修改调用接口逻辑

master
于肖磊 2025-08-07 18:10:37 +08:00
parent 2567d2ece9
commit 31a6b2c316
4 changed files with 29 additions and 17 deletions

View File

@ -7,10 +7,10 @@
data: {
//
//
request_url:'http://shopxo.com/',
request_url:'https://new.shopxo.vip/',
// publicpublichttps://d1.shopxo.vip/public/
static_url:'http://shopxo.com/',
static_url:'https://new.shopxo.vip/',
// default
system_type: 'default',

View File

@ -313,6 +313,8 @@
scroll_num: 0,
scroll_num_top: 0,
goods_type: '',
//
tabs_click_index: 0,
};
},
computed: {
@ -409,9 +411,11 @@
watch: {
propKey(val) {
// diytabs
if ((this.tabs_id || null) == null) {
if ((this.tabs_id || null) == null && this.tabs_click_index == 0) {
//
this.init();
} else {
this.tabs_click_event(this.tabs_id, this.is_tabs_type, this.tabs_click_index, { is_cache: 0 });
}
},
},
@ -556,11 +560,12 @@
return diy_data_list;
},
//
tabs_click_event(tabs_id, bool, params = {}) {
tabs_click_event(tabs_id, bool, index, params = {}) {
let new_data = [];
this.setData({
is_tabs_type: bool,
tabs_id: tabs_id,
tabs_click_index: index,
});
let new_params = {
...params,
@ -578,17 +583,22 @@
}
// diy
if (bool) {
uni.showLoading({
title: this.$t('common.loading_in_text'),
mask: true,
});
const is_lodaing = isEmpty(params);
if (is_lodaing) {
uni.showLoading({
title: this.$t('common.loading_in_text'),
mask: true,
});
}
uni.request({
url: app.globalData.get_request_url('index', 'diy'),
method: 'POST',
data: new_params,
dataType: 'json',
success: (res) => {
uni.hideLoading();
if (is_lodaing) {
uni.hideLoading();
}
//
let data = res.data.data.data;
if (res.data.code == 0) {
@ -599,14 +609,16 @@
});
//
if (parseInt(data.is_result_data_cache || 0) == 1) {
this.tabs_click_event(tabs_id, bool, { is_cache: 0 });
this.tabs_click_event(tabs_id, bool, index, { is_cache: 0 });
}
} else {
app.globalData.showToast(res.data.msg);
}
},
fail: () => {
uni.hideLoading();
if (is_lodaing) {
uni.hideLoading();
}
app.globalData.showToast(this.$t('common.internet_error_tips'));
},
});
@ -864,11 +876,11 @@
},
//
choice_location_back(e) {
// tabs_idtab
if ((this.tabs_id || null) == null) {
//
if (this.tabs_click_index == 0) {
this.$emit('onLocationBack', e);
} else {
this.tabs_click_event(this.tabs_id, this.is_tabs_type);
this.tabs_click_event(this.tabs_id, this.is_tabs_type, this.tabs_click_index);
}
},
//

View File

@ -177,8 +177,8 @@
});
},
// tab
tabs_click_event(tabs_id, is_micro_page) {
this.$emit('onTabsTap', tabs_id, is_micro_page);
tabs_click_event(tabs_id, is_micro_page, index) {
this.$emit('onTabsTap', tabs_id, is_micro_page, index);
},
// tab
tabs_height_event(height) {

View File

@ -336,7 +336,7 @@
sliding_fixed_style: this.get_sliding_fixed_style(0),
})
}, 0);
this.$emit('onTabsTap', tabs_id, is_micro_page);
this.$emit('onTabsTap', tabs_id, is_micro_page, index);
},
// tab
tabs_height_event(height) {