个人信息相关接口

This commit is contained in:
tangping 2023-05-26 23:58:54 +08:00
parent d46dd16c36
commit 2353101453
6 changed files with 77 additions and 41 deletions

View File

@ -18,41 +18,55 @@ import addr from '@/images/addr.png'
import friend from '@/images/friend.png'
import { Avatar } from '@nutui/nutui-react-taro';
import next from '@/images/next.png'
import { useEffect } from 'react';
import { userDetail } from '../../utils/api';
import { useState } from 'react';
import { navigateTo } from '../../utils/utils';
const Index = () => {
const [user, setUser] = useState({})
useEffect(() => {
userDetail().then(rs => {
if (!rs) return
setUser(rs)
})
}, [])
return <View className='user-container'>
<View className='my-header-top relative'>
<View className='user-title flex-center'>
<View className='home-title-extra'>
<Image src={setting} className='home-title-icon' />
<Image src={message} className='home-title-icon' />
<Image src={setting} className='home-title-icon' onClick={() => { navigateTo('/pages/setting/index') }} />
<Image src={message} className='home-title-icon' onClick={() => { navigateTo('/pages/message/index') }} />
</View>
</View>
<View className='my-header flex-between'>
<View className='my-content flex-start'>
<View className='my-avatar flex-center'>
<Avatar size={50} icon="https://img12.360buyimg.com/imagetools/jfs/t1/143702/31/16654/116794/5fc6f541Edebf8a57/4138097748889987.png"
<Avatar size={50} icon={user.avatar} alt={user.nick_name}
/>
</View>
<View className='my-content-info flex-col'>
<View className='my-info-name flex-start'>
<Text>这个是姓名</Text>
<Text>{user.nick_name}</Text>
<View className='my-level'>
<Text className='my-lev-text'>V5</Text>
<Text className='my-lev-text'>{user.user_level?.name}</Text>
</View>
</View>
</View>
</View>
<View className='my-edit'>
<View className='my-edit' onClick={() => {
navigateTo('/pages/user-info/index')
}}>
<Text>编辑资料 {'>'} </Text>
</View>
</View>
<View className='flex-start my-id-box'>
<Image src={level1} className='my-id-icon' />
<Text className=''>区域合伙人</Text>
<Text className=''>{user.is_city_partner ? '区域合伙人' : ''}</Text>
</View>
</View>
<View className='my-container'>
@ -61,32 +75,40 @@ const Index = () => {
<View className='my-order-container'>
<View className='my-order-title flex-between'>
<Text>我的订单</Text>
<View className='my-order-more flex-center'>
<View className='my-order-more flex-center' onClick={() => {
navigateTo('/pages/order/index')
}}>
<Text>全部订单</Text>
<Image className='next-icon' src={next} />
</View>
</View>
<View className='my-order-tool flex-between'>
<View className='flex-col my-order-tool-item'>
<View className='flex-col my-order-tool-item' onClick={() => {
navigateTo('/pages/order/index?state=paid')
}}>
<View className="relative my-order-tool-box">
<Image className='my-order-tool-icon' src={waitpay} />
<Text className='my-order-mark' style={{ fontSize: 4 }}>2</Text>
</View>
<Text>待付款</Text>
</View>
<View className='flex-col my-order-tool-item'>
<View className="relative my-order-tool-box">
<Image className='my-order-tool-icon' src={delivery} />
<Text className='my-order-mark' style={{ fontSize: 4 }}>2</Text>
{/* <Text className='my-order-mark' style={{ fontSize: 4 }}>2</Text> */}
</View>
<Text>待发货</Text>
</View>
<View className='flex-col my-order-tool-item'>
<View className='flex-col my-order-tool-item' onClick={() => {
navigateTo('/pages/order/index?state=sent')
}}>
<View className="relative my-order-tool-box">
<Image className='my-order-tool-icon' src={delivery} />
{/* <Text className='my-order-mark' style={{ fontSize: 4 }}>2</Text> */}
</View>
<Text>待收货</Text>
</View>
<View className='flex-col my-order-tool-item' onClick={() => {
navigateTo('/pages/order/index?state=received')
}}>
<View className="relative my-order-tool-box">
<Image className='my-order-tool-icon' src={done} />
<Text className='my-order-mark' style={{ fontSize: 4 }}>2</Text>
{/* <Text className='my-order-mark' style={{ fontSize: 4 }}>2</Text> */}
</View>
<Text>已完成</Text>
<Text>收货</Text>
</View>
</View>
</View>
@ -98,11 +120,11 @@ const Index = () => {
</View>
<View className='flex-around justify-center mt-22'>
<View className='bal-item-content flex-col items-center'>
<Text>12345</Text>
<Text>{user.contribution}</Text>
<Text className='bal-item-helper'>贡献值</Text>
</View>
<View className='bal-item-content flex-col items-center'>
<Text>12345</Text>
<Text>{user.energy}</Text>
<Text className='bal-item-helper'>能量值</Text>
</View>
</View>
@ -114,15 +136,15 @@ const Index = () => {
</View>
<View className='flex-between mt-22'>
<View className='bal-item-content flex-col items-center'>
<Text>12345</Text>
<Text>{user.score}</Text>
<Text className='bal-item-helper'>余额</Text>
</View>
<View className='bal-item-content flex-col items-center'>
<Text>12345</Text>
<Text>{user.profit ?? 0}</Text>
<Text className='bal-item-helper'>收益</Text>
</View>
<View className='bal-item-content flex-col items-center'>
<Text>12345</Text>
<Text>{user.shopping_score}</Text>
<Text className='bal-item-helper'>购物金</Text>
</View>
</View>
@ -143,7 +165,6 @@ const Index = () => {
<View className='flex-col my-order-tool-item'>
<View className="relative my-order-tool-box">
<Image className='my-tool-icon' src={mall} />
</View>
<Text>购物金商城</Text>
</View>

View File

@ -77,7 +77,8 @@
}
.my-level {
width: 25px;
// width: 25px;
padding: 0 6px;
height: 16px;
background: linear-gradient(117deg, #0F1732 0%, #2F3A58 100%);
border-radius: 7px;

View File

@ -58,4 +58,6 @@
.card-item-des {
font-size: 16px;
margin-top: 10px;
font-weight: 400;
word-spacing: 6px;
}

View File

@ -11,12 +11,14 @@ import { Infiniteloading } from "@nutui/nutui-react-taro"
import { useEffect } from "react"
import { orderList } from "../../utils/api"
import { navigateTo, orderState } from "../../utils/utils"
import { useRouter } from "@tarojs/taro"
const Login = () => {
const param = useRouter().params
const limit = 20
const [tabKey, setTabKey] = useState('0')
const [tabKey, setTabKey] = useState(param.state ?? '0')
const [chanel] = useState('all')
const [page, setPage] = useState(1)
const [list, setList] = useState([])

View File

@ -13,6 +13,8 @@ import { useRouter } from '@tarojs/taro';
import { Button, Textarea, Address } from '@nutui/nutui-react-taro';
import { Avatar } from '@nutui/nutui-react-taro';
import { Overlay } from '@nutui/nutui-react-taro';
import { userDetail } from '../../utils/api';
import { navigateTo } from '../../utils/utils';
@ -21,11 +23,14 @@ function Index() {
const param = useRouter().params
const [id] = useState(param.id)
const [visible, setVisible] = useState(false)
const [user, setUser] = useState({})
useEffect(() => {
}, [id])
userDetail().then(rs => {
if (!rs) return
setUser(rs)
})
}, [])
//
@ -70,7 +75,7 @@ function Index() {
<View className=' addr-item'>
<View className='item-bg' >
<View className='my-order-title flex-between'>
<Avatar size={46} icon="https://img12.360buyimg.com/imagetools/jfs/t1/143702/31/16654/116794/5fc6f541Edebf8a57/4138097748889987.png"
<Avatar size={46} icon={user.avatar} alt={user.nick_name}
/>
<View className='my-order-more flex-center' onClick={editAvatarFn}>
<Text>修改头像</Text>
@ -81,30 +86,30 @@ function Index() {
</View>
<View className='addr-item mt-22'>
<View className='addr-form'>
<View className='addr-form' onClick={() => { navigateTo('/pages/change-user/index') }}>
<View className='addr-form-name'>个人信息</View>
<View className='flex justify-between items-center ' onClick={() => { setNormal(true) }}>
<View className='flex justify-between items-center ' >
<Label />
<Image src={next} className='next-icon' />
</View>
</View>
<View className='addr-form'>
<View className='addr-form' onClick={() => { navigateTo('/pages/change-password/index') }}>
<View className='addr-form-name'>修改密码</View>
<View className='flex justify-between items-center ' onClick={() => { setNormal(true) }}>
<View className='flex justify-between items-center ' >
<Image src={next} className='next-icon' />
</View>
</View>
<View className='addr-form'>
<View className='addr-form' onClick={() => { navigateTo('/pages/change-phone/index') }}>
<View className='addr-form-name'>修改手机号</View>
<View className='flex justify-between items-center ' onClick={() => { setNormal(true) }}>
<Label>18080093730</Label>
<View className='flex justify-between items-center ' >
<Label>{user.phone}</Label>
<Image src={next} className='next-icon ml-2' />
</View>
</View>
<View className='addr-form'>
<View className='addr-form' onClick={() => { navigateTo('/pages/my-card/index') }}>
<View className='addr-form-name'>我的银行卡</View>
<View className='flex justify-between items-center ' onClick={() => { setNormal(true) }}>
<View className='flex justify-between items-center ' >
<Image src={next} className='next-icon' />
</View>
</View>

View File

@ -51,4 +51,9 @@ export const order = async (channel, data = {}) => {
export const orderList = async (channel, params = {}) => {
return await g(`/orders/${channel}`, params)
}
// 当前用户信息
export const userDetail = async () => {
return await g(`/users/detail`)
}