提交 b239fe06 authored 作者: yueweilu's avatar yueweilu

跳转详情需登录

上级 ce4a0087
......@@ -102,7 +102,7 @@ class LibraryController extends GetxController with GetTickerProviderStateMixin{
final result = await Tools.checkCurrentNetStatus();
// 有网络的时候上传 笔记
if (result){
if (result && UserStore.to.isLogin){
upload();
}
super.onReady();
......@@ -245,6 +245,7 @@ class LibraryController extends GetxController with GetTickerProviderStateMixin{
List<Map<String, dynamic>> data = await SqlManager.queryNoUploadData();
Console.log('查询到的数据----------------------------------------------------$data');
if(data.isNotEmpty){
final result = await LibraryAPI.uploadOffline(node: jsonEncode(data));
// 上传成功后 更新数据库中的字段
if (result) {
......@@ -252,6 +253,8 @@ class LibraryController extends GetxController with GetTickerProviderStateMixin{
}
}
}
/// 获取图书列表数据
Future<void> _getBooks([bool isRefresh = false]) async {
......
......@@ -15,6 +15,7 @@ import 'package:ionicons/ionicons.dart';
import '../../models/index.dart';
import '../../routes/index.dart';
import '../../store/index.dart';
import '../../widgets/index.dart';
import '../course/index.dart';
import '../study/index.dart';
......
......@@ -271,7 +271,8 @@ abstract class Routes {
child: BookDetailPage(
bookId: state.uri.queryParameters['book_id'].toString(),
)
)
),
redirect: (context, state) => _RouteRedirect.auth(),
),
GoRoute(
path: '/$bookScore',
......@@ -613,7 +614,7 @@ abstract class Routes {
}
abstract class _RouteRedirect {
static String? auth(BuildContext context, GoRouterState state) {
static String? auth() {
if (UserStore.to.isLogin) return null;
return '/${Routes.login}';
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论