From 2e8b810df84da8610064ecb04aeb7f5733a061bb Mon Sep 17 00:00:00 2001 From: gongfuxiang Date: Thu, 26 Sep 2024 14:47:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=95=E9=83=A8=E8=8F=9C=E5=8D=95=E5=88=87?= =?UTF-8?q?=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 70 ++++--------------- components/nav-back/nav-back.vue | 4 +- pages.json | 6 +- pages/error/error.vue | 4 +- pages/goods-detail/goods-detail.vue | 4 +- pages/logout/logout.vue | 2 +- pages/plugins/ask/user-detail/user-detail.vue | 4 +- 7 files changed, 20 insertions(+), 74 deletions(-) diff --git a/App.vue b/App.vue index 6d0fc390..387d6274 100644 --- a/App.vue +++ b/App.vue @@ -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(); }, diff --git a/components/nav-back/nav-back.vue b/components/nav-back/nav-back.vue index 8ea79622..38e54502 100644 --- a/components/nav-back/nav-back.vue +++ b/components/nav-back/nav-back.vue @@ -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(); } diff --git a/pages.json b/pages.json index 3164181b..3342f51f 100644 --- a/pages.json +++ b/pages.json @@ -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" diff --git a/pages/error/error.vue b/pages/error/error.vue index 6086b977..1cb18a7d 100644 --- a/pages/error/error.vue +++ b/pages/error/error.vue @@ -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]); } } } diff --git a/pages/goods-detail/goods-detail.vue b/pages/goods-detail/goods-detail.vue index 5ca84d83..f6cb313e 100644 --- a/pages/goods-detail/goods-detail.vue +++ b/pages/goods-detail/goods-detail.vue @@ -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(); } diff --git a/pages/logout/logout.vue b/pages/logout/logout.vue index ecaefd73..33f89036 100644 --- a/pages/logout/logout.vue +++ b/pages/logout/logout.vue @@ -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)) { diff --git a/pages/plugins/ask/user-detail/user-detail.vue b/pages/plugins/ask/user-detail/user-detail.vue index b4adad6a..e35ab081 100644 --- a/pages/plugins/ask/user-detail/user-detail.vue +++ b/pages/plugins/ask/user-detail/user-detail.vue @@ -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(); }