feat: UP主投稿排序查询

This commit is contained in:
guozhigq
2023-09-23 00:48:22 +08:00
parent 97268c36dc
commit f79e4765c2
4 changed files with 94 additions and 8 deletions

View File

@ -5,20 +5,38 @@ class ArchiveController extends GetxController {
int? mid;
int pn = 1;
int count = 0;
RxMap<String, String> currentOrder = <String, String>{}.obs;
List<Map<String, String>> orderList = [
{'type': 'pubdate', 'label': '最新发布'},
{'type': 'click', 'label': '最多播放'},
{'type': 'stow', 'label': '最多收藏'},
];
@override
void onInit() {
super.onInit();
mid = int.parse(Get.parameters['mid']!);
currentOrder.value = orderList.first;
}
// 获取用户投稿
Future getMemberArchive() async {
var res = await MemberHttp.memberArchive(mid: mid, pn: pn);
var res = await MemberHttp.memberArchive(
mid: mid, pn: pn, order: currentOrder['type']!);
if (res['status']) {
count = res['data'].page['count'];
pn += 1;
}
return res;
}
toggleSort() async {
pn = 1;
int index = orderList.indexOf(currentOrder.value);
if (index == orderList.length - 1) {
currentOrder.value = orderList.first;
} else {
currentOrder.value = orderList[index + 1];
}
}
}