add 护照OCR识别
Showing
4 changed files
with
75 additions
and
33 deletions
| ... | @@ -36,12 +36,12 @@ | ... | @@ -36,12 +36,12 @@ |
| 36 | :on-error="handleUploadError" | 36 | :on-error="handleUploadError" |
| 37 | :on-exceed="handleExceed" | 37 | :on-exceed="handleExceed" |
| 38 | :before-remove="handleDelete" | 38 | :before-remove="handleDelete" |
| 39 | :show-file-list="true" | 39 | :show-file-list="showFileList" |
| 40 | :headers="headers" | 40 | :headers="headers" |
| 41 | :on-preview="handlePictureCardPreview" | 41 | :on-preview="handlePictureCardPreview" |
| 42 | :file-list="fileListInUpload" | 42 | :file-list="fileListInUpload" |
| 43 | :class="{ hide: fileList.length >= limit }" | 43 | :class="{ hide: fileList.length >= limit }" |
| 44 | name="image" | 44 | :name="paramName" |
| 45 | :disabled="disabled" | 45 | :disabled="disabled" |
| 46 | :accept="accept" | 46 | :accept="accept" |
| 47 | > | 47 | > |
| ... | @@ -108,9 +108,17 @@ const props = defineProps({ | ... | @@ -108,9 +108,17 @@ const props = defineProps({ |
| 108 | type: Boolean, | 108 | type: Boolean, |
| 109 | default: false | 109 | default: false |
| 110 | }, | 110 | }, |
| 111 | showFileList: { | ||
| 112 | type: Boolean, | ||
| 113 | default: true | ||
| 114 | }, | ||
| 111 | action: { | 115 | action: { |
| 112 | type: String, | 116 | type: String, |
| 113 | default: '' | 117 | default: '' |
| 118 | }, | ||
| 119 | paramName: { | ||
| 120 | type: String, | ||
| 121 | default: 'image' | ||
| 114 | } | 122 | } |
| 115 | }) | 123 | }) |
| 116 | 124 | ||
| ... | @@ -133,9 +141,7 @@ const uploadList = ref([]) | ... | @@ -133,9 +141,7 @@ const uploadList = ref([]) |
| 133 | const dialogImageUrl = ref('') | 141 | const dialogImageUrl = ref('') |
| 134 | const dialogVisible = ref(false) | 142 | const dialogVisible = ref(false) |
| 135 | const baseUrl = import.meta.env.VITE_APP_BASE_API | 143 | const baseUrl = import.meta.env.VITE_APP_BASE_API |
| 136 | const uploadImgUrl = ref( | 144 | const uploadImgUrl = ref(baseUrl + '/upload/uploadImgToLocalServer') // 上传的图片服务器地址 |
| 137 | baseUrl + '/upload/uploadImgToLocalServer' | ||
| 138 | ) // 上传的图片服务器地址 | ||
| 139 | const headers = ref({ Authorization: 'Bearer ' + getToken() }) | 145 | const headers = ref({ Authorization: 'Bearer ' + getToken() }) |
| 140 | const fileList = ref([]) | 146 | const fileList = ref([]) |
| 141 | const fileListInUpload = ref([]) | 147 | const fileListInUpload = ref([]) |
| ... | @@ -173,7 +179,6 @@ watch( | ... | @@ -173,7 +179,6 @@ watch( |
| 173 | 179 | ||
| 174 | // 上传前loading加载 | 180 | // 上传前loading加载 |
| 175 | function handleBeforeUpload(file) { | 181 | function handleBeforeUpload(file) { |
| 176 | console.log('handleBeforeUpload', props) | ||
| 177 | let isImg = false | 182 | let isImg = false |
| 178 | if (props.fileType.length) { | 183 | if (props.fileType.length) { |
| 179 | let fileExtension = '' | 184 | let fileExtension = '' |
| ... | @@ -212,6 +217,7 @@ function handleExceed() { | ... | @@ -212,6 +217,7 @@ function handleExceed() { |
| 212 | 217 | ||
| 213 | // 上传成功回调 | 218 | // 上传成功回调 |
| 214 | function handleUploadSuccess(res, file) { | 219 | function handleUploadSuccess(res, file) { |
| 220 | console.log(props) | ||
| 215 | if (!actionUrl.value) { | 221 | if (!actionUrl.value) { |
| 216 | if (res.code === 200) { | 222 | if (res.code === 200) { |
| 217 | uploadList.value.push({ name: file.name, url: res.data || res.msg }) | 223 | uploadList.value.push({ name: file.name, url: res.data || res.msg }) | ... | ... |
| ... | @@ -66,15 +66,11 @@ | ... | @@ -66,15 +66,11 @@ |
| 66 | :is-show-tip="false" | 66 | :is-show-tip="false" |
| 67 | /> | 67 | /> |
| 68 | </el-form-item> | 68 | </el-form-item> |
| 69 | <el-form-item :label="language==0?'性别':'Gender'" required> | ||
| 70 | <el-radio-group v-model="form.sex"> | ||
| 71 | <el-radio value="0">{{ language == 0 ? '女' : 'female' }}</el-radio> | ||
| 72 | <el-radio value="1">{{ language == 0 ? '男' : 'male' }}</el-radio> | ||
| 73 | </el-radio-group> | ||
| 74 | </el-form-item> | ||
| 75 | 69 | ||
| 76 | <el-form-item :label="language==0?'有效证件':'Valid Passport'" required> | 70 | <el-form-item :label="language==0?'有效证件':'Valid Passport'" required> |
| 77 | <image-upload action="/common/getPersonInfoFromCert/3" v-model="form.passportUrl" :limit="1" :is-show-tip="false" | 71 | <image-upload ref="uploadPassportRef" v-model="form.passportUrl" :limit="1" :is-show-tip="false" |
| 72 | :action="'/common/getPersonInfoFromCert/3'" | ||
| 73 | paramName="pic" | ||
| 78 | :button-text="language==0?'上传':'Upload'" | 74 | :button-text="language==0?'上传':'Upload'" |
| 79 | @response="ocrSuccess"/> | 75 | @response="ocrSuccess"/> |
| 80 | <div class="tip"> | 76 | <div class="tip"> |
| ... | @@ -85,6 +81,13 @@ | ... | @@ -85,6 +81,13 @@ |
| 85 | </div> | 81 | </div> |
| 86 | 82 | ||
| 87 | </el-form-item> | 83 | </el-form-item> |
| 84 | <el-form-item :label="language==0?'性别':'Gender'" required> | ||
| 85 | <el-radio-group v-model="form.sex"> | ||
| 86 | <el-radio value="0">{{ language == 0 ? '女' : 'female' }}</el-radio> | ||
| 87 | <el-radio value="1">{{ language == 0 ? '男' : 'male' }}</el-radio> | ||
| 88 | </el-radio-group> | ||
| 89 | </el-form-item> | ||
| 90 | |||
| 88 | <el-form-item :label="language==0?'出生日期':'Date of Birth'" required> | 91 | <el-form-item :label="language==0?'出生日期':'Date of Birth'" required> |
| 89 | <el-date-picker | 92 | <el-date-picker |
| 90 | v-model="form.birth" | 93 | v-model="form.birth" |
| ... | @@ -117,6 +120,8 @@ import _ from 'lodash' | ... | @@ -117,6 +120,8 @@ import _ from 'lodash' |
| 117 | import Vcode from "vue3-puzzle-vcode" | 120 | import Vcode from "vue3-puzzle-vcode" |
| 118 | import {checkWdsf, checkWdsfAthletes} from "@/apiPc/match"; | 121 | import {checkWdsf, checkWdsfAthletes} from "@/apiPc/match"; |
| 119 | import {useStorage} from "@vueuse/core/index"; | 122 | import {useStorage} from "@vueuse/core/index"; |
| 123 | import ImageUpload from '@/components/ImageUpload/index.vue' | ||
| 124 | import ImageUpload2 from '@/components/ImageUpload/index2.vue' | ||
| 120 | 125 | ||
| 121 | const language = useStorage('language', 0) | 126 | const language = useStorage('language', 0) |
| 122 | const certificates = ref([ | 127 | const certificates = ref([ |
| ... | @@ -158,11 +163,11 @@ const data = reactive({ | ... | @@ -158,11 +163,11 @@ const data = reactive({ |
| 158 | cptId: '', | 163 | cptId: '', |
| 159 | failVcode: '验证失败,请重试', | 164 | failVcode: '验证失败,请重试', |
| 160 | successVcode: '验证通过!', | 165 | successVcode: '验证通过!', |
| 161 | sliderText: '拖动滑块完成拼图', | 166 | sliderText: '拖动滑块完成拼图' |
| 162 | }) | 167 | }) |
| 163 | const { | 168 | const { |
| 164 | form, show, showVcode, title, labels, uType, isMe, isCodeTrue, card, cptId, | 169 | form, show, showVcode, title, labels, uType, isMe, isCodeTrue, card, cptId, |
| 165 | failVcode, successVcode, sliderText | 170 | failVcode, successVcode, sliderText,uploadPassportRef |
| 166 | } = toRefs(data) | 171 | } = toRefs(data) |
| 167 | 172 | ||
| 168 | let editgay = false | 173 | let editgay = false |
| ... | @@ -227,8 +232,16 @@ watch(show, (value) => { | ... | @@ -227,8 +232,16 @@ watch(show, (value) => { |
| 227 | }) | 232 | }) |
| 228 | }) | 233 | }) |
| 229 | const ocrSuccess = (res) => { | 234 | const ocrSuccess = (res) => { |
| 230 | // todo 增加护照ocr识别 识别外国人护照姓名,出生年月 | 235 | // form.value.passportUrl = res.data.url |
| 231 | console.log(res) | 236 | console.log(form.value.passportUrl) |
| 237 | if(res.code==200){ | ||
| 238 | form.value.passportUrl = res.data.url | ||
| 239 | form.value.passportNumber = res.data.code | ||
| 240 | form.value.birth = res.data.birth?.slice(0, 10) | ||
| 241 | form.value.sex = res.data.sex | ||
| 242 | } else if(res.code==500){ | ||
| 243 | ElMessage.warning(res.msg) | ||
| 244 | } | ||
| 232 | } | 245 | } |
| 233 | 246 | ||
| 234 | function submitForm() { | 247 | function submitForm() { |
| ... | @@ -406,7 +419,7 @@ function disabledBirth(time) { | ... | @@ -406,7 +419,7 @@ function disabledBirth(time) { |
| 406 | 419 | ||
| 407 | .tip { | 420 | .tip { |
| 408 | font-size: 13px; | 421 | font-size: 13px; |
| 409 | color: #999; | 422 | color: #999; line-height: 1.6; |
| 410 | margin: 10px 0; | 423 | margin: 10px 0; |
| 411 | 424 | ||
| 412 | i { | 425 | i { | ... | ... |
| ... | @@ -65,15 +65,12 @@ | ... | @@ -65,15 +65,12 @@ |
| 65 | /> | 65 | /> |
| 66 | </el-form-item> | 66 | </el-form-item> |
| 67 | 67 | ||
| 68 | <el-form-item :label="language==0?'性别':'Gender'" required> | ||
| 69 | <el-radio-group v-model="wdsfData.sex"> | ||
| 70 | <el-radio value="0">{{ language == 0 ? '女' : 'female' }}</el-radio> | ||
| 71 | <el-radio value="1">{{ language == 0 ? '男' : 'male' }}</el-radio> | ||
| 72 | </el-radio-group> | ||
| 73 | </el-form-item> | ||
| 74 | <el-form-item :label="language==0?'有效证件':'Valid Passport'" required> | 68 | <el-form-item :label="language==0?'有效证件':'Valid Passport'" required> |
| 75 | <image-upload v-model="wdsfData.passportUrl" :limit="1" :is-show-tip="false" | 69 | <image-upload v-model="wdsfData.passportUrl" :limit="1" :is-show-tip="false" |
| 76 | :button-text="language==0?'上传':'Upload'"/> | 70 | :action="'/common/getPersonInfoFromCert/3'" |
| 71 | paramName="pic" | ||
| 72 | :button-text="language==0?'上传':'Upload'" | ||
| 73 | @response="ocrSuccess"/> | ||
| 77 | <div class="tip"> | 74 | <div class="tip"> |
| 78 | <span v-if="language==0">请上传有效身份证件扫描件,用于核实身份信息、申请签证邀请函及购买保险等</span> | 75 | <span v-if="language==0">请上传有效身份证件扫描件,用于核实身份信息、申请签证邀请函及购买保险等</span> |
| 79 | <span v-else>Please upload a scanned copy of your valid passport for verification of identity information, | 76 | <span v-else>Please upload a scanned copy of your valid passport for verification of identity information, |
| ... | @@ -83,7 +80,12 @@ | ... | @@ -83,7 +80,12 @@ |
| 83 | <el-form-item :label="language==0?'证件号':'Passport number'" required> | 80 | <el-form-item :label="language==0?'证件号':'Passport number'" required> |
| 84 | <el-input v-model="wdsfData.passportNumber"/> | 81 | <el-input v-model="wdsfData.passportNumber"/> |
| 85 | </el-form-item> | 82 | </el-form-item> |
| 86 | 83 | <el-form-item :label="language==0?'性别':'Gender'" required> | |
| 84 | <el-radio-group v-model="wdsfData.sex"> | ||
| 85 | <el-radio value="0">{{ language == 0 ? '女' : 'female' }}</el-radio> | ||
| 86 | <el-radio value="1">{{ language == 0 ? '男' : 'male' }}</el-radio> | ||
| 87 | </el-radio-group> | ||
| 88 | </el-form-item> | ||
| 87 | <el-form-item :label="language==0?'出生日期':'Date of Birth'" required> | 89 | <el-form-item :label="language==0?'出生日期':'Date of Birth'" required> |
| 88 | <el-date-picker | 90 | <el-date-picker |
| 89 | v-model="wdsfData.birthday" | 91 | v-model="wdsfData.birthday" |
| ... | @@ -365,6 +367,18 @@ function bigNext(){ | ... | @@ -365,6 +367,18 @@ function bigNext(){ |
| 365 | } | 367 | } |
| 366 | 368 | ||
| 367 | function next() { | 369 | function next() { |
| 370 | if(!form.value.code){ | ||
| 371 | ElMessage.warning(language.value == 0 ?'请填写验证码':'Please fill in your verification code') | ||
| 372 | return | ||
| 373 | } | ||
| 374 | if(!form.value.password){ | ||
| 375 | ElMessage.warning(language.value == 0 ?'请填写密码':'Please fill in your password') | ||
| 376 | return | ||
| 377 | } | ||
| 378 | if(!form.value.confirmPassword){ | ||
| 379 | ElMessage.warning(language.value == 0 ?'请再次填写密码':'Please fill in Confirm Password') | ||
| 380 | return | ||
| 381 | } | ||
| 368 | if (wdsfData.value.personFlag == '0') { | 382 | if (wdsfData.value.personFlag == '0') { |
| 369 | let obj = { | 383 | let obj = { |
| 370 | card: form.value.card, | 384 | card: form.value.card, |
| ... | @@ -445,6 +459,17 @@ function afterR() { | ... | @@ -445,6 +459,17 @@ function afterR() { |
| 445 | function forgetPassword(account) { | 459 | function forgetPassword(account) { |
| 446 | useUserStore().setReLogin({account: account, active: 2}) | 460 | useUserStore().setReLogin({account: account, active: 2}) |
| 447 | } | 461 | } |
| 462 | const ocrSuccess = (res) => { | ||
| 463 | wdsfData.value.passportUrl = res.data.url | ||
| 464 | if(res.code==200){ | ||
| 465 | wdsfData.value.passportUrl = res.data.url | ||
| 466 | wdsfData.value.passportNumber = res.data.code | ||
| 467 | wdsfData.value.birthday = res.data.birth?.slice(0, 10) | ||
| 468 | wdsfData.value.sex = res.data.sex | ||
| 469 | } else if(res.code==500){ | ||
| 470 | ElMessage.warning(res.msg) | ||
| 471 | } | ||
| 472 | } | ||
| 448 | </script> | 473 | </script> |
| 449 | 474 | ||
| 450 | <style scoped lang="scss"> | 475 | <style scoped lang="scss"> | ... | ... |
| ... | @@ -70,27 +70,25 @@ export default defineConfig(({ mode, command }) => { | ... | @@ -70,27 +70,25 @@ export default defineConfig(({ mode, command }) => { |
| 70 | rewrite: (p) => p.replace(/^\/dev-api\/ztx-train/, '') | 70 | rewrite: (p) => p.replace(/^\/dev-api\/ztx-train/, '') |
| 71 | }, | 71 | }, |
| 72 | '/dev-api/ztx-match': { | 72 | '/dev-api/ztx-match': { |
| 73 | // target: 'http://192.168.1.118:8083', | 73 | target: 'http://192.168.1.253:8081', |
| 74 | target: 'https://wdsfwuxicenter.com/stage-api/', | 74 | // target: 'https://wdsfwuxicenter.com/stage-api/', |
| 75 | changeOrigin: true, | 75 | changeOrigin: true, |
| 76 | rewrite: (p) => p.replace(/^\/dev-api\/ztx-match/, '') | 76 | rewrite: (p) => p.replace(/^\/dev-api\/ztx-match/, '') |
| 77 | }, | 77 | }, |
| 78 | '/dev-api/ztx-webSite': { | 78 | '/dev-api/ztx-webSite': { |
| 79 | target: 'https://wdsfwuxicenter.com/stage-api/', | 79 | target: 'http://192.168.1.253:8081', |
| 80 | changeOrigin: true, | 80 | changeOrigin: true, |
| 81 | rewrite: (p) => p.replace(/^\/dev-api\/ztx-webSite/, '') | 81 | rewrite: (p) => p.replace(/^\/dev-api\/ztx-webSite/, '') |
| 82 | }, | 82 | }, |
| 83 | '/dev-api': { | 83 | '/dev-api': { |
| 84 | // target: 'http://192.168.1.118:8081/', | 84 | // target: 'http://192.168.1.118:8081/', |
| 85 | // target: 'http://192.168.1.131:8081/', | 85 | target: 'http://192.168.1.253:8081', |
| 86 | target: 'https://jijin.wtwuxicenter.com/stage-api', | 86 | // target: 'https://jijin.wtwuxicenter.com/stage-api', |
| 87 | // target: 'http://124.70.181.90:1880/stage-api', | ||
| 88 | // target: 'https://wdsfwuxicenter.com/stage-api/', | 87 | // target: 'https://wdsfwuxicenter.com/stage-api/', |
| 89 | changeOrigin: true, | 88 | changeOrigin: true, |
| 90 | rewrite: (p) => p.replace(/^\/dev-api/, '') | 89 | rewrite: (p) => p.replace(/^\/dev-api/, '') |
| 91 | }, | 90 | }, |
| 92 | '/ticket': { | 91 | '/ticket': { |
| 93 | // target: 'http://192.168.1.131:8098/', | ||
| 94 | // target: 'http://192.168.1.131:8081/', | 92 | // target: 'http://192.168.1.131:8081/', |
| 95 | target: 'https://jijin.wtwuxicenter.com/h5/', | 93 | target: 'https://jijin.wtwuxicenter.com/h5/', |
| 96 | // target: 'https://ticketh5.wdsfwuxicenter.com/h5/', | 94 | // target: 'https://ticketh5.wdsfwuxicenter.com/h5/', | ... | ... |
-
Please register or sign in to post a comment