diff --git a/components/diy/diy.vue b/components/diy/diy.vue index f953c31f..8c78cfd8 100644 --- a/components/diy/diy.vue +++ b/components/diy/diy.vue @@ -102,7 +102,7 @@ type: Object, default: () => ({}), }, - propDataId: { + propHomeId: { type: [String, Number], default: '', }, @@ -148,14 +148,15 @@ // 是否是模块数据或者是九宫格商品分类样式数据, 默认模块数据 is_tabs_type: true, + // 5,7,0 是误差,, 12 是下边距,60是高度,bar_height是不同小程序下的导航栏距离顶部的高度 // #ifdef MP - header_top: 'padding-top:' + (bar_height + 154) + 'rpx;', + header_top: 'padding-top:' + (bar_height + 34 + 5 + 12) + 'px;', // #endif // #ifdef H5 || MP-TOUTIAO - header_top: 'padding-top:' + (bar_height + 158) + 'rpx;', + header_top: 'padding-top:' + (bar_height + 34 + 7 + 12) + 'px;', // #endif // #ifdef APP - header_top: 'padding-top:' + (bar_height + 144) + 'rpx;', + header_top: 'padding-top:' + (bar_height + 34 + 0 + 12) + 'px;', // #endif header_data: {}, @@ -163,6 +164,7 @@ // 选项卡数据 tabs_data: {}, diy_data: [], + tabs_home_id: this.propHomeId, // 商品列表 goods_list: [], goods_total: 0, @@ -180,8 +182,6 @@ // 判断数据是否在加载中 data_is_loading: 0, key: '', - // 缓存key - cache_key: app.globalData.data.cache_diy_data_key }; }, computed: { @@ -195,6 +195,7 @@ methods: { init() { // tabs选项卡数据过滤 + // const filter_tabs_list = this.value.tabs_data || []; this.setData({ key: get_math(), header_data: this.value.header, @@ -202,7 +203,7 @@ diy_data: this.value.diy_data, tabs_data: this.value.tabs_data, }); - uni.setStorageSync(this.cache_key + this.propDataId, this.value.diy_data); + uni.setStorageSync('diy-data-' + this.propId, this.value.diy_data); }, footer_height_computer(number) { this.padding_footer_computer = number * 2; @@ -218,7 +219,7 @@ id: tabs_id, }; if (tabs_id) { - new_data = uni.getStorageSync(this.cache_key + tabs_id) || []; + new_data = uni.getStorageSync('diy-data-' + tabs_id) || []; if (new_data.length > 0) { // 先使用缓存数据展示 this.setData({ @@ -239,7 +240,7 @@ const data = res.data.data.data; if (res.data.code == 0) { new_data = data?.config.diy_data || []; - uni.setStorageSync(this.cache_key + tabs_id, new_data); + uni.setStorageSync('diy-data-' + tabs_id, new_data); this.setData({ diy_data: new_data, }); @@ -256,7 +257,7 @@ this.get_goods_list(1); } } else { - new_data = uni.getStorageSync(this.cache_key + this.propDataId) || []; + new_data = uni.getStorageSync('diy-data-' + this.tabs_home_id) || []; // 先使用缓存数据展示 this.setData({ diy_data: new_data, diff --git a/components/diy/header.vue b/components/diy/header.vue index ad72988f..011031db 100644 --- a/components/diy/header.vue +++ b/components/diy/header.vue @@ -1,6 +1,6 @@