Browse Source

fix: 超级订阅关键词: 当前关键词未修改, 不发送请求

cuiyalong 4 years ago
parent
commit
8e022061bd

+ 17 - 1
src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/js/keyword-info.js

@@ -34,6 +34,12 @@ var vm = new Vue({
       matchWay: 1, // 0精准/1模糊->新增默认为:模糊1
       notKey: ''
     },
+    // 当前关键词信息备份,用于判断是否修改过
+    keyInfoBackup: {
+      key: '',
+      matchWay: 1,
+      notKey: ''
+    },
     showNotKeyModule: false,
     // 关键词刷新状态保存(类似前端分页)
     recListState: {
@@ -276,6 +282,10 @@ var vm = new Vue({
       this.keyInfo.notKey = notKeyArr.join(' ')
       this.keyInfo.matchWay = matchWay
 
+      // 关键词信息备份
+      var backup = JSON.parse(JSON.stringify(this.keyInfo))
+      Object.assign(this.keyInfoBackup, backup)
+
       if (this.keyInfo.notKey) {
         this.showNotKeyModule = true
       }
@@ -452,7 +462,13 @@ var vm = new Vue({
           confirmButtonText: '我知道了'
         })
       }
-      
+
+      // 如果未修改,则直接返回
+      var changed = utils.deepCompare(this.keyInfo, this.keyInfoBackup)
+      if (changed) {
+        return history.back()
+      }
+
       // 整理数据
       //  SK:保存关键词; DK:删除关键词; SC:保存分类
       var groupInfo = this.getGKIndex()

+ 17 - 1
src/web/staticres/vipsubscribe/js/keyword-info.js

@@ -34,6 +34,12 @@ var vm = new Vue({
       matchWay: 1, // 0精准/1模糊->新增默认为:模糊1
       notKey: ''
     },
+    // 当前关键词信息备份,用于判断是否修改过
+    keyInfoBackup: {
+      key: '',
+      matchWay: 1,
+      notKey: ''
+    },
     showNotKeyModule: false,
     // 关键词刷新状态保存(类似前端分页)
     recListState: {
@@ -276,6 +282,10 @@ var vm = new Vue({
       this.keyInfo.notKey = notKeyArr.join(' ')
       this.keyInfo.matchWay = matchWay
 
+      // 关键词信息备份
+      var backup = JSON.parse(JSON.stringify(this.keyInfo))
+      Object.assign(this.keyInfoBackup, backup)
+
       if (this.keyInfo.notKey) {
         this.showNotKeyModule = true
       }
@@ -452,7 +462,13 @@ var vm = new Vue({
           confirmButtonText: '我知道了'
         })
       }
-      
+
+      // 如果未修改,则直接返回
+      var changed = utils.deepCompare(this.keyInfo, this.keyInfoBackup)
+      if (changed) {
+        return history.back()
+      }
+
       // 整理数据
       //  SK:保存关键词; DK:删除关键词; SC:保存分类
       var groupInfo = this.getGKIndex()