1
wankeda
2025-04-10 e692b8c296bae952a810688f700b659ae8240a5c
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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
<template>
    <view class="mine">
        <view class="tools">
            <uni-icons type="scan" size="48rpx" color="#292C39" @click="doScan"></uni-icons>
            <uni-icons type="gear-filled" size="48rpx" color="#292C39" @click="goSetAddress"></uni-icons>
        </view>
        <view class="header">
            <view class="header-user">
                <image :src="userInfo.avatar" class="header-user-avatar"></image>
                <view class="header-user-nickname">
                    <view class="nickname">{{ userInfo.userName }}🧑‍💻</view>
                    <view class="info">{{ userInfo.roleName }} &nbsp;&nbsp; {{ userInfo.userTrueName }}</view>
                </view>
                <view class="header-user-more">
                    <uni-icons type="bars" size="48rpx" color="#BEC0C7"></uni-icons>
                </view>
            </view>
        <!--     <view class="header-target">
                <view class="header-target-item" v-for="(item, key) in target" :key="key">
                    <text class="label">{{ item }}</text>
                    <text class="value">{{ key }}</text>
                </view>
            </view> -->
        </view>
        <view class="main">
            <uni-list :border="false">
                <uni-list-item showArrow title="检查更新" @click.native="checkVeision"/>
                <uni-list-item showArrow title="更新密码" @click.native="updatePassWord" />
                <uni-list-item showArrow title="退出当前账号" @click.native="doLogout" />
            </uni-list>
        </view>
    </view>
</template>
<script>
    //import {  } from "@/common/api/{$}.js";
    import httpInterceptor from '@/common/http.interceptor.js'
    export default {
        data() {
            return {
                // target: {
                //     修身: 99,
                //     齐家: 99,
                //     治国: 99,
                //     评天下: 144
                // },
                userInfo: {}
            };
        },
        //监听页面加载,其参数为上个页面传递的数据,参数类型为 Object(用于页面传参)
        onLoad() {
            this.$u.post('/api/User/GetCurrentUserInfo', null).then(res => {
                console.log(res);
                
                if (res.status) {
                    this.userInfo = res.data
                } else {
                    this.$t.message.loading('登录失效请重新登录')
                    this.Login()
                }
 
            }).catch((res) => {
                this.$t.message.loading('登录失效请重新登录')
                this.Login()
            })
            // let haslogin = uni.getStorageSync('jo_user')
            // this.userNickName = haslogin.name;
        },
        methods: {
            Login() {
                // this.$u.route('/pages/login/login');
                uni.reLaunch({
                    url: '/pages/login/login'
                });
            },
 
            doLogout() {
                uni.showModal({
                    title: '提示',
                    content: '确认退出当前登录账号吗?',
                    success: (action) => {
                        if (action.confirm) {
                            // 点击的确认按钮
                            uni.clearStorage();
                            uni.reLaunch({
                                url: '/pages/login/login'
                            });
                        }
                    }
                })
            },
            
            
            updatePassWord(){
                uni.reLaunch({
                    url: '/pages/UpdatePassWord/UpdatePassWord'
                });
            },
            
            doScan() {
                uni.scanCode({
                    success: (res) => {
                        // 扫码内容
                        let code = res.result || ''
 
                        uni.showToast(`扫码内容:${code}`)
                    }
                })
            },
            checkVeision() {
            
                // 获取manifest.json 的信息 版本信息
                plus.runtime.getProperty(plus.runtime.appid, wgtinfo => {
                    this.curVersion = wgtinfo.version; //应用版本名称
                    this.curVersionCode = wgtinfo.versionCode; //应用版本号
                });
                this.$u.get('/api/PDA/GetRelease', null).then(res => {
                    // 当前版本code
                    let curVersionCode = parseInt(this.curVersionCode);
                    // 新版本code
                    let newVersionCode = res;
                    debugger 
                    console.log("curVersionCode:", curVersionCode);
                    console.log("newVersionCode:", newVersionCode);
                    // 有新版本
                    if (newVersionCode > curVersionCode) {
                        console.log("有新版本")
                        // 检测新版本提示
                        uni.showModal({
                            title: '版本检查',
                            content: '检测到新版本,是否下载安装包?',
                            confirmText: '下载',
                            success: res => {
                                // 安装包下载地址
                                if (res.confirm) {
                                    const url = httpInterceptor.baseUrl + "/api/PDA/FileDownload"
                                    uni.showLoading({
                                         title: '安装包下载中'
                                    });
                                    // 新建下载任务
                                    let dtask = plus.downloader.createDownload(url, {}, (d,
                                        status) => {
                                        if (status == 200) {
                                            uni.hideLoading();
                                            uni.showModal({
                                                 title: '提示',
                                                content: '安装包下载成功,是否确认安装?',
                                                success: res => {
                                                    if (res.confirm) {
                                                        plus.runtime.install(
                                                            plus.io
                                                            .convertLocalFileSystemURL(
                                                                d.filename
                                                            ), {},
                                                            success => {
                                                                uni.showToast({
                                                                    title: '安装成功',
                                                                    mask: false,
                                                                    duration: 1500
                                                                });
                                                            },
                                                            error => {
                                                                uni.showToast({
                                                                    title: '安装失败',
                                                                    mask: false,
                                                                    duration: 1500
                                                                });
                                                            }
                                                        );
                                                    }
                                                }
                                            });
                                        } else {
                                            uni.hideLoading();
                                            uni.showToast({
                                                title: '安装包下载失败',
                                                mask: false,
                                                duration: 1500
                                            });
                                        }
                                    });
                                    // 开始下载
                                    dtask.start();
                                }
                            }
                        });
                    }
                    else{
                        this.$t.message.toast("暂无更新")
                    }
                })
            }
            
            //跳转到SetAddress页面
            ,
            goSetAddress() {
                this.$u.route('/pages/SetAddress/SetAddress');
            },
        },
    };
</script>
 
 
<style lang="scss" scoped>
    .mine {
        min-height: calc(100vh - var(--window-top) - var(--window-bottom));
        width: 100vw;
        box-sizing: border-box;
        background: #e7f0ff;
        padding: 0 24rpx 24rpx;
 
        .tools {
            display: flex;
            justify-content: space-between;
            margin-bottom: 32rpx;
            box-sizing: border-box;
            padding: 0 12rpx;
        }
 
        .header {
            width: 100%;
            background: #f6f9fe;
            border-radius: 16rpx;
            padding: 32rpx;
            box-sizing: border-box;
            margin-bottom: 24rpx;
 
            &-user {
                display: flex;
                margin-bottom: 56rpx;
 
                &-avatar {
                    flex: 0 0 auto;
                    border-radius: 50%;
                    width: 128rpx;
                    height: 128rpx;
                    overflow: hidden;
                }
 
                &-nickname {
                    flex: 1 1 auto;
                    margin-left: 32rpx;
                    display: flex;
                    flex-direction: column;
                    justify-content: center;
 
                    .nickname {
                        color: #292c39;
                        font-weight: 550;
                        font-size: 32rpx;
                        margin-bottom: 12rpx;
                    }
 
                    .info {
                        color: #c6c9cf;
                        font-size: 26rpx;
                    }
                }
 
                &-more {
                    flex: 0 0 auto;
                    width: 48rpx;
                }
            }
 
            &-target {
                display: flex;
 
                &-item {
                    display: flex;
                    flex-direction: column;
                    align-items: center;
                    width: 25%;
 
                    .label {
                        color: #292c39;
                        font-size: 32rpx;
                        font-weight: 550;
                        margin-bottom: 24rpx;
                    }
 
                    .value {
                        color: #3c3f49;
                        font-size: 28rpx;
                    }
                }
            }
        }
 
        .main {
            width: 100%;
            background: #ffffff;
            border-radius: 16rpx;
            padding: 12rpx 12rpx;
            box-sizing: border-box;
        }
    }
</style>