소스 검색

修改 - 添加及更新皮肤页面类型的储存方式;修改了一下编辑皮肤时出现的bug(回显时是上一条数据)

15313670163 6 일 전
부모
커밋
f688601894
1개의 변경된 파일16개의 추가작업 그리고 2개의 파일을 삭제
  1. 16 2
      src/views/componentGallery/skin.vue

+ 16 - 2
src/views/componentGallery/skin.vue

@@ -410,7 +410,8 @@ export default {
             },
             //图片json
             img_arr: [],
-
+            // 页面类型json
+            page_arr: [],
             value: '',
             options: [],
 
@@ -426,6 +427,7 @@ export default {
                 templateImg: [], //皮肤图片
                 templateKeyword: [], //皮肤关键词
                 templateId: '', //皮肤编号
+                templatePage: [], //页面类型
             },
             rules: {
                 templateStyle: [{ required: true, trigger: 'blur', validator: validateEmpty }],
@@ -569,6 +571,7 @@ export default {
             this.ruleForm.templateName = val.template_name
             this.img_arr = JSON.parse(val.template_img)
             this.tags = val.template_keyword ? val.template_keyword.split("|") : []
+            this.ruleForm.templateKeyword = val.template_keyword? val.template_keyword.split("|") : []
             this.ruleForm.templateId = val.template_id
             this.homeImg = ''
             this.logoUrl_home = ''
@@ -584,7 +587,7 @@ export default {
             this.logoUrl_sList = ''
             this.sDetailImg = ''
             this.logoUrl_sDetail = ''
-
+            this.page_arr = []
             for (let item of this.img_arr) {
                 if (item.name == '首页') {
                     this.logoUrl_home = item.url
@@ -654,36 +657,43 @@ export default {
             if (this.logoUrl_home) {
                 this.home_obj.url = this.homeImg
                 this.img_arr.push(this.home_obj)
+                this.page_arr.push(1);
             }
             //频道页
             if (this.logoUrl_class) {
                 this.class_obj.url = this.classifyImg
                 this.img_arr.push(this.class_obj)
+                this.page_arr.push(2);
             }
             //列表页
             if (this.logoUrl_list) {
                 this.list_obj.url = this.listImg
                 this.img_arr.push(this.list_obj)
+                this.page_arr.push(3);
             }
             //详情页
             if (this.logoUrl_detail) {
                 this.detail_obj.url = this.detailImg
                 this.img_arr.push(this.detail_obj)
+                this.page_arr.push(4);
             }
             //搜索页
             if (this.logoUrl_search) {
                 this.search_obj.url = this.searchImg
                 this.img_arr.push(this.search_obj)
+                this.page_arr.push(5);
             }
             //特殊列表页
             if (this.logoUrl_sList) {
                 this.sList_obj.url = this.sListImg
                 this.img_arr.push(this.sList_obj)
+                this.page_arr.push(6)
             }
             //特殊详情页
             if (this.logoUrl_sDetail) {
                 this.sDetail_obj.url = this.sDetailImg
                 this.img_arr.push(this.sDetail_obj)
+                this.page_arr.push(7)
             }
             function cleanObProp(arr) {
                 return arr.map(item => {
@@ -696,8 +706,10 @@ export default {
                     return newItem;
                 });
             }
+            console.log('page-----------------------------------------',this.page_arr);
             const cleanArray = cleanObProp(this.img_arr);
             this.ruleForm.templateImg = JSON.stringify(cleanArray);
+            this.ruleForm.templatePage = JSON.stringify(this.page_arr);
             // console.log(this.ruleForm.templateImg);
 
             if (this.dialogName == "添加") {
@@ -707,6 +719,7 @@ export default {
                     template_class_id: this.ruleForm.templateStyle, //皮肤风格id
                     template_keyword: this.ruleForm.templateKeyword, //皮肤关键词
                     template_id: this.ruleForm.templateId, //皮肤编号
+                    page_type: this.ruleForm.templatePage, //页面类型
                 }).then(data => {
                     if (data.code == 200) {
                         this.$message({
@@ -740,6 +753,7 @@ export default {
                     template_class_id: this.ruleForm.templateStyle, //皮肤风格id
                     template_keyword: this.ruleForm.templateKeyword, //皮肤关键词
                     template_id: this.ruleForm.templateId, //皮肤编号
+                    page_type: this.ruleForm.templatePage, //页面类型
                 }
                 this.$store.dispatch('genre/updateTemplate', data).then(res => {
                     if (res.code == 200) {