<template>
	<view>
		<view class="uni-list">
			<view class="uni-list-cell">
			<view class="uni-list-cell-left">
					姓名<text>*</text>
			</view>
			<view class="uni-list-cell-db" @click="getStudentInformation()">
				<view class="uni-input">{{name}}</view> 
			</view>
			</view>
		</view>
			<view class="uni-list">
				<view class="uni-list-cell">
					<view class="uni-list-cell-left">
							性别<text>*</text>
					</view>
					<view class="uni-list-cell-db" @click="getStudentInformation()">
						<!-- <picker @change="bindPickerChange" :value="index" :range="array"> -->
							<view class="uni-input">{{studentSex}}</view>   <!-- <image src="../../static/右箭头.svg" mode=""> -->
						<!-- </picker> -->
					</view>
				</view>
			</view>
				<view class="uni-list">
					<view class="uni-list-cell">
						<view class="uni-list-cell-left">
							手机号<text>*</text>
						</view>
						<view class="uni-list-cell-db">
							<!-- <picker @change="bindPickerChange" :value="index" :range="array"> -->
								<view class="uni-input">{{studentPhone}}</view>   <!-- <image src="../../static/右箭头.svg" mode=""> -->
							<!-- </picker> -->
						</view>
					</view>
				</view>
				
				<view class="uni-list">
					<view class="uni-list-cell">
						<view class="uni-list-cell-left">
							备选手机号<text>*</text>
						</view>
						<view class="uni-list-cell-db">
								<view class="uni-input">{{studentOtherPhone}}</view>    <!-- <image src="../../static/右箭头.svg" mode=""> -->
						</view>
					</view>
				</view>
				
				<view class="uni-list">
				       <view class="cuni-list-cell">
				             <view class="uni-list-cell-left">
								 学生宿舍<text>*</text>
							 </view> 
			                  <view class="uni-list-cell-db">
				                   	<view class="uni-input"><!-- {{multiArray[0][multiIndex[0]]}}{{multiArray[1][multiIndex[1]]}}{{multiArray[2][multiIndex[2]]}} -->
				                  {{studentDormitory}}
								   <!-- <image src="../../static/右箭头.svg" mode=""> -->
				                   	</view>
				                 </view>
				         </view>
			      </view>
				
				<view class="uni-list">
					<view class="uni-list-cell">
						<view class="uni-list-cell-left">
							学生校区<text>*</text>
						</view>
						<view class="uni-list-cell-db">
							<!-- <picker @change="bindPickerChange" :value="index" :range="array"> -->
								<view class="uni-input">{{school[index]}}</view>   <!-- <image src="../../static/右箭头.svg" mode=""> -->
							<!-- </picker> -->
						</view>
					</view>
				</view>
				<button @click="getInformation()" type="default" style="position: absolute;top:345px;left: 24px;width: 328px;height: 47px;color: white;background-color:  rgba(42, 130, 228, 1);">确认</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				name:'',
				studentSex:'',
				studentPhone:'',
				studentOtherPhone:'',
				studentDormitory:'',
				school:['黄家湖','墨轩湖'],
				index:0,
				homeUrl:"https://jtishfw.ncjti.edu.cn/baoxiu/repairApi"
			}
		},
		onLoad() {
			this.getStudentInformation()
		},
		methods: {
		getStudentInformation(){
			let that = this;
			uni.getStorage({
			    key: 'student',
			    success: function (result) {
			        console.log('这是获取key中的内容',result)
					console.log(result.data.studentName)
					that.name = result.data.studentName
					console.log(result.data.studentSex)
					that.studentSex = result.data.studentSex
					console.log(that.studentSex)
					if(that.studentSex == 0){
						that.studentSex = '男'
					}else{
						that.studentSex = '女'
					}
					that.studentPhone = result.data.studentPhone
					that.studentOtherPhone = result.data.studentOtherPhone
					that.studentDormitory = result.data.studentDormitory
			    }
			})
			  that.name = that.name
			  that.studentSex = that.studentSex
			  that.studentPhone = that.studentPhone
			  that.studentOtherPhone = that.studentOtherPhone
			  that.studentDormitory = that.studentDormitory
		},
		  bindPickerChange: function(e) {
			    console.log('picker发送选择改变，携带值为', e.target.value)
			    this.index = e.target.value
		},
		async getInformation(){
			this.$https.post(`${this.homeUrl}/student/queryByID`)
			.then(result=>{
				console.log(result.data)
				uni.reLaunch({
					url:'../index/index'
				})
			},err=>{})
			
		},
		}
	}
</script>

<style>
.uni-list-cell-left{
	float: left;
	width: 22%;
	height: 47px;
	text-align: center;
	font-size: 14px;
	border-bottom: 1px solid rgba(200, 200, 205, 1);
	line-height: 47px;
}
.uni-list-cell-left text{
	color: red;
}
.uni-list-cell-db{
	float: right;
	width: 78%;
	height: 47px;
	border-bottom: 1px solid rgba(200, 200, 205, 1);
}
.uni-list-cell-db .name{
	float: right;
}
.uni-list{
	position: relative;
	font-size: 14px;
}
.uni-list-cell-db input{
	height: 47px;
    width: 78%;
	text-align: center;
	line-height: 47px;
	font-size: 14px;
}
.uni-list-cell-db .uni-input{
	float: right;
	margin-right: 36px;
	text-align: center;
	line-height: 47px;
}

.uni-list-cell-db uni-image{
	position: absolute;
	width: 26px;
	height: 26px;
	right: 3px;
	top:11px;
}
button{
	position: absolute;
	top:345px;
	left: 24px;
	width: 328px;
	height: 47px;
	color: white;
}
</style>
