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.
 
 
 
 

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