Explorar el Código

Merge branch 'dev4.5.5' of http://127.0.0.1:8080/qmx/jy into dev4.5.5

TANGSHIZHE hace 4 años
padre
commit
2f074b4f2d

+ 7 - 4
src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/js/keyword-info.js

@@ -510,10 +510,6 @@ var vm = new Vue({
         filterArr = JSON.parse(JSON.stringify(filterArr))
         if (this.pInfo.editType === 'edit') {
           filterArr.splice(this.pInfo.kIndex, 1)
-          filterArr.push({
-            key: this.keyInfo.key.split(/\s+/),
-            matchway: this.keyInfo.matchWay
-          })
         }
 
         if (filterArr.length === 0) {
@@ -523,6 +519,13 @@ var vm = new Vue({
         filterArr = this.allKeywordsList
       }
 
+      if (this.keyInfo.key.replace(/\s+/g, '')) {
+        filterArr.push({
+          key: this.keyInfo.key.split(/\s+/),
+          matchway: this.keyInfo.matchWay
+        })
+      }
+
       filterArr.forEach(function (item) {
         // 关键词1:信息 技术   关键词2:软件
         // 模糊匹配,参数是:信息 技术 软件

+ 20 - 13
src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/js/keyword-manage.js

@@ -13,7 +13,8 @@ var vm = new Vue({
     editGroupNameDialog: {
       show: false,
       type: '', // 状态:add/edit
-      value: ''
+      value: '',
+      tipText: ''
     },
   },
   computed: {
@@ -343,6 +344,7 @@ var vm = new Vue({
     editGroupName: function (editType, item, index) {
       this.editGroupNameDialog.type = editType
       this.editGroupNameDialog.show = true
+      this.editGroupNameDialog.tipText = ''
       if (editType === 'edit') {
         this.editGroupNameDialog.value = item.name
         this.editGroupNameDialog.gIndex = index
@@ -353,17 +355,23 @@ var vm = new Vue({
         $('.group-name-edit .van-dialog__confirm').prop('disabled', !this.editGroupNameDialog.value)
       })
     },
-    confirmEditGroupName: function () {
-      // 关键词分类名判重
-      var classNameArr = this.getAllGroupName()
-      if (classNameArr.indexOf(this.editGroupNameDialog.value) === -1) {
-        // 分类名不重复,新建分类
-        this.saveGroupEdit(this.editGroupNameDialog.type)
-      } else {
-        // this.showToast('分类名不能重复')
+    confirmEditGroupName: function (action, done) {
+      if (action === 'cancel') {
+        done()
+      } else if (action === 'confirm') {
+        // 关键词分类名判重
+        var classNameArr = this.getAllGroupName()
+        if (classNameArr.indexOf(this.editGroupNameDialog.value) === -1) {
+          // 分类名不重复,新建分类
+          this.saveGroupEdit(this.editGroupNameDialog.type, done)
+        } else {
+          // this.showToast('分类名不能重复')
+          this.editGroupNameDialog.tipText = '该关键词分类已存在'
+          done(false)
+        }
       }
     },
-    saveGroupEdit: function (type) {
+    saveGroupEdit: function (type, done) {
       var _this = this
       var data = {}
       var toastType = ''
@@ -385,13 +393,12 @@ var vm = new Vue({
       } else {
         return
       }
-      var loading = this.showLoading()
       $.ajax({
         type: 'POST',
         url: '/subscribepay/afterPay/setUserInfo',
         data: data,
         success: function (res) {
-          loading && loading.clear()
+          done && done()
           if (res.flag) {
             _this.showToast(toastType + '分类成功')
             _this.getKeywordsGroupList()
@@ -401,7 +408,7 @@ var vm = new Vue({
           }
         },
         error: function () {
-          loading && loading.clear()
+          done && done()
         }
       })
     }

+ 6 - 1
src/jfw/modules/app/src/web/templates/vipsubscribe/manageWord.html

@@ -52,6 +52,10 @@
         .keyword-list {
             padding-top: 0;
         }
+        .edit-tip {
+            color: #FB483D;
+            margin: .1rem 0;
+        }
     </style>
 </head>
 
@@ -137,11 +141,12 @@
             title="关键词分类"
             get-container="body"
             confirm-button-color="#2ABED1"
-            @confirm="confirmEditGroupName"
+            :before-close="confirmEditGroupName"
             show-cancel-button>
             <div class="edit-container">
                 <input type="text" maxlength="20" v-model.trim="editGroupNameDialog.value" placeholder="输入关键词分类名称" onblur="window.scrollTo(0, 0)">
             </div>
+            <div class="edit-tip" v-show="editGroupNameDialog.tipText">${ editGroupNameDialog.tipText }</div>
         </van-dialog>
     </div>
     <script src=//cdn-common.jianyu360.com/cdn/lib/jquery/3.6.0/jquery.min.js></script>

+ 7 - 4
src/web/staticres/vipsubscribe/js/keyword-info.js

@@ -510,10 +510,6 @@ var vm = new Vue({
         filterArr = JSON.parse(JSON.stringify(filterArr))
         if (this.pInfo.editType === 'edit') {
           filterArr.splice(this.pInfo.kIndex, 1)
-          filterArr.push({
-            key: this.keyInfo.key.split(/\s+/),
-            matchway: this.keyInfo.matchWay
-          })
         }
 
         if (filterArr.length === 0) {
@@ -523,6 +519,13 @@ var vm = new Vue({
         filterArr = this.allKeywordsList
       }
 
+      if (this.keyInfo.key.replace(/\s+/g, '')) {
+        filterArr.push({
+          key: this.keyInfo.key.split(/\s+/),
+          matchway: this.keyInfo.matchWay
+        })
+      }
+
       filterArr.forEach(function (item) {
         // 关键词1:信息 技术   关键词2:软件
         // 模糊匹配,参数是:信息 技术 软件

+ 21 - 13
src/web/staticres/vipsubscribe/js/keyword-manage.js

@@ -13,7 +13,8 @@ var vm = new Vue({
     editGroupNameDialog: {
       show: false,
       type: '', // 状态:add/edit
-      value: ''
+      value: '',
+      tipText: ''
     },
   },
   computed: {
@@ -343,6 +344,7 @@ var vm = new Vue({
     editGroupName: function (editType, item, index) {
       this.editGroupNameDialog.type = editType
       this.editGroupNameDialog.show = true
+      this.editGroupNameDialog.tipText = ''
       if (editType === 'edit') {
         this.editGroupNameDialog.value = item.name
         this.editGroupNameDialog.gIndex = index
@@ -353,17 +355,23 @@ var vm = new Vue({
         $('.group-name-edit .van-dialog__confirm').prop('disabled', !this.editGroupNameDialog.value)
       })
     },
-    confirmEditGroupName: function () {
-      // 关键词分类名判重
-      var classNameArr = this.getAllGroupName()
-      if (classNameArr.indexOf(this.editGroupNameDialog.value) === -1) {
-        // 分类名不重复,新建分类
-        this.saveGroupEdit(this.editGroupNameDialog.type)
-      } else {
-        // this.showToast('分类名不能重复')
+    confirmEditGroupName: function (action, done) {
+      if (action === 'cancel') {
+        done()
+      } else if (action === 'confirm') {
+        // 关键词分类名判重
+        var classNameArr = this.getAllGroupName()
+        if (classNameArr.indexOf(this.editGroupNameDialog.value) === -1) {
+          // 分类名不重复,新建分类
+          this.saveGroupEdit(this.editGroupNameDialog.type, done)
+        } else {
+          // this.showToast('分类名不能重复')
+          this.editGroupNameDialog.tipText = '该关键词分类已存在'
+          done(false)
+        }
       }
     },
-    saveGroupEdit: function (type) {
+    saveGroupEdit: function (type, done) {
       var _this = this
       var data = {}
       var toastType = ''
@@ -385,13 +393,13 @@ var vm = new Vue({
       } else {
         return
       }
-      var loading = this.showLoading()
+
       $.ajax({
         type: 'POST',
         url: '/subscribepay/afterPay/setUserInfo',
         data: data,
         success: function (res) {
-          loading && loading.clear()
+          done && done()
           if (res.flag) {
             _this.showToast(toastType + '分类成功')
             _this.getKeywordsGroupList()
@@ -401,7 +409,7 @@ var vm = new Vue({
           }
         },
         error: function () {
-          loading && loading.clear()
+          done && done()
         }
       })
     }

+ 6 - 1
src/web/templates/weixin/vipsubscribe/manageWord.html

@@ -56,6 +56,10 @@
         .keyword-list {
             padding-top: 0;
         }
+        .edit-tip {
+            color: #FB483D;
+            margin: .1rem 0;
+        }
     </style>
 </head>
 
@@ -135,11 +139,12 @@
             title="关键词分类"
             get-container="body"
             confirm-button-color="#2ABED1"
-            @confirm="confirmEditGroupName"
+            :before-close="confirmEditGroupName"
             show-cancel-button>
             <div class="edit-container">
                 <input type="text" maxlength="20" v-model.trim="editGroupNameDialog.value" placeholder="输入关键词分类名称" onblur="window.scrollTo(0, 0)">
             </div>
+            <div class="edit-tip" v-show="editGroupNameDialog.tipText">${ editGroupNameDialog.tipText }</div>
         </van-dialog>
     </div>
     <script src=//cdn-common.jianyu360.com/cdn/lib/jquery/3.6.0/jquery.min.js></script>