Browse Source

修改bug

chenrui 10 months ago
parent
commit
82680fb247

+ 24 - 7
src/views/easyPassManagement/homepageCarouselImg/edit.vue

@@ -110,11 +110,12 @@
                   showType="radio"
                   showType="radio"
                   :notIn="notShowSel"
                   :notIn="notShowSel"
                   :disabled="isDisabled"
                   :disabled="isDisabled"
+                  @change="changeContentType"
                   allowClear></v-select>
                   allowClear></v-select>
               </a-form-model-item>
               </a-form-model-item>
             </a-col>
             </a-col>
             <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
             <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
-              <a-form-model-item label="内容" prop="content" v-show="form.contentType =='IMAGE_CONTENT'">
+              <a-form-model-item label="内容" prop="contentEditor" v-show="form.contentType =='IMAGE_CONTENT'">
                 <editor
                 <editor
                   v-show="!isDisabled"
                   v-show="!isDisabled"
                   id="carouselImageEdit-editor"
                   id="carouselImageEdit-editor"
@@ -207,7 +208,8 @@ export default {
         contentType: 'LINK', // 内容类型
         contentType: 'LINK', // 内容类型
         content: '', // 内容
         content: '', // 内容
         contentLink: '', // 内容链接
         contentLink: '', // 内容链接
-        state: 'UNPUBLISH'// 发布状态
+        state: 'UNPUBLISH', // 发布状态
+        contentEditor: ''
       },
       },
       chooseSnList: [],
       chooseSnList: [],
       dateFormat: 'YYYY-MM-DD', // 有效期时间格式
       dateFormat: 'YYYY-MM-DD', // 有效期时间格式
@@ -220,8 +222,9 @@ export default {
         allDealerFlag: [{ required: true, message: '请选择参与经销商', trigger: 'change' }],
         allDealerFlag: [{ required: true, message: '请选择参与经销商', trigger: 'change' }],
         imageUrl: [{ required: true, message: '请选择要上传的封面图片', trigger: 'change' }],
         imageUrl: [{ required: true, message: '请选择要上传的封面图片', trigger: 'change' }],
         contentType: [{ required: true, message: '请选择内容类型', trigger: 'change' }],
         contentType: [{ required: true, message: '请选择内容类型', trigger: 'change' }],
-        content: [{ required: true, message: '请输入对应内容', trigger: ['blur', 'change'] }],
-        contentLink: [{ required: true, message: '请输入对应内容', trigger: ['blur', 'change'] }]
+        content: [{ required: true, message: '请选择视频展示', trigger: ['blur', 'change'] }],
+        contentLink: [{ required: true, message: '请输入跳转链接', trigger: ['blur', 'change'] }],
+        contentEditor: [{ required: true, message: '请输入图文内容', trigger: ['blur', 'change'] }]
       }
       }
     }
     }
   },
   },
@@ -253,6 +256,11 @@ export default {
       this.chooseSnList = []
       this.chooseSnList = []
       this.openDealerModal = false
       this.openDealerModal = false
     },
     },
+    // 切换类型  清空内容显示
+    changeContentType (val) {
+      this.form.content = ''
+      this.form.contentLink = ''
+    },
     // 部分经销商 删除
     // 部分经销商 删除
     delBuyerName (row) {
     delBuyerName (row) {
       const pos = this.chooseDealerList.findIndex(item => item.dealerSn == row.dealerSn)
       const pos = this.chooseDealerList.findIndex(item => item.dealerSn == row.dealerSn)
@@ -279,6 +287,7 @@ export default {
           if (res.data.bizType && res.data.bizType === 'SHOP_PROMO') {
           if (res.data.bizType && res.data.bizType === 'SHOP_PROMO') {
             _this.isDisabled = true
             _this.isDisabled = true
           }
           }
+
           if (res.data.contentType == 'IMAGE_CONTENT') {
           if (res.data.contentType == 'IMAGE_CONTENT') {
             _this.$refs.editor.setHtml(res.data.content)
             _this.$refs.editor.setHtml(res.data.content)
           } else if (res.data.contentType == 'VIDEO') {
           } else if (res.data.contentType == 'VIDEO') {
@@ -291,9 +300,11 @@ export default {
           }
           }
           _this.$refs.imageSet.setFileList(res.data.imageUrl)
           _this.$refs.imageSet.setFileList(res.data.imageUrl)
           _this.form = { ..._this.form, ...res.data }
           _this.form = { ..._this.form, ...res.data }
+          _this.form.contentEditor = res.data.content
           _this.$nextTick(() => {
           _this.$nextTick(() => {
             _this.form.time = [res.data.bannerStartDate, res.data.bannerEndDate]
             _this.form.time = [res.data.bannerStartDate, res.data.bannerEndDate]
           })
           })
+          console.log('22222222222222:', _this.form)
         }
         }
       })
       })
     },
     },
@@ -303,6 +314,10 @@ export default {
       if (_this.form.contentType === 'LINK') {
       if (_this.form.contentType === 'LINK') {
         _this.form.content = _this.form.contentLink
         _this.form.content = _this.form.contentLink
       }
       }
+      if (_this.form.contentType === 'IMAGE_CONTENT') {
+        _this.form.content = _this.form.contentEditor
+      }
+      console.log('11111111111:', _this.form)
       // 验证组件必填项
       // 验证组件必填项
       _this.$refs.ruleForm.validate(valid => {
       _this.$refs.ruleForm.validate(valid => {
         if (valid) {
         if (valid) {
@@ -324,6 +339,7 @@ export default {
       var formData = JSON.parse(JSON.stringify(_this.form))
       var formData = JSON.parse(JSON.stringify(_this.form))
       delete formData.time
       delete formData.time
       delete formData.contentLink
       delete formData.contentLink
+      delete formData.contentEditor
       _this.spinning = true
       _this.spinning = true
       saveShopBanner(formData).then(res => {
       saveShopBanner(formData).then(res => {
         if (res.status == 200) {
         if (res.status == 200) {
@@ -348,9 +364,9 @@ export default {
     },
     },
     //  文本编辑器
     //  文本编辑器
     editorChange (html, text) {
     editorChange (html, text) {
-      this.form.content = html
+      this.form.contentEditor = html
       if (html) {
       if (html) {
-        this.$refs.ruleForm.clearValidate('content')
+        this.$refs.ruleForm.clearValidate('contentEditor')
       }
       }
     },
     },
     // 重置
     // 重置
@@ -368,7 +384,8 @@ export default {
         contentType: 'LINK', // 内容类型
         contentType: 'LINK', // 内容类型
         content: '', // 内容
         content: '', // 内容
         contentLink: '',
         contentLink: '',
-        state: 'UNPUBLISH'
+        state: 'UNPUBLISH',
+        contentEditor: ''
       }
       }
       if (this.$refs.imageSet) {
       if (this.$refs.imageSet) {
         this.$refs.imageSet.setFileList('')
         this.$refs.imageSet.setFileList('')

+ 1 - 1
src/views/easyPassManagement/homepageCarouselImg/list.vue

@@ -191,7 +191,7 @@ export default {
       if (!row) {
       if (!row) {
         this.$router.push({ name: 'carouselImageAdd' })
         this.$router.push({ name: 'carouselImageAdd' })
       } else {
       } else {
-        this.$router.push({ name: 'carouselImageEdit', params: { sn: row.bannerSn, bizType: row.bizType } })
+        this.$router.push({ name: 'carouselImageEdit', params: { sn: row.bannerSn, bizType: row.bizType || 'none' } })
       }
       }
     },
     },
     //  创建时间  change
     //  创建时间  change