瀏覽代碼

不需登录正常调试

wenningning 2 年之前
父節點
當前提交
292dc14300

+ 4 - 2
sleep/api/doctor_advert.js

@@ -7,7 +7,8 @@ import request, { Method } from '@/utils/request'
  */
  */
 export function getDoctorAdvertList(params) {
 export function getDoctorAdvertList(params) {
   return request({
   return request({
-    url: 'care/health_advert/pageList',
+    url: 'care/care_device_member_bind/pageList', // 先写死
+    // url: 'care/health_advert/pageList',
     config: {method: Method.POST, needToken: false, loading: true},
     config: {method: Method.POST, needToken: false, loading: true},
     params
     params
   })
   })
@@ -16,7 +17,8 @@ export function getDoctorAdvertList(params) {
 /** 查询单个健康宣教 列表编辑按钮进入编辑页面时调用 */
 /** 查询单个健康宣教 列表编辑按钮进入编辑页面时调用 */
 export function getDoctorAdvert(id, params) {
 export function getDoctorAdvert(id, params) {
   return request({
   return request({
-    url: `care/health_advert/${id}`,
+    url: `care/care_device_member_bind/health_advert/${id}`, // 先写死
+    // url: `care/health_advert/${id}`,
     config: {method: Method.GET, needToken: false, loading: true},
     config: {method: Method.GET, needToken: false, loading: true},
     params
     params
   })
   })

+ 6 - 3
sleep/api/sleep_report.js

@@ -7,7 +7,8 @@ import request, { Method,API } from '@/utils/request'
 // 获取最近一天的睡眠报告
 // 获取最近一天的睡眠报告
 export function getNewListByUnionId(params){
 export function getNewListByUnionId(params){
     return request({
     return request({
-        url: `care/sleep_report/get_new_list_by_union_id`,
+        // url: `care/sleep_report/get_new_list_by_union_id`,
+        url: `${API.base}/xiaomian/get_new_list_by_union_id`,  // 先写死
         config: {method: Method.POST, needToken: true, loading: true},
         config: {method: Method.POST, needToken: true, loading: true},
         params
         params
     })
     })
@@ -16,7 +17,8 @@ export function getNewListByUnionId(params){
 // 获取日历上有值的天数
 // 获取日历上有值的天数
 export function getSleepReportDaysTag(params){
 export function getSleepReportDaysTag(params){
     return request({
     return request({
-        url: `care/sleep_report/get_sleep_report_days_tag`,
+        url: `${API.base}/xiaomian/get_sleep_report_days_tag`,  // 先写死
+        // url: `care/sleep_report/get_sleep_report_days_tag`,
         config: {method: Method.POST, needToken: true, loading: true},
         config: {method: Method.POST, needToken: true, loading: true},
         params
         params
     })
     })
@@ -42,7 +44,8 @@ export function getWarnResult(imei){
 // 根据imei与用户unionId获取最新报告
 // 根据imei与用户unionId获取最新报告
 export function getNewReportBySn(params){
 export function getNewReportBySn(params){
     return request({
     return request({
-        url: `care/sleep_report/get_new_report_by_sn`,
+        url: `xiaomian/get_new_report_by_sn`, // 先写死
+        // url: `care/sleep_report/get_new_report_by_sn`,
         config: {method: Method.GET, needToken: true, loading: true},
         config: {method: Method.GET, needToken: true, loading: true},
         params
         params
     })
     })

+ 7 - 5
sleep/pages/home/index.vue

@@ -341,6 +341,7 @@
 <script>
 <script>
 import echarts from '@/static/echarts.min.js'
 import echarts from '@/static/echarts.min.js'
 import mpvueEcharts from '@/components/mpvue-echarts/src/echarts.vue'
 import mpvueEcharts from '@/components/mpvue-echarts/src/echarts.vue'
+import  { API } from '@/utils/request'
 
 
 import Storage from '@/utils/storage'
 import Storage from '@/utils/storage'
 import * as API_deviceMemberBind  from '@/api/device_member_bind'
 import * as API_deviceMemberBind  from '@/api/device_member_bind'
@@ -382,12 +383,13 @@ export default {
       },
       },
       deviceList: [], // 设备列表
       deviceList: [], // 设备列表
       lastMsgTime: 0, // 最后一次设备消息时间
       lastMsgTime: 0, // 最后一次设备消息时间
-      memberId: 50289,
+      memberId: '',
       bindSn: '',
       bindSn: '',
       bindShow: false
       bindShow: false
 		};
 		};
 	},
 	},
   onLoad() {
   onLoad() {
+    this.memberId = 50289
     this.API_getDeviceList()
     this.API_getDeviceList()
   },
   },
   // onLoad() {
   // onLoad() {
@@ -417,7 +419,6 @@ export default {
   //     }
   //     }
   //   })
   //   })
   //
   //
-  //
   // },
   // },
   beforeDestroy() {
   beforeDestroy() {
     this.closeWebsocket()
     this.closeWebsocket()
@@ -474,8 +475,9 @@ export default {
     connect() {
     connect() {
       let _this = this
       let _this = this
       this.connecting = true
       this.connecting = true
-      // let wsUrl = api.base.replace('http', 'ws')
+      let wsUrl = API.base.replace('http', 'ws')
       this.mySocketTask = uni.connectSocket({
       this.mySocketTask = uni.connectSocket({
+        // url: wsUrl + '/sleep_report/monitor/' + this.memberId,
         url: 'ws://wdkl.natapp1.cc/sleep_report/monitor/' + this.memberId,
         url: 'ws://wdkl.natapp1.cc/sleep_report/monitor/' + this.memberId,
         success(res) {
         success(res) {
           // 这里是接口调用成功的回调,不是连接成功的回调,请注意
           // 这里是接口调用成功的回调,不是连接成功的回调,请注意
@@ -789,7 +791,7 @@ export default {
       })
       })
     },
     },
     addBindDevice() {
     addBindDevice() {
-		
+
 		  if (this.memberId) {
 		  if (this.memberId) {
         this.bindShow = 'show'
         this.bindShow = 'show'
       } else {
       } else {
@@ -1471,7 +1473,7 @@ export default {
   .home-data-chart {
   .home-data-chart {
     overflow-x: hidden;
     overflow-x: hidden;
     width: 100%;
     width: 100%;
-	
+
     .group_10 {
     .group_10 {
       padding-left: 2.06rem;
       padding-left: 2.06rem;
       padding-bottom: 2.25rem;
       padding-bottom: 2.25rem;

+ 28 - 7
sleep/pages/my/index.vue

@@ -65,7 +65,7 @@
             <view class="flex-row justify-between">
             <view class="flex-row justify-between">
               <text class="font_1 text_5 pos_2">我的设备</text>
               <text class="font_1 text_5 pos_2">我的设备</text>
               <view class="flex-row items-center section_4 pos_3">
               <view class="flex-row items-center section_4 pos_3">
-                <text class="font_5" @click="bindShow = 'show'">添加设备</text>
+                <text class="font_5" @click="addBindDevice">添加设备</text>
                 <image
                 <image
                     class="shrink-0 image_7"
                     class="shrink-0 image_7"
                     src="../../static/mine/myIconAdd.png"
                     src="../../static/mine/myIconAdd.png"
@@ -79,10 +79,10 @@
 				    class="image_4"
 				    class="image_4"
 					src="../../static/home/homeIconAdd.png"
 					src="../../static/home/homeIconAdd.png"
 				  />
 				  />
-				  <view class="text_5">添加设备</view>
+				  <view class="text_5" @click="addBindDevice">添加设备</view>
 				</view>
 				</view>
 			</view>
 			</view>
-			
+
             <view v-if="deviceList.length > 0" v-for="(item, index) in deviceList" :key="index"
             <view v-if="deviceList.length > 0" v-for="(item, index) in deviceList" :key="index"
                   class="flex-col my_device_default space-y-6">
                   class="flex-col my_device_default space-y-6">
               <view class="flex-row justify-between items-end">
               <view class="flex-row justify-between items-end">
@@ -282,8 +282,8 @@ export default {
   data() {
   data() {
     return {
     return {
       deviceList: [],
       deviceList: [],
-      unionId: '6291d3bde21b840008ae7842', // 先写死
-      memberId: '50289', // 先写死
+      unionId: '',
+      memberId: '',
       bindSn: '',
       bindSn: '',
       bindShow: false,
       bindShow: false,
       userInfo: null
       userInfo: null
@@ -302,6 +302,8 @@ export default {
   //   }
   //   }
   // },
   // },
   mounted() {
   mounted() {
+    this.unionId = '6291d3bde21b840008ae7842'
+    this.memberId = 50289
     this.deviceList = Storage.getItem('myBindDevices')
     this.deviceList = Storage.getItem('myBindDevices')
     if (this.deviceList) {
     if (this.deviceList) {
       console.log('this.deviceList===', this.deviceList)
       console.log('this.deviceList===', this.deviceList)
@@ -476,6 +478,25 @@ export default {
           }
           }
         })
         })
       },
       },
+    addBindDevice() {
+      if (this.memberId) {
+        this.bindShow = 'show'
+      } else {
+        uni.showModal({
+          title: '提示',
+          content: "您还没有登录,是否前往登录?",
+          confirmText: "确定",
+          showCancel: true,
+          success: function(res) {
+            if (res.confirm) {
+              uni.reLaunch({
+                url:'/pages/auth/auth'
+              })
+            }
+          }
+        })
+      }
+    },
   ...mapActions({
   ...mapActions({
       logout: 'logoutAction'
       logout: 'logoutAction'
     })
     })
@@ -499,9 +520,9 @@ export default {
 	    font-size: 1.3rem;
 	    font-size: 1.3rem;
 	    font-family: PingFangSC;
 	    font-family: PingFangSC;
 	    line-height: 1.38rem;
 	    line-height: 1.38rem;
-		margin-left: 0.5rem	  
+		margin-left: 0.5rem
 		}
 		}
-	}	  
+	}
 .power-module {
 .power-module {
   position: absolute;
   position: absolute;
   right: 1.63rem;
   right: 1.63rem;

+ 2 - 1
sleep/pages/report/report.vue

@@ -529,11 +529,12 @@
         disabled: true,
         disabled: true,
         bindShow: false,
         bindShow: false,
         bindSn: '',
         bindSn: '',
-        memberId: 50289,
+        memberId: '',
         userInfo: null
         userInfo: null
 			}
 			}
 		},
 		},
     mounted() {
     mounted() {
+      this.memberId = 50289
       this.params.unionId = '6291d3bde21b840008ae7842' // 先写死
       this.params.unionId = '6291d3bde21b840008ae7842' // 先写死
       this.getNewSleepReport()
       this.getNewSleepReport()
     },
     },

+ 4 - 4
sleep/utils/request.js

@@ -9,10 +9,10 @@ import checkToken from '@/utils/checkToken'
 const api_mode = 'dev'
 const api_mode = 'dev'
 
 
 export const API = {
 export const API = {
-	// base: 'https://api.base.wdklian.com',
-	// buyer: 'https://api.buyer.wdklian.com',
-	base: 'http://wdkl.natapp1.cc',
-	buyer: 'http://192.168.1.199:7002'
+	base: 'https://api.base.wdklian.com',
+	buyer: 'https://api.buyer.wdklian.com',
+	// base: 'http://wdkl.natapp1.cc',
+	// buyer: 'http://192.168.1.199:7002'
 }
 }
 
 
 const config = {
 const config = {