Não pode escolher mais do que 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.
 
 
 

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