修复账号切换后「我的」页当前账号展示错误,并统一举报摄影师首页 URI。

切换账号时以用户选中账号为准写入展示标题与业务作用域,避免沿用旧门店名称;同时将首页举报摄影师入口 URI 对齐为 report_photographer。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-01 17:21:04 +08:00
parent fcb86d43f5
commit 5ab9b1b324
23 changed files with 419 additions and 92 deletions

View File

@ -125,3 +125,7 @@ DEBUG 构建下,“我的”列表会额外展示“首页调试”入口,
- 无实名认证信息时:点击去实名认证。
- 账号切换失败只展示 Toast不清空登录态。
- 实名认证失败只影响实名认证页面,不影响登录态和账号上下文。
- 「当前账号」展示规则:
- 门店账号(`store_user`)展示门店名称,不回退到景区名称。
- 景区账号(`scenic_user`)展示景区名称。
- 展示标题在登录/切换成功时写入 `AccountContext.currentAccountDisplayTitle`,切换账号时必须同步更新,不能沿用上一次账号名称。

View File

@ -212,7 +212,8 @@ struct AccountSwitchView: View {
accountContext: accountContext,
permissionContext: permissionContext,
profileAPI: profileAPI,
accountContextAPI: accountContextAPI
accountContextAPI: accountContextAPI,
selectedAccount: account
)
}
appRouter.reset()
@ -226,14 +227,7 @@ struct AccountSwitchView: View {
}
private var currentAccountId: String? {
guard let current = accountContext.profile else { return nil }
if let store = accountContext.currentStore {
return "\(V9StoreUser.accountTypeValue)_\(store.id)"
}
if let scenic = accountContext.currentScenic {
return "\(V9ScenicUser.accountTypeValue)_\(scenic.id)"
}
return current.userId.isEmpty ? nil : current.userId
accountContext.currentAccountIdentifier
}
///

View File

@ -494,20 +494,51 @@ struct ProfileView: View {
}
private var currentAccountDisplayName: String {
nonEmpty(accountContext.currentAccountDisplayTitle)
?? (isStoreAccountContext ? resolvedStoreAccountName : resolvedScenicAccountName)
}
/// 退
private var resolvedStoreAccountName: String {
nonEmpty(accountContext.currentStore?.name)
?? nonEmpty(accountContext.currentScenic?.name)
?? accountContext.profile?.displayName
?? nonEmpty(matchedStoreScope?.name)
?? nonEmpty(accountContext.profile?.displayName)
?? viewModel.displayNickname
}
///
private var resolvedScenicAccountName: String {
nonEmpty(accountContext.currentScenic?.name)
?? nonEmpty(accountContext.profile?.displayName)
?? viewModel.displayNickname
}
///
private var isStoreAccountContext: Bool {
accountContext.accountType == V9StoreUser.accountTypeValue
}
/// currentStore
private var matchedStoreScope: BusinessScope? {
if let currentStore = accountContext.currentStore {
return currentStore
}
guard accountContext.accountType == V9StoreUser.accountTypeValue else { return nil }
if accountContext.storeScopes.count == 1 {
return accountContext.storeScopes.first
}
return nil
}
private var currentAccountTypeText: String {
if accountContext.currentStore != nil {
switch accountContext.accountType {
case V9StoreUser.accountTypeValue:
return "门店账号"
}
if accountContext.currentScenic != nil {
case V9ScenicUser.accountTypeValue:
return "景区账号"
default:
return nonEmpty(viewModel.userInfo?.roleName) ?? "账号"
}
return nonEmpty(viewModel.userInfo?.roleName) ?? "账号"
}
private var nicknameBinding: Binding<String> {