@uxda/appkit 4.1.42 → 4.1.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxda/appkit",
3
- "version": "4.1.42",
3
+ "version": "4.1.46",
4
4
  "description": "小程序应用开发包",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.ts",
@@ -1,12 +1,12 @@
1
1
  <template>
2
- <div class="promoter-card">
2
+ <div class="promoter-card" v-if="applyRecord.distributorFlag === 'Y' || applyRecord.accessCheckStatus === 'Y'">
3
3
  <div class="promoter-card-tab" v-if="useCase === 'company' && isAdmin">
4
4
  <div class="promoter-card-tab-item" @click="onTabChange('person')" :class="{ focus: tab === 'person' }">个人</div>
5
5
  <div class="promoter-card-tab-item" @click="onTabChange('company')" :class="{ focus: tab === 'company' }">企业</div>
6
6
  </div>
7
7
  <div class="promoter-card-hd" @click="emits('blance', tab)"
8
8
  v-if="applyRecord.distributorFlag === 'Y' || applyRecord.accessCheckStatus === 'Y'">
9
- <div class="promoter-card-hd-num">{{ promoter.total }}</div>
9
+ <div class="promoter-card-hd-num">{{ promoter.balance }}</div>
10
10
  <div class="promoter-card-hd-info">可提现余额(元)</div>
11
11
  <img class="arrow-img" src="https://cdn.ddjf.com/static/images/appkit/arrow.png" alt="">
12
12
  </div>
@@ -32,7 +32,7 @@
32
32
  </template>
33
33
 
34
34
  <script setup lang="ts">
35
- import { ref } from 'vue'
35
+ import { ref, watch } from 'vue'
36
36
  import { endpoints, useHttp } from '../api'
37
37
  import { Promoter } from '../types'
38
38
  import { useDidShow } from '@tarojs/taro'
@@ -68,7 +68,7 @@ async function loadPromoter() {
68
68
  useCase: tab.value,
69
69
  })
70
70
  .then((data) => {
71
- promoter.value.total = data?.total || 0
71
+ promoter.value.balance = data?.balance || 0
72
72
  promoter.value.totalIncome = data?.totalIncome || 0
73
73
  promoter.value.totalRebateIncome = data?.totalRebateIncome || 0
74
74
  })
@@ -90,7 +90,10 @@ const emits = defineEmits([
90
90
  ])
91
91
 
92
92
  useDidShow(() => {
93
- loadPromoter()
93
+ Object.keys(props.applyRecord)?.length && loadPromoter()
94
+ })
95
+ watch(() => props.applyRecord, () => {
96
+ Object.keys(props.applyRecord)?.length && loadPromoter()
94
97
  })
95
98
 
96
99
  defineExpose({
@@ -91,7 +91,7 @@ export type 权益类目 = {
91
91
  }
92
92
 
93
93
  export type Promoter = {
94
- total: number
94
+ balance: number
95
95
  totalIncome: number
96
96
  totalRebateIncome: number
97
97
  }
@@ -1,7 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { reactive } from 'vue'
3
- import OcrId from './../../components/ocr-id/index.vue'
4
- import { OcrResultType } from '../../components/ocr-id/types'
3
+ import OcrIcon from '../../shared/components/OcrIcon.vue'
5
4
  import DdArea from './../../components/dd-area/index.vue'
6
5
  import DdSelector from './../../components/dd-selector/index.vue'
7
6
  import Taro from '@tarojs/taro'
@@ -46,10 +45,10 @@ const positionOptions = [
46
45
 
47
46
  const emit = defineEmits(['submit'])
48
47
 
49
- function onOCRInfo(payload: OcrResultType) {
48
+ function onOCRInfo(payload: any) {
50
49
  if (!payload) return
51
- formState.name = payload.faceInfo.name
52
- formState.certNo = payload.faceInfo.certNo
50
+ formState.name = payload?.faceInfo.name
51
+ formState.certNo = payload?.faceInfo.certNo
53
52
  }
54
53
 
55
54
  function showVerifyToast(tip: string, duration = 1500) {
@@ -124,25 +123,18 @@ async function submit() {
124
123
  </nut-form-item>
125
124
  <nut-form-item label="你的姓名" required>
126
125
  <div class="self-registration__input">
127
- <input
128
- v-model="formState.name"
129
- class="nut-input-text"
130
- placeholder="请输入或拍照识别"
131
- type="text"
132
- :maxlength="20"
133
- />
134
- <OcrId @ocr="onOCRInfo" style="margin-left: 5px" />
126
+ <input v-model="formState.name" class="nut-input-text" placeholder="请输入或拍照识别" type="text" :maxlength="20" />
127
+ <OcrIcon @complete="onOCRInfo">
128
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jAyNWMtLjExLS4zOTYtLjYzOS0uNjc0LTEuMDQ1LS42NzRoLTE0LjljLS4zOTkgMC0uOTUuMzY2LTEuMDUzLjY5OWwtMS4xMzYgMy42NmMtLjI0Ny43ODYtMS4wNDUgMS4zMy0xLjk1NSAxLjMzMkg0LjU2NGMtMS4zOTcgMC0yLjUzNiAxLjAyMi0yLjUzNiAyLjI3NnYxNy4wMjRjMCAxLjI1NCAxLjEzOSAyLjI3NiAyLjUzNiAyLjI3NmgzMC44N2MxLjM5NyAwIDIuNTM1LTEuMDIyIDIuNTM1LTIuMjc2VjIxLjU5NmMwLS41MDMuNDU0LS45MSAxLjAxNC0uOTFzMS4wMTUuNDA3IDEuMDE1LjkxVjMxLjgxYy0uMDAzIDIuMjYtMi4wNSA0LjEtNC41NjcgNC4xSDQuNTY0QzIuMDQ5IDM1LjkxIDAgMzQuMDcgMCAzMS44MTF6IiBmaWxsPSIjNEJDQjkzIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMi4xNzQgMjEuNzc4YzAtNC44NyAzLjcwNS04LjgzIDguMjYtOC44MyA0LjU1NiAwIDguMjYyIDMuOTYgOC4yNjIgOC44M3MtMy43MDYgOC44MzItOC4yNjEgOC44MzJjLTQuNTU2IDAtOC4yNjEtMy45NjItOC4yNjEtOC44MzJ6bTEuNzc5LjEzYzAgMy43OTYgMi45MDcgNi44ODMgNi40ODIgNi44ODMgMy41NzQgMCA2LjQ4MS0zLjA4NyA2LjQ4MS02Ljg4M3MtMi45MDctNi44ODMtNi40ODItNi44ODNjLTMuNTc0IDAtNi40ODEgMy4wODctNi40ODEgNi44ODN6IiBmaWxsPSIjNEJDQjkzIi8+PC9zdmc+" />
131
+ </template>
132
+ </OcrIcon>
135
133
  </div>
136
134
  </nut-form-item>
137
135
 
138
136
  <nut-form-item v-if="formState.scene === 'person'" label="身份证号码" required>
139
- <input
140
- v-model="formState.certNo"
141
- class="nut-input-text"
142
- placeholder="请输入"
143
- type="text"
144
- :maxlength="18"
145
- />
137
+ <input v-model="formState.certNo" class="nut-input-text" placeholder="请输入" type="text" :maxlength="18" />
146
138
  </nut-form-item>
147
139
 
148
140
  <template v-else>
@@ -150,22 +142,11 @@ async function submit() {
150
142
  <DdSelector v-model:value="formState.position" :options="positionOptions" />
151
143
  </nut-form-item>
152
144
  <nut-form-item label="公司名称" required>
153
- <input
154
- v-model="formState.companyName"
155
- class="nut-input-text"
156
- placeholder="请输入"
157
- type="text"
158
- :maxlength="50"
159
- />
145
+ <input v-model="formState.companyName" class="nut-input-text" placeholder="请输入" type="text"
146
+ :maxlength="50" />
160
147
  </nut-form-item>
161
148
  <nut-form-item label="社会统一信用代码" required>
162
- <input
163
- v-model="formState.companyNo"
164
- class="nut-input-text"
165
- placeholder="请输入"
166
- type="text"
167
- :maxlength="18"
168
- />
149
+ <input v-model="formState.companyNo" class="nut-input-text" placeholder="请输入" type="text" :maxlength="18" />
169
150
  </nut-form-item>
170
151
  <nut-form-item label="所在地区" required>
171
152
  <DdArea v-model:value="formState.areaCode" type="city" placeholder="请选择" />
@@ -174,9 +155,7 @@ async function submit() {
174
155
  </nut-form>
175
156
  </div>
176
157
  <div class="self-registration-bottom">
177
- <nut-button block type="primary" class="experience-button" @click="submit"
178
- >立即体验</nut-button
179
- >
158
+ <nut-button block type="primary" class="experience-button" @click="submit">立即体验</nut-button>
180
159
  </div>
181
160
  </div>
182
161
  </template>
@@ -1,9 +1,5 @@
1
1
  <template>
2
- <div
3
- :class="['ocr-business-license', disabled ? 'disabled' : '']"
4
- class="ocr-icon"
5
- @click="onIconClick"
6
- >
2
+ <div :class="['ocr-business-license', disabled ? 'disabled' : '']" class="ocr-icon" @click="onIconClick">
7
3
  <ns-icon name="https://cdn.ddjf.com/static/images/beidouxing/ocr-icon.png" />
8
4
  </div>
9
5
  </template>
@@ -82,7 +78,6 @@ async function onIconClick() {
82
78
  objectNo: `min${Date.now()}`,
83
79
  },
84
80
  header: {
85
- sessionKey: session || '',
86
81
  token: session || '',
87
82
  },
88
83
  });
@@ -120,10 +115,12 @@ async function onIconClick() {
120
115
  .ocr-business-license {
121
116
  width: 24px;
122
117
  height: 24px;
118
+
123
119
  .ns-icon {
124
120
  width: 24px;
125
121
  height: 24px;
126
122
  }
123
+
127
124
  &.disabled {
128
125
  .ns-icon {
129
126
  filter: brightness(1.5) grayscale(1);
@@ -1,29 +1,53 @@
1
1
  <template>
2
- <div :class="['ocr-icon', disabled ? 'disabled' : '']" @click="onIconClick">
3
- <ns-icon name="https://cdn.ddjf.com/static/images/beidouxing/ocr-icon.png" />
4
- </div>
2
+ <div class="ocr-icon" :class="[disabled ? 'disabled' : '']" @click="onPhotograph">
3
+ <slot name="icon">
4
+ <ns-icon name="https://cdn.ddjf.com/static/images/beidouxing/ocr-icon.png" />
5
+ </slot>
6
+ </div>
7
+
8
+ <nut-action-sheet v-model:visible="activeSheetVisible" :menu-items="actionSheetMenus" @choose="chooseImages"
9
+ cancel-txt="取消" />
5
10
  </template>
6
11
 
7
12
  <script lang="ts" setup>
8
- import Taro from '@tarojs/taro';
9
- import { NsIcon } from '@uxda/nutshell/taro';
10
- import { useAppKitOptions } from '../../Appkit';
13
+ import Taro from '@tarojs/taro'
14
+ import { NsIcon } from '@uxda/nutshell/taro'
15
+ import { useAppKitOptions } from '../../Appkit'
16
+ import { ref } from 'vue';
11
17
 
12
- const appKitOptions = useAppKitOptions();
18
+ const appKitOptions = useAppKitOptions()
13
19
 
14
- const emits = defineEmits(['complete']);
20
+ const emits = defineEmits(['complete'])
15
21
 
16
22
  type OcrIconProps = {
17
- disabled: boolean;
18
- };
23
+ disabled?: boolean,
24
+ side?: 'face' | 'back',
25
+ class?: string
26
+ }
19
27
 
20
- const props = defineProps<OcrIconProps>();
28
+ const props = withDefaults(defineProps<OcrIconProps>(), {
29
+ disabled: false,
30
+ side: 'face',
31
+ class: ''
32
+ })
21
33
 
22
- export type OcrResult = {
23
- name: string;
24
- number: string;
25
- address: string;
26
- };
34
+ type OcrResultType = {
35
+ faceInfo: {
36
+ name: string
37
+ certNo: string
38
+ address: string
39
+ }
40
+ backInfo: {
41
+ startDate: string
42
+ endDate: string
43
+ }
44
+ fileUploadVO: {
45
+ fileKey: string
46
+ fileUrl: string
47
+ objectNo: string
48
+ thumbnailUrl?: string
49
+ }
50
+ }
27
51
 
28
52
  async function taroImgCompress(src: string, quality = 80) {
29
53
  return new Promise((resolve, reject) => {
@@ -31,88 +55,129 @@ async function taroImgCompress(src: string, quality = 80) {
31
55
  src: src,
32
56
  quality: quality,
33
57
  success: (res) => {
34
- resolve(res);
58
+ resolve(res)
35
59
  },
36
60
  fail: (res) => {
37
- reject(res);
61
+ reject(res)
38
62
  },
39
- });
40
- });
63
+ })
64
+ })
41
65
  }
42
66
 
43
67
  function getCompressQuality(size: number) {
44
- let quality = 100;
45
- const curSize = size / (1024 * 1024);
68
+ let quality = 100
69
+ const curSize = size / (1024 * 1024)
46
70
  if (curSize > 6) {
47
- quality = quality - ((curSize - 6) / curSize) * 100;
71
+ quality = quality - ((curSize - 6) / curSize) * 100
48
72
  }
49
- return quality;
73
+ return quality
50
74
  }
51
75
 
52
76
  function allTrim(str: string) {
53
- return str.replace(/\s+/g, '');
77
+ return str.replace(/\s+/g, '')
54
78
  }
55
79
 
56
- async function onIconClick() {
57
- if (props.disabled) {
58
- return;
59
- }
60
- let result: OcrResult | null = null;
80
+ async function onUploadFile(csRes: any) {
81
+ let result: OcrResultType | null = null
61
82
  try {
62
- const csRes = await Taro.chooseImage({
63
- count: 1,
64
- });
65
- let { path, size } = csRes.tempFiles[0];
66
- const compressImg: any =
67
- (await taroImgCompress(path, getCompressQuality(size))) || {};
68
- const filePath = compressImg.tempFilePath || path;
69
- Taro.showLoading({ title: '身份证识别中..' });
70
- const session = appKitOptions.token();
71
- const baseUrl = appKitOptions.baseUrl();
83
+ let { path, size, tempFilePath } = csRes.tempFiles[0]
84
+ const compressImg: any = (await taroImgCompress(path || tempFilePath, getCompressQuality(size))) || {}
85
+ const filePath = compressImg.tempFilePath || path
86
+ Taro.showLoading({ title: '身份证识别中..' })
87
+
88
+ const session = appKitOptions.token()
89
+ const baseUrl = appKitOptions.baseUrl()
72
90
  const upRes: any = await Taro.uploadFile({
73
91
  url: baseUrl + '/hkapprove/ocr/idcard',
74
92
  filePath,
75
93
  name: 'file',
76
94
  formData: {
77
95
  objectNo: `min${Date.now()}`,
78
- side: 'face',
96
+ side: props.side,
79
97
  },
80
98
  header: {
81
- sessionKey: session || '',
82
99
  token: session || '',
83
100
  },
84
- });
85
- Taro.hideLoading();
86
- const res = JSON.parse(upRes.data);
101
+ })
102
+ Taro.hideLoading()
103
+
104
+ const res = JSON.parse(upRes.data)
87
105
  if (res.code === '200') {
88
- const faceInfo = res.result.faceInfo || {},
89
- file = res.result.fileUploadVO;
106
+ const faceInfo = res.result.faceInfo || {}
107
+ const backInfo = res.result.backInfo || {}
90
108
  result = {
91
- name: allTrim(faceInfo.name || ''),
92
- number: allTrim(faceInfo.num || ''),
93
- address: allTrim(faceInfo.address || ''),
94
- // file: {
95
- // key: file.fileKey,
96
- // url: file.fileUrl,
97
- // object: file.objectNo,
98
- // thumb: file.thumbnailUrl
99
- // }
100
- };
101
- console.log('===识别', result);
102
- if (!result.name && !result.number) {
103
- Taro.showToast({ title: '识别失败,请重试', icon: 'none' });
109
+ faceInfo: {
110
+ name: allTrim(faceInfo.name || ''),
111
+ certNo: allTrim(faceInfo.num || ''),
112
+ address: allTrim(faceInfo.address || ''),
113
+ },
114
+ backInfo: {
115
+ startDate: backInfo?.startDate || '',
116
+ endDate: backInfo?.endDate || ''
117
+ },
118
+ fileUploadVO: res.result.fileUploadVO || {},
119
+ }
120
+ console.log('===识别', result)
121
+ if (props.side === 'face' && !result.faceInfo.name && !result.faceInfo.certNo) {
122
+ Taro.showToast({ title: '识别失败,请重试', icon: 'none' })
123
+ }
124
+ if (props.side === 'back' && !result.backInfo?.startDate && !result.backInfo?.endDate) {
125
+ Taro.showToast({ title: '识别失败,请重试', icon: 'none' })
104
126
  }
105
127
  } else {
106
128
  Taro.showToast({
107
129
  title: res.msg,
108
130
  icon: 'error',
109
- });
131
+ })
110
132
  }
111
133
  } catch (err) {
112
- Taro.hideLoading();
113
- console.log(err);
134
+ Taro.hideLoading()
135
+ console.log(err)
114
136
  }
115
- emits('complete', result);
137
+ emits('complete', result)
138
+ }
139
+
140
+
141
+ // 上传图片操作面板
142
+ const activeSheetVisible = ref(false)
143
+ const actionSheetMenus = [
144
+ {
145
+ name: '拍摄',
146
+ type: 'camera',
147
+ },
148
+ {
149
+ name: '从相册选择',
150
+ type: 'album',
151
+ },
152
+ {
153
+ name: '从聊天会话选择',
154
+ type: 'message',
155
+ },
156
+ ]
157
+ // 选择图像上传
158
+ async function chooseImages(item: any) {
159
+ if (['camera', 'album'].includes(item.type)) {
160
+ const csRes = await Taro.chooseMedia({
161
+ count: 1,
162
+ sourceType: [item.type], // "camera" | "album"
163
+ maxDuration: 60, // 使用duration属性判断是图片还是视频,图片没有该属性
164
+ })
165
+
166
+ onUploadFile(csRes)
167
+ } else {
168
+ const csRes = await Taro.chooseMessageFile({
169
+ count: 1,
170
+ type: 'image',
171
+ })
172
+
173
+ onUploadFile(csRes)
174
+ }
175
+ }
176
+
177
+ function onPhotograph() {
178
+ if (props.disabled) return
179
+
180
+ activeSheetVisible.value = true
116
181
  }
117
182
  </script>
118
183
 
@@ -120,10 +185,14 @@ async function onIconClick() {
120
185
  .ocr-icon {
121
186
  width: 24px;
122
187
  height: 24px;
188
+ display: inline-flex;
189
+ align-items: center;
190
+
123
191
  .ns-icon {
124
192
  width: 24px;
125
193
  height: 24px;
126
194
  }
195
+
127
196
  &.disabled {
128
197
  .ns-icon {
129
198
  filter: brightness(1.5) grayscale(1);
@@ -1,114 +0,0 @@
1
- <script setup lang="ts">
2
- import Taro from '@tarojs/taro'
3
- import { OcrResultType } from './types'
4
- import { useAppKitOptions } from '../../Appkit'
5
-
6
- const emits = defineEmits(['ocr'])
7
-
8
- const appKitOptions = useAppKitOptions()
9
-
10
- // 压缩图片
11
- async function taroImgCompress(src: string, quality = 80) {
12
- return new Promise((resolve, reject) => {
13
- Taro.compressImage({
14
- src: src,
15
- quality: quality,
16
- success: (res) => {
17
- resolve(res)
18
- },
19
- fail: (res) => {
20
- reject(res)
21
- },
22
- })
23
- })
24
- }
25
-
26
- // 压缩质量
27
- function getCompressQuality(size: number) {
28
- let quality = 100
29
- const curSize = size / (1024 * 1024)
30
- if (curSize > 6) {
31
- quality = quality - ((curSize - 6) / curSize) * 100
32
- }
33
- return quality
34
- }
35
-
36
- // 清除字符串内空格
37
- function allTrim(str: string) {
38
- return str.replace(/\s+/g, '')
39
- }
40
-
41
- // 拍照识别
42
- async function ocrIDCard() {
43
- let ocrResult: OcrResultType = null
44
- try {
45
- const csRes = await Taro.chooseImage({
46
- count: 1,
47
- })
48
- let { path, size } = csRes.tempFiles[0]
49
- const compressImg: any = (await taroImgCompress(path, getCompressQuality(size))) || {}
50
- const filePath = compressImg.tempFilePath || path
51
- Taro.showLoading({ title: '身份证识别中..' })
52
- const session = appKitOptions.token()
53
- const baseUrl = appKitOptions.baseUrl()
54
- const upRes: any = await Taro.uploadFile({
55
- url: baseUrl + '/hkapprove/ocr/idcard',
56
- filePath,
57
- name: 'file',
58
- formData: {
59
- objectNo: `min${Date.now()}`,
60
- side: 'face',
61
- },
62
- header: {
63
- sessionKey: session || '',
64
- token: session || '',
65
- },
66
- })
67
- Taro.hideLoading()
68
- const res = JSON.parse(upRes.data)
69
- if (res.code === '200') {
70
- const faceInfo = res.result.faceInfo || {}
71
- ocrResult = {
72
- faceInfo: {
73
- name: allTrim(faceInfo.name || ''),
74
- certNo: allTrim(faceInfo.num || ''),
75
- address: allTrim(faceInfo.address || ''),
76
- },
77
- fileUploadVO: res.result.fileUploadVO || {},
78
- }
79
- if (!ocrResult.faceInfo.name && !ocrResult.faceInfo.certNo) {
80
- Taro.showToast({ title: '识别失败,请重试', icon: 'none' })
81
- }
82
- } else {
83
- Taro.showToast({
84
- title: res.msg,
85
- icon: 'error',
86
- })
87
- }
88
- } catch (err) {
89
- Taro.hideLoading()
90
- console.log(err)
91
- }
92
- emits('ocr', ocrResult)
93
- }
94
- </script>
95
-
96
- <template>
97
- <div class="ocr-id" @click="ocrIDCard">
98
- <slot name="icon">
99
- <img
100
- class="ocr-id__img"
101
- src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgZmlsbD0ibm9uZSI+PHBhdGggb3BhY2l0eT0iLjAxIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTQwIDB2NDBIMFYwaDQweiIgZmlsbD0iI0M0QzRDNCIvPjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNMzMuMDQ0IDE3LjM2M2MuOTYgMCAxLjczOS0uNzkgMS43MzktMS43NjYgMC0uOTc1LS43NzktMS43NjYtMS43NC0xLjc2Ni0uOTYgMC0xLjczOC43OS0xLjczOCAxLjc2NnMuNzc4IDEuNzY2IDEuNzM5IDEuNzY2eiIgZmlsbD0iIzRCQ0I5MyIvPjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNMCAzMS44MTJWMTQuNzg4YzAtMi4yNTggMi4wNDktNC4wOTcgNC41NjQtNC4wOTdoMy44NDRsMS4xMzYtMy42NThDOS44ODggNS45MTMgMTEuMjM3IDUgMTIuNTQ4IDVIMjcuNDVjMS4zOSAwIDIuNjguODc2IDMuMDEgMi4wNDRsMS4xMzMgMy42NDdoMy44NDRjMi41MTUgMCA0LjU2NCAxLjgzOSA0LjU2NCA0LjA5N3YxLjczOWMwIC41MDMtLjQ1NC45MS0xLjAxNC45MXMtMS4wMTQtLjQwNy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44ODN6IiBmaWxsPSIjNEJDQjkzIi8+PC9zdmc+"
102
- />
103
- </slot>
104
- </div>
105
- </template>
106
-
107
- <style lang="scss">
108
- .ocr-id {
109
- &__img {
110
- width: 20px;
111
- height: 20px;
112
- }
113
- }
114
- </style>
@@ -1,13 +0,0 @@
1
- export type OcrResultType = {
2
- faceInfo: {
3
- name: string
4
- certNo: string
5
- address: string
6
- }
7
- fileUploadVO: {
8
- fileKey: string
9
- fileUrl: string
10
- objectNo: string
11
- thumbnailUrl?: string
12
- }
13
- } | null