<template>
	<view class="info">
		<view class="base_info">
			<view class="base_info_con">
				<view class="title flexS">
					<text class="iconfont icongeren2" style="font-size: 45rpx;color: #ea4a42;margin-right: 10rpx;"></text>
					<text>报名信息</text>
				</view>
				<view class="info_fixed">
					<view>
						<view class="label">姓名：</view>
						<view class="label_con">{{ userInfo.nickname || '' }}</view>
					</view>
					<view>
						<view class="label">手机号：</view>
						<view class="label_con">{{ userInfo.phone || '' }}</view>
					</view>
					<view>
						<view class="label">代理等级：</view>
						<view class="label_con">{{ userInfo.level || '' }}</view>
					</view>
					<view>
						<view class="label">性别：</view>
						<view class="label_con">{{ signedInfo.sex ? '女' : '男' }}</view>
					</view>
					<view>
						<view class="label">身份证号：</view>
						<view class="label_con">{{ signedInfo.id_code || '' }}</view>
					</view>
					<view>
						<view class="label">来自哪里：</view>
						<view class="label_con">{{ signedInfo.province || '' }}-{{ signedInfo.city || '' }}-{{ signedInfo.area || '' }}</view>
					</view>
					<view>
						<view class="label">详细地址：</view>
						<view class="label_con">{{ signedInfo.detail || '' }}</view>
					</view>
					<view>
						<view class="label">参加次数：</view>
						<view class="label_con">{{ (userInfo.type ? signedInfo.join_two_num : signedInfo.join_one_num) || 0 }}</view>
					</view>
				</view>
				<view class="dynamic_info">
					<view class="info_con" v-for="item in formData" :key="item.id">
						<view class="label">{{ item.form_name }}</view>
						<radio-group v-if="item.style == 1">
							<label v-for="(temp, index) in item.form_value" :key="index">
								<view class="radio_con">
									<radio :value="item.value" checked="item.value" disabled></radio>
									<text>{{ item.form_value[index] }}</text>
								</view>
							</label>
						</radio-group>
						<checkbox-group v-if="item.style == 2">
							<label v-for="(temp, index) in item.form_value" :key="index">
								<view class="check_con">
									<checkbox :value="item.value" checked="item.value" disabled />
									<text>{{ item.form_value[index] }}</text>
								</view>
							</label>
						</checkbox-group>
						<view class="label_con" v-if="item.style == 3"><textarea v-model="item.value" disabled auto-height :class="brand ? 'textareaIp' : ''" /></view>
						<view v-if="item.style == 4">
							<view class="label_con flexS address">
								<text class="iconfont icondizhi"></text>
								<text>{{ item.value[0] }} {{ item.value[1] }} {{ item.value[2] }}</text>
							</view>
							<view class="label">详细地址</view>
							<view class="label_con flexS">
								<text class="iconfont icondizhi"></text>
								<textarea v-model="item.value[3]" disabled auto-height :class="brand ? 'textareaIp' : ''" />
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import { lookForm, userSignUpInfo } from '../../api/sign.js';
export default {
	data() {
		return {
			formData: [],
			userInfo: {},
			signedInfo: {}
		};
	},
	onShow() {
		this.lookForm();
		this.getSystem();
		this.getFormSignedInfo()
		this.userInfo = uni.getStorageSync('userInfo');
	},
	methods: {
		getFormSignedInfo() {
			userSignUpInfo().then(res => {
				if(res.code === 200) {
					this.signedInfo = res.data
				}
			})
		},
		//获取手机版本动态设置textarea的padinng值 解决安卓机跟ios的textarea的高度不一致
		getSystem() {
			uni.getSystemInfo({
				success: res => {
					if (res.brand == 'iPhone') {
						this.brand = true;
					}
				}
			});
		},
		lookForm() {
			lookForm().then(res => {
				if (res.code == 200) {
					this.formData = res.data.list;
				} else {
					uni.showModal({
						content: res.message || '请求失败',
						showCancel: false
					});
				}
			});
		}
	}
};
</script>
<style>
page {
	width: 100%;
	height: 100%;
	background-color: #fff;
}
</style>
<style lang="scss">
.label {
	font-size: 28rpx;
	margin: 20rpx 0;
}
.label_con {
	font-size: 32rpx;
	font-weight: 600;
	padding-bottom: 15rpx;
	.iconfont {
		margin-right: 10rpx;
		flex-shrink: 0;
	}
}
.textareaIp {
	padding: 0;
}
textarea {
	font-size: 32rpx;
	font-weight: 600;
	padding: 10rpx 0;
}
.address {
	border-bottom: 1rpx solid #f5f5f5;
}
.info {
	padding-bottom: 82rpx;
	.base_info {
		width: 100%;
		background-color: #fff;
		.title {
			padding: 15rpx 0;
			text {
				font-size: 36rpx;
				font-weight: 600;
			}
			image {
				height: 40rpx;
				width: 40rpx;
				margin-right: 20rpx;
			}
		}
		.base_info_con {
			width: 90%;
			margin: 0 auto;
		}
	}
	.base_info {
		.base_info_con {
			.info_fixed {
				color: #333;
				> view {
					border-bottom: 1rpx solid #f5f5f5;
				}
			}
			.info_con {
				border-bottom: 1rpx solid #f5f5f5;
				.check_con,
				.radio_con {
					width: 100%;
					display: flex;
					justify-content: flex-start;
					align-items: center;
					padding-bottom: 15rpx;
					text {
						font-size: 32rpx;
						font-weight: 600;
						margin-left: 20rpx;
					}
				}
				.radio_con {
					radio .wx-radio-input {
						border-radius: 50%;
						border: 2rpx solid #999;
						background: transparent !important;
						width: 40rpx;
						height: 40rpx;
					}
					radio .wx-radio-input.wx-radio-input-checked::before {
						border-radius: 100%;
						width: 60%;
						height: 60%;
						content: '';
						background-color: #ea4a42;
						transform: translate(-50%, -50%) scale(1);
						-webkit-transform: translate(-50%, -50%) scale(1);
					}
					radio .wx-radio-input.wx-radio-input-checked {
						border-color: #ea4a42;
					}
				}
				.check_con {
					checkbox .wx-checkbox-input {
						border: 2rpx solid #999;
						background: transparent !important;
						width: 40rpx;
						height: 40rpx;
					}
					checkbox .wx-checkbox-input.wx-checkbox-input-checked {
						border-color: #ea4a42;
					}
					checkbox .wx-checkbox-input.wx-checkbox-input-checked::before {
						width: 60%;
						height: 60%;
						background: #ea4a42;
						content: '';
						transform: translate(-50%, -50%) scale(1);
						-webkit-transform: translate(-50%, -50%) scale(1);
					}
				}
			}
		}
	}
}
</style>
