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.
 
 
 

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