Browse Source

Merge branch 'master' into dev_des

# Conflicts:
#	components/CustomTabBar.vue
dev_des
1054425342@qq.com 3 months ago
parent
commit
4489fc5874
  1. 8
      App.vue
  2. 26
      components/CustomTabBar.vue

8
App.vue

@ -12,6 +12,14 @@
console.log('App Launch') console.log('App Launch')
// //
// this.initBackgroundMusic(); // this.initBackgroundMusic();
//
this.Post({id: 10217},'/api/article/getArticleById').then(res => {
try {
// let SHFlag = res.data.title
let SHFlag = res.data.subtitle
uni.setStorageSync('SHFlag', SHFlag)
} catch(e) {}
});
}, },
onShow: function() { onShow: function() {
console.log('App Show') console.log('App Show')

26
components/CustomTabBar.vue

@ -1,20 +1,15 @@
<template> <template>
<view>
<!-- 占位区域防止内容被TabBar遮挡 -->
<!-- 固定的TabBar -->
<view class="custom-tab-bar"> <view class="custom-tab-bar">
<view <view
class="tab-item" class="tab-item"
v-for="(item, i) in tabBarList" v-for="(item, i) in tabBarList"
:key="i" :key="i"
v-if="tabBarShowList[i]"
@click="switchTab(i)" @click="switchTab(i)"
> >
<text <text :style="{ color: currentTab === i ? item.selectColor : '#fff' }">{{
:style="{ color: currentTab === i ? item.selectColor : '#fff' }" item.text
>{{ item.text }}</text }}</text>
>
</view>
</view> </view>
</view> </view>
</template> </template>
@ -41,9 +36,9 @@ export default {
text: "阅读体", text: "阅读体",
}, },
{ {
pagePath: "pages/index/timeShopBank", pagePath: "pages/index/sensoryStore",
selectColor: "#00FF00", selectColor: "#00FF00",
text: "时间银行", text: "有感商店",
}, },
{ {
pagePath: "pages/index/intelligentAgent", pagePath: "pages/index/intelligentAgent",
@ -56,11 +51,20 @@ export default {
text: "iSoul", text: "iSoul",
}, },
], ],
tabBarShowList: [],
}; };
}, },
onLoad() { onLoad() {
this.getCurrentTab(); this.getCurrentTab();
}, },
mounted() {
this.tabBarShowList = uni
.getStorageSync("SHFlag")
.split(",")
.map((item) => {
return item.trim().toLowerCase() === "true";
});
},
methods: { methods: {
getCurrentTab() { getCurrentTab() {
const pages = getCurrentPages(); const pages = getCurrentPages();

Loading…
Cancel
Save