feat(mine): 未登录时点头像区跳转登录页,副标题显示「点击登录」
This commit is contained in:
parent
5582fbb863
commit
e70aa7e3e6
|
|
@ -13,6 +13,12 @@ export default function Mine() {
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
const user = useAppSelector((s) => s.auth.userInfo)
|
const user = useAppSelector((s) => s.auth.userInfo)
|
||||||
|
const loggedOut = !user
|
||||||
|
|
||||||
|
const goLogin = () => {
|
||||||
|
if (!loggedOut) return
|
||||||
|
reLaunch(ROUTES.LOGIN)
|
||||||
|
}
|
||||||
|
|
||||||
const logout = () => {
|
const logout = () => {
|
||||||
dispatch(clearAuth())
|
dispatch(clearAuth())
|
||||||
|
|
@ -23,7 +29,8 @@ export default function Mine() {
|
||||||
return (
|
return (
|
||||||
<View className={styles.page}>
|
<View className={styles.page}>
|
||||||
<Navbar title="个人中心" autoBack={false} variant="hero" />
|
<Navbar title="个人中心" autoBack={false} variant="hero" />
|
||||||
<View className={styles.header}>
|
{/* 未登录点头像区跳登录页;已登录无交互 */}
|
||||||
|
<View className={styles.header} onClick={goLogin}>
|
||||||
{user?.avatar ? (
|
{user?.avatar ? (
|
||||||
<Image className={styles.avatar} src={user.avatar} mode="aspectFill" />
|
<Image className={styles.avatar} src={user.avatar} mode="aspectFill" />
|
||||||
) : (
|
) : (
|
||||||
|
|
@ -33,7 +40,7 @@ export default function Mine() {
|
||||||
)}
|
)}
|
||||||
<View className={styles.headerInfo}>
|
<View className={styles.headerInfo}>
|
||||||
<Text className={styles.name}>{user?.nickName ?? '未登录'}</Text>
|
<Text className={styles.name}>{user?.nickName ?? '未登录'}</Text>
|
||||||
<Text className={styles.uid}>微信登录</Text>
|
<Text className={styles.uid}>{loggedOut ? '点击登录' : '微信登录'}</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue