<template>
|
<view class="mainContent">
|
<view class="headerAvatar">
|
<view class="">
|
<u-avatar :text="firstFont" fontSize="40" randomBgColor size='100'></u-avatar>
|
</view>
|
</view>
|
<view class="inforBox">
|
<u-cell-group>
|
<u-cell icon="server-man" title="姓名" :value="userInfor.userName"></u-cell>
|
<u-cell icon="account-fill" title="账号" :value="userInfor.account"></u-cell>
|
<u-cell icon="integral-fill" title="责任单位" :value="unitName"></u-cell>
|
<u-cell icon="phone-fill" title="手机号" :value="userInfor.mobile"></u-cell>
|
</u-cell-group>
|
</view>
|
<view class="bunts">
|
<u-button type="error" text="退出" @click="goOut"></u-button>
|
</view>
|
</view>
|
</template>
|
<script>
|
import {
|
created
|
} from '../../../uni_modules/uview-ui/libs/mixin/mixin'
|
export default {
|
data() {
|
return {
|
loading: false,
|
userInfor: {},
|
unitList: []
|
}
|
},
|
computed: {
|
unitName() {
|
let data = ''
|
if (this.unitList.length > 0) {
|
data = this.unitList.find(a => parseInt(a.unitId) === this.userInfor.unitId).unitName
|
}
|
return data || ''
|
},
|
firstFont() {
|
return this.userInfor.userName[0] || '七'
|
}
|
},
|
created() {
|
this.$http.httpGet('/allocation/unit').then(res => {
|
this.unitList = res.data
|
})
|
this.userInfor = this.$storage.getJson('userInfo')
|
console.log('userInfor', this.userInfor.userName[0])
|
},
|
methods: {
|
goOut() {
|
uni.showModal({
|
title: '退出',
|
content: '确认退出吗?',
|
success: res => {
|
if (res.confirm) {
|
this.$http.httpGet('/AppUser/wx/exit', {
|
userId: this.userInfor.userId
|
}).then(res => {
|
uni.clearStorageSync()
|
uni.reLaunch({
|
url: '/pages/login/login',
|
})
|
}).catch(uni.$u.toast('退出失败'))
|
}
|
}
|
})
|
}
|
}
|
}
|
</script>
|
<style lang="scss" scoped>
|
.mainContent {
|
padding: 20px;
|
}
|
|
.headerAvatar {
|
display: flex;
|
justify-content: center;
|
}
|
|
.inforBox {
|
margin-top: 57.69rpx;
|
}
|
|
.bunts {
|
margin-top: 57.69rpx;
|
}
|
</style>
|