From 94184a6b00bde2ea596ae01890a326f73aab562f Mon Sep 17 00:00:00 2001
From: sws <1141121512@qq.com>
Date: Fri, 20 Sep 2024 17:18:00 +0800
Subject: [PATCH] =?UTF-8?q?1.diy---=E9=80=89=E9=A1=B9=E5=8D=A1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/diy/diy.vue | 8 +++++++-
components/diy/tabs.vue | 41 +++++++++++++++++++++++------------------
2 files changed, 30 insertions(+), 19 deletions(-)
diff --git a/components/diy/diy.vue b/components/diy/diy.vue
index 0f143395..fdd870d0 100644
--- a/components/diy/diy.vue
+++ b/components/diy/diy.vue
@@ -3,7 +3,7 @@
-
+
@@ -146,6 +146,12 @@
tabs_data: filter_tabs_list.length > 0 ? filter_tabs_list[0].com_data : {},
is_tabs: true,
});
+ const storge_keys = uni.getStorageInfoSync().keys;
+ for (let i in storge_keys) {
+ if (storge_keys[i].indexOf('diy-data-') !== -1) {
+ uni.removeStorageSync(storge_keys[i]);
+ }
+ }
uni.setStorageSync('diy-data-' + this.propId, this.value.diy_data);
},
footer_height_computer(number) {
diff --git a/components/diy/tabs.vue b/components/diy/tabs.vue
index 69fcc52f..1544b34e 100644
--- a/components/diy/tabs.vue
+++ b/components/diy/tabs.vue
@@ -81,28 +81,33 @@
// 获取缓存数据
new_data = uni.getStorageSync('diy-data-' + this.propId) || {};
} else {
- new_data = uni.getStorageSync('diy-data-' + item.id) || {};
+ if (index !== 0) params.id = item.micro_page_list.id;
+ if (params.id) {
+ new_data = uni.getStorageSync('diy-data-' + item.id) || {};
+ }
}
this.$emit('tabs-click', new_data, true);
if (item.data_type == '0') {
- if (index !== 0) params.id = item.classify.id;
- uni.request({
- url: app.globalData.get_request_url('index', 'diy'),
- method: 'POST',
- data: params,
- dataType: 'json',
- success: (res) => {
- // 数据处理
- var data = res.data.data;
- if (res.data.code == 0) {
- uni.setStorageSync('diy-data-' + item.id, data.config.diy_data);
- this.$emit('tabs-click', data.config.diy_data, true);
- } else {
- app.globalData.showToast(res.data.msg);
- }
- },
- });
+ if (params.id) {
+ uni.request({
+ url: app.globalData.get_request_url('index', 'diy'),
+ method: 'POST',
+ data: params,
+ dataType: 'json',
+ success: (res) => {
+ // 数据处理
+ const data = res.data.data.data;
+ if (res.data.code == 0) {
+ uni.setStorageSync('diy-data-' + params.id, data.config.diy_data);
+ this.$emit('tabs-click', data.config.diy_data, true);
+ } else {
+ app.globalData.showToast(res.data.msg);
+ }
+ },
+ });
+ }
} else {
+ if (index !== 0) params.id = item.classify.id;
console.log('123123123123123');
}
},