feat(KYC页面): 修复获取上一次注入图片的问题
This commit is contained in:
parent
7248e362b2
commit
5268820610
@ -207,6 +207,9 @@ const count = computed(() => applyInfo.value.otherDescription.length) //字数
|
||||
const tempFiles = ref([]) //用于提交的临时图片文件列表
|
||||
// const previewUrls = ref([]) //预览图片数组
|
||||
const resImgUrls = ref([]) //用于提交申请的图片数组
|
||||
const lastImgUrl = computed(() => {
|
||||
return resImgUrls.value.length > 0 ? resImgUrls.value[resImgUrls.value.length - 1] : null
|
||||
}) //上一次最新添加的图片
|
||||
|
||||
const updateStatus = ref(false) //是否为修改
|
||||
|
||||
@ -243,9 +246,6 @@ const callNativeImagePicker = async () => {
|
||||
throw new Error('Maximum number of images reached')
|
||||
}
|
||||
|
||||
// 记录当前所有已选图片路径,用于去重判断
|
||||
const existingImagePaths = new Set(resImgUrls.value)
|
||||
|
||||
// 定义过滤函数
|
||||
const filterDuplicateImages = (access) => {
|
||||
try {
|
||||
@ -261,7 +261,7 @@ const callNativeImagePicker = async () => {
|
||||
console.log('检查图片数据:', file.path)
|
||||
|
||||
// 如果是已存在的图片,返回false表示需要继续检查
|
||||
if (existingImagePaths.has(file.path)) {
|
||||
if (lastImgUrl.value && file.path === lastImgUrl.value) {
|
||||
console.log('检测到重复图片,继续等待新图片...')
|
||||
return false
|
||||
}
|
||||
@ -296,13 +296,7 @@ const callNativeImagePicker = async () => {
|
||||
const file = result.data
|
||||
console.log('接收到原生图片数据:', file.path)
|
||||
|
||||
if (existingImagePaths.has(file.path)) {
|
||||
console.log('检测到重复图片,继续等待新图片...')
|
||||
// 不处理重复图片,继续等待新的图片数据
|
||||
// 这里不调用 resolve 或 reject,让 uploadImgFile 继续检查
|
||||
return
|
||||
}
|
||||
|
||||
lastImgUrl.value = file.path // 更新上一次实际选择的图片路径
|
||||
// 生成预览图
|
||||
resImgUrls.value.push(file.path)
|
||||
resolve()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user