feat: 评论二楼跳转

This commit is contained in:
guozhigq
2024-07-21 22:40:43 +08:00
parent 9afecbecdb
commit a57f10ccdb
5 changed files with 132 additions and 86 deletions

View File

@ -26,7 +26,7 @@ class VideoReplyReplyController extends GetxController {
currentPage = 0;
}
Future queryReplyList({type = 'init'}) async {
Future queryReplyList({type = 'init', currentReply}) async {
if (type == 'init') {
currentPage = 0;
}
@ -63,6 +63,17 @@ class VideoReplyReplyController extends GetxController {
// res['data'].replies.addAll(replyList);
}
}
if (replyList.isNotEmpty && currentReply != null) {
int indexToRemove =
replyList.indexWhere((item) => currentReply.rpid == item.rpid);
// 如果找到了指定ID的项则移除
if (indexToRemove != -1) {
replyList.removeAt(indexToRemove);
}
if (currentPage == 1 && type == 'init') {
replyList.insert(0, currentReply);
}
}
isLoadingMore = false;
return res;
}