123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502 |
- <template>
- <view class="content-wrap">
- <view class="t-card">
- <view class="content">
- <view class="t-con">
- <view class="item-tips">
- <view class="title"> 上传后请核对识别信息 </view>
- <view class="tip"> 如有错误请及时手动修改 </view>
- </view>
- <view class="picture-wrapper" @click="takePhotoMode(1)">
- <view class="bg">
- <view class="">
- <view class="name"> 人像面 </view>
- <view class="value"> 上传身份证的人像面 </view>
- <view class="tip">
- <view class="tip-value"> 拍摄规范 </view>
- </view>
- </view>
- <image v-if="!state.form.userIdImgUrl" class="icon" :src="`${$imgUrl}issuance/sfz.png`"
- :style="{'--bgimg':`url(${$imgUrl}issuance/bg-border.png)`}">
- </image>
- <image v-else class="icon" :src="strReplace(state.form.userIdImgUrl)"
- :style="{'--bgimg':`url(${$imgUrl}issuance/bg-border.png`}"></image>
- </view>
- </view>
- <view class="picture-wrapper" @click="takePhotoMode(2)">
- <view class="bg">
- <view class="">
- <view class="name"> 国徽面 </view>
- <view class="value"> 上传身份证的国徽面 </view>
- <view class="tip">
- <view class="tip-value"> 拍摄规范 </view>
- </view>
- </view>
- <image v-if="!state.form.userIdBackImgUrl" class="icon" :src="`${$imgUrl}issuance/sff.png`"
- :style="{'--bgimg':`url(${$imgUrl}issuance/bg-border.png`}">
- </image>
- <image v-else class="icon" :src="strReplace(state.form.userIdBackImgUrl)"
- :style="{'--bgimg':`url(${$imgUrl}issuance/bg-border.png`}"></image>
- </view>
- </view>
- </view>
- <view class="shibie-wrapper">
- <view class="title"> 识别内容如下 </view>
- <u-form label-width="230" :model="state.form" ref="uForm" :label-style='labelStyle'>
- <u-form-item label="姓名" :left-icon='`${$imgUrl}issuance/point-form.png`'
- :left-icon-style='leftIcon'>
- <u-input v-model="state.form.userName" placeholder='请输入姓名' maxlength="20"
- @input="replaceInput" inputAlign="right" />
- </u-form-item>
- <u-form-item label="身份证号" :left-icon='`${$imgUrl}issuance/point-form.png`'
- :left-icon-style='leftIcon'>
- <u-input placeholder='请输入身份证' type="idcard" v-model="state.form.idNum" maxlength="18"
- inputAlign="right" />
- </u-form-item>
- <u-form-item label="地址" :left-icon='`${$imgUrl}issuance/point-form.png`'
- :left-icon-style='leftIcon'>
- <u-input placeholder='请输入地址' :autoHeight='true' v-model="state.form.address" maxlength="50"
- inputAlign="right" />
- </u-form-item>
- <u-form-item label="证件类型" :left-icon='`${$imgUrl}issuance/point-form.png`'
- :left-icon-style='leftIcon' borderBottom>
- <u-input v-model="state.form.idTypeStr" type="select" @click="show1 = true"
- input-align='right' />
- </u-form-item>
- </u-form>
- </view>
- <view class="action">
- <view class="btn-tip">
- 如识别信息有误,请手动修改,确认无误后,点击下一步!
- </view>
- <button type="default" class="ui-btn" @click="savaHandle()">
- 下一步
- </button>
- </view>
- </view>
-
- </view>
- </view>
- <!-- 选择车牌颜色 -->
- <u-select v-model="show1" :list="credentialTypeSelect" @confirm="changeIdType"></u-select>
- <uploadImg :isTakePhotoModeShow="state.isTakePhotoModeShow" :phoneType="state.choiceIndex" @close="close"
- @ocrResult="ocrResult">
- </uploadImg>
- </template>
-
- <script setup lang="ts">
- import uploadImg from '@/components/uploadOcr';
- import {
- reactive,
- ref,
- } from "vue";
- import {
- msg,
- checkStr,
- strReplace,
- uploadFile,
- compressImage,
- chooseImageCompress,
- compareDates,
- getFileBase64
- } from "@/utils/utils";
- import {
- onLoad,
- onPageScroll,
- } from "@dcloudio/uni-app";
- import {
- getUserMsg,
- realNameAuthentication
- } from "@/utils/network/api.js";
-
- import { credentialTypeSelect } from "@/datas/credentialType.js";
- import { requestNew } from "@/utils/network/request.js";
-
- import {
- setItem,
- getItem,
- } from "@/utils/storage";
- import {
- getCodeName
- } from "@/datas/queryKey.js";
- import navBar from "@/components/nav-bar/nav-bar2.vue";
- const labelStyle = {
- color: "#004576",
- fontSize: "28rpx",
- }
- const leftIcon = {
- height: '100%',
- width: '8rpx',
- display: 'flex',
- 'align-items': 'center',
- 'margin-right': '4rpx',
- }
- const scrollTop = ref(0)
- const show1 = ref(false)
- const state = reactive({
- choiceIndex: 1, // 1 身份证正面 2 身份证反面 3行驶证正面 4行驶证反面
- isTakePhotoModeShow: false, //选择拍照方式是否出来
- form: {
- address: "",
- idNum: "",
- userName: "", //开户人姓名
- userIdImgUrl: "",
- userIdBackImgUrl: "",
- gender: "",
- idType: "", //用户证件类型 101//身份证
- idTypeStr: "",
- userIdBackImgBase64:"",
- userIdImgBase64:""
- },
- userIdImgBase64Old:"",
- userIdBackImgBase64Old:""
- });
-
- const close = (e) => {
- console.log("e", e)
- state.isTakePhotoModeShow = e
- }
-
- const changeIdType = (item) => {
- state.form.idType = item[0].value
- state.form.idTypeStr = item[0].label
- console.log(item)
- }
-
- async function savaHandle(){
- if (!state.form.userName) {
- msg('请输入姓名');
- return;
- }
- if (!state.form.userIdImgUrl) {
- msg('请上传身份证的人像面');
- return;
- }
- if (!state.form.userIdBackImgUrl) {
- msg('请上传身份证的国徽面');
- return;
- }
- if (!checkStr(state.form.idNum, 'card')) {
- msg('请输入正确身份证号');
- return;
- }
- if (!state.form.idType) {
- msg('请选择证件类型');
- return;
- }
- state.form.userIdImgBase64=await getFileBase64(state.userIdImgBase64Old)
- state.form.userIdBackImgBase64=await getFileBase64(state.userIdBackImgBase64Old)
- // getFileBase64(state.userIdImgBase64Old, (data) => {
- // console.log("getFileBase641", data)
- // state.form.userIdImgBase64=data
- // })
- // getFileBase64(state.userIdBackImgBase64Old, (data) => {
- // console.log("getFileBase642", data)
- // state.form.userIdBackImgBase64=data
- // })
- const options = {
- type: 2,
- data: {
- ...state.form
- },
- method: "POST",
- showLoading: true,
- };
- requestNew(realNameAuthentication, options).then((res) => {
- console.log("提交", res);
-
- });
- };
-
- onLoad((option : any) => {
-
- console.log("option", option)
- });
-
- //监听页面滚动
- onPageScroll((e) => {
- scrollTop.value = e.scrollTop;
- });
- const replaceInput = (event) => {
- console.log("event", event)
- const screeningStr = /[^\u4E00-\u9FA5]/g; //想禁止什么类型,在这里替换正则就可以了
- if (screeningStr.test(event)) {
- setTimeout(() => {
- state.form.userName = event.replace(screeningStr, '');
- }, 100)
- } else {
- setTimeout(() => {
- state.form.userName = event;
- }, 100)
- }
- console.log("event.replace(screeningStr, '')", event.replace(screeningStr, ''), event, state.form.userName)
- }
- const takePhotoMode = (index) => {
- console.log("index", index)
- state.isTakePhotoModeShow = true
- state.choiceIndex = index
- }
-
- const ocrResult =(data) => {
- console.log("图片地址val", data)
- if (state.choiceIndex == 1) {
- state.form.userName = data.name;
- if (data.gender == '男') {
- state.form.gender = 'MALE'
- } else if (data.gender == '女') {
- state.form.gender = 'FEMALE'
- } else {
- state.form.gender = 'UNKOWN'
- }
- state.form.idNum = data.idno;
- state.form.userIdImgUrl = data.imageUrl;
- state.form.address = data.address;
- state.userIdImgBase64Old=data.tempFilePath;
- } else {
- state.form.userIdBackImgUrl = data.imageUrl;
- state.userIdBackImgBase64Old=data.tempFilePath
- compareDates(data.enddate)
- }
- }
- </script>
-
- <style lang="scss" scoped>
- .title {
- font-size: 35rpx;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #01243A;
- line-height: 35rpx;
- margin-bottom: 20rpx;
- }
-
- .content-wrap {
- position: absolute;
- top: 30rpx;
- width: 100%;
- box-sizing: border-box;
- padding: 0 30rpx 210rpx;
-
- .t-con {
- width: 100%;
- background-color: #fff;
- border-radius: 12rpx;
- padding: 40rpx 30rpx 30rpx;
- box-sizing: border-box;
- }
-
- .t-select {
- display: flex;
- padding-bottom: 30rpx;
- justify-content: center;
- align-items: center;
-
- .item-select {
- width: 200rpx;
- height: 68rpx;
- font-family: SourceHanSansSC, SourceHanSansSC;
- font-weight: 400;
- font-size: 28rpx;
- color: #CCB375;
- text-align: center;
- line-height: 68rpx;
- border: 1rpx solid #CCB375;
-
- &.l-item {
- border-radius: 34rpx 0 0 34rpx;
- }
-
- &.r-item {
- border-radius: 0 34rpx 34rpx 0;
- }
-
- &.active {
- color: #fff;
- background: #CCB375;
- }
- }
- }
-
- .big {
- font-size: 30rpx;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #333333;
- line-height: 24rpx;
- }
-
- .nomal {
- font-size: 26rpx;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #666666;
- line-height: 24rpx;
- }
-
-
- }
-
- .content {
-
- .action {
- position: absolute;
- bottom: 0rpx;
- left: 0;
- height: 188rpx;
- background-color: #fff;
- border-radius: 30rpx 30rpx 0 0;
- width: 100vw;
- display: flex;
- align-items: center;
- justify-content: center;
- flex-direction: column;
-
- .btn-tip {
- font-family: SourceHanSansSC, SourceHanSansSC;
- font-weight: 400;
- font-size: 24rpx;
- color: #CCB375;
- margin-bottom: 14rpx;
- }
-
- .button {
- height: 88rpx;
- background: radial-gradient(at 0% 0%, #01243A 0%, #004576 100%);
- border-radius: 40rpx;
- font-size: 32rpx;
- font-weight: 400;
- color: #ffffff;
- line-height: 88rpx;
- width: 660rpx;
- margin: 0 auto;
- }
- }
-
- .item-tips {
- .title {
- font-size: 30rpx;
- font-family: Microsoft YaHei;
- font-weight: 500;
- color: #01243A;
- line-height: 30rpx;
- }
-
- .tip {
- margin-top: 16rpx;
- font-size: 24rpx;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #999999;
- line-height: 24rpx;
- }
- }
-
- .picture-wrapper {
- margin-top: 30rpx;
-
- .bg {
- background: #F5F9FB;
- border-radius: 10rpx;
- padding: 40rpx 30rpx;
- display: flex;
- justify-content: space-between;
-
- .name {
- padding-top: 30rpx;
- font-size: 32rpx;
- font-family: SourceHanSansSC, SourceHanSansSC;
- font-weight: 500;
- color: #111;
- line-height: 34rpx;
- }
-
- .value {
- margin-top: 20rpx;
- font-size: 22rpx;
- font-family: SourceHanSansSC, SourceHanSansSC;
- font-weight: 400;
- color: #999999;
- line-height: 24rpx;
- }
-
- .tip {
- margin-top: 20rpx;
- text-align: center;
- width: 100rpx;
- height: 30rpx;
- border-radius: 6rpx;
- border: 1rpx solid #CCB375;
-
- .tip-value {
- font-size: 20rpx;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #CCB375;
- line-height: 30rpx;
- opacity: 1;
- }
- }
- }
-
- .icon {
- width: 304rpx;
- height: 190rpx;
- background-image: var(--bgimg);
- background-size: 100% 100%;
- background-repeat: no-repeat;
- }
- }
-
- .shibie-wrapper,
- .card-box {
- margin-top: 30rpx;
- border-radius: 12rpx;
- background-color: #fff;
- width: 100%;
- padding: 30rpx 30rpx 0;
- box-sizing: border-box;
-
- .title {
- font-size: 30rpx;
- font-family: SourceHanSansSC, SourceHanSansSC;
- font-weight: 500;
- color: #01243A;
- line-height: 30rpx;
- }
- }
-
- .buchong-wrapper {
- margin-top: 60rpx;
-
- .title {
- font-size: 30rpx;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #000000;
- line-height: 30rpx;
- }
- }
-
- .green-tip {
- margin-top: 50rpx;
- font-size: 24rpx;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #999;
- line-height: 24rpx;
- margin-bottom: 60rpx;
- }
- }
-
- .down {
- background: #CCB375;
- color: #fff;
- border-radius: 5rpx;
- font-size: 20rpx;
- margin-top: 10rpx;
- width: 100rpx;
- height: 30rpx;
- text-align: center;
- line-height: 30rpx;
- }
- </style>
|