This commit is contained in:
jeremygan2021
2026-02-11 01:31:21 +08:00
parent 61afc52ac2
commit 2d090cd0f4
97 changed files with 3661 additions and 4 deletions

View File

@@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '个人中心'
})

View File

@@ -0,0 +1,53 @@
.page-container {
min-height: 100vh;
background-color: #f7f8fa;
}
.header {
background: #fff;
padding: 40px 20px;
display: flex;
align-items: center;
margin-bottom: 20px;
.avatar {
width: 60px;
height: 60px;
border-radius: 30px;
margin-right: 15px;
background: #eee;
}
.nickname {
font-size: 18px;
font-weight: bold;
color: #333;
}
}
.menu {
background: #fff;
.item {
padding: 15px 20px;
border-bottom: 1px solid #eee;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 16px;
position: relative;
&:last-child { border-bottom: none; }
.arrow { color: #ccc; }
.btn-contact {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
}
}
}

View File

@@ -0,0 +1,46 @@
import { View, Text, Image, Button } from '@tarojs/components'
import Taro, { useDidShow } from '@tarojs/taro'
import { useState } from 'react'
import './index.scss'
export default function UserIndex() {
const [userInfo, setUserInfo] = useState<any>(null)
useDidShow(() => {
const info = Taro.getStorageSync('userInfo')
if (info) setUserInfo(info)
})
const goOrders = () => Taro.navigateTo({ url: '/pages/order/list' })
const goDistributor = () => Taro.navigateTo({ url: '/subpackages/distributor/index' })
const login = () => {
// Trigger login again if needed
Taro.reLaunch({ url: '/pages/index/index' })
}
return (
<View className='page-container'>
<View className='header'>
<Image src={userInfo?.avatar_url || 'https://via.placeholder.com/100'} className='avatar' />
<Text className='nickname'>{userInfo?.nickname || '未登录'}</Text>
{!userInfo && <Button size='mini' onClick={login}></Button>}
</View>
<View className='menu'>
<View className='item' onClick={goOrders}>
<Text></Text>
<Text className='arrow'>></Text>
</View>
<View className='item' onClick={goDistributor}>
<Text></Text>
<Text className='arrow'>></Text>
</View>
<View className='item'>
<Text></Text>
<Button openType='contact' className='btn-contact' />
<Text className='arrow'>></Text>
</View>
</View>
</View>
)
}