数字艺术
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

287 lines
5.4 KiB

<template>
<view class="container">
<Head @backto="backto" title="实名认证"></Head>
<view v-if="state==0" class="smrz">
<view class="shurukuan">
<view>
<view>名字</view>
<input placeholder="请输入真实姓名" v-model="authentication.realname" />
</view>
<view>
<view>身份证号</view>
<input placeholder="请输入身份证号" v-model="authentication.idcard" />
</view>
</view>
<view class="queren" @click="nameauthentication">
完成
</view>
</view>
<view v-if="state==1" class="smrzwc">
<view class="smrzwc_top">
<image src="../../static/ysm.png"></image>
<view>已实名认证</view>
</view>
<view class="smrzwc_xx">
<view>
<view>姓名</view>
<view>{{idnumber.name}}</view>
</view>
<view>
<view>身份证号</view>
<view>{{idnumber.fristnumber}}****************{{idnumber.lastnumber}}</view>
</view>
</view>
</view>
</view>
</template>
<script>
import {
ref,
reactive
} from 'vue';
import {
userverified,
usergetverified
} from "@/api/api.js";
import {
onLoad,
onShow,
} from "@dcloudio/uni-app";
import Head from "../../components/head.vue"
export default {
components: {
Head
},
setup() {
let state = ref(0);
let idnumber = reactive({
fristnumber: "",
lastnumber: "",
name: ''
});
let authentication = reactive({
realname: "",
idcard: ""
})
function backto() {
uni.navigateTo({
url:"../set/set"
})
}
function nameauthentication() {
let idcard = /^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
if (authentication.realname.length == 0) {
uni.showToast({
duration: 1500,
title: "请输入名字",
icon: 'error'
})
return
}
if (!idcard.test(authentication.idcard)) {
uni.showToast({
duration: 1500,
title: "身份证不正确",
icon: 'error'
})
return
}
userverified({
name: authentication.realname,
id_card: authentication.idcard
}).then((res) => {
console.log(res);
if (res.code == 200) {
uni.showToast({
duration: 1000,
title: "认证成功",
icon: 'success'
});
state.value = 1;
usergetverified({}).then((res) => {
console.log(res);
if (res.data.id_card) {
state.value = 1;
idnumber.fristnumber = res.data.id_card.slice(0, 1);
idnumber.lastnumber = res.data.id_card.slice(res.data.id_card.length - 1,
res.data.id_card.length);
idnumber.name = res.data.name
}
})
} else if (res.code == 202) {
uni.showToast({
duration: 1000,
title: `${res.msg}`,
icon: 'error'
});
}
})
};
onLoad(() => {
usergetverified({}).then((res) => {
console.log(res);
if (res.data.id_card) {
state.value = 1;
idnumber.fristnumber = res.data.id_card.slice(0, 1);
idnumber.lastnumber = res.data.id_card.slice(res.data.id_card.length - 1, res.data
.id_card.length);
idnumber.name = res.data.name
}
})
});
return {
state,
nameauthentication,
authentication,
idnumber,
backto
}
}
}
</script>
<style lang="scss" scoped>
.container {
display: flex;
}
.smrz {
display: flex;
flex-direction: column;
align-items: center;
margin: 0rpx auto;
margin-top: 150rpx;
.shurukuan {
width: 686upx;
// height: 326upx;
background: #23262F;
border-radius: 12upx;
display: flex;
flex-direction: column;
padding: 32upx;
box-sizing: border-box;
margin-bottom: 120upx;
>view {
color: #ffffff;
display: flex;
font-size: 28upx;
font-weight: 400;
justify-content: space-between;
border-bottom: 1upx solid #373737;
&:nth-of-type(1) {
padding-top: 20upx;
padding-bottom: 40upx;
}
&:nth-last-child(1) {
border-bottom: none;
padding-top: 40upx;
padding-bottom: 0upx !important;
}
>input {
text-align: right;
}
}
}
.queren {
width: 668upx;
height: 84upx;
background: #3772FF;
border-radius: 12upx;
display: flex;
align-items: center;
justify-content: center;
font-size: 28upx;
font-weight: 500;
color: #FFFFFF;
}
}
.smrzwc {
display: flex;
flex-direction: column;
align-items: center;
padding-top: 90upx;
color: #ffffff;
margin: 0rpx auto;
margin-top: 150rpx;
.smrzwc_top {
display: flex;
flex-direction: column;
align-items: center;
font-size: 30upx;
font-weight: 500;
color: #FFFFFF;
>image {
width: 124upx;
height: 124upx;
margin-bottom: 40upx;
}
}
.smrzwc_xx {
width: 686upx;
// height: 326upx;
background: #23262F;
border-radius: 12upx;
display: flex;
flex-direction: column;
align-items: center;
padding: 32upx;
box-sizing: border-box;
margin-top: 50upx;
>view {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-weight: 400;
color: #FFFFFF;
border-bottom: 1upx solid #373737;
padding-bottom: 44upx;
&:nth-last-child(1) {
border-bottom: none;
padding-top: 44upx;
padding-bottom: 20upx;
}
>view:nth-of-type(1) {
font-size: 28upx;
}
>view:nth-of-type(1) {
font-size: 24upx;
}
}
}
}
page {
// padding-top: 34upx;
}
</style>