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

588 lines
13 KiB

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