Просмотр исходного кода

fix: 修复日期筛选和接口请求问题

1. 切换正式接口地址为线上环境
2. 为日期选择后重置页码为1,避免分页数据异常
3. 补全日期时间参数,确保筛选范围覆盖整日
4. 增加日历选择回调的调试日志
allen 13 часов назад
Родитель
Сommit
6a48e6e5e2
3 измененных файлов с 13 добавлено и 10 удалено
  1. 5 4
      pages/bzy/detail.vue
  2. 6 4
      pages/cbd/detail.vue
  3. 2 2
      util/api.js

+ 5 - 4
pages/bzy/detail.vue

@@ -318,6 +318,7 @@ export default {
     handleChange(e){
       this.startDate = e.startDate;
       this.endDate = e.endDate;
+      this.page = 1;
       this.initAction();
     },
     showCalendar(){
@@ -392,8 +393,8 @@ export default {
         data: {
           device_type_id: this.deviceInfo.type_id,
           d_id: this.deviceInfo.d_id,
-          start_time: new Date(this.startDate).getTime()/1000,// 转成毫秒
-          end_time: new Date(this.endDate).getTime()/1000,// 转成毫秒
+          start_time: new Date(this.startDate + ' 00:00:00').getTime()/1000,// 转成毫秒
+          end_time: new Date(this.endDate + ' 23:59:59').getTime()/1000,// 转成毫秒
         },
       });
       const data = res || [];
@@ -406,8 +407,8 @@ export default {
         data: {
           device_type_id: this.deviceInfo.type_id,
           device_id: this.deviceInfo.id,
-          start_time: new Date(this.startDate).getTime()/1000,
-          end_time: new Date(this.endDate).getTime()/1000,
+          start_time: new Date(this.startDate + ' 00:00:00').getTime()/1000,
+          end_time: new Date(this.endDate + ' 23:59:59').getTime()/1000,
           page: this.page,
           page_size: this.page_size,
         },

+ 6 - 4
pages/cbd/detail.vue

@@ -335,8 +335,10 @@ export default {
       return `${year}-${month}-${day}`;
     },
     handleChange(e){
+      console.log(e,'eeeeeeee');
       this.startDate = e.startDate;
       this.endDate = e.endDate;
+      this.page = 1;
       this.initAction();
     },
     showCalendar(){
@@ -415,8 +417,8 @@ export default {
         data: {
           device_type_id: this.deviceInfo.type_id,
           d_id: this.deviceInfo.d_id,
-          start_time: new Date(this.startDate).getTime()/1000,// 转成毫秒
-          end_time: new Date(this.endDate).getTime()/1000,// 转成毫秒
+          start_time: new Date(this.startDate + ' 00:00:00').getTime()/1000,// 转成毫秒
+          end_time: new Date(this.endDate + ' 23:59:59').getTime()/1000,
         },
       });
       const data = res || [];
@@ -429,8 +431,8 @@ export default {
         data: {
           device_type_id: this.deviceInfo.type_id,
           device_id: this.deviceInfo.id,
-          start_time: new Date(this.startDate).getTime()/1000,
-          end_time: new Date(this.endDate).getTime()/1000,
+          start_time: new Date(this.startDate + ' 00:00:00').getTime()/1000,
+          end_time: new Date(this.endDate + ' 23:59:59').getTime()/1000,
           page: this.page,
           page_size: this.page_size,
         },

+ 2 - 2
util/api.js

@@ -1,9 +1,9 @@
 // let BASE_URL = 'http://114.55.0.7:8002';
 // const BASE_URL='http://8.136.98.49:8002'
 // let BASE_URL = 'http://218.28.198.186:10505'
-// let BASE_URL = 'https://wx.hnyfwlw.com'
+let BASE_URL = 'https://wx.hnyfwlw.com'
 // let BASE_URL = 'http://192.168.1.107:8000';
-let BASE_URL = 'http://218.28.198.186:10508';
+// let BASE_URL = 'http://218.28.198.186:10508';
 // let BASE_URL = 'https://uat.hnyfwlw.com'
 export const myRequest = (options) => {
   // BASE_URL=uni.getStorageSync('http')