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.
 
 
 
 

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