From 362eb452cce68a74fb395647e21c4fee75ca124b Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Mon, 9 May 2022 23:45:00 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A4=BE=E7=BE=A4=E5=88=97=E8=A1=A8=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/community/community_child_page.dart | 13 +++++++++++++ lib/mine/personal_page.dart | 3 +++ lib/retrofit/min_api.dart | 2 +- lib/retrofit/retrofit_api.dart | 2 +- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/community/community_child_page.dart b/lib/community/community_child_page.dart index 4a7db4d9..70c1a496 100644 --- a/lib/community/community_child_page.dart +++ b/lib/community/community_child_page.dart @@ -33,6 +33,8 @@ class CommunityChildPageState extends State with AutomaticKe int pageNum = 1; String userId; bool isLoadMore = false; + bool isRefresh = true; + bool isLoadingData = false; ScrollController sc = ScrollController(); List
articles = []; @@ -52,6 +54,14 @@ class CommunityChildPageState extends State with AutomaticKe ///动态列表 queryCommunity() async { + if(!isRefresh){ + isRefresh = true; + return; + } + if(isLoadingData){ + return; + } + isLoadingData = true; if (apiService == null) { SharedPreferences value = await SharedPreferences.getInstance(); userId = value.getString('userId'); @@ -107,6 +117,8 @@ class CommunityChildPageState extends State with AutomaticKe refreshController.loadNoData(); } } + + isLoadingData = false; } @override @@ -191,6 +203,7 @@ class CommunityChildPageState extends State with AutomaticKe if (baseData != null && baseData.isSuccess) { this.articles.forEach((element) { if(element.id == id){ + isRefresh = false; setState(() { element.likes = baseData.data.likes; element.viewers = baseData.data.viewers; diff --git a/lib/mine/personal_page.dart b/lib/mine/personal_page.dart index 8084782d..b46306b1 100644 --- a/lib/mine/personal_page.dart +++ b/lib/mine/personal_page.dart @@ -142,6 +142,9 @@ class _PersonalPage extends State with WidgetsBindingObserver { article.likes = element?.likes; article.comments = element?.comments; articles.add(article); + }); + setState(() { + }); // print("comments: ${comments.length}"); if (int.tryParse(baseData.data.total) < (pageNum * 10)) { diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index 5b8d9f8f..f8e85a64 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -32,7 +32,7 @@ part 'min_api.g.dart'; // const base_url = "http://192.168.10.37:8766/app/"; -const localBaseUrl = "http://192.168.10.78:8765/app/";///本地 +const localBaseUrl = "https://pos.api.lotus-wallet.com/app/";///本地 const serviceBaseUrl = "https://pos.api.lotus-wallet.com/app/";///线上 diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 1b7fc4bc..1f7b8706 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -68,7 +68,7 @@ part 'retrofit_api.g.dart'; // const base_url = "http://192.168.10.132:8766/app/";///詹云久 -const localBaseUrl = "http://192.168.10.78:8766/app/";///本地 +const localBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///本地 const serviceBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///线上 @RestApi(baseUrl: localBaseUrl)