App.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  1. <template>
  2. <div id="app">
  3. <keep-alive>
  4. <router-view v-if="$route.meta.keepAlive" />
  5. </keep-alive>
  6. <router-view v-if="!$route.meta.keepAlive" />
  7. </div>
  8. </template>
  9. <script>
  10. import {
  11. mapMutations,
  12. } from "vuex";
  13. import wx from "weixin-js-sdk";
  14. import {
  15. empdetail
  16. } from "@/api/user/user";
  17. import {
  18. haveOutCall
  19. } from "@/api/index/crm";
  20. import {
  21. getAgentName
  22. } from "@/api/broker/index.js";
  23. import * as api from "@/api/user/user.js";
  24. export default {
  25. name: "App",
  26. data() {
  27. return {};
  28. },
  29. created() {
  30. var that = this;
  31. var hrefList = that.getQueryStringArgs(window.location.href);
  32. if (!!hrefList.token) {
  33. that.setToken(hrefList.token);
  34. if (!hrefList.btype) {
  35. this.userfun();
  36. this.getCallOutSystem();
  37. }
  38. this.$nextTick(() => {
  39. this.getAgentName();
  40. })
  41. }
  42. that.setclientype(hrefList.client_type);
  43. let str = window.location.hash.split("?")[0].split("#/")[1];
  44. if (!!hrefList.empid) {
  45. that.setempid(hrefList.empid);
  46. }
  47. if (!!hrefList.platform) {
  48. this.setplatform(hrefList.platform);
  49. }
  50. },
  51. methods: {
  52. ...mapMutations([
  53. "setToken",
  54. "setclientype",
  55. "setempid",
  56. "setpersonObj",
  57. "setplatform",
  58. "setAgentName",
  59. "setOutCallSystem"
  60. ]),
  61. //处理链接携带的参数
  62. getQueryStringArgs: function(url) {
  63. url = url == null ? window.location.href : url;
  64. var search = url.substring(url.lastIndexOf("?") + 1);
  65. var obj = {};
  66. var reg = /([^?&=]+)=([^?&=]*)/g;
  67. search.replace(reg, function(rs, $1, $2) {
  68. var name = decodeURIComponent($1);
  69. var val = decodeURIComponent($2);
  70. val = String(val);
  71. obj[name] = val;
  72. return rs;
  73. });
  74. return obj;
  75. },
  76. //获取装修推荐官自定义名称
  77. getAgentName() {
  78. getAgentName({}).then(res => {
  79. if (res.data.code == 0) {
  80. this.setAgentName(res.data.name);
  81. }
  82. })
  83. },
  84. getCallOutSystem() {
  85. haveOutCall({}).then(res => {
  86. if (res.data.code == 0) {
  87. this.setOutCallSystem(res.data.data);
  88. }
  89. })
  90. },
  91. //获取员工用户信息
  92. userfun() {
  93. const that = this;
  94. let data = {
  95. alertshow: 1,
  96. };
  97. empdetail(data).then((res) => {
  98. if (res.data.code == 0 || res.data.code == 601) {
  99. that.setpersonObj(res.data.data);
  100. that.setempid(res.data.data.id);
  101. this.setWXChatConfig();
  102. }
  103. });
  104. },
  105. /**
  106. * 配置微信JSDK
  107. * */
  108. setWXChatConfig() {
  109. let url = location.href.split("#")[0];
  110. api.getwxticket({
  111. url: url,
  112. alertshow: 1,
  113. })
  114. .then((res) => {
  115. wx.config({
  116. debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  117. appId: res.data.data.appid, // 必填,公众号的唯一标识
  118. timestamp: res.data.data.timestamp, // 必填,生成签名的时间戳
  119. nonceStr: res.data.data.noncestr, // 必填,生成签名的随机串
  120. signature: res.data.data.sign, // 必填,签名
  121. jsApiList: ["chooseImage", "uploadImage", "getLocalImgData","scanQRCode"], // 必填,需要使用的JS接口列表
  122. });
  123. wx.ready(function() {});
  124. });
  125. },
  126. },
  127. };
  128. </script>
  129. <style lang="less">
  130. @import "./styles/base.css";
  131. #app {
  132. width: 100vw;
  133. height: 100vh !important;
  134. max-width: 800px;
  135. /*no*/
  136. margin: 0 auto;
  137. font-family: PingFangSC-Regular, PingFang SC;
  138. }
  139. .block_content {
  140. p {
  141. width: 100% !important;
  142. max-height: none !important;
  143. img {
  144. width: 100% !important;
  145. height: auto !important;
  146. margin: 0px !important;
  147. padding: 0px !important;
  148. display: block;
  149. }
  150. }
  151. }
  152. .ellipsis {
  153. text-overflow: ellipsis;
  154. white-space: nowrap;
  155. overflow: hidden;
  156. }
  157. .bgbox {
  158. width: 100%;
  159. height: 16px;
  160. background: #eaf0f4;
  161. }
  162. .layBox {
  163. position: fixed;
  164. top: 0;
  165. left: 0;
  166. width: 100%;
  167. height: 100%;
  168. z-index: 99999;
  169. background-color: rgba(0, 0, 0, 0.5);
  170. }
  171. .layBox .van-loading {
  172. top: 40%;
  173. }
  174. .layBox .van-loading__text {
  175. color: #fff;
  176. }
  177. .lhr40 {
  178. line-height: 40px;
  179. }
  180. .loadmiddle {
  181. div {
  182. width: 30px;
  183. height: 50px;
  184. border-radius: 15px;
  185. margin-right: 16px;
  186. position: relative;
  187. // top: -30px;
  188. }
  189. div:last-child {
  190. margin-right: 0;
  191. }
  192. div.firstbox {
  193. height: 50px;
  194. animation: mymove 1.2s infinite; //1.2
  195. -webkit-animation: mymove 1.2s infinite;
  196. /* Safari 和 Chrome */
  197. }
  198. div.secondbox {
  199. height: 80px;
  200. animation: mymove1 1.2s infinite; //1.2
  201. -webkit-animation: mymove1 1.2s infinite;
  202. /* Safari 和 Chrome */
  203. }
  204. div.thirdbox {
  205. height: 110px;
  206. animation: mymove2 1.2s infinite;
  207. -webkit-animation: mymove2 1.2s infinite;
  208. /* Safari 和 Chrome */
  209. }
  210. }
  211. .loadmiddle {
  212. display: flex;
  213. justify-content: center;
  214. align-items: flex-end;
  215. height: 150px;
  216. flex-direction: row;
  217. position: relative;
  218. top: 0;
  219. animation: movetop 1.2s infinite;
  220. -webkit-animation: movetop 1.2s infinite;
  221. /* Safari 和 Chrome */
  222. }
  223. @keyframes movetop {
  224. 0% {
  225. top: 0;
  226. }
  227. 58% {
  228. top: 0;
  229. }
  230. 100% {
  231. top: -60px;
  232. }
  233. }
  234. .loadmiddle div {
  235. display: flex;
  236. flex-direction: column;
  237. justify-content: center;
  238. align-items: end;
  239. }
  240. .faceimg {
  241. display: block;
  242. width: 160px;
  243. height: 126px;
  244. margin: 0 auto 0;
  245. position: relative;
  246. top: -30px;
  247. z-index: 1;
  248. overflow: hidden;
  249. animation: myheight 1.2s infinite;
  250. -webkit-animation: myheight 1.2s infinite;
  251. /* Safari 和 Chrome */
  252. img {
  253. display: block;
  254. width: 100%;
  255. }
  256. }
  257. @keyframes myheight {
  258. 0% {
  259. height: 0px;
  260. top: -30px;
  261. }
  262. 58% {
  263. height: 0px;
  264. top: -30px;
  265. }
  266. 100% {
  267. height: 126px;
  268. top: -90px;
  269. }
  270. }
  271. @keyframes mymove {
  272. 0% {
  273. height: 50px;
  274. }
  275. 12.5% {
  276. height: 20px;
  277. }
  278. 25% {
  279. height: 50px;
  280. }
  281. 100% {
  282. height: 50px;
  283. }
  284. }
  285. @keyframes mymove1 {
  286. 0% {
  287. height: 80px;
  288. }
  289. 20.834% {
  290. height: 30px;
  291. }
  292. 41.7% {
  293. height: 80px;
  294. }
  295. 100% {
  296. height: 80px;
  297. }
  298. }
  299. @keyframes mymove2 {
  300. 0% {
  301. height: 110px;
  302. }
  303. 29.2% {
  304. height: 40px;
  305. }
  306. 58.3% {
  307. height: 110px;
  308. }
  309. 100% {
  310. height: 110px;
  311. }
  312. }
  313. .unfuturelayer {
  314. display: block;
  315. width: 100%;
  316. height: 100%;
  317. background-color: rgba(0, 0, 0, 0.16);
  318. position: fixed;
  319. top: 0;
  320. left: 0;
  321. z-index: 9999999;
  322. }
  323. .unfuturebox {
  324. display: block;
  325. width: 600px;
  326. height: 485px;
  327. position: fixed;
  328. top: 50%;
  329. left: 75px;
  330. transform: translateY(-50%);
  331. background-color: #fff;
  332. box-shadow: 0px 6px 26px rgba(0, 0, 0, 0.16);
  333. border-radius: 8px;
  334. }
  335. .unfuturebox img {
  336. display: block;
  337. width: 470px;
  338. height: 405px;
  339. margin: 40px auto;
  340. }
  341. </style>