From 446d7cccd41ceef0c7f284abbf6c87e40854d5e8 Mon Sep 17 00:00:00 2001 From: hzj <1304805162@qq.com> Date: Thu, 13 Nov 2025 15:03:49 +0800 Subject: [PATCH] =?UTF-8?q?fix(KYC=E9=A1=B5=E9=9D=A2):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E8=8E=B7=E5=8F=96=E4=B8=8A=E4=B8=80=E6=AC=A1=E6=B3=A8?= =?UTF-8?q?=E5=85=A5=E5=9B=BE=E7=89=87=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stores/lastImg.js | 16 ++++++++++++++++ src/views/Wallet/CashOut/KYC.vue | 9 +++++---- 2 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 src/stores/lastImg.js diff --git a/src/stores/lastImg.js b/src/stores/lastImg.js new file mode 100644 index 0000000..229bbad --- /dev/null +++ b/src/stores/lastImg.js @@ -0,0 +1,16 @@ +import { defineStore } from 'pinia' + +export const useLastImgStore = defineStore('lastImg', { + state: () => ({ + imgUrl: null, + }), + actions: { + setLastImgUrl(lastImgUrl) { + this.imgUrl = lastImgUrl + }, + + clearCache() { + this.imgUrl = null + }, + }, +}) diff --git a/src/views/Wallet/CashOut/KYC.vue b/src/views/Wallet/CashOut/KYC.vue index 2a01c03..f8c863e 100644 --- a/src/views/Wallet/CashOut/KYC.vue +++ b/src/views/Wallet/CashOut/KYC.vue @@ -195,9 +195,13 @@ import { uploadImg } from '@/api/upload.js' import { setDocumentDirection } from '@/locales/i18n' import { getWithdrawInfoList, addWithdrawInfo, updateWithdrawInfo } from '@/api/wallet' import { uploadImgFile, parseAccessOrigin } from '@/utils/uploadFiles.js' +import { useLastImgStore } from '@/stores/lastImg' +import { storeToRefs } from 'pinia' const { t, locale } = useI18n() const router = useRouter() +const lastImgStore = useLastImgStore() //获取图片缓存 +const { imgUrl: lastImgUrl } = storeToRefs(lastImgStore) //国家信息 // 监听语言变化并设置文档方向 locale.value && setDocumentDirection(locale.value) @@ -207,7 +211,6 @@ const count = computed(() => applyInfo.value.otherDescription.length) //字数 const tempFiles = ref([]) //用于提交的临时图片文件列表 // const previewUrls = ref([]) //预览图片数组 const resImgUrls = ref([]) //用于提交申请的图片数组 -const lastImgUrl = ref(null) //上一次最新添加的图片 const updateStatus = ref(false) //是否为修改 @@ -294,7 +297,7 @@ const callNativeImagePicker = async () => { const file = result.data console.log('接收到原生图片数据:', file.path) - lastImgUrl.value = file.path // 更新上一次实际选择的图片路径 + lastImgStore.setLastImgUrl(file.path) // 更新上一次实际选择的图片路径 // 生成预览图 resImgUrls.value.push(file.path) resolve() @@ -368,8 +371,6 @@ const getWithdrawInfoListData = async () => { applyInfo.value = resWithdrawInfoList.body[0] let imgList = JSON.parse(resWithdrawInfoList.body[0].passportFrontUrl) resImgUrls.value = imgList.map((item) => item) - lastImgUrl.value = - resImgUrls.value.length > 0 ? resImgUrls.value[resImgUrls.value.length - 1] : null } } catch (error) { console.error('获取提现信息列表失败:', error)