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

View File

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

View File

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

View File

@ -18,6 +18,9 @@
<div class="btn-bar"> <div class="btn-bar">
<Button type="primary" :loading="submitLoading" @click="saveTemplate"></Button> <Button type="primary" :loading="submitLoading" @click="saveTemplate"></Button>
<Button class="ml_10" @click="resetTemplate"></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>
</div> </div>
</template> </template>
@ -32,16 +35,57 @@ export default {
ModelForm, ModelForm,
}, },
mounted() { 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); this.getTemplateItem(this.$route.query.id);
}, },
data() { data() {
return { return {
hasCache:false,
modelData, // modelData, //
modelForm: { list: [] }, // modelForm: { list: [] }, //
submitLoading: false, // submitLoading: false, //
}; };
}, },
methods: { 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() { saveTemplate() {
// //
this.submitTemplate(this.$route.query.pageShow ? 'OPEN' : 'CLOSE') this.submitTemplate(this.$route.query.pageShow ? 'OPEN' : 'CLOSE')

View File

@ -113,12 +113,29 @@ export default {
methods: { methods: {
// //
init() { 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; if (!this.$route.query.id) return false;
API_Other.getHomeData(this.$route.query.id).then((res) => { API_Other.getHomeData(this.$route.query.id).then((res) => {
this.contentData = JSON.parse(res.result.pageData); this.contentData = JSON.parse(res.result.pageData);
this.handleComponent(this.contentData.list[0], 0); this.handleComponent(this.contentData.list[0], 0);
}); });
}, },
// //

View File

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

View File

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