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.
242 lines
5.0 KiB
242 lines
5.0 KiB
<template> |
|
<view class="page"> |
|
<view class="status-bar"></view> |
|
<image class="bg" src="@/static/image/person-bg.png"></image> |
|
<view class="wrap"> |
|
<view class="info"> |
|
<image class="avatar" :src="info.avatar" mode=""></image> |
|
<view class="text"> |
|
<view class="name">{{ info.userName }}</view> |
|
<view class="dep-wrap"> |
|
<view class="dep">{{ info.schoolName }}</view> |
|
<view class="tag">当前组织</view> |
|
</view> |
|
</view> |
|
</view> |
|
<view class="list"> |
|
<view class="item" @click="$util.to('/user/info/info')"> |
|
<view class="left"> |
|
<image class="icon" src="@/static/image/person4.png" mode=""></image> |
|
<text class="name">我的资料</text> |
|
</view> |
|
<uni-icons type="right" size="15" color="#ccc"></uni-icons> |
|
</view> |
|
<view class="item" @click="$util.to('/user/switchAccount/switchAccount')"> |
|
<view class="left"> |
|
<image class="icon" src="@/static/image/person4.png" mode=""></image> |
|
<text class="name">切换账号</text> |
|
</view> |
|
<uni-icons type="right" size="15" color="#ccc"></uni-icons> |
|
</view> |
|
<view class="item" @click="logout"> |
|
<view class="left"> |
|
<image class="icon" src="@/static/image/person3.png" mode=""></image> |
|
<text class="name">退出登录</text> |
|
</view> |
|
</view> |
|
</view> |
|
</view> |
|
|
|
<uni-popup ref="logout"> |
|
<view class="logout-wrap"> |
|
<view class="tips">退出当前账号?</view> |
|
<view class="user"> |
|
<image class="avatar" :src="info.avatar" mode=""></image> |
|
<view class="text"> |
|
<view class="name">{{ info.userName }}</view> |
|
<view class="dep">{{ info.schoolName }}</view> |
|
</view> |
|
</view> |
|
<view class="btns"> |
|
<view class="btn" @click="$refs.logout.close()">取消</view> |
|
<view class="btn" @click="logoutSubmit">确认</view> |
|
</view> |
|
</view> |
|
</uni-popup> |
|
|
|
<realName /> |
|
</view> |
|
</template> |
|
|
|
<script> |
|
import { queryUserInfoDetails, updateAvatars } from '@/apis/modules/user.js' |
|
import OSS from '@/libs/Oss/upload' |
|
export default { |
|
data() { |
|
return { |
|
info: { |
|
avatar: '', |
|
userName: '', |
|
schoolName: '' |
|
}, |
|
avatar: uni.getStorageSync('avatar') || '@/static/image/avatar.png', |
|
userName: uni.getStorageSync('userName'), |
|
} |
|
}, |
|
onShow() { |
|
this.getInfo() |
|
}, |
|
methods: { |
|
// 获取个人信息 |
|
async getInfo() { |
|
const res = await queryUserInfoDetails() |
|
const r = res.result.hrUserInfo |
|
this.info = { |
|
avatar: r.userAvatars || 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png', |
|
userName: r.userName || 'tourist', |
|
schoolName: r.schoolName || '' |
|
} |
|
}, |
|
// 退出登录 |
|
logout() { |
|
this.$refs.logout.open() |
|
return |
|
const that = this |
|
uni.showModal({ |
|
title: '提示', |
|
content: '确定要退出账号吗?', |
|
success(res) { |
|
if (res.confirm) { |
|
that.logoutSubmit() |
|
} |
|
} |
|
}) |
|
}, |
|
logoutSubmit() { |
|
uni.clearStorageSync() |
|
uni.reLaunch({ |
|
url: '/pages/login/login' |
|
}) |
|
}, |
|
} |
|
} |
|
</script> |
|
|
|
<style scoped lang="scss"> |
|
.status-bar { |
|
// width: 100%; |
|
// height: calc(var(--status-bar-height) + 120rpx); |
|
} |
|
.bg { |
|
width: 100%; |
|
height: calc(var(--status-bar-height) + 250rpx); |
|
// #ifdef MP-WEIXIN |
|
height: calc(var(--status-bar-height) + 317rpx); |
|
// #endif |
|
} |
|
.wrap { |
|
position: relative; |
|
padding: 0 24rpx; |
|
margin-top: -150rpx; |
|
} |
|
.info { |
|
display: flex; |
|
align-items: center; |
|
padding: 26rpx 34rpx; |
|
background-color: #fff; |
|
border-radius: 16rpx; |
|
.avatar { |
|
width: 120rpx; |
|
height: 120rpx; |
|
margin-right: 30rpx; |
|
border: 0; |
|
border-radius: 50%; |
|
} |
|
.text { |
|
margin-right: 20rpx; |
|
} |
|
.name { |
|
margin-bottom: 10rpx; |
|
font-size: 40rpx; |
|
color: #333; |
|
} |
|
.dep-wrap { |
|
display: flex; |
|
align-items: center; |
|
} |
|
.dep { |
|
max-width: 350rpx; |
|
font-size: 28rpx; |
|
color: #333; |
|
} |
|
.tag { |
|
padding: 8rpx 16rpx; |
|
margin-left: 10rpx; |
|
font-size: 24rpx; |
|
color: #333; |
|
white-space: nowrap; |
|
border-radius: 20px; |
|
border: 1px solid #ccc; |
|
} |
|
} |
|
.list { |
|
margin-top: 16rpx; |
|
.item { |
|
display: flex; |
|
justify-content: space-between; |
|
align-items: center; |
|
padding: 26rpx 28rpx; |
|
margin-bottom: 16rpx; |
|
background-color: #fff; |
|
border-radius: 16rpx; |
|
} |
|
.left { |
|
display: inline-flex; |
|
align-items: center; |
|
} |
|
.icon { |
|
width: 40rpx; |
|
height: 40rpx; |
|
margin-right: 16rpx; |
|
} |
|
text { |
|
font-size: 28rpx; |
|
color: #333; |
|
} |
|
} |
|
|
|
.logout-wrap { |
|
width: 520rpx; |
|
padding-top: 30rpx; |
|
background-color: #fff; |
|
border-radius: 20rpx; |
|
.user { |
|
display: flex; |
|
justify-content: center; |
|
align-items: center; |
|
padding: 30rpx 20rpx; |
|
.avatar { |
|
width: 60rpx; |
|
height: 60rpx; |
|
margin-right: 20rpx; |
|
border-radius: 50%; |
|
} |
|
.name { |
|
font-size: 24rpx; |
|
} |
|
.dep { |
|
max-width: 500rpx; |
|
font-size: 24rpx; |
|
} |
|
} |
|
.tips { |
|
font-size: 32rpx; |
|
text-align: center; |
|
} |
|
|
|
.btns { |
|
display: flex; |
|
text-align: center; |
|
border-top: 1px solid #eee; |
|
.btn { |
|
flex: 1; |
|
padding: 16rpx; |
|
font-size: 24rpx; |
|
color: #007EFF; |
|
&:first-child { |
|
border-right: 1px solid #eee; |
|
} |
|
} |
|
} |
|
} |
|
</style>
|
|
|