修复小程序上传图片预览
This commit is contained in:
@@ -107,6 +107,21 @@ function uploadObjectFile(filePath) {
|
||||
})
|
||||
}
|
||||
|
||||
function resolveUploadedImagePreviewUrl(uploadResult, fallbackFilePath) {
|
||||
const localPath = String(fallbackFilePath || '').trim()
|
||||
if (localPath) {
|
||||
return localPath
|
||||
}
|
||||
if (!uploadResult || typeof uploadResult !== 'object') {
|
||||
return ''
|
||||
}
|
||||
const primaryUrl = String(uploadResult.primaryUrl || '').trim()
|
||||
if (primaryUrl) {
|
||||
return primaryUrl
|
||||
}
|
||||
return String(uploadResult.fileUrl || '').trim()
|
||||
}
|
||||
|
||||
function uploadProfileImage(filePath) {
|
||||
return uploadFile({
|
||||
url: '/user/upload-profile-image',
|
||||
@@ -131,6 +146,7 @@ module.exports = {
|
||||
chooseImageFilePaths,
|
||||
chooseImageFilePath,
|
||||
uploadObjectFile,
|
||||
resolveUploadedImagePreviewUrl,
|
||||
uploadAvatar,
|
||||
uploadProfileImage
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user