From d3cd645d9e7f890b109b7677fd9f422683c8f738 Mon Sep 17 00:00:00 2001 From: orz12 Date: Wed, 6 Mar 2024 15:59:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=83=AD=E9=97=A8=E9=A1=B5=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E9=80=BB=E8=BE=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/hot/controller.dart | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/pages/hot/controller.dart b/lib/pages/hot/controller.dart index c2b2dee8..824ae717 100644 --- a/lib/pages/hot/controller.dart +++ b/lib/pages/hot/controller.dart @@ -14,6 +14,9 @@ class HotController extends GetxController { // 获取推荐 Future queryHotFeed(type) async { + if (type != 'onLoad') { + _currentPage = 1; + } var res = await VideoHttp.hotVideoList( pn: _currentPage, ps: _count, @@ -22,7 +25,8 @@ class HotController extends GetxController { if (type == 'init') { videoList.value = res['data']; } else if (type == 'onRefresh') { - videoList.insertAll(0, res['data']); + // videoList.insertAll(0, res['data']); + videoList.value = res['data']; } else if (type == 'onLoad') { videoList.addAll(res['data']); } @@ -34,15 +38,15 @@ class HotController extends GetxController { // 下拉刷新 Future onRefresh() async { - queryHotFeed('onRefresh'); + await queryHotFeed('onRefresh'); } // 上拉加载 Future onLoad() async { - queryHotFeed('onLoad'); + await queryHotFeed('onLoad'); } - // 返回顶部并刷新 + // 返回顶部 void animateToTop() async { if (scrollController.offset >= MediaQuery.of(Get.context!).size.height * 5) {