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.
 
 
 
 
 

98 lines
2.4 KiB

<style lang="scss">
.container{
.item{
display:flex;
min-height:80rpx;
align-items: center;
padding:20rpx 0;
margin:0 30rpx;
border-bottom:2rpx solid rgba(216, 216, 216, 0.2);
text{
&:first-child{
flex-shrink: 0;
color:#999;
margin-right:auto;
}
&:nth-child(2){
margin-left:20rpx;
}
&:nth-child(3){
flex-shrink: 0;
color:#999;
margin-left:30rpx;
}
}
}
}
</style>
<template>
<view class="container">
<view class="item">
<text>头像</text>
<u-image radius="5rpx" width="80rpx" height="80rpx" :src="`${host}/${$store.getters['userInfo'].avatar}`" mode="aspectFill" @click="reHeadImg">
<image slot="error" style="width:80rpx;height:80rpx" src="@/static/userHeader.png" mode="aspectFill"/>
</u-image>
</view>
<view class="item">
<text>所属企业</text> <text class="over">{{$store.getters['userInfo'].companyName}}</text>
</view>
<view class="item">
<text>系统账号</text> <text>{{$store.getters['userInfo'].username}}</text>
</view>
<view class="item">
<text>身份</text> <text>{{identity[$store.getters['userInfo'].roleCode]}}</text>
</view>
<view class="item" @click="$u.route({url:'pages/home/rePassword'})">
<text>修改密码</text> <text class="plant-youbian"/>
</view>
</view>
</template>
<script>
import request,{host} from '@/common/request'
export default{
data(){
return{
host:host('imgUrl'),
identity:{
admin:"管理员",
base_admin:"基地管理员",
company_admin:"企业管理员",
majingfu:"第三方登录",
third_role:"第三方登录角色",
}
}
},
methods:{
async reHeadImg(){
uni.chooseImage({
count:1,
success:async e=>{
if(/ok/.test(e.errMsg)){
var res=await request("/sys/common/upload",{
filePath:e.tempFiles[0].path,
body:{ biz: "temp" }
})
if(res.statu){
var userInfo=await request("/sys/user/editor",{
method:"post",
body:{
avatar:res.data,
id: this.$store.getters['userInfo'].id
}
})
if(userInfo.statu){
uni.showToast({title:"修改成功!",icon:"success"})
this.$store.commit("setHeadImg",res.data)
}else{
uni.showToast({title:"修改失败!",icon:"error"})
}
}else{
uni.showToast({title:"上传头像失败!",icon:"error"})
}
}
}
})
},
}
}
</script>