<template>
	<view class="content">
		<view v-if="baseData != ''">
			<view class="top" :class="{active : type}">
				<view class="base">
					<view class="white">
						<view class="base-title">
							<view class="base-name">
								基本信息
							</view>
						</view>
						<view class="base-list">
							<view class="base-block">
								<view class="base-block-name">
									<text>*</text>姓名
								</view>
								<view class="base-block-write prohibit">
									{{baseData.name}}
								</view>
							</view>
							<view class="base-block">
								<view class="base-block-name">
									<text>*</text>性别
								</view>
								<view class="base-block-write prohibit">
									{{baseData.sex}}
								</view>
							</view>
							<view class="base-block">
								<view class="base-block-name">
									<text>*</text>年龄
								</view>
								<view class="base-block-write prohibit">
									{{baseData.age}}
								</view>
							</view>
							<view class="base-block">
								<view class="base-block-name">
									<text>*</text>属相
								</view>
								<view class="base-block-write prohibit">
									{{baseData.zodiak}}
								</view>
							</view>
							<view class="base-block baseAline">
								<view class="base-block-name">
									<text>*</text>身份证号
								</view>
								<view class="base-block-write prohibit">
									{{baseData.id_card}}
								</view>
							</view>
							<view class="base-block baseAline">
								<view class="base-block-name">
									<text>*</text>身份证地址
								</view>
								<view class="base-block-write prohibit">
									{{baseData.address}}
								</view>
							</view>
							<view class="base-block">
								<view class="base-block-name">
									<text>*</text>婚姻
								</view>
								<view class="base-block-write prohibit">
									{{marriage}}
								</view>
							</view>
							<view class="base-block" v-if="baseData.mate">
								<view class="base-block-name">
									<text>*</text>配偶
								</view>
								<view class="base-block-write prohibit">
									{{baseData.mate}}
								</view>
							</view>
							<view class="base-block">
								<view class="base-block-name">
									<text>*</text>学历
								</view>
								<view class="base-block-write prohibit">
									{{education}}
								</view>
							</view>
							<view class="base-block  baseAline">
								<view class="base-block-name">
									<text>*</text>毕业学院
								</view>
								<view class="base-block-write prohibit">
									{{baseData.school}}
								</view>
							</view>
							<view class="base-block baseAline">
								<view class="base-block-name">
									<text>*</text>联系电话
								</view>
								<view class="base-block-write prohibit">
									{{baseData.mobile}}
								</view>
							</view>
							<view class="base-block baseAline">
								<view class="base-block-name">
									<text>*</text>联系地址
								</view>
								<view class="base-block-textarea">
									{{baseData.contact_address}}
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
			<view class="introduce-btn" v-if="type">
				<button class="btn" size="mini" :disabled="disabled" @click="infoSubmit">提交审核</button>
			</view>
		</view>
		<view class="pack-center pages-hint" v-else>
		    <image src="/static/imgs/Noevaluate.png"></image>
		    <view>暂无数据</view>
		</view>
	</view>
</template>

<script>
	import { BaseSee, BaseFirst } from '@/apis/interfaces/user'
	export default {
		data() {
			return {
				disabled	: false, // 按钮状态
				baseData	: '', // 基础信息
				education	: '', // 学历
				marriage    : '', // 婚姻
				type		: '',
			}
		},
		onShow() {
			// 获取基础信息
			this.baseInfo();
			this.type = this.$Route.query.type
		},
		methods: {
			// 基础信息
			baseInfo() {
				BaseSee().then(res => {
					this.baseData  = res
					if(res != ''){
						this.education      = res.educations[res.education]
						this.marriage       = res.marriages[res.marriage]
					}
				}).catch( err => {
					uni.showToast({
						title: err.message,
						icon: "none"
					})
				})
			},
			
			// 首次信息
			infoSubmit() {
				BaseFirst(this.$Route.query.userId, this.$Route.query.baseId).then(res => {
					this.disabled = true
					uni.showToast({
						title: res,
						icon: "none"
					})
					setTimeout(() => {
						uni.navigateBack({
							delta: 1
						})
						uni.hideLoading() 
					}, 1500)
				}).catch( err => {
					uni.showToast({
						title: err.message,
						icon: "none"
					})
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.top {
		background-color: #f5f5f5;
		color: #ffffff;
		position: relative;
		height: 100vh;
		overflow-y: scroll;
		&.active {
			border-bottom: 140rpx solid transparent;
		}
		&::after {
			content: '';
			position: absolute;
			background-color: $mian-color;
			border-radius: 0 0 $radius*5 $radius*5;
			width: 100%;
			height: 260rpx;
			left: 0;
			top: 0;
		}
		.base {
			position: absolute;
			z-index: 9;
			padding: $padding + 20 $padding;
			box-sizing: border-box;
			.white {
				padding: $padding $padding 0;
				box-sizing: border-box;
				background-color: #ffffff;
				border-radius: $radius-m;
				overflow: hidden;
				.base-title {
					display: flex;
					line-height: 38rpx;
					.base-name {
						flex: 1;
						color: $mian-color;
						font-weight: 600;
						font-size: $title-size + 2;
					}
					.base-number {
						color: #999999;
						font-size: $title-size-m;
					}
				}
				.base-list {
					margin: 40rpx -10rpx 0;
					overflow: hidden;
					.base-block {
						width: calc(50% - 20rpx);
						margin: 0 10rpx $margin + 10;
						float: left;
						.base-block-name {
							margin-bottom: $margin - 10;
							color: #111111;
							text {
								color: $mian-color;
								padding-right: 10rpx;
							}
						}
						.base-block-textarea {
							background-color: #F6F6F6;
							border-radius: $radius-sm;
							padding: $padding;
							font-size: $title-size-lg;
							color: #999999;
						}
						.base-block-write {
							background-color: #F6F6F6;
							border-radius: $radius-sm;
							padding: $padding - 10 $padding;
							box-sizing: border-box;
							position: relative;
							display: flex;
							color: #111111;
							font-size: $title-size-lg;
							line-height: 48rpx;
							&.prohibit {
								color: #999999;
							}
							.idcardAdd-picker {
								width: 100%;
								height: 100%;
							}
							.base-block-input {
								width: 100%;
								height: 100%;
								font-size: $title-size-lg;
							}
							.base-block-textarea {
								padding: $padding 0;
							}
							.placeholderClass {
							   color: #999999;
							}
							image {
								width: 24rpx;
								height: 24rpx;
								position: absolute;
								top: $margin;
								right: $margin;
							}
						}
						.base-block-site {
							display: flex;
							margin: 0 -5rpx;
							.base-site-white {
								background-color: #F6F6F6;
								border-radius: $radius-sm;
								flex: 3;
								color: #111111;
								font-size: $title-size-lg;
								height: 84rpx;
								line-height: 84rpx;
								padding: 0 $padding - 10 0 $padding;
								box-sizing: border-box;
								position: relative;
								margin: 0 5rpx;
								width: 100%;
								.picker {
									width: calc(100% - 30rpx)
								}
								image {
									width: 24rpx;
									height: 24rpx;
									position: absolute;
									top: $margin;
									right: 0;
								}
							}
						}
					}
					.baseAline {
						width: calc(100% - 20rpx);
					}
				}
			}
		}
	}
	
	.introduce-btn {
		position: fixed;
		width: 100%;
		left: 0;
		bottom: 0;
		background-color: #f5f5f5;
		text-align: center;
		padding: $padding;
		box-sizing: border-box;
		z-index: 2000;
		.btn {
			background-color: $mian-color;
			color: #ffffff;
			border-radius: $radius-sm;
			width: 100%;
			line-height: 90rpx;
			font-size: $title-size;
			&[disabled] {
				background-color: #eba5a5;
			}
		}
	}
	
</style>