Commit 21eea0ac by zhangquan

案例管理添加字段

1 parent 6225b677
......@@ -8,11 +8,11 @@
<div class="text-tip" style="margin: 0;">建议尺寸:272*364</div>
</div>
<div slot="selectBrandSlot">
<el-radio-group v-model="formObj.brandType">
<el-radio-group v-model="formObj.applyBrandType">
<el-radio :label="1">全部品牌</el-radio>
<el-radio :label="2">部分品牌</el-radio>
</el-radio-group>
<div v-if="formObj.brandType == 2">
<div v-if="formObj.applyBrandType == 2">
<el-button class="el-icon-plus" size="small" @click="openBrandDialog">选择品牌</el-button>
<div class="brand-wrap" v-if="brandList && brandList.length">
<div class="brand-item" v-for="item in brandList" :key="item.id">{{ item.name }}</div>
......@@ -47,7 +47,7 @@ export default {
caseName: '',
coverUrl: '',
introduction: '',
brandType: 1,
applyBrandType: 1,
videoCoverArr: []
},
brandList: [],
......@@ -69,7 +69,7 @@ export default {
}, trigger: 'change' }],
introduction: [{ required: true, message: '请输入宣传文案', trigger: 'change' }],
brand: [{ required: true, validator: (rule, value, callback) => {
if(this.formObj.brandType==2 && !this.brandList?.length) {
if(this.formObj.applyBrandType==2 && !this.brandList?.length) {
callback(new Error(`请选择品牌`))
}else{
callback()
......@@ -152,13 +152,12 @@ export default {
if(valid){
let params = JSON.parse(JSON.stringify(this.formObj))
params.coverUrl = this.formObj.videoCoverArr[0]
if(params.brandType == 2){
if(params.applyBrandType == 2){
params.brandList = this.brandList.map(item => {
return { brandId: item.id , brandName: item.name}
})
}
delete params.videoCoverArr
delete params.brandType
if(!params.id) delete params.id
this.$apis.case.addCaseApi(params).then(res => {
console.log(res)
......@@ -182,12 +181,11 @@ export default {
this.$apis.case.getCaseDetailApi({id: this.$route.query.id}).then(res => {
console.log(res)
if(res){
const attrList = ['id', 'mediaId', 'caseName', 'introduction']
const attrList = ['id', 'mediaId', 'caseName', 'introduction', 'applyBrandType']
attrList.forEach(key =>{
this.formObj[key] = res[key]
})
this.formObj.videoCoverArr = [res.coverUrl]
this.formObj.brandType = res.brandList?.length > 0 ? 2 : 1
this.brandList = res.brandList.map(item => ({id: item.brandId, name: item.brandName})) || []
}
})
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!