diff --git a/src/pages/home/index.jsx b/src/pages/home/index.jsx index b103338..9535596 100644 --- a/src/pages/home/index.jsx +++ b/src/pages/home/index.jsx @@ -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 - - + { navigateTo('/pages/setting/index') }} /> + { navigateTo('/pages/message/index') }} /> - - 这个是姓名 + {user.nick_name} - V5 + {user.user_level?.name} - + { + navigateTo('/pages/user-info/index') + }}> 编辑资料 {'>'} - 区域合伙人 + {user.is_city_partner ? '区域合伙人' : ''} @@ -61,32 +75,40 @@ const Index = () => { 我的订单 - + { + navigateTo('/pages/order/index') + }}> 全部订单 - + { + navigateTo('/pages/order/index?state=paid') + }}> - 2 - - 待付款 - - - - - 2 + {/* 2 */} 待发货 - + { + navigateTo('/pages/order/index?state=sent') + }}> + + + {/* 2 */} + + 待收货 + + { + navigateTo('/pages/order/index?state=received') + }}> - 2 + {/* 2 */} - 已完成 + 已收货 @@ -98,11 +120,11 @@ const Index = () => { - 12345 + {user.contribution} 贡献值 - 12345 + {user.energy} 能量值 @@ -114,15 +136,15 @@ const Index = () => { - 12345 + {user.score} 余额 - 12345 + {user.profit ?? 0} 收益 - 12345 + {user.shopping_score} 购物金 @@ -143,7 +165,6 @@ const Index = () => { - 购物金商城 diff --git a/src/pages/home/index.scss b/src/pages/home/index.scss index aac001c..9731569 100644 --- a/src/pages/home/index.scss +++ b/src/pages/home/index.scss @@ -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; diff --git a/src/pages/my-card/index.scss b/src/pages/my-card/index.scss index cbe0537..dde9269 100644 --- a/src/pages/my-card/index.scss +++ b/src/pages/my-card/index.scss @@ -58,4 +58,6 @@ .card-item-des { font-size: 16px; margin-top: 10px; + font-weight: 400; + word-spacing: 6px; } \ No newline at end of file diff --git a/src/pages/order/index.jsx b/src/pages/order/index.jsx index 93dbad1..1dc94c6 100644 --- a/src/pages/order/index.jsx +++ b/src/pages/order/index.jsx @@ -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([]) diff --git a/src/pages/user-info/index.jsx b/src/pages/user-info/index.jsx index b460955..48e8f00 100644 --- a/src/pages/user-info/index.jsx +++ b/src/pages/user-info/index.jsx @@ -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() { - 修改头像 @@ -81,30 +86,30 @@ function Index() { - + { navigateTo('/pages/change-user/index') }}> 个人信息 - { setNormal(true) }}> + - + { navigateTo('/pages/change-password/index') }}> 修改密码 - { setNormal(true) }}> + - + { navigateTo('/pages/change-phone/index') }}> 修改手机号 - { setNormal(true) }}> - + + - + { navigateTo('/pages/my-card/index') }}> 我的银行卡 - { setNormal(true) }}> + diff --git a/src/utils/api.js b/src/utils/api.js index 07b854c..39c9d8f 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -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`) } \ No newline at end of file