diy底部菜单优化

master
gongfuxiang 2024-09-26 02:06:13 +08:00
parent 327ada1c6c
commit df6378e379
6 changed files with 91 additions and 31 deletions

32
App.vue
View File

@ -545,7 +545,7 @@
login_confirm_tips_modal(self, object, method, params) {
// tabbar
var page = self.current_page(false);
var is_tabbar = self.is_tabbar_pages('/'+page);
var is_tabbar = self.is_system_tabbar_pages('/'+page);
// tabbar
if(method == 'init' && !is_tabbar) {
uni.redirectTo({
@ -913,14 +913,30 @@
},
/**
* 当前地址是否存在tabbar中
* 当前地址是否存在底部菜单tabbar中
*/
is_tabbar_pages(url) {
var value = this.get_url_main_part(url);
is_tabbar_pages(url = null) {
return this.is_tabbar_pages_handle(this.app_tabbar_pages(), url);
},
/**
* 当前地址是否存在系统tabbar中
*/
is_system_tabbar_pages(url = null) {
return this.is_tabbar_pages_handle(this.data.system_tabbar, url);
},
/**
* 当前地址是否存在tabbar中
* pages tabbar页面
* url url地址
*/
is_tabbar_pages_handle(pages, url = null) {
var value = this.get_url_main_part((url == null) ? '/'+this.current_page(false) : url);
if ((value || null) == null) {
return false;
}
if(this.data.system_tabbar.indexOf(value) != -1) {
if(pages.indexOf(value) != -1) {
return true;
}
return false;
@ -940,7 +956,7 @@
break;
//
case 1:
if (this.is_tabbar_pages(value)) {
if (this.is_system_tabbar_pages(value)) {
var temp = value.split('?');
if (temp.length > 1 && (temp[1] || null) != null) {
value = temp[0];
@ -1607,7 +1623,7 @@
//
} else {
if (this.is_page(value)) {
if (this.is_tabbar_pages(value)) {
if (this.is_system_tabbar_pages(value)) {
var temp = value.split('?');
if (temp.length > 1 && (temp[1] || null) != null) {
value = temp[0];
@ -2795,7 +2811,7 @@
'pages/plugins/ask/index/index',
];
// tab
if(this.is_tabbar_pages('/'+url) != -1 || pages_always.indexOf(url) != -1) {
if(this.is_system_tabbar_pages('/'+url) != -1 || pages_always.indexOf(url) != -1) {
value = '';
}
}

View File

@ -1,7 +1,9 @@
<template>
<view>
<componentDiyFooter :key="key" :propValue="app_tabber" @footer-height="footer_height_value_event"></componentDiyFooter>
<view v-if="propIsFooterSeat && footer_height_value > 0" :style="'height:'+footer_height_value+'rpx;'"></view>
<view>
<block v-if="is_tabbar">
<componentDiyFooter :key="key" :propValue="app_tabber" @footer-height="footer_height_value_event"></componentDiyFooter>
<view v-if="propIsFooterSeat && footer_height_value > 0" :style="'height:'+footer_height_value+'rpx;'"></view>
</block>
</view>
</template>
<script>
@ -10,7 +12,8 @@
export default {
data() {
return {
key: '',
key: '',
is_tabbar: false,
app_tabber: null,
footer_height_value: 0,
};
@ -43,10 +46,21 @@
//
init() {
//
this.setData({
key: Math.random(),
app_tabber: app.globalData.get_config('app_tabber')
});
var is_tabbar = app.globalData.is_tabbar_pages();
if(is_tabbar) {
this.setData({
is_tabbar: is_tabbar,
key: Math.random(),
app_tabber: app.globalData.get_config('app_tabber'),
});
} else {
this.setData({
is_tabbar: is_tabbar
});
}
console.log(is_tabbar)
},
//

View File

@ -56,7 +56,7 @@
</view>
</view>
<block v-if="is_show_footer == 1">
<componentDiyFooter :key="key" :propValue="footer_data.com_data" @footer-height="footer_height_computer" @footer-tap="footer_click_event"></componentDiyFooter>
<componentDiyFooter :key="key" :propValue="footer_data.com_data" @footer-height="footer_height_value_event"></componentDiyFooter>
</block>
</view>
</template>
@ -143,7 +143,7 @@
//
currency_symbol: app.globalData.currency_symbol(),
//
padding_footer_computer: 140,
footer_height_value: 140,
//
is_tabs: false,
//
@ -190,18 +190,36 @@
},
computed: {
diy_content_style() {
return this.header_top + `padding-bottom:${this.padding_footer_computer}rpx;`;
return this.header_top + `padding-bottom:${this.footer_height_value}rpx;`;
},
},
created() {
//
this.init_config();
//
this.init();
},
methods: {
//
init_config(status) {
if ((status || false) == true) {
// diy
var is_show_footer = this.propValue.header.com_data.content.bottom_navigation_show;
var is_tabbar = app.globalData.is_tabbar_pages();
this.setData({
is_show_footer: is_show_footer && !is_tabbar
});
} else {
app.globalData.is_config(this, 'init_config');
}
},
//
init() {
// tabs
this.setData({
key: Math.random(),
is_show_footer: this.propValue.header.com_data.content.bottom_navigation_show,
header_data: this.propValue.header,
footer_data: this.propValue.footer,
diy_data: this.propValue.diy_data,
@ -209,9 +227,14 @@
});
uni.setStorageSync(this.cache_key + this.tabs_home_id, this.propValue.diy_data);
},
footer_height_computer(number) {
this.padding_footer_computer = number * 2;
//
footer_height_value_event(number) {
this.setData({
footer_height_value: number * 2
});
},
//
tabs_click_event(tabs_id, bool, params = {}) {
let new_data = [];
@ -270,10 +293,12 @@
});
}
},
//
scroll_lower(e) {
this.get_goods_list();
},
//
get_goods_list(is_mandatory) {
//
@ -374,11 +399,7 @@
});
},
});
},
//
footer_click_event(data) {
console.log(data);
},
}
},
};
</script>

View File

@ -63,7 +63,6 @@
methods: {
//
init() {
console.log(this.propValue, 2)
if ((this.propValue || null) !== null) {
let new_content = this.propValue.content || {};
let new_style = this.propValue.style || {};

View File

@ -20,11 +20,15 @@
</view>
<view v-else>
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
</view>
</view>
<!-- 公共 -->
<componentCommon></componentCommon>
</view>
</template>
<script>
const app = getApp();
const app = getApp();
import componentCommon from '@/components/common/common';
import componentLayout from "@/components/layout/layout";
import componentSearch from "@/components/search/search";
import componentNoData from "@/components/no-data/no-data";
@ -45,7 +49,8 @@
};
},
components: {
components: {
componentCommon,
componentLayout,
componentSearch,
componentNoData,

View File

@ -10,15 +10,20 @@
<view v-else>
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
</view>
<!-- 公共 -->
<componentCommon></componentCommon>
</view>
</template>
<script>
const app = getApp();
import componentCommon from '@/components/common/common';
import componentDiy from '@/components/diy/diy';
import componentNoData from "@/components/no-data/no-data";
import componentBottomLine from "@/components/bottom-line/bottom-line";
export default {
components: {
componentCommon,
componentDiy,
componentNoData,
componentBottomLine