This commit is contained in:
@@ -4,6 +4,7 @@ const { chooseImageFilePath, uploadProfileImage } = require('../../utils/upload'
|
||||
const { buildProfileCard, normalizeAvatar } = require('../../utils/profile-card')
|
||||
const { BRAND_CONFIG } = require('../../utils/config')
|
||||
const profileCache = require('../../utils/profile-cache')
|
||||
const { showErrorToast } = require('../../utils/toast')
|
||||
|
||||
function resolveRoleText(type) {
|
||||
const role = Number(type)
|
||||
@@ -65,7 +66,7 @@ Page({
|
||||
const profile = await profileCache.getProfile(options)
|
||||
this.syncProfileToSession(profile)
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '个人信息加载失败', icon: 'none' })
|
||||
showErrorToast(error, '个人信息加载失败')
|
||||
} finally {
|
||||
this.setData({ loading: false })
|
||||
}
|
||||
@@ -146,7 +147,7 @@ Page({
|
||||
if (!filePath) return
|
||||
await this.uploadAvatar(filePath)
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '头像上传失败', icon: 'none' })
|
||||
showErrorToast(error, '头像上传失败')
|
||||
}
|
||||
},
|
||||
|
||||
@@ -159,7 +160,7 @@ Page({
|
||||
try {
|
||||
await this.uploadAvatar(event.detail && event.detail.avatarUrl)
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '微信头像获取失败', icon: 'none' })
|
||||
showErrorToast(error, '微信头像获取失败')
|
||||
}
|
||||
},
|
||||
|
||||
@@ -190,7 +191,7 @@ Page({
|
||||
wx.showToast({ title: '已保存', icon: 'success', duration: 3000 })
|
||||
setTimeout(() => wx.navigateBack(), 350)
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '保存失败', icon: 'none', duration: 3000 })
|
||||
showErrorToast(error, '保存失败', { duration: 3000 })
|
||||
} finally {
|
||||
this.setData({ saving: false })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user