<template>
	<view class="contioner">

		<view class="content">
			<view class="contentitem frist">
				<view class="itemname">
					姓名
				</view>
				<view class="fanhui">
					<input type="text" value="" placeholder="请输入您的真实姓名" v-model="name" />
				</view>
			</view>
			<view class="contentitem">
				<view class="itemname">
					身份证
				</view>
				<view class="fanhui">
					<input type="text" value="" maxlength="18" placeholder="请输入您的身份证号" v-model="Idcard" />
				</view>
			</view>

		</view>

		<view class="content">
			<view class="button" @click="authentication">
				开始认证
			</view>
		</view>
	</view>
</template>

<script>
	import {
		NameAuthentication
	} from '../../api/user.js'
	export default {
		data() {
			return {
				name: "",
				Idcard: ""
			}
		},
		
		methods: {
			// 实名认证
			async authentication() {
				let a = await NameAuthentication({
					name: this.name,
					card: this.Idcard
				})
				if(a.msg=='操作成功'){
					uni.setStorageSync('user',a.data)
					uni.showToast({
						title:'认证成功',
						icon:'success'
					})
					setTimeout(()=>{
						uni.navigateBack()
					},2000)
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import "./IDnumber.scss"
</style>
