ソースを参照

update property

glglove 4 ヶ月 前
コミット
0a8d90919c
共有24 個のファイルを変更した731 個の追加459 個の削除を含む
  1. 28 28
      packages/cpt_property/lib/modules/news/page/property_news_page.dart
  2. 30 37
      packages/cpt_property/lib/modules/news/page/property_news_state.dart
  3. 48 9
      packages/cpt_property/lib/modules/news/repository/property_news_repository.dart
  4. 128 114
      packages/cpt_property/lib/modules/news/vm/property_news_vm.dart
  5. 1 1
      packages/cpt_property/lib/modules/news/vm/property_news_vm.g.dart
  6. 1 1
      packages/cpt_property/lib/modules/rent/page/property_rent_page.dart
  7. 18 18
      packages/cpt_property/lib/modules/rent/page/property_rent_state.dart
  8. 0 70
      packages/cpt_property/lib/modules/rent/repository/property_rent_repository.dart
  9. 0 29
      packages/cpt_property/lib/modules/rent/repository/property_rent_repository.g.dart
  10. 107 47
      packages/cpt_property/lib/modules/rent/vm/property_rent_vm.dart
  11. 1 1
      packages/cpt_property/lib/modules/rent/vm/property_rent_vm.g.dart
  12. 2 1
      packages/cpt_property/lib/modules/sale/page/property_sale_page.dart
  13. 18 18
      packages/cpt_property/lib/modules/sale/page/property_sale_state.dart
  14. 5 6
      packages/cpt_property/lib/modules/sale/repository/property_sale_repository.dart
  15. 99 41
      packages/cpt_property/lib/modules/sale/vm/property_sale_vm.dart
  16. 1 1
      packages/cpt_property/lib/modules/sale/vm/property_sale_vm.g.dart
  17. 5 2
      packages/cpt_property/pubspec.yaml
  18. 25 0
      packages/cs_domain/lib/entity/property_news_entity.dart
  19. 25 0
      packages/cs_domain/lib/entity/property_sale_entity.dart
  20. 42 15
      packages/cs_domain/lib/generated/json/base/json_convert_content.dart
  21. 55 0
      packages/cs_domain/lib/generated/json/property_news_entity.g.dart
  22. 55 0
      packages/cs_domain/lib/generated/json/property_sale_entity.g.dart
  23. 31 14
      packages/cs_domain/lib/generated/json/user_me_entity.g.dart
  24. 6 6
      packages/cs_plugin_platform/lib/http/dio_engine.dart

+ 28 - 28
packages/cpt_property/lib/modules/news/page/property_news_page.dart

@@ -35,10 +35,10 @@ class PropertyNewsPage extends HookConsumerWidget {
   static double cardHeight = 117.5 + 50;
   static double cardLeftWidth = 125;
 
-  Widget _buildItemLeftSection(BuildContext context,WidgetRef ref, item, _vm) {
-    final imageHeight = item['pic']!.isNotEmpty? cardHeight + 15 : cardHeight;
+  Widget _buildItemLeftSection(BuildContext context,WidgetRef ref, item, vm) {
+    // final imageHeight = item['pic']!.isNotEmpty? cardHeight : cardHeight;
     return Container(
-        height: imageHeight,
+        height: cardHeight,
         width: cardLeftWidth,
         decoration: BoxDecoration(
           color: ColorUtils.string2Color('#F2F3F6'),
@@ -50,26 +50,26 @@ class PropertyNewsPage extends HookConsumerWidget {
         ),
         child: Center(
           child: MyLoadImage(
-            item['pic'],
+            item['cover_image'],
             placeholderPath: Assets.propertyNewsItemBg,
-            height: item['pic']!.isNotEmpty? imageHeight : 60.5,
-            width: item['pic']!.isNotEmpty? cardLeftWidth : 50.5,
+            height: item['cover_image']!.isNotEmpty? cardHeight : 60.5,
+            width: item['cover_image']!.isNotEmpty? cardLeftWidth : 60.5,
             // fit: BoxFit.cover,
-            fit: BoxFit.cover,
+            fit: BoxFit.fill,
             cornerRadius: 8,
           ),
         )
     );
   }
 
-  Widget _buildItemRightSection(BuildContext context,WidgetRef ref, item, _vm) {
-    // 使用 ref.select 监听 list 中 item 的 Map 对象中的 isCollection 字段
-    final isCollection = ref.watch(propertyNewsVmProvider.select((state) {
-      final curItem = state.list.firstWhere(
+  Widget _buildItemRightSection(BuildContext context,WidgetRef ref, item, vm) {
+    // 使用 ref.select 监听 list 中 item 的 Map 对象中的 liked 字段
+    final liked = ref.watch(propertyNewsVmProvider.select((state) {
+      final curItem = state.list!.firstWhere(
             (valueItem) => valueItem['id'] == item['id'],
-        orElse: () => {'isCollection': false},
+        orElse: () => {'liked': false},
       );
-      return curItem['isCollection'] as bool;
+      return curItem['liked'] as bool;
     }));
 
     return Container(
@@ -106,7 +106,7 @@ class PropertyNewsPage extends HookConsumerWidget {
                 children: [
                   Expanded(
                     child: MyTextView(
-                      item['description'],
+                      item['content'],
                       maxLines: 2, // 设置最大行数为2
                       isTextEllipsis: true, // 超出部分用省略号表示
                       fontSize: 12,
@@ -136,9 +136,9 @@ class PropertyNewsPage extends HookConsumerWidget {
           Positioned(
             right: 5,
             bottom: 0,
-            child: MyAssetImage(isCollection? Assets.propertyCollectionActive:Assets.propertyCollection,width:22,height: 20.5,).onTap((){
+            child: MyAssetImage(liked? Assets.propertyCollectionActive:Assets.propertyCollection,width:22,height: 20.5,).onTap((){
               Log.d("点击了收藏按钮");
-              _vm.handlerCollection(item, isCollection);
+              vm.handlerCollection(item, liked);
             }),
           ),
         ],
@@ -149,7 +149,7 @@ class PropertyNewsPage extends HookConsumerWidget {
   }
 
   // listitem
-  Widget _buildNewsItem(BuildContext context,WidgetRef ref, item, _vm) {
+  Widget _buildNewsItem(BuildContext context,WidgetRef ref, item, vm) {
     return Row(
       mainAxisAlignment: MainAxisAlignment.center,
       crossAxisAlignment: CrossAxisAlignment.center,
@@ -173,8 +173,8 @@ class PropertyNewsPage extends HookConsumerWidget {
             mainAxisAlignment: MainAxisAlignment.start,
             crossAxisAlignment: CrossAxisAlignment.start,
             children: [
-              _buildItemLeftSection(context, ref, item, _vm),
-              Expanded(child: _buildItemRightSection(context, ref, item, _vm)),
+              _buildItemLeftSection(context, ref, item, vm),
+              Expanded(child: _buildItemRightSection(context, ref, item, vm)),
             ],
           ),
         ).constrained(
@@ -183,18 +183,18 @@ class PropertyNewsPage extends HookConsumerWidget {
       ],
     ).onTap((){
       // 去详情
-      // _vm.goNewsDetail(item);
+      // vm.goNewsDetail(item);
     });
   }
 
 
   @override
   Widget build(BuildContext context, WidgetRef ref) {
-    final _vm = ref.read(propertyNewsVmProvider.notifier);
+    final vm = ref.read(propertyNewsVmProvider.notifier);
     final state = ref.watch(propertyNewsVmProvider);
     useEffect(() {
       // 组件挂载时执行 - 执行接口请求
-      Future.microtask(() => _vm.initPageData());
+      Future.microtask(() => vm.initPageData());
       return () {
         // 组件卸载时执行
         Log.d("property_news_page 组件卸载时执行");
@@ -209,30 +209,30 @@ class PropertyNewsPage extends HookConsumerWidget {
         width: double.infinity,
         height: double.infinity,
         child: EasyRefresh(
-          controller: _vm.refreshController,
+          controller: vm.refreshController,
           // 上拉加载
           onLoad: () async{
             Log.d("----onLoad");
-            _vm.loadMore();
+            vm.loadMore();
           },
           // 下拉刷新
           onRefresh: () async{
             Log.d("----onRefresh");
-            _vm.onRefresh();
+            vm.onRefresh();
           },
           child: LoadStateLayout(
             state: state.loadingState,
             errorMessage: state.errorMessage,
             errorRetry: () {
-              _vm.retryRequest();
+              vm.retryRequest();
             },
             successSliverWidget: [
                 SliverList(
                   delegate: SliverChildBuilderDelegate(
                         (context, index){
-                          return _buildNewsItem(context, ref, state.list[index], _vm);
+                          return _buildNewsItem(context, ref, state.list![index], vm);
                         },
-                    childCount: state.list.length
+                    childCount: state.list!.length
                   )
                 )
             ],

+ 30 - 37
packages/cpt_property/lib/modules/news/page/property_news_state.dart

@@ -9,60 +9,53 @@ class PropertyNewsState {
     LoadState loadingState;
     String? errorMessage;
 
-    int? curPage;
-    int? pageSize = 10;
-    int? filterCount = 1;
-    List<Map<String, dynamic>> list;
+    int? page;
+    int? limit = 10;
+    int? count = 1;
+    List<Map<String, dynamic>>? list;
 
     PropertyNewsState({
         this.loadingState = LoadState.State_Loading,
         String? errorMessage,
-        this.curPage = 1,
-        this.pageSize = 10,
-        this.filterCount = 1,
+        this.page = 1,
+        this.limit = 10,
+        this.count = 1,
         required this.list,
     });
 
-
-
+    PropertyNewsState copyWith({
+    LoadState? loadingState,
+    String? errorMessage,
+    int? page,
+    int? limit,
+    int? count,
+    List<Map<String, dynamic>>? list,
+  }) {
+    return PropertyNewsState(
+      loadingState: loadingState ?? this.loadingState,
+      errorMessage: errorMessage ?? this.errorMessage,
+      page: page ?? this.page,
+      limit: limit ?? this.limit,
+      count: count ?? this.count,
+      list: list ?? this.list,
+    );
+  }
 
     Map<String, dynamic> toMap() {
     return {
-      'loadingState': this.loadingState,
-      'errorMessage': this.errorMessage,
-      'curPage': this.curPage,
-      'pageSize': this.pageSize,
-      'filterCount': this.filterCount,
+      'page': this.page,
+      'limit': this.limit,
+      'count': this.count,
       'list': this.list,
     };
   }
 
   factory PropertyNewsState.fromMap(Map<String, dynamic> map) {
     return PropertyNewsState(
-      loadingState: map['loadingState'] as LoadState,
-      errorMessage: map['errorMessage'] as String,
-      curPage: map['curPage'] as int,
-      pageSize: map['pageSize'] as int,
-      filterCount: map['filterCount'] as int,
+      page: map['page'] as int,
+      limit: map['limit'] as int,
+      count: map['count'] as int,
       list: map['list'] as List<Map<String, dynamic>>,
     );
   }
-
-    PropertyNewsState copyWith({
-    LoadState? loadingState,
-    String? errorMessage,
-    int? curPage,
-    int? pageSize,
-    int? filterCount,
-    List<Map<String, dynamic>>? list,
-  }) {
-    return PropertyNewsState(
-      loadingState: loadingState ?? this.loadingState,
-      errorMessage: errorMessage ?? this.errorMessage,
-      curPage: curPage ?? this.curPage,
-      pageSize: pageSize ?? this.pageSize,
-      filterCount: filterCount ?? this.filterCount,
-      list: list ?? this.list,
-    );
-  }
 }

+ 48 - 9
packages/cpt_property/lib/modules/news/repository/property_news_repository.dart

@@ -1,9 +1,11 @@
 import 'package:domain/constants/api_constants.dart';
+import 'package:domain/entity/property_news_entity.dart';
 import 'package:domain/entity/server_time.dart';
 import 'package:plugin_platform/platform_export.dart';
 import 'package:plugin_platform/http/dio_engine.dart';
 import 'package:plugin_platform/http/http_result.dart';
 import 'package:riverpod_annotation/riverpod_annotation.dart';
+import 'package:shared/utils/log_utils.dart';
 import 'package:shared/utils/util.dart';
 
 import 'package:flutter_riverpod/flutter_riverpod.dart';
@@ -27,19 +29,14 @@ class PropertyNewsRepository {
 
   PropertyNewsRepository({required this.dioEngine});
 
-  Future<HttpResult<Object>> fetchPropertyNewsList(
+  Future<HttpResult<Object>> fetchList(
       Map<String, dynamic>? data, {
         CancelToken? cancelToken,
       }) async {
     Map<String, dynamic> params = {};
 
-    // if (!Utils.isEmpty(type)) {
-    //   params["type"] = type!;
-    // }
-
     params = data!;
 
-
     Map<String, String> headers = {};
 
     headers["Content-Type"] = "application/x-www-form-urlencoded";
@@ -47,7 +44,7 @@ class PropertyNewsRepository {
 
     final result = await dioEngine.requestNetResult(
       // ApiConstants.apiServerTime, // api 地址
-      '/index.php/api/employee/extra/time', // api 地址
+      '/api/v1/user/property/news/list', // api 地址
       params: params,
       headers: headers,
       method: HttpMethod.GET,
@@ -56,16 +53,58 @@ class PropertyNewsRepository {
       cancelToken: cancelToken,
     );
 
+    Log.d("------请求返回的result--$result--------");
     //根据返回的结果,封装原始数据为Bean/Entity对象
     if (result.isSuccess) {
       //重新赋值data或list
       final json = result.getDataJson();
-      var data = PropertyNewsState.fromMap(json!);
+      var data = PropertyNewsEntity.fromJson(json!);
       //重新赋值data或list
-      return result.convert<PropertyNewsState>(data: data);
+      return result.convert<PropertyNewsEntity>(data: data);
     }
     return result.convert();
   }
 
 
+  // 点赞/取消点赞
+  Future<HttpResult<Object>> fetchPropertyNewsLikeClick(
+      Map<String, dynamic>? data, {
+        CancelToken? cancelToken,
+      }) async {
+    Map<String, dynamic> params = {};
+
+    params = data!;
+
+    Map<String, String> headers = {};
+
+    headers["Content-Type"] = "application/x-www-form-urlencoded";
+    headers["Accept"] = "application/x.yyjobs-api.v1+json";
+
+    final result = await dioEngine.requestNetResult(
+      // ApiConstants.apiServerTime, // api 地址
+      '/api/v1/user/property/like/click', // api 地址
+      params: params,
+      headers: headers,
+      method: HttpMethod.POST,
+      isShowLoadingDialog: true,  //是否展示默认的Loading弹窗
+      networkDebounce: true,   //是否防抖防止重复请求
+      cancelToken: cancelToken,
+    );
+
+    Log.d("------请求返回的result--$result--------");
+    //根据返回的结果,封装原始数据为Bean/Entity对象
+    if (result.isSuccess) {
+      //重新赋值data或list
+      final json = result.getDataJson();
+
+      if(json!=null && json['data'] == true){
+        return result.convert<bool>(data: true);
+      }else {
+        return result.convert<bool>(data: false);
+      }
+    }
+    return result.convert();
+  }
+
 }
+

+ 128 - 114
packages/cpt_property/lib/modules/news/vm/property_news_vm.dart

@@ -1,3 +1,4 @@
+import 'package:domain/entity/property_news_entity.dart';
 import 'package:plugin_platform/http/http_result.dart';
 import 'package:riverpod_annotation/riverpod_annotation.dart';
 import 'package:shared/utils/log_utils.dart';
@@ -55,16 +56,16 @@ class PropertyNewsVm extends _$PropertyNewsVm {
   Future loadMore() async {
     Log.d("----property_news_vm-----loadMore");
     // await Future.delayed(const Duration(seconds: 2));
-    // if(state.list.length >= state.filterCount){
+    // if(state.list.length >= state.count){
     //   return;
     // }else {
-    //   int curPage = state.curPage + 1;
-    //   state = state.copyWith(curPage: curPage,);
+    //   int page = state.page + 1;
+    //   state = state.copyWith(page: page,);
     //   getListData();
     // }
-    // 检查 curPage 是否为 null,并初始化为 1
-    int newCurPage = state.curPage ?? 1;
-    state = state.copyWith(curPage: ++newCurPage);
+    // 检查 page 是否为 null,并初始化为 1
+    int newCurPage = state.page ?? 1;
+    state = state.copyWith(page: ++newCurPage);
     getListData();
   }
 
@@ -74,13 +75,13 @@ class PropertyNewsVm extends _$PropertyNewsVm {
     Log.d("----property_news_vm-----onRefresh ");
 
     // await Future.delayed(const Duration(seconds: 2));
-    state = state.copyWith(curPage: 1);
+    state = state.copyWith(page: 1);
     getListData();
   }
 
   // 重试请求
   Future retryRequest() async {
-    state = state.copyWith(curPage: 1);
+    state = state.copyWith(page: 1);
     _needShowPlaceholder = true;
     getListData();
   }
@@ -92,72 +93,103 @@ class PropertyNewsVm extends _$PropertyNewsVm {
       changeLoadingState(LoadState.State_Loading, null);
     }
 
-    Log.d("加载listData数据---------------start--${state.curPage}---");
-    //   try {
-    //     //请求网络
-    //     Map<String, dynamic>  params = {
-    //       "curPage": state.curPage,
-    //       "pageSize": state.pageSize,
-    //     };
-    //     Log.d("请求参数------$params");
-    //     final result = await propertyNewsRepository.fetchPropertyNewsList(params);
-    //     Log.d("请求完成结果------${result.data}");
-    //     //校验成功失败
-    //     if (result.isSuccess) {
-    //       // state = state.copyWith(serverTime: result.data);
-    //       state = state;
-    //   handleList(listResult.data?.rows);
-    //       ToastEngine.show("获取数据成功");
-    //     } else {
-    //   errorMessage = listResult.errorMsg;
-    //   changeLoadingState(LoadState.State_Error);
-    //       ToastEngine.show(result.errorMsg ?? "Network Load Error");
-    //     }
-    //   } catch (e) {
-    //     ToastEngine.show("Error: $e");
+    Log.d("加载listData数据---------------start--${state.page}---");
+      try {
+        //请求网络
+        Map<String, dynamic>  params = {
+          "page": state.page,
+          "limit": state.limit,
+        };
+        Log.d("请求参数------$params");
+        final result = await propertyNewsRepository.fetchList(params);
+        //校验成功失败
+        if (result.isSuccess) {
+          handlerResultList((result.data as PropertyNewsEntity).list);
+        } else {
+          String errorMessage = result.errorMsg!;
+          changeLoadingState(LoadState.State_Error, errorMessage);
+          ToastEngine.show(result.errorMsg ?? "Network Load Error");
+        }
+      } catch (e) {
+        ToastEngine.show("Error: $e");
+      }
+
+
+    // await Future.delayed(const Duration(milliseconds: 1500));
+    // final List<Map<String, dynamic>> listData = [
+    //   {
+    //     "id": 1,
+    //     "title": "法国进口高档国家的看过艰苦奋斗是感觉扣税的房价过快岁的法国艰苦奋斗是架构开发更加开放的国际法的是",
+    //     "description": "fsklfdsk罚款乱收费上课了发送卡fsklfdsk罚款乱收费上课了发送卡fsklfdsk罚款乱收费上课了发送卡fsklfdsk罚款乱收费上课了发送卡fsklfdsk罚款乱收费上课了发送卡",
+    //     "time": "2024-02-15 12:00:00",
+    //     "isCollection": true,
+    //     "pic": "https://img1.baidu.com/it/u=2500825327,873404587&fm=253&fmt=auto&app=138&f=JPEG?w=750&h=500"
+    //   },
+    //   {
+    //     "id": 2,
+    //     "title": "JHKFDSAJKjfkdsfjkasjkjklfajfkajifwoqirujweiqofjndsaikfniasdhfiasdhfiadshfifjadslfjkdlsafjlkadsj",
+    //     "description": "oifosjf fjdskafj hjiwehfriohjfiash",
+    //     "time": "2024-10-16 12:00:00",
+    //     "isCollection": false,
+    //     "pic": ""
+    //   },
+    // ];
+    //
+    // if (state.page == 1) {
+    //   //刷新的方式
+    //   state = state.copyWith(list: listData);
+    //   refreshController.finishRefresh();
+    //   //更新展示的状态
+    //   changeLoadingState(LoadState.State_Success, null);
+    // } else {
+    //   //加载更多
+    //   final allList = state.list;
+    //   if(allList.length >= state.count! * state.limit!){
+    //     //更新展示的状态
+    //     changeLoadingState(LoadState.State_Success, null);
+    //     refreshController.finishLoad(IndicatorResult.noMore);
+    //   }else {
+    //     allList.addAll(listData);
+    //     state = state.copyWith(list: allList);
+    //     refreshController.finishLoad();
     //   }
+    // }
+    // // 最后赋值
+    // _needShowPlaceholder = false;
+  }
+
+  void handlerResultList(List? list) {
+    if (list != null && list.isNotEmpty) {
+      //有数据,判断是刷新还是加载更多的数据
+      if (state.page == 1) {
+        //刷新的方式
+        state.list!.clear();
+        state.list!.addAll(list as List<Map<String, dynamic>>);
+        refreshController.finishRefresh();
 
-    await Future.delayed(const Duration(milliseconds: 1500));
-    final List<Map<String, dynamic>> listData = [
-      {
-        "id": 1,
-        "title": "法国进口高档国家的看过艰苦奋斗是感觉扣税的房价过快岁的法国艰苦奋斗是架构开发更加开放的国际法的是",
-        "description": "fsklfdsk罚款乱收费上课了发送卡fsklfdsk罚款乱收费上课了发送卡fsklfdsk罚款乱收费上课了发送卡fsklfdsk罚款乱收费上课了发送卡fsklfdsk罚款乱收费上课了发送卡",
-        "time": "2024-02-15 12:00:00",
-        "isCollection": true,
-        "pic": "https://img1.baidu.com/it/u=2500825327,873404587&fm=253&fmt=auto&app=138&f=JPEG?w=750&h=500"
-      },
-      {
-        "id": 2,
-        "title": "JHKFDSAJKjfkdsfjkasjkjklfajfkajifwoqirujweiqofjndsaikfniasdhfiasdhfiadshfifjadslfjkdlsafjlkadsj",
-        "description": "oifosjf fjdskafj hjiwehfriohjfiash",
-        "time": "2024-10-16 12:00:00",
-        "isCollection": false,
-        "pic": ""
-      },
-    ];
-
-    if (state.curPage == 1) {
-      //刷新的方式
-      state = state.copyWith(list: listData);
-      refreshController.finishRefresh();
-      //更新展示的状态
-      changeLoadingState(LoadState.State_Success, null);
-    } else {
-      //加载更多
-      final allList = state.list;
-      if(allList.length >= state.filterCount! * state.pageSize!){
         //更新展示的状态
         changeLoadingState(LoadState.State_Success, null);
-        refreshController.finishLoad(IndicatorResult.noMore);
-      }else {
-        allList.addAll(listData);
+      } else {
+        //加载更多
+        final allList = state.list;
         state = state.copyWith(list: allList);
         refreshController.finishLoad();
+        // update();
+      }
+    } else {
+      if (state.page == 1) {
+        //展示无数据的布局
+        state.list!.clear();
+        changeLoadingState(LoadState.State_Empty, null);
+        refreshController.finishRefresh();
+      } else {
+        //展示加载完成,没有更多数据了
+        if(state.list!.length == 0){
+          changeLoadingState(LoadState.State_Empty, null);
+        }
+        refreshController.finishLoad(IndicatorResult.noMore);
       }
     }
-    // 最后赋值
-    _needShowPlaceholder = false;
   }
 
 
@@ -168,56 +200,38 @@ class PropertyNewsVm extends _$PropertyNewsVm {
   }
 
   // 收藏/取消收藏
-  void handlerCollection(curItem, bool isCollection){
-
-    List<Map<String, dynamic>> newList = state.list.map((item) {
-        if(item['id'] == curItem['id']){
-          return {
-            ...item,
-            'isCollection': !isCollection
-          };
+  void handlerCollection(curItem, bool liked) async {
+    try {
+      Map<String, dynamic> params = {
+        "id": curItem['id'],
+      };
+      final result = await propertyNewsRepository.fetchPropertyNewsLikeClick(params);
+      //校验成功失败
+      if (result.isSuccess) {
+        List<Map<String, dynamic>>? newList = state.list?.map((item) {
+          if(item['id'] == curItem['id']){
+            return {
+              ...item,
+              'liked': !liked
+            };
+          }
+          return item;
+        }).toList();
+        // Log.d("handlerCollection $newList");
+        state = state.copyWith(list: newList);
+        if(liked){
+          ToastEngine.show("取消收藏");
+        }else {
+          ToastEngine.show("收藏成功");
         }
-        return item;
-    }).toList();
-    // Log.d("handlerCollection $newList");
-    state = state.copyWith(list: newList);
-    if(isCollection){
-      ToastEngine.show("取消收藏");
-    }else {
-      ToastEngine.show("收藏成功");
+      } else {
+        String errorMessage = result.errorMsg!;
+        ToastEngine.show(errorMessage ?? "Network Load Error");
+      }
+
+    } catch (e) {
+      ToastEngine.show("Error: $e");
     }
   }
 
-
-
-// 处理数据与展示的逻辑
-// void handleList(List<JobAppliedListSGRows>? list) {
-//   if (list != null && list.isNotEmpty) {
-//     //有数据,判断是刷新还是加载更多的数据
-//     if (_curPage == 1) {
-//       //刷新的方式
-//       state.list.clear();
-//       state.list.addAll(list);
-//       refreshController.finishRefresh();
-//
-//       //更新展示的状态
-//       changeLoadingState(LoadState.State_Success);
-//     } else {
-//       //加载更多
-//       state.list.addAll(list);
-//       refreshController.finishLoad();
-//       update();
-//     }
-//   } else {
-//     if (_curPage == 1) {
-//       //展示无数据的布局
-//       state.list.clear();
-//       changeLoadingState(LoadState.State_Empty);
-//       refreshController.finishRefresh();
-//     } else {
-//       //展示加载完成,没有更多数据了
-//       refreshController.finishLoad(IndicatorResult.noMore);
-//     }
-//   }
-// }
 }

+ 1 - 1
packages/cpt_property/lib/modules/news/vm/property_news_vm.g.dart

@@ -6,7 +6,7 @@ part of 'property_news_vm.dart';
 // RiverpodGenerator
 // **************************************************************************
 
-String _$propertyNewsVmHash() => r'0a31694e75c48792b56b3e8bf7fbf442af24659a';
+String _$propertyNewsVmHash() => r'0cae6de1cd893ca95b0f8219b04f29c362f77a13';
 
 /// See also [PropertyNewsVm].
 @ProviderFor(PropertyNewsVm)

+ 1 - 1
packages/cpt_property/lib/modules/rent/page/property_rent_page.dart

@@ -168,7 +168,7 @@ class PropertyRentPage extends HookConsumerWidget {
                 )
               ],
             ),
-          )
+          ).marginOnly(top: 5, bottom: 5)
       ),
     );
   }

+ 18 - 18
packages/cpt_property/lib/modules/rent/page/property_rent_state.dart

@@ -9,26 +9,26 @@ class PropertyRentState {
   LoadState loadingState;
   String? errorMessage;
 
-  int? curPage;
-  int? pageSize = 10;
-  int? filterCount = 0;
+  int? page;
+  int? limit = 10;
+  int? count = 0;
   List<Map<String, dynamic>> list;
 
   PropertyRentState({
     this.loadingState = LoadState.State_Loading,
     String? errorMessage,
-    this.curPage = 1,
-    this.pageSize = 10,
-    this.filterCount = 0,
+    this.page = 1,
+    this.limit = 10,
+    this.count = 0,
     required this.list,
   });
   Map<String, dynamic> toMap() {
     return {
       'loadingState': this.loadingState,
       'errorMessage': this.errorMessage,
-      'curPage': this.curPage,
-      'pageSize': this.pageSize,
-      'filterCount': this.filterCount,
+      'page': this.page,
+      'limit': this.limit,
+      'count': this.count,
       'list': this.list,
     };
   }
@@ -37,9 +37,9 @@ class PropertyRentState {
     return PropertyRentState(
       loadingState: map['loadingState'] as LoadState,
       errorMessage: map['errorMessage'] as String,
-      curPage: map['curPage'] as int,
-      pageSize: map['pageSize'] as int,
-      filterCount: map['filterCount'] as int,
+      page: map['page'] as int,
+      limit: map['limit'] as int,
+      count: map['count'] as int,
       list: map['list'] as List<Map<String, dynamic>>,
     );
   }
@@ -47,17 +47,17 @@ class PropertyRentState {
   PropertyRentState copyWith({
     LoadState? loadingState,
     String? errorMessage,
-    int? curPage,
-    int? pageSize,
-    int? filterCount,
+    int? page,
+    int? limit,
+    int? count,
     List<Map<String, dynamic>>? list,
   }) {
     return PropertyRentState(
       loadingState: loadingState ?? this.loadingState,
       errorMessage: errorMessage ?? this.errorMessage,
-      curPage: curPage ?? this.curPage,
-      pageSize: pageSize ?? this.pageSize,
-      filterCount: filterCount ?? this.filterCount,
+      page: page ?? this.page,
+      limit: limit ?? this.limit,
+      count: count ?? this.count,
       list: list ?? this.list,
     );
   }

+ 0 - 70
packages/cpt_property/lib/modules/rent/repository/property_rent_repository.dart

@@ -1,70 +0,0 @@
-import 'package:domain/constants/api_constants.dart';
-import 'package:domain/entity/server_time.dart';
-import 'package:plugin_platform/platform_export.dart';
-import 'package:plugin_platform/http/dio_engine.dart';
-import 'package:plugin_platform/http/http_result.dart';
-import 'package:riverpod_annotation/riverpod_annotation.dart';
-import 'package:shared/utils/util.dart';
-
-import 'package:flutter_riverpod/flutter_riverpod.dart';
-import 'package:plugin_basic/provider/http_provider/http_provider.dart';
-
-import '../page/property_rent_state.dart';
-part 'property_rent_repository.g.dart';
-
-@Riverpod(keepAlive: true)
-PropertyRentRepository propertyRentRepository(Ref ref) {
-  final dioEngine = ref.watch(dioEngineProvider);
-  return PropertyRentRepository(dioEngine: dioEngine);
-}
-
-/*
- * 数据仓库
- */
-class PropertyRentRepository {
-  DioEngine dioEngine;
-
-  PropertyRentRepository({required this.dioEngine});
-
-  Future<HttpResult<Object>> fetchPropertyNewsList(
-      Map<String, dynamic>? data, {
-        CancelToken? cancelToken,
-      }) async {
-    Map<String, dynamic> params = {};
-
-    // if (!Utils.isEmpty(type)) {
-    //   params["type"] = type!;
-    // }
-
-    params = data!;
-
-
-    Map<String, String> headers = {};
-
-    headers["Content-Type"] = "application/x-www-form-urlencoded";
-    headers["Accept"] = "application/x.yyjobs-api.v1+json";
-
-    final result = await dioEngine.requestNetResult(
-      // ApiConstants.apiServerTime, // api 地址
-      '/index.php/api/employee/extra/time', // api 地址
-      params: params,
-      headers: headers,
-      method: HttpMethod.GET,
-      isShowLoadingDialog: true,  //是否展示默认的Loading弹窗
-      networkDebounce: true,   //是否防抖防止重复请求
-      cancelToken: cancelToken,
-    );
-
-    //根据返回的结果,封装原始数据为Bean/Entity对象
-    if (result.isSuccess) {
-      //重新赋值data或list
-      final json = result.getDataJson();
-      var data = PropertyRentState.fromMap(json!);
-      //重新赋值data或list
-      return result.convert<PropertyRentState>(data: data);
-    }
-    return result.convert();
-  }
-
-
-}

+ 0 - 29
packages/cpt_property/lib/modules/rent/repository/property_rent_repository.g.dart

@@ -1,29 +0,0 @@
-// GENERATED CODE - DO NOT MODIFY BY HAND
-
-part of 'property_rent_repository.dart';
-
-// **************************************************************************
-// RiverpodGenerator
-// **************************************************************************
-
-String _$propertyRentRepositoryHash() =>
-    r'1086503553f2392faaca5dc570bd1ff82c72d570';
-
-/// See also [propertyRentRepository].
-@ProviderFor(propertyRentRepository)
-final propertyRentRepositoryProvider =
-    Provider<PropertyRentRepository>.internal(
-  propertyRentRepository,
-  name: r'propertyRentRepositoryProvider',
-  debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
-      ? null
-      : _$propertyRentRepositoryHash,
-  dependencies: null,
-  allTransitiveDependencies: null,
-);
-
-@Deprecated('Will be removed in 3.0. Use Ref instead')
-// ignore: unused_element
-typedef PropertyRentRepositoryRef = ProviderRef<PropertyRentRepository>;
-// ignore_for_file: type=lint
-// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package

+ 107 - 47
packages/cpt_property/lib/modules/rent/vm/property_rent_vm.dart

@@ -1,16 +1,19 @@
+import 'package:domain/entity/property_sale_entity.dart';
 import 'package:plugin_platform/http/http_result.dart';
+import 'package:riverpod/src/framework.dart';
 import 'package:riverpod_annotation/riverpod_annotation.dart';
 import 'package:shared/utils/log_utils.dart';
 import 'package:plugin_platform/engine/toast/toast_engine.dart';
 import 'package:widgets/load_state_layout.dart';
 import 'package:widgets/widget_export.dart';
+import '../../sale/repository/property_sale_repository.dart';
 import '../page/property_rent_state.dart';
-import '../repository/property_rent_repository.dart';
 part 'property_rent_vm.g.dart';
 
 @riverpod
 class PropertyRentVm extends _$PropertyRentVm {
-  late PropertyRentRepository propertyRentRepository;
+  late PropertySaleRepository propertySaleRepository;
+
   bool _needShowPlaceholder = true; //是否展示LoadingView
 
   // Refresh 控制器
@@ -28,7 +31,8 @@ class PropertyRentVm extends _$PropertyRentVm {
   @override
   PropertyRentState build() {
     // 引入数据仓库
-    propertyRentRepository = ref.read(propertyRentRepositoryProvider);
+    propertySaleRepository = ref.read(propertySaleRepositoryProvider);
+    // 引入数据仓库
     // 初始化状态
     PropertyRentState state = initState();
     // 初始化列表数据
@@ -53,16 +57,16 @@ class PropertyRentVm extends _$PropertyRentVm {
   Future loadMore() async {
     Log.d("----property_news_vm-----loadMore");
     // await Future.delayed(const Duration(seconds: 2));
-    // if(state.list.length >= state.filterCount){
+    // if(state.list.length >= state.count){
     //   return;
     // }else {
-    //   int curPage = state.curPage + 1;
-    //   state = state.copyWith(curPage: curPage,);
+    //   int page = state.page + 1;
+    //   state = state.copyWith(page: page,);
     //   getListData();
     // }
-    // 检查 curPage 是否为 null,并初始化为 1
-    int newCurPage = state.curPage ?? 1;
-    state = state.copyWith(curPage: ++newCurPage);
+    // 检查 page 是否为 null,并初始化为 1
+    int newCurPage = state.page ?? 1;
+    state = state.copyWith(page: ++newCurPage);
     getListData();
   }
 
@@ -72,13 +76,13 @@ class PropertyRentVm extends _$PropertyRentVm {
     Log.d("----property_news_vm-----onRefresh ");
 
     // await Future.delayed(const Duration(seconds: 2));
-    state = state.copyWith(curPage: 1);
+    state = state.copyWith(page: 1);
     getListData();
   }
 
   // 重试请求
   Future retryRequest() async {
-    state = state.copyWith(curPage: 1);
+    state = state.copyWith(page: 1);
     _needShowPlaceholder = true;
     getListData();
   }
@@ -90,12 +94,12 @@ class PropertyRentVm extends _$PropertyRentVm {
       changeLoadingState(LoadState.State_Loading, null);
     }
 
-    Log.d("加载listData数据---------------start--${state.curPage}---");
+    Log.d("加载listData数据---------------start--${state.page}---");
     //   try {
     //     //请求网络
     //     Map<String, dynamic>  params = {
-    //       "curPage": state.curPage,
-    //       "pageSize": state.pageSize,
+    //       "page": state.page,
+    //       "limit": state.limit,
     //     };
     //     Log.d("请求参数------$params");
     //     final result = await propertyNewsRepository.fetchPropertyNewsList(params);
@@ -115,44 +119,100 @@ class PropertyRentVm extends _$PropertyRentVm {
     //     ToastEngine.show("Error: $e");
     //   }
 
-    await Future.delayed(const Duration(milliseconds: 1500));
-    final List<Map<String, dynamic>> listData = [
-      {
-        "id": 1,
-        "title": "Jul 2024  Blk XX #XX to XX 1,100 - 1,200 sqft",
-        "price": "\$4000",
-        "unit": "per month",
-      },
-      {
-        "id": 2,
-        "title": "Jul 2024  Blk XX #XX to XX 1,100 - 1,200 sqft",
-        "price": "\$4000",
-        "unit": "per month",
-      },
-    ];
-
-    if (state.curPage == 1) {
-      //刷新的方式
-      state = state.copyWith(list: listData);
-      refreshController.finishRefresh();
-      //更新展示的状态
-      changeLoadingState(LoadState.State_Success, null);
-    } else {
-      //加载更多
-      final allList = state.list;
-      if(allList.length >= state.filterCount! * state.pageSize!){
+    // await Future.delayed(const Duration(milliseconds: 1500));
+    // final List<Map<String, dynamic>> listData = [
+    //   {
+    //     "id": 1,
+    //     "title": "Jul 2024  Blk XX #XX to XX 1,100 - 1,200 sqft",
+    //     "price": "\$4000",
+    //     "unit": "per month",
+    //   },
+    //   {
+    //     "id": 2,
+    //     "title": "Jul 2024  Blk XX #XX to XX 1,100 - 1,200 sqft",
+    //     "price": "\$4000",
+    //     "unit": "per month",
+    //   },
+    // ];
+    //
+    // if (state.page == 1) {
+    //   //刷新的方式
+    //   state = state.copyWith(list: listData);
+    //   refreshController.finishRefresh();
+    //   //更新展示的状态
+    //   changeLoadingState(LoadState.State_Success, null);
+    // } else {
+    //   //加载更多
+    //   final allList = state.list;
+    //   if(allList.length >= state.count! * state.limit!){
+    //     //更新展示的状态
+    //     changeLoadingState(LoadState.State_Success, null);
+    //     refreshController.finishLoad(IndicatorResult.noMore, true);
+    //   }else {
+    //     allList.addAll(listData);
+    //     state = state.copyWith(list: allList);
+    //     refreshController.finishLoad();
+    //   }
+    // }
+    //
+    // // 最后赋值
+    // _needShowPlaceholder = false;
+    try {
+      //请求网络
+      Map<String, dynamic>  params = {
+        "type": 2, // 1 sale 2 rent
+        "page": state.page,
+        "limit": state.limit,
+      };
+      Log.d("请求参数------$params");
+      final result = await propertySaleRepository.fetchList(params);
+      //校验成功失败
+      if (result.isSuccess) {
+        // state = state.copyWith(count: (result.data as PropertySaleEntity).count);
+        handlerResultList((result.data as PropertySaleEntity).list);
+      } else {
+        String errorMessage = result.errorMsg!;
+        changeLoadingState(LoadState.State_Error, errorMessage);
+        ToastEngine.show(result.errorMsg ?? "Network Load Error");
+      }
+    } catch (e) {
+      ToastEngine.show("Error: $e");
+    }
+
+  }
+
+
+  void handlerResultList(List? list) {
+    if (list != null && list.isNotEmpty) {
+      //有数据,判断是刷新还是加载更多的数据
+      if (state.page == 1) {
+        //刷新的方式
+        state.list!.clear();
+        state.list!.addAll(list as List<Map<String, dynamic>>);
+        refreshController.finishRefresh();
+
         //更新展示的状态
         changeLoadingState(LoadState.State_Success, null);
-        refreshController.finishLoad(IndicatorResult.noMore, true);
-      }else {
-        allList.addAll(listData);
+      } else {
+        //加载更多
+        final allList = state.list;
         state = state.copyWith(list: allList);
         refreshController.finishLoad();
+        // update();
+      }
+    } else {
+      if (state.page == 1) {
+        //展示无数据的布局
+        state.list!.clear();
+        changeLoadingState(LoadState.State_Empty, null);
+        refreshController.finishRefresh();
+      } else {
+        //展示加载完成,没有更多数据了
+        if(state.list!.length == 0){
+          changeLoadingState(LoadState.State_Empty, null);
+        }
+        refreshController.finishLoad(IndicatorResult.noMore);
       }
     }
-
-    // 最后赋值
-    _needShowPlaceholder = false;
   }
-
 }

+ 1 - 1
packages/cpt_property/lib/modules/rent/vm/property_rent_vm.g.dart

@@ -6,7 +6,7 @@ part of 'property_rent_vm.dart';
 // RiverpodGenerator
 // **************************************************************************
 
-String _$propertyRentVmHash() => r'bc707e343a4e5db430176e316ff8ae3a0cfe4477';
+String _$propertyRentVmHash() => r'2e62b3a1a11cd5e3896b7fb46e2506a9273ef861';
 
 /// See also [PropertyRentVm].
 @ProviderFor(PropertyRentVm)

+ 2 - 1
packages/cpt_property/lib/modules/sale/page/property_sale_page.dart

@@ -5,6 +5,7 @@ import 'package:auto_route/auto_route.dart';
 import 'package:flutter_hooks/flutter_hooks.dart';
 import 'package:hooks_riverpod/hooks_riverpod.dart';
 import 'package:router/ext/auto_router_extensions.dart';
+import 'package:shared/utils/ext_dart.dart';
 import 'package:shared/utils/log_utils.dart';
 import 'package:shared/utils/color_utils.dart';
 import 'package:widgets/ext/ex_widget.dart';
@@ -63,7 +64,7 @@ class PropertySalePage extends HookConsumerWidget {
           ),
         ),
         child:MyTextView(
-          item['price'],
+          '${item['units']}${item['price']}',
           fontSize: 17,
           textColor: context.appColors.textBlack,
           isFontMedium: true,

+ 18 - 18
packages/cpt_property/lib/modules/sale/page/property_sale_state.dart

@@ -9,17 +9,17 @@ class PropertySaleState {
   LoadState loadingState;
   String? errorMessage;
 
-  int? curPage;
-  int? pageSize = 10;
-  int? filterCount = 1;
+  int? page;
+  int? limit = 10;
+  int? count = 1;
   List<Map<String, dynamic>> list;
 
   PropertySaleState({
     this.loadingState = LoadState.State_Loading,
     String? errorMessage,
-    this.curPage = 1,
-    this.pageSize = 10,
-    this.filterCount = 1,
+    this.page = 1,
+    this.limit = 10,
+    this.count = 1,
     required this.list,
   });
 
@@ -27,9 +27,9 @@ class PropertySaleState {
     return {
       'loadingState': this.loadingState,
       'errorMessage': this.errorMessage,
-      'curPage': this.curPage,
-      'pageSize': this.pageSize,
-      'filterCount': this.filterCount,
+      'page': this.page,
+      'limit': this.limit,
+      'count': this.count,
       'list': this.list,
     };
   }
@@ -37,9 +37,9 @@ class PropertySaleState {
     return PropertySaleState(
       loadingState: map['loadingState'] as LoadState,
       errorMessage: map['errorMessage'] as String,
-      curPage: map['curPage'] as int,
-      pageSize: map['pageSize'] as int,
-      filterCount: map['filterCount'] as int,
+      page: map['page'] as int,
+      limit: map['limit'] as int,
+      count: map['count'] as int,
       list: map['list'] as List<Map<String, dynamic>>,
     );
   }
@@ -47,17 +47,17 @@ class PropertySaleState {
   PropertySaleState copyWith({
     LoadState? loadingState,
     String? errorMessage,
-    int? curPage,
-    int? pageSize,
-    int? filterCount,
+    int? page,
+    int? limit,
+    int? count,
     List<Map<String, dynamic>>? list,
   }) {
     return PropertySaleState(
       loadingState: loadingState ?? this.loadingState,
       errorMessage: errorMessage ?? this.errorMessage,
-      curPage: curPage ?? this.curPage,
-      pageSize: pageSize ?? this.pageSize,
-      filterCount: filterCount ?? this.filterCount,
+      page: page ?? this.page,
+      limit: limit ?? this.limit,
+      count: count ?? this.count,
       list: list ?? this.list,
     );
   }

+ 5 - 6
packages/cpt_property/lib/modules/sale/repository/property_sale_repository.dart

@@ -1,4 +1,5 @@
 import 'package:domain/constants/api_constants.dart';
+import 'package:domain/entity/property_sale_entity.dart';
 import 'package:domain/entity/server_time.dart';
 import 'package:plugin_platform/platform_export.dart';
 import 'package:plugin_platform/http/dio_engine.dart';
@@ -26,7 +27,7 @@ class PropertySaleRepository {
 
   PropertySaleRepository({required this.dioEngine});
 
-  Future<HttpResult<Object>> fetchPropertyNewsList(
+  Future<HttpResult<Object>> fetchList(
       Map<String, dynamic>? data, {
         CancelToken? cancelToken,
       }) async {
@@ -35,10 +36,8 @@ class PropertySaleRepository {
     // if (!Utils.isEmpty(type)) {
     //   params["type"] = type!;
     // }
-
     params = data!;
 
-
     Map<String, String> headers = {};
 
     headers["Content-Type"] = "application/x-www-form-urlencoded";
@@ -46,7 +45,7 @@ class PropertySaleRepository {
 
     final result = await dioEngine.requestNetResult(
       // ApiConstants.apiServerTime, // api 地址
-      '/index.php/api/employee/extra/time', // api 地址
+      '/api/v1/user/property/transaction/list', // api 地址
       params: params,
       headers: headers,
       method: HttpMethod.GET,
@@ -59,9 +58,9 @@ class PropertySaleRepository {
     if (result.isSuccess) {
       //重新赋值data或list
       final json = result.getDataJson();
-      var data = PropertySaleState.fromMap(json!);
+      var data = PropertySaleEntity.fromJson(json!);
       //重新赋值data或list
-      return result.convert<PropertySaleState>(data: data);
+      return result.convert<PropertySaleEntity>(data: data);
     }
     return result.convert();
   }

+ 99 - 41
packages/cpt_property/lib/modules/sale/vm/property_sale_vm.dart

@@ -1,3 +1,4 @@
+import 'package:domain/entity/property_sale_entity.dart';
 import 'package:plugin_platform/http/http_result.dart';
 import 'package:riverpod_annotation/riverpod_annotation.dart';
 import 'package:shared/utils/log_utils.dart';
@@ -53,16 +54,16 @@ class PropertySaleVm extends _$PropertySaleVm {
   Future loadMore() async {
     Log.d("----property_news_vm-----loadMore");
     // await Future.delayed(const Duration(seconds: 2));
-    // if(state.list.length >= state.filterCount){
+    // if(state.list.length >= state.count){
     //   return;
     // }else {
-    //   int curPage = state.curPage + 1;
-    //   state = state.copyWith(curPage: curPage,);
+    //   int page = state.page + 1;
+    //   state = state.copyWith(page: page,);
     //   getListData();
     // }
-    // 检查 curPage 是否为 null,并初始化为 1
-    int newCurPage = state.curPage ?? 1;
-    state = state.copyWith(curPage: ++newCurPage);
+    // 检查 page 是否为 null,并初始化为 1
+    int newCurPage = state.page ?? 1;
+    state = state.copyWith(page: ++newCurPage);
     getListData();
   }
 
@@ -72,13 +73,13 @@ class PropertySaleVm extends _$PropertySaleVm {
     Log.d("----property_news_vm-----onRefresh ");
 
     // await Future.delayed(const Duration(seconds: 2));
-    state = state.copyWith(curPage: 1);
+    state = state.copyWith(page: 1);
     getListData();
   }
 
   // 重试请求
   Future retryRequest() async {
-    state = state.copyWith(curPage: 1);
+    state = state.copyWith(page: 1);
     _needShowPlaceholder = true;
     getListData();
   }
@@ -90,12 +91,12 @@ class PropertySaleVm extends _$PropertySaleVm {
       changeLoadingState(LoadState.State_Loading, null);
     }
 
-    Log.d("加载listData数据---------------start--${state.curPage}---");
+    Log.d("加载listData数据---------------start--${state.page}---");
     //   try {
     //     //请求网络
     //     Map<String, dynamic>  params = {
-    //       "curPage": state.curPage,
-    //       "pageSize": state.pageSize,
+    //       "page": state.page,
+    //       "limit": state.limit,
     //     };
     //     Log.d("请求参数------$params");
     //     final result = await propertyNewsRepository.fetchPropertyNewsList(params);
@@ -115,42 +116,99 @@ class PropertySaleVm extends _$PropertySaleVm {
     //     ToastEngine.show("Error: $e");
     //   }
 
-    await Future.delayed(const Duration(milliseconds: 1500));
-    final List<Map<String, dynamic>> listData = [
-      {
-        "id": 1,
-        "title": "18 Sep 2024 BIK 39#09-XX 1337 psd 1001 sqft",
-        "price": "\$1.338 M",
-      },
-      {
-        "id": 2,
-        "title": "18 Sep 2024 BIK 39#09-XX 1337 psd 1001 sqft",
-        "price": "\$1.338 M",
-      },
-    ];
-
-    if (state.curPage == 1) {
-      //刷新的方式
-      state = state.copyWith(list: listData);
-      refreshController.finishRefresh();
-      //更新展示的状态
-      changeLoadingState(LoadState.State_Success, null);
-    } else {
-      //加载更多
-      final allList = state.list;
-      if(allList.length >= state.filterCount! * state.pageSize!){
+    // await Future.delayed(const Duration(milliseconds: 1500));
+    // final List<Map<String, dynamic>> listData = [
+    //   {
+    //     "id": 1,
+    //     "title": "18 Sep 2024 BIK 39#09-XX 1337 psd 1001 sqft",
+    //     "price": "\$1.338 M",
+    //   },
+    //   {
+    //     "id": 2,
+    //     "title": "18 Sep 2024 BIK 39#09-XX 1337 psd 1001 sqft",
+    //     "price": "\$1.338 M",
+    //   },
+    // ];
+    //
+    // if (state.page == 1) {
+    //   //刷新的方式
+    //   state = state.copyWith(list: listData);
+    //   refreshController.finishRefresh();
+    //   //更新展示的状态
+    //   changeLoadingState(LoadState.State_Success, null);
+    // } else {
+    //   //加载更多
+    //   final allList = state.list;
+    //   if(allList.length >= state.count! * state.limit!){
+    //     //更新展示的状态
+    //     changeLoadingState(LoadState.State_Success, null);
+    //     refreshController.finishLoad(IndicatorResult.noMore, true);
+    //   }else {
+    //     allList.addAll(listData);
+    //     state = state.copyWith(list: allList);
+    //     refreshController.finishLoad();
+    //   }
+    // }
+    //
+    // // 最后赋值
+    // _needShowPlaceholder = false;
+
+
+    try {
+      //请求网络
+      Map<String, dynamic>  params = {
+        "type": 1, // 1 sale 2 rent
+        "page": state.page,
+        "limit": state.limit,
+      };
+      Log.d("请求参数------$params");
+      final result = await propertySaleRepository.fetchList(params);
+      //校验成功失败
+      if (result.isSuccess) {
+        // state = state.copyWith(count: (result.data as PropertySaleEntity).count);
+        handlerResultList((result.data as PropertySaleEntity).list);
+      } else {
+        String errorMessage = result.errorMsg!;
+        changeLoadingState(LoadState.State_Error, errorMessage);
+        ToastEngine.show(result.errorMsg ?? "Network Load Error");
+      }
+    } catch (e) {
+      ToastEngine.show("Error: $e");
+    }
+
+  }
+
+
+  void handlerResultList(List? list) {
+    if (list != null && list.isNotEmpty) {
+      //有数据,判断是刷新还是加载更多的数据
+      if (state.page == 1) {
+        //刷新的方式
+        state.list!.clear();
+        state.list!.addAll(list as List<Map<String, dynamic>>);
+        refreshController.finishRefresh();
         //更新展示的状态
         changeLoadingState(LoadState.State_Success, null);
-        refreshController.finishLoad(IndicatorResult.noMore, true);
-      }else {
-        allList.addAll(listData);
+      } else {
+        //加载更多
+        final allList = state.list;
         state = state.copyWith(list: allList);
         refreshController.finishLoad();
       }
+    } else {
+      if (state.page == 1) {
+        //展示无数据的布局
+        state.list!.clear();
+        changeLoadingState(LoadState.State_Empty, null);
+        refreshController.finishRefresh();
+      } else {
+        //展示加载完成,没有更多数据了
+        if(state.list!.length == 0){
+          changeLoadingState(LoadState.State_Empty, null);
+        }
+        refreshController.finishLoad(IndicatorResult.noMore);
+      }
     }
-
-    // 最后赋值
-    _needShowPlaceholder = false;
   }
 
 }

+ 1 - 1
packages/cpt_property/lib/modules/sale/vm/property_sale_vm.g.dart

@@ -6,7 +6,7 @@ part of 'property_sale_vm.dart';
 // RiverpodGenerator
 // **************************************************************************
 
-String _$propertySaleVmHash() => r'19d1b7d65dc326d454df74af5fd9d7632d795811';
+String _$propertySaleVmHash() => r'8a612924f792107d19776759ce44c7e5a4bac9cb';
 
 /// See also [PropertySaleVm].
 @ProviderFor(PropertySaleVm)

+ 5 - 2
packages/cpt_property/pubspec.yaml

@@ -69,8 +69,11 @@ dev_dependencies:
   # AutoRouter 生成代码
   auto_route_generator: ^8.0.0
 
-  # json序列化
-  freezed: ^2.2.0
+#  # json序列化
+#  freezed: ^2.2.0
+
+  # json 序列化和反序列化
+#  json_annotation: ^4.8.0
 
 
 flutter:

+ 25 - 0
packages/cs_domain/lib/entity/property_news_entity.dart

@@ -0,0 +1,25 @@
+import 'package:domain/generated/json/base/json_field.dart';
+import 'package:domain/generated/json/property_news_entity.g.dart';
+import 'dart:convert';
+export 'package:domain/generated/json/property_news_entity.g.dart';
+
+@JsonSerializable()
+class PropertyNewsEntity {
+	int? count;
+	int? page;
+	int? limit;
+	@JSONField(name: "count_page")
+	int? countPage;
+	List<dynamic>? list;
+
+	PropertyNewsEntity();
+
+	factory PropertyNewsEntity.fromJson(Map<String, dynamic> json) => $PropertyNewsEntityFromJson(json);
+
+	Map<String, dynamic> toJson() => $PropertyNewsEntityToJson(this);
+
+	@override
+	String toString() {
+		return jsonEncode(this);
+	}
+}

+ 25 - 0
packages/cs_domain/lib/entity/property_sale_entity.dart

@@ -0,0 +1,25 @@
+import 'package:domain/generated/json/base/json_field.dart';
+import 'package:domain/generated/json/property_sale_entity.g.dart';
+import 'dart:convert';
+export 'package:domain/generated/json/property_sale_entity.g.dart';
+
+@JsonSerializable()
+class PropertySaleEntity {
+	int? count;
+	int? page;
+	int? limit;
+	@JSONField(name: "count_page")
+	int? countPage;
+	List<dynamic>? list;
+
+	PropertySaleEntity();
+
+	factory PropertySaleEntity.fromJson(Map<String, dynamic> json) => $PropertySaleEntityFromJson(json);
+
+	Map<String, dynamic> toJson() => $PropertySaleEntityToJson(this);
+
+	@override
+	String toString() {
+		return jsonEncode(this);
+	}
+}

+ 42 - 15
packages/cs_domain/lib/generated/json/base/json_convert_content.dart

@@ -6,6 +6,8 @@
 import 'package:flutter/material.dart' show debugPrint;
 import 'package:domain/entity/auth_login_entity.dart';
 import 'package:domain/entity/captcha_img_entity.dart';
+import 'package:domain/entity/property_news_entity.dart';
+import 'package:domain/entity/property_sale_entity.dart';
 import 'package:domain/entity/server_time.dart';
 import 'package:domain/entity/user_me_entity.dart';
 
@@ -65,12 +67,14 @@ class JsonConvert {
     }
   }
 
-  List<T?>? convertList<T>(List<dynamic>? value, {EnumConvertFunction? enumConvert}) {
+  List<T?>? convertList<T>(List<dynamic>? value,
+      {EnumConvertFunction? enumConvert}) {
     if (value == null) {
       return null;
     }
     try {
-      return value.map((dynamic e) => _asT<T>(e, enumConvert: enumConvert)).toList();
+      return value.map((dynamic e) => _asT<T>(e, enumConvert: enumConvert))
+          .toList();
     } catch (e, stackTrace) {
       debugPrint('asT<$T> $e $stackTrace');
       if (onError != null) {
@@ -80,12 +84,14 @@ class JsonConvert {
     }
   }
 
-  List<T>? convertListNotNull<T>(dynamic value, {EnumConvertFunction? enumConvert}) {
+  List<T>? convertListNotNull<T>(dynamic value,
+      {EnumConvertFunction? enumConvert}) {
     if (value == null) {
       return null;
     }
     try {
-      return (value as List<dynamic>).map((dynamic e) => _asT<T>(e, enumConvert: enumConvert)!).toList();
+      return (value as List<dynamic>).map((dynamic e) =>
+      _asT<T>(e, enumConvert: enumConvert)!).toList();
     } catch (e, stackTrace) {
       debugPrint('asT<$T> $e $stackTrace');
       if (onError != null) {
@@ -133,7 +139,8 @@ class JsonConvert {
           return covertFunc(Map<String, dynamic>.from(value)) as T;
         }
       } else {
-        throw UnimplementedError('$type unimplemented,you can try running the app again');
+        throw UnimplementedError(
+            '$type unimplemented,you can try running the app again');
       }
     }
   }
@@ -141,31 +148,48 @@ class JsonConvert {
   //list is returned by type
   static M? _getListChildType<M>(List<Map<String, dynamic>> data) {
     if (<AuthLoginEntity>[] is M) {
-      return data.map<AuthLoginEntity>((Map<String, dynamic> e) => AuthLoginEntity.fromJson(e)).toList() as M;
+      return data.map<AuthLoginEntity>((Map<String, dynamic> e) =>
+          AuthLoginEntity.fromJson(e)).toList() as M;
     }
     if (<CaptchaImgEntity>[] is M) {
-      return data.map<CaptchaImgEntity>((Map<String, dynamic> e) => CaptchaImgEntity.fromJson(e)).toList() as M;
+      return data.map<CaptchaImgEntity>((Map<String, dynamic> e) =>
+          CaptchaImgEntity.fromJson(e)).toList() as M;
+    }
+    if (<PropertyNewsEntity>[] is M) {
+      return data.map<PropertyNewsEntity>((Map<String, dynamic> e) =>
+          PropertyNewsEntity.fromJson(e)).toList() as M;
+    }
+    if (<PropertySaleEntity>[] is M) {
+      return data.map<PropertySaleEntity>((Map<String, dynamic> e) =>
+          PropertySaleEntity.fromJson(e)).toList() as M;
     }
     if (<ServerTime>[] is M) {
-      return data.map<ServerTime>((Map<String, dynamic> e) => ServerTime.fromJson(e)).toList() as M;
+      return data.map<ServerTime>((Map<String, dynamic> e) =>
+          ServerTime.fromJson(e)).toList() as M;
     }
     if (<UserMeEntity>[] is M) {
-      return data.map<UserMeEntity>((Map<String, dynamic> e) => UserMeEntity.fromJson(e)).toList() as M;
+      return data.map<UserMeEntity>((Map<String, dynamic> e) =>
+          UserMeEntity.fromJson(e)).toList() as M;
     }
     if (<UserMeHouseholds>[] is M) {
-      return data.map<UserMeHouseholds>((Map<String, dynamic> e) => UserMeHouseholds.fromJson(e)).toList() as M;
+      return data.map<UserMeHouseholds>((Map<String, dynamic> e) =>
+          UserMeHouseholds.fromJson(e)).toList() as M;
     }
     if (<UserMeEstates>[] is M) {
-      return data.map<UserMeEstates>((Map<String, dynamic> e) => UserMeEstates.fromJson(e)).toList() as M;
+      return data.map<UserMeEstates>((Map<String, dynamic> e) =>
+          UserMeEstates.fromJson(e)).toList() as M;
     }
     if (<UserMeEstatesAccounts>[] is M) {
-      return data.map<UserMeEstatesAccounts>((Map<String, dynamic> e) => UserMeEstatesAccounts.fromJson(e)).toList() as M;
+      return data.map<UserMeEstatesAccounts>((Map<String, dynamic> e) =>
+          UserMeEstatesAccounts.fromJson(e)).toList() as M;
     }
     if (<UserMeEstatesAccountsUnit>[] is M) {
-      return data.map<UserMeEstatesAccountsUnit>((Map<String, dynamic> e) => UserMeEstatesAccountsUnit.fromJson(e)).toList() as M;
+      return data.map<UserMeEstatesAccountsUnit>((Map<String, dynamic> e) =>
+          UserMeEstatesAccountsUnit.fromJson(e)).toList() as M;
     }
     if (<UserMeDefaultUnit>[] is M) {
-      return data.map<UserMeDefaultUnit>((Map<String, dynamic> e) => UserMeDefaultUnit.fromJson(e)).toList() as M;
+      return data.map<UserMeDefaultUnit>((Map<String, dynamic> e) =>
+          UserMeDefaultUnit.fromJson(e)).toList() as M;
     }
 
     debugPrint("$M not found");
@@ -178,7 +202,8 @@ class JsonConvert {
       return json;
     }
     if (json is List) {
-      return _getListChildType<M>(json.map((dynamic e) => e as Map<String, dynamic>).toList());
+      return _getListChildType<M>(
+          json.map((dynamic e) => e as Map<String, dynamic>).toList());
     } else {
       return jsonConvert.convert<M>(json);
     }
@@ -189,6 +214,8 @@ class JsonConvertClassCollection {
   Map<String, JsonConvertFunction> convertFuncMap = {
     (AuthLoginEntity).toString(): AuthLoginEntity.fromJson,
     (CaptchaImgEntity).toString(): CaptchaImgEntity.fromJson,
+    (PropertyNewsEntity).toString(): PropertyNewsEntity.fromJson,
+    (PropertySaleEntity).toString(): PropertySaleEntity.fromJson,
     (ServerTime).toString(): ServerTime.fromJson,
     (UserMeEntity).toString(): UserMeEntity.fromJson,
     (UserMeHouseholds).toString(): UserMeHouseholds.fromJson,

+ 55 - 0
packages/cs_domain/lib/generated/json/property_news_entity.g.dart

@@ -0,0 +1,55 @@
+import 'package:domain/generated/json/base/json_convert_content.dart';
+import 'package:domain/entity/property_news_entity.dart';
+
+PropertyNewsEntity $PropertyNewsEntityFromJson(Map<String, dynamic> json) {
+  final PropertyNewsEntity propertyNewsEntity = PropertyNewsEntity();
+  final int? count = jsonConvert.convert<int>(json['count']);
+  if (count != null) {
+    propertyNewsEntity.count = count;
+  }
+  final int? page = jsonConvert.convert<int>(json['page']);
+  if (page != null) {
+    propertyNewsEntity.page = page;
+  }
+  final int? limit = jsonConvert.convert<int>(json['limit']);
+  if (limit != null) {
+    propertyNewsEntity.limit = limit;
+  }
+  final int? countPage = jsonConvert.convert<int>(json['count_page']);
+  if (countPage != null) {
+    propertyNewsEntity.countPage = countPage;
+  }
+  final List<dynamic>? list = (json['list'] as List<dynamic>?)?.map(
+          (e) => e).toList();
+  if (list != null) {
+    propertyNewsEntity.list = list;
+  }
+  return propertyNewsEntity;
+}
+
+Map<String, dynamic> $PropertyNewsEntityToJson(PropertyNewsEntity 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;
+  return data;
+}
+
+extension PropertyNewsEntityExtension on PropertyNewsEntity {
+  PropertyNewsEntity copyWith({
+    int? count,
+    int? page,
+    int? limit,
+    int? countPage,
+    List<dynamic>? list,
+  }) {
+    return PropertyNewsEntity()
+      ..count = count ?? this.count
+      ..page = page ?? this.page
+      ..limit = limit ?? this.limit
+      ..countPage = countPage ?? this.countPage
+      ..list = list ?? this.list;
+  }
+}

+ 55 - 0
packages/cs_domain/lib/generated/json/property_sale_entity.g.dart

@@ -0,0 +1,55 @@
+import 'package:domain/generated/json/base/json_convert_content.dart';
+import 'package:domain/entity/property_sale_entity.dart';
+
+PropertySaleEntity $PropertySaleEntityFromJson(Map<String, dynamic> json) {
+  final PropertySaleEntity propertySaleEntity = PropertySaleEntity();
+  final int? count = jsonConvert.convert<int>(json['count']);
+  if (count != null) {
+    propertySaleEntity.count = count;
+  }
+  final int? page = jsonConvert.convert<int>(json['page']);
+  if (page != null) {
+    propertySaleEntity.page = page;
+  }
+  final int? limit = jsonConvert.convert<int>(json['limit']);
+  if (limit != null) {
+    propertySaleEntity.limit = limit;
+  }
+  final int? countPage = jsonConvert.convert<int>(json['count_page']);
+  if (countPage != null) {
+    propertySaleEntity.countPage = countPage;
+  }
+  final List<dynamic>? list = (json['list'] as List<dynamic>?)?.map(
+          (e) => e).toList();
+  if (list != null) {
+    propertySaleEntity.list = list;
+  }
+  return propertySaleEntity;
+}
+
+Map<String, dynamic> $PropertySaleEntityToJson(PropertySaleEntity 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;
+  return data;
+}
+
+extension PropertySaleEntityExtension on PropertySaleEntity {
+  PropertySaleEntity copyWith({
+    int? count,
+    int? page,
+    int? limit,
+    int? countPage,
+    List<dynamic>? list,
+  }) {
+    return PropertySaleEntity()
+      ..count = count ?? this.count
+      ..page = page ?? this.page
+      ..limit = limit ?? this.limit
+      ..countPage = countPage ?? this.countPage
+      ..list = list ?? this.list;
+  }
+}

+ 31 - 14
packages/cs_domain/lib/generated/json/user_me_entity.g.dart

@@ -19,11 +19,13 @@ UserMeEntity $UserMeEntityFromJson(Map<String, dynamic> json) {
   if (phone != null) {
     userMeEntity.phone = phone;
   }
-  final String? followsCount = jsonConvert.convert<String>(json['follows_count']);
+  final String? followsCount = jsonConvert.convert<String>(
+      json['follows_count']);
   if (followsCount != null) {
     userMeEntity.followsCount = followsCount;
   }
-  final String? flowersCount = jsonConvert.convert<String>(json['flowers_count']);
+  final String? flowersCount = jsonConvert.convert<String>(
+      json['flowers_count']);
   if (flowersCount != null) {
     userMeEntity.flowersCount = flowersCount;
   }
@@ -31,17 +33,23 @@ UserMeEntity $UserMeEntityFromJson(Map<String, dynamic> json) {
   if (postsCount != null) {
     userMeEntity.postsCount = postsCount;
   }
-  final List<UserMeHouseholds>? households = (json['households'] as List<dynamic>?)?.map(
-          (e) => jsonConvert.convert<UserMeHouseholds>(e) as UserMeHouseholds).toList();
+  final List<UserMeHouseholds>? households = (json['households'] as List<
+      dynamic>?)
+      ?.map(
+          (e) => jsonConvert.convert<UserMeHouseholds>(e) as UserMeHouseholds)
+      .toList();
   if (households != null) {
     userMeEntity.households = households;
   }
-  final List<UserMeEstates>? estates = (json['estates'] as List<dynamic>?)?.map(
-          (e) => jsonConvert.convert<UserMeEstates>(e) as UserMeEstates).toList();
+  final List<UserMeEstates>? estates = (json['estates'] as List<dynamic>?)
+      ?.map(
+          (e) => jsonConvert.convert<UserMeEstates>(e) as UserMeEstates)
+      .toList();
   if (estates != null) {
     userMeEntity.estates = estates;
   }
-  final UserMeDefaultUnit? defaultUnit = jsonConvert.convert<UserMeDefaultUnit>(json['default_unit']);
+  final UserMeDefaultUnit? defaultUnit = jsonConvert.convert<UserMeDefaultUnit>(
+      json['default_unit']);
   if (defaultUnit != null) {
     userMeEntity.defaultUnit = defaultUnit;
   }
@@ -138,8 +146,12 @@ UserMeEstates $UserMeEstatesFromJson(Map<String, dynamic> json) {
   if (name != null) {
     userMeEstates.name = name;
   }
-  final List<UserMeEstatesAccounts>? accounts = (json['accounts'] as List<dynamic>?)?.map(
-          (e) => jsonConvert.convert<UserMeEstatesAccounts>(e) as UserMeEstatesAccounts).toList();
+  final List<UserMeEstatesAccounts>? accounts = (json['accounts'] as List<
+      dynamic>?)
+      ?.map(
+          (e) =>
+      jsonConvert.convert<UserMeEstatesAccounts>(e) as UserMeEstatesAccounts)
+      .toList();
   if (accounts != null) {
     userMeEstates.accounts = accounts;
   }
@@ -167,7 +179,8 @@ extension UserMeEstatesExtension on UserMeEstates {
   }
 }
 
-UserMeEstatesAccounts $UserMeEstatesAccountsFromJson(Map<String, dynamic> json) {
+UserMeEstatesAccounts $UserMeEstatesAccountsFromJson(
+    Map<String, dynamic> json) {
   final UserMeEstatesAccounts userMeEstatesAccounts = UserMeEstatesAccounts();
   final String? id = jsonConvert.convert<String>(json['id']);
   if (id != null) {
@@ -193,14 +206,16 @@ UserMeEstatesAccounts $UserMeEstatesAccountsFromJson(Map<String, dynamic> json)
   if (status != null) {
     userMeEstatesAccounts.status = status;
   }
-  final UserMeEstatesAccountsUnit? unit = jsonConvert.convert<UserMeEstatesAccountsUnit>(json['unit']);
+  final UserMeEstatesAccountsUnit? unit = jsonConvert.convert<
+      UserMeEstatesAccountsUnit>(json['unit']);
   if (unit != null) {
     userMeEstatesAccounts.unit = unit;
   }
   return userMeEstatesAccounts;
 }
 
-Map<String, dynamic> $UserMeEstatesAccountsToJson(UserMeEstatesAccounts entity) {
+Map<String, dynamic> $UserMeEstatesAccountsToJson(
+    UserMeEstatesAccounts entity) {
   final Map<String, dynamic> data = <String, dynamic>{};
   data['id'] = entity.id;
   data['name'] = entity.name;
@@ -233,7 +248,8 @@ extension UserMeEstatesAccountsExtension on UserMeEstatesAccounts {
   }
 }
 
-UserMeEstatesAccountsUnit $UserMeEstatesAccountsUnitFromJson(Map<String, dynamic> json) {
+UserMeEstatesAccountsUnit $UserMeEstatesAccountsUnitFromJson(
+    Map<String, dynamic> json) {
   final UserMeEstatesAccountsUnit userMeEstatesAccountsUnit = UserMeEstatesAccountsUnit();
   final String? id = jsonConvert.convert<String>(json['id']);
   if (id != null) {
@@ -258,7 +274,8 @@ UserMeEstatesAccountsUnit $UserMeEstatesAccountsUnitFromJson(Map<String, dynamic
   return userMeEstatesAccountsUnit;
 }
 
-Map<String, dynamic> $UserMeEstatesAccountsUnitToJson(UserMeEstatesAccountsUnit entity) {
+Map<String, dynamic> $UserMeEstatesAccountsUnitToJson(
+    UserMeEstatesAccountsUnit entity) {
   final Map<String, dynamic> data = <String, dynamic>{};
   data['id'] = entity.id;
   data['block'] = entity.block;

+ 6 - 6
packages/cs_plugin_platform/lib/http/dio_engine.dart

@@ -141,7 +141,7 @@ class DioEngine {
               return HttpResult(
                 isSuccess: true,
                 code: code,
-                msg: jsonMap['msg'],
+                msg: jsonMap['message'],
                 listJson: jsonMap['data'], //赋值给的 listJson 字段
               );
             } else {
@@ -149,16 +149,16 @@ class DioEngine {
               return HttpResult(
                 isSuccess: true,
                 code: code,
-                msg: jsonMap['msg'],
+                msg: jsonMap['message'],
                 dataJson: jsonMap['data'], //赋值给的 dataJson 字段
               );
             }
 
             //如果code != 200 ,下面是错误的情况判断
           } else {
-            if (jsonMap.containsKey('msg')) {
+            if (jsonMap.containsKey('message')) {
               //如果有msg字符串优先返回msg字符串
-              return HttpResult(isSuccess: false, code: code, errorMsg: jsonMap['msg']);
+              return HttpResult(isSuccess: false, code: code, errorMsg: jsonMap['message']);
             } else {
               //什么都没有就返回Http的错误字符串
               return HttpResult(isSuccess: false, code: code, errorMsg: jsonMap['message']);
@@ -166,9 +166,9 @@ class DioEngine {
           }
         } else {
           //没有code,说明有错误信息,判断错误信息
-          if (jsonMap.containsKey('msg')) {
+          if (jsonMap.containsKey('message')) {
             //如果有msg字符串优先返回msg字符串
-            return HttpResult(isSuccess: false, errorMsg: jsonMap['msg']);
+            return HttpResult(isSuccess: false, errorMsg: jsonMap['message']);
           } else {
             //什么都没有就返回Http的错误字符串
             return HttpResult(isSuccess: false, errorMsg: jsonMap['message']);