bibi 3 years ago
parent 73b4da2eaf
commit 4740daf677

@ -280,6 +280,7 @@ export default {
},
close(){
this.$refs.ruleForm.resetFields();
this.fileList = []
this.formType = 'add'
},
handleCancel() {

@ -131,6 +131,7 @@ export default {
},
submit() {
console.log(this.documentList);
//
let arr = [];
for (let k of this.documentList) {
if (k.response) {
@ -140,6 +141,16 @@ export default {
}
}
this.form.annexUrls = arr;
//
let pic = [];
for (let k of this.fileList) {
if (k.response) {
pic.push(k.response.data);
} else {
pic.push(k.url.split("/")[k.url.split("/").length - 1]);
}
}
this.form.coverImgUrls = pic;
console.log(this.form);
this.$refs.ruleForm.validate(async (valid) => {
if (valid) {
@ -208,7 +219,7 @@ export default {
}
this.fileList = pic;
} else {
this.form.coverImgList = [];
this.form.coverImgUrls = [];
}
if (res.data.annexImgList.length > 0) {
console.log(res.data.annexImgList);
@ -225,7 +236,7 @@ export default {
}
this.documentList = file;
} else {
this.form.coverImgList = [];
this.form.annexUrls = [];
}
});
} else {

@ -5,25 +5,23 @@
<a-button class="add-btn" style="margin: 10px" @click="newSwiper"
>添加轮播图</a-button
>
<!-- list -->
<a-card
hoverable
style="width: 70%; margin-top: 10px"
style="width:1000px; margin-top: 10px"
v-for="item in cardList"
:key="item.id"
>
<span class="card-close" @click="del(item.id)">×</span>
<a-row>
<a-col :span="9">
<div style="color: #00000073; padding-bottom: 10px">
上传图片尺寸: 750*300
</div>
<a-col :span="9" style="display:flex;justify-content: center">
<img
:src="$ImgUrl(item.imgList[0].url)"
v-if="item.imgList.length > 0"
class="list-img"
alt=""
/>
<span v-else></span>
<div v-else style="align-self:center">暂无图片</div>
</a-col>
<a-col :span="11">
<a-descriptions layout="vertical" :column="1">
@ -43,7 +41,7 @@
</a-col>
</a-row>
</a-card>
<!-- list -->
<!-- 添加 -->
<a-modal
:title="add.title"
:visible="add.show"
@ -53,7 +51,7 @@
>
<a-row>
<a-col :span="9">
<div style="color: #00000073; padding-bottom: 10px">
<div style="color: #00000073; padding-bottom: 10px;">
上传图片尺寸: 750*300
</div>
<commonUpload
@ -118,7 +116,7 @@
<chooseTable
:show="table.show"
:type="form.type"
@submit="submit"
@submit="submitURL"
@close="close"
/>
</div>
@ -166,6 +164,28 @@ export default {
title: "添加轮播图",
};
},
//
async saveSetting() {
if (this.add.title === "添加轮播图") {
let res = await swiperInsert(this.form);
if (res.code === 200) {
this.$message.success(res.msg);
this.newSwiperClose();
this.getData();
} else {
this.$message.error(res.msg);
}
} else if (this.add.title === "修改轮播图") {
let res = await swiperUpdate(this.form);
if (res.code === 200) {
this.$message.success(res.msg);
this.getData();
this.newSwiperClose();
} else {
this.$message.error(res.msg);
}
}
},
//
edit(data) {
this.add = {
@ -214,33 +234,11 @@ export default {
};
},
//
submit(data, customizeUrl) {
submitURL(data, customizeUrl) {
this.form.customizeUrl = customizeUrl;
this.form.associationId = data[0];
this.close();
},
//
async saveSetting() {
if (this.add.title === "添加轮播图") {
let res = await swiperInsert(this.form);
if (res.code === 200) {
this.$message.success(res.msg);
this.getData();
this.newSwiperClose();
} else {
this.$message.error(res.msg);
}
} else if (this.add.title === "修改轮播图") {
let res = await swiperUpdate(this.form);
if (res.code === 200) {
this.$message.success(res.msg);
this.getData();
this.newSwiperClose();
} else {
this.$message.error(res.msg);
}
}
},
//
close() {
this.table.show = false;
@ -294,7 +292,7 @@ export default {
height: 200px;
}
.list-img {
width: 90%;
width: 300px;
height: 200px;
}
.card-close {

Loading…
Cancel
Save