zhangzengfei
2021-06-04 570c4304b907150335f3f8e9d19c4bec6a425757
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
<template>
    <view class="">
        <view class="center">
            <view class="logo" @click="bindLogin" :hover-class="!hasLogin ? 'logo-hover' : ''">
                <image class="logo-img" :src="avatarUrl"></image>
                <view class="logo-title">
                    <text class="user-name">{{hasLogin ? userName : '您未登录'}} \n ID: 123123</text>
                    <text class="go-login navigat-arrow" v-if="!hasLogin">&#xe65e;</text>
                </view>
            </view>
            <view class="center-list">
                <view class="center-list-item border-bottom">
                    <text class="list-icon"><i class="el-icon-mobile-phone"></i></text>
                    <text class="list-text">绑定手机号</text>
                    <text class="list-text mobile">{{"13112311231"}}</text>
                </view>
                <view class="center-list-item border-bottom" @click="toInvite">
                    <text class="list-icon">&#xe102;</text>
                    <text class="list-text">成为经销商</text>
                    <text class="navigat-arrow">&#xe470;</text>
                </view>
                <view class="center-list-item border-bottom">
                    <text class="list-icon"><i class="el-icon-s-marketing"></i></text>
                    <text class="list-text">推广数据统计</text>
                    <text class="navigat-arrow">&#xe470;</text>
                </view>
            </view>
            <view class="center-list" v-show="false">
                <view class="center-list-item border-bottom" v-show="hasLogin && hasPwd" @click="goto">
                    <text class="list-icon">&#xe60f;</text>
                    <text class="list-text">修改密码</text>
                    <text class="navigat-arrow">&#xe65e;</text>
                </view>
                <view v-if="hasLogin" class="center-list-item border-bottom" @click="toInvite">
                    <text class="list-icon">&#xe65f;</text>
                    <text class="list-text">邀请好友</text>
                    <text class="navigat-arrow">&#xe65e;</text>
                </view>
                <view class="center-list-item border-bottom">
                    <text class="list-icon">&#xe639;</text>
                    <text class="list-text">新消息通知</text>
                    <text class="navigat-arrow">&#xe65e;</text>
                </view>
                <view class="center-list-item border-bottom">
                    <text class="list-icon">&#xe60b;</text>
                    <text class="list-text">帮助与反馈</text>
                    <text class="navigat-arrow">&#xe65e;</text>
                </view>
                <view class="center-list-item border-bottom">
                    <text class="list-icon">&#xe65f;</text>
                    <text class="list-text">服务条款及隐私</text>
                    <text class="navigat-arrow">&#xe65e;</text>
                </view>
                <view class="center-list-item">
                    <text class="list-icon">&#xe614;</text>
                    <text class="list-text">关于应用</text>
                </view>
            </view>
 
            <view class="btn-row">
                <button v-if="hasLogin" class="primary" type="primary" :loading="logoutBtnLoading" @tap="bindLogout">退出账号</button>
            </view>
        </view>
    </view>
</template>
 
<script>
    import {
        mapState,
        mapMutations
    } from 'vuex'
    import {
        univerifyLogin
    } from '@/common/univerify.js'
 
    export default {
        data() {
            return {
                avatarUrl: "../../static/img/logo.png",
                inviteUrl: '',
                logoutBtnLoading: false,
                hasPwd: uni.getStorageSync('uni_id_has_pwd')
            }
        },
        computed: {
            ...mapState(['hasLogin', 'forcedLogin', 'userName'])
        },
 
        methods: {
            ...mapMutations(['logout']),
            bindLogin() {
                if (!this.hasLogin) {
                    univerifyLogin().catch(err => {
                        if (err === false) return;
 
                        uni.navigateTo({
                            url: '../login/login',
                        });
                    })
                }
            },
            bindLogout() {
                this.logoutBtnLoading = true
                this.logout();
                uni.removeStorageSync('uni_id_token')
                uni.removeStorageSync('username')
                uni.removeStorageSync('uni_id_has_pwd')
 
                if (this.forcedLogin) {
                    uni.reLaunch({
                        url: '../login/login',
                    });
                }
 
                this.logoutBtnLoading = false
            },
            toInvite() {
                uni.navigateTo({
                    url: '../invite/invite'
                })
            },
            goto() {
                uni.navigateTo({
                    url: '../pwd/update-password'
                })
            }
        }
    }
</script>
 
<style scoped>
    @font-face {
        font-family: texticons;
        font-weight: normal;
        font-style: normal;
        src: url('../../static/uni.ttf') format('truetype');
    }
 
    page,
    view {
        display: flex;
    }
 
    page {
        background-color: #f8f8f8;
    }
 
    button {
        width: 100%;
    }
 
    .center {
        flex-direction: column;
    }
 
    .logo {
        width: 750rpx;
        height: 240rpx;
        padding: 20rpx;
        box-sizing: border-box;
        background-color: #fff;
        flex-direction: row;
        align-items: center;
    }
 
    .logo-hover {
        opacity: 0.8;
    }
 
    .logo-img {
        width: 120rpx;
        height: 120rpx;
        border-radius: 150rpx;
    }
 
    .logo-title {
        height: 150rpx;
        flex: 1;
        align-items: center;
        justify-content: space-between;
        flex-direction: row;
        margin-left: 20rpx;
    }
 
    .user-name {
        height: 40rpx;
        line-height: 40rpx;
        color: #7b7b7b;
    }
 
    .go-login.navigat-arrow {
        color: #FFFFFF;
    }
 
    .login-title {
        height: 150rpx;
        align-items: self-start;
        justify-content: center;
        flex-direction: column;
        margin-left: 20rpx;
    }
 
    .center-list {
        background-color: #FFFFFF;
        margin-top: 20rpx;
        width: 750rpx;
        flex-direction: column;
    }
 
    .center-list-item {
        height: 90rpx;
        width: 750rpx;
        box-sizing: border-box;
        flex-direction: row;
        padding: 0rpx 20rpx;
    }
 
    .border-bottom {
        border-bottom-width: 1rpx;
        border-color: #c8c7cc;
        border-bottom-style: solid;
    }
 
    .list-icon {
        width: 40rpx;
        height: 90rpx;
        line-height: 90rpx;
        color: #0faeff;
        text-align: center;
        font-family: texticons;
        margin-right: 20rpx;
    }
 
    .list-text {
        height: 90rpx;
        line-height: 90rpx;
        color: #555;
        flex: 1;
        text-align: left;
    }
 
    .navigat-arrow {
        height: 90rpx;
        width: 40rpx;
        line-height: 90rpx;
        color: #555;
        text-align: right;
        font-family: texticons;
    }
 
    .mobile {
        font-size: 13px;
        text-align: right;
    }
</style>