<template>
	<RefreshView ref="mescrollRef" text="报名必填项" :useDownScroll="false" :useUpScroll="false" :useTitleLeftBtn="1" titleLeftBtnSource="保存" @leftBtn='save'>
		<view class="row">
			<text class="field">真实姓名</text>
			<checkbox class="checkbox" :checked="data.onRealName"  @click="checkboxChange('onRealName')"> </checkbox>
		</view>
		<view class="line-thin"></view>
		<view class="row">
			<text class="field">性别</text>
			<checkbox-group class="item_check" >
				<checkbox class="checkbox" :checked="data.onSex"  @click="checkboxChange('onSex')"></checkbox>
			</checkbox-group>
		</view>
		<view class="line-thin"></view>
		<view class="row">
			<text class="field">生日</text>
			<checkbox class="checkbox" :checked="data.onBirthday" @click="checkboxChange('onBirthday')"></checkbox>
		</view>
		<view class="line-thin"></view>
		<view class="row">
			<text class="field">地区</text>
			<checkbox class="checkbox" :checked="data.onAdCode" @click="checkboxChange('onAdCode')"></checkbox>
		</view>
	</RefreshView>
</template>
<script>
	export default {
		data() {
			return {
				data:{
					onRealName:true,
					onSex:true,
					onBirthday:true,
					onAdCode:false
				}
			}
		},
		onLoad(options){
			this.data.onRealName = options.onRealName == 1?true:false
			this.data.onSex = options.onSex == 1?true:false
			this.data.onBirthday = options.onBirthday == 1?true:false
			this.data.onAdCode = options.onAdCode == 1?true:false
		},
		methods: {
			checkboxChange(index) {
				let _this = this
				if ( index == "onRealName" ){
					this.data.onRealName = !this.data.onRealName
				}
				if ( index == "onSex"){
					this.data.onSex = !this.data.onSex
				} 
				if ( index == "onBirthday"){
					this.data.onBirthday = !this.data.onBirthday
				}
				if ( index == "onAdCode"){
					this.data.onAdCode = !this.data.onAdCode
				}
			},
			save(){
				console.log("报名必填项",this.data)
				this.data.onRealName = this.data.onRealName == true?1:0
				this.data.onSex = this.data.onSex == true?1:0
				this.data.onBirthday = this.data.onBirthday == true?1:0
				this.data.onAdCode = this.data.onAdCode == true?1:0
				this.SetResult(this.data)
				// let _this = this
				// _this.HTTP({
				// 	url: 'aos/v1/enrollRequired/saveEnrollRequired',
				// 	method: 'POST',
				// 	data: _this.data,
				// 	paramsType: "JSON",
				// 	loading: true
				// })
				// .then((res) => {
					
				// 	uni.navigateBack({
				// 		delta: 1
				// 	})
				// });	
			}

		}
	}
</script>

<style lang="scss">
	@import url("../../static/master.css");
</style>
