diff --git a/manager/src/views/page-decoration/wap/navbar.vue b/manager/src/views/page-decoration/wap/navbar.vue index fa848aef..ae6c1f77 100644 --- a/manager/src/views/page-decoration/wap/navbar.vue +++ b/manager/src/views/page-decoration/wap/navbar.vue @@ -110,7 +110,6 @@ export default { }, }, mounted() { - console.log( this.getStore('managerMobilePageCache') ) this.hasCache = this.getStore('managerMobilePageCache') ? true : false; }, methods: { diff --git a/seller/src/views/shop/renovation.vue b/seller/src/views/shop/renovation.vue index a4649c0d..004ef1c7 100644 --- a/seller/src/views/shop/renovation.vue +++ b/seller/src/views/shop/renovation.vue @@ -28,6 +28,8 @@ >保存模板 + + @@ -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"); diff --git a/seller/src/views/shop/wap/index.vue b/seller/src/views/shop/wap/index.vue index 0574f1e4..d850b51b 100644 --- a/seller/src/views/shop/wap/index.vue +++ b/seller/src/views/shop/wap/index.vue @@ -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) diff --git a/seller/src/views/shop/wap/navbar.vue b/seller/src/views/shop/wap/navbar.vue index 45b7c9a4..5b8771a9 100644 --- a/seller/src/views/shop/wap/navbar.vue +++ b/seller/src/views/shop/wap/navbar.vue @@ -22,6 +22,7 @@
--> +