100 lines
2.5 KiB
Vue
100 lines
2.5 KiB
Vue
<template>
|
||
<view>
|
||
<uni-list>
|
||
<uni-list-item title="姓名" :rightText="userInfo.name"></uni-list-item>
|
||
<uni-list-item title="账户名" :rightText="userInfo.username"></uni-list-item>
|
||
<uni-list-item title="主部门" :rightText="userInfo.belong_dept_name"></uni-list-item>
|
||
<uni-list-item title="主岗位" :rightText="userInfo.post_name"></uni-list-item>
|
||
</uni-list>
|
||
<view style="height: 4rpx;"></view>
|
||
<view style="display: flex;">
|
||
<button size="mini" type="primary" @click="changePw">修改密码</button>
|
||
<button size="mini" type="warn" @click="logout">退出登录</button>
|
||
</view>
|
||
</view>
|
||
<view class="dialogWrap" v-if="dialogV">
|
||
<view class="dialogCont">
|
||
<view class="dialogTitle">
|
||
<view>修改密码</view>
|
||
<view @click="closeDialog">×</view>
|
||
</view>
|
||
<view style="height: 4rpx;"></view>
|
||
<view>
|
||
<uni-forms v-model="formData">
|
||
<uni-forms-item label="原密码" required>
|
||
<uni-easyinput type="password" v-model="formData.old_password"></uni-easyinput>
|
||
</uni-forms-item>
|
||
<uni-forms-item label="新密码" >
|
||
<uni-easyinput type="password" v-model="formData.new_password1"></uni-easyinput>
|
||
</uni-forms-item>
|
||
<uni-forms-item label="新密码/">
|
||
<uni-easyinput type="password" v-model="formData.new_password2"></uni-easyinput>
|
||
</uni-forms-item>
|
||
</uni-forms>
|
||
<view style="height: 4rpx;"></view>
|
||
<view style="text-align: center;">
|
||
<button size="mini" type="primary" @click="save">保存</button>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
data() {
|
||
return {
|
||
userInfo: {},
|
||
formData: {},
|
||
dialogV: false
|
||
}
|
||
},
|
||
mounted() {
|
||
this.initUserInfo()
|
||
},
|
||
methods: {
|
||
initUserInfo() {
|
||
let userInfo = uni.getStorageSync("userInfo")
|
||
this.userInfo = userInfo;
|
||
},
|
||
logout() {
|
||
// #ifdef APP-PLUS
|
||
try{uni.removeStorageSync("mySecret")}catch(e){};
|
||
// #endif
|
||
// #ifdef MP-WEIXIN
|
||
this.$api.unbindWxmp().then(res=>{});
|
||
// #endif
|
||
uni.removeStorageSync("access")
|
||
uni.reLaunch({
|
||
url: "/pages/auth/login"
|
||
})
|
||
|
||
},
|
||
changePw() {
|
||
this.form = {}
|
||
this.dialogV = true;
|
||
},
|
||
closeDialog() {
|
||
this.dialogV = false;
|
||
},
|
||
save() {
|
||
this.$api.changePw(this.formData).then(res=>{
|
||
uni.showToast({
|
||
title: '保存成功',
|
||
icon: 'none'
|
||
})
|
||
uni.reLaunch({
|
||
url: '/pages/auth/login?autoLoading=no'
|
||
})
|
||
})
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style>
|
||
.uni-forms-item {
|
||
margin-bottom: 8px;
|
||
}
|
||
</style>
|