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) {