Procházet zdrojové kódy

fix: 修复日期筛选异常并重置分页逻辑

1. 统一给日期参数拼接时分来获取准确的时间戳
2. 日期选择变更时重置页码为1
3. 恢复使用正式环境的API base url
allen před 1 týdnem
rodič
revize
b5d9027147
3 změnil soubory, kde provedl 14 přidání a 12 odebrání
  1. 5 4
      pages/bzy/detail.vue
  2. 7 6
      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,
         },

+ 7 - 6
pages/cbd/detail.vue

@@ -338,6 +338,7 @@ export default {
     handleChange(e){
       this.startDate = e.startDate;
       this.endDate = e.endDate;
+      this.page = 1;
       this.initAction();
     },
     showCalendar(){
@@ -416,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 || [];
@@ -430,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,
         },
@@ -446,8 +447,8 @@ export default {
         method: 'POST',
         data: {
         d_id: this.deviceInfo.d_id,
-        start: this.startDate,
-        end: this.endDate,
+        start: this.startDate + ' 00:00:00',
+        end: this.endDate + ' 23:59:59',
         model: 'B'
         },
       });

+ 2 - 2
util/api.js

@@ -9,10 +9,10 @@ export const myRequest = (options) => {
     //      ? 'https://uat.hnyfwlw.com'
     //      : 'https://web.hnyfwlw.com';
     // BASE_URL = 'http://192.168.1.107:8000'
-    BASE_URL = 'http://218.28.198.186:10508';
+    // BASE_URL = 'http://218.28.198.186:10508';
     // BASE_URL = 'http://8.136.98.49:8002';
   }
-  // BASE_URL = config.productAPI;
+  BASE_URL = config.productAPI;
   // BASE_URL = config.developAPI;
   var session_key = '';
   session_key = uni.getStorageSync('session_key');