diff --git a/circle_app/lib/app/circle/logic.dart b/circle_app/lib/app/circle/logic.dart index bc0a96f..2d5c6c6 100644 --- a/circle_app/lib/app/circle/logic.dart +++ b/circle_app/lib/app/circle/logic.dart @@ -17,15 +17,20 @@ class CircleLogic extends GetxController { Map? statistics; int page = 1; + bool isMore = true; + @override void onInit() async { super.onInit(); var data = await DioManager.instance - .get(url: Api.getCircleInterests, params: {"page": page}); + .get(url: Api.getCircleInterests, params: {"page": page,'page_size':20}); var bean = BaseResponse.fromJson( data, (data) => InterestsBean.fromJson(data)); if(bean.data is InterestsBean&&bean.isSuccess()){ circle = bean.data!; + if (circle.lists.length < 20) { + isMore = false; + } update(); } @@ -33,13 +38,23 @@ class CircleLogic extends GetxController { } loadMore() async { - page = page++; + if (!isMore) return; + page = page + 1; var data = await DioManager.instance - .get(url: Api.getCircleInterests, params: {"page": page}); + .get(url: Api.getCircleInterests, params: {"page": page,'page_size':20}); var bean = BaseResponse.fromJson( data, (data) => InterestsBean.fromJson(data)); - circle = bean.data!; - update(); + + InterestsBean newcircle = bean.data!; + if (newcircle.lists.isNotEmpty) { + + if (newcircle.lists.length < 20) { + isMore = false; + } + circle.lists.addAll(newcircle.lists); + update(); + } + } outCircle(String interest_id, bool isStatus) async { diff --git a/circle_app/lib/app/my_circle/logic.dart b/circle_app/lib/app/my_circle/logic.dart index 57fc6e9..7660374 100644 --- a/circle_app/lib/app/my_circle/logic.dart +++ b/circle_app/lib/app/my_circle/logic.dart @@ -33,7 +33,7 @@ class MyCircleLogic extends GetxController { } loadMore() async { - page = page++; + page = page+1; var data = await DioManager.instance .get(url: Api.getMyCircleInterests, params: {"page": page,'page_size':20}); var bean = BaseResponse.fromJson(