微信小程序上传

This commit is contained in:
2026-07-12 14:45:57 +08:00
parent d271ac5b13
commit becf91da52
45 changed files with 1815 additions and 23 deletions
+57
View File
@@ -0,0 +1,57 @@
import { useEffect, useState } from 'react';
import { View, Text, Button } from '@tarojs/components';
import Taro, { useDidShow } from '@tarojs/taro';
import TabMainHeader from '../../components/TabMainHeader';
import UserTabBar, { shouldRenderPageTabBar, syncTabBarSelected } from '../../components/UserTabBar';
import { isLoggedIn, logout, request, toast, type UserProfile } from '../../lib/api';
export default function MinePage() {
const [profile, setProfile] = useState<UserProfile | null>(null);
const loggedIn = isLoggedIn();
useDidShow(() => {
syncTabBarSelected(3);
});
useEffect(() => {
if (!loggedIn) return;
request<UserProfile>('/auth/me')
.then(setProfile)
.catch((e) => toast(e instanceof Error ? e.message : '加载失败'));
}, [loggedIn]);
return (
<View className="u-page u-page--tab">
<TabMainHeader title="我的" />
<View className="u-card">
{loggedIn ? (
<View>
<Text className="u-title" style={{ marginBottom: 4 }}>
{profile?.nickname || '用户'}
</Text>
<Text className="u-muted" style={{ display: 'block', marginBottom: 16 }}>
{profile?.phone || '未绑定手机'}
</Text>
<Text className="u-muted" style={{ display: 'block', marginBottom: 16 }}>
/ / h5-user
</Text>
<Button className="u-btn u-btn--block" onClick={() => logout()}>
退
</Button>
</View>
) : (
<View>
<View className="u-empty"></View>
<Button
className="u-btn u-btn--block"
onClick={() => Taro.navigateTo({ url: '/pages/login/index' })}
>
</Button>
</View>
)}
</View>
{shouldRenderPageTabBar() ? <UserTabBar selected={3} /> : null}
</View>
);
}