服务器更替
This commit is contained in:
@@ -31,15 +31,24 @@ watch(
|
||||
)
|
||||
|
||||
async function handleCropperAvatarSuccess(avatarUrl: string) {
|
||||
if (!avatarUrl) {
|
||||
uni.showToast({ title: t('common.prompt.picture-wrong-please-try-again'), icon: 'none' })
|
||||
return
|
||||
}
|
||||
try {
|
||||
await uni.showLoading({
|
||||
uni.showLoading({
|
||||
title: t('common.prompt.up-cross'),
|
||||
mask: true,
|
||||
})
|
||||
const res = await upload(avatarUrl, '.png', 'app/avatar/')
|
||||
console.log('111111', res)
|
||||
form.value.avatar = res as string
|
||||
}finally {
|
||||
const res = await upload(avatarUrl)
|
||||
form.value.avatar = String(res || '')
|
||||
} catch (error: any) {
|
||||
console.log('avatar upload error', error)
|
||||
uni.showToast({
|
||||
title: error?.message || t('common.prompt.up-failed'),
|
||||
icon: 'none',
|
||||
})
|
||||
} finally {
|
||||
uni.hideLoading()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user