#
whycq
2023-11-07 e7cb9cf85f5f1c0db0833dbbd9ad3f4ed09b3598
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<template>
    <view>
        <view class="user" @click="userDetail">
            <!-- 头像 -->
            <view class="user-avatar">
                <img src="" alt="">
                <!-- <image src="" mode="aspectFit"></image> -->
            </view>
            <!-- 信息 -->
            <view class="user-info">
                <view class="user-name">{{username}}</view>
                <view class="user-company">中扬立库技术有限公司</view>
            </view>
            <!-- 更多 -->
            <view class="user-icons">
                <uni-icons type="right"></uni-icons>
            </view>
        </view>
    </view>
</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);
                } 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);
            }
        }
    }
</script>
 
<style>
    .user {
        width: 100%;
        height: 200rpx;
        background-color: #fff;
        display: grid;
        grid-template-columns: 1fr 4fr 1fr;
    }
    .user-avatar {
        height: 200rpx;
        width: 200rpx;
        /* background-color: aquamarine; */
        display: flex;
        justify-content: center;
        align-items: center;
    }
    .user-avatar img {
        height: 100rpx;
        border-radius: 20rpx;
    }
    .user-info {
        height: 200rpx;
        display: grid;
        grid-template-rows: 2fr 2fr;
        /* background-color: aqua; */
    }
    .user-name {
        height: 100rpx;
        width: 100%;
        display: flex;
        align-items: flex-end;
        font-size: 30rpx;
        font-weight: 700;
    }
    .user-company {
        height: 100rpx;
    }
    .user-icons {
        display: flex;
        align-items: center;
        justify-content: center;
    }
</style>