Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 

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