feat(mine): 未登录时点头像区跳转登录页,副标题显示「点击登录」

This commit is contained in:
ozh 2026-09-17 10:53:49 +08:00
parent 5582fbb863
commit e70aa7e3e6
1 changed files with 9 additions and 2 deletions

View File

@ -13,6 +13,12 @@ export default function Mine() {
const dispatch = useDispatch()
const toast = useToast()
const user = useAppSelector((s) => s.auth.userInfo)
const loggedOut = !user
const goLogin = () => {
if (!loggedOut) return
reLaunch(ROUTES.LOGIN)
}
const logout = () => {
dispatch(clearAuth())
@ -23,7 +29,8 @@ export default function Mine() {
return (
<View className={styles.page}>
<Navbar title="个人中心" autoBack={false} variant="hero" />
<View className={styles.header}>
{/* 未登录点头像区跳登录页;已登录无交互 */}
<View className={styles.header} onClick={goLogin}>
{user?.avatar ? (
<Image className={styles.avatar} src={user.avatar} mode="aspectFill" />
) : (
@ -33,7 +40,7 @@ export default function Mine() {
)}
<View className={styles.headerInfo}>
<Text className={styles.name}>{user?.nickName ?? '未登录'}</Text>
<Text className={styles.uid}>微信登录</Text>
<Text className={styles.uid}>{loggedOut ? '点击登录' : '微信登录'}</Text>
</View>
</View>