fix(KYC页面): 修复获取上一次注入图片的问题
This commit is contained in:
parent
cfd80f05ba
commit
446d7cccd4
16
src/stores/lastImg.js
Normal file
16
src/stores/lastImg.js
Normal 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
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
@ -195,9 +195,13 @@ import { uploadImg } from '@/api/upload.js'
|
|||||||
import { setDocumentDirection } from '@/locales/i18n'
|
import { setDocumentDirection } from '@/locales/i18n'
|
||||||
import { getWithdrawInfoList, addWithdrawInfo, updateWithdrawInfo } from '@/api/wallet'
|
import { getWithdrawInfoList, addWithdrawInfo, updateWithdrawInfo } from '@/api/wallet'
|
||||||
import { uploadImgFile, parseAccessOrigin } from '@/utils/uploadFiles.js'
|
import { uploadImgFile, parseAccessOrigin } from '@/utils/uploadFiles.js'
|
||||||
|
import { useLastImgStore } from '@/stores/lastImg'
|
||||||
|
import { storeToRefs } from 'pinia'
|
||||||
|
|
||||||
const { t, locale } = useI18n()
|
const { t, locale } = useI18n()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const lastImgStore = useLastImgStore() //获取图片缓存
|
||||||
|
const { imgUrl: lastImgUrl } = storeToRefs(lastImgStore) //国家信息
|
||||||
|
|
||||||
// 监听语言变化并设置文档方向
|
// 监听语言变化并设置文档方向
|
||||||
locale.value && setDocumentDirection(locale.value)
|
locale.value && setDocumentDirection(locale.value)
|
||||||
@ -207,7 +211,6 @@ const count = computed(() => applyInfo.value.otherDescription.length) //字数
|
|||||||
const tempFiles = ref([]) //用于提交的临时图片文件列表
|
const tempFiles = ref([]) //用于提交的临时图片文件列表
|
||||||
// const previewUrls = ref([]) //预览图片数组
|
// const previewUrls = ref([]) //预览图片数组
|
||||||
const resImgUrls = ref([]) //用于提交申请的图片数组
|
const resImgUrls = ref([]) //用于提交申请的图片数组
|
||||||
const lastImgUrl = ref(null) //上一次最新添加的图片
|
|
||||||
|
|
||||||
const updateStatus = ref(false) //是否为修改
|
const updateStatus = ref(false) //是否为修改
|
||||||
|
|
||||||
@ -294,7 +297,7 @@ const callNativeImagePicker = async () => {
|
|||||||
const file = result.data
|
const file = result.data
|
||||||
console.log('接收到原生图片数据:', file.path)
|
console.log('接收到原生图片数据:', file.path)
|
||||||
|
|
||||||
lastImgUrl.value = file.path // 更新上一次实际选择的图片路径
|
lastImgStore.setLastImgUrl(file.path) // 更新上一次实际选择的图片路径
|
||||||
// 生成预览图
|
// 生成预览图
|
||||||
resImgUrls.value.push(file.path)
|
resImgUrls.value.push(file.path)
|
||||||
resolve()
|
resolve()
|
||||||
@ -368,8 +371,6 @@ const getWithdrawInfoListData = async () => {
|
|||||||
applyInfo.value = resWithdrawInfoList.body[0]
|
applyInfo.value = resWithdrawInfoList.body[0]
|
||||||
let imgList = JSON.parse(resWithdrawInfoList.body[0].passportFrontUrl)
|
let imgList = JSON.parse(resWithdrawInfoList.body[0].passportFrontUrl)
|
||||||
resImgUrls.value = imgList.map((item) => item)
|
resImgUrls.value = imgList.map((item) => item)
|
||||||
lastImgUrl.value =
|
|
||||||
resImgUrls.value.length > 0 ? resImgUrls.value[resImgUrls.value.length - 1] : null
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取提现信息列表失败:', error)
|
console.error('获取提现信息列表失败:', error)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user