<template>
	<view class="content" v-if="info.name">
		<view class="content-block">
			<view class="content-item">
				<view class="text-title nowrap">姓名</view>
				<view class="text-value">{{info.name || '-'}}</view>
			</view>
			<view class="content-item">
				<view class="text-title nowrap">性别</view>
				<view class="text-value">{{info.sex || '-'}}</view>
			</view>
			<view class="content-item">
				<view class="text-title nowrap">年龄</view>
				<view class="text-value">{{info.age || '-'}}</view>
			</view>
			<view class="content-item">
				<view class="text-title nowrap">手机号码</view>
				<view class="text-value">{{info.mobile || '-'}}</view>
			</view>
			<view class="content-item">
				<view class="text-title nowrap">属相</view>
				<view class="text-value">{{info.zodiak || '-'}}</view>
			</view>
			<view class="content-item">
				<view class="text-title nowrap">身份证号</view>
				<view class="text-value">{{info.id_card || '-'}}</view>
			</view>
			<view class="content-item">
				<view class="text-title nowrap">婚姻状况</view>
				<view class="text-value">{{info.marriages[info.marriage] || '-'}}</view>
			</view>
			<view class="content-item">
				<view class="text-title nowrap">配偶姓名</view>
				<view class="text-value">{{info.mate || '-'}}</view>
			</view>
			<view class="content-item">
				<view class="text-title nowrap">学历</view>
				<view class="text-value">{{info.educations[info.education] || '-'}}</view>
			</view>
			<view class="content-item">
				<view class="text-title nowrap">毕业院校</view>
				<view class="text-value">{{info.school || '-'}}</view>
			</view>
			<view class="content-item">
				<view class="text-title nowrap">身份证地址</view>
				<view class="text-value">{{info.address || '-'}}</view>
			</view>
			<view class="content-item">
				<view class="text-title nowrap">联系地址</view>
				<view class="text-value">{{info.contact_address || '-'}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { userInfoBase } from '@/apis/interfaces/user.js'
	export default {
		data() {
			return {
				info: {}
			};
		},
		created() {
			uni.showLoading({
				title: '加载中...',
				mask : true
			})
			userInfoBase().then(res => {
				this.info = res;
				uni.hideLoading()
			}).catch(err => {
				uni.showToast({
					title: err.message,
					icon : 'none'
				})
			})
		}
	}
</script>

<style lang="scss">
	.content{
		padding: 30rpx 0;
		box-sizing: border-box;
		.content-block{
			background: white;
			.content-item{
				display: flex;
				justify-content: space-between;
				align-items: center;
				line-height: 40rpx;
				padding: 30rpx;
				font-size: 30rpx;
				.text-title{
					width: 200rpx;
					color: gray;
				}
				.text-value{
					width: calc( 100% - 200rpx);
					text-align: right;
				}
				@extend .border-solid;
				&::after{
					left: 30rpx;
				}
				&:last-child::after{
					display: none;
				}
			}
		}
	}
</style>
