<template>
	<view class="box">
		<view class="exp">
			<u-radio-group v-model="radiovalue1" placement="column" @change="groupChange">
				<view class="item u-flex u-row-between" v-for="(item,idx) in radiolist1" v-if="idx<page" :key="idx">
					<text>{{item.name}}</text>
					<u-radio :name="item.name" @change="radioChange(item)">
					</u-radio>
				</view>
			</u-radio-group>
		</view>
		<view class="bottom">
			<view class="btn" @click="toteach">
				{{i18n.enter}}
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				concant: '',
				code: '',
				radiolist1: [],
				page: 20
			};
		},
		computed: {
			i18n() {
				return this.$t('index')
			}
		},
		onReachBottom() {
			if (this.page < this.radiolist1.length) {
				this.page += 20
			}
		},
		onLoad() {
			if (uni.getStorageSync('radiolist1')) {
				console.log(uni.getStorageSync('radiolist1'));
				this.radiolist1 = uni.getStorageSync('radiolist1')
			}
		},
		methods: {
			load(index) {
				console.log(index)
			},

			toteach() {
				const eventChannel = this.getOpenerEventChannel();
				eventChannel.emit('todcp', {
					'concant': this.concant,
					'code': this.code
				});
				uni.navigateBack()
			},
			groupChange(n) {
				console.log('groupChange', n);
			},
			radioChange(n) {
				this.concant = n.name
				this.code = n.code
			}
		}
	}
</script>

<style lang="scss" scoped>
	.box {
		padding: 20rpx 24rpx;
		box-sizing: border-box;

		.bottom {
			width: 750rpx;
			height: 166rpx;
			background: #FFFFFF;
			padding: 18rpx 32rpx;
			box-sizing: border-box;
			position: fixed;
			bottom: 0;
			left: 0;

			.btn {
				width: 686rpx;
				height: 88rpx;
				background: #F83224;
				border-radius: 44rpx;
				font-family: PingFangSC, PingFang SC;
				font-weight: 500;
				font-size: 32rpx;
				color: #FFFFFF;
				line-height: 88rpx;
				text-align: center;
				font-style: normal;
			}
		}

		.item {
			width: 654rpx;
			height: 112rpx;
			border-bottom: 2rpx solid rgba(151, 151, 151, 0.1);
		}

		.exp {
			width: 702rpx;
			// height: 564rpx;
			background: #FFFFFF;
			border-radius: 16rpx;
			padding: 0 20rpx;
		}
	}
</style>