feat: 新增管理端楼层装修保存到本地功能

master
Yer 2023-08-09 14:42:23 +08:00
parent 128ad892d1
commit c5e06ad1f2
7 changed files with 87 additions and 1 deletions

View File

@ -112,6 +112,7 @@ export default {
{
props: {
// type: this.index == params.index ? "primary" : "",
type: 'default',
size: "small",
},
on: {
@ -204,6 +205,7 @@ export default {
{
props: {
// type: this.index == params.index ? "primary" : "",
type: 'default',
size: "small",
},
on: {
@ -255,6 +257,7 @@ export default {
{
props: {
// type: this.index == params.index ? "primary" : "",
type: 'default',
size: "small",
},
on: {

View File

@ -208,6 +208,7 @@ export default {
"Button",
{
props: {
type: 'default',
size: "small",
},
on: {

View File

@ -213,6 +213,7 @@ export default {
"Button",
{
props: {
type: 'default',
size: "small",
},
style: {

View File

@ -18,6 +18,9 @@
<div class="btn-bar">
<Button type="primary" :loading="submitLoading" @click="saveTemplate"></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>
@ -32,16 +35,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

@ -113,12 +113,29 @@ export default {
methods: {
//
init() {
//
const cache = this.getStore('managerMobilePageCache')
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);
this.handleComponent(this.contentData.list[0], 0);
});
},
//

View File

@ -20,6 +20,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
@ -41,6 +42,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 @@ export default {
props: ["pagetype"],
data() {
return {
hasCache:false, //
progress: true, //
num: 20, //
saveDialog: false, //
@ -103,8 +109,21 @@ export default {
immediate: true,
},
},
mounted() {},
mounted() {
console.log( this.getStore('managerMobilePageCache') )
this.hasCache = this.getStore('managerMobilePageCache') ? true : false;
},
methods: {
clearCache(){
this.setStore('managerMobilePageCache','');
this.$Message.success('清空成功')
},
//
witeLocalStore(){
this.setStore('managerMobilePageCache', this.$store.state.styleStore)
this.$Message.success('写入成功')
},
clickBtn(val) {
this.way.forEach((item, index) => {
item.selected = false;

View File

@ -267,6 +267,7 @@ export default {
"Button",
{
props: {
type: 'default',
size: "small"
},
style: {