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.
 
 
 
 

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