Browse Source

首页登陆优化

ff_new
w-R 3 years ago
parent
commit
4fd5ecda7e
  1. 7
      lib/login/login_page.dart

7
lib/login/login_page.dart

@ -68,8 +68,7 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
sharedPreferences.getString("token") != null && sharedPreferences.getString("token") != null &&
sharedPreferences.getString("token") != "") { sharedPreferences.getString("token") != "") {
Navigator.of(context).popAndPushNamed('/router/main_page'); Navigator.of(context).popAndPushNamed('/router/main_page');
} else { } else {initController();
initController();
client = ApiService(Dio(), context: context); client = ApiService(Dio(), context: context);
isShowLogin = true; isShowLogin = true;
@ -301,8 +300,8 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
print(error); print(error);
SmartDialog.showToast("$error", alignment: Alignment.center); SmartDialog.showToast("$error", alignment: Alignment.center);
}); });
EasyLoading.show(status: S.of(context).zhengzaijiazai);
Future.delayed(Duration(seconds:2), () { Future.delayed(Duration(seconds:2), () {
EasyLoading.dismiss();
if (value !=null && value.isSuccess) { if (value !=null && value.isSuccess) {
saveUserJson(value.data); saveUserJson(value.data);
eventBus.fire(EventType(3)); eventBus.fire(EventType(3));
@ -311,6 +310,8 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
'/router/main_page', '/router/main_page',
(route) => false, (route) => false,
); );
EasyLoading.dismiss();
} else { } else {
SmartDialog.showToast("${value.msg}", alignment: Alignment.center); SmartDialog.showToast("${value.msg}", alignment: Alignment.center);
} }

Loading…
Cancel
Save