登录调通

This commit is contained in:
2025-11-05 13:14:01 +08:00
parent ea18b71523
commit 36910b8b32
7 changed files with 85 additions and 42 deletions

View File

@@ -18,24 +18,21 @@ class HomeController extends GetxController with BaseControllerMixin {
FlutterNativeSplash.remove();
}
//登录状态 未登录跳转登录页
bool isLoggedIn = false;
// 登录渠道 加氢站b_login 司机端c_login
String loginChannel = "c_login";
String loginChannel_b = "b_login";
// 根据登录状态和登录渠道返回不同的首页
Widget getHomePage(bool isLoggedIn, String loginChannel) {
if (!isLoggedIn) {
return LoginPage(); // 未登录,跳转到登录页面
} else {
// 已登录,根据渠道判断跳转到不同的页面
if (loginChannel == "b_login") {
return BaseWidgetsPage(); // 渠道A进入 BaseWidgetsPage
Widget getHomePage() {
//登录状态跳转
if (StorageService.to.isLoggedIn) {
// 如果已登录,再判断是哪个渠道
if (StorageService.to.loginChannel == LoginChannel.station) {
return B_BaseWidgetsPage(); // 站点首页
} else if (StorageService.to.loginChannel == LoginChannel.driver) {
return BaseWidgetsPage(); // 司机首页
} else {
return StorageService.to.isLoggedIn ? B_BaseWidgetsPage() : LoginPage(); // 渠道B进入 B_BaseWidgetsPage
return LoginPage();
}
} else {
// 未登录,直接去登录页
return LoginPage();
}
}
}