<template>
|
<view class="container">
|
<view class="uni-panel">
|
<view class="uni-panel-h" @click="clickUser">
|
<view class="uni-panel-image">
|
<image class="user-image" :src="imgUserData" mode="widthFix" @error="imageUserError"> </image>
|
</view>
|
<view class="uni-name-info"><text class="uni-name-text">{{userData.user_name}}</text>
|
<text class="uni-name-text">账号:{{userData.user_login}}</text>
|
</view>
|
<view class="uni-panel-right"><text class="fs-ArrowRight"></text></view>
|
</view>
|
<view class="uni-panel-h2" @click="clickDevicePanel">
|
<text class="uni-panel-text">设备</text>
|
<text class="uni-panel-icon fs-ArrowDown" :class="{'uni-panel-icon-on':isDevicePanel}"></text>
|
</view>
|
<view v-show="isDevicePanel" class="uni-panel-c">
|
<view class="uni-panel-hh">
|
<text>设备型号</text>
|
<view class="uni-panel-text2">
|
<text>{{deviceType}}</text>
|
</view>
|
</view>
|
<view class="uni-panel-hh">
|
<text>分辨率</text>
|
<view class="uni-panel-text2">
|
<text>{{deviceScreen}}</text>
|
</view>
|
</view>
|
<view class="uni-panel-hh">
|
<text>系统类型</text>
|
<view class="uni-panel-text2">
|
<text>{{osType}}</text>
|
</view>
|
</view>
|
<view class="uni-panel-hh">
|
<text>网络类型</text>
|
<view class="uni-panel-text2">
|
<text>{{networkType}}</text>
|
</view>
|
</view>
|
</view>
|
</view>
|
<view class="uni-panel-bottom">
|
<button class="uni-panel-button button-clz" v-if="isPwdLogin" @click="clickModifyPwd">修改密码</button>
|
<!-- v-if="!isPwdLogin" -->
|
<button class="uni-panel-button button-clz-exit" @click="clickExit">退出登录</button>
|
<button class="uni-panel-button button-clz" @click="clickRelogin">重新登录</button>
|
<button class="uni-panel-button button-clz" @click="clickReset">设置</button>
|
<!-- <button class="uni-panel-button button-clz" @click="clickModifyPwd">扫描</button> -->
|
<text class="uni-panel-text2" style="margin-right: 10px;font-size: 14px;">{{verdate}}</text>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import {
|
showModal,
|
showToast
|
} from "@/common/Page.js"
|
import Session from "@/common/utils.js"
|
import {
|
resetPassword
|
} from "@/api/org.js"
|
export default {
|
data() {
|
return {
|
isDevicePanel: true,
|
deviceType: "",
|
deviceScreen: "",
|
osType: "",
|
networkType: "",
|
userData: {
|
user_login: "",
|
user_name: ""
|
},
|
verdate: '',
|
imgUserData: '',
|
isPwdLogin: true,
|
}
|
},
|
methods: {
|
setData(obj) {
|
let that = this;
|
let keys = [];
|
let val, data;
|
Object.keys(obj).forEach(function(key) {
|
keys = key.split(".");
|
val = obj[key];
|
data = that.$data;
|
keys.forEach(function(key2, index) {
|
if (index + 1 == keys.length) {
|
that.$set(data, key2, val);
|
} else {
|
if (!data[key2]) {
|
that.$set(data, key2, {});
|
}
|
}
|
data = data[key2];
|
});
|
});
|
},
|
imageUserError() {
|
this.imgUserData = getApp().globalData.defaultuserphoto
|
},
|
clickUser() {
|
const _this = this
|
uni.navigateTo({
|
url: '/pages/my/usersetting',
|
events: {
|
updatePhoto: function() {
|
const app = getApp()
|
_this.imgUserData =
|
`${app.globalData.apiurl.org}/userphoto?login=${app.globalData.userdata.user_login}&t=${new Date().getTime()}`;
|
}
|
}
|
|
})
|
},
|
clickDevicePanel() {
|
this.isDevicePanel = !this.isDevicePanel
|
},
|
clickExit() {
|
showModal("确定要退出登录吗?", "询问").then((res) => {
|
console.log("clickExit", res)
|
if (res) {
|
const app = getApp()
|
app.globalData.userdata = {};
|
Session.clearValue('userdata');
|
let loginInfo = Session.getValue('logininfo')
|
if (!this.isPwdLogin) {
|
loginInfo.userlogin = ""
|
loginInfo.username = ""
|
}
|
loginInfo.mobile = ""
|
loginInfo.password = ""
|
loginInfo.sessionid = ""
|
Session.setValue('logininfo', loginInfo);
|
uni.reLaunch({
|
url: '/pages/loading/loading?noautologin=1'
|
})
|
}
|
})
|
},
|
clickModifyPwd() {
|
/* uni.scanCode({
|
scanType:["qrCode"],
|
success: function (s) {
|
console.log("scanCode:",s)
|
}
|
})
|
*/
|
uni.navigateTo({
|
url: '/pages/my/resetpwd'
|
})
|
},
|
clickRelogin() {
|
showModal("确定要退出重新登录吗?", "询问").then((res) => {
|
console.log("clickRelogin", res)
|
if (res) {
|
const app = getApp()
|
app.globalData.userdata = {};
|
Session.clearValue('userdata');
|
let loginInfo = Session.getValue('logininfo')
|
loginInfo.mobile = ""
|
loginInfo.password = ""
|
loginInfo.sessionid = ""
|
Session.setValue('logininfo', loginInfo);
|
uni.reLaunch({
|
url: '/pages/loading/loading'
|
})
|
}
|
})
|
},
|
clickReset() {
|
uni.navigateTo({
|
url: '/pages/loading/set'
|
})
|
|
},
|
showError(ex) {
|
let tip = typeof ex == 'string' ? ex : typeof ex.err_msg == 'string' ? ex.err_msg : typeof ex.errMsg ==
|
'string' ? ex.errMsg : ""
|
showModal(tip, "提示", false)
|
},
|
|
},
|
onTabItemTap(item) {
|
let default_pageinfo = {}
|
default_pageinfo.pagePath = item.pagePath
|
Session.setDefaultPageInfo(default_pageinfo)
|
},
|
onShow() {
|
const app = getApp()
|
this.userData = {
|
user_login: app.globalData.userdata.user_login,
|
user_name: app.globalData.userdata.user_name
|
}
|
this.verdate = app.globalData.verdate
|
this.isPwdLogin = app.globalData.isPwdLogin
|
this.imgUserData =
|
`${app.globalData.apiurl.org}/userphoto?login=${app.globalData.userdata.user_login}`;
|
|
},
|
onLoad() {
|
var _this = this
|
// #ifdef MP-DINGTALK
|
|
my.setNavigationBar({
|
backgroundColor: "#007AFF",
|
frontColor: "#ffffff"
|
})
|
// #endif
|
uni.getSystemInfo({
|
success: function(s) {
|
//console.log("getSystemInfo",s)
|
_this.setData({
|
osType: s.brand + " " + s.osName + s.osVersion,
|
deviceType: s.brand + " " + s.model,
|
deviceScreen: s.screenWidth * s.pixelRatio + "*" + s.screenHeight * s
|
.pixelRatio
|
})
|
},
|
})
|
uni.getNetworkType({
|
success: function(s) {
|
//console.log("getNetworkType",s)
|
_this.setData({
|
networkType: s.networkType + "网络"
|
})
|
},
|
})
|
var pages = getCurrentPages()
|
let default_pageinfo = {}
|
default_pageinfo.pagePath = pages[0].route
|
Session.setDefaultPageInfo(default_pageinfo)
|
}
|
}
|
</script>
|
|
<style>
|
page {
|
background-color: #e5eaee
|
}
|
|
.container {
|
display: flex;
|
width: 750rpx;
|
height: 100vh;
|
flex-direction: column;
|
}
|
|
.user-image {
|
height: 80px !important;
|
width: 80px;
|
border-radius: 50%;
|
}
|
|
.uni-panel {
|
display: flex;
|
flex: 1;
|
background-color: transparent;
|
flex-direction: column !important;
|
}
|
|
.uni-panel-c {
|
display: flex;
|
background-color: #ffffff;
|
flex-direction: column !important;
|
margin: 8px 16px;
|
border-radius: 12px;
|
}
|
|
.uni-panel-h {
|
display: flex;
|
flex-direction: row !important;
|
background-color: transparent;
|
padding: 8px;
|
height: 90px !important;
|
}
|
|
.uni-panel-h2 {
|
display: flex;
|
background-color: #d4dfec;
|
flex-direction: row !important;
|
align-items: center !important;
|
/* border-top:1px solid #cacaca; */
|
padding: 8px 12px;
|
font-size: 14px;
|
}
|
|
.uni-panel-hh {
|
display: flex;
|
|
flex-direction: row !important;
|
align-items: center !important;
|
padding: 8px;
|
font-size: 12px;
|
border-bottom: 1px solid #f2e7e7;
|
}
|
|
.uni-panel-bottom {
|
display: flex;
|
width: 100%;
|
margin-bottom: 8px;
|
flex-direction: column !important;
|
}
|
|
.uni-name-info {
|
flex: 1;
|
flex-direction: column !important;
|
font-size: 15px;
|
width: calc(750rpx - 120px);
|
padding: 20px 4px;
|
}
|
|
.uni-name-text {
|
display: flex;
|
padding: 2px 2px;
|
}
|
|
.uni-panel-image {
|
height: 80px !important;
|
width: 80px;
|
position: relative;
|
float: left;
|
padding: 2px;
|
text-align: center;
|
border-radius: 50%;
|
}
|
|
.uni-panel-right {
|
font-size: 16px;
|
width: 20px;
|
position: relative;
|
float: right;
|
text-align: center;
|
color: #808080;
|
line-height: 80px;
|
}
|
|
.button-clz-exit {
|
font-size: 16px !important;
|
color: red;
|
}
|
|
.button-clz {
|
font-size: 16px !important;
|
color: #007aff;
|
}
|
|
.uni-panel-button {
|
|
border-radius: 12px;
|
margin: 5px 20px 16px;
|
background-color: #f3f9fa;
|
}
|
|
.uni-panel-icon {
|
margin-left: 8px;
|
color: #999999;
|
font-weight: normal;
|
transition-duration: 0s;
|
font-size: 15px;
|
transition-property: transform;
|
}
|
|
.uni-panel-icon-on {
|
transform: rotate(180deg);
|
}
|
|
.uni-panel-text {
|
flex: 1;
|
color: #000000;
|
text-align: left;
|
}
|
|
.uni-panel-text2 {
|
flex: 1;
|
color: #000000;
|
font-weight: normal;
|
text-align: right;
|
}
|
</style>
|