<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 }} {{ 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>
|