修复Salon对象存储头像展示
This commit is contained in:
@@ -56,10 +56,11 @@ Page({
|
||||
if (!filePath) return
|
||||
this.setData({ avatarUploading: true })
|
||||
const uploadResult = await uploadObjectFile(filePath)
|
||||
const avatarUrl = uploadResult.fileUrl || uploadResult.primaryUrl || filePath
|
||||
// 私有对象存储地址可能无法被小程序直接访问,上传完成后先用本地临时文件即时预览。
|
||||
const storedAvatar = uploadResult.fileUrl || uploadResult.primaryUrl || ''
|
||||
this.setData({
|
||||
'form.avatar': avatarUrl,
|
||||
'form.avatarUrl': avatarUrl
|
||||
'form.avatar': storedAvatar,
|
||||
'form.avatarUrl': filePath
|
||||
})
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '头像上传失败', icon: 'none' })
|
||||
@@ -72,6 +73,10 @@ Page({
|
||||
this.setData({ 'form.avatar': '', 'form.avatarUrl': '' })
|
||||
},
|
||||
|
||||
onAvatarError() {
|
||||
this.setData({ 'form.avatarUrl': '' })
|
||||
},
|
||||
|
||||
stopTouchMove() {
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user