feat(KYC页): 更改图片上传方式

This commit is contained in:
hzj 2025-11-12 12:22:53 +08:00
parent e98f7002ac
commit 5c4033611f

View File

@ -60,11 +60,14 @@
src="/src/assets/icon/addImg.png" src="/src/assets/icon/addImg.png"
alt="" alt=""
style="display: block; width: 15vw; aspect-ratio: 1/1; object-fit: cover" style="display: block; width: 15vw; aspect-ratio: 1/1; object-fit: cover"
@click="triggerFileInput"
/> />
<input <input
ref="fileInputRef"
type="file" type="file"
accept="image/*"
@change="handleFileChange" @change="handleFileChange"
style="position: absolute; inset: 0; opacity: 0" style="display: none"
/> />
</div> </div>
@ -176,6 +179,8 @@ import { getWithdrawInfoList, addWithdrawInfo, updateWithdrawInfo } from '@/api/
const { t, locale } = useI18n() const { t, locale } = useI18n()
const router = useRouter() const router = useRouter()
const fileInputRef = ref(null)
// //
locale.value && setDocumentDirection(locale.value) locale.value && setDocumentDirection(locale.value)
@ -201,8 +206,35 @@ const checkStatus = computed(() => {
return applyInfo.value.contactNumber != '' && previewUrls.value.length > 0 return applyInfo.value.contactNumber != '' && previewUrls.value.length > 0
}) })
//
const triggerFileInput = () => {
console.log('触发文件选择')
if (fileInputRef.value) {
fileInputRef.value.click()
}
}
// () // ()
const handleFileChange = (e) => { const handleFileChange = (e) => {
console.log('=== 文件选择事件开始 ===')
try {
//
if (!e.target.files || e.target.files.length === 0) {
console.warn('No files selected or unsupported environment')
//
console.log(
'触发条件: !e.target=',
!e.target,
', !e.target.files=',
!e.target.files,
', e.target.files.length === 0=',
e.target.files?.length === 0
)
return
}
// 3 // 3
if (previewUrls.value.length < 3) { if (previewUrls.value.length < 3) {
const fileList = e.target.files // const fileList = e.target.files //
@ -233,6 +265,9 @@ const handleFileChange = (e) => {
} else { } else {
showWarning(t('max_images_warning')) showWarning(t('max_images_warning'))
} }
} catch (error) {
console.error('File selection error:', error)
}
} }
const handleCancel = (index) => { const handleCancel = (index) => {