1
This commit is contained in:
@@ -79,12 +79,16 @@ class _LoginPageState extends State<LoginPage> {
|
||||
|
||||
//设置登录信息l
|
||||
await userStore.setToken(loginRes.accessToken);
|
||||
await userStore.asyncUserInfo();
|
||||
await userStore.setUserInfo();
|
||||
|
||||
if (!mounted) return;
|
||||
if (userStore.userInfo?.accountType == 1) {
|
||||
context.go(RoutePaths.sHome);
|
||||
} else {
|
||||
context.go(RoutePaths.sHome);
|
||||
} else if(userStore.userInfo?.accountType == 2){
|
||||
context.go(RoutePaths.tHome);
|
||||
}else{
|
||||
EasyLoading.showError("账号类型错误");
|
||||
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:app/providers/user_store.dart';
|
||||
import 'package:app/router/route_paths.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
@@ -28,15 +29,15 @@ class _SplashPageState extends State<SplashPage> {
|
||||
context.go(RoutePaths.login);
|
||||
} else {
|
||||
UserStore userStore = context.read<UserStore>();
|
||||
userStore.setUserInfo();
|
||||
await userStore.init();
|
||||
//去学生主页
|
||||
if (userStore.userInfo?.accountType == 1) {
|
||||
context.go(RoutePaths.sHome);
|
||||
} else {
|
||||
} else if(userStore.userInfo?.accountType == 2){
|
||||
context.go(RoutePaths.tHome);
|
||||
}else{
|
||||
EasyLoading.showError("无法找到首页");
|
||||
}
|
||||
print("执行用户数据同步了");
|
||||
userStore.asyncUserInfo();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user