Parcourir la source

update community

glglove il y a 2 mois
Parent
commit
2853acaed0

+ 3 - 3
packages/cpt_community/lib/modules/my_following/my_follow/my_follow_page.dart

@@ -75,11 +75,11 @@ class MyFollowPage extends HookConsumerWidget {
                 final ScrollMetrics metrics = notification.metrics;
                 final double currentOffset = metrics.pixels;
                 final double prevOffset = previousOffset.value;
-                Log.d("---最大滚动距离-----${metrics.maxScrollExtent}-------");
+                // Log.d("---最大滚动距离-----${metrics.maxScrollExtent}-------");
                 if (currentOffset > prevOffset) {
                   // 向上滚动
                   // 日志输出当前滚动偏移量和前一次滚动偏移量
-                  Log.d('--向上滚动---当前currentOffset: $currentOffset, previousOffset: $prevOffset---------');
+                  // Log.d('--向上滚动---当前currentOffset: $currentOffset, previousOffset: $prevOffset---------');
                   if(useSearchBar.value == false && metrics.maxScrollExtent >=0 && currentOffset >= 110){
                     // 滚动到110 时 将 titlebar 换成 searchbar
                     useSearchBar.value = true;
@@ -87,7 +87,7 @@ class MyFollowPage extends HookConsumerWidget {
                 } else if (currentOffset < prevOffset) {
                   // 向下滚动
                   // 日志输出当前滚动偏移量和前一次滚动偏移量
-                  Log.d('--向下滚动---当前currentOffset: $currentOffset, previousOffset: $prevOffset---------');
+                  // Log.d('--向下滚动---当前currentOffset: $currentOffset, previousOffset: $prevOffset---------');
                   if(useSearchBar.value == true && metrics.maxScrollExtent >=0 && currentOffset <= 110){
                     // 滚动到110 时 将 searchbar 换成 titlebar
                     useSearchBar.value = false;

+ 3 - 3
packages/cpt_community/lib/modules/my_following/my_follower/my_follower_page.dart

@@ -75,11 +75,11 @@ class MyFollowerPage extends HookConsumerWidget {
                 final ScrollMetrics metrics = notification.metrics;
                 final double currentOffset = metrics.pixels;
                 final double prevOffset = previousOffset.value;
-                Log.d("---最大滚动距离-----${metrics.maxScrollExtent}-------");
+                // Log.d("---最大滚动距离-----${metrics.maxScrollExtent}-------");
                 if (currentOffset > prevOffset) {
                   // 向上滚动
                   // 日志输出当前滚动偏移量和前一次滚动偏移量
-                  Log.d('--向上滚动---当前currentOffset: $currentOffset, previousOffset: $prevOffset---------');
+                  // Log.d('--向上滚动---当前currentOffset: $currentOffset, previousOffset: $prevOffset---------');
                   if(useSearchBar.value == false && metrics.maxScrollExtent >=0 && currentOffset >= 110){
                     // 滚动到110 时 将 titlebar 换成 searchbar
                     useSearchBar.value = true;
@@ -87,7 +87,7 @@ class MyFollowerPage extends HookConsumerWidget {
                 } else if (currentOffset < prevOffset) {
                   // 向下滚动
                   // 日志输出当前滚动偏移量和前一次滚动偏移量
-                  Log.d('--向下滚动---当前currentOffset: $currentOffset, previousOffset: $prevOffset---------');
+                  // Log.d('--向下滚动---当前currentOffset: $currentOffset, previousOffset: $prevOffset---------');
                   if(useSearchBar.value == true && metrics.maxScrollExtent >=0 && currentOffset <= 110){
                     // 滚动到110 时 将 searchbar 换成 titlebar
                     useSearchBar.value = false;

+ 2 - 2
packages/cpt_community/lib/modules/my_posts/my_posts_forrent/my_posts_forrent_vm.dart

@@ -157,7 +157,7 @@ class MyPostsForRentVm extends _$MyPostsForRentVm {
       final result = await commonGarageRespositoryInstance.fetchMyPostsGarageDataList(params);
       //校验成功失败
       if (result.isSuccess) {
-        handlerResultList((result.list as List<MypostsSaleRentEntity>));
+        handlerResultList((result.data! as MypostsSaleRentEntity).list as List<MypostsSaleRentList>);
       } else {
         String errorMessage = result.errorMsg!;
         changeLoadingState(LoadState.State_Error, errorMessage);
@@ -172,7 +172,7 @@ class MyPostsForRentVm extends _$MyPostsForRentVm {
 
   }
 
-  void handlerResultList(List<MypostsSaleRentEntity>? list) {
+  void handlerResultList(List<MypostsSaleRentList>? list) {
     if (list != null && list.isNotEmpty) {
       //有数据,判断是刷新还是加载更多的数据
       if (_page == 1) {

+ 3 - 2
packages/cpt_community/lib/modules/my_posts/my_posts_forsale/my_posts_forsale_vm.dart

@@ -193,9 +193,10 @@ class MyPostsForSaleVm extends _$MyPostsForSaleVm {
       };
       Log.d("请求参数------$params");
       final result = await commonGarageRespositoryInstance.fetchMyPostsGarageDataList(params);
+
       //校验成功失败
       if (result.isSuccess) {
-        handlerResultList((result.list as List<MypostsSaleRentEntity>));
+        handlerResultList((result.data! as MypostsSaleRentEntity).list as List<MypostsSaleRentList>);
       } else {
         String errorMessage = result.errorMsg!;
         changeLoadingState(LoadState.State_Error, errorMessage);
@@ -212,7 +213,7 @@ class MyPostsForSaleVm extends _$MyPostsForSaleVm {
   }
 
 
-  void handlerResultList(List<MypostsSaleRentEntity>? list) {
+  void handlerResultList(List<MypostsSaleRentList>? list) {
     if (list != null && list.isNotEmpty) {
       //有数据,判断是刷新还是加载更多的数据
       if (_page == 1) {

+ 4 - 3
packages/cpt_community/lib/respository/common_garage.dart

@@ -132,10 +132,11 @@ class CommonGarageRespository {
     //根据返回的结果,封装原始数据为Bean/Entity对象
     if (result.isSuccess) {
       //重新赋值data或list
-      final json = result.getListJson();
-      List<MypostsSaleRentEntity> data = json?.map((item) => MypostsSaleRentEntity.fromJson(item)).toList() ?? [];
+      final json = result.getDataJson();
+
+      var data = MypostsSaleRentEntity.fromJson(json!);
       //重新赋值data或list
-      return result.convert(list: data);
+      return result.convert(data: data);
     }else {
       if(result.errorMsg != null && result.errorMsg!.isNotEmpty){
         ToastEngine.show("${result.errorMsg}");

+ 24 - 3
packages/cs_domain/lib/entity/myposts_sale_rent_entity.dart

@@ -5,6 +5,27 @@ export 'package:domain/generated/json/myposts_sale_rent_entity.g.dart';
 
 @JsonSerializable()
 class MypostsSaleRentEntity {
+	int? count;
+	int? page;
+	int? limit;
+	@JSONField(name: "count_page")
+	int? countPage;
+	List<MypostsSaleRentList>? list;
+
+	MypostsSaleRentEntity();
+
+	factory MypostsSaleRentEntity.fromJson(Map<String, dynamic> json) => $MypostsSaleRentEntityFromJson(json);
+
+	Map<String, dynamic> toJson() => $MypostsSaleRentEntityToJson(this);
+
+	@override
+	String toString() {
+		return jsonEncode(this);
+	}
+}
+
+@JsonSerializable()
+class MypostsSaleRentList {
 	int? id;
 	String? title;
 	int? price;
@@ -14,11 +35,11 @@ class MypostsSaleRentEntity {
 	@JSONField(name: "likes_count")
 	int? likesCount;
 
-	MypostsSaleRentEntity();
+	MypostsSaleRentList();
 
-	factory MypostsSaleRentEntity.fromJson(Map<String, dynamic> json) => $MypostsSaleRentEntityFromJson(json);
+	factory MypostsSaleRentList.fromJson(Map<String, dynamic> json) => $MypostsSaleRentListFromJson(json);
 
-	Map<String, dynamic> toJson() => $MypostsSaleRentEntityToJson(this);
+	Map<String, dynamic> toJson() => $MypostsSaleRentListToJson(this);
 
 	@override
 	String toString() {

+ 5 - 0
packages/cs_domain/lib/generated/json/base/json_convert_content.dart

@@ -317,6 +317,10 @@ class JsonConvert {
       return data.map<MypostsSaleRentEntity>((Map<String, dynamic> e) =>
           MypostsSaleRentEntity.fromJson(e)).toList() as M;
     }
+    if (<MypostsSaleRentList>[] is M) {
+      return data.map<MypostsSaleRentList>((Map<String, dynamic> e) =>
+          MypostsSaleRentList.fromJson(e)).toList() as M;
+    }
     if (<NewsfeedCommentPublishEntity>[] is M) {
       return data.map<NewsfeedCommentPublishEntity>((Map<String, dynamic> e) =>
           NewsfeedCommentPublishEntity.fromJson(e)).toList() as M;
@@ -510,6 +514,7 @@ class JsonConvertClassCollection {
     (MypostsNewsfeedListAccount).toString(): MypostsNewsfeedListAccount
         .fromJson,
     (MypostsSaleRentEntity).toString(): MypostsSaleRentEntity.fromJson,
+    (MypostsSaleRentList).toString(): MypostsSaleRentList.fromJson,
     (NewsfeedCommentPublishEntity).toString(): NewsfeedCommentPublishEntity
         .fromJson,
     (NewsfeedDetailEntity).toString(): NewsfeedDetailEntity.fromJson,

+ 68 - 12
packages/cs_domain/lib/generated/json/myposts_sale_rent_entity.g.dart

@@ -4,36 +4,92 @@ import 'package:domain/entity/myposts_sale_rent_entity.dart';
 MypostsSaleRentEntity $MypostsSaleRentEntityFromJson(
     Map<String, dynamic> json) {
   final MypostsSaleRentEntity mypostsSaleRentEntity = MypostsSaleRentEntity();
+  final int? count = jsonConvert.convert<int>(json['count']);
+  if (count != null) {
+    mypostsSaleRentEntity.count = count;
+  }
+  final int? page = jsonConvert.convert<int>(json['page']);
+  if (page != null) {
+    mypostsSaleRentEntity.page = page;
+  }
+  final int? limit = jsonConvert.convert<int>(json['limit']);
+  if (limit != null) {
+    mypostsSaleRentEntity.limit = limit;
+  }
+  final int? countPage = jsonConvert.convert<int>(json['count_page']);
+  if (countPage != null) {
+    mypostsSaleRentEntity.countPage = countPage;
+  }
+  final List<MypostsSaleRentList>? list = (json['list'] as List<dynamic>?)
+      ?.map(
+          (e) =>
+      jsonConvert.convert<MypostsSaleRentList>(e) as MypostsSaleRentList)
+      .toList();
+  if (list != null) {
+    mypostsSaleRentEntity.list = list;
+  }
+  return mypostsSaleRentEntity;
+}
+
+Map<String, dynamic> $MypostsSaleRentEntityToJson(
+    MypostsSaleRentEntity entity) {
+  final Map<String, dynamic> data = <String, dynamic>{};
+  data['count'] = entity.count;
+  data['page'] = entity.page;
+  data['limit'] = entity.limit;
+  data['count_page'] = entity.countPage;
+  data['list'] = entity.list?.map((v) => v.toJson()).toList();
+  return data;
+}
+
+extension MypostsSaleRentEntityExtension on MypostsSaleRentEntity {
+  MypostsSaleRentEntity copyWith({
+    int? count,
+    int? page,
+    int? limit,
+    int? countPage,
+    List<MypostsSaleRentList>? list,
+  }) {
+    return MypostsSaleRentEntity()
+      ..count = count ?? this.count
+      ..page = page ?? this.page
+      ..limit = limit ?? this.limit
+      ..countPage = countPage ?? this.countPage
+      ..list = list ?? this.list;
+  }
+}
+
+MypostsSaleRentList $MypostsSaleRentListFromJson(Map<String, dynamic> json) {
+  final MypostsSaleRentList mypostsSaleRentList = MypostsSaleRentList();
   final int? id = jsonConvert.convert<int>(json['id']);
   if (id != null) {
-    mypostsSaleRentEntity.id = id;
+    mypostsSaleRentList.id = id;
   }
   final String? title = jsonConvert.convert<String>(json['title']);
   if (title != null) {
-    mypostsSaleRentEntity.title = title;
+    mypostsSaleRentList.title = title;
   }
   final int? price = jsonConvert.convert<int>(json['price']);
   if (price != null) {
-    mypostsSaleRentEntity.price = price;
+    mypostsSaleRentList.price = price;
   }
   final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
           (e) => jsonConvert.convert<String>(e) as String).toList();
   if (resources != null) {
-    mypostsSaleRentEntity.resources = resources;
+    mypostsSaleRentList.resources = resources;
   }
   final String? createdAt = jsonConvert.convert<String>(json['created_at']);
   if (createdAt != null) {
-    mypostsSaleRentEntity.createdAt = createdAt;
+    mypostsSaleRentList.createdAt = createdAt;
   }
   final int? likesCount = jsonConvert.convert<int>(json['likes_count']);
   if (likesCount != null) {
-    mypostsSaleRentEntity.likesCount = likesCount;
+    mypostsSaleRentList.likesCount = likesCount;
   }
-  return mypostsSaleRentEntity;
+  return mypostsSaleRentList;
 }
 
-Map<String, dynamic> $MypostsSaleRentEntityToJson(
-    MypostsSaleRentEntity entity) {
+Map<String, dynamic> $MypostsSaleRentListToJson(MypostsSaleRentList entity) {
   final Map<String, dynamic> data = <String, dynamic>{};
   data['id'] = entity.id;
   data['title'] = entity.title;
@@ -44,8 +100,8 @@ Map<String, dynamic> $MypostsSaleRentEntityToJson(
   return data;
 }
 
-extension MypostsSaleRentEntityExtension on MypostsSaleRentEntity {
-  MypostsSaleRentEntity copyWith({
+extension MypostsSaleRentListExtension on MypostsSaleRentList {
+  MypostsSaleRentList copyWith({
     int? id,
     String? title,
     int? price,
@@ -53,7 +109,7 @@ extension MypostsSaleRentEntityExtension on MypostsSaleRentEntity {
     String? createdAt,
     int? likesCount,
   }) {
-    return MypostsSaleRentEntity()
+    return MypostsSaleRentList()
       ..id = id ?? this.id
       ..title = title ?? this.title
       ..price = price ?? this.price