Переглянути джерело

fix: 修复时间筛选组件缓存数据未清除导致的推送时间展示与实际发送参数不一致的问题

zhangyuhan 2 роки тому
батько
коміт
3e55c04eaf

+ 18 - 7
src/web/staticres/common-module/history-push/js/historypush.js

@@ -194,7 +194,8 @@ var vm = new Vue({
     }
     this.subPageMove()
     if(firstTime) {
-      firstTime = firstTime / 1000 +'_'+ firstTime / 1000;
+      const pushtime = this.calcDateTime(firstTime / 1000)
+      firstTime = pushtime.start / 1000 + '_' + pushtime.end / 1000
       this.time = firstTime
       this.setPushTime(firstTime)
     }else {
@@ -203,10 +204,10 @@ var vm = new Vue({
     // console.log(this.selectPro, '用户身份');
   },
   mounted () {
-    var recover = this.recover()
     // 判断是否推送消息进入,清空缓存值,显示底部导航
     try {
       if (pushUrlTime) {
+        sessionStorage.removeItem(this.sessStorageKey)
         this.setPushTime(pushUrlTime + '_' + pushUrlTime)
         this.revorceOtherData()
         JyObj.hiddenBottom("1")
@@ -214,6 +215,7 @@ var vm = new Vue({
     } catch (e) {
       console.log(e)
     }
+    var recover = this.recover()
     if (!recover) {
       setTimeout(() => {
         // 如果订阅消息进来时间不为空
@@ -523,13 +525,22 @@ var vm = new Vue({
         this.showSuperVipDialog()
       }
     },
-    // 订阅推送消息展示数据
-    setPushTime: function(time) {
-      // console.log(time)
+    calcDateTime: function (time) {
+      // @tip 调用时间选择组件函数格式化时间
+      const endTime = parseInt(String(time).split('_')[0] * 1000)
+
       let pushtime = {
-        start: parseInt(time.split('_')[0] * 1000),
-        end: parseInt(time.split('_')[0] * 1000),
+        start: endTime,
+        end: endTime,
+      }
+      if (typeof dateComponent.methods.calcNotExactTime === 'function') {
+        pushtime = dateComponent.methods.calcNotExactTime('today', endTime)
       }
+      return pushtime
+    },
+    // 订阅推送消息展示数据
+    setPushTime: function(time) {
+      const pushtime = this.calcDateTime(time)
       this.tagText.timeText = new Date(pushtime.end).pattern('yyyy.MM.dd')
       this.selectDate.startDate = pushtime.start
       this.selectDate.endDate= pushtime.end