lefengyang
2026-08-16 89a0bb7081da65e12d73b959db93470b1d5f5b03
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<template>
    <view class="page_bg">
        <uv-navbar title=" " :placeholder="true" leftIcon="" bgColor="rgba(0,0,0,0)" titleStyle="color:#fff"></uv-navbar>
        
        <view class="my_info">
            <image class="ph" :src="baseURL + user.avatar" mode="aspectFill"></image>
            <view class="info">
                <view class="name">
                    {{user.nickName}}
                </view>
                <view class="text">
                    微信号: {{user.wx||'-'}}
                </view>
            </view>
        </view>
        
        <view class="my_nav">
            <navigator class="item" url="/pages/personal/personal" hover-class="none" :render-link="false">
                <view class="name">
                    用户信息编辑
                </view>
                <uv-icon name="arrow-right" color="rgba(0, 0, 0, 0.40)" size="36rpx"></uv-icon>
            </navigator>
            <navigator class="item" url="/pages/invite/invite" hover-class="none" :render-link="false">
                <view class="name">
                    邀请好友
                </view>
                <uv-icon name="arrow-right" color="rgba(0, 0, 0, 0.40)" size="36rpx"></uv-icon>
            </navigator>
            <navigator class="item" url="/pages/about/about" hover-class="none" :render-link="false">
                <view class="name">
                    关于我们
                </view>
                <uv-icon name="arrow-right" color="rgba(0, 0, 0, 0.40)" size="36rpx"></uv-icon>
            </navigator>
            <navigator class="item" url="/pages/feedback/feedback" hover-class="none" :render-link="false">
                <view class="name">
                    意见反馈
                </view>
                <uv-icon name="arrow-right" color="rgba(0, 0, 0, 0.40)" size="36rpx"></uv-icon>
            </navigator>
            <navigator class="item" url="/pages/set/set" hover-class="none" :render-link="false">
                <view class="name">
                    设置
                </view>
                <uv-icon name="arrow-right" color="rgba(0, 0, 0, 0.40)" size="36rpx"></uv-icon>
            </navigator>
        </view>
        
        <view class="logout">
            <uv-button type="primary" :hairline="true" :plain="true" text="退出登录" shape="circle" color="#999" @click="postLogout"></uv-button>
        </view>
        
    </view>
</template>
 
<script>
    import { userInfo,logout } from '@/api/api.js'
    export default {
        data() {
            return {
                baseURL: '',
                user: {}
            }
        },
        onLoad() {
            
        },
        onShow() {
            this.baseURL = uni.$uv.http.config.baseURL
            this.getUserInfo()
        },
        methods: {
            postLogout(){
                uni.showModal({
                    title: '提示',
                    content: '确定退出登录吗?',
                    success: function (res) {
                        if (res.confirm) {
                            console.log('用户点击确定');
                            logout().then(res=>{
                                console.log('退出----',res)
                                uni.showToast({
                                    title: res.msg,
                                    duration: 2000,
                                    icon: 'none'
                                });
                                uni.removeStorageSync('token');
                                uni.removeStorageSync('userId');
                                uni.reLaunch({
                                    url: '/pages/login/login'
                                });
                            })
                        } else if (res.cancel) {
                            console.log('用户点击取消');
                        }
                    }
                });
                
            },
            getUserInfo(){
                userInfo().then(res=>{
                    console.log('用户信息----',res)
                    this.user = res.user
                    uni.setStorageSync('userId', res.user.userId)
                })
            }
        }
    }
</script>
 
<style lang="scss" scoped>
.logout{
    width: 380rpx;
    margin: 60rpx auto 0;
}
.my_nav{
    margin-top: 70rpx;
    padding:0 30rpx;
    .item{
        width: 100%;
        height: 120rpx;
        display: flex;
        align-items: center;
        justify-content: space-between;
        display: flex;
        align-items: center;
        justify-content: space-between;
        box-sizing: border-box;
        border-bottom: 1rpx solid #ddd;
        box-sizing: border-box;
        padding-right: 10rpx;
        .name{
            font-size: 30rpx;
            color: rgba(0,0,0,0.9);
            line-height: 46rpx;
        }
    }
}
.my_info{
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding:20rpx 30rpx 0;
    .info{
        width: 100%;
        .name{
            font-weight: 500;
            font-size: 35rpx;
            color: rgba(0,0,0,0.9);
            line-height: 48rpx;
        }
        .text{
            font-weight: 400;
            font-size: 27rpx;
            color: rgba(0,0,0,0.7);
            line-height: 46rpx;
            margin-top: 10rpx;
        }
    }
    .ph{
        flex-shrink: 0;
        width: 140rpx;
        height: 140rpx;
        border-radius: 50%;
        border:4rpx solid #fff;
        margin-right: 30rpx;
    }
}
.page_bg{
    width: 100%;
    min-height: calc(100vh - var(--window-bottom));
    background:url('/static/img/bg_2.jpg') no-repeat center top;
    background-size: 100% auto;
}
</style>