Explorar el Código

优化采美百科文章自动保存功能

xiebaomin hace 2 años
padre
commit
42a501aa50

+ 10 - 0
src/main/resources/static/js/supplier-center/article/article-edit.js

@@ -174,6 +174,13 @@ var articleEdit = new Vue({
             this.onFocused()
             this.onBlured()
         },
+        changeVisible($event) {
+            if ($event) {
+                this.onFocused()
+            } else {
+                this.onBlured()
+            }
+        },
         // 设置表单初始数据
         setFormData: function setFormData(shopArticle) {
             for (var key in this.formData) {
@@ -217,6 +224,8 @@ var articleEdit = new Vue({
             if (this.chooseLabels.indexOf(this.addLabelName) > -1) return this.addLabelName = '';
             this.chooseLabels.push(this.addLabelName);
             this.addLabelName = '';
+            this.onFocused()
+            this.onBlured()
         },
         // 判断标签是否被选
         checkLabel: function checkLabel(index) {
@@ -234,6 +243,7 @@ var articleEdit = new Vue({
         handleImageRemove: function handleImageRemove(response, file, fileList) {
             this.formData.guidanceImage = "";
             this.articleImageList = [];
+            console.log('移除成功')
         },
         // 保存 提交表单
         handleSave: function handleSave() {

+ 5 - 3
src/main/resources/templates/supplier-center/article/article-edit.html

@@ -81,6 +81,7 @@
                                         reserve-keyword
                                         :remote-method="fetchQueryKeywordList"
                                         :loading="remoteLoading"
+                                        @visible-change="changeVisible"
                                 >
                                     <el-option v-for="item in labelList" :key="item.id" :label="item.keyword" :value="item.id"></el-option>
                                 </el-select>
@@ -102,13 +103,13 @@
                             </el-form-item>
                             <!-- 文章内容 -->
                             <el-form-item label="文章内容" prop="articleContent" class="mint-filter">
-                                <el-input v-model="formData.articleContent" v-show="false" @focus="onFocused" @blur="onBlured"></el-input>
-                                <editor v-model="formData.articleContent" placeholder="请输入文章内容" @focus="onFocused" @blur="onBlured"></editor>
+                                <el-input v-model="formData.articleContent" v-show="false"></el-input>
+                                <editor v-model="formData.articleContent" placeholder="请输入文章内容" @click.native="onFocused"></editor>
                                 <div class="mint-message" v-if="formValidate.articleContent">{{formValidate.articleContent}}</div>
                             </el-form-item>
                             <!-- 文章分类 -->
                             <el-form-item label="文章分类" prop="typeId">
-                                <el-select v-model="formData.typeId" class="max-width" @change="handlerTypeId">
+                                <el-select v-model="formData.typeId" class="max-width" @change="handlerTypeId" @click.native="onFocused">
                                     <template v-for="(typeInfo, index) in articleTypeList">
                                         <el-option :label="typeInfo.typeName" :value="typeInfo.typeId" :key="typeInfo.typeId"></el-option>
                                     </template>
@@ -125,6 +126,7 @@
                                         :on-remove="handleImageRemove"
                                         :file-list="articleImageList"
                                         :limit="1"
+                                        @click.native="onFocused"
                                 >
                                     <i class="el-icon-plus"></i>
                                     <div slot="tip" class="el-upload__tip">建议图片尺寸210px*210px,并上传白底图片</div>