update: 调整首页顶部头像为应用LOGO、调整启动页面,增加是否每次都显示判断

This commit is contained in:
小莫唐尼 2024-06-26 09:47:04 +08:00
parent aec54e8c5b
commit cc05b64dec
4 changed files with 33 additions and 14 deletions

View File

@ -6,7 +6,7 @@ export const DefaultAppConfigs = {
loveConfig: {}, loveConfig: {},
imagesConfig: {}, imagesConfig: {},
authorConfig: {}, authorConfig: {},
startConfig: {}, appConfig: {},
pluginConfig: {}, pluginConfig: {},
adConfig: {}, adConfig: {},
} }
@ -27,4 +27,4 @@ export const getAppConfigs = () => {
*/ */
export const setAppConfigs = (configs) => { export const setAppConfigs = (configs) => {
uni.setStorageSync(_AppConfigKey, JSON.stringify(configs)) uni.setStorageSync(_AppConfigKey, JSON.stringify(configs))
} }

View File

@ -3,6 +3,8 @@
</template> </template>
<script> <script>
const homePagePath = '/pages/tabbar/home/home'
const startPagePath = '/pagesA/start/start'
export default { export default {
computed: { computed: {
configs() { configs() {
@ -11,33 +13,42 @@ export default {
}, },
onLoad() { onLoad() {
uni.$tm.vx.actions('config/fetchConfigs').then((res) => { uni.$tm.vx.actions('config/fetchConfigs').then((res) => {
console.log('正常:', res)
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
uni.$tm.vx.commit('setWxShare', res.shareConfig); uni.$tm.vx.commit('setWxShare', res.shareConfig);
// #endif // #endif
this.fnCheckShowStarted(); this.fnCheckShowStarted();
}).catch((err) => { }).catch((err) => {
console.log('异常:', err)
uni.switchTab({ uni.switchTab({
url: '/pages/tabbar/home/home' url: homePagePath
}); });
}) })
}, },
methods: { methods: {
fnCheckShowStarted() { fnCheckShowStarted() {
if (!this.configs.startConfig.enabled) { if (!this.configs.appConfig.startConfig.enabled) {
uni.switchTab({ uni.switchTab({
url: '/pages/tabbar/home/home' url: homePagePath
}); });
return; return;
} }
//
if (this.configs.appConfig.startConfig.alwaysShow) {
uni.removeStorageSync('APP_HAS_STARTED')
uni.redirectTo({
url: startPagePath
});
return;
}
//
if (uni.getStorageSync('APP_HAS_STARTED')) { if (uni.getStorageSync('APP_HAS_STARTED')) {
uni.switchTab({ uni.switchTab({
url: '/pages/tabbar/home/home' url: homePagePath
}); });
} else { } else {
uni.redirectTo({ uni.redirectTo({
url: '/pagesA/start/start' url: startPagePath
}); });
} }
} }

View File

@ -1,7 +1,9 @@
<template> <template>
<view class="app-page"> <view class="app-page">
<tm-menubars iconColor="white" color="white" :flat="true" :showback="false"> <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"> <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> <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> <view class="search-input_text pl-12 text-size-m text-grey">搜索文章...</view>
@ -118,14 +120,20 @@ export default {
categoryList: [], categoryList: [],
}; };
}, },
computed: { computed: {
haloConfigs() {
return this.$tm.vx.getters().getConfigs;
},
bloggerInfo() { bloggerInfo() {
let blogger = this.$tm.vx.getters().getConfigs.authorConfig.blogger; const blogger = this.$tm.vx.getters().getConfigs.authorConfig.blogger;
console.log('blogger----------------', blogger)
blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar, true); blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar, true);
return blogger; return blogger;
}, },
appInfo() {
const appInfo = this.haloConfigs.appConfig.appInfo;
appInfo.logo = this.$utils.checkImageUrl(appInfo.logo)
return appInfo;
}
}, },
onLoad() { onLoad() {
this.fnSetPageTitle(); this.fnSetPageTitle();

View File

@ -68,7 +68,7 @@ export default {
}, },
computed: { computed: {
startConfig() { startConfig() {
return this.$tm.vx.getters().getConfigs.startConfig; return this.$tm.vx.getters().getConfigs.appConfig.startConfig;
}, },
pageStyle() { pageStyle() {
if (this.startConfig.bg) { if (this.startConfig.bg) {