底部菜单切换

master
gongfuxiang 2024-09-26 14:47:02 +08:00
parent b00a91b5bf
commit 2e8b810df8
7 changed files with 20 additions and 74 deletions

70
App.vue
View File

@ -964,11 +964,13 @@
uni.setStorageSync(this.data.cache_page_tabbar_switch_params, query);
}
uni.switchTab({
url: value,
url: value
});
//tabbar
uni.hideTabBar();
} else {
uni.navigateTo({
url: value,
url: value
});
}
break;
@ -1396,9 +1398,6 @@
//
self.set_theme_value(data.plugins_themestyle_data);
//
self.set_tabbar(data.plugins_themestyle_data);
//
self.user_auto_login_handle();
},
@ -1631,16 +1630,18 @@
uni.setStorageSync(this.data.cache_page_tabbar_switch_params, query);
}
uni.switchTab({
url: value,
url: value
});
//tabbar
uni.hideTabBar();
} else {
if (is_redirect) {
uni.redirectTo({
url: value,
url: value
});
} else {
uni.navigateTo({
url: value,
url: value
});
}
}
@ -1985,7 +1986,7 @@
// #ifdef H5 || APP
// url#
if(this.is_url(result['url'])) {
result['url'] = this.page_url_protocol(result.url.split('#')[0] + '#' + (result.path == null || result.path.substr(0, 1) == '/' ? '' : '/') + result.path + result.query);
result['url'] = this.page_url_protocol(result.url.split('#')[0] + '#' + ((result.path || null) != null && result.path.substr(0, 1) == '/' ? '' : '/') + (result.path || '') + (result.query || ''));
}
// #endif
return result;
@ -2053,9 +2054,7 @@
page_back_prev_event() {
var prev_page = this.prev_page();
if (prev_page == null) {
uni.switchTab({
url: this.app_tabbar_pages()[0],
});
this.url_open(this.app_tabbar_pages()[0]);
} else {
uni.navigateBack();
}
@ -2434,45 +2433,6 @@
uni.setStorageSync('theme', value || this.data.default_theme);
},
//
set_tabbar(theme) {
//
if ((theme || null) == null) {
theme = this.get_theme_value();
}
//
uni.setTabBarStyle({
selectedColor: this.get_theme_color(theme),
});
//
uni.setTabBarItem({
index: 0,
iconPath: 'static/images/common/tabbar/home.png',
selectedIconPath: 'static/images/' + theme + '/tabbar/home.png',
text: i18n.t('common.home'),
});
uni.setTabBarItem({
index: 1,
iconPath: 'static/images/common/tabbar/category.png',
selectedIconPath: 'static/images/' + theme + '/tabbar/category.png',
text: i18n.t('common.category'),
});
uni.setTabBarItem({
index: 2,
iconPath: 'static/images/common/tabbar/cart.png',
selectedIconPath: 'static/images/' + theme + '/tabbar/cart.png',
text: i18n.t('common.cart'),
});
uni.setTabBarItem({
index: 3,
iconPath: 'static/images/common/tabbar/user.png',
selectedIconPath: 'static/images/' + theme + '/tabbar/user.png',
text: i18n.t('common.my'),
});
},
//
group_arry(arry, sub_group_length) {
let index = 0;
@ -2837,18 +2797,12 @@
//
page_event_onload_handle(params) {
//
this.set_tabbar();
//
this.get_user_location();
},
//
page_event_onshow_handle() {
//
this.set_tabbar();
//
this.set_pages_navigation_bar_title();
},
@ -2856,7 +2810,7 @@
//
onLaunch(params) {
//tabbar
//tabbar
uni.hideTabBar();
},

View File

@ -88,9 +88,7 @@
top_nav_left_back_event() {
var pages = getCurrentPages();
if (pages.length <= 1) {
uni.switchTab({
url: app.globalData.app_tabbar_pages()[0],
});
app.globalData.url_open(app.globalData.app_tabbar_pages()[0]);
} else {
uni.navigateBack();
}

View File

@ -1673,10 +1673,10 @@
"backgroundColorBottom": "#f5f5f5"
},
"tabBar": {
"color": "#fff",
"color": "#f5f5f5",
"borderStyle": "white",
"selectedColor": "#fff",
"backgroundColor": "#fff",
"selectedColor": "#f5f5f5",
"backgroundColor": "#f5f5f5",
"list": [
{
"pagePath": "pages/index/index"

View File

@ -59,9 +59,7 @@
if(pages > 1) {
uni.navigateBack();
} else {
uni.switchTab({
url: app.globalData.app_tabbar_pages()[0]
});
app.globalData.url_open(app.globalData.app_tabbar_pages()[0]);
}
}
}

View File

@ -1052,9 +1052,7 @@
top_nav_left_back_event(e) {
var pages = getCurrentPages();
if (pages.length <= 1) {
uni.switchTab({
url: app.globalData.app_tabbar_pages()[0],
});
app.globalData.url_open(app.globalData.app_tabbar_pages()[0]);
} else {
uni.navigateBack();
}

View File

@ -124,7 +124,7 @@
app.globalData.remove_user_cache_event();
app.globalData.showToast(res.data.msg, 'success');
setTimeout(function () {
uni.switchTab({ url: app.globalData.app_tabbar_pages()[0] });
app.globalData.url_open(app.globalData.app_tabbar_pages()[0]);
}, 1500);
} else {
if (app.globalData.is_login_check(res.data)) {

View File

@ -149,9 +149,7 @@
top_nav_left_back_event(e) {
var pages = getCurrentPages();
if (pages.length <= 1) {
uni.switchTab({
url: app.globalData.app_tabbar_pages()[0],
});
app.globalData.url_open(app.globalData.app_tabbar_pages()[0]);
} else {
uni.navigateBack();
}