You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

124 lines
2.7 KiB

<template>
<view class="personal">
<view class="txbox">
<image src="../../static/avatar.png" class="tx"></image>
<!-- <view class="text">admin</view> -->
</view>
<view>
<uni-list>
<!-- <uni-list-item title="工号" clickable @click="onClick" :rightText="usermsg.phoneNumber"></uni-list-item> -->
<uni-list-item title="姓名" clickable @click="onClick" :rightText="userName"
thumb="../../static/icon_personal_name.png"></uni-list-item>
<uni-list-item title="修改密码" link to="/pages/setter/passwordpage"
thumb="../../static/icon_personal_password.png"></uni-list-item>
<uni-list-item title="参数设置" link to="/pages/setter/setterDetail"
thumb="../../static/icon_personal_setting.png"></uni-list-item>
</uni-list>
</view>
<view>
<button class="footbtn" @click="handlerlogout">退出登录</button>
</view>
</view>
</template>
<script>
import {
getprofile,
logout
} from '@/api/index.js';
export default {
data() {
return {
userName: '',
usermsg: {}
}
},
created() {
this.userName = localStorage.getItem("userName");
//this.getprofile()
},
methods: {
getprofile() {
let params = {
userName: "admin",
isExternal: true,
hasPassword: true
}
getprofile(params).then((res) => {
console.log(res)
this.usermsg = res
})
},
handlerlogout() {
this.clearStorage();
uni.reLaunch({
url: '../login/index'
})
// logout().then((res) => {
// console.log(res)
// this.clearStorage();
// uni.reLaunch({
// url: '../login/index'
// })
// }).catch((err) => {
// console.log(err)
// uni.reLaunch({
// url: '../login/index'
// })
// })
},
clearStorage() {
// sessionStorage.setItem('isLogin', 0); //登录判断
// sessionStorage.setItem('hasLogin', false);
// localStorage.setItem("token_type", "")
// localStorage.setItem('userId', "");
// localStorage.setItem('userName', "");
// localStorage.setItem('company', ""); //
// localStorage.setItem('warehouseCode', "");
// localStorage.setItem('selectMenuIndex', "0");
localStorage.clear();
sessionStorage.clear();
},
}
}
</script>
<style>
.txbox {
display: flex;
flex-direction: column;
align-items: center;
}
.tx {
width: 200rpx;
height: 200rpx;
margin: 50rpx 0 50rpx;
border-radius: 150upx;
}
.text {
font-size: 20upx;
text-align: center;
}
.footbox {
display: flex;
align-items: center;
}
.footbtn {
margin-top: 120rpx;
width: 300rpx;
border-radius: 50rpx;
background-color: #fff;
font-size: .825rem;
color: #333;
line-height: 90rpx;
}
</style>