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.
 
 
 

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