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.
 
 
 
 

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