Commit 738b1c9c by zhangquan

bug修复

1 parent b8ef2ee4
...@@ -32,7 +32,10 @@ ...@@ -32,7 +32,10 @@
</div> </div>
<div slot="coverDetailSlot" class="cover-Slot"> <div slot="coverDetailSlot" class="cover-Slot">
<Upload v-if="!formObj.prodImg" :empty="true" @clickEvent="openCoverDialog" :default-style="{width: '84px', height: '84px'}" :formObj="formObj" btnName="创建封面" attr="coverDetail"></Upload> <Upload v-if="!formObj.prodImg" :empty="true" @clickEvent="openCoverDialog" :default-style="{width: '84px', height: '84px'}" :formObj="formObj" btnName="创建封面" attr="coverDetail"></Upload>
<Upload v-else :default-style="{width: '84px', height: '84px'}" :formObj="formObj" btnName="创建封面" attr="prodImg"></Upload> <div v-else class="cover-wrap">
<div class="title">{{formObj.proName}}</div>
<Upload @delImage="delCoverDetail" @editImage="editCoverDetail" :default-style="{width: '88px', height: '60px'}" :isEdit="true" :formObj="formObj" btnName="创建封面" attr="prodImg"></Upload>
</div>
</div> </div>
<div slot="mainImageSlot" class="main-image-Slot"> <div slot="mainImageSlot" class="main-image-Slot">
<Upload placement="right" tip="图片&视频只能上传一个" fileType="all" :formObj="formObj" attr="imageUrl"></Upload> <Upload placement="right" tip="图片&视频只能上传一个" fileType="all" :formObj="formObj" attr="imageUrl"></Upload>
...@@ -93,7 +96,7 @@ ...@@ -93,7 +96,7 @@
</div> </div>
</div> </div>
</glsx-combi-form> </glsx-combi-form>
<ProdCoverDialog @closeDialog="closeDialog" @confirmDialog="confirmDialog" v-if="coverVisible" :visible="coverVisible"></ProdCoverDialog> <ProdCoverDialog @closeDialog="closeDialog" @confirmDialog="confirmDialog" :formObj="coverDeatilFormObj" v-if="coverVisible" :visible="coverVisible"></ProdCoverDialog>
</div> </div>
<GLFooter class="gl-footer"> <GLFooter class="gl-footer">
<el-button class="btn-cancle" @click="goListPage">取消</el-button> <el-button class="btn-cancle" @click="goListPage">取消</el-button>
...@@ -128,6 +131,7 @@ export default { ...@@ -128,6 +131,7 @@ export default {
isEditType: false, isEditType: false,
coverVisible: false, coverVisible: false,
routeInfo: {}, routeInfo: {},
coverDeatilFormObj: {},
contentType: { contentType: {
1: '特色产品', 1: '特色产品',
2: '案例视频', 2: '案例视频',
...@@ -166,10 +170,12 @@ export default { ...@@ -166,10 +170,12 @@ export default {
{ {
required: true, required: true,
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
if (!this.formObj.proName || !this.formObj.prodImg) { if(!this.formObj.prodImg){
callback(new Error('封面详情不能为空')) callback(new Error('产品封面不能为空'))
}else if (!this.formObj.proName) {
callback(new Error('产品名称不能为空'))
} else{ } else{
callback() callback()
} }
}, },
trigger: 'change' trigger: 'change'
...@@ -402,6 +408,18 @@ export default { ...@@ -402,6 +408,18 @@ export default {
showBox(e, key){ showBox(e, key){
if(e){ this[key] = true } if(e){ this[key] = true }
}, },
editCoverDetail(){
this.coverDeatilFormObj = {
title: this.formObj.proName,
url: this.formObj.prodImg
}
this.coverVisible = true
},
delCoverDetail(){
this.formObj.proName = ''
this.formObj.prodImg = ''
this.coverDeatilFormObj = {}
},
confirmDialog(e){ confirmDialog(e){
const { title, url } = e const { title, url } = e
this.formObj.proName = title this.formObj.proName = title
...@@ -577,6 +595,34 @@ export default { ...@@ -577,6 +595,34 @@ export default {
width: 136px; width: 136px;
} }
} }
.cover-wrap{
box-shadow: 0 6px 20px 0 #7a7a7a33;
position: relative;
width: 88px;
height: 86px;
border-radius: 0 0 4px 4px;
/deep/ .img-item, /deep/ .operate{
border-radius: 4px 4px 0 0;
}
.title{
padding: 0 8px;
box-sizing: border-box;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-size: 12px;
color: #323436;
position: absolute;
z-index: 5;
width: 100%;
text-align: center;
height: 26px;
background-color: #fff;
bottom: 0;
line-height: 26px;
border-radius: 0 0 4px 4px;
}
}
.expansion-detail-slot{ .expansion-detail-slot{
.tab-item { .tab-item {
display: inline-block; display: inline-block;
......
...@@ -20,6 +20,15 @@ export default { ...@@ -20,6 +20,15 @@ export default {
visible: { visible: {
type: Boolean, type: Boolean,
default: false default: false
},
formObj: {
type: Object,
default: ()=>{
return {
title: '',
url: ''
}
}
} }
}, },
data(){ data(){
...@@ -30,24 +39,28 @@ export default { ...@@ -30,24 +39,28 @@ export default {
}, },
detailFormData: [ detailFormData: [
{ {
label: '封面标题', label: '产品名称',
name: 'title', name: 'title',
type: 'input', type: 'input',
maxlength: 12, maxlength: 12,
showLimit: true showLimit: true
}, },
{ {
label: '内容标题', label: '产品封面',
name: 'url', name: 'url',
addHtml: 'coverSlot' addHtml: 'coverSlot'
} }
], ],
detailRules: { detailRules: {
title: [{ required: true, message: '请输入产品名称', trigger: 'change' }], title: [{ required: true, message: '请输入产品名称', trigger: 'change' }],
url: [{ required: true, message: '请上传封面', trigger: 'change' }] url: [{ required: true, message: '请上传产品封面', trigger: 'change' }]
}, },
} }
}, },
created(){
const {title, url } = this.formObj
this.detailFormObj = { title, url }
},
methods: { methods: {
onCancel(){ onCancel(){
this.$emit('closeDialog') this.$emit('closeDialog')
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!