<template>
	<view class="top_user">
		<view class="user_img">
			<view class="user_img1">
				<uv-avatar fontSize="20" size = 70  randomBgColor :text=userInfo.userInfo.nickname[0]>
					
				</uv-avatar>
			</view>
			<view class="user_text">
				<view class="user_text1">
					{{userInfo.userInfo.nickname}}
				</view>
				<view class="user_text2">
					<text style="float: left;">账号：{{userInfo.userInfo.username}}</text> 
					<view class="user_sf">{{sf[userInfo.userInfo.group]}}</view>
				</view>
			</view>
		</view>
		<uv-cell-group>
			<view  @click="set">
				<uv-cell  size="large" icon="setting-fill" title="账号设置" :isLink="true"></uv-cell>
			</view>
			<view @click="quit">
				<uv-cell size="large"  icon="warning-fill" title="账号退出"  :isLink="true"></uv-cell>
			</view>
			</uv-cell-group>
	</view>

</template>

<script setup>

	let userInfo =wx.getStorageSync('userInfos')
	const sf =['','超级管理员','实验室管理员','学院领导','教师',]
	console.log(userInfo)
	// 进详情页
	function set(){
		wx.navigateTo({
			url:'/pages/user/set'
		})
	}
	// 账号退出
	function quit(){
		wx.removeStorage({
		  key: 'userInfos',
		  success () {
			  wx.showLoading({
			    title: '退出中',
			  })
			  setTimeout(function () {
			    wx.reLaunch({
			    	url:'/pages/login/index'
			    })
			  }, 1000)
		  }
		})
	}
	
</script>


<style lang="less">
page{
	background-color:  rgb(244,245,249);
}
.user_img{
	margin-left: 30rpx;
	// height: 200rpx;
	
}
.user_img1{
	float: left;
}
	
.top_user{
	width: 100%;
	background-color: #fff;
	padding-top: 30rpx;
}
.user_text{
	padding-left: 90px;
	height: 90px;
	
}
.user_text1{
	margin-bottom: 20rpx;
	font-size: 40rpx;
}
.user_text2{
	color: #808695;
}
.user_sf{
	margin-left: 20rpx;
	background-color: #5cadff;
	color: #fff;
	border-radius: 2rpx;
	height: 42rpx;
	line-height: 42rpx;
	font-size: 20rpx;
	float: left;
	padding:  0 20rpx;
	border-radius: 30rpx;
}
</style>
