Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

307 linhas
6.6 KiB

  1. <template>
  2. <view>
  3. </view>
  4. </template>
  5. <script>
  6. //app.js
  7. var config = require("./config");
  8. export default {
  9. onLaunch: function(options) {
  10. if (wx.canIUse('getUpdateManager')) {
  11. const updateManager = wx.getUpdateManager()
  12. updateManager.onCheckForUpdate(function(res) {
  13. if (res.hasUpdate) {
  14. updateManager.onUpdateReady(function() {
  15. uni.showModal({
  16. title: '更新提示',
  17. cancelColor: "#999999",
  18. content: '新版本已经准备好,是否重启应用?',
  19. success: function(res) {
  20. if (res.confirm) {
  21. updateManager.applyUpdate()
  22. }
  23. }
  24. })
  25. })
  26. updateManager.onUpdateFailed(function() {
  27. uni.showModal({
  28. title: '已经有新版本了哟~',
  29. cancelColor: "#999999",
  30. content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~'
  31. })
  32. })
  33. }
  34. })
  35. } else {
  36. uni.showModal({
  37. title: '提示',
  38. cancelColor: "#999999",
  39. content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
  40. })
  41. }
  42. const token = uni.getStorageSync("weapp_session_login_data")
  43. if (typeof token.token != "string") {
  44. return
  45. }
  46. this.$u.get("/user/getUser").then(data => {
  47. uni.setStorageSync("weapp_session_userInfo_data", data)
  48. })
  49. wx.setInnerAudioOption({
  50. obeyMuteSwitch: false
  51. });
  52. },
  53. onShow(options) {
  54. const token = uni.getStorageSync("weapp_session_login_data")
  55. if (typeof token.token != "string") {
  56. console.log("没有")
  57. return
  58. }else{
  59. this.infoscoket()
  60. }
  61. },
  62. onHide() {},
  63. methods: {
  64. infoscoket(){
  65. let pushon=uni.getStorageSync('weapp_session_userInfo_data').loginName
  66. uni.connectSocket({
  67. url: 'wss://hfju.com/ws?uid='+pushon+'_applets',
  68. header: {
  69. "content-type": "application/json",
  70. 'Access-Token': uni.getStorageSync('weapp_session_login_data').token
  71. }
  72. });
  73. uni.onSocketOpen(function (res) {
  74. console.log('WebSocket连接已打开!');
  75. });
  76. uni.onSocketError(function (res) {
  77. console.log('WebSocket连接打开失败,请检查!');
  78. });
  79. uni.onSocketMessage(function (res) {
  80. console.log('收到服务器内容:' + res.data);
  81. let cedata=JSON.stringify(res);
  82. let data=JSON.parse(cedata);
  83. let zdata=JSON.parse(data.data)
  84. if(zdata.to=="recCmd"){
  85. uni.$emit('update',{msg:'页面更新'})
  86. return
  87. }
  88. uni.showModal({
  89. title: '提示',
  90. content: zdata.to+'的设备电量过低请检查!',
  91. cancelText: "取消", // 取消按钮的文字
  92. confirmText: "查看", // 确认按钮文字
  93. success: function (res) {
  94. if (res.confirm) {
  95. console.log('用户点击确定');
  96. uni.navigateTo({
  97. url: `/pages/main/toviewtherecording/index?jump=`+"jump"
  98. })
  99. } else if (res.cancel) {
  100. console.log('用户点击取消');
  101. }
  102. }
  103. });
  104. });
  105. },
  106. Closewebsocke(){
  107. uni.closeSocket();
  108. uni.onSocketClose(function (res) {
  109. console.log('WebSocket 已关闭!');
  110. });
  111. },
  112. }
  113. };
  114. </script>
  115. <style>
  116. @import "./app.css";
  117. </style>
  118. <style lang="scss">
  119. @import "uview-ui/index.scss";
  120. /*每个页面公共css */
  121. //图表样式等
  122. .single{
  123. width: 100%;
  124. background: #FFFFFF;
  125. .title{
  126. width: 100%;
  127. height: 90rpx;
  128. border-bottom: 1rpx solid #E0E0E0;
  129. display: flex;
  130. .title1{
  131. flex: 2;
  132. font-size: 30rpx;
  133. font-weight: 600;
  134. color: #333333;
  135. line-height: 90rpx;
  136. text-indent: 30rpx;
  137. }
  138. .title3{
  139. flex: 3;
  140. height: 90rpx;
  141. display: flex;
  142. align-items: center;
  143. justify-content: flex-end;
  144. .title3-box{
  145. display: flex;
  146. align-items: center;
  147. width: 25%;
  148. justify-content: center;
  149. .activecltab{
  150. border-bottom: 2px solid #2671E2;
  151. }
  152. }
  153. }
  154. .title2{
  155. flex: 3;
  156. height: 90rpx;
  157. display: flex;
  158. align-items: center;
  159. .title2-che{
  160. width: 178rpx;
  161. height: 48rpx;
  162. background: #FFFFFF;
  163. border-radius: 6rpx;
  164. border: 1px solid #E0E0E0;
  165. line-height: 48rpx;
  166. font-size: 28rpx;
  167. font-weight: 400;
  168. color: #666666;
  169. text-indent: 12rpx;
  170. margin-left: 35rpx;
  171. position: relative;
  172. .righttochoose{
  173. width: 18rpx;
  174. height: 24rpx;
  175. position: absolute;
  176. top: 12rpx;
  177. right: 12rpx;
  178. }
  179. }
  180. }
  181. }
  182. .swiper-box{
  183. width: 97%;
  184. margin: 0 auto;
  185. }
  186. .hejibox{
  187. width: 100%;
  188. height: 80rpx;
  189. display: flex;
  190. .heji{
  191. width: 50%;
  192. height: 100%;
  193. font-size: 28rpx;
  194. font-weight: 400;
  195. color: #666666;
  196. line-height: 80rpx;
  197. text-indent: 30rpx;
  198. }
  199. }
  200. .danwei{
  201. width: 100%;
  202. height: 40rpx;
  203. font-size: 24rpx;
  204. font-weight: 400;
  205. color: #999999;
  206. line-height: 40rpx;
  207. text-indent: 30rpx;
  208. }
  209. .uchaserbox{
  210. width: 100%;
  211. height: 470rpx;
  212. }
  213. .jindu{
  214. width: 100%;
  215. height: 300rpx;
  216. .jindu-box{
  217. width: 100%;
  218. padding-left: 30rpx;
  219. padding-right: 30rpx;
  220. .jindu-boxche{
  221. width: 100%;
  222. height: 46rpx;
  223. display: flex;
  224. align-items: center;
  225. height: 50rpx;
  226. .jindu-name{
  227. width: 120rpx;
  228. font-size: 28rpx;
  229. color: #666666;
  230. }
  231. .jindu-zxl{
  232. width: 120rpx;
  233. font-size: 26rpx;
  234. margin-left: 16rpx;
  235. color: #666666;
  236. text-align: center;
  237. }
  238. }
  239. }
  240. }
  241. }
  242. //时间切换的样式
  243. .boxtittab {
  244. width: 100;
  245. height: 92rpx;
  246. background: #FFFFFF;
  247. border: 1px solid #E0E0E0;
  248. display: flex;
  249. align-items: center;
  250. .tabbox {
  251. flex: 1;
  252. height: 100%;
  253. text-align: center;
  254. line-height: 92rpx;
  255. color: #666666;
  256. font-size: 28rpx;
  257. display: flex;
  258. justify-content: center;
  259. .activecllasscet {
  260. width: 96rpx;
  261. border-bottom: 2px solid #2671E2;
  262. }
  263. }
  264. }
  265. //多个格子的样式
  266. .boxzonglan {
  267. width: 100%;
  268. min-height: 496rpx;
  269. background: #FFFFFF;
  270. padding: 30rpx 30rpx 30rpx 30rpx;
  271. .zonglantit {
  272. font-size: 30rpx;
  273. color: #333333;
  274. font-family: PingFangSC-Semibold, PingFang SC;
  275. font-weight: 600;
  276. }
  277. .zonglanbox {
  278. width: 100%;
  279. display: flex;
  280. flex-wrap: wrap;
  281. margin-top: 24rpx;
  282. .grid {
  283. width: 50%;
  284. height: 128rpx;
  285. border: 1px solid #E0E0E0;
  286. .audonum {
  287. color: #666666;
  288. text-indent: 40rpx;
  289. font-size: 26rpx;
  290. margin-top: 20rpx;
  291. }
  292. .num {
  293. color: #333333;
  294. text-indent: 40rpx;
  295. font-size: 32rpx;
  296. font-weight: 600;
  297. margin-top: 10rpx;
  298. }
  299. }
  300. }
  301. }
  302. </style>