Leon 2 years ago
parent
commit
4e5321d9b1
3 changed files with 35 additions and 8 deletions
  1. 0 2
      src/pages/Profile.tsx
  2. 15 0
      src/pages/ProfileSetting.scss
  3. 20 6
      src/pages/ProfileSetting.tsx

+ 0 - 2
src/pages/Profile.tsx

@@ -10,8 +10,6 @@ export default function Page() {
     const dispatch = useDispatch();
     const user = useSelector((state: any) => state.user);
 
-    
-
     function tapLogin() {
         Taro.navigateTo({
             url: '/pages/ChooseAuth'

+ 15 - 0
src/pages/ProfileSetting.scss

@@ -0,0 +1,15 @@
+.row{
+    display: flex;
+    flex-direction: row;
+    justify-content: space-between;
+}
+
+.avatar{
+    width: 90px;
+    height: 90px;
+    border-radius: 90px;
+    background-color: #fff;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+}

+ 20 - 6
src/pages/ProfileSetting.tsx

@@ -1,10 +1,12 @@
 import Buttons from "@/components/Buttons";
 import { clear, logout } from "@/services/user";
-import { View, Text } from "@tarojs/components";
-import { useDispatch } from "react-redux";
+import { View, Text,Image } from "@tarojs/components";
+import { useDispatch, useSelector } from "react-redux";
+import './Profile.scss'
 
 export default function Page() {
     const dispatch = useDispatch();
+    const user = useSelector((state: any) => state.user);
     function logoutF() {
         dispatch(logout() as any);
     }
@@ -12,11 +14,23 @@ export default function Page() {
     function clearF() {
         dispatch(clear() as any);
     }
-    
-    return <View>
-        <Buttons title='退出登录' onClick={logoutF} style={{ width: 289, marginBottom: 30 }} />
 
-        <Buttons title='注销账号' onClick={clearF} style={{ width: 289, marginBottom: 30 }} />
+    return <View className="container">
+        <View className="row">
+            <Text>头像</Text>
+            <Image src={user.avatar} className="avatar" />
+        </View>
+        <View className="row">
+            <Text>昵称</Text>
+            <Text>{user.nickname}</Text>
+        </View>
+        <View className="row">
+            <Text>用户名</Text>
+            <Text>{user.username}</Text>
+        </View>
+        {/* <Buttons title='退出登录' onClick={logoutF} style={{ width: 289, marginBottom: 30 }} />
+
+        <Buttons title='注销账号' onClick={clearF} style={{ width: 289, marginBottom: 30 }} /> */}
 
 
     </View>