新增门店订单与核销管理列表,对齐 Android 订单能力并完善账号级缓存。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@ -20,9 +20,13 @@ final class ProfileViewModel: ObservableObject {
|
||||
@Published private(set) var pendingAvatarData: Data?
|
||||
@Published private(set) var pendingAvatarFileName: String?
|
||||
@Published private(set) var avatarUploadProgress: Int?
|
||||
/// 接口返回前使用的本地账号资料缓存,来自 AccountContext / AccountSnapshot。
|
||||
private var cachedProfile: AccountProfile?
|
||||
|
||||
var displayNickname: String {
|
||||
nonEmpty(userInfo?.nickname) ?? "未设置昵称"
|
||||
nonEmpty(userInfo?.nickname)
|
||||
?? nonEmpty(cachedProfile?.displayName)
|
||||
?? "未设置昵称"
|
||||
}
|
||||
|
||||
var displayRealName: String {
|
||||
@ -30,11 +34,11 @@ final class ProfileViewModel: ObservableObject {
|
||||
}
|
||||
|
||||
var displayPhone: String {
|
||||
nonEmpty(userInfo?.phone) ?? "--"
|
||||
nonEmpty(userInfo?.phone) ?? nonEmpty(cachedProfile?.phone) ?? "--"
|
||||
}
|
||||
|
||||
var displayAvatarURL: String {
|
||||
nonEmpty(userInfo?.avatar) ?? ""
|
||||
nonEmpty(userInfo?.avatar) ?? nonEmpty(cachedProfile?.avatarURL) ?? ""
|
||||
}
|
||||
|
||||
var accountStatusText: String {
|
||||
@ -53,6 +57,12 @@ final class ProfileViewModel: ObservableObject {
|
||||
}
|
||||
}
|
||||
|
||||
/// 用本地缓存的账号资料预填充展示字段,避免冷启动或重新进入页面时先显示占位文案。
|
||||
func applyCachedProfile(_ profile: AccountProfile?) {
|
||||
guard userInfo == nil else { return }
|
||||
cachedProfile = profile
|
||||
}
|
||||
|
||||
/// 重新加载用户资料和实名认证状态。
|
||||
func reload(api: ProfileAPI) async throws {
|
||||
guard !isLoading else { return }
|
||||
|
||||
Reference in New Issue
Block a user