fix(KYC页面): 修复获取上一次注入图片的问题

This commit is contained in:
hzj 2025-11-13 15:03:49 +08:00
parent cfd80f05ba
commit 446d7cccd4
2 changed files with 21 additions and 4 deletions

16
src/stores/lastImg.js Normal file
View File

@ -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
},
},
})

View File

@ -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)