From ae808c0439ccf2f5cf82eee145cf4e5e2a670572 Mon Sep 17 00:00:00 2001
From: hzj <1304805162@qq.com>
Date: Wed, 12 Nov 2025 17:49:24 +0800
Subject: [PATCH] =?UTF-8?q?test(KYC=E9=A1=B5):=20=E6=B5=8B=E8=AF=95?=
=?UTF-8?q?=E5=9B=BE=E7=89=87=E4=B8=8A=E4=BC=A0=E6=96=B9=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/utils/uploadFiles.js | 18 +++++++++++----
src/views/Wallet/CashOut/KYC.vue | 39 ++++++++++++++++++++------------
2 files changed, 38 insertions(+), 19 deletions(-)
diff --git a/src/utils/uploadFiles.js b/src/utils/uploadFiles.js
index d9cae70..4c84633 100644
--- a/src/utils/uploadFiles.js
+++ b/src/utils/uploadFiles.js
@@ -11,21 +11,31 @@ export function android() {
* @param {Function} renderFun 回调函数,接收APP传递的access参数
*/
export function uploadImgFile(renderFun) {
+ // 设置全局回调函数,供原生App调用
window.renderData = renderFun
+ // iOS平台兼容
+ window.getIosAccessOriginParam = renderFun
try {
if (window.app && window.app.uploadImgFile) {
- console.log('使用uploadImgFile')
+ console.log('使用window.app.uploadImgFile')
// 使用注入的方法
const result = window.app.uploadImgFile()
- console.log('uploadImgFile 返回结果:', result)
+ console.log('uploadImgFile返回结果:', result)
renderFun(result)
} else if (window.FlutterPageControl) {
// 直接使用Flutter通道
- window.FlutterPageControl.postMessage(`正在调用uploadImgFile`)
+ window.FlutterPageControl.postMessage(`需要调用uploadImgFile`)
+ } else {
+ // 降级处理
+ const mockAccess = JSON.stringify('')
+ renderFun(mockAccess)
}
} catch (error) {
- console.error('上传图片失败:', error)
+ console.error('调出图片选择界面失败:', error)
+ // 异常情况下的兜底处理
+ const mockAccess = JSON.stringify('')
+ renderFun(mockAccess)
}
}
diff --git a/src/views/Wallet/CashOut/KYC.vue b/src/views/Wallet/CashOut/KYC.vue
index 34ddd5d..6474e9a 100644
--- a/src/views/Wallet/CashOut/KYC.vue
+++ b/src/views/Wallet/CashOut/KYC.vue
@@ -62,8 +62,7 @@
style="display: block; width: 15vw; aspect-ratio: 1/1; object-fit: cover"
/>
-
+ /> -->
{
return applyInfo.value.contactNumber != '' && previewUrls.value.length > 0
})
+// 点击图片选择按钮
+const onClickImagePicker = async () => {
+ try {
+ await callNativeImagePicker()
+ } catch (error) {
+ console.error('图片选择失败:', error)
+ // 可以在这里添加额外的错误处理逻辑
+ }
+}
+
// 调用原生图片选择器
const callNativeImagePicker = () => {
console.log('调用原生图片选择器')
@@ -238,7 +247,7 @@ const callNativeImagePicker = () => {
// 最多3张图片
if (previewUrls.value.length >= 3) {
showWarning(t('max_images_warning'))
- return Promise.resolve() // 或者返回 rejected Promise
+ return Promise.reject(new Error('Maximum number of images reached'))
}
return new Promise((resolve, reject) => {
@@ -258,16 +267,16 @@ const callNativeImagePicker = () => {
const file = result.data
console.log('接收到原生图片数据:', file)
- // 生成预览图(需要根据实际数据格式调整)
- if (typeof file === 'string' && (file.startsWith('http') || file.startsWith('data:'))) {
- // 如果是URL或base64数据
- previewUrls.value.push(file)
- tempFiles.value.push(file) // 保存原始数据用于上传
- } else {
- // 如果是文件对象或其他格式,需要相应处理
- previewUrls.value.push(file)
- tempFiles.value.push(file)
- }
+ // // 生成预览图(需要根据实际数据格式调整)
+ // if (typeof file === 'string' && (file.startsWith('http') || file.startsWith('data:'))) {
+ // // 如果是URL或base64数据
+ // previewUrls.value.push(file)
+ // tempFiles.value.push(file) // 保存原始数据用于上传
+ // } else {
+ // // 如果是文件对象或其他格式,需要相应处理
+ // previewUrls.value.push(file)
+ // tempFiles.value.push(file)
+ // }
showSuccess(t('image_selected_success'))
resolve()