AI销管
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

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