Ver Fonte

修改bug

chenrui há 2 anos atrás
pai
commit
7efd33835f

+ 52 - 20
src/views/promotionRulesManagement/promotionManagement/editModal.vue

@@ -9,8 +9,8 @@
     @cancel="isShow=false"
     width="76%">
     <!-- 表单 -->
-    <div>
-      <a-spin :spinning="spinning" tip="Loading..." class="promotionEdit-content">
+    <div class="promotionEdit-content" ref="formBox">
+      <a-spin :spinning="spinning" tip="Loading...">
         <a-form-model
           id="promotionEdit-form"
           ref="ruleForm"
@@ -25,7 +25,7 @@
               :maxLength="30"
               v-model.trim="form.title"
               placeholder="请输入标题名称(最多30个字符)"
-              :disabled="pageType === 'edit'"
+              :disabled="isDisabled"
               allowClear/>
           </a-form-model-item>
           <a-form-model-item label="封面图片" prop="imageSet">
@@ -39,6 +39,16 @@
               :maxNums="10"
               @change="changeImage"
               listType="picture-card"></Upload>
+            <Upload
+              v-else-if="pageType==='edit'&&!isDisabled"
+              class="upload"
+              id="promotionEdit-imageSet"
+              v-model="form.imageSet"
+              ref="imageSet"
+              :fileSize="10"
+              :maxNums="10"
+              @change="changeImage"
+              listType="picture-card"></Upload>
             <div v-else>
               <img
                 :src="con"
@@ -57,7 +67,7 @@
               type="number"
               v-model.trim="form.sort"
               placeholder="请输入排序数字(数字越大越靠后)"
-              :disabled="pageType === 'edit'"
+              :disabled="isDisabled"
               allowClear />
           </a-form-model-item>
           <a-form-model-item label="内容类型" prop="contentType">
@@ -67,7 +77,7 @@
               id="promotion-saleStatus"
               code="PROMO_CONTENT_TYPE"
               showType="radio"
-              :disabled="pageType === 'edit'"
+              :disabled="isDisabled"
               allowClear></v-select>
           </a-form-model-item>
           <a-form-model-item label="内容" prop="content" v-show="form.contentType =='IMAGE_CONTENT'">
@@ -78,7 +88,14 @@
               class="promotionEdit-editor"
               @on-change="editorChange"
               :cache="false"></editor>
-            <div v-show="pageType === 'edit'" class="box" v-html="form.content"></div>
+            <editor
+              v-show="pageType === 'edit'&&!isDisabled"
+              id="promotionEdit-editor"
+              ref="editor"
+              class="promotionEdit-editor"
+              @on-change="editorChange"
+              :cache="false"></editor>
+            <div v-show="pageType === 'edit'&&isDisabled" class="box" v-html="form.content"></div>
           </a-form-model-item>
           <a-form-model-item label="上传视频" prop="content" v-show="form.contentType =='VIDEO'">
             <Upload
@@ -88,20 +105,31 @@
               v-model="form.content"
               fileType="video/mp4"
               ref="videoSet"
-              :fileSize="1024"
+              :fileSize="100"
               :maxNums="1"
               @change="changeVideo"
               listType="picture-card"></Upload>
-            <div v-else>
-              <video width="100" height="100" controls loop controlsList="nodownload">
-                <source :src="form.content" type="video/mp4"></source>
+            <Upload
+              v-else-if="pageType==='edit'&&!isDisabled"
+              class="upload"
+              id="promotionEdit-imageSet"
+              v-model="form.content"
+              fileType="video/mp4"
+              ref="videoSet"
+              :fileSize="100"
+              :maxNums="1"
+              @change="changeVideo"
+              listType="picture-card"></Upload>
+            <div v-if="pageType==='edit'&&isDisabled">
+              <video width="230" height="150" controls loop controlsList="nodownload">
+                <source :src="form.content" type="video/mp4">
               </video>
             </div>
-            <span class="upload-desc">说明:文件最大1G;视频:mp4.avi.flv</span>
+            <span class="upload-desc">说明:文件最大100M;视频:mp4.avi.flv</span>
           </a-form-model-item>
           <a-form-model-item label="跳转链接" prop="content" v-show="form.contentType =='LINK'">
             <a-input
-              :disabled="pageType === 'edit'"
+              :disabled="isDisabled"
               id="promotionEdit-title"
               :maxLength="100"
               v-model.trim="form.content"
@@ -193,6 +221,7 @@ export default {
       },
       images: [],
       openShowModal: false,
+      isDisabled: false, // 控制是否能编辑
       rules: {
         title: [
           { required: true, message: '请输入标题名称', trigger: 'blur' }
@@ -228,13 +257,11 @@ export default {
         this.$message.error('请输入预览内容!')
       }
     },
-    onChange (e) {
-      console.log('radio checked', e.target.value)
-    },
     //  详情
     getDetail () {
       promoTerminalDetail({ sn: this.itemId }).then(res => {
         if (res.status == 200) {
+          this.isDisabled = res.data.state != 'CLOSE'
           this.form.promoActiveSn = res.data.promoActiveSn
           this.form.title = res.data.title
           this.form.contentType = res.data.contentType
@@ -242,12 +269,15 @@ export default {
           this.form.enabledFlag = res.data.enabledFlag
           this.form.sort = res.data.sort
           this.images = res.data.imageSet
-          this.form.imageSet = res.data.imageSet
+          this.form.imageSet = res.data.images
+          this.$refs.imageSet.setFileList(res.data.images)
           this.form.content = res.data.content
           if (res.data.contentType == 'IMAGE_CONTENT') {
             this.$refs.editor.setHtml(res.data.content)
           } else if (res.data.contentType == 'VIDEO') {
-            this.content = res.data.content
+            if (res.data.state === 'CLOSE') {
+              this.$refs.videoSet.setFileList(res.data.content)
+            }
           }
         }
       })
@@ -262,6 +292,7 @@ export default {
           if (this.pageType === 'add') {
             formData.imageSet = formData.imageSet ? formData.imageSet.split(',') : []
           }
+          formData.showFlag = formData.enabledFlag == 0 ? '0' : formData.showFlag
           _this.spinning = true
           saveActive(formData).then(res => {
             if (res.status == 200) {
@@ -274,7 +305,6 @@ export default {
             }
           })
         } else {
-          console.log('error')
           return false
         }
       })
@@ -301,7 +331,7 @@ export default {
     isShow (newValue, oldValue) {
       if (!newValue) {
         this.$emit('close')
-        if (this.pageType == 'add') {
+        if (this.pageType == 'add' || !this.isDisabled) {
           this.$refs.imageSet.setFileList('')
           this.$refs.videoSet.setFileList('')
         }
@@ -319,9 +349,11 @@ export default {
           sort: undefined
         }
         this.images = []
+        this.isDisabled = false
         this.$refs.ruleForm.resetFields()
+        this.$refs.formBox.scrollTop = 0
       } else {
-        if (this.pageType === 'edit') {
+        if (this.pageType == 'edit') {
           this.getDetail()
         }
       }

+ 19 - 11
src/views/promotionRulesManagement/promotionManagement/list.vue

@@ -95,9 +95,9 @@
             <template slot="title">
               <span>{{ record.description }}</span>
             </template>
-            <span @click="promotionDesc(record)" class="font1">{{ record.description }}</span>
+            <div @click="promotionDesc(record)" class="desc font1">{{ record.description }}</div>
           </a-tooltip>
-          <span v-else @click="promotionDesc(record)" class="font1">{{ record.description }}</span>
+          <div v-else @click="promotionDesc(record)" class="desc font1">{{ record.description }}</div>
         </template>
         <!-- 促销展示 -->
         <template slot="salesShow" slot-scope="text, record">
@@ -116,16 +116,16 @@
               size="small"
               type="link"
               class="button-warning"
-              @click="handleRelease(record,'edit')"
-              v-if="record.state=='PUBLISH' || record.state=='CLOSE'"
-              id="promotion-modify-btn">发布修改</a-button>
+              @click="promotionEdit(record)"
+              v-if="record.state=='UNPUBLISH' ||record.state=='CLOSE'"
+              id="promotion-edit-btn">促销编辑</a-button>
             <a-button
               size="small"
               type="link"
               class="button-warning"
-              @click="promotionEdit(record)"
-              v-if="record.state=='UNPUBLISH' ||record.state=='CLOSE'"
-              id="promotion-edit-btn">促销编辑</a-button>
+              @click="handleRelease(record,'edit')"
+              v-if="record.state=='PUBLISH' || record.state=='CLOSE'"
+              id="promotion-modify-btn">发布修改</a-button>
             <a-button
               size="small"
               type="link"
@@ -230,7 +230,7 @@ export default {
         { title: '促销名称', dataIndex: 'name', width: '12%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '促销时间', scopedSlots: { customRender: 'promotionTime' }, width: '8%', align: 'center' },
         { title: '参与客户', scopedSlots: { customRender: 'joinCustomers' }, width: '12%', align: 'center' },
-        { title: '促销描述', scopedSlots: { customRender: 'salesDesc' }, width: '12%', align: 'center', ellipsis: true },
+        { title: '促销描述', scopedSlots: { customRender: 'salesDesc' }, width: '12%', align: 'center' },
         { title: '促销展示', scopedSlots: { customRender: 'salesShow' }, width: '6%', align: 'center' },
         { slots: { title: 'arrowFalgTitle' }, scopedSlots: { customRender: 'arrowFalg' }, width: '6%', align: 'center' },
         { title: '促销状态', dataIndex: 'stateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
@@ -327,7 +327,7 @@ export default {
     // 促销发布
     handleRelease (row, type) {
       this.itemId = row.promoActiveSn
-      this.pageType = type
+      this.pageType = row.imageSet && row.imageSet.length > 0 ? 'edit' : type
       this.$nextTick(() => {
         this.openPromotionEditModal = true
       })
@@ -376,8 +376,16 @@ export default {
   }
 }
 </script>
-<style lang="less">
+<style lang="less" scoped>
   .font1{
    color:#39f;
   }
+  .desc{
+    width: 100%;
+    overflow: hidden;
+    text-overflow: ellipsis;
+    display: -webkit-box;
+    -webkit-line-clamp: 3;
+    -webkit-box-orient: vertical;
+  }
 </style>

+ 3 - 4
src/views/promotionRulesManagement/promotionManagement/promotionShowModal.vue

@@ -10,8 +10,8 @@
     :width="500">
     <div class="promotionDesc-con">
       <img src="@/assets/iphone.png" alt="图片走丢了" srcset="">
-      <div class="promotionDescCon" v-show="showType==='IMAGE_CONTENT'" v-html="mainContent"></div>
-      <div class="promotionDescCon" v-show="showType=='VIDEO'" >
+      <div class="promotionDescCon" v-if="showType==='IMAGE_CONTENT'" v-html="mainContent"></div>
+      <div class="promotionDescCon" v-if="showType=='VIDEO'" >
         <video width="100%" height="auto" controls loop controlsList="nodownload">
           <source :src="mainContent" type="video/mp4"></source>
         </video>
@@ -26,7 +26,6 @@
 
 <script>
 import { commonMixin } from '@/utils/mixin'
-import { promoTerminalDetail } from '@/api/promoTerminal'
 export default {
   name: 'PromotionDescModal',
   mixins: [commonMixin],
@@ -47,7 +46,7 @@ export default {
   methods: {
     pageInit (con) {
       this.showType = con.type
-     this.mainContent = con.con
+      this.mainContent = con.con
     }
   },
   watch: {