AI销管
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

684 lines
16 KiB

  1. <script>
  2. import Vue from 'vue';
  3. const domainObj = require('./utils/domain.js');
  4. //app.js
  5. var config = require("./config");
  6. export default {
  7. onLaunch(options) {
  8. uni.$on('sendStayTime', (data) => {
  9. this.getTimeChecks(data)
  10. })
  11. this.setTabbarItems() // 设置tabbar
  12. // 获取用户信息
  13. uni.getSystemInfo({
  14. success: function(e) {
  15. console.log(e, 'phoneInfo')
  16. // #ifdef MP-WEIXIN
  17. Vue.prototype.StatusBar = e.statusBarHeight;
  18. let custom = wx.getMenuButtonBoundingClientRect();
  19. Vue.prototype.Custom = custom;
  20. Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
  21. Vue.prototype.windowHeight = e.safeArea.height
  22. // #endif
  23. Vue.mixin({
  24. data() {
  25. return {
  26. StatusBar: Vue.prototype.StatusBar,
  27. CustomBar: Vue.prototype.CustomBar,
  28. windowHeight: Vue.prototype.windowHeight,
  29. LOADING: false,
  30. bulidIngObj: uni.getStorageSync('buildingID'),
  31. };
  32. },
  33. onLoad() {
  34. this.setTabbarItems()
  35. },
  36. methods: {
  37. // 设置底部导航栏
  38. setTabbarItems() {
  39. const tabbarList = [{
  40. iconPath: "/static/images/tabBar/jiedais.png",
  41. selectedIconPath: "/static/images/tabBar/jiedaiActives.png",
  42. text: "接待"
  43. },
  44. {
  45. iconPath: "/static/images/tabBar/kehus.png",
  46. selectedIconPath: "/static/images/tabBar/kehuActives.png",
  47. text: "客户"
  48. },
  49. {
  50. iconPath: "/static/images/tabBar/works.png",
  51. selectedIconPath: "/static/images/tabBar/workActives.png",
  52. text: "工作台"
  53. },
  54. {
  55. iconPath: "/static/images/tabBar/xuexis.png",
  56. selectedIconPath: "/static/images/tabBar/xuexiActives.png",
  57. text: "学习"
  58. },
  59. {
  60. iconPath: "/static/images/tabBar/mes.png",
  61. selectedIconPath: "/static/images/tabBar/meActives.png",
  62. text: "我的"
  63. }
  64. ]
  65. if (domainObj.domain == 'zh.aihxz.com') {
  66. tabbarList.forEach((item, index) => {
  67. uni.setTabBarItem({
  68. index: index,
  69. iconPath: item.iconPath,
  70. selectedIconPath: item.selectedIconPath
  71. })
  72. })
  73. }
  74. },
  75. //实时统计
  76. getTabBarBadge() {
  77. uni.request({
  78. url: config.service.realTimeStatistics,
  79. method: "POST",
  80. header: {
  81. 'content-type': 'application/json',
  82. 'Authorization': 'Bearer ' + uni.getStorageSync(
  83. 'weapp_session_login_data').token
  84. },
  85. data: {
  86. houseId: uni.getStorageSync('buildingID').id
  87. },
  88. success: (data) => {
  89. if (data.data.data == null) {
  90. uni.removeTabBarBadge({
  91. index: 0,
  92. })
  93. return
  94. } else {
  95. uni.removeTabBarBadge({
  96. index: 0,
  97. })
  98. if (data.data.data.receivingCustomer > 0) {
  99. uni.setTabBarBadge({
  100. index: 0,
  101. text: `${data.data.data.receivingCustomer}`
  102. })
  103. }
  104. }
  105. },
  106. fail: () => {
  107. uni.removeTabBarBadge({
  108. index: 0,
  109. })
  110. }
  111. })
  112. },
  113. upDateBulidIngObj() {
  114. this.bulidIngObj = uni.getStorageSync('buildingID')
  115. },
  116. addLookingCount(id) {
  117. uni.request({
  118. url: config.service.addLookingCount,
  119. method: "POST",
  120. header: {
  121. 'content-type': 'application/json',
  122. 'Authorization': 'Bearer ' + uni.getStorageSync(
  123. 'weapp_session_login_data').token
  124. },
  125. data: {
  126. houseId: uni.getStorageSync(
  127. 'buildingID').id,
  128. houseName: uni.getStorageSync(
  129. 'buildingID').name,
  130. recordId: id
  131. },
  132. })
  133. },
  134. sendLog(data) {
  135. uni.request({
  136. url: config.service.addLog,
  137. method: "POST",
  138. header: {
  139. 'content-type': 'application/json',
  140. 'Authorization': 'Bearer ' + uni.getStorageSync(
  141. 'weapp_session_login_data').token
  142. },
  143. data: {
  144. houseId: data.houseId || uni.getStorageSync(
  145. 'buildingID').id,
  146. houseName: data.houseName || uni.getStorageSync(
  147. 'buildingID').name,
  148. serviceId: "test",
  149. recordId: data.id
  150. },
  151. success: (data) => {}
  152. })
  153. },
  154. // 时分秒转换为秒
  155. TIMEEVENT(e) {
  156. var time = e;
  157. var len = time.split(':')
  158. if (len.length == 3) {
  159. var hour = time.split(':')[0];
  160. var min = time.split(':')[1];
  161. var sec = time.split(':')[2];
  162. return Number(hour * 3600) + Number(min * 60) + Number(sec);
  163. }
  164. if (len.length == 2) {
  165. var min = time.split(':')[0];
  166. var sec = time.split(':')[1];
  167. return Number(min * 60) + Number(sec);
  168. }
  169. if (len.length == 1) {
  170. var sec = time.split(':')[0];
  171. return Number(sec);
  172. }
  173. },
  174. // 目前使用页面为录音页面
  175. SPEAKERSTYLE(index) {
  176. let obj = {
  177. color: '',
  178. }
  179. switch (index) {
  180. case 1:
  181. obj.color = '#60CBEC';
  182. break;
  183. case 2:
  184. obj.color = '#EC8B47';
  185. break;
  186. case 3:
  187. obj.color = '#4F861E';
  188. break;
  189. case 5:
  190. obj.color = '#4980C8';
  191. break;
  192. case 6:
  193. obj.color = '#60CBEC';
  194. break;
  195. case 7:
  196. obj.color = '#EC8B47';
  197. break;
  198. case 8:
  199. obj.color = '#4F861E';
  200. break;
  201. default:
  202. obj.color = '#9F61C8';
  203. break;
  204. }
  205. return obj
  206. },
  207. // 检测权限 返回 Boolean类型
  208. CHECKAUTHORITY(name = '') {
  209. let menu = uni.getStorageSync('weapp_session_Menu_data')
  210. return menu[name] === undefined ? false : menu[name]
  211. },
  212. },
  213. filters: {
  214. // ASCII码转换 大写字母A是65 演讲人是从1开始所以num+64
  215. toCapital(num) {
  216. let str = ''
  217. if (num) {
  218. str = String.fromCharCode(num + 64)
  219. }
  220. return str
  221. }
  222. }
  223. });
  224. }
  225. });
  226. // 新版本更新
  227. if (wx.canIUse('getUpdateManager')) {
  228. const updateManager = wx.getUpdateManager()
  229. updateManager.onCheckForUpdate(function(res) {
  230. if (res.hasUpdate) {
  231. updateManager.onUpdateReady(function() {
  232. uni.showModal({
  233. title: '更新提示',
  234. cancelColor: "#999999",
  235. content: '新版本已经准备好,是否重启应用?',
  236. success: function(res) {
  237. if (res.confirm) {
  238. updateManager.applyUpdate()
  239. }
  240. }
  241. })
  242. })
  243. updateManager.onUpdateFailed(function() {
  244. uni.showModal({
  245. title: '已经有新版本了哟~',
  246. cancelColor: "#999999",
  247. content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~'
  248. })
  249. })
  250. }
  251. })
  252. } else {
  253. uni.showModal({
  254. title: '提示',
  255. cancelColor: "#999999",
  256. content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
  257. })
  258. }
  259. // 判断token
  260. const token = uni.getStorageSync("weapp_session_login_data")
  261. if (typeof token.token != "string") {
  262. return
  263. }
  264. uni.request({
  265. url: config.service.getUser,
  266. method: "GET",
  267. header: {
  268. 'content-type': 'application/json',
  269. 'Authorization': 'Bearer ' + uni.getStorageSync('weapp_session_login_data').token
  270. },
  271. success: (res) => {
  272. let rescor = res.data.data;
  273. // return
  274. if (res.statusCode == 401) {
  275. uni.showToast({
  276. title: '登录过期请重新登录',
  277. icon: "none",
  278. duration: 2000,
  279. })
  280. uni.navigateTo({
  281. url: `/pages/login/index`
  282. })
  283. return
  284. }
  285. if (rescor.user.total == 0) {
  286. uni.showToast({
  287. title: '暂无绑定项目',
  288. duration: 2000,
  289. icon: "none"
  290. });
  291. return
  292. } else {
  293. let lopan = {
  294. id: rescor.houseList[0].id,
  295. name: rescor.houseList[0].propertyName
  296. }
  297. let users = rescor.user
  298. users.zkProperties = rescor.houseList
  299. uni.setStorageSync("weapp_session_userInfo_data", users); //写入缓存
  300. }
  301. }
  302. })
  303. this.$u.get(config.service.notReadNum, {
  304. id: uni.getStorageSync('weapp_session_userInfo_data').accountId,
  305. projectId: uni.getStorageSync('buildingID').id
  306. }).then(res => {
  307. if (res > 0) {
  308. uni.setTabBarBadge({ //显示数字
  309. index: 4, //tabbar下标
  310. text: res || 0 //数字
  311. })
  312. } else {
  313. uni.removeTabBarBadge({
  314. index: 4
  315. })
  316. }
  317. }).catch(e => {
  318. uni.removeTabBarBadge({
  319. index: 4
  320. })
  321. })
  322. wx.setInnerAudioOption({
  323. obeyMuteSwitch: false
  324. });
  325. },
  326. onShow(options) {
  327. const token = uni.getStorageSync("weapp_session_login_data")
  328. if (typeof token.token != "string") {
  329. return
  330. } else {}
  331. // 中途杀死进程退出小程序后重新进入需要重新提交
  332. if (uni.getStorageSync('StayTimeDetails2-star') && uni.getStorageSync(
  333. 'StayTimeDetails2-end') && uni.getStorageSync('StayTimeDetails2-watch')) {
  334. this.getTimeChecks(uni.getStorageSync('StayTimeDetails2-watch'))
  335. }
  336. },
  337. onHide() {},
  338. methods: {
  339. // 纪录当前停留时间details2页面
  340. getTimeChecks(data) {
  341. console.log('sendStayTime', data)
  342. let [a, b] = [uni.getStorageSync('StayTimeDetails2-star'), uni.getStorageSync(
  343. 'StayTimeDetails2-end')]
  344. let time = (Number(b) - Number(a)) / 1000 / 60
  345. this.$u.post('/customer/getCheckTheTime', {
  346. cusId: data, //接待id
  347. standingTime: time //停留时间
  348. }).then(res => {
  349. uni.removeStorageSync('StayTimeDetails2-star')
  350. uni.removeStorageSync('StayTimeDetails2-end')
  351. uni.removeStorageSync('StayTimeDetails2-watch')
  352. }).catch(() => {
  353. uni.removeStorageSync('StayTimeDetails2-star')
  354. uni.removeStorageSync('StayTimeDetails2-end')
  355. uni.removeStorageSync('StayTimeDetails2-watch')
  356. })
  357. },
  358. // 设置底部导航栏
  359. setTabbarItems() {
  360. const tabbarList = [{
  361. iconPath: "/static/images/tabBar/jiedais.png",
  362. selectedIconPath: "/static/images/tabBar/jiedaiActives.png",
  363. text: "接待"
  364. },
  365. {
  366. iconPath: "/static/images/tabBar/kehus.png",
  367. selectedIconPath: "/static/images/tabBar/kehuActives.png",
  368. text: "客户"
  369. },
  370. {
  371. iconPath: "/static/images/tabBar/works.png",
  372. selectedIconPath: "/static/images/tabBar/workActives.png",
  373. text: "工作台"
  374. },
  375. {
  376. iconPath: "/static/images/tabBar/xuexis.png",
  377. selectedIconPath: "/static/images/tabBar/xuexiActives.png",
  378. text: "学习"
  379. },
  380. {
  381. iconPath: "/static/images/tabBar/mes.png",
  382. selectedIconPath: "/static/images/tabBar/meActives.png",
  383. text: "我的"
  384. }
  385. ]
  386. if (domainObj.domain == 'zh.aihxz.com') {
  387. tabbarList.forEach((item, index) => {
  388. uni.setTabBarItem({
  389. index: index,
  390. iconPath: item.iconPath,
  391. selectedIconPath: item.selectedIconPath
  392. })
  393. })
  394. }
  395. }
  396. }
  397. };
  398. </script>
  399. <style>
  400. @import "./app.css";
  401. </style>
  402. <style lang="scss">
  403. @import "uview-ui/index.scss";
  404. /*每个页面公共css */
  405. //图表样式等
  406. .single {
  407. width: 100%;
  408. background: #FFFFFF;
  409. .title {
  410. width: 100%;
  411. height: 80rpx;
  412. display: flex;
  413. align-items: center;
  414. .title1 {
  415. flex: 2;
  416. font-size: 30rpx;
  417. font-weight: 500;
  418. color: #333333;
  419. line-height: 80rpx;
  420. padding-left: 30rpx;
  421. font-family: PingFangSC-Medium, PingFang SC;
  422. }
  423. .title3 {
  424. flex: 3;
  425. height: 90rpx;
  426. display: flex;
  427. align-items: center;
  428. justify-content: flex-end;
  429. padding-right: 30rpx;
  430. .title3-box {
  431. display: flex;
  432. align-items: center;
  433. width: 25%;
  434. justify-content: center;
  435. .activecltab {
  436. color: #2671E2;
  437. border-bottom: 4rpx solid #2671E2;
  438. }
  439. }
  440. }
  441. .title2 {
  442. flex: 2;
  443. display: flex;
  444. justify-content: flex-end;
  445. align-items: center;
  446. height: 42rpx;
  447. font-size: 30rpx;
  448. font-family: PingFangSC-Regular, PingFang SC;
  449. font-weight: 400;
  450. color: #333333;
  451. line-height: 42rpx;
  452. margin-right: 30rpx;
  453. .righttochoose {
  454. width: 24rpx;
  455. height: 12rpx;
  456. margin-left: 12rpx;
  457. }
  458. }
  459. }
  460. .swiper-box {
  461. width: 97%;
  462. margin: 0 auto 26rpx;
  463. }
  464. .hejibox {
  465. width: 100%;
  466. height: 80rpx;
  467. display: flex;
  468. .heji {
  469. width: 50%;
  470. height: 100%;
  471. font-size: 28rpx;
  472. font-weight: 400;
  473. color: #666666;
  474. line-height: 80rpx;
  475. text-indent: 30rpx;
  476. }
  477. }
  478. .danwei {
  479. width: 100%;
  480. height: 40rpx;
  481. font-size: 24rpx;
  482. font-weight: 400;
  483. color: #999999;
  484. line-height: 40rpx;
  485. text-indent: 30rpx;
  486. }
  487. .uchaserbox {
  488. width: 95%;
  489. height: 470rpx;
  490. }
  491. .jindu {
  492. width: 100%;
  493. min-height: 400rpx;
  494. .jindu-box {
  495. width: 100%;
  496. padding: 0 30rpx;
  497. .jindu-boxche {
  498. width: 100%;
  499. height: 40rpx;
  500. display: flex;
  501. align-items: center;
  502. margin-bottom: 38rpx;
  503. .jindu-name {
  504. width: 120rpx;
  505. font-size: 28rpx;
  506. font-family: PingFangSC-Regular, PingFang SC;
  507. font-weight: 400;
  508. color: #333333;
  509. line-height: 40rpx;
  510. }
  511. .progress-cus {
  512. flex: 1;
  513. height: 30rpx;
  514. margin-left: 10rpx;
  515. background: #F0F1F2;
  516. .color {
  517. height: 30rpx;
  518. background: linear-gradient(90deg, #3A82EF 0%, #7EB2FF 100%);
  519. }
  520. .color4 {
  521. height: 30rpx;
  522. background: linear-gradient(270deg, #6DC5B8 0%, #07B79D 100%);
  523. }
  524. .color1 {
  525. height: 30rpx;
  526. background: linear-gradient(270deg, #F88881 0%, #E6625B 100%); //1
  527. }
  528. .color2 {
  529. height: 30rpx;
  530. background: linear-gradient(270deg, #FFC940 0%, #FF981E 100%); //2
  531. }
  532. .color3 {
  533. height: 30rpx;
  534. background: linear-gradient(270deg, #FFE800 0%, #FFCC00 100%); //3
  535. }
  536. }
  537. .jindu-zxl {
  538. width: 120rpx;
  539. font-size: 28rpx;
  540. margin-left: 12rpx;
  541. color: #333;
  542. text-align: left;
  543. line-height: 40rpx;
  544. }
  545. }
  546. }
  547. }
  548. }
  549. //时间切换的样式
  550. .boxtittab {
  551. width: 100;
  552. height: 92rpx;
  553. background: #FFFFFF;
  554. display: flex;
  555. align-items: center;
  556. .tabbox {
  557. flex: 1;
  558. height: 100%;
  559. text-align: center;
  560. line-height: 92rpx;
  561. color: #666666;
  562. font-size: 28rpx;
  563. font-weight: 400;
  564. display: flex;
  565. justify-content: center;
  566. .activecllasscet {
  567. width: 96rpx;
  568. color: #2671E2;
  569. font-weight: 600;
  570. border-bottom: 4rpx solid #2671E2;
  571. }
  572. }
  573. }
  574. //多个格子的样式
  575. .boxzonglan {
  576. width: 100%;
  577. min-height: 496rpx;
  578. background: #FFFFFF;
  579. padding: 30rpx 30rpx 30rpx 30rpx;
  580. .zonglantit {
  581. font-size: 30rpx;
  582. color: #333333;
  583. font-family: PingFangSC-Semibold, PingFang SC;
  584. font-weight: 500;
  585. }
  586. .zonglanbox {
  587. width: 100%;
  588. display: flex;
  589. flex-wrap: wrap;
  590. margin-top: 24rpx;
  591. box-shadow: 0px 0px 12rpx 0px rgba(38, 113, 226, 0.1);
  592. border-radius: 12rpx;
  593. .grid {
  594. width: 50%;
  595. // height: 128rpx;
  596. padding-bottom: 24rpx;
  597. // border: 1rpx solid #E0E0E0;
  598. .audonum {
  599. color: #666666;
  600. text-indent: 40rpx;
  601. font-size: 28rpx;
  602. margin-top: 20rpx;
  603. line-height: 40rpx;
  604. display: flex;
  605. align-items: center;
  606. .circle {
  607. width: 20rpx;
  608. height: 20rpx;
  609. background: #FFFFFF;
  610. border: 6rpx solid #2671E2;
  611. margin-right: 12rpx;
  612. margin-left: 30rpx;
  613. border-radius: 50%;
  614. }
  615. }
  616. .num {
  617. color: #333333;
  618. text-indent: 40rpx;
  619. font-size: 44rpx;
  620. font-weight: 600;
  621. line-height: 50rpx;
  622. margin-top: 18rpx;
  623. }
  624. }
  625. }
  626. }
  627. </style>