diff --git a/App.vue b/App.vue index ce575694..cfc13b2f 100644 --- a/App.vue +++ b/App.vue @@ -48,6 +48,14 @@ // 2.去lang里面各个文件去新增语言翻译 default_language: 'zh', + // 系统tabbar + system_tabbar: [ + '/pages/index/index', + '/pages/goods-category/goods-category', + '/pages/cart/cart', + '/pages/user/user' + ], + // 公共配置 // 分享及转发使用页面设置的默认图片及系统默认图片(0否, 1是) is_share_use_image: 1, @@ -888,13 +896,17 @@ /** * 底部菜单页面数、tabbar */ - tabbar_pages_data() { - return [ - '/pages/index/index', - '/pages/goods-category/goods-category', - '/pages/cart/cart', - '/pages/user/user' - ]; + app_tabbar_pages() { + var temp_tabbar = this.data.system_tabbar; + var app_tabber = this.get_config('app_tabber') || null; + if(app_tabber != null && (app_tabber.content || null) != null && (app_tabber.content.nav_content || null) != null) { + temp_tabbar = app_tabber.content.nav_content.map(function(v) { + if((v.link || null) != null && (v.link.page || null) != null) { + return v.link.page; + } + }); + } + return temp_tabbar; }, /** @@ -905,11 +917,8 @@ if ((value || null) == null) { return false; } - var temp_tabbar_pages = this.tabbar_pages_data(); - for (var i in temp_tabbar_pages) { - if (temp_tabbar_pages[i] == value) { - return true; - } + if(this.data.system_tabbar.indexOf(value) != -1) { + return true; } return false; }, @@ -1528,6 +1537,15 @@ // 是否关闭当前页面 var is_redirect = parseInt(e.currentTarget.dataset.redirect || 0) == 1; + // 如果是底部菜单,非系统内置菜单则关闭当前页面并打开 + var tabbar = this.app_tabbar_pages(); + if(tabbar.indexOf(value) != -1 && this.data.system_tabbar.indexOf(value) == -1) { + var page = this.prev_page(); + if(page != null && this.data.system_tabbar.indexOf(page) == -1) { + is_redirect = true; + } + } + // 调用打开url方法 this.url_open(value, is_redirect); }, @@ -1938,7 +1956,7 @@ var result = { title: data.title || share_config.title || this.get_application_title(), desc: data.desc || share_config.desc || this.get_application_describe(), - path: data.path || this.tabbar_pages_data()[0], + path: data.path || this.app_tabbar_pages()[0], query: this.share_query_handle(data.query || ''), img: data.img || share_config.pic || this.get_application_logo_square(), }; @@ -2015,7 +2033,7 @@ var prev_page = this.prev_page(); if (prev_page == null) { uni.switchTab({ - url: this.tabbar_pages_data()[0], + url: this.app_tabbar_pages()[0], }); } else { uni.navigateBack(); @@ -2318,7 +2336,7 @@ var self = this; self.weixin_privacy_setting_timer = setInterval(function () { var page = self.get_page_url(false); - if ('/' + page == self.tabbar_pages_data()[0]) { + if ('/' + page == self.app_tabbar_pages()[0]) { uni.getPrivacySetting({ success: (res) => { if (res.needAuthorization) { @@ -2772,7 +2790,7 @@ 'pages/plugins/ask/index/index', ]; // 当前tab页面 - if(this.tabbar_pages_data().indexOf('/'+url) != -1 || pages_always.indexOf(url) != -1) { + if(this.is_tabbar_pages('/'+url) != -1 || pages_always.indexOf(url) != -1) { value = ''; } } @@ -2786,7 +2804,7 @@ // 读取语言 var value = i18n.t(key); // 首页则读取当前应用名称 - if(this.tabbar_pages_data()[0] == '/'+url) { + if(this.app_tabbar_pages()[0] == '/'+url) { value = this.get_application_title(); } } diff --git a/components/cart/cart.vue b/components/cart/cart.vue index 305ed6e1..c7c72f9f 100644 --- a/components/cart/cart.vue +++ b/components/cart/cart.vue @@ -329,13 +329,6 @@ var common_static_url = app.globalData.get_static_url('common'); var status_bar_height = parseInt(app.globalData.get_system_info('statusBarHeight', 0, true)); export default { - props: { - // 来源类型 - propSourceType: { - type: String, - default: '', // 默认主页面。当传入page时为子页面 - }, - }, data() { return { status_bar_height: status_bar_height, @@ -415,6 +408,14 @@ window_top: '100rpx', // #endif }; + }, + + props: { + // 来源类型 + propSourceType: { + type: String, + default: '', // 默认主页面。当传入page时为子页面 + }, }, components: { @@ -423,7 +424,7 @@ componentNavBack, componentRealstoreCart, componentBottomLine, - componentPopup, + componentPopup }, // 属性值改变监听 diff --git a/components/common/common.vue b/components/common/common.vue new file mode 100644 index 00000000..54be2b78 --- /dev/null +++ b/components/common/common.vue @@ -0,0 +1,56 @@ + + + \ No newline at end of file diff --git a/components/diy/footer.vue b/components/diy/footer.vue index 3e108375..41756431 100644 --- a/components/diy/footer.vue +++ b/components/diy/footer.vue @@ -4,7 +4,7 @@ - + @@ -48,7 +48,7 @@ }, created() { //隐藏tabbar - uni.hideTabBar(); + // uni.hideTabBar(); }, mounted() { if ((this.value || null) !== null) { @@ -59,23 +59,31 @@ init() { const new_content = this.value.content || {}; const new_style = this.value.style || {}; + let nav_content = new_content.nav_content || []; + let page = app.globalData.current_page() || null; + let is_active = this.footerActiveIndex; + if(page != null) { + for(var i in nav_content) { + console.log(page, nav_content[i]['link']) + if((nav_content[i]['link'] || null) != null && (nav_content[i]['link']['page'] || null) != null && nav_content[i]['link']['page'] == '/'+page) { + is_active = i; + } + } + } this.setData({ - nav_content: new_content.nav_content || [], + nav_content: nav_content, nav_style: new_content.nav_style || 0, + is_active: is_active, default_text_color: 'color:' + new_style.default_text_color || 'rgba(0, 0, 0, 1)', text_color_checked: 'color:' + new_style.text_color_checked || 'rgba(204, 204, 204, 1)', style_container: common_styles_computer(new_style.common_style), }); - let footer_height = new_style.common_style.padding_top + new_style.common_style.padding_bottom + new_style.common_style.margin_top + new_style.common_style.margin_bottom + 50; + let footer_height = parseInt(new_style.common_style.padding_top) + parseInt(new_style.common_style.padding_bottom) + parseInt(new_style.common_style.margin_top) + parseInt(new_style.common_style.margin_bottom) + 40; // #ifndef APP // 底部菜单距离底部的安全距离 - footer_height = footer_height + uni.getSystemInfoSync().statusBarHeight - 40; + footer_height += parseInt(uni.getSystemInfoSync().statusBarHeight); // #endif - if (footer_height >= 70) { - footer_height = footer_height; - } else { - footer_height = 70; - } + console.log(footer_height) this.$emit('footer-height', footer_height); }, // 跳转链接 @@ -85,8 +93,8 @@ this.setData({ is_active: index, }); - // app.globalData.url_event(e); - this.$emit('footer-click', index, list_item); + app.globalData.url_event(e); + this.$emit('footer-tap', index, list_item); }, }, }; diff --git a/pages.json b/pages.json index 92ff322e..3164181b 100644 --- a/pages.json +++ b/pages.json @@ -1681,6 +1681,12 @@ { "pagePath": "pages/index/index" }, + { + "pagePath": "pages/goods-category/goods-category" + }, + { + "pagePath": "pages/cart/cart" + }, { "pagePath": "pages/user/user" } diff --git a/pages/cart/cart.vue b/pages/cart/cart.vue index f9b3674e..0b64080d 100644 --- a/pages/cart/cart.vue +++ b/pages/cart/cart.vue @@ -7,53 +7,58 @@ - + + + + \ No newline at end of file diff --git a/pages/goods-category/goods-category.css b/pages/goods-category/goods-category.css index 4015e78c..bf789995 100644 --- a/pages/goods-category/goods-category.css +++ b/pages/goods-category/goods-category.css @@ -54,9 +54,6 @@ .left-nav .nav-active { background: #fff; font-weight: 500; -} -.left-content-actual-list { - height: calc(100% - 100rpx); } /** @@ -210,9 +207,6 @@ width: 20%; padding: 20rpx 0; } -.right-content-actual { - padding-bottom: 105rpx; -} .goods-right-content { width: calc(100% - 200rpx); height: calc(100% - 182rpx); diff --git a/pages/goods-category/goods-category.vue b/pages/goods-category/goods-category.vue index 4a669b8b..460eedf3 100644 --- a/pages/goods-category/goods-category.vue +++ b/pages/goods-category/goods-category.vue @@ -74,7 +74,7 @@ - + {{ $t('common.all') }} @@ -91,7 +91,7 @@ - + @@ -178,7 +178,7 @@ - + {{ item.name }} @@ -366,12 +366,16 @@ + + + diff --git a/pages/index/index.vue b/pages/index/index.vue index a3096c35..7a244086 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -278,9 +278,6 @@ - - - @@ -295,11 +292,15 @@ + + + diff --git a/pages/user/user.vue b/pages/user/user.vue index 721db3c8..8d9f47f0 100644 --- a/pages/user/user.vue +++ b/pages/user/user.vue @@ -166,10 +166,14 @@ + + +