Ver código fonte

编辑界面bug修改

喻文俊 3 anos atrás
pai
commit
59ace06684

+ 25 - 0
src/main/resources/static/js/supplier-center/encyclopedia/instrument-edit.js

@@ -306,6 +306,31 @@ new Vue({
             this.imageList = this.initPreviewImageList([formData.image], { name: '授权图片' });
             this.authImageList = this.initPreviewImageList(formData.authImageList, { name: '授权图片' });
             this.displayImageList = this.initPreviewImageList(formData.displayImageList, { name: '效果图' });
+
+            // 初始化参数列表
+            if (formData.questionList.length < this.questionMinLimit) {
+                const newQuestionList = [];
+                for (var i = 0; i < this.questionMinLimit; i++) {
+                    if (formData.questionList[i]) {
+                        newQuestionList[i] = formData.questionList[i]
+                    } else {
+                        newQuestionList[i] = {question: '', answer: '',}
+                    }
+                }
+                this.formData.questionList = newQuestionList
+            }
+            // 初始化问题列表
+            if (formData.paramList.length < this.paramsMinLimit) {
+                const newParamList = [];
+                for (var i = 0; i < this.paramsMinLimit; i++) {
+                    if (formData.paramList[i]) {
+                        newParamList[i] = formData.paramList[i]
+                    } else {
+                        newParamList[i] = {name: '', content: '',}
+                    }
+                }
+                this.formData.paramList = newParamList
+            }
         },
 
         // 初始化图片

+ 29 - 3
src/main/resources/static/js/supplier-center/encyclopedia/product-edit.js

@@ -275,7 +275,7 @@ new Vue({
         },
 
         // 初始化表单数据
-        initFormData(formData) {
+        initFormData: function(formData) {
             console.log(formData);
             // 初始化this.formData
             for (var key in this.formData) {
@@ -292,6 +292,32 @@ new Vue({
             this.imageList = this.initPreviewImageList([formData.image], {name: '授权图片'});
             this.authImageList = this.initPreviewImageList(formData.authImageList, {name: '授权图片'});
             this.displayImageList = this.initPreviewImageList(formData.displayImageList, {name: '效果图'});
+
+
+            // 初始化参数列表
+            if (formData.questionList.length < this.questionMinLimit) {
+                const newQuestionList = [];
+                for (var i = 0; i < this.questionMinLimit; i++) {
+                    if (formData.questionList[i]) {
+                        newQuestionList[i] = formData.questionList[i]
+                    } else {
+                        newQuestionList[i] = {question: '', answer: '',}
+                    }
+                }
+                this.formData.questionList = newQuestionList
+            }
+            // 初始化问题列表
+            if (formData.paramList.length < this.paramsMinLimit) {
+                const newParamList = [];
+                for (var i = 0; i < this.paramsMinLimit; i++) {
+                    if (formData.paramList[i]) {
+                        newParamList[i] = formData.paramList[i]
+                    } else {
+                        newParamList[i] = {name: '', content: '',}
+                    }
+                }
+                this.formData.paramList = newParamList
+            }
         },
 
         // 初始化图片
@@ -312,9 +338,9 @@ new Vue({
         // 获取表单数据
         getProductFormData() {
             this.productId = localStorage.getItem('productId');
-            localStorage.removeItem('productId');
+            // localStorage.removeItem('productId');
 
-            if (!this.productId) return;
+            // if (!this.productId) return;
 
             const that = this;
             SupplierApi.GetShopBaikeProductForm({productId: this.productId}, function (res) {