From 3bf6136bc67f6d1dfbc50c43ef84ca98b07fdf03 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Fri, 8 Mar 2024 00:03:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=A5=BC=E4=B8=AD=E6=A5=BC=E8=AF=84?= =?UTF-8?q?=E8=AE=BA=E8=AF=B7=E6=B1=82=E9=87=8D=E5=A4=8D=20#284?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../video/detail/reply_reply/controller.dart | 20 ++++--------------- lib/pages/video/detail/reply_reply/view.dart | 3 ++- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/lib/pages/video/detail/reply_reply/controller.dart b/lib/pages/video/detail/reply_reply/controller.dart index 6daa0b8ae..e94aaea5e 100644 --- a/lib/pages/video/detail/reply_reply/controller.dart +++ b/lib/pages/video/detail/reply_reply/controller.dart @@ -30,6 +30,9 @@ class VideoReplyReplyController extends GetxController { if (type == 'init') { currentPage = 0; } + if (isLoadingMore) { + return; + } isLoadingMore = true; final res = await ReplyHttp.replyReplyList( oid: aid!, @@ -41,7 +44,7 @@ class VideoReplyReplyController extends GetxController { final List replies = res['data'].replies; if (replies.isNotEmpty) { noMore.value = '加载中...'; - if (replyList.length == res['data'].page.count) { + if (replies.length == res['data'].page.count) { noMore.value = '没有更多了'; } currentPage++; @@ -50,21 +53,6 @@ class VideoReplyReplyController extends GetxController { noMore.value = currentPage == 0 ? '还没有评论' : '没有更多了'; } if (type == 'init') { - // List replies = res['data'].replies; - // 添加置顶回复 - // if (res['data'].upper.top != null) { - // bool flag = false; - // for (var i = 0; i < res['data'].topReplies.length; i++) { - // if (res['data'].topReplies[i].rpid == res['data'].upper.top.rpid) { - // flag = true; - // } - // } - // if (!flag) { - // replies.insert(0, res['data'].upper.top); - // } - // } - // replies.insertAll(0, res['data'].topReplies); - // res['data'].replies = replies; replyList.value = replies; } else { // 每次回复之后,翻页请求有且只有相同的一条回复数据 diff --git a/lib/pages/video/detail/reply_reply/view.dart b/lib/pages/video/detail/reply_reply/view.dart index 820a69ecb..e8754a311 100644 --- a/lib/pages/video/detail/reply_reply/view.dart +++ b/lib/pages/video/detail/reply_reply/view.dart @@ -54,7 +54,8 @@ class _VideoReplyReplyPanelState extends State { () { if (scrollController.position.pixels >= scrollController.position.maxScrollExtent - 300) { - EasyThrottle.throttle('replylist', const Duration(seconds: 2), () { + EasyThrottle.throttle('replylist', const Duration(milliseconds: 200), + () { _videoReplyReplyController.queryReplyList(type: 'onLoad'); }); }