From 6824ba109c5d5f4b952a8afd1bff59816b8480e5 Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期三, 22 十一月 2023 19:14:11 +0800
Subject: [PATCH] #
---
pages/user/user.vue | 50 ++++++++++++++++++++++----------------------------
1 files changed, 22 insertions(+), 28 deletions(-)
diff --git a/pages/user/user.vue b/pages/user/user.vue
index cb5bc04..64dff87 100644
--- a/pages/user/user.vue
+++ b/pages/user/user.vue
@@ -3,8 +3,7 @@
<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">
@@ -20,6 +19,7 @@
</template>
<script>
+ import user from '@/pages/api/user/user.js'
export default{
data() {
return {
@@ -30,35 +30,28 @@
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'
})
},
- 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);
- }
- })
- },
+ backLogin(res) {
+ uni.showToast({title: res.msg, icon: "none", position: 'top'})
+ setTimeout(() => {
+ uni.reLaunch({
+ url: '../login/login'
+ });
+ }, 1000);
+ }
}
}
</script>
@@ -72,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