优化小程序部分

This commit is contained in:
hero920103 committed 2026-10-31 19:17:37 +08:00
1 parent 727319a6eb
commit d4e89788c5
46 files changed
+4906 -63

No files matched your search

+20 -34
View File
@@ -1,52 +1,38 @@
<template>
<view class="content">
<image class="logo" src="/static/logo.png"></image>
<view class="text-area">
<text class="title">{{title}}</text>
</view>
<view class="boot">
<image class="boot-logo" src="/static/logo.png" mode="aspectFit"></image>
<text class="boot-text">正在进入…</text>
</view>
</template>
<script>
export default {
data() {
return {
title: 'Hello'
}
},
onLoad() {
import { onShow } from '@dcloudio/uni-app'
import { isLoggedIn } from '@/utils/auth.js'
},
methods: {
}
}
/**
* 启动跳板页:若启动入口指向本页(脚手架默认首页),先做登录检测再分流,
* 未登录直接进登录页,已登录进首页(pages/nav/nav)。
*/
onShow(() => {
uni.reLaunch({ url: isLoggedIn() ? '/pages/nav/nav' : '/pages/login/login' })
})
</script>
<style>
.content {
.boot {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
.boot-logo {
width: 180rpx;
height: 180rpx;
margin-bottom: 32rpx;
}
.text-area {
display: flex;
justify-content: center;
}
.title {
font-size: 36rpx;
.boot-text {
font-size: 28rpx;
color: #8f8f94;
}
</style>
-5
View File
@@ -172,11 +172,6 @@
<text class="agree-link" @tap.stop="showAgreement">《隐私政策》</text>
</text>
</view>
<view class="foot-tip">
<FaIcon name="lock" color="#a3acbf" :size="11" />
<text class="foot-tip-text">统一身份认证 · 一次登录,全平台通行</text>
</view>
</view>
</template>
+6 -1
View File
@@ -170,7 +170,12 @@ onMounted(() => {
})
onShow(() => {
if (isLoggedIn() && !loading.value) load()
// 未登录(含后台切回来时令牌被清)直接回登录页,不再停留在首页
if (!isLoggedIn()) {
uni.reLaunch({ url: '/pages/login/login' })
return
}
if (!loading.value) load()
})
</script>
+6
View File
@@ -68,6 +68,7 @@ import { mpHeadPad } from '@/utils/mpHead.js'
const headPad = mpHeadPad()
import { getUser, setUser, logout, isLoggedIn, isSSOEnabled, getToken } from '@/utils/auth.js'
import { getCurrentUser, logoutApi, logoutUAC } from '@/api/auth.js'
import { requestSubscribeNotice } from '@/utils/subscribe.js'
import AppTabbar from '@/components/MainTabbar.vue'
const user = ref(null)
@@ -147,6 +148,11 @@ function onMenuTap(item) {
uni.navigateTo({ url: '/pages/login/forget' })
return
}
if (item.title === '消息通知') {
// 订阅消息授权:用户同意后,服务器才有一次主动推送的机会
requestSubscribeNotice()
return
}
uni.showToast({ title: item.title, icon: 'none' })
}