diy底部菜单优化
parent
327ada1c6c
commit
df6378e379
32
App.vue
32
App.vue
|
|
@ -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 = '';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
},
|
||||
|
||||
// 底部菜单高度
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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 || {};
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue