mod: 我的收藏
This commit is contained in:
@ -4,30 +4,42 @@ import 'package:pilipala/http/user.dart';
|
||||
import 'package:pilipala/http/video.dart';
|
||||
import 'package:pilipala/models/user/fav_detail.dart';
|
||||
import 'package:pilipala/models/user/fav_folder.dart';
|
||||
import 'package:pilipala/utils/id_utils.dart';
|
||||
|
||||
class FavDetailController extends GetxController {
|
||||
FavFolderItemData? item;
|
||||
Rx<FavDetailData> favDetailData = FavDetailData().obs;
|
||||
|
||||
int? mediaId;
|
||||
late String heroTag;
|
||||
int currentPage = 1;
|
||||
bool isLoadingMore = false;
|
||||
RxMap favInfo = {}.obs;
|
||||
RxList<FavDetailItemData> favList = [FavDetailItemData()].obs;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
item = Get.arguments;
|
||||
if (Get.parameters.keys.isNotEmpty) {
|
||||
mediaId = int.parse(Get.parameters['mediaId']!);
|
||||
heroTag = Get.parameters['heroTag']!;
|
||||
}
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
Future<dynamic> queryUserFavFolderDetail() async {
|
||||
print('🐯🐯虎');
|
||||
Future<dynamic> queryUserFavFolderDetail({type = 'init'}) async {
|
||||
var res = await await UserHttp.userFavFolderDetail(
|
||||
pn: 1,
|
||||
ps: 15,
|
||||
pn: currentPage,
|
||||
ps: 20,
|
||||
mediaId: mediaId!,
|
||||
);
|
||||
favDetailData.value = res['data'];
|
||||
if (res['status']) {
|
||||
favInfo.value = res['data'].info;
|
||||
if (currentPage == 1 && type == 'init') {
|
||||
favList.value = res['data'].medias;
|
||||
} else if (type == 'onload') {
|
||||
favList.addAll(res['data'].medias);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -49,4 +61,8 @@ class FavDetailController extends GetxController {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onLoad() {
|
||||
queryUserFavFolderDetail(type: 'onload');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user