更改功德箱未显示完

This commit is contained in:
2022-03-14 12:03:12 +08:00
parent a362bdb47a
commit 97ecc2ffd5
5 changed files with 42 additions and 17 deletions
+20 -8
View File
@@ -2,8 +2,8 @@
<div class="app-safe-area" :style="{minHeight: minHeight + 'px'}">
<div id="app" :data-height="minHeight - tabHeight" :style="{ minHeight: minHeight - tabHeight + 'px', paddingBottom: tabHeight + 'px'}">
<router-view />
<van-tabbar v-if="showTabbar" class="tabbar" ref="tabbar" route active-color="#CF9E3B" inactive-color="#999">
<van-tabbar-item replace name v-for="(tab, index) in tabbar" :key="index" :to="tab.path">
<van-tabbar v-if="showTabbar" class="tabbar" v-model="actionRoute" ref="tabbar" active-color="#CF9E3B" inactive-color="#999">
<van-tabbar-item replace name v-for="(tab, index) in tabbar" :key="index" @click="onNavigation(tab)">
<span>{{ tab.title }}</span>
<template #icon="props">
<img :src="props.active ? tab.active: tab.inactive" alt="">
@@ -25,6 +25,7 @@ export default {
minHeight: 0,
tabbar,
tabHeight: 0,
// actionRoute: 0
};
},
provide() {
@@ -56,22 +57,33 @@ export default {
}
},
mounted(){
console.log('launch', this.$route.query)
this.$store.commit('SET_LAUNCH', this.$route.query)
console.log( safeAreaInsets.bottom)
setTimeout(() => {
console.log( safeAreaInsets.bottom)
this.minHeight = window.innerHeight - safeAreaInsets.bottom;
}, 30)
},
methods: {
onNavigation(tab){
const { path } = this.$route;
if(path === tab.path) return;
this.$router.push({ path: tab.path, query: { temple_id: this.$route.query.temple_id}})
}
},
computed: {
actionRoute: {
get(){
const { tabbar } = this;
return tabbar.map(tab => tab.name).indexOf(this.$route.name)
},
set(){ }
},
showTabbar() {
const path = tabbar.map(tab => tab.path);
const { name, query: { temple_id } } = this.$route;
const { name, query: { temple_id, hideTab } } = this.$route;
// 等于寺庙功德箱时隐藏底部导航
if(name === 'merit-box' && temple_id !== '1'){
console.log(name, temple_id !== '1')
if(name === 'merit-box' || (name === 'temple-list' && hideTab === '1')){
return false
}
+5 -1
View File
@@ -90,7 +90,11 @@ export default {
},
methods: {
back(){
this.$router.push({ name: 'home', query: { temple_id: this.query.temple_id } })
if(this.query.fromPathName){
this.$router.replace({ name: this.query.fromPathName,query: { temple_id: this.query.temple_id } })
return;
}
this.$router.replace({ name: 'home', query: { temple_id: this.query.temple_id }});
},
openBox(){
this.randVisible = true
+8 -1
View File
@@ -124,6 +124,7 @@
</p>
</van-popup>
<!-- 功德箱-->
<img src="@/assets/img/gongdexiang.png" class="gongdexiang" @click="openBox"/>
</div>
</template>
@@ -148,7 +149,7 @@ export default {
openBox(){
this.$router.push({
name: 'merit-box',
query: { temple_id : this.query.temple_id, open_box: 1 }
query: { temple_id : this.query.temple_id, open_box: 1, fromPathName: this.$route.name }
})
},
locationTo(nav) {
@@ -197,6 +198,12 @@ export default {
}
},
onPushForRouteName(routeName){
if(routeName === 'merit-box'){
return this.openBox();
}
if(routeName === 'temple-list'){
return this.$router.push({ name: routeName, query: { hideTab: '1'}})
}
this.$router.push({ name: routeName })
},
async getUserData(){
+8 -6
View File
@@ -1,5 +1,5 @@
<template>
<div class="temple-list" :style="{height: root.minHeight - root.tabHeight + 'px'}">
<div class="temple-list" :style="{height: root.minHeight + 'px'}">
<div class="topbar" ref="topbar">
<van-nav-bar left-arrow :title="$route.meta.title" v-if="$route.meta.showNavBar" @click-left="$router.back()" :style="{backgroundColor: $route.meta.navBarBackgroundColor}" />
<van-search v-model="keyword" show-action action-text="搜索" placeholder="请输入寺院、方丈、监院名称" @search="onSearch" @cancel="onCancel">
@@ -73,11 +73,13 @@ export default {
}
},
mounted(){
console.log(this.parentHeight)
this.$nextTick(() => {
console.log(this.$refs.topbar.offsetHeight)
this.containerHeight = this.parentHeight - this.$refs.topbar.offsetHeight - 100;
})
setTimeout(() => {
if(this.query.hideTab === '1'){
this.containerHeight = this.root.minHeight - this.$refs.topbar.offsetHeight;
} else {
this.containerHeight = this.root.minHeight - this.$refs.topbar.offsetHeight - 100;
}
}, 50)
if(this.query.search){
this.keyword = this.query.search;