feat: 商家端新增楼层数据保存到本地功能

master
Yer 2023-08-09 14:56:57 +08:00
parent c5e06ad1f2
commit 9e7a1b3ee3
4 changed files with 76 additions and 2 deletions

View File

@ -110,7 +110,6 @@ export default {
},
},
mounted() {
console.log( this.getStore('managerMobilePageCache') )
this.hasCache = this.getStore('managerMobilePageCache') ? true : false;
},
methods: {

View File

@ -28,6 +28,8 @@
>保存模板</Button
>
<Button class="ml_10" @click="resetTemplate"></Button>
<Button class="ml_10" @click="witeLocalStore"></Button>
<Button class="ml_10" v-if="hasCache" @click="clearCache"></Button>
</div>
</div>
</template>
@ -42,16 +44,57 @@ export default {
ModelForm,
},
mounted() {
//
const cache = this.getStore('managerPCPageCache')
this.hasCache = !!cache;
if(cache){
this.$Modal.confirm({
title: '提示',
content: '获取到本地有缓存数据,是否使用缓存数据?',
okText: '使用',
cancelText: '取消',
onOk: () => {
let pageData = cache;
if (pageData) {
pageData = JSON.parse(pageData);
if (pageData.list[0].type === "topAdvert") {
// topAdvert 广 navList
this.$refs.modelForm.topAdvert = pageData.list[0];
this.$refs.modelForm.navList = pageData.list[1];
pageData.list.splice(0, 2);
this.modelForm = pageData;
} else {
this.modelForm = { list: [] };
}
} else {
this.modelForm = { list: [] };
}
}
});
}
this.getTemplateItem(this.$route.query.id);
},
data() {
return {
hasCache:false,
modelData, //
modelForm: { list: [] }, //
submitLoading: false, //
};
},
methods: {
clearCache(){
this.setStore('managerPCPageCache', '')
this.$Message.success('清除成功')
},
//
witeLocalStore(){
const data ={...this.modelForm}
data.list.unshift(this.$refs.modelForm.navList);
data.list.unshift(this.$refs.modelForm.topAdvert);
this.setStore('managerPCPageCache', data)
this.$Message.success('写入成功')
},
saveTemplate() {
//
this.submitTemplate(this.$route.query.pageShow ? "OPEN" : "CLOSE");

View File

@ -116,6 +116,21 @@ export default {
//
init() {
//
const cache = this.getStore('sellerMobilePageCache')
if(cache){
this.$Modal.confirm({
title: '提示',
content: '获取到本地有缓存数据,是否使用缓存数据?',
okText: '使用',
cancelText: '取消',
onOk: () => {
const data = JSON.parse(cache);
this.contentData = data;
}
});
}
if (!this.$route.query.id) return false;
API_Other.getHomeData(this.$route.query.id).then(res=>{
this.contentData = JSON.parse(res.result.pageData)

View File

@ -22,6 +22,7 @@
<div ref="qrCodeUrl"></div>
</div>
</Poptip> -->
<Button size="default" type="default" v-if="hasCache" @click="clearCache"></Button>
<Button size="default" type="primary" @click="handleSpinShow"></Button>
<Modal
@ -42,6 +43,10 @@
<span slot="close"></span>
</i-switch>
</div>
<div class="model-item">
将当前装修内容写入到本地缓存中下次进入页面时可继续使用
<Button type="small" @click="witeLocalStore"></Button>
</div>
<Button type="primary" @click="save()"></Button>
</div>
@ -56,6 +61,7 @@ import * as API_Other from "@/api/other.js";
export default {
data() {
return {
hasCache:false, //
progress: true, //
num: 20, //
saveDialog: false, //
@ -87,8 +93,19 @@ export default {
};
},
watch: {},
mounted() {},
mounted() {
this.hasCache = this.getStore('sellerMobilePageCache') ? true : false;
},
methods: {
clearCache(){
this.setStore('sellerMobilePageCache','');
this.$Message.success('清空成功')
},
//
witeLocalStore(){
this.setStore('sellerMobilePageCache', this.$store.state.styleStore)
this.$Message.success('写入成功')
},
clickBtn(val) {
this.way.forEach((item, index) => {
item.selected = false;