Quellcode durchsuchen

修复采美文章自动保存功能

xiebaomin vor 2 Jahren
Ursprung
Commit
a83c103494

+ 19 - 6
src/main/resources/static/js/supplier-center/encyclopedia/edit.js

@@ -285,19 +285,19 @@ const edit = new Vue({
         },
     },
     methods: {
-        onFocused() {
+        onFocused(val = 300) {
             setTimeout(() => {
                 this.validTime = null
                 console.log(111)
                 clearTimeout(this.validTime)
-            }, 300)
+            }, val)
         },
-        onBlured() {
+        onBlured(val = 200) {
             setTimeout(() => {
                 this.isFocus = true
                 this.validFormRule()
                 console.log(222)
-            }, 200)
+            }, val)
         },
         // 自动保存校验
         validFormRule() {
@@ -321,6 +321,13 @@ const edit = new Vue({
         handlerTypeId() {
             this.onBlured()
         },
+        changeVisible($event) {
+            if ($event) {
+                this.onFocused()
+            } else {
+                this.onBlured()
+            }
+        },
         // 获取表单数据
         fetchEntryData(){
             const self = this
@@ -559,7 +566,8 @@ const edit = new Vue({
         // 删除信息栏
         handleInfoRemove(index) {
             this.formData.infoList.splice(index, 1)
-            this.onFocused()
+            this.onFocused(0)
+            this.onBlured(0)
         },
         // 正文目录数据
         genereateTextInfo(type, index) {
@@ -585,7 +593,8 @@ const edit = new Vue({
         // 删除正文目录
         handleRemoveTextInfo(index, type) {
             this.formData.textInfoList.splice(index, 1)
-            this.onFocused()
+            this.onFocused(0)
+            this.onBlured(0)
         },
         // 文件上传成功
         handleUploadSuccess(fileList) {
@@ -595,6 +604,8 @@ const edit = new Vue({
         // 文件移除
         handleFileRemove(file) {
             this.fileList = this.fileList.filter(item => item.uuid !== file.uuid);
+            this.onFocused()
+            this.onBlured()
         },
         // 封面上传成功
         handleCoverUploadSuccess(fileList) {
@@ -606,6 +617,8 @@ const edit = new Vue({
         handleCoverRemove(file) {
             this.formData.image = ''
             this.coverList = this.coverList.filter(item => item.uuid !== file.uuid);
+            this.onFocused()
+            this.onBlured()
         },
         // 资料图片上传
         handleReferenceImageUploadSuccess(fileList){

+ 1 - 2
src/main/resources/templates/supplier-center/encyclopedia/edit.html

@@ -149,8 +149,7 @@
                                     reserve-keyword
                                     :remote-method="fetchQueryKeywordList"
                                     :loading="remoteLoading"
-                                    @click.native="handlerDiscrip"
-                                    @change="handlerTypeId"
+                                    @visible-change="changeVisible"
                             >
                                 <el-option v-for="item in labelList" :key="item.id" :label="item.keyword" :value="item.id"></el-option>
                             </el-select>