<template>
	<view>
		<view class="chance u-f">
			当前剩余<view class="num">'{{num}}'</view>次修改信息的机会
		</view>
		<picker :range="address" @change="provinceChange">
			<view class="u-s">
				<input type="text" v-model="addre"/><view class="icon iconfont icon-down-fill"></view>
		    </view>
		</picker>
		<picker :range="subject" @change="subjectChange"> 
			<view class="u-s">
				<input type="text" v-model="sub"/><view class="icon iconfont icon-down-fill"></view>
		    </view>
		</picker>
		<view class="u-s">
			<input type="text" v-model="sco" /><view class="icon1">分数</view>
		</view>
		<view class="u-s">
			<input type="text" v-model="number"/><view class="icon1">位次</view>
		</view>
		<input type="text" value="确定" class="btn" @tap="goIndex"/>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				"num":getApp().globalData.global_num,
				"address":["山东","北京"],
				"addre":getApp().globalData.global_addre,
				"sco":getApp().globalData.global_sco,
				"subject":["文科","理科"],
				"sub":getApp().globalData.global_sub,
				"number":"1000"
			}
		},
		methods: {
			subjectChange(e){
				let m=e.detail.value;
				getApp().globalData.global_sub=this.subject[m];
				this.sub=getApp().globalData.global_sub
			},
			provinceChange(e){
				let m=e.detail.value;
				getApp().globalData.global_addre=this.address[m];
				this.addre=getApp().globalData.global_addre;
			},
			goIndex(){
				if(this.num>0){
					uni.navigateBack({
					delta:1, 
					});
				    getApp().globalData.global_num--;
					this.num=getApp().globalData.global_num;
					getApp().globalData.global_sco=this.sco;	
				}else{
					uni.showToast({
						"title":"超过最大修改次数了",
						"icon":"none"
					})
				}	
			}
		}
	}
</script>

<style scoped>
.u-f{
	display: flex;
	justify-content: center;
	align-items: center;
}
.u-s{
	display: flex;
	justify-content: space-between;
	align-items: center;
}
.chance{
	margin-top: 70upx;
	margin-bottom: 30upx;
	font-size: 35upx;
	color: #999999;
}
.chance .num{
	color: #DD524D;
}
input{
	width: 80%;
	height: 100upx;
	margin: 15upx auto;
	background:#E7E7E7;
	border-radius: 35upx;
	position: relative;
	padding-left: 40upx;
}
.icon , .icon1{
	position: absolute;
	right: 100upx;
	color: #999999;
	font-size: 20upx;
}
.btn{
	background: #FF0000;
	color: white;
	text-align: center;
}
.icon1{
	font-size: 30upx;
}
</style>
