1.diy---选项卡

master
sws 2024-09-20 16:53:30 +08:00
parent c0235dc0ec
commit 68f19bbb0b
2 changed files with 33 additions and 23 deletions

View File

@ -132,7 +132,7 @@
return `padding-top:${this.header_top}rpx;padding-bottom:${this.padding_footer_computer}rpx`;
},
},
mounted() {
created() {
this.init();
},
methods: {
@ -152,9 +152,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,
});
},
},

View File

@ -4,13 +4,13 @@
<view v-if="top_up == '1'" class="pf z-i-deep-must left-0 right-0 top-0">
<view class="seize-seat" :style="'padding-top:' + tabs_top"></view>
<view :style="style_container">
<componentDiyModulesTabsView :value="value" isTabs @tabs-click="tabs_click_event"></componentDiyModulesTabsView>
<componentDiyModulesTabsView :value="tabs_data" isTabs @tabs-click="tabs_click_event"></componentDiyModulesTabsView>
</view>
</view>
<!-- 占位 -->
<view class="pr" :class="top_up == '1' ? 'vs-hide' : ''">
<view :style="style_container">
<componentDiyModulesTabsView :value="value" isTabs></componentDiyModulesTabsView>
<componentDiyModulesTabsView :value="tabs_data" isTabs></componentDiyModulesTabsView>
</view>
</view>
</view>
@ -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');
}
},
},
};