|
@@ -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()
|
|
|
}
|
|
|
}
|