|
|
@@ -23,10 +23,7 @@ class RouterUtil { |
|
|
|
print(user.toString()); |
|
|
|
if (user?.token == null || user.token == '') { |
|
|
|
print('need login...'); |
|
|
|
return Navigator.of(context) |
|
|
|
.push(MaterialPageRoute(builder: (BuildContext context) { |
|
|
|
return LoginPage(); |
|
|
|
})); |
|
|
|
RouterUtil.goLogin(context); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -45,4 +42,23 @@ class RouterUtil { |
|
|
|
return page; |
|
|
|
})); |
|
|
|
} |
|
|
|
|
|
|
|
// 跳转登录 |
|
|
|
static Future goLogin(BuildContext context) { |
|
|
|
return Navigator.of(context) |
|
|
|
.push(MaterialPageRoute(builder: (BuildContext context) { |
|
|
|
return LoginPage(); |
|
|
|
})); |
|
|
|
} |
|
|
|
|
|
|
|
static Future openWebview(String url, BuildContext context) { |
|
|
|
if (url == null || url == '') { |
|
|
|
Logger.error('跳转链接不能为空'); |
|
|
|
return Future.error('跳转链接不能为空'); |
|
|
|
} |
|
|
|
SkipModel model = SkipModel(); |
|
|
|
model.skipIdentifier = 'pub.flutter.url'; |
|
|
|
model.url = url; |
|
|
|
RouterUtil.route(model, null, context); |
|
|
|
} |
|
|
|
} |