From 155f2b80f2a9b6f900c73f6e4461e9cebb7cd028 Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期二, 10 十月 2023 17:12:20 +0800
Subject: [PATCH] #

---
 pages/user/user.vue |   47 ++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 44 insertions(+), 3 deletions(-)

diff --git a/pages/user/user.vue b/pages/user/user.vue
index 97f4c69..cb5bc04 100644
--- a/pages/user/user.vue
+++ b/pages/user/user.vue
@@ -1,6 +1,6 @@
 <template>
 	<view>
-		<view class="user">
+		<view class="user" @click="userDetail">
 			<!-- 澶村儚 -->
 			<view class="user-avatar">
 				<img src="" alt="">
@@ -8,7 +8,7 @@
 			</view>
 			<!-- 淇℃伅 -->
 			<view class="user-info">
-				<view class="user-name">闄堥箯</view>
+				<view class="user-name">{{username}}</view>
 				<view class="user-company">涓壃绔嬪簱鎶�鏈湁闄愬叕鍙�</view>
 			</view>
 			<!-- 鏇村 -->
@@ -20,13 +20,54 @@
 </template>
 
 <script>
+	export default{
+		data() {
+			return {
+				username: ''
+			}
+		},
+		onShow() {
+			this.getDetail()
+		},
+		methods: {
+			userDetail() {
+				uni.navigateTo({
+					url:'/pages/user/user_detail/userDetail'
+				})
+			},
+			getDetail() {
+				let that = this
+				uni.request({
+					url: that.baseUrl + '/user/detail/auth',
+					header: {'token' : uni.getStorageSync('token')},
+					method: 'POST',
+					success(res) {
+						res = res.data
+						if (res.code === 200) {
+							that.username = res.data.username
+						} else if (res.code === 403) {
+							uni.showToast({title: res.msg, icon: "none", position: 'top'})
+							setTimeout(() => {
+								uni.reLaunch({
+									url: '../../login/login'
+								});
+							}, 1000);
+						} else {
+							uni.showToast({title: res.msg, icon: "none",position: 'top'})
+						}
+						console.log(res.data);
+					}
+				})
+			},
+		}
+	}
 </script>
 
 <style>
 	.user {
 		width: 100%;
 		height: 200rpx;
-		background-color: #f8f8f8;
+		background-color: #fff;
 		display: grid;
 		grid-template-columns: 1fr 4fr 1fr;
 	}

--
Gitblit v1.9.1