diff --git a/components/diy/diy.vue b/components/diy/diy.vue
index 8382267d..09fa7daf 100644
--- a/components/diy/diy.vue
+++ b/components/diy/diy.vue
@@ -135,7 +135,7 @@
return `padding-top:${this.header_top}rpx;padding-bottom:${this.padding_footer_computer}rpx`;
},
},
- mounted() {
+ created() {
this.init();
},
methods: {
@@ -155,9 +155,10 @@
this.padding_footer_computer = number * 2;
},
// 选项卡回调更新数据
- tabs_click_event(data) {
+ tabs_click_event(data, bool) {
this.setData({
diy_data: data,
+ is_tabs_type: bool,
});
},
},
diff --git a/components/diy/tabs.vue b/components/diy/tabs.vue
index a828a831..69fcc52f 100644
--- a/components/diy/tabs.vue
+++ b/components/diy/tabs.vue
@@ -4,13 +4,13 @@
-
+
-
+
@@ -43,6 +43,7 @@
return {
style_container: '',
content: '',
+ tabs_data: {},
// 是否滑动置顶
top_up: 0,
@@ -56,13 +57,18 @@
init() {
const new_content = this.value.content || {};
const new_style = this.value.style || {};
+ let new_tabs_data = this.value;
+ const new_tabs_list = new_content.tabs_list.unshift(new_content.home_data);
+ new_tabs_data.tabs_list = new_tabs_list;
this.setData({
+ tabs_data: new_tabs_data,
style_container: common_styles_computer(new_style.common_style),
top_up: new_content.tabs_top_up,
});
},
// 回调
tabs_click_event(index, item) {
+ console.log(item);
// 调接口
// 回调到上一级
// 更新上一级的数据,渲染更新页面
@@ -75,27 +81,30 @@
// 获取缓存数据
new_data = uni.getStorageSync('diy-data-' + this.propId) || {};
} else {
- params.id = item.id;
new_data = uni.getStorageSync('diy-data-' + item.id) || {};
}
- this.$emit('tabs-click', new_data);
- uni.request({
- url: app.globalData.get_request_url('diy', 'index'),
- 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);
- } else {
- app.globalData.showToast(res.data.msg);
- }
- },
- fail: () => {},
- });
+ 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);
+ }
+ },
+ });
+ } else {
+ console.log('123123123123123');
+ }
},
},
};