<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>
		<view class="set_zhsz">
			<uni-forms ref="baseForm" :modelValue="baseFormData">
				<uni-forms-item label="密码" >
					<uni-easyinput v-model="password" placeholder="请填写需要修改的密码" />
				</uni-forms-item>
			</uni-forms>
		</view>
		<view class="set_tijiao">
			<button style="background-color:#2d8cf0;" type="primary" @click="submit()">提交</button>
		</view>
	</view>
</template>
 
<script setup>
	import { ref } from "vue";
	import { toRaw } from '@vue/reactivity';
	import { requestApi } from '@/api/request.js';
	let userInfo =wx.getStorageSync('userInfos')
	let password = ref('')
	const sf =['','超级管理员','实验室管理员','学院领导','教师',]
	
	const submit = () => {
		wx.showLoading({
		  title: '加载中',
		})
		console.log(password)
	     const d = requestApi(
	     	'/admin/borrow.BorrowApp/editPassword?server=1',
	     	{data : toRaw(password)},
	     	'POST'
	     ).then(d => {
	     	if(d.code === 1){
	     		wx.navigateBack({
	     			delta:1
	     		})
	     	}else{
	     		toast('	提交失败！！')
	     	}
	     	wx.hideLoading()
	     })
	}
	
 
</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;
	}
	.set_zhsz{
		width: 94%;
		margin: 20rpx auto;
	}
	.set_tijiao{
		width: 50%;
		margin: 0 auto;
		padding-bottom: 30rpx;
	}
</style>