Compare commits

...

2 Commits

Author SHA1 Message Date
bibi 51cc54d6a4 新增轮播图bug
3 years ago
bibi 4740daf677 1
3 years ago

@ -9,7 +9,7 @@
<template>
<a-config-provider :locale="locale">
<div id="app">
<router-view></router-view>
<router-view v-if="isRouterAlive"></router-view>
</div>
</a-config-provider>
</template>
@ -18,11 +18,25 @@
import zhCN from "ant-design-vue/lib/locale-provider/zh_CN";
export default {
name: 'App',
provide () {
return {
reload: this.reload
}
},
data() {
return {
locale: zhCN
locale: zhCN,
isRouterAlive: true
};
},
methods: {
reload () {
this.isRouterAlive = false
this.$nextTick(() => {
this.isRouterAlive = true
})
}
}
}
</script>

@ -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,27 +5,25 @@
<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>
<img
:src="$ImgUrl(item.imgList[0].url)"
v-if="item.imgList.length > 0"
class="list-img"
alt=""
/>
<span v-else></span>
<div v-else></div>
</a-col>
<a-col :span="11">
<a-col :span="12">
<a-descriptions layout="vertical" :column="1">
<a-descriptions-item label="链接设置">
{{ item.customizeUrl }}
@ -38,12 +36,12 @@
</a-descriptions-item>
</a-descriptions>
</a-col>
<a-col :span="4">
<a-col :span="3">
<a-button class="add-btn" @click="edit(item)"></a-button>
</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>
@ -137,6 +135,7 @@ export default {
components: {
chooseTable,
},
inject: ["reload"],
data() {
return {
table: {
@ -166,6 +165,29 @@ 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();
this.reload();
} 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 +236,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 +294,7 @@ export default {
height: 200px;
}
.list-img {
width: 90%;
width: 300px;
height: 200px;
}
.card-close {

@ -81,6 +81,7 @@ export default {
},
data() {
return {
inject: ["reload"],
table: {
show: false,
},
@ -161,6 +162,7 @@ export default {
if (res.code === 200) {
this.$message.success(res.msg);
this.getData();
this.reload();
this.newSwiperClose();
} else {
this.$message.error(res.msg);

Loading…
Cancel
Save