<template>
	<view class="cardscanning">
		<!-- 摄像机 -->
		<view class="cardscanning-head">
			<view class="title item">请扫描你的有效身份证</view>
			<!-- 扫描身份证 -->
			<view class="title-box" @click="scanIdCard">
				<img src="/static/zhengmian.png" alt="" />
				<view class="box">
					扫描身份证正面
				</view>
				<!-- <button type="submit">打开扫描</button> -->
			</view>
		</view>
		<!-- 身份信息 -->
		<view class="cardscanning-box">
			<view class="box-item item">请确认你的身份信息</view>
			<view class="box-item">
				<view>姓名</view>
				<view class="box-item-info">江小雨</view>
			</view>
			<view class="box-item">
				<view>性别</view>
				<view class="box-item-info">男</view>
			</view>
			<view class="box-item">
				<view>民族</view>
				<view class="box-item-info">汉族</view>
			</view>
		</view>
		<view class="cardscanning-box" style="height: 250rpx;">
			<view class="box-item">
				<view>出生日期</view>
				<view class="box-item-info">2020/7/9</view>
			</view>
			<view class="box-item">
				<view>家庭住址</view>
				<view class="box-item-info">男</view>
			</view>
			<view class="box-item">
				<view>身份证号</view>
				<view class="box-item-info">50022855445444116174</view>
			</view>
		</view>
	
		<!-- 最后的提取信息 -->
		<view class="bottom">
			<button type="default" class="button" @click="extractBtn">提取信息</button>
		</view>
	</view>
</template>

<script>
// 在 Vue 文件中调用原生插件
import { NativeModules } from '@dcloudio/uni-app';
	export default {
			data(){
				return{
					userInfo:{} //个人信息
				}
			},
		mounted() {
			
		},
		methods:{
		
			// 扫描身份证
			scanIdCard(){
			   // 调用摄像头
			        uni.chooseImage({
			          count: 1,
			          sizeType: ['original', 'compressed'],
			          sourceType: ['camera'],
			          success: (res) => {
			            const tempFilePaths = res.tempFilePaths;
			            // 对图片进行识别
						console.log(tempFilePaths,'tempFilePaths');
			            // 预览图片
			            // this.idCardImage = tempFilePaths[0];
			          }
			        });
			},
			
			extractBtn(){
				uni.request({
					url:'http://192.168.0.15:8080/wechat/patient',
					method:'get',
					success: (res)=>{
					console.log(res,'res');
					},
					fail: function(err) {
					  console.error(err); // 请求失败时的处理逻辑
					}
				})
				
			}
		}
	}
</script>

<style scoped lang="scss">
	.cardscanning{
		width: 100vw;
		height: 100vh;
		// padding: 23rpx;
		background-color: #eee;
		box-sizing: border-box;
		.item{
			font-family: SourceHanSansCN, SourceHanSansCN;
			font-weight: 400;
			font-size: 30rpx;
			color: #999999;
			line-height: 32rpx;
			text-align: left;
			font-style: normal;
			text-transform: none;
		}
		.cardscanning-head{
			width: 750rpx;
			height: 400rpx;
			background: #FFFFFF;
			padding: 30rpx;
			.title-box{
				margin-top: 32rpx;
				width: 685rpx;
				height: 279rpx;
				background: #F3F7FD;
				border-radius: 10rpx 10rpx 10rpx 10rpx;
				text-align: center;
				img{
					width: 220rpx;
					height: 180rpx;
				}
				.box{
					margin-top: 20rpx;
					width: 692rpx;
					height: 80rpx;
					background: #5581FF;
					border-radius: 0rpx 10rpx 10rpx 0rpx;
					line-height: 80rpx;
					font-family: SourceHanSansCN, SourceHanSansCN;
					font-weight: 400;
					font-size: 28rpx;
					color: #FFFFFF;
					font-style: normal;
					text-transform: none;
				}
			}
		}
		
		.cardscanning-box{
			margin-top: 30rpx;
			width: 750rpx;
			height: 362rpx;
			background-color: #FFFFFF;
			box-sizing: border-box;
			.box-item{
				// width: 750rpx;
				height: 88rpx;
				line-height: 88rpx;
				border-bottom:  2rpx solid #eee;
				background: #FFFFFF;
				padding:0 40rpx ;
				display: flex;
				justify-content: space-between;
				font-family: SourceHanSansCN, SourceHanSansCN;
				font-weight: 400;
				font-size: 30rpx;
				color: #1B1B20;
				.box-item-info{
					color: #656565;
				}
			}
		}
		
		.bottom{
			margin-top: 50rpx;
			height: 200rpx;
			background-color: #FFFFFF;
			display: flex;
			align-items: center;
			.button{
				width: 721rpx;
				height: 100rpx;
				background: #5581FF;
				box-shadow: 8rpx 0rpx 16rpx 0rpx #2385FF;
				border-radius: 44rpx 44rpx 44rpx 44rpx;
				color: #FFFFFF;
			}
		}
		
	}
</style>