2021-05-13 10:56:04 +08:00
|
|
|
|
<template>
|
|
|
|
|
<!-- 预览保存 -->
|
|
|
|
|
<div class="model-title">
|
|
|
|
|
<div>店铺装修</div>
|
|
|
|
|
<div class="btns">
|
2022-02-10 18:57:36 +08:00
|
|
|
|
<Button
|
|
|
|
|
@click="clickBtn(item)"
|
|
|
|
|
size="small"
|
|
|
|
|
v-for="(item, index) in way"
|
|
|
|
|
:key="index"
|
|
|
|
|
:type="item.selected ? 'primary' : ''"
|
|
|
|
|
>
|
2021-05-13 10:56:04 +08:00
|
|
|
|
{{ item.title }}
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="model-title-view-btn">
|
2021-06-13 17:56:16 +08:00
|
|
|
|
<!-- TODO 后期会补全 目前版本暂无 -->
|
|
|
|
|
<!-- <Poptip placement="bottom" width="100">
|
2021-05-13 10:56:04 +08:00
|
|
|
|
<Button size="default" @click="creatQrCode">预览模板</Button>
|
|
|
|
|
<div slot="content" class="default-view-content">
|
|
|
|
|
<div>临时预览</div>
|
|
|
|
|
<div ref="qrCodeUrl"></div>
|
|
|
|
|
</div>
|
2021-06-13 17:56:16 +08:00
|
|
|
|
</Poptip> -->
|
2021-06-10 18:31:54 +08:00
|
|
|
|
<Button size="default" type="primary" @click="handleSpinShow">保存模板</Button>
|
2021-05-13 10:56:04 +08:00
|
|
|
|
|
2022-02-10 18:57:36 +08:00
|
|
|
|
<Modal
|
|
|
|
|
title="保存中"
|
|
|
|
|
v-model="saveDialog"
|
|
|
|
|
:closable="true"
|
|
|
|
|
:mask-closable="false"
|
|
|
|
|
:footer-hide="true"
|
|
|
|
|
>
|
2021-05-13 10:56:04 +08:00
|
|
|
|
<div v-if="progress">
|
|
|
|
|
<div class="model-item">
|
|
|
|
|
模板名称 <Input style="width: 200px" v-model="submitWay.name" />
|
|
|
|
|
</div>
|
|
|
|
|
<div class="model-item">
|
|
|
|
|
是否立即发布
|
|
|
|
|
<i-switch v-model="submitWay.pageShow">
|
|
|
|
|
<span slot="open">开</span>
|
|
|
|
|
<span slot="close">关</span>
|
|
|
|
|
</i-switch>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<Button type="primary" @click="save()">保存</Button>
|
|
|
|
|
</div>
|
|
|
|
|
<Progress v-else :percent="num" status="active" />
|
|
|
|
|
</Modal>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
import * as API_Other from "@/api/other.js";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2021-05-13 18:09:36 +08:00
|
|
|
|
progress: true, // 展示进度
|
|
|
|
|
num: 20, // 提交进度
|
|
|
|
|
saveDialog: false, // 加载状态
|
2021-06-10 18:31:54 +08:00
|
|
|
|
way: [
|
|
|
|
|
// 装修tab栏切换
|
2021-05-13 10:56:04 +08:00
|
|
|
|
{
|
|
|
|
|
title: "首页",
|
|
|
|
|
name: "index",
|
|
|
|
|
selected: true,
|
|
|
|
|
},
|
2021-07-20 18:02:49 +08:00
|
|
|
|
// {
|
|
|
|
|
// title: "全屏广告",
|
|
|
|
|
// name: "advertising",
|
|
|
|
|
// selected: false,
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// title: "弹窗广告",
|
|
|
|
|
// name: "alertAdvertising",
|
|
|
|
|
// selected: false,
|
|
|
|
|
// },
|
2021-05-13 10:56:04 +08:00
|
|
|
|
],
|
2022-02-10 18:57:36 +08:00
|
|
|
|
|
2021-06-10 18:31:54 +08:00
|
|
|
|
submitWay: {
|
|
|
|
|
// 表单信息
|
2021-05-13 10:56:04 +08:00
|
|
|
|
pageShow: this.$route.query.type || false,
|
|
|
|
|
name: this.$route.query.name || "模板名称",
|
|
|
|
|
pageClientType: "H5",
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
watch: {},
|
|
|
|
|
mounted() {},
|
|
|
|
|
methods: {
|
|
|
|
|
clickBtn(val) {
|
|
|
|
|
this.way.forEach((item, index) => {
|
|
|
|
|
item.selected = false;
|
|
|
|
|
});
|
|
|
|
|
val.selected = true;
|
|
|
|
|
this.$emit("selected", val.name);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 加载,并保存模板
|
|
|
|
|
*/
|
|
|
|
|
handleSpinShow() {
|
|
|
|
|
this.saveDialog = true;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 填写是否发布,模板名称之后保存
|
|
|
|
|
save() {
|
|
|
|
|
if (this.$store.state.styleStore == void 0) {
|
|
|
|
|
this.$Message.error("请装修楼层");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-10 18:57:36 +08:00
|
|
|
|
this.submitWay?.pageShow === true
|
2021-05-13 10:56:04 +08:00
|
|
|
|
? (this.submitWay.pageShow = "OPEN")
|
|
|
|
|
: (this.submitWay.pageShow = "CLOSE");
|
|
|
|
|
|
|
|
|
|
this.submitWay.pageData = JSON.stringify(this.$store.state.styleStore);
|
|
|
|
|
this.submitWay.pageType = "INDEX";
|
|
|
|
|
|
|
|
|
|
this.$route.query.id ? this.update() : this.submit(this.submitWay);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 更新
|
|
|
|
|
update() {
|
2021-06-10 18:31:54 +08:00
|
|
|
|
this.progress = false;
|
2021-05-13 10:56:04 +08:00
|
|
|
|
API_Other.updateHome(this.$route.query.id, {
|
|
|
|
|
pageData: JSON.stringify(this.$store.state.styleStore),
|
|
|
|
|
name: this.submitWay.name,
|
|
|
|
|
pageShow: this.submitWay.pageShow,
|
2021-06-10 18:31:54 +08:00
|
|
|
|
pageType: "INDEX",
|
|
|
|
|
pageClientType: "H5",
|
2021-05-13 10:56:04 +08:00
|
|
|
|
})
|
|
|
|
|
.then((res) => {
|
|
|
|
|
this.num = 50;
|
2021-05-17 16:04:36 +08:00
|
|
|
|
if (res.success) {
|
2021-05-13 10:56:04 +08:00
|
|
|
|
this.num = 80;
|
|
|
|
|
/**制作保存成功动画¸ */
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.saveDialog = false;
|
|
|
|
|
this.$Message.success("修改成功");
|
|
|
|
|
this.goback();
|
|
|
|
|
}, 1000);
|
|
|
|
|
} else {
|
|
|
|
|
this.saveDialog = false;
|
|
|
|
|
this.$Message.error("修改失败,请稍后重试");
|
|
|
|
|
}
|
|
|
|
|
console.log(res);
|
|
|
|
|
})
|
|
|
|
|
.catch((error) => {});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 返回查询数据页面
|
|
|
|
|
goback() {
|
|
|
|
|
this.$router.push({
|
|
|
|
|
path: "/wapList",
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 保存
|
|
|
|
|
submit(submitWay) {
|
|
|
|
|
this.progress = false;
|
|
|
|
|
API_Other.setHomeSetup(submitWay)
|
|
|
|
|
.then((res) => {
|
|
|
|
|
this.num = 50;
|
2021-05-17 16:04:36 +08:00
|
|
|
|
if (res.success) {
|
2021-05-13 10:56:04 +08:00
|
|
|
|
this.num = 80;
|
|
|
|
|
/**制作保存成功动画¸ */
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.saveDialog = false;
|
|
|
|
|
this.$Message.success("保存成功");
|
|
|
|
|
this.goback();
|
|
|
|
|
}, 1000);
|
|
|
|
|
} else {
|
2021-06-10 18:31:54 +08:00
|
|
|
|
this.progress = true;
|
2021-05-13 10:56:04 +08:00
|
|
|
|
this.saveDialog = false;
|
|
|
|
|
this.$Message.error("保存失败,请稍后重试");
|
|
|
|
|
}
|
|
|
|
|
console.log(res);
|
|
|
|
|
})
|
|
|
|
|
.catch((error) => {});
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
.model-item {
|
|
|
|
|
width: 100%;
|
|
|
|
|
padding: 10px 0;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
> * {
|
|
|
|
|
margin: 0 8px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.model-title {
|
|
|
|
|
height: 70px;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
align-items: center;
|
|
|
|
|
color: #333;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
> .model-title-view-btn {
|
|
|
|
|
> * {
|
|
|
|
|
margin: 0 10px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.btns {
|
|
|
|
|
* {
|
|
|
|
|
margin: 0 4px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|