Bläddra i källkod

写死参数测试

wennn 2 år sedan
förälder
incheckning
333d64c889
5 ändrade filer med 80 tillägg och 60 borttagningar
  1. 1 1
      sleep/manifest.json
  2. 43 34
      sleep/pages/home/index.vue
  3. 18 11
      sleep/pages/my/index.vue
  4. 17 13
      sleep/pages/report/report.vue
  5. 1 1
      sleep/utils/request.js

+ 1 - 1
sleep/manifest.json

@@ -85,7 +85,7 @@
     },
     "quickapp" : {},
     "mp-weixin" : {
-        "appid" : "wx97a109e5a40588dc",
+        "appid" : "wx39e390ff4635fc8e",
         "requiredBackgroundModes" : [ "audio" ],
         "setting" : {
             "urlCheck" : true,

+ 43 - 34
sleep/pages/home/index.vue

@@ -382,40 +382,43 @@ export default {
       },
       deviceList: [], // 设备列表
       lastMsgTime: 0, // 最后一次设备消息时间
-      memberId: '',
+      memberId: 50289,
       bindSn: '',
       bindShow: false
 		};
 	},
   onLoad() {
-    wx.getSetting({
-      complete: (res) => {
-        if (!res.authSetting['scope.userInfo']) {
-          return
-        }
-        console.log('222222222222222222222222222')
-        const memberId = Storage.getItem('uid')
-        if (memberId) {
-          this.memberId = memberId
-          console.log('this.memberId===', this.memberId)
-          this.API_getDeviceList()
-        } else {
-          this.checkHasLogin()
-          const _this = this
-          let initTimer = setInterval(function () {
-            const memberId = Storage.getItem('uid')
-            if (memberId) {
-              _this.memberId = memberId
-              clearInterval(initTimer)
-              _this.API_getDeviceList()
-            }
-          }, 500)
-        }
-      }
-    })
-
-
+    this.API_getDeviceList()
   },
+  // onLoad() {
+  //   wx.getSetting({
+  //     complete: (res) => {
+  //       if (!res.authSetting['scope.userInfo']) {
+  //         return
+  //       }
+  //       console.log('222222222222222222222222222')
+  //       const memberId = Storage.getItem('uid')
+  //       if (memberId) {
+  //         this.memberId = memberId
+  //         console.log('this.memberId===', this.memberId)
+  //         this.API_getDeviceList()
+  //       } else {
+  //         this.checkHasLogin()
+  //         const _this = this
+  //         let initTimer = setInterval(function () {
+  //           const memberId = Storage.getItem('uid')
+  //           if (memberId) {
+  //             _this.memberId = memberId
+  //             clearInterval(initTimer)
+  //             _this.API_getDeviceList()
+  //           }
+  //         }, 500)
+  //       }
+  //     }
+  //   })
+  //
+  //
+  // },
   beforeDestroy() {
     this.closeWebsocket()
   },
@@ -423,14 +426,20 @@ export default {
     const imei = Storage.getItem('nowChangeDevice')
     if (imei) {
       this.homeFrom.nowDevice = imei
-      this.deviceAdded = true
-      if (!this.connected && this.memberId) {
-        this.init()
-      }
-    } else {
-      this.deviceAdded = false
     }
   },
+  // onShow() {
+  //   const imei = Storage.getItem('nowChangeDevice')
+  //   if (imei) {
+  //     this.homeFrom.nowDevice = imei
+  //     this.deviceAdded = true
+  //     if (!this.connected && this.memberId) {
+  //       this.init()
+  //     }
+  //   } else {
+  //     this.deviceAdded = false
+  //   }
+  // },
 	methods: {
 		handleShareClick() {
 			uni.navigateTo({

+ 18 - 11
sleep/pages/my/index.vue

@@ -271,23 +271,30 @@ export default {
   data() {
     return {
       deviceList: [],
-      unionId: '',
-      memberId: '',
+      unionId: '6291d3bde21b840008ae7842', // 先写死
+      memberId: '50289', // 先写死
       bindSn: '',
       bindShow: false,
       userInfo: null
     };
   },
+  // mounted() {
+  //   this.memberId = Storage.getItem('uid')
+  //   if (this.memberId) {
+  //     this.userInfo = Storage.getItem('userInfo')
+  //     this.deviceList = Storage.getItem('myBindDevices')
+  //     this.unionId = this.userInfo.union_id
+  //     if (this.deviceList) {
+  //       console.log('this.deviceList===', this.deviceList)
+  //       this.API_getNewReport()
+  //     }
+  //   }
+  // },
   mounted() {
-    this.memberId = Storage.getItem('uid')
-    if (this.memberId) {
-      this.userInfo = Storage.getItem('userInfo')
-      this.deviceList = Storage.getItem('myBindDevices')
-      this.unionId = this.userInfo.union_id
-      if (this.deviceList) {
-        console.log('this.deviceList===', this.deviceList)
-        this.API_getNewReport()
-      }
+    this.deviceList = Storage.getItem('myBindDevices')
+    if (this.deviceList) {
+      console.log('this.deviceList===', this.deviceList)
+      this.API_getNewReport()
     }
   },
   methods: {

+ 17 - 13
sleep/pages/report/report.vue

@@ -529,23 +529,27 @@
         disabled: true,
         bindShow: false,
         bindSn: '',
-        memberId: '',
+        memberId: 50289,
         userInfo: null
 			}
 		},
-    onShow() {
-      this.memberId = Storage.getItem('uid')
-      if (this.memberId) {
-        if (!this.isDeviceAdded) {
-          this.user = Storage.getItem('userInfo')
-          this.params.unionId = this.user.union_id
-          console.log('user===', this.user, this.user.union_id)
-          this.getNewSleepReport()
-        }
-      } else {
-        this.isDeviceAdded = false
-      }
+    mounted() {
+      this.params.unionId = '6291d3bde21b840008ae7842' // 先写死
+      this.getNewSleepReport()
     },
+    // onShow() {
+    //   this.memberId = Storage.getItem('uid')
+    //   if (this.memberId) {
+    //     if (!this.isDeviceAdded) {
+    //       this.user = Storage.getItem('userInfo')
+    //       this.params.unionId = this.user.union_id
+    //       console.log('user===', this.user, this.user.union_id)
+    //       this.getNewSleepReport()
+    //     }
+    //   } else {
+    //     this.isDeviceAdded = false
+    //   }
+    // },
     methods: {
       // 获取睡眠报告
       getNewSleepReport() {

+ 1 - 1
sleep/utils/request.js

@@ -6,7 +6,7 @@ import store from '@/store'
 import checkToken from '@/utils/checkToken'
 
 /** api 模式 */
-const api_mode = 'prod'
+const api_mode = 'dev'
 
 export const API = {
 	// base: 'https://api.base.wdklian.com',