Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 

436 wiersze
9.1 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. // #ifdef MP-WEIXIN
  10. Vue.prototype.StatusBar = e.statusBarHeight;
  11. let custom = wx.getMenuButtonBoundingClientRect();
  12. Vue.prototype.Custom = custom;
  13. Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
  14. Vue.prototype.windowHeight = e.safeArea.height
  15. // #endif
  16. Vue.mixin({
  17. data() {
  18. return {
  19. StatusBar: Vue.prototype.StatusBar,
  20. CustomBar: Vue.prototype.CustomBar,
  21. windowHeight: Vue.prototype.windowHeight,
  22. LOADING: false
  23. };
  24. },
  25. methods: {
  26. addLookingCount() {
  27. this.$u.post('/user/addLookingCount', { house: uni.getStorageSync('buildingID').id })
  28. },
  29. // 时分秒转换为秒
  30. TIMEEVENT(e) {
  31. var time = e;
  32. var len = time.split(':')
  33. if (len.length == 3) {
  34. var hour = time.split(':')[0];
  35. var min = time.split(':')[1];
  36. var sec = time.split(':')[2];
  37. return Number(hour * 3600) + Number(min * 60) + Number(sec);
  38. }
  39. if (len.length == 2) {
  40. var min = time.split(':')[0];
  41. var sec = time.split(':')[1];
  42. return Number(min * 60) + Number(sec);
  43. }
  44. if (len.length == 1) {
  45. var sec = time.split(':')[0];
  46. return Number(sec);
  47. }
  48. },
  49. // 目前使用页面为录音页面
  50. SPEAKERSTYLE(index) {
  51. let obj = {
  52. color: '',
  53. }
  54. switch (index) {
  55. case 1:
  56. obj.color = '#60CBEC';
  57. break;
  58. case 2:
  59. obj.color = '#EC8B47';
  60. break;
  61. case 3:
  62. obj.color = '#4F861E';
  63. break;
  64. case 5:
  65. obj.color = '#4980C8';
  66. break;
  67. case 6:
  68. obj.color = '#60CBEC';
  69. break;
  70. case 7:
  71. obj.color = '#EC8B47';
  72. break;
  73. case 8:
  74. obj.color = '#4F861E';
  75. break;
  76. default:
  77. obj.color = '#9F61C8';
  78. break;
  79. }
  80. return obj
  81. },
  82. // 检测权限
  83. checkAuthority(name = '') {
  84. let menu = uni.getStorageSync('weapp_session_Menu_data')
  85. return menu.findIndex(item => item.name == name) != -1
  86. },
  87. },
  88. filters: {
  89. // ASCII码转换 大写字母A是65 演讲人是从1开始所以num+64
  90. toCapital(num) {
  91. let str = ''
  92. str = String.fromCharCode(Number(num) + 64)
  93. return str
  94. },
  95. }
  96. });
  97. }
  98. });
  99. if (wx.canIUse('getUpdateManager')) {
  100. const updateManager = wx.getUpdateManager()
  101. updateManager.onCheckForUpdate(function(res) {
  102. if (res.hasUpdate) {
  103. updateManager.onUpdateReady(function() {
  104. uni.showModal({
  105. title: '更新提示',
  106. cancelColor: "#999999",
  107. content: '新版本已经准备好,是否重启应用?',
  108. success: function(res) {
  109. if (res.confirm) {
  110. updateManager.applyUpdate()
  111. }
  112. }
  113. })
  114. })
  115. updateManager.onUpdateFailed(function() {
  116. uni.showModal({
  117. title: '已经有新版本了哟~',
  118. cancelColor: "#999999",
  119. content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~'
  120. })
  121. })
  122. }
  123. })
  124. } else {
  125. uni.showModal({
  126. title: '提示',
  127. cancelColor: "#999999",
  128. content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
  129. })
  130. }
  131. const token = uni.getStorageSync("weapp_session_login_data")
  132. if (typeof token.token != "string") {
  133. return
  134. }
  135. this.$u.get("/user/getUser").then(data => {
  136. uni.setStorageSync("weapp_session_userInfo_data", data)
  137. })
  138. this.$u.get("/user/getMenu").then(data => {
  139. uni.setStorageSync("weapp_session_Menu_data", data)
  140. })
  141. wx.setInnerAudioOption({
  142. obeyMuteSwitch: false
  143. });
  144. },
  145. onShow(options) {
  146. const token = uni.getStorageSync("weapp_session_login_data")
  147. if (typeof token.token != "string") {
  148. console.log("没有")
  149. return
  150. } else {
  151. this.infoscoket()
  152. }
  153. },
  154. onHide() {},
  155. methods: {
  156. infoscoket() {
  157. let pushon = uni.getStorageSync('weapp_session_userInfo_data').loginName
  158. uni.connectSocket({
  159. url: 'wss://hfju.com/ws?uid=' + pushon + '_applets',
  160. header: {
  161. "content-type": "application/json",
  162. 'Access-Token': uni.getStorageSync('weapp_session_login_data').token
  163. }
  164. });
  165. uni.onSocketOpen(function(res) {
  166. console.log('WebSocket连接已打开!');
  167. });
  168. uni.onSocketError(function(res) {
  169. console.log('WebSocket连接打开失败,请检查!');
  170. });
  171. uni.onSocketMessage(function(res) {
  172. console.log('收到服务器内容:' + res.data);
  173. let cedata = JSON.stringify(res);
  174. let data = JSON.parse(cedata);
  175. let zdata = JSON.parse(data.data)
  176. if (zdata.to == "recCmd") {
  177. uni.$emit('update', {
  178. msg: '页面更新'
  179. })
  180. return
  181. }
  182. uni.showModal({
  183. title: '提示',
  184. content: zdata.to + '的设备电量过低请检查!',
  185. cancelText: "取消", // 取消按钮的文字
  186. confirmText: "查看", // 确认按钮文字
  187. success: function(res) {
  188. if (res.confirm) {
  189. console.log('用户点击确定');
  190. uni.navigateTo({
  191. url: `/pages/main/toviewtherecording/index?jump=` + "jump"
  192. })
  193. } else if (res.cancel) {
  194. console.log('用户点击取消');
  195. }
  196. }
  197. });
  198. });
  199. },
  200. Closewebsocke() {
  201. uni.closeSocket();
  202. uni.onSocketClose(function(res) {
  203. console.log('WebSocket 已关闭!');
  204. });
  205. },
  206. }
  207. };
  208. </script>
  209. <style>
  210. @import "./app.css";
  211. </style>
  212. <style lang="scss">
  213. @import "uview-ui/index.scss";
  214. /*每个页面公共css */
  215. //图表样式等
  216. .single {
  217. width: 100%;
  218. background: #FFFFFF;
  219. .title {
  220. width: 100%;
  221. height: 90rpx;
  222. border-bottom: 1rpx solid #E0E0E0;
  223. display: flex;
  224. .title1 {
  225. flex: 2;
  226. font-size: 30rpx;
  227. font-weight: 600;
  228. color: #333333;
  229. line-height: 90rpx;
  230. text-indent: 30rpx;
  231. }
  232. .title3 {
  233. flex: 3;
  234. height: 90rpx;
  235. display: flex;
  236. align-items: center;
  237. justify-content: flex-end;
  238. .title3-box {
  239. display: flex;
  240. align-items: center;
  241. width: 25%;
  242. justify-content: center;
  243. .activecltab {
  244. border-bottom: 2px solid #2671E2;
  245. }
  246. }
  247. }
  248. .title2 {
  249. flex: 3;
  250. height: 90rpx;
  251. display: flex;
  252. align-items: center;
  253. .title2-che {
  254. width: 178rpx;
  255. height: 48rpx;
  256. background: #FFFFFF;
  257. border-radius: 6rpx;
  258. border: 1px solid #E0E0E0;
  259. line-height: 48rpx;
  260. font-size: 28rpx;
  261. font-weight: 400;
  262. color: #666666;
  263. text-indent: 12rpx;
  264. margin-left: 35rpx;
  265. position: relative;
  266. .righttochoose {
  267. width: 18rpx;
  268. height: 24rpx;
  269. position: absolute;
  270. top: 12rpx;
  271. right: 12rpx;
  272. }
  273. }
  274. }
  275. }
  276. .swiper-box {
  277. width: 97%;
  278. margin: 0 auto;
  279. }
  280. .hejibox {
  281. width: 100%;
  282. height: 80rpx;
  283. display: flex;
  284. .heji {
  285. width: 50%;
  286. height: 100%;
  287. font-size: 28rpx;
  288. font-weight: 400;
  289. color: #666666;
  290. line-height: 80rpx;
  291. text-indent: 30rpx;
  292. }
  293. }
  294. .danwei {
  295. width: 100%;
  296. height: 40rpx;
  297. font-size: 24rpx;
  298. font-weight: 400;
  299. color: #999999;
  300. line-height: 40rpx;
  301. text-indent: 30rpx;
  302. }
  303. .uchaserbox {
  304. width: 95%;
  305. height: 470rpx;
  306. }
  307. .jindu {
  308. width: 100%;
  309. height: 300rpx;
  310. .jindu-box {
  311. width: 100%;
  312. padding-left: 30rpx;
  313. padding-right: 30rpx;
  314. .jindu-boxche {
  315. width: 100%;
  316. height: 46rpx;
  317. display: flex;
  318. align-items: center;
  319. height: 50rpx;
  320. .jindu-name {
  321. width: 120rpx;
  322. font-size: 28rpx;
  323. color: #666666;
  324. }
  325. .jindu-zxl {
  326. width: 120rpx;
  327. font-size: 26rpx;
  328. margin-left: 16rpx;
  329. color: #666666;
  330. text-align: center;
  331. }
  332. }
  333. }
  334. }
  335. }
  336. //时间切换的样式
  337. .boxtittab {
  338. width: 100;
  339. height: 92rpx;
  340. background: #FFFFFF;
  341. border: 1px solid #E0E0E0;
  342. display: flex;
  343. align-items: center;
  344. .tabbox {
  345. flex: 1;
  346. height: 100%;
  347. text-align: center;
  348. line-height: 92rpx;
  349. color: #666666;
  350. font-size: 28rpx;
  351. display: flex;
  352. justify-content: center;
  353. .activecllasscet {
  354. width: 96rpx;
  355. border-bottom: 2px solid #2671E2;
  356. }
  357. }
  358. }
  359. //多个格子的样式
  360. .boxzonglan {
  361. width: 100%;
  362. min-height: 496rpx;
  363. background: #FFFFFF;
  364. padding: 30rpx 30rpx 30rpx 30rpx;
  365. .zonglantit {
  366. font-size: 30rpx;
  367. color: #333333;
  368. font-family: PingFangSC-Semibold, PingFang SC;
  369. font-weight: 600;
  370. }
  371. .zonglanbox {
  372. width: 100%;
  373. display: flex;
  374. flex-wrap: wrap;
  375. margin-top: 24rpx;
  376. .grid {
  377. width: 50%;
  378. height: 128rpx;
  379. border: 1px solid #E0E0E0;
  380. .audonum {
  381. color: #666666;
  382. text-indent: 40rpx;
  383. font-size: 26rpx;
  384. margin-top: 20rpx;
  385. }
  386. .num {
  387. color: #333333;
  388. text-indent: 40rpx;
  389. font-size: 32rpx;
  390. font-weight: 600;
  391. margin-top: 10rpx;
  392. }
  393. }
  394. }
  395. }
  396. </style>