|
|
@@ -6,7 +6,7 @@
|
|
|
<Form ref="formRef" class="g-form__container" @submit="onSubmit">
|
|
|
<CellGroup inset>
|
|
|
<Field v-model="formData.username" name="username" label="姓名" placeholder="请输入用户姓名" :rules="formRules.username"/>
|
|
|
- <Field v-model="formData.cardtype" name="cardtype" label="证件类型" placeholder="请选择证件类型" is-link readonly @click="showPicker = true"/>
|
|
|
+ <app-select v-model="formData.cardtype" name="cardtype" label="证件类型" placeholder="请选择证件类型" :rules="formRules.cardtype" :options="enums" />
|
|
|
<Field v-model="formData.cardnum" name="cardnum" label="证件号码" placeholder="请输入证件号码" :rules="formRules.cardnum"/>
|
|
|
<Field v-model="formData.cardbackphotourl" name="cardbackphotourl" label="证件正面照片" :rules="formRules.cardbackphotourl">
|
|
|
<template #input>
|
|
|
@@ -20,9 +20,6 @@
|
|
|
</Field>
|
|
|
</CellGroup>
|
|
|
</Form>
|
|
|
- <Popup v-model:show="showPicker" round position="bottom">
|
|
|
- <Picker title="请选择证件类型" :columns="enums" @cancel="showPicker = false" @confirm="onConfirm" />
|
|
|
- </Popup>
|
|
|
<template #footer>
|
|
|
<div class="g-form__footer">
|
|
|
<Button type="primary" @click="formRef?.submit" round block>提交实名认证</Button>
|
|
|
@@ -32,25 +29,24 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { reactive, shallowRef } from 'vue'
|
|
|
-import { CellGroup, Button, Field, Form, FormInstance, Uploader, Toast, FieldRule, Picker, Popup } from 'vant'
|
|
|
+import { shallowRef, computed } from 'vue'
|
|
|
+import { CellGroup, Button, Field, Form, FormInstance, Uploader, Toast, FieldRule } from 'vant'
|
|
|
import { addAuthReq } from '@/business/user'
|
|
|
import { Model } from 'echarts/core';
|
|
|
import { fullloading, dialog } from '@/utils/vant';
|
|
|
import { ref } from 'vue';
|
|
|
import { getCertificateTypeList } from "@/constants/account";
|
|
|
+import AppSelect from '@mobile/components/base/select/index.vue'
|
|
|
|
|
|
const formRef = shallowRef<FormInstance>()
|
|
|
const { formData, formSubmit } = addAuthReq()
|
|
|
-const showPicker = ref(false);
|
|
|
-const result = ref('');
|
|
|
+
|
|
|
/// 证件正面地址
|
|
|
const backList = ref([]);
|
|
|
/// 证件背面地址
|
|
|
const frontList = ref([]);
|
|
|
-
|
|
|
/// 获取对应的证件枚举类型
|
|
|
-const enums = getCertificateTypeList().map(obj=>{ return obj.label })
|
|
|
+const enums = computed(() => { return getCertificateTypeList().map(obj=>{ return {label: obj.label, value: obj.value} }) })
|
|
|
|
|
|
const afterRead = (file: any) => {
|
|
|
file.status = 'uploading';
|
|
|
@@ -68,6 +64,12 @@ const formRules: { [key in keyof Model.AddAuthReq]?: FieldRule[] } = {
|
|
|
required: true,
|
|
|
message: '请输入用户姓名',
|
|
|
}],
|
|
|
+ cardtype: [{
|
|
|
+ message: '请选择证件类型',
|
|
|
+ validator: () => {
|
|
|
+ return !!formData.cardtype
|
|
|
+ }
|
|
|
+ }],
|
|
|
cardnum: [{
|
|
|
required: true,
|
|
|
message: '请输入证件号码',
|
|
|
@@ -82,12 +84,6 @@ const formRules: { [key in keyof Model.AddAuthReq]?: FieldRule[] } = {
|
|
|
}],
|
|
|
}
|
|
|
|
|
|
-const onConfirm = (value: any) => {
|
|
|
- result.value = value;
|
|
|
- showPicker.value = false;
|
|
|
- formData.cardtype = value
|
|
|
-}
|
|
|
-
|
|
|
const onSubmit = () => {
|
|
|
fullloading((hideLoading) => {
|
|
|
formSubmit().then(() => {
|