|
|
@ -2,13 +2,55 @@
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<div class="cardTitle">首页轮播图设置</div>
|
|
|
|
<div class="cardTitle">首页轮播图设置</div>
|
|
|
|
<a-divider></a-divider>
|
|
|
|
<a-divider></a-divider>
|
|
|
|
<a-button class="add-btn" style="margin: 10px" @click="addCard = true"
|
|
|
|
<a-button class="add-btn" style="margin: 10px" @click="newSwiper"
|
|
|
|
>添加轮播图</a-button
|
|
|
|
>添加轮播图</a-button
|
|
|
|
>
|
|
|
|
>
|
|
|
|
|
|
|
|
<a-card
|
|
|
|
<!-- 新增 -->
|
|
|
|
hoverable
|
|
|
|
<a-card style="width: 70%; margin-top: 10px" @close="del" v-if="addCard">
|
|
|
|
style="width: 70%; margin-top: 10px"
|
|
|
|
<span class="card-close" @click="addCard = false">×</span>
|
|
|
|
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>
|
|
|
|
|
|
|
|
</a-col>
|
|
|
|
|
|
|
|
<a-col :span="11">
|
|
|
|
|
|
|
|
<a-descriptions layout="vertical" :column="1">
|
|
|
|
|
|
|
|
<a-descriptions-item label="链接设置">
|
|
|
|
|
|
|
|
{{ item.customizeUrl }}
|
|
|
|
|
|
|
|
</a-descriptions-item>
|
|
|
|
|
|
|
|
<a-descriptions-item label="是否显示在用户端">
|
|
|
|
|
|
|
|
{{ item.isShow ? "是" : "否" }}
|
|
|
|
|
|
|
|
</a-descriptions-item>
|
|
|
|
|
|
|
|
<a-descriptions-item label="显示权重">
|
|
|
|
|
|
|
|
{{ item.showWeights }}
|
|
|
|
|
|
|
|
</a-descriptions-item>
|
|
|
|
|
|
|
|
</a-descriptions>
|
|
|
|
|
|
|
|
</a-col>
|
|
|
|
|
|
|
|
<a-col :span="4">
|
|
|
|
|
|
|
|
<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"
|
|
|
|
|
|
|
|
@ok="saveSetting"
|
|
|
|
|
|
|
|
@cancel="newSwiperClose"
|
|
|
|
|
|
|
|
width="900px"
|
|
|
|
|
|
|
|
>
|
|
|
|
<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">
|
|
|
@ -19,7 +61,7 @@
|
|
|
|
@handleChange="handleChange"
|
|
|
|
@handleChange="handleChange"
|
|
|
|
></commonUpload>
|
|
|
|
></commonUpload>
|
|
|
|
</a-col>
|
|
|
|
</a-col>
|
|
|
|
<a-col :span="11">
|
|
|
|
<a-col :span="15">
|
|
|
|
<a-descriptions layout="vertical" :column="1">
|
|
|
|
<a-descriptions layout="vertical" :column="1">
|
|
|
|
<a-descriptions-item label="链接设置">
|
|
|
|
<a-descriptions-item label="链接设置">
|
|
|
|
<a-input-group compact>
|
|
|
|
<a-input-group compact>
|
|
|
@ -27,6 +69,7 @@
|
|
|
|
style="width: 120px"
|
|
|
|
style="width: 120px"
|
|
|
|
v-model="form.type"
|
|
|
|
v-model="form.type"
|
|
|
|
placeholder="请选择类型"
|
|
|
|
placeholder="请选择类型"
|
|
|
|
|
|
|
|
@change="changeType"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<a-select-option :value="1"> 自定义链接 </a-select-option>
|
|
|
|
<a-select-option :value="1"> 自定义链接 </a-select-option>
|
|
|
|
<a-select-option :value="2"> 商城 </a-select-option>
|
|
|
|
<a-select-option :value="2"> 商城 </a-select-option>
|
|
|
@ -38,19 +81,20 @@
|
|
|
|
v-if="form.type === 1"
|
|
|
|
v-if="form.type === 1"
|
|
|
|
style="width: 200px; background: #0000000f"
|
|
|
|
style="width: 200px; background: #0000000f"
|
|
|
|
placeholder="请输入链接"
|
|
|
|
placeholder="请输入链接"
|
|
|
|
|
|
|
|
v-model="form.customizeUrl"
|
|
|
|
></a-input>
|
|
|
|
></a-input>
|
|
|
|
<a-button
|
|
|
|
<a-button
|
|
|
|
v-else-if="form.type !== 1 && form.customizeUrl === ''"
|
|
|
|
v-else-if="form.type !== 1 && form.customizeUrl === ''"
|
|
|
|
style="width: 100px; background: #0000000f"
|
|
|
|
style="width: 100px; background: #0000000f"
|
|
|
|
@click='checkList(form.type)'
|
|
|
|
@click="table.show = true"
|
|
|
|
>请选择链接
|
|
|
|
>请选择链接
|
|
|
|
</a-button>
|
|
|
|
</a-button>
|
|
|
|
<a-input
|
|
|
|
<a-button
|
|
|
|
|
|
|
|
style="width: 70%; background: #0000000f; overflow: hidden"
|
|
|
|
|
|
|
|
@click="table.show = true"
|
|
|
|
v-else
|
|
|
|
v-else
|
|
|
|
v-model="form.customizeUrl"
|
|
|
|
>{{ form.customizeUrl }}</a-button
|
|
|
|
style="width: 300px; background: #0000000f"
|
|
|
|
>
|
|
|
|
disabled
|
|
|
|
|
|
|
|
></a-input>
|
|
|
|
|
|
|
|
</a-input-group>
|
|
|
|
</a-input-group>
|
|
|
|
</a-descriptions-item>
|
|
|
|
</a-descriptions-item>
|
|
|
|
<a-descriptions-item label="是否显示在用户端">
|
|
|
|
<a-descriptions-item label="是否显示在用户端">
|
|
|
@ -64,23 +108,97 @@
|
|
|
|
</a-descriptions-item>
|
|
|
|
</a-descriptions-item>
|
|
|
|
</a-descriptions>
|
|
|
|
</a-descriptions>
|
|
|
|
</a-col>
|
|
|
|
</a-col>
|
|
|
|
<a-col :span="4">
|
|
|
|
|
|
|
|
<a-button class="add-btn">保存设置</a-button>
|
|
|
|
|
|
|
|
</a-col>
|
|
|
|
|
|
|
|
</a-row>
|
|
|
|
</a-row>
|
|
|
|
</a-card>
|
|
|
|
</a-modal>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<chooseTable
|
|
|
|
|
|
|
|
:show="table.show"
|
|
|
|
|
|
|
|
:type="form.type"
|
|
|
|
|
|
|
|
@submit="submit"
|
|
|
|
|
|
|
|
@close="close"
|
|
|
|
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
|
import { swiperList } from "@/api/operation/swiper";
|
|
|
|
import { form } from "./depend/config";
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
|
|
|
swiperList,
|
|
|
|
|
|
|
|
swiperInsert,
|
|
|
|
|
|
|
|
swiperDel,
|
|
|
|
|
|
|
|
swiperUpdate,
|
|
|
|
|
|
|
|
} from "@/api/operation/swiper";
|
|
|
|
|
|
|
|
import chooseTable from "./depend/table.vue";
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
|
|
|
|
|
components: {
|
|
|
|
|
|
|
|
chooseTable,
|
|
|
|
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
|
|
|
|
table: {
|
|
|
|
|
|
|
|
show: false,
|
|
|
|
|
|
|
|
},
|
|
|
|
fileList: [],
|
|
|
|
fileList: [],
|
|
|
|
cardList: [],
|
|
|
|
cardList: [],
|
|
|
|
addCard: true,
|
|
|
|
add: {
|
|
|
|
form: {
|
|
|
|
show: false,
|
|
|
|
|
|
|
|
title: "添加轮播图",
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
form,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
|
|
|
|
|
|
|
this.getData();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
async getData() {
|
|
|
|
|
|
|
|
let res = await swiperList();
|
|
|
|
|
|
|
|
this.cardList = res.data;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
// 新增
|
|
|
|
|
|
|
|
newSwiper() {
|
|
|
|
|
|
|
|
this.add = {
|
|
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
|
|
title: "添加轮播图"
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
// 编辑
|
|
|
|
|
|
|
|
edit(data) {
|
|
|
|
|
|
|
|
this.add = {
|
|
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
|
|
title: "修改轮播图"
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
console.log(data);
|
|
|
|
|
|
|
|
this.form.id = data.id;
|
|
|
|
|
|
|
|
this.form.isShow = data.isShow;
|
|
|
|
|
|
|
|
this.form.showWeights = data.showWeights;
|
|
|
|
|
|
|
|
this.form.type = data.type;
|
|
|
|
|
|
|
|
this.form.customizeUrl = data.customizeUrl;
|
|
|
|
|
|
|
|
this.form.associationId = data.associationId;
|
|
|
|
|
|
|
|
if (data.imgList.length > 0) {
|
|
|
|
|
|
|
|
// 如果已经有图片
|
|
|
|
|
|
|
|
this.form.imgUrls.push(data.imgList[0].url);
|
|
|
|
|
|
|
|
const file = [];
|
|
|
|
|
|
|
|
for (let item of data.imgList) {
|
|
|
|
|
|
|
|
let obj = {
|
|
|
|
|
|
|
|
name: item.url.split("_")[0] + "." + item.url.split(".")[1],
|
|
|
|
|
|
|
|
url: this.$ImgUrl(item.url),
|
|
|
|
|
|
|
|
uid: item.url.split("_")[1],
|
|
|
|
|
|
|
|
status: "done",
|
|
|
|
|
|
|
|
thumbUrl: this.$ImgUrl(item.url),
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
file.push(obj);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.fileList = file;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
newSwiperClose() {
|
|
|
|
|
|
|
|
this.add = {
|
|
|
|
|
|
|
|
show: false,
|
|
|
|
|
|
|
|
title: "添加轮播图",
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
this.fileList = [];
|
|
|
|
|
|
|
|
this.form = {
|
|
|
|
id: undefined,
|
|
|
|
id: undefined,
|
|
|
|
type: undefined,
|
|
|
|
type: undefined,
|
|
|
|
showWeights: 0,
|
|
|
|
showWeights: 0,
|
|
|
@ -88,33 +206,69 @@ export default {
|
|
|
|
isShow: false,
|
|
|
|
isShow: false,
|
|
|
|
associationId: undefined,
|
|
|
|
associationId: undefined,
|
|
|
|
imgUrls: [],
|
|
|
|
imgUrls: [],
|
|
|
|
},
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
// 选择链接确定
|
|
|
|
// this.getData()
|
|
|
|
submit(data, customizeUrl) {
|
|
|
|
|
|
|
|
this.form.customizeUrl = customizeUrl;
|
|
|
|
|
|
|
|
this.form.associationId = data[0];
|
|
|
|
|
|
|
|
this.close();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
// 保存
|
|
|
|
async getData() {
|
|
|
|
async saveSetting() {
|
|
|
|
let res = await swiperList();
|
|
|
|
if (this.add.title === "添加轮播图") {
|
|
|
|
this.cardList = res.data;
|
|
|
|
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);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
checkList(type){
|
|
|
|
// 关闭选择
|
|
|
|
if(type===2){
|
|
|
|
close() {
|
|
|
|
|
|
|
|
this.table.show = false;
|
|
|
|
}else if(type===3){
|
|
|
|
},
|
|
|
|
|
|
|
|
changeType() {
|
|
|
|
}else if(type===4){
|
|
|
|
this.form.customizeUrl = "";
|
|
|
|
|
|
|
|
},
|
|
|
|
}else if(type===5){
|
|
|
|
// 删除轮播图
|
|
|
|
|
|
|
|
async del(id) {
|
|
|
|
|
|
|
|
this.$confirm({
|
|
|
|
|
|
|
|
title: "是否删除",
|
|
|
|
|
|
|
|
icon: "delete",
|
|
|
|
|
|
|
|
onOk: async () => {
|
|
|
|
|
|
|
|
swiperDel({ homepageCarouselId: id }).then((res) => {
|
|
|
|
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
|
|
|
this.$message.success(res.msg);
|
|
|
|
|
|
|
|
this.getData();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.$message.error(res.msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
del(id) {},
|
|
|
|
// 上传图片
|
|
|
|
handleChange(data) {
|
|
|
|
handleChange(data) {
|
|
|
|
|
|
|
|
console.log(data);
|
|
|
|
this.fileList = data;
|
|
|
|
this.fileList = data;
|
|
|
|
if (data[0].status === "done") {
|
|
|
|
// 删除照片
|
|
|
|
// this.form.imgUrls.push(data[0].response.data);
|
|
|
|
if(this.fileList.length===0){
|
|
|
|
|
|
|
|
this.form.imgUrls=[]
|
|
|
|
|
|
|
|
}else if (data[0].status === "done") {
|
|
|
|
|
|
|
|
this.form.imgUrls.push(data[0].response.data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -130,6 +284,14 @@ export default {
|
|
|
|
width: 90%;
|
|
|
|
width: 90%;
|
|
|
|
height: 200px;
|
|
|
|
height: 200px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/deep/.ant-upload-list-picture-card-container {
|
|
|
|
|
|
|
|
width: 90%;
|
|
|
|
|
|
|
|
height: 200px;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.list-img {
|
|
|
|
|
|
|
|
width: 90%;
|
|
|
|
|
|
|
|
height: 200px;
|
|
|
|
|
|
|
|
}
|
|
|
|
.card-close {
|
|
|
|
.card-close {
|
|
|
|
position: absolute;
|
|
|
|
position: absolute;
|
|
|
|
right: 10px;
|
|
|
|
right: 10px;
|
|
|
|