fix(t209): stabilize failed login form state

This commit is contained in:
QiuSW
2026-07-27 16:13:18 +08:00
parent 5782c3088d
commit 6d70eee0af
2 changed files with 16 additions and 6 deletions
@@ -142,7 +142,7 @@ fun ProcurementScreen(
} }
when (state.phase) { when (state.phase) {
ProcurementPhase.SIGNED_OUT -> item { ProcurementPhase.SIGNED_OUT -> item(key = "procurement-login") {
LoginSection( LoginSection(
state = state, state = state,
onLogin = onLogin onLogin = onLogin
@@ -157,7 +157,9 @@ fun ProcurementScreen(
} }
ProcurementPhase.CLAIMED -> { ProcurementPhase.CLAIMED -> {
if (state.authenticationRequired) { if (state.authenticationRequired) {
item { LoginSection(state = state, onLogin = onLogin) } item(key = "procurement-login") {
LoginSection(state = state, onLogin = onLogin)
}
} }
item { TaskDetails(state) } item { TaskDetails(state) }
item { item {
@@ -196,7 +198,9 @@ fun ProcurementScreen(
ProcurementPhase.RUNNING, ProcurementPhase.RUNNING,
ProcurementPhase.AUTHORIZATION_EXPIRED -> { ProcurementPhase.AUTHORIZATION_EXPIRED -> {
if (state.authenticationRequired) { if (state.authenticationRequired) {
item { LoginSection(state = state, onLogin = onLogin) } item(key = "procurement-login") {
LoginSection(state = state, onLogin = onLogin)
}
} }
item { TaskDetails(state) } item { TaskDetails(state) }
item { item {
@@ -266,14 +270,14 @@ private fun LoginSection(
) { ) {
val colors = BaoziTheme.colors val colors = BaoziTheme.colors
val coroutineScope = rememberCoroutineScope() val coroutineScope = rememberCoroutineScope()
var backendUrl by remember(state.profile.backendUrl) { var backendUrl by remember {
mutableStateOf(state.profile.backendUrl) mutableStateOf(state.profile.backendUrl)
} }
var username by remember(state.profile.username) { var username by remember {
mutableStateOf(state.profile.username) mutableStateOf(state.profile.username)
} }
var password by remember { mutableStateOf("") } var password by remember { mutableStateOf("") }
var deviceId by remember(state.profile.deviceId) { var deviceId by remember {
mutableStateOf(state.profile.deviceId) mutableStateOf(state.profile.deviceId)
} }
var deviceToken by remember { mutableStateOf("") } var deviceToken by remember { mutableStateOf("") }
+6
View File
@@ -52,3 +52,9 @@ write_paths:
防止请求尚未开始时重复点击。 防止请求尚未开始时重复点击。
- 2026-07-27:`./gradlew.bat :app:compileDebugKotlin :app:testDebugUnitTest - 2026-07-27:`./gradlew.bat :app:compileDebugKotlin :app:testDebugUnitTest
:app:assembleDebug` 通过;最新 Debug APK 已安装并冷启动至 PKG110,无 crash/ANR。 :app:assembleDebug` 通过;最新 Debug APK 已安装并冷启动至 PKG110,无 crash/ANR。
- 2026-07-27:首次修复后真机复测仍复现。根因是错误信息作为新的 `LazyColumn` 项插在
登录表单之前,无 key 的表单项位置变化后被 Compose 重新创建。登录项改用稳定
`procurement-login` key,并移除会在 profile 发布时重置字段的 remember key。
- 2026-07-27:PKG110 真机以无效后台地址触发“后台地址必须包含主机”;错误显示后测试
的后台地址、账号和设备 ID 仍可见。强制重启 App 后测试值消失,确认表单只在内存中
保留,未持久化凭证。