mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-21 17:46:24 +08:00
@@ -1,5 +1,6 @@
|
||||
import 'package:PiliPlus/http/dynamics.dart';
|
||||
import 'package:PiliPlus/http/fav.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/http/video.dart';
|
||||
import 'package:PiliPlus/models/dynamics/article_content_model.dart'
|
||||
show ArticleContentModel;
|
||||
@@ -9,6 +10,7 @@ import 'package:PiliPlus/models_new/article/article_info/data.dart';
|
||||
import 'package:PiliPlus/models_new/article/article_view/data.dart';
|
||||
import 'package:PiliPlus/pages/common/dyn/common_dyn_controller.dart';
|
||||
import 'package:PiliPlus/utils/accounts.dart';
|
||||
import 'package:PiliPlus/utils/app_scheme.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:PiliPlus/utils/url_utils.dart';
|
||||
@@ -46,8 +48,9 @@ class ArticleController extends CommonDynController {
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
id = Get.parameters['id']!;
|
||||
type = Get.parameters['type']!;
|
||||
final params = Get.parameters;
|
||||
id = params['id']!;
|
||||
type = params['type']!;
|
||||
|
||||
// to opus
|
||||
if (type == 'read') {
|
||||
@@ -55,8 +58,11 @@ class ArticleController extends CommonDynController {
|
||||
url,
|
||||
) {
|
||||
if (url != null) {
|
||||
id = url.split('/').last;
|
||||
type = 'opus';
|
||||
final opusId = PiliScheme.uriDigitRegExp.firstMatch(url)?.group(1);
|
||||
if (opusId != null) {
|
||||
id = opusId;
|
||||
type = 'opus';
|
||||
}
|
||||
}
|
||||
init();
|
||||
});
|
||||
@@ -99,8 +105,10 @@ class ArticleController extends CommonDynController {
|
||||
..author ??= opusData.modules.moduleAuthor
|
||||
..title ??= opusData.modules.moduleTag?.text;
|
||||
return true;
|
||||
} else {
|
||||
loadingState.value = res as Error;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Future<bool> queryRead(int cvid) async {
|
||||
@@ -116,8 +124,10 @@ class ArticleController extends CommonDynController {
|
||||
getArticleInfo();
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
loadingState.value = res as Error;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// stats
|
||||
@@ -208,6 +218,14 @@ class ArticleController extends CommonDynController {
|
||||
SmartDialog.showToast(res['msg']);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> onReload() {
|
||||
if (!isLoaded.value) {
|
||||
return Future.value();
|
||||
}
|
||||
return super.onReload();
|
||||
}
|
||||
}
|
||||
|
||||
class Summary {
|
||||
|
||||
Reference in New Issue
Block a user