diff --git a/lib/controller/home/home_controller.dart b/lib/controller/home/home_controller.dart index 1f62d8c..2e14c78 100644 --- a/lib/controller/home/home_controller.dart +++ b/lib/controller/home/home_controller.dart @@ -25,7 +25,8 @@ class HomeController extends GetxController { final nearbyIsLoading = false.obs; final nearbyPage = 1.obs; final nearbyHasMore = true.obs; - + + final marchPage = 1.obs; // 当前标签页索引 final selectedTabIndex = 0.obs; @@ -81,7 +82,7 @@ class HomeController extends GetxController { getMatchmakerList() async { try{ final response = await _homeApi.userPageDongwoMatchmakerMarriageInformation( - pageNum: 1, + pageNum: marchPage.value, pageSize: 10 ); if (response.data.isSuccess && response.data.data != null) { @@ -94,6 +95,7 @@ class HomeController extends GetxController { } else { listRefreshController.finishLoad(IndicatorResult.noMore); } + update(); } else { // 响应失败,抛出异常 diff --git a/lib/model/home/event_list_data.dart b/lib/model/home/event_list_data.dart index eb81bb6..ba57be4 100644 --- a/lib/model/home/event_list_data.dart +++ b/lib/model/home/event_list_data.dart @@ -1,9 +1,9 @@ class EventListData { List? records; - int? total; - int? size; - int? current; - int? pages; + num? total; + num? size; + num? current; + num? pages; EventListData( {this.records, this.total, this.size, this.current, this.pages}); @@ -47,43 +47,43 @@ class Records { String? applyEndTime; String? beginTime; String? endTime; - int? provinceCode; + num? provinceCode; String? provinceName; - int? cityCode; + num? cityCode; String? cityName; - int? districtCode; + num? districtCode; String? districtName; String? detailedAddress; - int? numberParticipants; - int? numberMan; - int? numberWoman; - double? manEntryFee; - double? womanEntryFee; - double? manDiscount; - double? womanDiscount; + num? numberParticipants; + num? numberMan; + num? numberWoman; + num? manEntryFee; + num? womanEntryFee; + num? manDiscount; + num? womanDiscount; String? depict; - int? status; - int? activityType; + num? status; + num? activityType; String? communityId; String? communityName; String? communityQrCodeUrl; String? contactPictureUrl; String? goodsName; - int? chargeType; - int? mutualAssistanceLimit; + num? chargeType; + num? mutualAssistanceLimit; bool? needRegInfo; bool? realNameSwitch; List? imgList; - int? topSerialNumber; + num? topSerialNumber; String? sharePhotosUrl; String? contentPic; - int? contentPicHeight; - int? simulationNanNum; - int? simulationWonanNum; - int? registrationPopulation; - int? participantStatus; - int? manNumber; - int? womanNumber; + num? contentPicHeight; + num? simulationNanNum; + num? simulationWonanNum; + num? registrationPopulation; + num? participantStatus; + num? manNumber; + num? womanNumber; Records( {this.id, @@ -253,12 +253,12 @@ class Records { class ImgList { String? id; bool? isDelete; - List? createTime; - List? updateTime; + List? createTime; + List? updateTime; Null? event; - int? siteActivityId; + num? siteActivityId; String? url; - int? serialNumber; + num? serialNumber; ImgList( {this.id, @@ -273,8 +273,8 @@ class ImgList { ImgList.fromJson(Map json) { id = json['id']; isDelete = json['isDelete']; - createTime = json['createTime'].cast(); - updateTime = json['updateTime'].cast(); + createTime = json['createTime'].cast(); + updateTime = json['updateTime'].cast(); event = json['event']; siteActivityId = json['siteActivityId']; url = json['url']; diff --git a/lib/network/api_urls.dart b/lib/network/api_urls.dart index d04da87..b4556ff 100644 --- a/lib/network/api_urls.dart +++ b/lib/network/api_urls.dart @@ -141,7 +141,7 @@ class ApiUrls { 'dating-agency-service/user/page/own-post-dynamic'; static const String userParticipateInSiteActivity = - 'dating-agency-service/user/participate/in/site/activity'; + 'dating-agency-service/user/participate/in/site/qulianlian-activity'; static const String userQuitSiteActivity = 'dating-agency-service/user/quit/site/activity'; diff --git a/lib/network/home_api.g.dart b/lib/network/home_api.g.dart index f6b02af..2d50e5e 100644 --- a/lib/network/home_api.g.dart +++ b/lib/network/home_api.g.dart @@ -435,7 +435,7 @@ class _HomeApi implements HomeApi { Options(method: 'POST', headers: _headers, extra: _extra) .compose( _dio.options, - 'dating-agency-service/user/participate/in/site/activity', + 'dating-agency-service/user/participate/in/site/qulianlian-activity', queryParameters: queryParameters, data: _data, ) diff --git a/lib/pages/home/event_info.dart b/lib/pages/home/event_info.dart index 5c29c3c..d180587 100644 --- a/lib/pages/home/event_info.dart +++ b/lib/pages/home/event_info.dart @@ -105,6 +105,7 @@ class EventInfo extends StatelessWidget { ), SizedBox(height: 5.w,), Row( + crossAxisAlignment: CrossAxisAlignment.start, children: [ Icon( Icons.location_on_outlined, @@ -118,11 +119,13 @@ class EventInfo extends StatelessWidget { color: const Color.fromRGBO(144, 144, 144, 1) ), ), - Text( - "${controller.item.value.cityName ?? ""}${controller.item.value.districtName ?? ""}${controller.item.value.detailedAddress ?? ""}", - style: TextStyle( - fontSize: 12.w, - color: const Color.fromRGBO(144, 144, 144, 1) + Expanded( + child: Text( + "${controller.item.value.cityName ?? ""}${controller.item.value.districtName ?? ""}${controller.item.value.detailedAddress ?? ""}", + style: TextStyle( + fontSize: 12.w, + color: const Color.fromRGBO(144, 144, 144, 1) + ), ), ) ], @@ -228,10 +231,19 @@ class EventInfo extends StatelessWidget { ], ), ), - CachedNetworkImage( + if(controller.item.value.contentPic != null && controller.item.value.contentPic != "")CachedNetworkImage( imageUrl: controller.item.value.contentPic ?? "", width: 345.w, fit: BoxFit.cover, + ), + if(controller.item.value.contentPic == null || controller.item.value.contentPic == "") Row( + children: [ + Expanded(child: SizedBox( + child: Text( + controller.item.value.depict ?? "" + ), + )) + ], ) ], ), @@ -239,7 +251,7 @@ class EventInfo extends StatelessWidget { ), ), ), - bottomNavigationBar: (controller.item.value.participantStatus == 0 || controller.item.value.participantStatus == -1) ? Container( + bottomNavigationBar: (controller.item.value.participantStatus == 0) ? Container( height: 60.w, color: Colors.white, child: Center( diff --git a/lib/pages/home/matchmaker_page.dart b/lib/pages/home/matchmaker_page.dart index b1624f9..9de8b02 100644 --- a/lib/pages/home/matchmaker_page.dart +++ b/lib/pages/home/matchmaker_page.dart @@ -50,16 +50,23 @@ class _MatchmakerPageState extends State with AutomaticKeepAlive onRefresh: () async { print('推荐列表下拉刷新被触发'); + controller.marchPage.value = 1; controller.matchmakerList.clear(); await controller.getMatchmakerList(); controller.listRefreshController.finishRefresh(IndicatorResult.success); controller.listRefreshController.finishLoad(IndicatorResult.none); + setState(() { + + }); }, // 上拉加载更多 onLoad: () async { print('推荐列表上拉加载被触发, hasMore: '); - + controller.marchPage.value += 1; await controller.getMatchmakerList(); + setState(() { + + }); }, child: Container( padding: EdgeInsets.symmetric( diff --git a/lib/pages/home/recommend_tab.dart b/lib/pages/home/recommend_tab.dart index 9e74a65..61d4c66 100644 --- a/lib/pages/home/recommend_tab.dart +++ b/lib/pages/home/recommend_tab.dart @@ -116,6 +116,47 @@ class _RecommendTabState extends State child: SingleChildScrollView( child: Column( children: [ + Container( + padding: EdgeInsets.symmetric(horizontal: 12), + margin: EdgeInsets.only(bottom: 10.w), + height: 90.w, + child: Swiper( + autoplay: true, + itemCount: controller.bannerLint.length, + loop: true, + onTap: (int index){ + print(index); + if(controller.bannerLint[index].jumpType == 2){ + Get.to(() => OpenWebView(url: controller.bannerLint[index].jumpValue ?? "")); + } else if(controller.bannerLint[index].jumpType == 3){ + TDImageViewer.showImageViewer(context: context, images: [controller.bannerLint[index].jumpValue ?? ""]); + } + }, + itemBuilder: (BuildContext context, int index) { + return CachedNetworkImage( + imageUrl: controller.bannerLint[index].image ?? "", + height: 90.w, + fit: BoxFit.cover, + + imageBuilder: (context, imageProvider) => Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + image: DecorationImage( + image: imageProvider, + fit: BoxFit.cover, + ), + ), + ), + errorWidget: (context, url, error) => Image.asset( + Assets.imagesUserAvatar, + width: 165.w, + height: 165.w, + fit: BoxFit.cover, + ), + ); + }, + ), + ), Container( padding: EdgeInsets.symmetric(horizontal: 12), margin: EdgeInsets.only(bottom: 10.w), @@ -255,47 +296,6 @@ class _RecommendTabState extends State ], ), ), - Container( - padding: EdgeInsets.symmetric(horizontal: 12), - margin: EdgeInsets.only(bottom: 10.w), - height: 90.w, - child: Swiper( - autoplay: true, - itemCount: controller.bannerLint.length, - loop: true, - onTap: (int index){ - print(index); - if(controller.bannerLint[index].jumpType == 2){ - Get.to(() => OpenWebView(url: controller.bannerLint[index].jumpValue ?? "")); - } else if(controller.bannerLint[index].jumpType == 3){ - TDImageViewer.showImageViewer(context: context, images: [controller.bannerLint[index].jumpValue ?? ""]); - } - }, - itemBuilder: (BuildContext context, int index) { - return CachedNetworkImage( - imageUrl: controller.bannerLint[index].image ?? "", - height: 90.w, - fit: BoxFit.cover, - - imageBuilder: (context, imageProvider) => Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8), - image: DecorationImage( - image: imageProvider, - fit: BoxFit.cover, - ), - ), - ), - errorWidget: (context, url, error) => Image.asset( - Assets.imagesUserAvatar, - width: 165.w, - height: 165.w, - fit: BoxFit.cover, - ), - ); - }, - ), - ), ListView.separated( shrinkWrap: true, // ⭐ 关键 1:高度由内容决定 physics: const NeverScrollableScrollPhysics(), // ⭐ 关键 2:禁用自身滚动