From c2463c02a17f92df55ec77ed2da3fb724290c072 Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期一, 20 十月 2025 17:34:30 +0800
Subject: [PATCH] fix: bug
---
apps/cMiniApp/src/subpackages/authentication/authenticationRealName/InnerPage.vue | 104 +++++++++++++++++++++++++++++++++++-----------------
1 files changed, 70 insertions(+), 34 deletions(-)
diff --git a/apps/cMiniApp/src/subpackages/authentication/authenticationRealName/InnerPage.vue b/apps/cMiniApp/src/subpackages/authentication/authenticationRealName/InnerPage.vue
index 2ab5db4..6e5dda9 100644
--- a/apps/cMiniApp/src/subpackages/authentication/authenticationRealName/InnerPage.vue
+++ b/apps/cMiniApp/src/subpackages/authentication/authenticationRealName/InnerPage.vue
@@ -3,18 +3,14 @@
<nut-form :model-value="form" ref="formRef" :rules="rules">
<ProFormItemCell label="韬唤璇佺収鐗�:" required>
<div class="id-imgUrl-wrapper">
- <nut-form-item
- label=" "
- class="bole-form-item"
- prop="legalPersonIdFrontImgUrl"
- label-width="0px"
- >
+ <nut-form-item label=" " class="bole-form-item" prop="identityImg" label-width="0px">
<Uploader
- v-model:file-list="form.legalPersonIdFrontImgUrl"
+ v-model:file-list="form.identityImg"
:maximum="1"
:limitFileSize="10"
class="bole-uploader nopaddingtop"
@my-success="handleFrontImgUrlChange"
+ @delete="handleFrontImgUrlDelete"
>
<template #upload-icon>
<div class="photograph-wrapper">
@@ -24,14 +20,9 @@
</template>
</Uploader>
</nut-form-item>
- <nut-form-item
- label=" "
- class="bole-form-item"
- prop="legalPersonIdBackImgUrl"
- label-width="0px"
- >
+ <nut-form-item label=" " class="bole-form-item" prop="identityBackImg" label-width="0px">
<Uploader
- v-model:file-list="form.legalPersonIdBackImgUrl"
+ v-model:file-list="form.identityBackImg"
:maximum="1"
:limitFileSize="10"
class="bole-uploader nopaddingtop"
@@ -55,6 +46,7 @@
v-model.trim="form.name"
class="nut-input-text bole-input-text"
placeholder="璇峰~鍐欏鍚�"
+ :formatter="filterNotCN"
type="text"
/>
</nut-form-item>
@@ -83,12 +75,13 @@
</template>
</nut-input>
</nut-form-item>
- <nut-form-item label="鐭俊楠岃瘉鐮�:" class="bole-form-item" prop="verificationCode" required>
+ <nut-form-item label="鐭俊楠岃瘉鐮�:" class="bole-form-item" prop="verifyCode" required>
<nut-input
- v-model.trim="form.verificationCode"
+ v-model.trim="form.verifyCode"
class="nut-input-text bole-input-text"
placeholder="璇疯緭鍏ラ獙璇佺爜"
type="number"
+ :max-length="6"
/>
</nut-form-item>
</template>
@@ -102,29 +95,31 @@
</template>
<script setup lang="ts">
-import { VerificationCodeBusinessType } from '@12333/constants';
import { ProFormCaptcha, ProFormItemCell } from 'senin-mini/components';
import * as electronSignServices from '@12333/services/apiV2/electronSign';
import { FileItem } from '@nutui/nutui-taro/dist/types/__VUE/uploader/type';
import { Photograph } from '@nutui/icons-vue-taro';
import { FormRules } from '@nutui/nutui-taro/dist/types/__VUE/form/types';
-import { FormValidator } from '@12333/utils';
+import { FormValidator, filterNotCN } from '@12333/utils';
import Taro from '@tarojs/taro';
+import { userCredentialVerifyOcrIDCard } from '@12333/hooks';
+import { EnumOcrAccess } from '@12333/constants';
defineOptions({
name: 'InnerPage',
});
+const { userDetail, updateUserInfo } = useUser();
const router = Taro.useRouter();
const type = router.params?.type ?? '';
const form = reactive({
- legalPersonIdFrontImgUrl: [] as FileItem[],
- legalPersonIdBackImgUrl: [] as FileItem[],
+ identityImg: [] as FileItem[],
+ identityBackImg: [] as FileItem[],
name: '',
identity: '',
- phoneNumber: '',
- verificationCode: '',
+ phoneNumber: userDetail.value?.contactPhoneNumber,
+ verifyCode: '',
});
const formRef = ref<any>(null);
@@ -132,21 +127,21 @@
const rules: FormRules = {
name: [{ required: true, message: '璇峰~鍐欏鍚�' }],
- legalPersonIdFrontImgUrl: [
+ identityImg: [
{ required: true, message: '璇蜂笂浼犺韩浠借瘉浜哄儚闈�', validator: FormValidator.validatorArray },
],
- legalPersonIdBackImgUrl: [
+ identityBackImg: [
{ required: true, message: '璇蜂笂浼犺韩浠借瘉鍥藉窘闈�', validator: FormValidator.validatorArray },
],
identity: [
{ required: true, message: '璇峰~鍐欒韩浠借瘉鍙风爜' },
{ message: '璇疯緭鍏ユ纭殑韬唤璇佸彿鐮�', validator: FormValidator.validatorIDCard },
],
- legalPersonContactPhone: [
+ phoneNumber: [
{ required: true, message: '璇峰~鍐欐墜鏈哄彿鐮�' },
{ message: '璇疯緭鍏ユ纭殑鎵嬫満鍙风爜', validator: FormValidator.validatorPhoneNumber },
],
- verificationCode: [{ required: true, message: '璇疯緭鍏ラ獙璇佺爜' }],
+ verifyCode: [{ required: true, message: '璇疯緭鍏ラ獙璇佺爜' }],
};
async function onGetCaptcha(phoneNumber: string) {
@@ -161,12 +156,14 @@
}
function handleFrontImgUrlChange(response: FileItem) {
- // userCredentialVerifyOcrIDCard(response, {
- // onSuccess(res) {
- // if (res.realName) form.legalPersonName = res.realName;
- // if (res.idcardNum) form.legalPersonIdNumber = res.idcardNum;
- // },
- // });
+ userCredentialVerifyOcrIDCard({
+ url: response?.url,
+ access: EnumOcrAccess.Baidu,
+ onSuccess(res) {
+ if (res.model?.name) form.name = res.model?.name;
+ if (res.model?.identity) form.identity = res.model?.identity;
+ },
+ });
}
function handleSubmit() {
@@ -187,8 +184,47 @@
}
}
-async function personalUserFaceReal() {}
-async function personalUserIdentity3Real() {}
+async function personalUserIdentity3Real() {
+ try {
+ let params: API.PersonalUserIdentity3RealCommand = {
+ name: form.name,
+ phoneNumber: form.phoneNumber,
+ identity: form.identity,
+ identityImg: form.identityImg?.[0]?.path ?? '',
+ identityBackImg: form.identityBackImg?.[0]?.path ?? '',
+ verifyCode: form.verifyCode,
+ };
+ let res = await electronSignServices.personalUserIdentity3Real(params);
+ if (res) {
+ Taro.navigateTo({ url: `${RouterPath.authenticationResult}` });
+ }
+ } catch (error) {}
+}
+
+async function personalUserFaceReal() {
+ try {
+ let params: API.PersonalUserFaceRealCommand = {
+ name: form.name,
+ identity: form.identity,
+ identityImg: form.identityImg?.[0]?.path ?? '',
+ identityBackImg: form.identityBackImg?.[0]?.path ?? '',
+ };
+ let res = await electronSignServices.personalUserFaceReal(params);
+ if (res) {
+ // 涓轰簡鍏煎鏃х増鏈殑api res鐩存帴鏄痜aceUrl
+ const encodedUrl = encodeURIComponent(typeof res === 'string' ? res : res.faceUrl);
+ updateUserInfo();
+ Taro.navigateTo({ url: `${RouterPath.extraPage}?url=${encodedUrl}` });
+ }
+ } catch (error) {}
+}
+
+function handleFrontImgUrlDelete({ files, fileList, index }) {
+ if (fileList?.length === 0) {
+ form.name = '';
+ form.identity = '';
+ }
+}
</script>
<style lang="scss">
--
Gitblit v1.9.1