feat: 新增诊断报告全流程功能,适配登录后报告跳转逻辑
实现了入门测/出门测报告的完整链路: 1. 新增UserInfo模型的出门测报告标记字段与相关接口 2. 新增全局报告路由拦截器,自动在登录后/应用回前台时检查报告状态 3. 新增报告相关API、页面与路由配置,包含欢迎页、H5壳子、AI计算页 4. 适配登录成功后的报告跳转逻辑,更新用户状态管理方法
This commit is contained in:
@@ -381,6 +381,18 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
||||
password: password,
|
||||
rememberPassword: _rememberPassword,
|
||||
);
|
||||
|
||||
if (mounted) {
|
||||
// 对齐 Vue login/index.vue L404: 登录成功后检查报告标记
|
||||
// isShowReport / isShowAfterReport 任一为 true → 跳报告页
|
||||
final hasReport = user.isShowReport || user.isShowAfterReport;
|
||||
if (hasReport) {
|
||||
final reportType = user.isShowAfterReport ? 'exitTest' : 'placementTest';
|
||||
context.go('/studentInfo', extra: {'type': reportType});
|
||||
} else {
|
||||
context.go('/');
|
||||
}
|
||||
}
|
||||
} catch (_) {
|
||||
debugPrint('⚠ 【用户信息】拉取失败,已跳过缓存');
|
||||
// 即使拉用户信息失败也存历史(userName 留空)
|
||||
@@ -390,19 +402,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
||||
password: password,
|
||||
rememberPassword: _rememberPassword,
|
||||
);
|
||||
}
|
||||
|
||||
if (mounted) {
|
||||
final messenger = ScaffoldMessenger.of(context);
|
||||
context.go('/');
|
||||
// messenger.showSnackBar(
|
||||
// SnackBar(
|
||||
// content: Text(
|
||||
// '登录成功,欢迎 ${res.info.userName.isEmpty ? account : res.info.userName}',
|
||||
// ),
|
||||
// duration: const Duration(seconds: 2),
|
||||
// ),
|
||||
// );
|
||||
if (mounted) context.go('/');
|
||||
}
|
||||
} on ApiException catch (e) {
|
||||
if (mounted) _toast(e.message);
|
||||
|
||||
Reference in New Issue
Block a user