bibi 3 years ago
parent 73b4da2eaf
commit 4740daf677

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

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

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

Loading…
Cancel
Save