Skip to content

Commit

Permalink
update: 调整首页顶部头像为应用LOGO、调整启动页面,增加是否每次都显示判断
Browse files Browse the repository at this point in the history
  • Loading branch information
okay-xiaomo committed Jun 26, 2024
1 parent aec54e8 commit cc05b64
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 14 deletions.
4 changes: 2 additions & 2 deletions config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const DefaultAppConfigs = {
loveConfig: {},
imagesConfig: {},
authorConfig: {},
startConfig: {},
appConfig: {},
pluginConfig: {},
adConfig: {},
}
Expand All @@ -27,4 +27,4 @@ export const getAppConfigs = () => {
*/
export const setAppConfigs = (configs) => {
uni.setStorageSync(_AppConfigKey, JSON.stringify(configs))
}
}
25 changes: 18 additions & 7 deletions pages/index/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
</template>

<script>
const homePagePath = '/pages/tabbar/home/home'
const startPagePath = '/pagesA/start/start'
export default {
computed: {
configs() {
Expand All @@ -11,33 +13,42 @@ export default {
},
onLoad() {
uni.$tm.vx.actions('config/fetchConfigs').then((res) => {
console.log('正常:', res)
// #ifdef MP-WEIXIN
uni.$tm.vx.commit('setWxShare', res.shareConfig);
// #endif
this.fnCheckShowStarted();
}).catch((err) => {
console.log('异常:', err)
uni.switchTab({
url: '/pages/tabbar/home/home'
url: homePagePath
});
})
},
methods: {
fnCheckShowStarted() {
if (!this.configs.startConfig.enabled) {
if (!this.configs.appConfig.startConfig.enabled) {
uni.switchTab({
url: '/pages/tabbar/home/home'
url: homePagePath
});
return;
}
// 是否每次都显示启动页
if (this.configs.appConfig.startConfig.alwaysShow) {
uni.removeStorageSync('APP_HAS_STARTED')
uni.redirectTo({
url: startPagePath
});
return;
}
// 只显示一次启动页
if (uni.getStorageSync('APP_HAS_STARTED')) {
uni.switchTab({
url: '/pages/tabbar/home/home'
url: homePagePath
});
} else {
uni.redirectTo({
url: '/pagesA/start/start'
url: startPagePath
});
}
}
Expand Down
16 changes: 12 additions & 4 deletions pages/tabbar/home/home.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<template>
<view class="app-page">
<tm-menubars iconColor="white" color="white" :flat="true" :showback="false">
<image slot="left" class="logo ml-24 round-24" :src="bloggerInfo.avatar" mode="scaleToFill"></image>
<view slot="left">
<image class="logo ml-24 round-24" :src="appInfo.logo" mode="scaleToFill"/>
</view>
<view class="search-input round-12 pt-12 pb-12 flex pl-24" @click="fnToSearch">
<text class="search-input_icon iconfont text-size-m icon-search text-grey"></text>
<view class="search-input_text pl-12 text-size-m text-grey">搜索文章...</view>
Expand Down Expand Up @@ -118,14 +120,20 @@ export default {
categoryList: [],
};
},
computed: {
haloConfigs() {
return this.$tm.vx.getters().getConfigs;
},
bloggerInfo() {
let blogger = this.$tm.vx.getters().getConfigs.authorConfig.blogger;
console.log('blogger----------------', blogger)
const blogger = this.$tm.vx.getters().getConfigs.authorConfig.blogger;
blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar, true);
return blogger;
},
appInfo() {
const appInfo = this.haloConfigs.appConfig.appInfo;
appInfo.logo = this.$utils.checkImageUrl(appInfo.logo)
return appInfo;
}
},
onLoad() {
this.fnSetPageTitle();
Expand Down
2 changes: 1 addition & 1 deletion pagesA/start/start.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default {
},
computed: {
startConfig() {
return this.$tm.vx.getters().getConfigs.startConfig;
return this.$tm.vx.getters().getConfigs.appConfig.startConfig;
},
pageStyle() {
if (this.startConfig.bg) {
Expand Down

0 comments on commit cc05b64

Please sign in to comment.