From 9a3837ce2d128a9f03264f2ce99b8d3584e5520e Mon Sep 17 00:00:00 2001 From: whycq <10027870+whycq@user.noreply.gitee.com> Date: 星期五, 24 十一月 2023 09:29:00 +0800 Subject: [PATCH] # --- pages/user/user.vue | 37 ++++++++++++++++++++++++++++++------- 1 files changed, 30 insertions(+), 7 deletions(-) diff --git a/pages/user/user.vue b/pages/user/user.vue index 98e5997..64dff87 100644 --- a/pages/user/user.vue +++ b/pages/user/user.vue @@ -3,12 +3,11 @@ <view class="user" @click="userDetail"> <!-- 澶村儚 --> <view class="user-avatar"> - <img src="" alt=""> - <!-- <image src="" mode="aspectFit"></image> --> + <image src="../../static/image/user__easyico.png" mode="aspectFit"></image> </view> <!-- 淇℃伅 --> <view class="user-info"> - <view class="user-name">闄堥箯</view> + <view class="user-name">{{username}}</view> <view class="user-company">涓壃绔嬪簱鎶�鏈湁闄愬叕鍙�</view> </view> <!-- 鏇村 --> @@ -20,15 +19,38 @@ </template> <script> + import user from '@/pages/api/user/user.js' export default{ data() { return { - + username: '' } }, + onShow() { + this.getDetail() + }, methods: { + async getDetail() { + let res = await user.getDetail() + if (res.code === 200) { + this.username = res.data.username + console.log(res.data); + } else if (res.code === 403) { + this.backLogin(res) + } + }, userDetail() { - + uni.navigateTo({ + url:'/pages/user/user_detail/userDetail' + }) + }, + backLogin(res) { + uni.showToast({title: res.msg, icon: "none", position: 'top'}) + setTimeout(() => { + uni.reLaunch({ + url: '../login/login' + }); + }, 1000); } } } @@ -43,8 +65,9 @@ grid-template-columns: 1fr 4fr 1fr; } .user-avatar { - height: 200rpx; - width: 200rpx; + height: 100rpx; + width: 100rpx; + padding: 50rpx; /* background-color: aquamarine; */ display: flex; justify-content: center; -- Gitblit v1.9.1