Browse Source

update rewards

“shanwenxin” 2 months ago
parent
commit
752cd7c389
70 changed files with 3335 additions and 1454 deletions
  1. 1 1
      app/lib/main.dart
  2. 71 31
      packages/cpt_rewards/lib/modules/rewards/rewards_page.dart
  3. 12 15
      packages/cpt_rewards/lib/modules/rewards/rewards_repository.dart
  4. 27 33
      packages/cpt_rewards/lib/modules/rewards/rewards_state.dart
  5. 40 45
      packages/cpt_rewards/lib/modules/rewards/rewards_vm.dart
  6. 31 7
      packages/cpt_rewards/lib/modules/rewards_detail/rewards_detail_page.dart
  7. 11 14
      packages/cpt_rewards/lib/modules/rewards_detail/rewards_detail_repository.dart
  8. 22 31
      packages/cpt_rewards/lib/modules/rewards_detail/rewards_detail_state.dart
  9. 40 45
      packages/cpt_rewards/lib/modules/rewards_detail/rewards_detail_vm.dart
  10. 39 22
      packages/cpt_rewards/lib/modules/rewards_history/rewards_history_earned/rewards_history_earned_page.dart
  11. 12 16
      packages/cpt_rewards/lib/modules/rewards_history/rewards_history_earned/rewards_history_earned_repository.dart
  12. 44 32
      packages/cpt_rewards/lib/modules/rewards_history/rewards_history_earned/rewards_history_earned_state.dart
  13. 96 47
      packages/cpt_rewards/lib/modules/rewards_history/rewards_history_earned/rewards_history_earned_vm.dart
  14. 40 23
      packages/cpt_rewards/lib/modules/rewards_history/rewards_history_spent/rewards_history_spent_page.dart
  15. 14 16
      packages/cpt_rewards/lib/modules/rewards_history/rewards_history_spent/rewards_history_spent_repository.dart
  16. 43 31
      packages/cpt_rewards/lib/modules/rewards_history/rewards_history_spent/rewards_history_spent_state.dart
  17. 96 47
      packages/cpt_rewards/lib/modules/rewards_history/rewards_history_spent/rewards_history_spent_vm.dart
  18. 251 216
      packages/cpt_rewards/lib/modules/rewards_home/rewards_home_page.dart
  19. 22 16
      packages/cpt_rewards/lib/modules/rewards_home/rewards_home_repository.dart
  20. 38 34
      packages/cpt_rewards/lib/modules/rewards_home/rewards_home_state.dart
  21. 58 44
      packages/cpt_rewards/lib/modules/rewards_home/rewards_home_vm.dart
  22. 1 1
      packages/cpt_rewards/lib/modules/rewards_home/rewards_home_vm.g.dart
  23. 27 133
      packages/cpt_rewards/lib/modules/rewards_list/dialog/reward_listfilter_all_dialog.dart
  24. 78 51
      packages/cpt_rewards/lib/modules/rewards_list/dialog/reward_listfilter_dialog.dart
  25. 30 12
      packages/cpt_rewards/lib/modules/rewards_list/rewards_list_page.dart
  26. 51 14
      packages/cpt_rewards/lib/modules/rewards_list/rewards_list_repository.dart
  27. 78 37
      packages/cpt_rewards/lib/modules/rewards_list/rewards_list_state.dart
  28. 161 54
      packages/cpt_rewards/lib/modules/rewards_list/rewards_list_vm.dart
  29. 39 18
      packages/cpt_rewards/lib/modules/rewards_my/rewards_my_active/rewards_my_active_page.dart
  30. 12 15
      packages/cpt_rewards/lib/modules/rewards_my/rewards_my_active/rewards_my_active_repository.dart
  31. 44 32
      packages/cpt_rewards/lib/modules/rewards_my/rewards_my_active/rewards_my_active_state.dart
  32. 92 46
      packages/cpt_rewards/lib/modules/rewards_my/rewards_my_active/rewards_my_active_vm.dart
  33. 40 18
      packages/cpt_rewards/lib/modules/rewards_my/rewards_my_expired/rewards_my_expired_page.dart
  34. 12 17
      packages/cpt_rewards/lib/modules/rewards_my/rewards_my_expired/rewards_my_expired_repository.dart
  35. 43 31
      packages/cpt_rewards/lib/modules/rewards_my/rewards_my_expired/rewards_my_expired_state.dart
  36. 92 46
      packages/cpt_rewards/lib/modules/rewards_my/rewards_my_expired/rewards_my_expired_vm.dart
  37. 39 18
      packages/cpt_rewards/lib/modules/rewards_my/rewards_my_used/rewards_my_used_page.dart
  38. 13 16
      packages/cpt_rewards/lib/modules/rewards_my/rewards_my_used/rewards_my_used_repository.dart
  39. 43 31
      packages/cpt_rewards/lib/modules/rewards_my/rewards_my_used/rewards_my_used_state.dart
  40. 92 46
      packages/cpt_rewards/lib/modules/rewards_my/rewards_my_used/rewards_my_used_vm.dart
  41. 54 5
      packages/cpt_rewards/lib/router/page/rewards_page_router.gr.dart
  42. 22 0
      packages/cs_domain/lib/entity/rewards_category_entity.dart
  43. 25 0
      packages/cs_domain/lib/entity/rewards_history_earned_entity.dart
  44. 61 0
      packages/cs_domain/lib/entity/rewards_home_entity.dart
  45. 43 0
      packages/cs_domain/lib/entity/rewards_home_tes_entity.dart
  46. 22 0
      packages/cs_domain/lib/entity/rewards_home_test_entity.dart
  47. 23 0
      packages/cs_domain/lib/entity/rewards_home_tx_entity.dart
  48. 61 0
      packages/cs_domain/lib/entity/rewards_index_entity.dart
  49. 46 0
      packages/cs_domain/lib/entity/rewards_list_entity.dart
  50. 20 0
      packages/cs_domain/lib/entity/text_kon_entity.dart
  51. 99 0
      packages/cs_domain/lib/generated/assets.dart
  52. 113 14
      packages/cs_domain/lib/generated/json/base/json_convert_content.dart
  53. 31 14
      packages/cs_domain/lib/generated/json/facility_book_entity.g.dart
  54. 38 19
      packages/cs_domain/lib/generated/json/facility_page_entity.g.dart
  55. 42 0
      packages/cs_domain/lib/generated/json/rewards_category_entity.g.dart
  56. 57 0
      packages/cs_domain/lib/generated/json/rewards_history_earned_entity.g.dart
  57. 141 0
      packages/cs_domain/lib/generated/json/rewards_home_entity.g.dart
  58. 101 0
      packages/cs_domain/lib/generated/json/rewards_home_tes_entity.g.dart
  59. 43 0
      packages/cs_domain/lib/generated/json/rewards_home_test_entity.g.dart
  60. 41 0
      packages/cs_domain/lib/generated/json/rewards_home_tx_entity.g.dart
  61. 124 0
      packages/cs_domain/lib/generated/json/rewards_index_entity.g.dart
  62. 110 0
      packages/cs_domain/lib/generated/json/rewards_list_entity.g.dart
  63. 15 0
      packages/cs_domain/lib/generated/json/text_kon_entity.g.dart
  64. 3 0
      packages/cs_domain/pubspec.yaml
  65. BIN
      packages/cs_resources/assets/rewards/reward_list_choose.png
  66. BIN
      packages/cs_resources/assets/rewards/reward_list_high.png
  67. BIN
      packages/cs_resources/assets/rewards/reward_list_hot.png
  68. BIN
      packages/cs_resources/assets/rewards/reward_list_low.png
  69. BIN
      packages/cs_resources/assets/rewards/reward_list_new.png
  70. 5 0
      packages/cs_resources/lib/generated/assets.dart

+ 1 - 1
app/lib/main.dart

@@ -101,7 +101,7 @@ class MyApp extends HookConsumerWidget {
         usePenetrate: false,
       )
       ..loading = SmartConfigLoading(
-        // backDismiss: true,
+        // SmartConfigCustomSmartConfigCustomSmartConfigCustom
         clickMaskDismiss: true,
       )
       ..toast = SmartConfigToast(

+ 71 - 31
packages/cpt_rewards/lib/modules/rewards/rewards_page.dart

@@ -5,14 +5,19 @@ import 'package:cpt_rewards/modules/rewards_home/rewards_home_page.dart';
 import 'package:cpt_rewards/modules/rewards_list/rewards_list_page.dart';
 import 'package:cpt_rewards/modules/rewards_my/rewards_my_page.dart';
 import 'package:cs_resources/generated/assets.dart';
+import 'package:domain/entity/rewards_index_entity.dart';
 import 'package:flutter/material.dart';
 import 'package:auto_route/auto_route.dart';
+import 'package:flutter_hooks/flutter_hooks.dart';
 import 'package:hooks_riverpod/hooks_riverpod.dart';
 import 'package:plugin_platform/engine/image/image_nine_grid.dart';
 import 'package:router/ext/auto_router_extensions.dart';
 import 'package:shared/utils/color_utils.dart';
+import 'package:shared/utils/log_utils.dart';
 import 'package:widgets/ext/ex_widget.dart';
+import 'package:widgets/load_state_layout.dart';
 import 'package:widgets/my_load_image.dart';
+import 'package:widgets/widget_export.dart';
 
 import '../../../router/page/rewards_page_router.dart';
 import './rewards_vm.dart';
@@ -49,14 +54,32 @@ class RewardsPage extends HookConsumerWidget {
         child: Column(
           crossAxisAlignment: CrossAxisAlignment.start,
           children: [
-            const MyAssetImage(
-              Assets.rewardsRewardsBack,
-              width: 44,
-              height: 44,
-            ).onTap(() {
-              // backCallback
-              Navigator.pop(context);
-            }),
+            Row(
+              crossAxisAlignment: CrossAxisAlignment.center,
+              mainAxisAlignment: MainAxisAlignment.spaceBetween,
+              children: [
+                const MyAssetImage(
+                  Assets.rewardsRewardsBack,
+                  width: 44,
+                  height: 44,
+                ).onTap(() {
+                  // backCallback
+                  Navigator.pop(context);
+                }),
+                const Text(
+                  'Daily Login',
+                  style: TextStyle(
+                      fontSize: 18.0,
+                      color: Colors.white,
+                      fontWeight: FontWeight.w500), // 设置字体大小
+                ),
+                const MyAssetImage(
+                  Assets.rewardsRewardsIconWen,
+                  width: 20,
+                  height: 20,
+                )
+              ],
+            ),
             // const Text(
             //   '1526 Available Points',
             //   style: TextStyle(
@@ -106,8 +129,7 @@ class RewardsPage extends HookConsumerWidget {
             .backgroundColor(ColorUtils.string2Color('#4161D0')));
   }
 
-  Widget _buildSearch(BuildContext context, WidgetRef ref, _vm) {
-    // List itemsList = _vm.state.list.toList();
+  Widget _buildSearch(BuildContext context, WidgetRef ref, _vm, list) {
     return Container(
       width: MediaQuery.of(context).size.width - 30,
       decoration: BoxDecoration(
@@ -889,31 +911,49 @@ class RewardsPage extends HookConsumerWidget {
   @override
   Widget build(BuildContext context, WidgetRef ref) {
     final _vm = ref.read(rewardsVmProvider.notifier);
-
+    final state = ref.watch(rewardsVmProvider);
+    RewardsIndexEntity? list = state.list;
+    useEffect(() {
+      // 组件挂载时执行 - 执行接口请求
+      Future.microtask(() => _vm.initPageData());
+      return () {
+        // 组件卸载时执行
+        Log.d("property_news_page 组件卸载时执行");
+      };
+    }, []);
     return Scaffold(
       // appBar: AppBar(title: Text("奖励")),
       body: Column(children: [
         Expanded(
-          child: SingleChildScrollView(
-              scrollDirection: Axis.vertical,
-              physics: const BouncingScrollPhysics(),
-              clipBehavior: Clip.none,
-              child: Column(
-                children: [
-                  _buildTop(context, ref, _vm),
-                  Container(
-                    transform: Matrix4.translationValues(0.0, -45.0, 0.0),
-                    child: Column(
-                      children: [
-                        _buildSearch(context, ref, _vm),
-                        _buildSwiper(context, ref, _vm),
-                        _buildList(context, ref, _vm),
-                        _buildHistory(context, ref, _vm),
-                      ],
-                    ), // 使用负数margin
-                  ).paddingOnly(left: 15, right: 15),
-                ],
-              )),
+          child: 
+          LoadStateLayout(
+            state: state.loadingState,
+            errorMessage: state.errorMessage,
+            errorRetry: () {
+              _vm.retryRequest();
+            },
+            successWidget: SingleChildScrollView(
+            scrollDirection: Axis.vertical,
+            physics: const BouncingScrollPhysics(),
+            clipBehavior: Clip.none,
+            child:  Column(
+                  children: [
+                    _buildTop(context, ref, _vm),
+                    Container(
+                      transform: Matrix4.translationValues(0.0, -45.0, 0.0),
+                      child: Column(
+                        children: [
+                          _buildSearch(context, ref, _vm, list),
+                          _buildSwiper(context, ref, _vm),
+                          _buildList(context, ref, _vm),
+                          _buildHistory(context, ref, _vm),
+                        ],
+                      ), // 使用负数margin
+                    ).paddingOnly(left: 15, right: 15),
+                  ],
+                )
+                ),
+          ),
         ),
       ]).backgroundColor(ColorUtils.string2Color('#F2F3F6')),
     );

+ 12 - 15
packages/cpt_rewards/lib/modules/rewards/rewards_repository.dart

@@ -1,9 +1,11 @@
 import 'package:domain/constants/api_constants.dart';
+import 'package:domain/entity/rewards_index_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,18 +29,13 @@ class RewardsRepository {
   RewardsRepository({required this.dioEngine});
 
   Future<HttpResult<Object>> fetchPropertyNewsList(
-      Map<String, dynamic>? data, {
-        CancelToken? cancelToken,
-      }) async {
+    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";
@@ -46,25 +43,25 @@ class RewardsRepository {
 
     final result = await dioEngine.requestNetResult(
       // ApiConstants.apiServerTime, // api 地址
-      '/index.php/api/employee/extra/time', // api 地址
+      '/api/v1/user/reward/index', // api 地址
       params: params,
       headers: headers,
       method: HttpMethod.GET,
-      isShowLoadingDialog: true,  //是否展示默认的Loading弹窗
-      networkDebounce: true,   //是否防抖防止重复请求
+      isShowLoadingDialog: false, //是否展示默认的Loading弹窗
+      networkDebounce: true, //是否防抖防止重复请求
       cancelToken: cancelToken,
     );
 
+    Log.d("------请求返回的result--$result--------");
     //根据返回的结果,封装原始数据为Bean/Entity对象
     if (result.isSuccess) {
       //重新赋值data或list
       final json = result.getDataJson();
-      var data = RewardsState.fromJson(json!);
+      var data = RewardsIndexEntity.fromJson(json!);
+      Log.d("------data--$data--------");
       //重新赋值data或list
-      return result.convert<RewardsState>(data: data);
+      return result.convert<RewardsIndexEntity>(data: data);
     }
     return result.convert();
   }
-
-
 }

+ 27 - 33
packages/cpt_rewards/lib/modules/rewards/rewards_state.dart

@@ -2,48 +2,42 @@
 
 import 'dart:convert';
 
-RewardsState rewardsStateFromJson(String str) => RewardsState.fromJson(json.decode(str));
-
-String rewardsStateToJson(RewardsState data) => json.encode(data.toJson());
+import 'package:domain/entity/rewards_index_entity.dart';
+import 'package:widgets/load_state_layout.dart';
 
 class RewardsState {
+  //页面 LoadView 状态的展示
+  LoadState loadingState;
+  String? errorMessage;
+  RewardsIndexEntity? list;
+
   RewardsState({
-    required this.curPage,
-    required this.pageSize,
+    this.loadingState = LoadState.State_Loading,
+    String? errorMessage,
     required this.list,
-    required this.filterCount,
   });
 
-  int curPage;
-  int pageSize;
-  List<Map<String, dynamic>> list;
-  int filterCount;
-
-  factory RewardsState.fromJson(Map<dynamic, dynamic> json) => RewardsState(
-    curPage: json["curPage"],
-    pageSize: json["pageSize"],
-    list: List<Map<String, dynamic>>.from(json["list"].map((x) => x)),
-    filterCount: json["filterCount"],
-  );
-
-  Map<dynamic, dynamic> toJson() => {
-    "curPage": curPage,
-    "pageSize": pageSize,
-    "list": List<dynamic>.from(list.map((x) => x)),
-    "filterCount": filterCount,
-  };
-
   RewardsState copyWith({
-    int? curPage,
-    int? pageSize,
-    List<Map<String, dynamic>>? list,
-    int? filterCount,
+    LoadState? loadingState,
+    String? errorMessage,
+    RewardsIndexEntity? list,
   }) {
     return RewardsState(
-      curPage: curPage ?? this.curPage,
-      pageSize: pageSize ?? this.pageSize,
+      loadingState: loadingState ?? this.loadingState,
+      errorMessage: errorMessage ?? this.errorMessage,
       list: list ?? this.list,
-      filterCount: filterCount ?? this.filterCount,
     );
   }
-}
+
+  Map<String, dynamic> toMap() {
+    return {
+      'list': this.list,
+    };
+  }
+
+  factory RewardsState.fromMap(Map<String, dynamic> map) {
+    return RewardsState(
+      list: map['list'] as RewardsIndexEntity,
+    );
+  }
+}

+ 40 - 45
packages/cpt_rewards/lib/modules/rewards/rewards_vm.dart

@@ -1,9 +1,12 @@
+import 'package:domain/entity/rewards_index_entity.dart';
 import 'package:flutter/material.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:plugin_platform/engine/toast/toast_engine.dart';
+import 'package:widgets/load_state_layout.dart';
 import 'package:widgets/picker/option_pick_util.dart';
+import 'package:widgets/widget_export.dart';
 import './rewards_state.dart';
 import './rewards_repository.dart';
 part 'rewards_vm.g.dart';
@@ -11,25 +14,15 @@ part 'rewards_vm.g.dart';
 @riverpod
 class RewardsVm extends _$RewardsVm {
   late RewardsRepository rewardsRepository;
+  bool _needShowPlaceholder = false; //是否展示LoadingView
+
+  // Refresh 控制器
+  final EasyRefreshController refreshController = EasyRefreshController(
+    controlFinishRefresh: true, //允许刷新
+    controlFinishLoad: true, //允许加载
+  );
   RewardsState initState() {
-    return RewardsState(
-      curPage: 1,
-      pageSize: 10,
-      list: [
-        {
-          "id": 1,
-          "title":
-              "The community will hold the activity of making Zongzi on the Loong Boat ……",
-          "price": "Monday 14 0ct 2024, 15:00 PM~18:00PM",
-        },
-        {
-          "id": 2,
-          "title": "Community basketball competition activities",
-          "price": "Monday 14 Oct 2024, 10:19 AM",
-        },
-      ],
-      filterCount: 2,
-    );
+    return RewardsState(list: null);
   }
 
   @override
@@ -45,20 +38,12 @@ class RewardsVm extends _$RewardsVm {
   // 初始化页面数据
   initPageData() {
     Log.d("----property_news_vm-----initPageData");
-    refreshListData();
+    getListData();
   }
 
   // 上拉加载
   Future onLoadData() async {
     Log.d("----property_news_vm-----initListData");
-    // await Future.delayed(const Duration(seconds: 2));
-    // if(state.list.length >= state.filterCount){
-    //   return;
-    // }else {
-    //   int curPage = state.curPage + 1;
-    //   state = state.copyWith(curPage: curPage,);
-    //   getListData();
-    // }
     getListData();
   }
 
@@ -68,41 +53,51 @@ class RewardsVm extends _$RewardsVm {
     // PropertyPage.startInstance(context: context, item: item);
   }
 
+// 重试请求
+  Future retryRequest() async {
+    _needShowPlaceholder = true;
+    getListData();
+  }
+
+  //刷新页面状态
+  void changeLoadingState(LoadState loadState, String? errorMsg) {
+    state = state.copyWith(loadingState: loadState, errorMessage: errorMsg);
+  }
+
   // 获取list 列表数据
   void getListData<T>() async {
     Log.d("加载listData数据---------------start-----");
     try {
       //请求网络
-      Map<String, dynamic> params = {
-        "curPage": state.curPage,
-        "pageSize": state.pageSize,
-      };
+      Map<String, dynamic> params = {};
       Log.d("请求参数------$params");
-      final result =
-          await rewardsRepository.fetchPropertyNewsList(params);
+      final result = await rewardsRepository.fetchPropertyNewsList(params);
       Log.d("请求完成结果------${result.data}");
       //校验成功失败
       if (result.isSuccess) {
-        // state = state.copyWith(serverTime: result.data);
-        state = state;
+        state = state.copyWith(
+          list: result.data as RewardsIndexEntity,
+        );
         ToastEngine.show("获取数据成功");
+        changeLoadingState(LoadState.State_Success, null);
       } else {
+        String errorMessage = result.errorMsg!;
+        changeLoadingState(LoadState.State_Error, errorMessage);
         ToastEngine.show(result.errorMsg ?? "Network Load Error");
       }
     } catch (e) {
       ToastEngine.show("Error: $e");
     }
   }
+  // // 下拉刷新
+  // Future refreshListData() async {
+  //   Log.d("----property_news_vm-----refreshListData ");
 
-  // 下拉刷新
-  Future refreshListData() async {
-    Log.d("----property_news_vm-----refreshListData ");
-
-    // await Future.delayed(const Duration(seconds: 2));
+  //   // await Future.delayed(const Duration(seconds: 2));
 
-    state = state.copyWith(curPage: 1, pageSize: 10);
-    // ref.invalidateSelf();
-    // ref.invalidate(propertyNewsVmProvider);
-    getListData();
-  }
+  //   state = state.copyWith(curPage: 1, pageSize: 10);
+  //   // ref.invalidateSelf();
+  //   // ref.invalidate(propertyNewsVmProvider);
+  //   getListData();
+  // }
 }

+ 31 - 7
packages/cpt_rewards/lib/modules/rewards_detail/rewards_detail_page.dart

@@ -3,11 +3,13 @@ import 'package:cs_resources/theme/app_colors_theme.dart';
 import 'package:flutter/cupertino.dart';
 import 'package:flutter/material.dart';
 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/log_utils.dart';
 import 'package:shared/utils/color_utils.dart';
 import 'package:widgets/ext/ex_widget.dart';
+import 'package:widgets/load_state_layout.dart';
 import 'package:widgets/my_appbar.dart';
 import 'package:widgets/my_load_image.dart';
 import 'package:widgets/my_text_view.dart';
@@ -20,14 +22,20 @@ import './rewards_detail_vm.dart';
 
 @RoutePage()
 class RewardsDetailPage extends HookConsumerWidget {
-  const RewardsDetailPage({Key? key}) : super(key: key);
+  final int? id;
+  const RewardsDetailPage(
+      {Key? key,
+      @PathParam('id') required this.id}) : super(key: key);
 
   //启动当前页面
-  static void startInstance({BuildContext? context}) {
+  static void startInstance({
+    BuildContext? context,
+    int? id,
+  }) {
     if (context != null) {
-      context.router.push(const RewardsDetailPageRoute());
+      context.router.push(RewardsDetailPageRoute(id: id));
     } else {
-      appRouter.push(const RewardsDetailPageRoute());
+      appRouter.push(RewardsDetailPageRoute(id: id));
     }
   }
 
@@ -565,16 +573,32 @@ class RewardsDetailPage extends HookConsumerWidget {
   Widget build(BuildContext context, WidgetRef ref) {
     final _vm = ref.read(rewardsDetailVmProvider.notifier);
     final state = ref.watch(rewardsDetailVmProvider);
+    useEffect(() {
+      // 组件挂载时执行 - 执行接口请求
+      Future.microtask(() => _vm.initPageData(id:id));
+      return () {
+        // 组件卸载时执行
+        Log.d("property_news_page 组件卸载时执行");
+      };
+    }, []);
     return Scaffold(
       appBar: MyAppBar.appBar(
         context,
         "Verification Detail",
         backgroundColor: context.appColors.whiteBG,
       ),
-      body: Column(
+      body:  LoadStateLayout(
+          state: state.loadingState,
+          errorMessage: state.errorMessage,
+          errorRetry: () {
+            _vm.retryRequest(id: id);
+          },
+          successWidget: Column(
         children: [
           Expanded(
-              child: SingleChildScrollView(
+              child: 
+             
+              SingleChildScrollView(
                   scrollDirection: Axis.vertical,
                   physics: const BouncingScrollPhysics(),
                   clipBehavior: Clip.none,
@@ -626,7 +650,7 @@ class RewardsDetailPage extends HookConsumerWidget {
             ),
           )
         ],
-      ),
+      )),
     );
   }
 }

+ 11 - 14
packages/cpt_rewards/lib/modules/rewards_detail/rewards_detail_repository.dart

@@ -4,6 +4,7 @@ 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,18 +28,13 @@ class RewardsDetailRepository {
   RewardsDetailRepository({required this.dioEngine});
 
   Future<HttpResult<Object>> fetchPropertyNewsList(
-      Map<String, dynamic>? data, {
-        CancelToken? cancelToken,
-      }) async {
+    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";
@@ -46,25 +42,26 @@ class RewardsDetailRepository {
 
     final result = await dioEngine.requestNetResult(
       // ApiConstants.apiServerTime, // api 地址
-      '/index.php/api/employee/extra/time', // api 地址
+      '/api/v1/user/reward/reward/detail', // api 地址
       params: params,
       headers: headers,
       method: HttpMethod.GET,
-      isShowLoadingDialog: true,  //是否展示默认的Loading弹窗
-      networkDebounce: true,   //是否防抖防止重复请求
+      isShowLoadingDialog: false, //是否展示默认的Loading弹窗
+      networkDebounce: true, //是否防抖防止重复请求
       cancelToken: cancelToken,
     );
 
+    Log.d("------请求返回的result--$result--------");
     //根据返回的结果,封装原始数据为Bean/Entity对象
     if (result.isSuccess) {
       //重新赋值data或list
       final json = result.getDataJson();
-      var data = RewardsDetailState.fromJson(json!);
+      // var data = RewardsIndexEntity.fromJson(json!);
+      // Log.d("------data--$data--------");
       //重新赋值data或list
-      return result.convert<RewardsDetailState>(data: data);
+      // return result.convert<RewardsIndexEntity>(data: data);
     }
     return result.convert();
   }
 
-
 }

+ 22 - 31
packages/cpt_rewards/lib/modules/rewards_detail/rewards_detail_state.dart

@@ -2,48 +2,39 @@
 
 import 'dart:convert';
 
-RewardsDetailState rewardsDetailStateFromJson(String str) => RewardsDetailState.fromJson(json.decode(str));
-
-String rewardsDetailStateToJson(RewardsDetailState data) => json.encode(data.toJson());
+import 'package:widgets/load_state_layout.dart';
 
 class RewardsDetailState {
+  //页面 LoadView 状态的展示
+  LoadState loadingState;
+  String? errorMessage;
+  List<Map<String, dynamic>>? list;
+
   RewardsDetailState({
-    required this.curPage,
-    required this.pageSize,
+    this.loadingState = LoadState.State_Loading,
+    String? errorMessage,
     required this.list,
-    required this.filterCount,
   });
 
-  int curPage;
-  int pageSize;
-  List<Map<String, dynamic>> list;
-  int filterCount;
-
-  factory RewardsDetailState.fromJson(Map<dynamic, dynamic> json) => RewardsDetailState(
-    curPage: json["curPage"],
-    pageSize: json["pageSize"],
-    list: List<Map<String, dynamic>>.from(json["list"].map((x) => x)),
-    filterCount: json["filterCount"],
-  );
-
-  Map<dynamic, dynamic> toJson() => {
-    "curPage": curPage,
-    "pageSize": pageSize,
-    "list": List<dynamic>.from(list.map((x) => x)),
-    "filterCount": filterCount,
-  };
-
   RewardsDetailState copyWith({
-    int? curPage,
-    int? pageSize,
+    LoadState? loadingState,
+    String? errorMessage,
     List<Map<String, dynamic>>? list,
-    int? filterCount,
   }) {
     return RewardsDetailState(
-      curPage: curPage ?? this.curPage,
-      pageSize: pageSize ?? this.pageSize,
+      loadingState: loadingState ?? this.loadingState,
+      errorMessage: errorMessage ?? this.errorMessage,
       list: list ?? this.list,
-      filterCount: filterCount ?? this.filterCount,
     );
   }
+
+  Map<String, dynamic> toMap() {
+    return {
+      'list': this.list,
+    };
+  }
+
+  factory RewardsDetailState.fromMap(Map<String, dynamic> map) {
+    return RewardsDetailState(list: map['list'] as List<Map<String, dynamic>>);
+  }
 }

+ 40 - 45
packages/cpt_rewards/lib/modules/rewards_detail/rewards_detail_vm.dart

@@ -3,7 +3,9 @@ import 'package:plugin_platform/http/http_result.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/picker/option_pick_util.dart';
+import 'package:widgets/widget_export.dart';
 import './rewards_detail_state.dart';
 import './rewards_detail_repository.dart';
 part 'rewards_detail_vm.g.dart';
@@ -11,25 +13,15 @@ part 'rewards_detail_vm.g.dart';
 @riverpod
 class RewardsDetailVm extends _$RewardsDetailVm {
   late RewardsDetailRepository rewardsDetailRepository;
+  bool _needShowPlaceholder = false; //是否展示LoadingView
+
+  // Refresh 控制器
+  final EasyRefreshController refreshController = EasyRefreshController(
+    controlFinishRefresh: true, //允许刷新
+    controlFinishLoad: true, //允许加载
+  );
   RewardsDetailState initState() {
-    return RewardsDetailState(
-      curPage: 1,
-      pageSize: 10,
-      list: [
-        {
-          "id": 1,
-          "title":
-              "The community will hold the activity of making Zongzi on the Loong Boat ……",
-          "price": "Monday 14 0ct 2024, 15:00 PM~18:00PM",
-        },
-        {
-          "id": 2,
-          "title": "Community basketball competition activities",
-          "price": "Monday 14 Oct 2024, 10:19 AM",
-        },
-      ],
-      filterCount: 2,
-    );
+    return RewardsDetailState(list: [],);
   }
 
   @override
@@ -43,22 +35,14 @@ class RewardsDetailVm extends _$RewardsDetailVm {
   }
 
   // 初始化页面数据
-  initPageData() {
+  initPageData({int? id}) {
     Log.d("----property_news_vm-----initPageData");
-    refreshListData();
+    getListData(id: id);
   }
 
   // 上拉加载
   Future onLoadData() async {
     Log.d("----property_news_vm-----initListData");
-    // await Future.delayed(const Duration(seconds: 2));
-    // if(state.list.length >= state.filterCount){
-    //   return;
-    // }else {
-    //   int curPage = state.curPage + 1;
-    //   state = state.copyWith(curPage: curPage,);
-    //   getListData();
-    // }
     getListData();
   }
 
@@ -68,42 +52,53 @@ class RewardsDetailVm extends _$RewardsDetailVm {
     // PropertyPage.startInstance(context: context, item: item);
   }
 
+// 重试请求
+  Future retryRequest({int? id}) async {
+    _needShowPlaceholder = true;
+    getListData(id:id);
+  }
+
+  //刷新页面状态
+  void changeLoadingState(LoadState loadState, String? errorMsg) {
+    state = state.copyWith(loadingState: loadState, errorMessage: errorMsg);
+  }
+
   // 获取list 列表数据
-  void getListData<T>() async {
+  void getListData<T>({int? id}) async {
     Log.d("加载listData数据---------------start-----");
     try {
       //请求网络
       Map<String, dynamic> params = {
-        "curPage": state.curPage,
-        "pageSize": state.pageSize,
+        "id": id
       };
       Log.d("请求参数------$params");
       final result = await rewardsDetailRepository.fetchPropertyNewsList(params);
       Log.d("请求完成结果------${result.data}");
       //校验成功失败
       if (result.isSuccess) {
-        // state = state.copyWith(serverTime: result.data);
-        state = state;
+        // state = state.copyWith(
+        //   list: result.data as RewardsIndexEntity,
+        // );
         ToastEngine.show("获取数据成功");
+        changeLoadingState(LoadState.State_Success, null);
       } else {
+        String errorMessage = result.errorMsg!;
+        changeLoadingState(LoadState.State_Error, errorMessage);
         ToastEngine.show(result.errorMsg ?? "Network Load Error");
       }
     } catch (e) {
       ToastEngine.show("Error: $e");
     }
   }
+  // // 下拉刷新
+  // Future refreshListData() async {
+  //   Log.d("----property_news_vm-----refreshListData ");
 
-  // 下拉刷新
-  Future refreshListData() async {
-    Log.d("----property_news_vm-----refreshListData ");
-
-    // await Future.delayed(const Duration(seconds: 2));
-
-    state = state.copyWith(curPage: 1, pageSize: 10);
-    // ref.invalidateSelf();
-    // ref.invalidate(propertyNewsVmProvider);
-    getListData();
-  }
-
+  //   // await Future.delayed(const Duration(seconds: 2));
 
+  //   state = state.copyWith(curPage: 1, pageSize: 10);
+  //   // ref.invalidateSelf();
+  //   // ref.invalidate(propertyNewsVmProvider);
+  //   getListData();
+  // }
 }

+ 39 - 22
packages/cpt_rewards/lib/modules/rewards_history/rewards_history_earned/rewards_history_earned_page.dart

@@ -2,11 +2,13 @@ import 'package:cpt_rewards/modules/rewards_code/rewards_code_page.dart';
 import 'package:cpt_rewards/modules/rewards_redeem/rewards_redeem_page.dart';
 import 'package:flutter/material.dart';
 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/log_utils.dart';
 import 'package:shared/utils/color_utils.dart';
 import 'package:widgets/ext/ex_widget.dart';
+import 'package:widgets/load_state_layout.dart';
 import 'package:widgets/my_load_image.dart';
 import 'package:widgets/widget_export.dart';
 import 'package:cs_resources/generated/assets.dart';
@@ -101,30 +103,45 @@ class RewardsHistoryEarnedPage extends HookConsumerWidget {
 
   @override
   Widget build(BuildContext context, WidgetRef ref) {
-    final _vm = ref.read(rewardsHistoryEarnedVmProvider.notifier);
-
+    final vm = ref.read(rewardsHistoryEarnedVmProvider.notifier);
+    final state = ref.watch(rewardsHistoryEarnedVmProvider);
+    useEffect(() {
+      // 组件挂载时执行 - 执行接口请求
+      Future.microtask(() => vm.initPageData());
+      return () {
+        // 组件卸载时执行
+        Log.d("property_news_page 组件卸载时执行");
+      };
+    }, []);
     return Scaffold(
       // appBar: AppBar(title: Text("资产")),
-      body: Container(
-        color: ColorUtils.string2Color('#F2F3F6'),
-        padding: const EdgeInsets.only(top: 15, left: 15, right: 15),
-        child: EasyRefresh(
-          // 上拉加载
-          onLoad: () async {
-            Log.d("----onLoad");
-            _vm.onLoadData();
-          },
-          // 下拉刷新
-          onRefresh: () async {
-            Log.d("----onRefresh");
-            _vm.refreshListData();
-          },
-          child: Container(
-              // color: ColorUtils.string2Color('#F2F3F6'),
-              // padding: const EdgeInsets.only(top: 15, left: 15, right: 15),
-              child: _buildSaleList(context, ref, _vm)),
-        ),
-      ),
+      body: SizedBox(
+          width: double.infinity,
+          height: double.infinity,
+          child: EasyRefresh(
+              controller: vm.refreshController,
+              // 上拉加载
+              onLoad: () async {
+                Log.d("----onLoad");
+                vm.loadMore();
+              },
+              // 下拉刷新
+              onRefresh: () async {
+                Log.d("----onRefresh");
+                vm.onRefresh();
+              },
+              child: Container(
+                color: ColorUtils.string2Color('#F2F3F6'),
+                padding: const EdgeInsets.only(top: 15),
+                child: LoadStateLayout(
+                  state: state.loadingState,
+                  errorMessage: state.errorMessage,
+                  errorRetry: () {
+                    vm.retryRequest();
+                  },
+                  successSliverWidget: [_buildSaleList(context, ref, vm)],
+                ),
+              ))),
     );
   }
 }

+ 12 - 16
packages/cpt_rewards/lib/modules/rewards_history/rewards_history_earned/rewards_history_earned_repository.dart

@@ -1,9 +1,11 @@
 import 'package:domain/constants/api_constants.dart';
+import 'package:domain/entity/rewards_history_earned_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';
@@ -26,19 +28,14 @@ class RewardsHistoryEarnedRepository {
 
   RewardsHistoryEarnedRepository({required this.dioEngine});
 
-  Future<HttpResult<Object>> fetchPropertyNewsList(
-      Map<String, dynamic>? data, {
-        CancelToken? cancelToken,
-      }) async {
+  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";
@@ -46,25 +43,24 @@ class RewardsHistoryEarnedRepository {
 
     final result = await dioEngine.requestNetResult(
       // ApiConstants.apiServerTime, // api 地址
-      '/index.php/api/employee/extra/time', // api 地址
+      '/api/v1/user/reward/point/index', // api 地址
       params: params,
       headers: headers,
       method: HttpMethod.GET,
-      isShowLoadingDialog: true,  //是否展示默认的Loading弹窗
-      networkDebounce: true,   //是否防抖防止重复请求
+      isShowLoadingDialog: false, //是否展示默认的Loading弹窗
+      networkDebounce: true, //是否防抖防止重复请求
       cancelToken: cancelToken,
     );
 
+    Log.d("------请求返回的result--$result--------");
     //根据返回的结果,封装原始数据为Bean/Entity对象
     if (result.isSuccess) {
       //重新赋值data或list
       final json = result.getDataJson();
-      var data = RewardsHistoryEarnedState.fromJson(json!);
+      var data = RewardsHistoryEarnedEntity.fromJson(json!);
       //重新赋值data或list
-      return result.convert<RewardsHistoryEarnedState>(data: data);
+      return result.convert<RewardsHistoryEarnedEntity>(data: data);
     }
     return result.convert();
   }
-
-
 }

+ 44 - 32
packages/cpt_rewards/lib/modules/rewards_history/rewards_history_earned/rewards_history_earned_state.dart

@@ -2,48 +2,60 @@
 
 import 'dart:convert';
 
-RewardsHistoryEarnedState rewardsHistoryEarnedStateFromJson(String str) => RewardsHistoryEarnedState.fromJson(json.decode(str));
-
-String rewardsHistoryEarnedStateToJson(RewardsHistoryEarnedState data) => json.encode(data.toJson());
+import 'package:widgets/load_state_layout.dart';
 
 class RewardsHistoryEarnedState {
+  //页面 LoadView 状态的展示
+  LoadState loadingState;
+  String? errorMessage;
+
+  int? page;
+  int? limit = 10;
+  int? count = 1;
+  List<Map<String, dynamic>>? list;
+
   RewardsHistoryEarnedState({
-    required this.curPage,
-    required this.pageSize,
+    this.loadingState = LoadState.State_Loading,
+    String? errorMessage,
+    this.page = 1,
+    this.limit = 10,
+    this.count = 1,
     required this.list,
-    required this.filterCount,
   });
 
-  int curPage;
-  int pageSize;
-  List<Map<String, dynamic>> list;
-  int filterCount;
-
-  factory RewardsHistoryEarnedState.fromJson(Map<dynamic, dynamic> json) => RewardsHistoryEarnedState(
-    curPage: json["curPage"],
-    pageSize: json["pageSize"],
-    list: List<Map<String, dynamic>>.from(json["list"].map((x) => x)),
-    filterCount: json["filterCount"],
-  );
-
-  Map<dynamic, dynamic> toJson() => {
-    "curPage": curPage,
-    "pageSize": pageSize,
-    "list": List<dynamic>.from(list.map((x) => x)),
-    "filterCount": filterCount,
-  };
-
   RewardsHistoryEarnedState copyWith({
-    int? curPage,
-    int? pageSize,
+    LoadState? loadingState,
+    String? errorMessage,
+    int? page,
+    int? limit,
+    int? count,
     List<Map<String, dynamic>>? list,
-    int? filterCount,
   }) {
     return RewardsHistoryEarnedState(
-      curPage: curPage ?? this.curPage,
-      pageSize: pageSize ?? this.pageSize,
+      loadingState: loadingState ?? this.loadingState,
+      errorMessage: errorMessage ?? this.errorMessage,
+      page: page ?? this.page,
+      limit: limit ?? this.limit,
+      count: count ?? this.count,
       list: list ?? this.list,
-      filterCount: filterCount ?? this.filterCount,
     );
   }
-}
+
+  Map<String, dynamic> toMap() {
+    return {
+      'page': this.page,
+      'limit': this.limit,
+      'count': this.count,
+      'list': this.list,
+    };
+  }
+
+  factory RewardsHistoryEarnedState.fromMap(Map<String, dynamic> map) {
+    return RewardsHistoryEarnedState(
+      page: map['page'] as int,
+      limit: map['limit'] as int,
+      count: map['count'] as int,
+      list: map['list'] as List<Map<String, dynamic>>,
+    );
+  }
+}

+ 96 - 47
packages/cpt_rewards/lib/modules/rewards_history/rewards_history_earned/rewards_history_earned_vm.dart

@@ -1,7 +1,10 @@
+import 'package:domain/entity/rewards_history_earned_entity.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:plugin_platform/engine/toast/toast_engine.dart';
+import 'package:widgets/load_state_layout.dart';
+import 'package:widgets/widget_export.dart';
 import './rewards_history_earned_state.dart';
 import './rewards_history_earned_repository.dart';
 part 'rewards_history_earned_vm.g.dart';
@@ -9,81 +12,103 @@ part 'rewards_history_earned_vm.g.dart';
 @riverpod
 class RewardsHistoryEarnedVm extends _$RewardsHistoryEarnedVm {
   late RewardsHistoryEarnedRepository rewardsHistoryEarnedRepository;
+  var page = 1;
+  var limit = 10;
+
+  bool _needShowPlaceholder = false; //是否展示LoadingView
+
+  // Refresh 控制器
+  final EasyRefreshController refreshController = EasyRefreshController(
+    controlFinishRefresh: true, //允许刷新
+    controlFinishLoad: true, //允许加载
+  );
+
   RewardsHistoryEarnedState initState() {
+    // 初始化页面数据&0
     return RewardsHistoryEarnedState(
-      curPage: 1,
-      pageSize: 10,
-      list: [
-        {
-          "id": 1,
-          "title":
-              "The community will hold the activity of making Zongzi on the Loong Boat ……",
-          "price": "Monday 14 0ct 2024, 15:00 PM~18:00PM",
-        },
-        {
-          "id": 2,
-          "title": "Community basketball competition activities",
-          "price": "Monday 14 Oct 2024, 10:19 AM",
-        },
-      ],
-      filterCount: 2,
+      list: [],
     );
   }
 
   @override
   RewardsHistoryEarnedState build() {
     // 引入数据仓库
-    rewardsHistoryEarnedRepository = ref.read(rewardsHistoryEarnedRepositoryProvider);
+    rewardsHistoryEarnedRepository =
+        ref.read(rewardsHistoryEarnedRepositoryProvider);
     // 初始化状态
     RewardsHistoryEarnedState state = initState();
     // 初始化列表数据
     return state;
   }
 
-  // 初始化页面数据
+//刷新页面状态
+  void changeLoadingState(LoadState loadState, String? errorMsg) {
+    state = state.copyWith(loadingState: loadState, errorMessage: errorMsg);
+  }
+
+  // 初始化页面数据&0
   initPageData() {
     Log.d("----property_news_vm-----initPageData");
-    refreshListData();
+    onRefresh();
   }
 
-  // 上拉加载
-  Future onLoadData() async {
-    Log.d("----property_news_vm-----initListData");
+  // 上拉加载 更多
+  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 = page + 1;
+    //   state = state.copyWith(page: page,);
     //   getListData();
     // }
+    // 检查 page 是否为 null,并初始化为 1
+    page++;
+
+    getListData();
+  }
+
+  // 下拉刷新
+  Future onRefresh() async {
+    Log.d("----property_news_vm-----onRefresh ");
+
+    // await Future.delayed(const Duration(seconds: 2));
+    page = 1;
     getListData();
   }
 
-// 去新闻详情页
-  void goNewsDetail(String item) {
-    Log.d(item);
-    // PropertyPage.startInstance(context: context, item: item);
+  // 重试请求
+  Future retryRequest() async {
+    page = 1;
+    _needShowPlaceholder = true;
+    getListData();
   }
 
   // 获取list 列表数据
-  void getListData<T>() async {
-    Log.d("加载listData数据---------------start-----");
+  Future getListData<T>() async {
+    // if (_needShowPlaceholder) {
+    //   changeLoadingState(LoadState.State_Loading, null);
+    // }
+
+    Log.d("加载listData数据---------------start--${page}---");
     try {
       //请求网络
       Map<String, dynamic> params = {
-        "curPage": state.curPage,
-        "pageSize": state.pageSize,
+        "page": page,
+        "limit": limit,
+        "list_type": 'earned'
       };
       Log.d("请求参数------$params");
-      final result = await rewardsHistoryEarnedRepository.fetchPropertyNewsList(params);
-      Log.d("请求完成结果------${result.data}");
+      final result = await rewardsHistoryEarnedRepository.fetchList(params);
       //校验成功失败
       if (result.isSuccess) {
-        // state = state.copyWith(serverTime: result.data);
-        state = state;
-        ToastEngine.show("获取数据成功");
+        handlerResultList((result.data as RewardsHistoryEarnedEntity)
+            .list
+            .cast<RewardsHistoryEarnedEntity>());
       } else {
+        String errorMessage = result.errorMsg!;
+        changeLoadingState(LoadState.State_Error, errorMessage);
         ToastEngine.show(result.errorMsg ?? "Network Load Error");
       }
     } catch (e) {
@@ -91,15 +116,39 @@ class RewardsHistoryEarnedVm extends _$RewardsHistoryEarnedVm {
     }
   }
 
-  // 下拉刷新
-  Future refreshListData() async {
-    Log.d("----property_news_vm-----refreshListData ");
-
-    // await Future.delayed(const Duration(seconds: 2));
+  void handlerResultList(List<RewardsHistoryEarnedEntity>? list) {
+    if (list != null && list.isNotEmpty) {
+      //有数据,判断是刷新还是加载更多的数据
+      if (page == 1) {
+        //刷新的方式
+        state.list!.clear();
+        state.list!.addAll(list.map((item) => item.toJson()).toList());
+        refreshController.finishRefresh();
 
-    state = state.copyWith(curPage: 1, pageSize: 10);
-    // ref.invalidateSelf();
-    // ref.invalidate(propertyNewsVmProvider);
-    getListData();
+        //更新展示的状态
+        changeLoadingState(LoadState.State_Success, null);
+      } else {
+        //加载更多
+        final allList = state.list;
+        state = state.copyWith(list: allList);
+        refreshController.finishLoad();
+        // update();
+      }
+    } else {
+      if (page == 1) {
+        //展示无数据的布局
+        state.list!.clear();
+        changeLoadingState(LoadState.State_Empty, null);
+        refreshController.finishRefresh();
+      } else {
+        //展示加载完成,没有更多数据了
+        if (state.list!.length == 0) {
+          changeLoadingState(LoadState.State_Empty, null);
+        } else {
+          changeLoadingState(LoadState.State_Success, null);
+        }
+        refreshController.finishLoad(IndicatorResult.noMore);
+      }
+    }
   }
 }

+ 40 - 23
packages/cpt_rewards/lib/modules/rewards_history/rewards_history_spent/rewards_history_spent_page.dart

@@ -1,11 +1,13 @@
 import 'package:cpt_rewards/modules/rewards_transaction/rewards_transaction_page.dart';
 import 'package:flutter/material.dart';
 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/log_utils.dart';
 import 'package:shared/utils/color_utils.dart';
 import 'package:widgets/ext/ex_widget.dart';
+import 'package:widgets/load_state_layout.dart';
 import 'package:widgets/my_load_image.dart';
 import 'package:widgets/widget_export.dart';
 import 'package:cs_resources/generated/assets.dart';
@@ -99,31 +101,46 @@ class RewardsHistorySpentPage extends HookConsumerWidget {
   }
 
   @override
-  Widget build(BuildContext context, WidgetRef ref) {
-    final _vm = ref.read(rewardsHistorySpentVmProvider.notifier);
-
+   Widget build(BuildContext context, WidgetRef ref) {
+    final vm = ref.read(rewardsHistorySpentVmProvider.notifier);
+    final state = ref.watch(rewardsHistorySpentVmProvider);
+    useEffect(() {
+      // 组件挂载时执行 - 执行接口请求
+      Future.microtask(() => vm.initPageData());
+      return () {
+        // 组件卸载时执行
+        Log.d("property_news_page 组件卸载时执行");
+      };
+    }, []);
     return Scaffold(
       // appBar: AppBar(title: Text("资产")),
-      body: Container(
-        color: ColorUtils.string2Color('#F2F3F6'),
-        padding: const EdgeInsets.only(top: 15, left: 15, right: 15),
-        child: EasyRefresh(
-          // 上拉加载
-          onLoad: () async {
-            Log.d("----onLoad");
-            _vm.onLoadData();
-          },
-          // 下拉刷新
-          onRefresh: () async {
-            Log.d("----onRefresh");
-            _vm.refreshListData();
-          },
-          child: Container(
-              // color: ColorUtils.string2Color('#F2F3F6'),
-              // padding: const EdgeInsets.only(top: 15, left: 15, right: 15),
-              child: _buildSaleList(context, ref, _vm)),
-        ),
-      ),
+      body: SizedBox(
+          width: double.infinity,
+          height: double.infinity,
+          child: EasyRefresh(
+              controller: vm.refreshController,
+              // 上拉加载
+              onLoad: () async {
+                Log.d("----onLoad");
+                vm.loadMore();
+              },
+              // 下拉刷新
+              onRefresh: () async {
+                Log.d("----onRefresh");
+                vm.onRefresh();
+              },
+              child: Container(
+                color: ColorUtils.string2Color('#F2F3F6'),
+                padding: const EdgeInsets.only(top: 15),
+                child: LoadStateLayout(
+                  state: state.loadingState,
+                  errorMessage: state.errorMessage,
+                  errorRetry: () {
+                    vm.retryRequest();
+                  },
+                  successSliverWidget: [_buildSaleList(context, ref, vm)],
+                ),
+              ))),
     );
   }
 }

+ 14 - 16
packages/cpt_rewards/lib/modules/rewards_history/rewards_history_spent/rewards_history_spent_repository.dart

@@ -1,9 +1,11 @@
 import 'package:domain/constants/api_constants.dart';
+import 'package:domain/entity/rewards_history_earned_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';
@@ -18,6 +20,7 @@ RewardsHistorySpentRepository rewardsHistorySpentRepository(Ref ref) {
   return RewardsHistorySpentRepository(dioEngine: dioEngine);
 }
 
+
 /*
  * 数据仓库
  */
@@ -26,19 +29,14 @@ class RewardsHistorySpentRepository {
 
   RewardsHistorySpentRepository({required this.dioEngine});
 
-  Future<HttpResult<Object>> fetchPropertyNewsList(
-      Map<String, dynamic>? data, {
-        CancelToken? cancelToken,
-      }) async {
+  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";
@@ -46,25 +44,25 @@ class RewardsHistorySpentRepository {
 
     final result = await dioEngine.requestNetResult(
       // ApiConstants.apiServerTime, // api 地址
-      '/index.php/api/employee/extra/time', // api 地址
+      '/api/v1/user/reward/point/index', // api 地址
       params: params,
       headers: headers,
       method: HttpMethod.GET,
-      isShowLoadingDialog: true,  //是否展示默认的Loading弹窗
-      networkDebounce: true,   //是否防抖防止重复请求
+      isShowLoadingDialog: false, //是否展示默认的Loading弹窗
+      networkDebounce: true, //是否防抖防止重复请求
       cancelToken: cancelToken,
     );
 
+    Log.d("------请求返回的result--$result--------");
     //根据返回的结果,封装原始数据为Bean/Entity对象
     if (result.isSuccess) {
       //重新赋值data或list
       final json = result.getDataJson();
-      var data = RewardsHistorySpentState.fromJson(json!);
+      var data = RewardsHistoryEarnedEntity.fromJson(json!);
       //重新赋值data或list
-      return result.convert<RewardsHistorySpentState>(data: data);
+      return result.convert<RewardsHistoryEarnedEntity>(data: data);
     }
     return result.convert();
   }
-
-
 }
+

+ 43 - 31
packages/cpt_rewards/lib/modules/rewards_history/rewards_history_spent/rewards_history_spent_state.dart

@@ -2,48 +2,60 @@
 
 import 'dart:convert';
 
-RewardsHistorySpentState rewardsHistorySpentStateFromJson(String str) => RewardsHistorySpentState.fromJson(json.decode(str));
-
-String rewardsHistorySpentStateToJson(RewardsHistorySpentState data) => json.encode(data.toJson());
+import 'package:widgets/load_state_layout.dart';
 
 class RewardsHistorySpentState {
+  //页面 LoadView 状态的展示
+  LoadState loadingState;
+  String? errorMessage;
+
+  int? page;
+  int? limit = 10;
+  int? count = 1;
+  List<Map<String, dynamic>>? list;
+
   RewardsHistorySpentState({
-    required this.curPage,
-    required this.pageSize,
+    this.loadingState = LoadState.State_Loading,
+    String? errorMessage,
+    this.page = 1,
+    this.limit = 10,
+    this.count = 1,
     required this.list,
-    required this.filterCount,
   });
 
-  int curPage;
-  int pageSize;
-  List<Map<String, dynamic>> list;
-  int filterCount;
-
-  factory RewardsHistorySpentState.fromJson(Map<dynamic, dynamic> json) => RewardsHistorySpentState(
-    curPage: json["curPage"],
-    pageSize: json["pageSize"],
-    list: List<Map<String, dynamic>>.from(json["list"].map((x) => x)),
-    filterCount: json["filterCount"],
-  );
-
-  Map<dynamic, dynamic> toJson() => {
-    "curPage": curPage,
-    "pageSize": pageSize,
-    "list": List<dynamic>.from(list.map((x) => x)),
-    "filterCount": filterCount,
-  };
-
   RewardsHistorySpentState copyWith({
-    int? curPage,
-    int? pageSize,
+    LoadState? loadingState,
+    String? errorMessage,
+    int? page,
+    int? limit,
+    int? count,
     List<Map<String, dynamic>>? list,
-    int? filterCount,
   }) {
     return RewardsHistorySpentState(
-      curPage: curPage ?? this.curPage,
-      pageSize: pageSize ?? this.pageSize,
+      loadingState: loadingState ?? this.loadingState,
+      errorMessage: errorMessage ?? this.errorMessage,
+      page: page ?? this.page,
+      limit: limit ?? this.limit,
+      count: count ?? this.count,
       list: list ?? this.list,
-      filterCount: filterCount ?? this.filterCount,
+    );
+  }
+
+  Map<String, dynamic> toMap() {
+    return {
+      'page': this.page,
+      'limit': this.limit,
+      'count': this.count,
+      'list': this.list,
+    };
+  }
+
+  factory RewardsHistorySpentState.fromMap(Map<String, dynamic> map) {
+    return RewardsHistorySpentState(
+      page: map['page'] as int,
+      limit: map['limit'] as int,
+      count: map['count'] as int,
+      list: map['list'] as List<Map<String, dynamic>>,
     );
   }
 }

+ 96 - 47
packages/cpt_rewards/lib/modules/rewards_history/rewards_history_spent/rewards_history_spent_vm.dart

@@ -1,7 +1,10 @@
+import 'package:domain/entity/rewards_history_earned_entity.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:plugin_platform/engine/toast/toast_engine.dart';
+import 'package:widgets/load_state_layout.dart';
+import 'package:widgets/widget_export.dart';
 import './rewards_history_spent_state.dart';
 import './rewards_history_spent_repository.dart';
 part 'rewards_history_spent_vm.g.dart';
@@ -9,81 +12,103 @@ part 'rewards_history_spent_vm.g.dart';
 @riverpod
 class RewardsHistorySpentVm extends _$RewardsHistorySpentVm {
   late RewardsHistorySpentRepository rewardsHistorySpentRepository;
+  var page = 1;
+  var limit = 10;
+
+  bool _needShowPlaceholder = false; //是否展示LoadingView
+
+  // Refresh 控制器
+  final EasyRefreshController refreshController = EasyRefreshController(
+    controlFinishRefresh: true, //允许刷新
+    controlFinishLoad: true, //允许加载
+  );
+
   RewardsHistorySpentState initState() {
+    // 初始化页面数据&0
     return RewardsHistorySpentState(
-      curPage: 1,
-      pageSize: 10,
-      list: [
-        {
-          "id": 1,
-          "title":
-              "The community will hold the activity of making Zongzi on the Loong Boat ……",
-          "price": "Monday 14 0ct 2024, 15:00 PM~18:00PM",
-        },
-        {
-          "id": 2,
-          "title": "Community basketball competition activities",
-          "price": "Monday 14 Oct 2024, 10:19 AM",
-        },
-      ],
-      filterCount: 2,
+      list: [],
     );
   }
 
   @override
   RewardsHistorySpentState build() {
     // 引入数据仓库
-    rewardsHistorySpentRepository = ref.read(rewardsHistorySpentRepositoryProvider);
+    rewardsHistorySpentRepository =
+        ref.read(rewardsHistorySpentRepositoryProvider);
     // 初始化状态
     RewardsHistorySpentState state = initState();
     // 初始化列表数据
     return state;
   }
 
-  // 初始化页面数据
+//刷新页面状态
+  void changeLoadingState(LoadState loadState, String? errorMsg) {
+    state = state.copyWith(loadingState: loadState, errorMessage: errorMsg);
+  }
+
+  // 初始化页面数据&0
   initPageData() {
     Log.d("----property_news_vm-----initPageData");
-    refreshListData();
+    onRefresh();
   }
 
-  // 上拉加载
-  Future onLoadData() async {
-    Log.d("----property_news_vm-----initListData");
+  // 上拉加载 更多
+  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 = page + 1;
+    //   state = state.copyWith(page: page,);
     //   getListData();
     // }
+    // 检查 page 是否为 null,并初始化为 1
+    page++;
+
+    getListData();
+  }
+
+  // 下拉刷新
+  Future onRefresh() async {
+    Log.d("----property_news_vm-----onRefresh ");
+
+    // await Future.delayed(const Duration(seconds: 2));
+    page = 1;
     getListData();
   }
 
-// 去新闻详情页
-  void goNewsDetail(String item) {
-    Log.d(item);
-    // PropertyPage.startInstance(context: context, item: item);
+  // 重试请求
+  Future retryRequest() async {
+    page = 1;
+    _needShowPlaceholder = true;
+    getListData();
   }
 
   // 获取list 列表数据
-  void getListData<T>() async {
-    Log.d("加载listData数据---------------start-----");
+  Future getListData<T>() async {
+    // if (_needShowPlaceholder) {
+    //   changeLoadingState(LoadState.State_Loading, null);
+    // }
+
+    Log.d("加载listData数据---------------start--${page}---");
     try {
       //请求网络
       Map<String, dynamic> params = {
-        "curPage": state.curPage,
-        "pageSize": state.pageSize,
+        "page": page,
+        "limit": limit,
+        "list_type": 'spent'
       };
       Log.d("请求参数------$params");
-      final result = await rewardsHistorySpentRepository.fetchPropertyNewsList(params);
-      Log.d("请求完成结果------${result.data}");
+      final result = await rewardsHistorySpentRepository.fetchList(params);
       //校验成功失败
       if (result.isSuccess) {
-        // state = state.copyWith(serverTime: result.data);
-        state = state;
-        ToastEngine.show("获取数据成功");
+        handlerResultList((result.data as RewardsHistoryEarnedEntity)
+            .list
+            .cast<RewardsHistoryEarnedEntity>());
       } else {
+        String errorMessage = result.errorMsg!;
+        changeLoadingState(LoadState.State_Error, errorMessage);
         ToastEngine.show(result.errorMsg ?? "Network Load Error");
       }
     } catch (e) {
@@ -91,15 +116,39 @@ class RewardsHistorySpentVm extends _$RewardsHistorySpentVm {
     }
   }
 
-  // 下拉刷新
-  Future refreshListData() async {
-    Log.d("----property_news_vm-----refreshListData ");
-
-    // await Future.delayed(const Duration(seconds: 2));
+  void handlerResultList(List<RewardsHistoryEarnedEntity>? list) {
+    if (list != null && list.isNotEmpty) {
+      //有数据,判断是刷新还是加载更多的数据
+      if (page == 1) {
+        //刷新的方式
+        state.list!.clear();
+        state.list!.addAll(list.map((item) => item.toJson()).toList());
+        refreshController.finishRefresh();
 
-    state = state.copyWith(curPage: 1, pageSize: 10);
-    // ref.invalidateSelf();
-    // ref.invalidate(propertyNewsVmProvider);
-    getListData();
+        //更新展示的状态
+        changeLoadingState(LoadState.State_Success, null);
+      } else {
+        //加载更多
+        final allList = state.list;
+        state = state.copyWith(list: allList);
+        refreshController.finishLoad();
+        // update();
+      }
+    } else {
+      if (page == 1) {
+        //展示无数据的布局
+        state.list!.clear();
+        changeLoadingState(LoadState.State_Empty, null);
+        refreshController.finishRefresh();
+      } else {
+        //展示加载完成,没有更多数据了
+        if (state.list!.length == 0) {
+          changeLoadingState(LoadState.State_Empty, null);
+        } else {
+          changeLoadingState(LoadState.State_Success, null);
+        }
+        refreshController.finishLoad(IndicatorResult.noMore);
+      }
+    }
   }
 }

+ 251 - 216
packages/cpt_rewards/lib/modules/rewards_home/rewards_home_page.dart

@@ -5,13 +5,17 @@ import 'package:cpt_rewards/modules/rewards_list/rewards_list_page.dart';
 import 'package:cpt_rewards/modules/rewards_my/rewards_my_page.dart';
 import 'package:cpt_rewards/modules/rewards_search/rewards_search_page.dart';
 import 'package:cs_resources/generated/assets.dart';
+import 'package:domain/entity/rewards_home_entity.dart';
 import 'package:flutter/material.dart';
 import 'package:auto_route/auto_route.dart';
+import 'package:flutter_hooks/flutter_hooks.dart';
 import 'package:hooks_riverpod/hooks_riverpod.dart';
 import 'package:plugin_platform/engine/image/image_nine_grid.dart';
 import 'package:router/ext/auto_router_extensions.dart';
 import 'package:shared/utils/color_utils.dart';
+import 'package:shared/utils/log_utils.dart';
 import 'package:widgets/ext/ex_widget.dart';
+import 'package:widgets/load_state_layout.dart';
 import 'package:widgets/my_load_image.dart';
 
 import '../../../router/page/rewards_page_router.dart';
@@ -26,7 +30,7 @@ class RewardsHomePage extends HookConsumerWidget {
     if (context != null) {
       context.router.push(const RewardsHomePageRoute());
     } else {
-      appRouter.push(const RewardsHomePageRoute());
+      appRouter.push(const RewardsHomePageRoute()); 
     }
   }
 
@@ -57,16 +61,22 @@ class RewardsHomePage extends HookConsumerWidget {
               // backCallback
               Navigator.pop(context);
             }),
-            const Text(
-              '1526 Available Points',
-              style: TextStyle(
-                  fontSize: 18.0,
-                  color: Colors.white,
-                  fontWeight: FontWeight.w500), // 设置字体大小
-            ).paddingOnly(left: 10, top: 20, bottom: 18),
             Row(
               crossAxisAlignment: CrossAxisAlignment.center,
-              mainAxisAlignment: MainAxisAlignment.spaceBetween,
+              mainAxisAlignment: MainAxisAlignment.center,
+              children: [
+                const Text(
+                  '1526 Available Points',
+                  style: TextStyle(
+                      fontSize: 18.0,
+                      color: Colors.white,
+                      fontWeight: FontWeight.w500), // 设置字体大小
+                ).paddingOnly(left: 10, top: 20, bottom: 18),
+              ],
+            ),
+            Row(
+              crossAxisAlignment: CrossAxisAlignment.center,
+              mainAxisAlignment: MainAxisAlignment.center,
               children: [
                 Container(
                   decoration: BoxDecoration(
@@ -85,32 +95,32 @@ class RewardsHomePage extends HookConsumerWidget {
                     RewardsMyPage.startInstance();
                   }),
                 ),
-                Row(
-                  crossAxisAlignment: CrossAxisAlignment.center,
-                  mainAxisAlignment: MainAxisAlignment.center,
-                  children: [
-                    const MyAssetImage(
-                      Assets.rewardsRewardsY,
-                      width: 26,
-                      height: 26,
-                    ),
-                    Text(
-                      'Bronze',
-                      style: TextStyle(
-                          fontSize: 17.0,
-                          color: ColorUtils.string2Color('#FFCC00'),
-                          fontWeight: FontWeight.w500), // 设置字体大小
-                    ).marginOnly(
-                      left: 9,
-                      right: 7,
-                    ),
-                    const MyAssetImage(
-                      Assets.rewardsRewardsRight,
-                      width: 7,
-                      height: 12,
-                    ),
-                  ],
-                )
+                // Row(
+                //   crossAxisAlignment: CrossAxisAlignment.center,
+                //   mainAxisAlignment: MainAxisAlignment.center,
+                //   children: [
+                //     const MyAssetImage(
+                //       Assets.rewardsRewardsY,
+                //       width: 26,
+                //       height: 26,
+                //     ),
+                //     Text(
+                //       'Bronze',
+                //       style: TextStyle(
+                //           fontSize: 17.0,
+                //           color: ColorUtils.string2Color('#FFCC00'),
+                //           fontWeight: FontWeight.w500), // 设置字体大小
+                //     ).marginOnly(
+                //       left: 9,
+                //       right: 7,
+                //     ),
+                //     const MyAssetImage(
+                //       Assets.rewardsRewardsRight,
+                //       width: 7,
+                //       height: 12,
+                //     ),
+                //   ],
+                // )
               ],
             ).paddingOnly(left: 10)
           ],
@@ -205,54 +215,58 @@ class RewardsHomePage extends HookConsumerWidget {
     ).paddingOnly(left: 15);
   }
 
-  Widget _buildRecommend(BuildContext context, WidgetRef ref, _vm) {
-    return Container(
-      child: Column(
-        children: [
-          Row(
-            crossAxisAlignment: CrossAxisAlignment.center,
-            mainAxisAlignment: MainAxisAlignment.spaceBetween,
-            children: [
-              Text(
-                'Recommend',
-                style: TextStyle(
-                    fontSize: 17.0,
-                    color: ColorUtils.string2Color('#000001'),
-                    fontWeight: FontWeight.w500), // 设置字体大小
-              ),
-              Text(
-                'See All',
-                style: TextStyle(
-                    fontSize: 17.0,
-                    color: ColorUtils.string2Color('#4161D0'),
-                    fontWeight: FontWeight.w500), // 设置字体大小
-              ).onTap(() {
-                RewardsListPage.startInstance();
-              }),
-            ],
-          ).marginOnly(bottom: 15),
-          Row(
-              crossAxisAlignment: CrossAxisAlignment.center,
-              mainAxisAlignment: MainAxisAlignment.spaceBetween,
-              children: List.generate(2, (index) {
-                double hg = 70;
-                return Container(
-                    width: MediaQuery.of(context).size.width / 2 - 25,
-                    height: 185,
-                    decoration: const BoxDecoration(
-                      color: Colors.white,
-                      borderRadius: BorderRadius.all(Radius.circular(6.0)),
-                      boxShadow: [
-                        BoxShadow(
-                            color: Color.fromRGBO(184, 191, 217, 0.3),
-                            blurRadius: 6)
-                      ],
+  Widget _buildRecommend(BuildContext context, WidgetRef ref, _vm, list) {
+    return list['rewards'].length > 0
+        ? Container(
+            child: Column(
+              children: [
+                Row(
+                  crossAxisAlignment: CrossAxisAlignment.center,
+                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
+                  children: [
+                    Text(
+                      list?['name'] ?? '',
+                      style: TextStyle(
+                          fontSize: 17.0,
+                          color: ColorUtils.string2Color('#000001'),
+                          fontWeight: FontWeight.w500), // 设置字体大小
                     ),
-                    child: _buildItem(context, ref, _vm, hg));
-              }))
-        ],
-      ),
-    ).paddingOnly(left: 15, right: 15, top: 10);
+                    Text(
+                      'See All',
+                      style: TextStyle(
+                          fontSize: 17.0,
+                          color: ColorUtils.string2Color('#4161D0'),
+                          fontWeight: FontWeight.w500), // 设置字体大小
+                    ).onTap(() {
+                      RewardsListPage.startInstance();
+                    }),
+                  ],
+                ).marginOnly(bottom: 15),
+                Row(
+                    crossAxisAlignment: CrossAxisAlignment.center,
+                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
+                    children: List.generate(list['rewards'].length, (index) {
+                      double hg = 70;
+                      return Container(
+                          width: MediaQuery.of(context).size.width / 2 - 25,
+                          height: 155,
+                          decoration: const BoxDecoration(
+                            color: Colors.white,
+                            borderRadius:
+                                BorderRadius.all(Radius.circular(6.0)),
+                            boxShadow: [
+                              BoxShadow(
+                                  color: Color.fromRGBO(184, 191, 217, 0.3),
+                                  blurRadius: 6)
+                            ],
+                          ),
+                          child: _buildItem(
+                              context, ref, _vm, hg, list['rewards'][index]));
+                    }))
+              ],
+            ),
+          ).paddingOnly(left: 15, right: 15, top: 10)
+        : Container();
   }
 
   Widget _buildHottest(BuildContext context, WidgetRef ref, _vm) {
@@ -298,54 +312,48 @@ class RewardsHomePage extends HookConsumerWidget {
                             blurRadius: 6)
                       ],
                     ),
-                    child: _buildItem(context, ref, _vm, hg));
+                    child: _buildItem(context, ref, _vm, hg, {}));
               }))
         ],
       ),
     ).paddingOnly(left: 15, right: 15, top: 10);
   }
 
-  Widget _buildItem(BuildContext context, WidgetRef ref, _vm, height) {
+  Widget _buildItem(BuildContext context, WidgetRef ref, _vm, height, item) {
     double hg = height;
+    num point = item['point'] ?? 0;
+    num originalPoint = item['original_point'] ?? 0;
+    int id = item['id'];
     return Column(
       children: [
-        MyAssetImage(
-          Assets.rewardsRewardsIndex1,
-          // width: 110,
+        MyLoadImage(
+          item?['resources']?[0] ?? '',
+          width: MediaQuery.of(context).size.width,
           height: hg,
         ),
         Column(
           crossAxisAlignment: CrossAxisAlignment.start,
           children: [
-            const Text(
+            Text(
               maxLines: 2, // 设置最大行数为2
               overflow: TextOverflow.ellipsis, // 超出部分用省略号表示
-              'Cute children multifunctional ……',
-              style: TextStyle(
+              item?['name'] ?? '',
+              style: const TextStyle(
                   fontSize: 15.0,
                   color: Colors.black,
                   fontWeight: FontWeight.w500),
-            ),
-            Text(
-              maxLines: 1, // 设置最大行数为2
-              overflow: TextOverflow.ellipsis, // 超出部分用省略号表示
-              'Hong Ye Group Co., Ltd',
-              style: TextStyle(
-                  fontSize: 13.0,
-                  color: ColorUtils.string2Color('#808DAF'),
-                  fontWeight: FontWeight.w400),
             ).marginOnly(bottom: 5),
             Row(
               children: [
-                const Text(
-                  '300',
-                  style: TextStyle(
+                Text(
+                  '$point',
+                  style: const TextStyle(
                       fontSize: 18.0,
                       color: Colors.black,
                       fontWeight: FontWeight.w500),
                 ),
                 Text(
-                  '350',
+                  '$originalPoint',
                   style: TextStyle(
                       decoration: TextDecoration.lineThrough,
                       decorationColor: ColorUtils.string2Color('#808DAF'),
@@ -367,136 +375,163 @@ class RewardsHomePage extends HookConsumerWidget {
         ).paddingOnly(top: 12, left: 12, right: 12)
       ],
     ).onTap(() {
-      RewardsDetailPage.startInstance();
+      RewardsDetailPage.startInstance(id: id);
     });
   }
 
-  Widget _buildFood(BuildContext context, WidgetRef ref, _vm) {
-    return Container(
-      child: Column(
-        children: [
-          Row(
-            crossAxisAlignment: CrossAxisAlignment.center,
-            mainAxisAlignment: MainAxisAlignment.spaceBetween,
-            children: [
-              Text(
-                'Food & Beverage',
-                style: TextStyle(
-                    fontSize: 17.0,
-                    color: ColorUtils.string2Color('#000001'),
-                    fontWeight: FontWeight.w500), // 设置字体大小
-              ),
-              Text(
-                'See All',
-                style: TextStyle(
-                    fontSize: 17.0,
-                    color: ColorUtils.string2Color('#4161D0'),
-                    fontWeight: FontWeight.w500), // 设置字体大小
-              ).onTap(() {
-                RewardsListPage.startInstance();
-              }),
-            ],
-          ).marginOnly(bottom: 15),
-          Row(
-              crossAxisAlignment: CrossAxisAlignment.center,
-              mainAxisAlignment: MainAxisAlignment.spaceBetween,
-              children: List.generate(2, (index) {
-                double hg = 70;
-                return Container(
-                    width: MediaQuery.of(context).size.width / 2 - 25,
-                    height: 185,
-                    decoration: const BoxDecoration(
-                      color: Colors.white,
-                      borderRadius: BorderRadius.all(Radius.circular(6.0)),
-                      boxShadow: [
-                        BoxShadow(
-                            color: Color.fromRGBO(184, 191, 217, 0.3),
-                            blurRadius: 6)
-                      ],
+  Widget _buildFood(BuildContext context, WidgetRef ref, _vm, list) {
+    return list['rewards'].length > 0
+        ? Container(
+            child: Column(
+              children: [
+                Row(
+                  crossAxisAlignment: CrossAxisAlignment.center,
+                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
+                  children: [
+                    Text(
+                      list?['name'] ?? '',
+                      style: TextStyle(
+                          fontSize: 17.0,
+                          color: ColorUtils.string2Color('#000001'),
+                          fontWeight: FontWeight.w500), // 设置字体大小
                     ),
-                    child: _buildItem(context, ref, _vm, hg));
-              }))
-        ],
-      ),
-    ).paddingOnly(left: 15, right: 15, top: 10);
+                    Text(
+                      'See All',
+                      style: TextStyle(
+                          fontSize: 17.0,
+                          color: ColorUtils.string2Color('#4161D0'),
+                          fontWeight: FontWeight.w500), // 设置字体大小
+                    ).onTap(() {
+                      RewardsListPage.startInstance();
+                    }),
+                  ],
+                ).marginOnly(bottom: 15),
+                Row(
+                    crossAxisAlignment: CrossAxisAlignment.center,
+                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
+                    children: List.generate(2, (index) {
+                      double hg = 70;
+                      return Container(
+                          width: MediaQuery.of(context).size.width / 2 - 25,
+                          height: 185,
+                          decoration: const BoxDecoration(
+                            color: Colors.white,
+                            borderRadius:
+                                BorderRadius.all(Radius.circular(6.0)),
+                            boxShadow: [
+                              BoxShadow(
+                                  color: Color.fromRGBO(184, 191, 217, 0.3),
+                                  blurRadius: 6)
+                            ],
+                          ),
+                          child: _buildItem(
+                              context, ref, _vm, hg, list['rewards'][index]));
+                    }))
+              ],
+            ),
+          ).paddingOnly(left: 15, right: 15, top: 10)
+        : Container();
   }
 
-  Widget _buildBest(BuildContext context, WidgetRef ref, _vm) {
-    return Container(
-      child: Column(
-        children: [
-          Row(
-            crossAxisAlignment: CrossAxisAlignment.center,
-            mainAxisAlignment: MainAxisAlignment.spaceBetween,
-            children: [
-              Text(
-                'Best Offers in Singapore',
-                style: TextStyle(
-                    fontSize: 17.0,
-                    color: ColorUtils.string2Color('#000001'),
-                    fontWeight: FontWeight.w500), // 设置字体大小
-              ),
-              Text(
-                'See All',
-                style: TextStyle(
-                    fontSize: 17.0,
-                    color: ColorUtils.string2Color('#4161D0'),
-                    fontWeight: FontWeight.w500), // 设置字体大小
-              ),
-            ],
-          ).marginOnly(bottom: 15),
-          Column(
-              crossAxisAlignment: CrossAxisAlignment.center,
-              mainAxisAlignment: MainAxisAlignment.spaceBetween,
-              children: List.generate(2, (index) {
-                double hg = 140;
-                return Container(
-                        // width: MediaQuery.of(context).size.width / 2 - 25,
-                        height: 240,
-                        decoration: const BoxDecoration(
-                          color: Colors.white,
-                          borderRadius: BorderRadius.all(Radius.circular(6.0)),
-                          boxShadow: [
-                            BoxShadow(
-                                color: Color.fromRGBO(184, 191, 217, 0.3),
-                                blurRadius: 6)
-                          ],
-                        ),
-                        child: _buildItem(context, ref, _vm, hg))
-                    .marginOnly(bottom: 13);
-              }))
-        ],
-      ),
-    ).paddingOnly(left: 15, right: 15, top: 10);
+  Widget _buildBest(BuildContext context, WidgetRef ref, _vm, list) {
+    return list['rewards'].length > 0
+        ? Container(
+            child: Column(
+              children: [
+                Row(
+                  crossAxisAlignment: CrossAxisAlignment.center,
+                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
+                  children: [
+                    Text(
+                      'Best Offers in Singapore',
+                      style: TextStyle(
+                          fontSize: 17.0,
+                          color: ColorUtils.string2Color('#000001'),
+                          fontWeight: FontWeight.w500), // 设置字体大小
+                    ),
+                    Text(
+                      'See All',
+                      style: TextStyle(
+                          fontSize: 17.0,
+                          color: ColorUtils.string2Color('#4161D0'),
+                          fontWeight: FontWeight.w500), // 设置字体大小
+                    ),
+                  ],
+                ).marginOnly(bottom: 15),
+                Column(
+                    crossAxisAlignment: CrossAxisAlignment.center,
+                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
+                    children: List.generate(2, (index) {
+                      double hg = 140;
+                      return Container(
+                              // width: MediaQuery.of(context).size.width / 2 - 25,
+                              height: 220,
+                              decoration: const BoxDecoration(
+                                color: Colors.white,
+                                borderRadius:
+                                    BorderRadius.all(Radius.circular(6.0)),
+                                boxShadow: [
+                                  BoxShadow(
+                                      color: Color.fromRGBO(184, 191, 217, 0.3),
+                                      blurRadius: 6)
+                                ],
+                              ),
+                              child: _buildItem(context, ref, _vm, hg,
+                                  list['rewards'][index]))
+                          .marginOnly(bottom: 13);
+                    }))
+              ],
+            ),
+          ).paddingOnly(left: 15, right: 15, top: 10)
+        : Container();
   }
 
   @override
   Widget build(BuildContext context, WidgetRef ref) {
-    final _vm = ref.read(rewardsVmProvider.notifier);
-
+    final _vm = ref.read(rewardsHomeVmProvider.notifier);
+    final state = ref.watch(rewardsHomeVmProvider);
+    useEffect(() {
+      // 组件挂载时执行 - 执行接口请求
+      Future.microtask(() => _vm.initPageData());
+      return () {
+        // 组件卸载时执行s
+        Log.d("property_news_page 组件卸载时执行");
+      };
+    }, []);
     return Scaffold(
       // appBar: AppBar(title: Text("奖励")),
       body: Column(children: [
         Expanded(
-          child: SingleChildScrollView(
+            child: LoadStateLayout(
+          state: state.loadingState,
+          errorMessage: state.errorMessage,
+          errorRetry: () {
+            _vm.retryRequest();
+          },
+          successWidget: SingleChildScrollView(
               scrollDirection: Axis.vertical,
               physics: const BouncingScrollPhysics(),
               clipBehavior: Clip.none,
-              child: Column(
-                children: [
-                  _buildTop(context, ref, _vm),
-                  Container(
-                    transform: Matrix4.translationValues(0.0, -25.0, 0.0),
-                    child: _buildSearch(context, ref, _vm), // 使用负数margin
-                  ).paddingOnly(left: 15, right: 15),
-                  _buildSwiper(context, ref, _vm),
-                  _buildRecommend(context, ref, _vm).marginOnly(bottom: 15),
-                  _buildHottest(context, ref, _vm).marginOnly(bottom: 15),
-                  _buildFood(context, ref, _vm).marginOnly(bottom: 15),
-                  _buildBest(context, ref, _vm).marginOnly(bottom: 15),
-                ],
-              )),
-        ),
+              child: state.list.length > 0
+                  ? Column(
+                      children: [
+                        _buildTop(context, ref, _vm),
+                        Container(
+                          transform: Matrix4.translationValues(0.0, -25.0, 0.0),
+                          child: _buildSearch(context, ref, _vm), // 使用负数margin
+                        ).paddingOnly(left: 15, right: 15),
+                        _buildSwiper(context, ref, _vm),
+                        _buildRecommend(context, ref, _vm, state.list![0])
+                            .marginOnly(bottom: 15),
+                        // _buildHottest(context, ref, _vm).marginOnly(bottom: 15),
+                        _buildFood(context, ref, _vm, state.list![2])
+                            .marginOnly(bottom: 15),
+                        _buildBest(context, ref, _vm, state.list![1])
+                            .marginOnly(bottom: 15),
+                      ],
+                    )
+                  : const Column()),
+        )),
       ]).backgroundColor(ColorUtils.string2Color('#F2F3F6')),
     );
   }

+ 22 - 16
packages/cpt_rewards/lib/modules/rewards_home/rewards_home_repository.dart

@@ -1,9 +1,15 @@
 import 'package:domain/constants/api_constants.dart';
+import 'package:domain/entity/rewards_home_entity.dart';
+import 'package:domain/entity/rewards_home_tes_entity.dart';
+import 'package:domain/entity/rewards_home_test_entity.dart';
+import 'package:domain/entity/rewards_home_tx_entity.dart';
 import 'package:domain/entity/server_time.dart';
+import 'package:domain/entity/text_kon_entity.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,18 +33,13 @@ class RewardsHomeRepository {
   RewardsHomeRepository({required this.dioEngine});
 
   Future<HttpResult<Object>> fetchPropertyNewsList(
-      Map<String, dynamic>? data, {
-        CancelToken? cancelToken,
-      }) async {
+    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";
@@ -46,25 +47,30 @@ class RewardsHomeRepository {
 
     final result = await dioEngine.requestNetResult(
       // ApiConstants.apiServerTime, // api 地址
-      '/index.php/api/employee/extra/time', // api 地址
+      '/api/v1/user/reward/reward/home', // api 地址
       params: params,
       headers: headers,
       method: HttpMethod.GET,
-      isShowLoadingDialog: true,  //是否展示默认的Loading弹窗
-      networkDebounce: true,   //是否防抖防止重复请求
+      isShowLoadingDialog: false, //是否展示默认的Loading弹窗
+      networkDebounce: true, //是否防抖防止重复请求
       cancelToken: cancelToken,
     );
 
+    Log.d("------请求返回的result--$result--------");
     //根据返回的结果,封装原始数据为Bean/Entity对象
     if (result.isSuccess) {
       //重新赋值data或list
-      final json = result.getDataJson();
-      var data = RewardsHomeState.fromJson(json!);
+      // result.setList(result.getListJson());
+      final json = result.getListJson();
+      Log.d("------json--$json--------");
+      List<RewardsHomeTxEntity> data =
+          json?.map((item) => RewardsHomeTxEntity.fromJson(item)).toList() ??
+              [];
+      // var data = RewardsHomeTesEntity.fromJson(json);
+      Log.d("------data--$data--------");
       //重新赋值data或list
-      return result.convert<RewardsHomeState>(data: data);
+      return result.convert(list: data);
     }
     return result.convert();
   }
-
-
 }

+ 38 - 34
packages/cpt_rewards/lib/modules/rewards_home/rewards_home_state.dart

@@ -2,56 +2,60 @@
 
 import 'dart:convert';
 
-RewardsHomeState rewardsHomeStateFromJson(String str) =>
-    RewardsHomeState.fromJson(json.decode(str));
+import 'package:domain/entity/rewards_home_entity.dart';
+import 'package:widgets/load_state_layout.dart';
+
+// RewardsHomeState rewardsHomeStateFromJson(String str) =>
+//     RewardsHomeState.fromJson(json.decode(str));
 
 String rewardsHomeStateToJson(RewardsHomeState data) =>
     json.encode(data.toJson());
 
 class RewardsHomeState {
+  //页面 LoadView 状态的展示
+  LoadState loadingState;
+  String? errorMessage;
+  List<Map<String, dynamic>> list;
+  List<Map<String, dynamic>> lists;
   RewardsHomeState({
-    required this.curPage,
-    required this.pageSize,
+    this.loadingState = LoadState.State_Loading,
+    String? errorMessage,
     required this.list,
-    required this.filterCount,
     required this.lists,
   });
 
-  int curPage;
-  int pageSize;
-  List<Map<String, dynamic>> list;
-  int filterCount;
-  List<Map<String, dynamic>> lists;
+  RewardsHomeState copyWith(
+      {LoadState? loadingState,
+      String? errorMessage,
+      List<Map<String, dynamic>>? list,
+      List<Map<String, dynamic>>? lists}) {
+    return RewardsHomeState(
+      loadingState: loadingState ?? this.loadingState,
+      errorMessage: errorMessage ?? this.errorMessage,
+      list: list ?? this.list,
+      lists: lists ?? this.lists,
+    );
+  }
 
-  factory RewardsHomeState.fromJson(Map<dynamic, dynamic> json) =>
-      RewardsHomeState(
-        curPage: json["curPage"],
-        pageSize: json["pageSize"],
-        list: List<Map<String, dynamic>>.from(json["list"].map((x) => x)),
-        filterCount: json["filterCount"],
-        lists: List<Map<String, dynamic>>.from(json["lists"].map((x) => x)),
-      );
+  Map<String, dynamic> toMap() {
+    return {
+      'list': List<dynamic>.from(lists.map((x) => x)),
+      "lists": List<dynamic>.from(lists.map((x) => x)),
+    };
+  }
 
   Map<dynamic, dynamic> toJson() => {
-        "curPage": curPage,
-        "pageSize": pageSize,
-        "list": List<dynamic>.from(list.map((x) => x)),
-        "filterCount": filterCount,
         "lists": List<dynamic>.from(lists.map((x) => x)),
       };
-  RewardsHomeState copyWith({
-    int? curPage,
-    int? pageSize,
-    List<Map<String, dynamic>>? list,
-    int? filterCount,
-    List<Map<String, dynamic>>? lists,
-  }) {
+  factory RewardsHomeState.fromJson(Map<dynamic, dynamic> json, dynamic map) =>
+      RewardsHomeState(
+        lists: List<Map<String, dynamic>>.from(json["lists"].map((x) => x)),
+        list: List<Map<String, dynamic>>.from(json["lists"].map((x) => x)),
+      );
+  factory RewardsHomeState.fromMap(Map<String, dynamic> map, dynamic json) {
     return RewardsHomeState(
-      curPage: curPage ?? this.curPage,
-      pageSize: pageSize ?? this.pageSize,
-      list: list ?? this.list,
-      filterCount: filterCount ?? this.filterCount,
-      lists: list ?? this.lists,
+      list: List<Map<String, dynamic>>.from(json["lists"].map((x) => x)),
+      lists: List<Map<String, dynamic>>.from(json["lists"].map((x) => x)),
     );
   }
 }

+ 58 - 44
packages/cpt_rewards/lib/modules/rewards_home/rewards_home_vm.dart

@@ -1,10 +1,16 @@
 import 'package:cs_resources/generated/assets.dart';
+import 'package:domain/entity/rewards_home_entity.dart';
+import 'package:domain/entity/rewards_home_tx_entity.dart';
+import 'package:domain/entity/rewards_list_entity.dart';
+import 'package:domain/entity/text_kon_entity.dart';
 import 'package:flutter/material.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:plugin_platform/engine/toast/toast_engine.dart';
+import 'package:widgets/load_state_layout.dart';
 import 'package:widgets/picker/option_pick_util.dart';
+import 'package:widgets/widget_export.dart';
 import './rewards_home_state.dart';
 import './rewards_home_repository.dart';
 part 'rewards_home_vm.g.dart';
@@ -12,24 +18,16 @@ part 'rewards_home_vm.g.dart';
 @riverpod
 class RewardsHomeVm extends _$RewardsHomeVm {
   late RewardsHomeRepository rewardsHomeRepository;
+  bool _needShowPlaceholder = false; //是否展示LoadingView
+
+  // Refresh 控制器
+  final EasyRefreshController refreshController = EasyRefreshController(
+    controlFinishRefresh: true, //允许刷新
+    controlFinishLoad: true, //允许加载
+  );
   RewardsHomeState initState() {
     return RewardsHomeState(
-      curPage: 1,
-      pageSize: 10,
-      list: [
-        {
-          "id": 1,
-          "title":
-              "The community will hold the activity of making Zongzi on the Loong Boat ……",
-          "price": "Monday 14 0ct 2024, 15:00 PM~18:00PM",
-        },
-        {
-          "id": 2,
-          "title": "Community basketball competition activities",
-          "price": "Monday 14 Oct 2024, 10:19 AM",
-        },
-      ],
-      filterCount: 2,
+      list: [],
       lists: [
         {'title': 'YY', 'icon': Assets.rewardsRewardsIndex1},
         {'title': 'F&B', 'icon': Assets.rewardsRewardsIndex2},
@@ -46,10 +44,7 @@ class RewardsHomeVm extends _$RewardsHomeVm {
 
   @override
   RewardsHomeState build() {
-    // 初始化列表数据
-    // 初始化列表数据
     // 引入数据仓库
-    Log.d("----property_news_vm-----initPageData");
     rewardsHomeRepository = ref.read(rewardsHomeRepositoryProvider);
     // 初始化状态
     RewardsHomeState state = initState();
@@ -60,20 +55,12 @@ class RewardsHomeVm extends _$RewardsHomeVm {
   // 初始化页面数据
   initPageData() {
     Log.d("----property_news_vm-----initPageData");
-    refreshListData();
+    getListData();
   }
 
   // 上拉加载
   Future onLoadData() async {
     Log.d("----property_news_vm-----initListData");
-    // await Future.delayed(const Duration(seconds: 2));
-    // if(state.list.length >= state.filterCount)Home{
-    //   return;
-    // }else {
-    //   int curPage = state.curPage + 1;
-    //   state = state.copyWith(curPage: curPage,);
-    //   getListData();
-    // }
     getListData();
   }
 
@@ -83,24 +70,41 @@ class RewardsHomeVm extends _$RewardsHomeVm {
     // PropertyPage.startInstance(context: context, item: item);
   }
 
+// 重试请求
+  Future retryRequest() async {
+    _needShowPlaceholder = true;
+    getListData();
+  }
+
+  //刷新页面状态
+  void changeLoadingState(LoadState loadState, String? errorMsg) {
+    state = state.copyWith(loadingState: loadState, errorMessage: errorMsg);
+  }
+
+  void changeList(List<Map<String, dynamic>> lis) {
+    state = state.copyWith(list: lis);
+  }
+
   // 获取list 列表数据
   void getListData<T>() async {
     Log.d("加载listData数据---------------start-----");
     try {
       //请求网络
-      Map<String, dynamic> params = {
-        "curPage": state.curPage,
-        "pageSize": state.pageSize,
-      };
+      Map<String, dynamic> params = {};
       Log.d("请求参数------$params");
       final result = await rewardsHomeRepository.fetchPropertyNewsList(params);
-      Log.d("请求完成结果------${result.data}");
+      Log.d("请求完成结果------${result.list}");
       //校验成功失败
       if (result.isSuccess) {
-        // state = state.copyWith(serverTime: result.data);
-        state = state;
+        handlerResultList((result.list as List<RewardsListEntity>));
+        // state.list.addAll(result.list?.toList());
+        // final lis = result.getListJson();
+        // state =
+        // state.copyWith(list: result.list);
         ToastEngine.show("获取数据成功");
       } else {
+        String errorMessage = result.errorMsg!;
+        changeLoadingState(LoadState.State_Error, errorMessage);
         ToastEngine.show(result.errorMsg ?? "Network Load Error");
       }
     } catch (e) {
@@ -108,15 +112,25 @@ class RewardsHomeVm extends _$RewardsHomeVm {
     }
   }
 
-  // 下拉刷新
-  Future refreshListData() async {
-    Log.d("----property_news_vm-----refreshListData ");
+  void handlerResultList(List<RewardsListEntity>? list) {
+    if (list != null) {
+      //有数据,判断是刷新还是加载更多的数据
+      //刷新的方式
+      state.list.clear();
+      state.list.addAll(list.map((item) => item.toJson()).toList());
+      Log.d("请state.list------${state.list}");
+      changeLoadingState(LoadState.State_Success, null);
+    }
+  }
+  // // 下拉刷新
+  // Future refreshListData() async {
+  //   Log.d("----property_news_vm-----refreshListData ");
 
-    // await Future.delayed(const Duration(seconds: 2));
+  //   // await Future.delayed(const Duration(seconds: 2));
 
-    state = state.copyWith(curPage: 1, pageSize: 10);
-    // ref.invalidateSelf();
-    // ref.invalidate(propertyNewsVmProvider);
-    getListData();
-  }
+  //   state = state.copyWith(curPage: 1, pageSize: 10);
+  //   // ref.invalidateSelf();
+  //   // ref.invalidate(propertyNewsVmProvider);
+  //   getListData();
+  // }
 }

+ 1 - 1
packages/cpt_rewards/lib/modules/rewards_home/rewards_home_vm.g.dart

@@ -10,7 +10,7 @@ String _$rewardsHomeVmHash() => r'e773ac50dffaf8bb4d820118ee89a83aed303a76';
 
 /// See also [RewardsHomeVm].
 @ProviderFor(RewardsHomeVm)
-final rewardsVmProvider =
+final rewardsHomeVmProvider =
     AutoDisposeNotifierProvider<RewardsHomeVm, RewardsHomeState>.internal(
   RewardsHomeVm.new,
   name: r'rewardsHomeVmProvider',

+ 27 - 133
packages/cpt_rewards/lib/modules/rewards_list/dialog/reward_listfilter_all_dialog.dart

@@ -18,42 +18,16 @@ class RewardsListfilterAllDialo extends HookConsumerWidget {
     required this.confirmAction,
   });
 
-  Widget CheckboxList(BuildContext context) {
+  Widget CheckboxList(BuildContext context, ref, _vm) {
+    final state = ref.watch(rewardsListVmProvider);
+    List itemsList = state.categoryList;
     return Column(
       children: [
         Column(
-          children: [
-            Container(
-                height: 45,
-                decoration: BoxDecoration(
-                    border: Border(
-                        bottom: BorderSide(
-                  width: 1.0, // 底边边框的宽度
-                  color: ColorUtils.string2Color('#F2F3F6'), // 底边边框的颜色
-                ))),
-                child: Row(
-                  crossAxisAlignment: CrossAxisAlignment.center,
-                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
-                  children: [
-                    Row(
-                      children: [
-                        Text(
-                          'Latest',
-                          style: TextStyle(
-                              fontSize: 16.0,
-                              color: ColorUtils.string2Color('#000000'),
-                              fontWeight: FontWeight.w400),
-                        ),
-                      ],
-                    ),
-                    const MyAssetImage(
-                      Assets.rewardsRewardsIconDomn,
-                      width: 17,
-                      height: 17,
-                    )
-                  ],
-                )),
-            Container(
+            children: List.generate(
+          itemsList.length,
+          (index) {
+            return Container(
                 height: 45,
                 decoration: BoxDecoration(
                     border: Border(
@@ -68,83 +42,30 @@ class RewardsListfilterAllDialo extends HookConsumerWidget {
                     Row(
                       children: [
                         Text(
-                          'Latest',
+                          itemsList[index]['name'],
                           style: TextStyle(
                               fontSize: 16.0,
-                              color: ColorUtils.string2Color('#000000'),
+                              color: itemsList[index]['id'] == state.category_id
+                                  ? ColorUtils.string2Color('#FF5E75')
+                                  : ColorUtils.string2Color('#000000'),
                               fontWeight: FontWeight.w400),
                         ),
                       ],
                     ),
-                    const MyAssetImage(
-                      Assets.rewardsRewardsIconDomn,
-                      width: 17,
-                      height: 17,
-                    )
+                    itemsList[index]['id'] == state.category_id
+                        ? const MyAssetImage(
+                            Assets.rewardsRewardListChoose,
+                            width: 17,
+                            height: 17,
+                          )
+                        : Container()
                   ],
-                )),
-            Container(
-                height: 45,
-                decoration: BoxDecoration(
-                    border: Border(
-                        bottom: BorderSide(
-                  width: 1.0, // 底边边框的宽度
-                  color: ColorUtils.string2Color('#F2F3F6'), // 底边边框的颜色
-                ))),
-                child: Row(
-                  crossAxisAlignment: CrossAxisAlignment.center,
-                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
-                  children: [
-                    Row(
-                      children: [
-                        Text(
-                          'Latest',
-                          style: TextStyle(
-                              fontSize: 16.0,
-                              color: ColorUtils.string2Color('#000000'),
-                              fontWeight: FontWeight.w400),
-                        ),
-                      ],
-                    ),
-                    const MyAssetImage(
-                      Assets.rewardsRewardsIconDomn,
-                      width: 17,
-                      height: 17,
-                    )
-                  ],
-                )),
-            Container(
-                height: 45,
-                decoration: BoxDecoration(
-                    border: Border(
-                        bottom: BorderSide(
-                  width: 1.0, // 底边边框的宽度
-                  color: ColorUtils.string2Color('#F2F3F6'), // 底边边框的颜色
-                ))),
-                child: Row(
-                  crossAxisAlignment: CrossAxisAlignment.center,
-                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
-                  children: [
-                    Row(
-                      children: [
-                        Text(
-                          'Latest',
-                          style: TextStyle(
-                              fontSize: 16.0,
-                              color: ColorUtils.string2Color('#000000'),
-                              fontWeight: FontWeight.w400),
-                        ),
-                      ],
-                    ),
-                    const MyAssetImage(
-                      Assets.rewardsRewardsIconDomn,
-                      width: 17,
-                      height: 17,
-                    )
-                  ],
-                )),
-          ],
-        ).paddingOnly(left: 15, right: 15),
+                )).onTap(() {
+              _vm.categoryClick(itemsList[index]);
+              onCancel();
+            });
+          },
+        )).paddingOnly(left: 15, right: 15),
       ],
     );
   }
@@ -152,8 +73,7 @@ class RewardsListfilterAllDialo extends HookConsumerWidget {
   @override
   Widget build(BuildContext context, WidgetRef ref) {
     final _vm = ref.read(rewardsListVmProvider.notifier);
-    final state = ref.watch(rewardsListVmProvider);
-    List itemsList = _vm.state.list.toList();
+
     return Column(
       crossAxisAlignment: CrossAxisAlignment.start,
       mainAxisAlignment: MainAxisAlignment.start,
@@ -161,7 +81,7 @@ class RewardsListfilterAllDialo extends HookConsumerWidget {
         Container(
           transform: Matrix4.translationValues(0.0, 160.0, 0.0),
           width: double.infinity,
-          padding: const EdgeInsets.only(top: 22),
+          padding: const EdgeInsets.only(top: 12, bottom: 15),
           decoration: BoxDecoration(
             color: context.appColors.whiteSecondBG,
             boxShadow: const [
@@ -171,33 +91,7 @@ class RewardsListfilterAllDialo extends HookConsumerWidget {
           ),
           child: Column(
             children: [
-              Container(child: CheckboxList(context)),
-              Row(
-                children: [
-                  const SizedBox(width: 18),
-                  Expanded(
-                      flex: 1,
-                      child: InkWell(
-                        onTap: () async {
-                          onCancel();
-                          RewardsSuccessfulPage.startInstance();
-                          // confirmAction();
-                        },
-                        child: MyTextView(
-                          'Apply',
-                          fontSize: 16,
-                          paddingTop: 13,
-                          paddingBottom: 13,
-                          isFontMedium: true,
-                          textAlign: TextAlign.center,
-                          textColor: Colors.white,
-                          backgroundColor: context.appColors.btnBgDefault,
-                          cornerRadius: 7,
-                        ),
-                      )),
-                  const SizedBox(width: 18),
-                ],
-              ).marginOnly(bottom: 30, top: 28),
+              Container(child: CheckboxList(context, ref, _vm)),
             ],
           ),
         ),

+ 78 - 51
packages/cpt_rewards/lib/modules/rewards_list/dialog/reward_listfilter_dialog.dart

@@ -18,9 +18,12 @@ class RewardsListfilterDialo extends HookConsumerWidget {
     required this.confirmAction,
   });
 
-  Widget CheckboxList(BuildContext context) {
-    var _rangeValues = RangeValues(20.0, 80.0);
-    var isSelected = false;
+  Widget CheckboxList(BuildContext context, ref) {
+    final _vm = ref.read(rewardsListVmProvider.notifier);
+    final state = ref.watch(rewardsListVmProvider);
+    int point_min = state.point_min;
+    int point_max = state.point_max;
+    var isSelected = true;
     return Column(
       children: [
         Container(
@@ -58,26 +61,32 @@ class RewardsListfilterDialo extends HookConsumerWidget {
                     Row(
                       children: [
                         const MyAssetImage(
-                          Assets.rewardsRewardsIconDomn,
-                          width: 13,
-                          height: 16,
+                          Assets.rewardsRewardListNew,
+                          width: 16,
+                          height: 13,
                         ).marginOnly(right: 15),
                         Text(
                           'Latest',
                           style: TextStyle(
                               fontSize: 16.0,
-                              color: ColorUtils.string2Color('#000000'),
+                              color: state.sort_by == "created_at"
+                                  ? ColorUtils.string2Color('#FF5E75')
+                                  : ColorUtils.string2Color('#000000'),
                               fontWeight: FontWeight.w400),
                         ),
                       ],
                     ),
-                    const MyAssetImage(
-                      Assets.rewardsRewardsIconDomn,
-                      width: 17,
-                      height: 17,
-                    )
+                    state.sort_by == "created_at"
+                        ? const MyAssetImage(
+                            Assets.rewardsRewardListChoose,
+                            width: 17,
+                            height: 17,
+                          )
+                        : Container()
                   ],
-                )),
+                )).onTap(() {
+              _vm.sortByClick('created_at');
+            }),
             Container(
                 height: 45,
                 decoration: BoxDecoration(
@@ -93,26 +102,32 @@ class RewardsListfilterDialo extends HookConsumerWidget {
                     Row(
                       children: [
                         const MyAssetImage(
-                          Assets.rewardsRewardsIconDomn,
+                          Assets.rewardsRewardListHot,
                           width: 13,
-                          height: 16,
+                          height: 17,
                         ).marginOnly(right: 15),
                         Text(
-                          'Latest',
+                          'Popularity',
                           style: TextStyle(
                               fontSize: 16.0,
-                              color: ColorUtils.string2Color('#000000'),
+                              color: state.sort_by == "clicks_count"
+                                  ? ColorUtils.string2Color('#FF5E75')
+                                  : ColorUtils.string2Color('#000000'),
                               fontWeight: FontWeight.w400),
                         ),
                       ],
                     ),
-                    const MyAssetImage(
-                      Assets.rewardsRewardsIconDomn,
-                      width: 17,
-                      height: 17,
-                    )
+                    state.sort_by == "clicks_count"
+                        ? const MyAssetImage(
+                            Assets.rewardsRewardListChoose,
+                            width: 17,
+                            height: 17,
+                          )
+                        : Container()
                   ],
-                )),
+                )).onTap(() {
+              _vm.sortByClick('clicks_count');
+            }),
             Container(
                 height: 45,
                 decoration: BoxDecoration(
@@ -128,26 +143,32 @@ class RewardsListfilterDialo extends HookConsumerWidget {
                     Row(
                       children: [
                         const MyAssetImage(
-                          Assets.rewardsRewardsIconDomn,
-                          width: 13,
-                          height: 16,
+                          Assets.rewardsRewardListLow,
+                          width: 14,
+                          height: 17,
                         ).marginOnly(right: 15),
                         Text(
-                          'Latest',
+                          'Low to High Points',
                           style: TextStyle(
                               fontSize: 16.0,
-                              color: ColorUtils.string2Color('#000000'),
+                              color: state.sort == "asc"
+                                  ? ColorUtils.string2Color('#FF5E75')
+                                  : ColorUtils.string2Color('#000000'),
                               fontWeight: FontWeight.w400),
                         ),
                       ],
                     ),
-                    const MyAssetImage(
-                      Assets.rewardsRewardsIconDomn,
-                      width: 17,
-                      height: 17,
-                    )
+                   state.sort == "asc"
+                        ? const MyAssetImage(
+                            Assets.rewardsRewardListChoose,
+                            width: 17,
+                            height: 17,
+                          )
+                        : Container()
                   ],
-                )),
+                )).onTap(() {
+              _vm.sortClick('asc');
+            }),
             Container(
                 height: 45,
                 decoration: BoxDecoration(
@@ -163,26 +184,32 @@ class RewardsListfilterDialo extends HookConsumerWidget {
                     Row(
                       children: [
                         const MyAssetImage(
-                          Assets.rewardsRewardsIconDomn,
+                          Assets.rewardsRewardListHigh,
                           width: 13,
                           height: 16,
                         ).marginOnly(right: 15),
                         Text(
-                          'Latest',
+                          'High to Low Points',
                           style: TextStyle(
                               fontSize: 16.0,
-                              color: ColorUtils.string2Color('#000000'),
+                              color: state.sort == "desc"
+                                  ? ColorUtils.string2Color('#FF5E75')
+                                  : ColorUtils.string2Color('#000000'),
                               fontWeight: FontWeight.w400),
                         ),
                       ],
                     ),
-                    const MyAssetImage(
-                      Assets.rewardsRewardsIconDomn,
-                      width: 17,
-                      height: 17,
-                    )
+                    state.sort == "desc"
+                        ? const MyAssetImage(
+                            Assets.rewardsRewardListChoose,
+                            width: 17,
+                            height: 17,
+                          )
+                        : Container()
                   ],
-                )),
+                )).onTap(() {
+              _vm.sortClick('desc');
+            }),
           ],
         ).paddingOnly(left: 15, right: 15),
         Container(
@@ -208,7 +235,7 @@ class RewardsListfilterDialo extends HookConsumerWidget {
           mainAxisAlignment: MainAxisAlignment.start,
           children: [
             Text(
-              '0',
+              '$point_min',
               style: TextStyle(
                   fontSize: 16.0,
                   color: ColorUtils.string2Color('#000000'),
@@ -229,7 +256,7 @@ class RewardsListfilterDialo extends HookConsumerWidget {
                   fontWeight: FontWeight.w400),
             ).marginOnly(right: 3),
             Text(
-              '1200+',
+              '$point_max',
               style: TextStyle(
                   fontSize: 16.0,
                   color: ColorUtils.string2Color('#000000'),
@@ -245,12 +272,13 @@ class RewardsListfilterDialo extends HookConsumerWidget {
           ],
         ).paddingOnly(left: 15, right: 15, top: 20),
         RangeSlider(
-          values: _rangeValues, // 初始化范围
+          values: RangeValues(
+              state.point_min.toDouble(), state.point_max.toDouble()), // 初始化范围
           min: 0, // 最小值
           max: 100, // 最大值
           onChanged: (RangeValues values) {
+            _vm.rangeSliderChanged(values);
             // 处理范围改变事件
-            _rangeValues = values;
             print('Selected range: ${values.start} to ${values.end}');
           },
         ).marginOnly(top: 5),
@@ -279,7 +307,7 @@ class RewardsListfilterDialo extends HookConsumerWidget {
   Widget build(BuildContext context, WidgetRef ref) {
     final _vm = ref.read(rewardsListVmProvider.notifier);
     final state = ref.watch(rewardsListVmProvider);
-    List itemsList = _vm.state.list.toList();
+    // List itemsList = _vm.state.list.toList();
     return Column(
       crossAxisAlignment: CrossAxisAlignment.start,
       mainAxisAlignment: MainAxisAlignment.start,
@@ -297,7 +325,7 @@ class RewardsListfilterDialo extends HookConsumerWidget {
           ),
           child: Column(
             children: [
-              Container(child: CheckboxList(context)),
+              Container(child: CheckboxList(context, ref)),
               Row(
                 children: [
                   const SizedBox(width: 18),
@@ -306,8 +334,7 @@ class RewardsListfilterDialo extends HookConsumerWidget {
                       child: InkWell(
                         onTap: () async {
                           onCancel();
-                          RewardsSuccessfulPage.startInstance();
-                          // confirmAction();
+                          _vm.applyClick();
                         },
                         child: MyTextView(
                           'Apply',

+ 30 - 12
packages/cpt_rewards/lib/modules/rewards_list/rewards_list_page.dart

@@ -3,11 +3,13 @@ import 'package:cs_resources/theme/app_colors_theme.dart';
 import 'package:flutter/cupertino.dart';
 import 'package:flutter/material.dart';
 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/log_utils.dart';
 import 'package:shared/utils/color_utils.dart';
 import 'package:widgets/ext/ex_widget.dart';
+import 'package:widgets/load_state_layout.dart';
 import 'package:widgets/my_appbar.dart';
 import 'package:widgets/my_load_image.dart';
 import 'package:widgets/shatter/picker_container.dart';
@@ -180,25 +182,24 @@ class RewardsListPage extends HookConsumerWidget {
                   //     ),
                   //   ],
                   // ),
-                  const Row(
+                  Row(
                 mainAxisAlignment: MainAxisAlignment.spaceBetween,
                 crossAxisAlignment: CrossAxisAlignment.center,
                 children: [
                   Text(
-                    'All',
-                    style: TextStyle(
+                    state.category_name!,
+                    style: const TextStyle(
                         fontSize: 15.0,
                         color: Colors.black,
                         fontWeight: FontWeight.w500), // 设置字体大小
                   ),
-                  MyAssetImage(
+                  const MyAssetImage(
                     Assets.rewardsRewardsIconDomn,
                     width: 12,
                     height: 7,
                   ),
                 ],
               ).onTap(() {
-                // 去详情
                 _vm.doDeleteAccountAll(context);
               })).paddingOnly(left: 15, right: 15),
           SizedBox(
@@ -245,8 +246,16 @@ class RewardsListPage extends HookConsumerWidget {
 
   @override
   Widget build(BuildContext context, WidgetRef ref) {
-    final _vm = ref.read(rewardsListVmProvider.notifier);
+    final vm = ref.read(rewardsListVmProvider.notifier);
     final state = ref.watch(rewardsListVmProvider);
+    useEffect(() {
+      // 组件挂载时执行 - 执行接口请求
+      Future.microtask(() => vm.initPageData());
+      return () {
+        // 组件卸载时执行
+        Log.d("property_news_page 组件卸载时执行");
+      };
+    }, []);
     return Scaffold(
       appBar: MyAppBar.appBar(
         context,
@@ -256,23 +265,32 @@ class RewardsListPage extends HookConsumerWidget {
       body: Container(
         child: Column(
           children: [
-            _buildTop(context, ref, _vm),
+            _buildTop(context, ref, vm),
             Expanded(
               child: EasyRefresh(
+                controller: vm.refreshController,
                 // 上拉加载
                 onLoad: () async {
                   Log.d("----onLoad");
-                  _vm.onLoadData();
+                  vm.loadMore();
                 },
                 // 下拉刷新
                 onRefresh: () async {
                   Log.d("----onRefresh");
-                  _vm.refreshListData();
+                  vm.onRefresh();
                 },
                 child: Container(
-                    color: ColorUtils.string2Color('#F2F3F6'),
-                    padding: const EdgeInsets.only(top: 15),
-                    child: _buildSaleList(context, ref, _vm)),
+                  color: ColorUtils.string2Color('#F2F3F6'),
+                  padding: const EdgeInsets.only(top: 15),
+                  child: LoadStateLayout(
+                    state: state.loadingState,
+                    errorMessage: state.errorMessage,
+                    errorRetry: () {
+                      vm.retryRequest();
+                    },
+                    successSliverWidget: [_buildSaleList(context, ref, vm)],
+                  ),
+                ),
               ),
             )
           ],

+ 51 - 14
packages/cpt_rewards/lib/modules/rewards_list/rewards_list_repository.dart

@@ -1,9 +1,11 @@
 import 'package:domain/constants/api_constants.dart';
+import 'package:domain/entity/rewards_category_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';
@@ -26,19 +28,14 @@ class RewardsListRepository {
 
   RewardsListRepository({required this.dioEngine});
 
-  Future<HttpResult<Object>> fetchPropertyNewsList(
-      Map<String, dynamic>? data, {
-        CancelToken? cancelToken,
-      }) async {
+  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";
@@ -46,25 +43,65 @@ class RewardsListRepository {
 
     final result = await dioEngine.requestNetResult(
       // ApiConstants.apiServerTime, // api 地址
-      '/index.php/api/employee/extra/time', // api 地址
+      '/api/v1/user/reward/reward/index', // api 地址
       params: params,
       headers: headers,
       method: HttpMethod.GET,
-      isShowLoadingDialog: true,  //是否展示默认的Loading弹窗
-      networkDebounce: true,   //是否防抖防止重复请求
+      isShowLoadingDialog: false, //是否展示默认的Loading弹窗
+      networkDebounce: true, //是否防抖防止重复请求
       cancelToken: cancelToken,
     );
 
+    Log.d("------请求返回的result--$result--------");
     //根据返回的结果,封装原始数据为Bean/Entity对象
     if (result.isSuccess) {
       //重新赋值data或list
       final json = result.getDataJson();
-      var data = RewardsListState.fromJson(json!);
+      // var data = RewardsHistoryEarnedEntity.fromJson(json!);
       //重新赋值data或list
-      return result.convert<RewardsListState>(data: data);
+      // return result.convert<RewardsHistoryEarnedEntity>(data: data);
     }
     return result.convert();
   }
 
+  Future<HttpResult<Object>> fetchCategory(
+    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/reward/category/index', // api 地址
+      params: params,
+      headers: headers,
+      method: HttpMethod.GET,
+      isShowLoadingDialog: false, //是否展示默认的Loading弹窗
+      networkDebounce: true, //是否防抖防止重复请求
+      cancelToken: cancelToken,
+    );
+
+    Log.d("------请求返回的result--$result--------");
+    //根据返回的结果,封装原始数据为Bean/Entity对象
+    if (result.isSuccess) {
+      //重新赋值data或list
+      final json = result.getListJson();
+      Log.d("------json--$json--------");
+      List<RewardsCategoryEntity> data =
+          json?.map((item) => RewardsCategoryEntity.fromJson(item)).toList() ??
+              [];
+      // var data = RewardsHomeTesEntity.fromJson(json);
+      Log.d("------data--$data--------");
+      //重新赋值data或list
+      return result.convert(list: data);
+    }
+    return result.convert();
+  }
 }

+ 78 - 37
packages/cpt_rewards/lib/modules/rewards_list/rewards_list_state.dart

@@ -2,54 +2,95 @@
 
 import 'dart:convert';
 
-RewardsListState rewardsListStateFromJson(String str) => RewardsListState.fromJson(json.decode(str));
-
-String rewardsListStateToJson(RewardsListState data) => json.encode(data.toJson());
+import 'package:widgets/load_state_layout.dart';
 
 class RewardsListState {
-  //类型选项
-  final List<String> optionList = ["条件1", "条件2", "条件3", "条件4"];
-  String? selectedOption;
+  //页面 LoadView 状态的展示
+  LoadState loadingState;
+  String? errorMessage;
+  String? sort_by = '';
+  String? sort = '';
+  String? category_name = 'All';
+  int? page;
+  int? limit = 10;
+  int? count = 1;
+  int? category_id = 0;
+  int? point_min = 0;
+  int? point_max = 0;
+  List<Map<String, dynamic>>? list;
+  List<Map<String, dynamic>>? categoryList;
+
   RewardsListState({
-    required this.curPage,
-    required this.pageSize,
+    this.loadingState = LoadState.State_Loading,
+    String? errorMessage,
+    this.sort_by = '',
+    this.sort = '',
+    this.category_name = 'All',
+    this.page = 1,
+    this.limit = 10,
+    this.count = 1,
+    this.category_id = 0,
+    this.point_min = 0,
+    this.point_max = 0,
     required this.list,
-    required this.filterCount,
-    this.selectedOption,
+    required this.categoryList,
   });
 
-  int curPage;
-  int pageSize;
-  List<Map<String, dynamic>> list;
-  int filterCount;
-
-  factory RewardsListState.fromJson(Map<dynamic, dynamic> json) => RewardsListState(
-    curPage: json["curPage"],
-    pageSize: json["pageSize"],
-    list: List<Map<String, dynamic>>.from(json["list"].map((x) => x)),
-    filterCount: json["filterCount"],
-  );
-
-  Map<dynamic, dynamic> toJson() => {
-    "curPage": curPage,
-    "pageSize": pageSize,
-    "list": List<dynamic>.from(list.map((x) => x)),
-    "filterCount": filterCount,
-  };
-
   RewardsListState copyWith({
-    int? curPage,
-    int? pageSize,
+    LoadState? loadingState,
+    String? errorMessage,
+    String? category_name,
+    String? sort_by,
+    String? sort,
+    int? page,
+    int? limit,
+    int? count,
+    int? category_id,
+    int? point_min,
+    int? point_max,
     List<Map<String, dynamic>>? list,
-    int? filterCount,
-    String? selectedOption,
+    List<Map<String, dynamic>>? categoryList,
   }) {
     return RewardsListState(
-      curPage: curPage ?? this.curPage,
-      pageSize: pageSize ?? this.pageSize,
+      loadingState: loadingState ?? this.loadingState,
+      errorMessage: errorMessage ?? this.errorMessage,
+      category_name: category_name ?? this.category_name,
+      sort_by: sort_by ?? this.sort_by,
+      sort: sort ?? this.sort,
+      page: page ?? this.page,
+      limit: limit ?? this.limit,
+      count: count ?? this.count,
+      category_id: category_id ?? this.category_id,
+      point_min: point_min ?? this.point_min,
+      point_max: point_max ?? this.point_max,
       list: list ?? this.list,
-      filterCount: filterCount ?? this.filterCount,
-      selectedOption: selectedOption ?? this.selectedOption,
+      categoryList: list ?? this.categoryList,
+    );
+  }
+
+  Map<String, dynamic> toMap() {
+    return {
+      'page': this.page,
+      'limit': this.limit,
+      'count': this.count,
+      'category_id': this.category_id,
+      'point_min': this.point_min,
+      'point_max': this.point_max,
+      'list': this.list,
+      'categoryList': this.categoryList,
+    };
+  }
+
+  factory RewardsListState.fromMap(Map<String, dynamic> map) {
+    return RewardsListState(
+      page: map['page'] as int,
+      limit: map['limit'] as int,
+      count: map['count'] as int,
+      category_id: map['category_id'] as int,
+      point_min: map['point_min'] as int,
+      point_max: map['point_max'] as int,
+      list: map['list'] as List<Map<String, dynamic>>,
+      categoryList: map['categoryList'] as List<Map<String, dynamic>>,
     );
   }
 }

+ 161 - 54
packages/cpt_rewards/lib/modules/rewards_list/rewards_list_vm.dart

@@ -1,4 +1,6 @@
 import 'package:cpt_rewards/modules/rewards_list/dialog/reward_listfilter_all_dialog.dart';
+import 'package:domain/entity/rewards_category_entity.dart';
+import 'package:domain/entity/rewards_history_earned_entity.dart';
 import 'package:flutter/material.dart';
 import 'package:cpt_rewards/modules/rewards_list/dialog/reward_listfilter_dialog.dart';
 import 'package:plugin_platform/engine/dialog/dialog_engine.dart';
@@ -6,7 +8,9 @@ import 'package:plugin_platform/http/http_result.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/picker/option_pick_util.dart';
+import 'package:widgets/widget_export.dart';
 import './rewards_list_state.dart';
 import './rewards_list_repository.dart';
 part 'rewards_list_vm.g.dart';
@@ -14,24 +18,20 @@ part 'rewards_list_vm.g.dart';
 @riverpod
 class RewardsListVm extends _$RewardsListVm {
   late RewardsListRepository rewardsListRepository;
+  var page = 1;
+  var limit = 10;
+
+  bool _needShowPlaceholder = false; //是否展示LoadingView
+
+  // Refresh 控制器
+  final EasyRefreshController refreshController = EasyRefreshController(
+    controlFinishRefresh: true, //允许刷新
+    controlFinishLoad: true, //允许加载
+  );
   RewardsListState initState() {
     return RewardsListState(
-      curPage: 1,
-      pageSize: 10,
-      list: [
-        {
-          "id": 1,
-          "title":
-              "The community will hold the activity of making Zongzi on the Loong Boat ……",
-          "price": "Monday 14 0ct 2024, 15:00 PM~18:00PM",
-        },
-        {
-          "id": 2,
-          "title": "Community basketball competition activities",
-          "price": "Monday 14 Oct 2024, 10:19 AM",
-        },
-      ],
-      filterCount: 2,
+      list: [],
+      categoryList: [],
     );
   }
 
@@ -45,50 +45,112 @@ class RewardsListVm extends _$RewardsListVm {
     return state;
   }
 
-  // 初始化页面数据
+//刷新页面状态
+  void changeLoadingState(LoadState loadState, String? errorMsg) {
+    state = state.copyWith(loadingState: loadState, errorMessage: errorMsg);
+  }
+
+  // 初始化页面数据&0
   initPageData() {
     Log.d("----property_news_vm-----initPageData");
-    refreshListData();
+    getCategoryData();
+    onRefresh();
   }
 
-  // 上拉加载
-  Future onLoadData() async {
-    Log.d("----property_news_vm-----initListData");
+  // 上拉加载 更多
+  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 = page + 1;
+    //   state = state.copyWith(page: page,);
     //   getListData();
     // }
+    // 检查 page 是否为 null,并初始化为 1
+    page++;
+
     getListData();
   }
 
-// 去新闻详情页
-  void goNewsDetail(String item) {
-    Log.d(item);
-    // PropertyPage.startInstance(context: context, item: item);
+  // 下拉刷新
+  Future onRefresh() async {
+    Log.d("----property_news_vm-----onRefresh ");
+
+    // await Future.delayed(const Duration(seconds: 2));
+    page = 1;
+    getListData();
+  }
+
+  // 重试请求
+  Future retryRequest() async {
+    page = 1;
+    _needShowPlaceholder = true;
+    getListData();
+  }
+
+  // 获取Category数据
+  Future getCategoryData<T>() async {
+    // if (_needShowPlaceholder) {
+    //   changeLoadingState(LoadState.State_Loading, null);
+    // }
+
+    Log.d("加载listData数据---------------start--${page}---");
+    try {
+      //请求网络
+      Map<String, dynamic> params = {};
+      Log.d("请求参数------$params");
+      final result = await rewardsListRepository.fetchCategory(params);
+      //校验成功失败
+      if (result.isSuccess) {
+        handlerCategory((result.list as List<RewardsCategoryEntity>));
+      } else {
+        ToastEngine.show(result.errorMsg ?? "Network Load Error");
+      }
+    } catch (e) {
+      ToastEngine.show("Error: $e");
+    }
+  }
+
+  void handlerCategory(List<RewardsCategoryEntity>? list) {
+    if (list != null) {
+      //有数据,判断是刷新还是加载更多的数据
+      //刷新的方式
+      state.categoryList?.clear();
+      state.categoryList?.addAll(list.map((item) => item.toJson()).toList());
+      Log.d("请categoryList------${state.categoryList}");
+    }
   }
 
   // 获取list 列表数据
-  void getListData<T>() async {
-    Log.d("加载listData数据---------------start-----");
+  Future getListData<T>() async {
+    // if (_needShowPlaceholder) {
+    //   changeLoadingState(LoadState.State_Loading, null);
+    // }
+
+    Log.d("加载listData数据---------------start--${page}---");
     try {
       //请求网络
       Map<String, dynamic> params = {
-        "curPage": state.curPage,
-        "pageSize": state.pageSize,
+        "page": page,
+        "limit": limit,
+        "category_id": state.category_id == 0 ? '' : state.category_id,
+        "point_min": state.point_min,
+        "point_max": state.point_max,
+        "sort_by": state.sort_by,
+        "sort": state.sort,
       };
       Log.d("请求参数------$params");
-      final result = await rewardsListRepository.fetchPropertyNewsList(params);
-      Log.d("请求完成结果------${result.data}");
+      final result = await rewardsListRepository.fetchList(params);
       //校验成功失败
       if (result.isSuccess) {
-        // state = state.copyWith(serverTime: result.data);
-        state = state;
-        ToastEngine.show("获取数据成功");
+        handlerResultList((result.data as RewardsHistoryEarnedEntity)
+            .list
+            .cast<RewardsHistoryEarnedEntity>());
       } else {
+        String errorMessage = result.errorMsg!;
+        changeLoadingState(LoadState.State_Error, errorMessage);
         ToastEngine.show(result.errorMsg ?? "Network Load Error");
       }
     } catch (e) {
@@ -96,30 +158,74 @@ class RewardsListVm extends _$RewardsListVm {
     }
   }
 
-  // 下拉刷新
-  Future refreshListData() async {
-    Log.d("----property_news_vm-----refreshListData ");
+  void handlerResultList(List<RewardsHistoryEarnedEntity>? list) {
+    if (list != null && list.isNotEmpty) {
+      //有数据,判断是刷新还是加载更多的数据
+      if (page == 1) {
+        //刷新的方式
+        state.list!.clear();
+        state.list!.addAll(list.map((item) => item.toJson()).toList());
+        refreshController.finishRefresh();
 
-    // await Future.delayed(const Duration(seconds: 2));
+        //更新展示的状态
+        changeLoadingState(LoadState.State_Success, null);
+      } else {
+        //加载更多
+        final allList = state.list;
+        state = state.copyWith(list: allList);
+        refreshController.finishLoad();
+        // update();
+      }
+    } else {
+      if (page == 1) {
+        //展示无数据的布局
+        state.list!.clear();
+        changeLoadingState(LoadState.State_Empty, null);
+        refreshController.finishRefresh();
+      } else {
+        //展示加载完成,没有更多数据了
+        if (state.list!.length == 0) {
+          changeLoadingState(LoadState.State_Empty, null);
+        } else {
+          changeLoadingState(LoadState.State_Success, null);
+        }
+        refreshController.finishLoad(IndicatorResult.noMore);
+      }
+    }
+  }
+  void applyClick() {
+    onRefresh();
+  }
 
-    state = state.copyWith(curPage: 1, pageSize: 10);
-    // ref.invalidateSelf();
-    // ref.invalidate(propertyNewsVmProvider);
-    getListData();
+  void categoryClick(item) {
+    state =
+        state.copyWith(category_id: item['id'], category_name: item['name']);
+    _needShowPlaceholder = true;
+    onRefresh();
+    Log.d("category_id------${state.category_id}");
+    Log.d("category_name------${state.category_name}");
   }
 
-  //选择选项
-  void pickCategory() {
-    OptionPickerUtil.showCupertinoOptionPicker(
-      items: state.optionList,
-      initialSelectIndex: 0,
-      onPickerChanged: (_, index) {
-        state = state.copyWith(selectedOption: state.optionList[index]);
-      },
-    );
+  void sortByClick(star) {
+    state = state.copyWith(sort_by: star);
+    Log.d("sort_by------${state.sort_by}");
+  }
+
+  void sortClick(star) {
+    state = state.copyWith(sort: star);
+    Log.d("sort------${state.sort}");
+  }
+
+  void rangeSliderChanged(value) {
+    Log.d("category_id------$value");
+    state = state.copyWith(
+        point_min: value.start.toInt(), point_max: value.end.toInt());
+    Log.d("category_id------${state.point_min}");
+    Log.d("category_name------${state.point_max}");
   }
 
   void doDeleteAccount(context) {
+    SmartDialog.dismiss();
     DialogEngine.show(
       maskColor: Colors.transparent,
       animType: DialogAnimation.centerScale_otherSlide,
@@ -133,6 +239,7 @@ class RewardsListVm extends _$RewardsListVm {
   }
 
   void doDeleteAccountAll(context) {
+    SmartDialog.dismiss();
     DialogEngine.show(
       maskColor: Colors.transparent,
       animType: DialogAnimation.centerScale_otherSlide,

+ 39 - 18
packages/cpt_rewards/lib/modules/rewards_my/rewards_my_active/rewards_my_active_page.dart

@@ -2,11 +2,13 @@ import 'package:cpt_rewards/modules/rewards_code/rewards_code_page.dart';
 import 'package:cpt_rewards/modules/rewards_redeem/rewards_redeem_page.dart';
 import 'package:flutter/material.dart';
 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/log_utils.dart';
 import 'package:shared/utils/color_utils.dart';
 import 'package:widgets/ext/ex_widget.dart';
+import 'package:widgets/load_state_layout.dart';
 import 'package:widgets/my_load_image.dart';
 import 'package:widgets/widget_export.dart';
 import 'package:cs_resources/generated/assets.dart';
@@ -180,26 +182,45 @@ class RewardsMyActivePage extends HookConsumerWidget {
 
   @override
   Widget build(BuildContext context, WidgetRef ref) {
-    final _vm = ref.read(rewardsMyActiveVmProvider.notifier);
-
+    final vm = ref.read(rewardsMyActiveVmProvider.notifier);
+    final state = ref.watch(rewardsMyActiveVmProvider);
+    useEffect(() {
+      // 组件挂载时执行 - 执行接口请求
+      Future.microtask(() => vm.initPageData());
+      return () {
+        // 组件卸载时执行
+        Log.d("property_news_page 组件卸载时执行");
+      };
+    }, []);
     return Scaffold(
       // appBar: AppBar(title: Text("资产")),
-      body: EasyRefresh(
-        // 上拉加载
-        onLoad: () async {
-          Log.d("----onLoad");
-          _vm.onLoadData();
-        },
-        // 下拉刷新
-        onRefresh: () async {
-          Log.d("----onRefresh");
-          _vm.refreshListData();
-        },
-        child: Container(
-            color: ColorUtils.string2Color('#F2F3F6'),
-            padding: const EdgeInsets.only(top: 15),
-            child: _buildSaleList(context, ref, _vm)),
-      ),
+      body: SizedBox(
+          width: double.infinity,
+          height: double.infinity,
+          child: EasyRefresh(
+              controller: vm.refreshController,
+              // 上拉加载
+              onLoad: () async {
+                Log.d("----onLoad");
+                vm.loadMore();
+              },
+              // 下拉刷新
+              onRefresh: () async {
+                Log.d("----onRefresh");
+                vm.onRefresh();
+              },
+              child: Container(
+                color: ColorUtils.string2Color('#F2F3F6'),
+                padding: const EdgeInsets.only(top: 15),
+                child: LoadStateLayout(
+                  state: state.loadingState,
+                  errorMessage: state.errorMessage,
+                  errorRetry: () {
+                    vm.retryRequest();
+                  },
+                  successSliverWidget: [_buildSaleList(context, ref, vm)],
+                ),
+              ))),
     );
   }
 }

+ 12 - 15
packages/cpt_rewards/lib/modules/rewards_my/rewards_my_active/rewards_my_active_repository.dart

@@ -1,9 +1,11 @@
 import 'package:domain/constants/api_constants.dart';
+import 'package:domain/entity/rewards_history_earned_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';
@@ -26,19 +28,14 @@ class RewardsMyActiveRepository {
 
   RewardsMyActiveRepository({required this.dioEngine});
 
-  Future<HttpResult<Object>> fetchPropertyNewsList(
-      Map<String, dynamic>? data, {
-        CancelToken? cancelToken,
-      }) async {
+  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";
@@ -46,25 +43,25 @@ class RewardsMyActiveRepository {
 
     final result = await dioEngine.requestNetResult(
       // ApiConstants.apiServerTime, // api 地址
-      '/index.php/api/employee/extra/time', // api 地址
+      '/api/v1/user/reward/sale/index', // api 地址
       params: params,
       headers: headers,
       method: HttpMethod.GET,
-      isShowLoadingDialog: true,  //是否展示默认的Loading弹窗
-      networkDebounce: true,   //是否防抖防止重复请求
+      isShowLoadingDialog: false, //是否展示默认的Loading弹窗
+      networkDebounce: true, //是否防抖防止重复请求
       cancelToken: cancelToken,
     );
 
+    Log.d("------请求返回的result--$result--------");
     //根据返回的结果,封装原始数据为Bean/Entity对象
     if (result.isSuccess) {
       //重新赋值data或list
       final json = result.getDataJson();
-      var data = RewardsMyActiveState.fromJson(json!);
+      var data = RewardsHistoryEarnedEntity.fromJson(json!);
       //重新赋值data或list
-      return result.convert<RewardsMyActiveState>(data: data);
+      return result.convert<RewardsHistoryEarnedEntity>(data: data);
     }
     return result.convert();
   }
 
-
 }

+ 44 - 32
packages/cpt_rewards/lib/modules/rewards_my/rewards_my_active/rewards_my_active_state.dart

@@ -2,48 +2,60 @@
 
 import 'dart:convert';
 
-RewardsMyActiveState rewardsMyActiveStateFromJson(String str) => RewardsMyActiveState.fromJson(json.decode(str));
-
-String rewardsMyActiveStateToJson(RewardsMyActiveState data) => json.encode(data.toJson());
+import 'package:widgets/load_state_layout.dart';
 
 class RewardsMyActiveState {
+  //页面 LoadView 状态的展示
+  LoadState loadingState;
+  String? errorMessage;
+
+  int? page;
+  int? limit = 10;
+  int? count = 1;
+  List<Map<String, dynamic>>? list;
+
   RewardsMyActiveState({
-    required this.curPage,
-    required this.pageSize,
+    this.loadingState = LoadState.State_Loading,
+    String? errorMessage,
+    this.page = 1,
+    this.limit = 10,
+    this.count = 1,
     required this.list,
-    required this.filterCount,
   });
 
-  int curPage;
-  int pageSize;
-  List<Map<String, dynamic>> list;
-  int filterCount;
-
-  factory RewardsMyActiveState.fromJson(Map<dynamic, dynamic> json) => RewardsMyActiveState(
-    curPage: json["curPage"],
-    pageSize: json["pageSize"],
-    list: List<Map<String, dynamic>>.from(json["list"].map((x) => x)),
-    filterCount: json["filterCount"],
-  );
-
-  Map<dynamic, dynamic> toJson() => {
-    "curPage": curPage,
-    "pageSize": pageSize,
-    "list": List<dynamic>.from(list.map((x) => x)),
-    "filterCount": filterCount,
-  };
-
   RewardsMyActiveState copyWith({
-    int? curPage,
-    int? pageSize,
+    LoadState? loadingState,
+    String? errorMessage,
+    int? page,
+    int? limit,
+    int? count,
     List<Map<String, dynamic>>? list,
-    int? filterCount,
   }) {
     return RewardsMyActiveState(
-      curPage: curPage ?? this.curPage,
-      pageSize: pageSize ?? this.pageSize,
+      loadingState: loadingState ?? this.loadingState,
+      errorMessage: errorMessage ?? this.errorMessage,
+      page: page ?? this.page,
+      limit: limit ?? this.limit,
+      count: count ?? this.count,
       list: list ?? this.list,
-      filterCount: filterCount ?? this.filterCount,
     );
   }
-}
+
+  Map<String, dynamic> toMap() {
+    return {
+      'page': this.page,
+      'limit': this.limit,
+      'count': this.count,
+      'list': this.list,
+    };
+  }
+
+  factory RewardsMyActiveState.fromMap(Map<String, dynamic> map) {
+    return RewardsMyActiveState(
+      page: map['page'] as int,
+      limit: map['limit'] as int,
+      count: map['count'] as int,
+      list: map['list'] as List<Map<String, dynamic>>,
+    );
+  }
+}

+ 92 - 46
packages/cpt_rewards/lib/modules/rewards_my/rewards_my_active/rewards_my_active_vm.dart

@@ -1,7 +1,10 @@
+import 'package:domain/entity/rewards_history_earned_entity.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:plugin_platform/engine/toast/toast_engine.dart';
+import 'package:widgets/load_state_layout.dart';
+import 'package:widgets/widget_export.dart';
 import './rewards_my_active_state.dart';
 import './rewards_my_active_repository.dart';
 part 'rewards_my_active_vm.g.dart';
@@ -9,24 +12,19 @@ part 'rewards_my_active_vm.g.dart';
 @riverpod
 class RewardsMyActiveVm extends _$RewardsMyActiveVm {
   late RewardsMyActiveRepository rewardsMyActiveRepository;
+  var page = 1;
+  var limit = 10;
+
+  bool _needShowPlaceholder = false; //是否展示LoadingView
+
+  // Refresh 控制器
+  final EasyRefreshController refreshController = EasyRefreshController(
+    controlFinishRefresh: true, //允许刷新
+    controlFinishLoad: true, //允许加载
+  );
   RewardsMyActiveState initState() {
     return RewardsMyActiveState(
-      curPage: 1,
-      pageSize: 10,
-      list: [
-        {
-          "id": 1,
-          "title":
-              "The community will hold the activity of making Zongzi on the Loong Boat ……",
-          "price": "Monday 14 0ct 2024, 15:00 PM~18:00PM",
-        },
-        {
-          "id": 2,
-          "title": "Community basketball competition activities",
-          "price": "Monday 14 Oct 2024, 10:19 AM",
-        },
-      ],
-      filterCount: 2,
+      list: [],
     );
   }
 
@@ -40,50 +38,74 @@ class RewardsMyActiveVm extends _$RewardsMyActiveVm {
     return state;
   }
 
-  // 初始化页面数据
+//刷新页面状态
+  void changeLoadingState(LoadState loadState, String? errorMsg) {
+    state = state.copyWith(loadingState: loadState, errorMessage: errorMsg);
+  }
+
+  // 初始化页面数据&0
   initPageData() {
     Log.d("----property_news_vm-----initPageData");
-    refreshListData();
+    onRefresh();
   }
 
-  // 上拉加载
-  Future onLoadData() async {
-    Log.d("----property_news_vm-----initListData");
+  // 上拉加载 更多
+  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 = page + 1;
+    //   state = state.copyWith(page: page,);
     //   getListData();
     // }
+    // 检查 page 是否为 null,并初始化为 1
+    page++;
+
+    getListData();
+  }
+
+  // 下拉刷新
+  Future onRefresh() async {
+    Log.d("----property_news_vm-----onRefresh ");
+
+    // await Future.delayed(const Duration(seconds: 2));
+    page = 1;
     getListData();
   }
 
-// 去新闻详情页
-  void goNewsDetail(String item) {
-    Log.d(item);
-    // PropertyPage.startInstance(context: context, item: item);
+  // 重试请求
+  Future retryRequest() async {
+    page = 1;
+    _needShowPlaceholder = true;
+    getListData();
   }
 
   // 获取list 列表数据
-  void getListData<T>() async {
-    Log.d("加载listData数据---------------start-----");
+  Future getListData<T>() async {
+    // if (_needShowPlaceholder) {
+    //   changeLoadingState(LoadState.State_Loading, null);
+    // }
+
+    Log.d("加载listData数据---------------start--${page}---");
     try {
       //请求网络
       Map<String, dynamic> params = {
-        "curPage": state.curPage,
-        "pageSize": state.pageSize,
+        "page": page,
+        "limit": limit,
+        "list_type": 'active'
       };
       Log.d("请求参数------$params");
-      final result = await rewardsMyActiveRepository.fetchPropertyNewsList(params);
-      Log.d("请求完成结果------${result.data}");
+      final result = await rewardsMyActiveRepository.fetchList(params);
       //校验成功失败
       if (result.isSuccess) {
-        // state = state.copyWith(serverTime: result.data);
-        state = state;
-        ToastEngine.show("获取数据成功");
+        handlerResultList((result.data as RewardsHistoryEarnedEntity)
+            .list
+            .cast<RewardsHistoryEarnedEntity>());
       } else {
+        String errorMessage = result.errorMsg!;
+        changeLoadingState(LoadState.State_Error, errorMessage);
         ToastEngine.show(result.errorMsg ?? "Network Load Error");
       }
     } catch (e) {
@@ -91,15 +113,39 @@ class RewardsMyActiveVm extends _$RewardsMyActiveVm {
     }
   }
 
-  // 下拉刷新
-  Future refreshListData() async {
-    Log.d("----property_news_vm-----refreshListData ");
-
-    // await Future.delayed(const Duration(seconds: 2));
+  void handlerResultList(List<RewardsHistoryEarnedEntity>? list) {
+    if (list != null && list.isNotEmpty) {
+      //有数据,判断是刷新还是加载更多的数据
+      if (page == 1) {
+        //刷新的方式
+        state.list!.clear();
+        state.list!.addAll(list.map((item) => item.toJson()).toList());
+        refreshController.finishRefresh();
 
-    state = state.copyWith(curPage: 1, pageSize: 10);
-    // ref.invalidateSelf();
-    // ref.invalidate(propertyNewsVmProvider);
-    getListData();
+        //更新展示的状态
+        changeLoadingState(LoadState.State_Success, null);
+      } else {
+        //加载更多
+        final allList = state.list;
+        state = state.copyWith(list: allList);
+        refreshController.finishLoad();
+        // update();
+      }
+    } else {
+      if (page == 1) {
+        //展示无数据的布局
+        state.list!.clear();
+        changeLoadingState(LoadState.State_Empty, null);
+        refreshController.finishRefresh();
+      } else {
+        //展示加载完成,没有更多数据了
+        if (state.list!.length == 0) {
+          changeLoadingState(LoadState.State_Empty, null);
+        } else {
+          changeLoadingState(LoadState.State_Success, null);
+        }
+        refreshController.finishLoad(IndicatorResult.noMore);
+      }
+    }
   }
 }

+ 40 - 18
packages/cpt_rewards/lib/modules/rewards_my/rewards_my_expired/rewards_my_expired_page.dart

@@ -1,11 +1,13 @@
 import 'package:cpt_rewards/modules/rewards_transaction/rewards_transaction_page.dart';
 import 'package:flutter/material.dart';
 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/log_utils.dart';
 import 'package:shared/utils/color_utils.dart';
 import 'package:widgets/ext/ex_widget.dart';
+import 'package:widgets/load_state_layout.dart';
 import 'package:widgets/my_load_image.dart';
 import 'package:widgets/widget_export.dart';
 import 'package:cs_resources/generated/assets.dart';
@@ -159,26 +161,46 @@ class RewardsMyExpiredPage extends HookConsumerWidget {
 
   @override
   Widget build(BuildContext context, WidgetRef ref) {
-    final _vm = ref.read(rewardsMyExpiredVmProvider.notifier);
-
+    final vm = ref.read(rewardsMyExpiredVmProvider.notifier);
+    final state = ref.watch(rewardsMyExpiredVmProvider);
+    useEffect(() {
+      // 组件挂载时执行 - 执行接口请求
+      Future.microtask(() => vm.initPageData());
+      return () {
+        // 组件卸载时执行
+        Log.d("property_news_page 组件卸载时执行");
+      };
+    }, []);
     return Scaffold(
       // appBar: AppBar(title: Text("资产")),
-      body: EasyRefresh(
-        // 上拉加载
-        onLoad: () async {
-          Log.d("----onLoad");
-          _vm.onLoadData();
-        },
-        // 下拉刷新
-        onRefresh: () async {
-          Log.d("----onRefresh");
-          _vm.refreshListData();
-        },
-        child: Container(
-            color: ColorUtils.string2Color('#F2F3F6'),
-            padding: const EdgeInsets.only(top: 15),
-            child: _buildSaleList(context, ref, _vm)),
-      ),
+      body: SizedBox(
+          width: double.infinity,
+          height: double.infinity,
+          child: EasyRefresh(
+              controller: vm.refreshController,
+              // 上拉加载
+              onLoad: () async {
+                Log.d("----onLoad");
+                vm.loadMore();
+              },
+              // 下拉刷新
+              onRefresh: () async {
+                Log.d("----onRefresh");
+                vm.onRefresh();
+              },
+              child: Container(
+                color: ColorUtils.string2Color('#F2F3F6'),
+                padding: const EdgeInsets.only(top: 15),
+                child: LoadStateLayout(
+                  state: state.loadingState,
+                  errorMessage: state.errorMessage,
+                  errorRetry: () {
+                    vm.retryRequest();
+                  },
+                  successSliverWidget: [_buildSaleList(context, ref, vm)],
+                ),
+              ))),
     );
   }
 }
+

+ 12 - 17
packages/cpt_rewards/lib/modules/rewards_my/rewards_my_expired/rewards_my_expired_repository.dart

@@ -1,9 +1,11 @@
 import 'package:domain/constants/api_constants.dart';
+import 'package:domain/entity/rewards_history_earned_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';
@@ -25,20 +27,14 @@ class RewardsMyExpiredRepository {
   DioEngine dioEngine;
 
   RewardsMyExpiredRepository({required this.dioEngine});
-
-  Future<HttpResult<Object>> fetchPropertyNewsList(
-      Map<String, dynamic>? data, {
-        CancelToken? cancelToken,
-      }) async {
+  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";
@@ -46,25 +42,24 @@ class RewardsMyExpiredRepository {
 
     final result = await dioEngine.requestNetResult(
       // ApiConstants.apiServerTime, // api 地址
-      '/index.php/api/employee/extra/time', // api 地址
+      '/api/v1/user/reward/sale/index', // api 地址
       params: params,
       headers: headers,
       method: HttpMethod.GET,
-      isShowLoadingDialog: true,  //是否展示默认的Loading弹窗
-      networkDebounce: true,   //是否防抖防止重复请求
+      isShowLoadingDialog: false, //是否展示默认的Loading弹窗
+      networkDebounce: true, //是否防抖防止重复请求
       cancelToken: cancelToken,
     );
 
+    Log.d("------请求返回的result--$result--------");
     //根据返回的结果,封装原始数据为Bean/Entity对象
     if (result.isSuccess) {
       //重新赋值data或list
       final json = result.getDataJson();
-      var data = RewardsMyExpiredState.fromJson(json!);
+      var data = RewardsHistoryEarnedEntity.fromJson(json!);
       //重新赋值data或list
-      return result.convert<RewardsMyExpiredState>(data: data);
+      return result.convert<RewardsHistoryEarnedEntity>(data: data);
     }
     return result.convert();
   }
-
-
 }

+ 43 - 31
packages/cpt_rewards/lib/modules/rewards_my/rewards_my_expired/rewards_my_expired_state.dart

@@ -2,48 +2,60 @@
 
 import 'dart:convert';
 
-RewardsMyExpiredState rewardsMyExpiredStateFromJson(String str) => RewardsMyExpiredState.fromJson(json.decode(str));
-
-String rewardsMyExpiredStateToJson(RewardsMyExpiredState data) => json.encode(data.toJson());
+import 'package:widgets/load_state_layout.dart';
 
 class RewardsMyExpiredState {
+  //页面 LoadView 状态的展示
+  LoadState loadingState;
+  String? errorMessage;
+
+  int? page;
+  int? limit = 10;
+  int? count = 1;
+  List<Map<String, dynamic>>? list;
+
   RewardsMyExpiredState({
-    required this.curPage,
-    required this.pageSize,
+    this.loadingState = LoadState.State_Loading,
+    String? errorMessage,
+    this.page = 1,
+    this.limit = 10,
+    this.count = 1,
     required this.list,
-    required this.filterCount,
   });
 
-  int curPage;
-  int pageSize;
-  List<Map<String, dynamic>> list;
-  int filterCount;
-
-  factory RewardsMyExpiredState.fromJson(Map<dynamic, dynamic> json) => RewardsMyExpiredState(
-    curPage: json["curPage"],
-    pageSize: json["pageSize"],
-    list: List<Map<String, dynamic>>.from(json["list"].map((x) => x)),
-    filterCount: json["filterCount"],
-  );
-
-  Map<dynamic, dynamic> toJson() => {
-    "curPage": curPage,
-    "pageSize": pageSize,
-    "list": List<dynamic>.from(list.map((x) => x)),
-    "filterCount": filterCount,
-  };
-
   RewardsMyExpiredState copyWith({
-    int? curPage,
-    int? pageSize,
+    LoadState? loadingState,
+    String? errorMessage,
+    int? page,
+    int? limit,
+    int? count,
     List<Map<String, dynamic>>? list,
-    int? filterCount,
   }) {
     return RewardsMyExpiredState(
-      curPage: curPage ?? this.curPage,
-      pageSize: pageSize ?? this.pageSize,
+      loadingState: loadingState ?? this.loadingState,
+      errorMessage: errorMessage ?? this.errorMessage,
+      page: page ?? this.page,
+      limit: limit ?? this.limit,
+      count: count ?? this.count,
       list: list ?? this.list,
-      filterCount: filterCount ?? this.filterCount,
+    );
+  }
+
+  Map<String, dynamic> toMap() {
+    return {
+      'page': this.page,
+      'limit': this.limit,
+      'count': this.count,
+      'list': this.list,
+    };
+  }
+
+  factory RewardsMyExpiredState.fromMap(Map<String, dynamic> map) {
+    return RewardsMyExpiredState(
+      page: map['page'] as int,
+      limit: map['limit'] as int,
+      count: map['count'] as int,
+      list: map['list'] as List<Map<String, dynamic>>,
     );
   }
 }

+ 92 - 46
packages/cpt_rewards/lib/modules/rewards_my/rewards_my_expired/rewards_my_expired_vm.dart

@@ -1,7 +1,10 @@
+import 'package:domain/entity/rewards_history_earned_entity.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:plugin_platform/engine/toast/toast_engine.dart';
+import 'package:widgets/load_state_layout.dart';
+import 'package:widgets/widget_export.dart';
 import './rewards_my_expired_state.dart';
 import './rewards_my_expired_repository.dart';
 part 'rewards_my_expired_vm.g.dart';
@@ -9,24 +12,19 @@ part 'rewards_my_expired_vm.g.dart';
 @riverpod
 class RewardsMyExpiredVm extends _$RewardsMyExpiredVm {
   late RewardsMyExpiredRepository rewardsMyExpiredRepository;
+   var page = 1;
+  var limit = 10;
+
+  bool _needShowPlaceholder = false; //是否展示LoadingView
+
+  // Refresh 控制器
+  final EasyRefreshController refreshController = EasyRefreshController(
+    controlFinishRefresh: true, //允许刷新
+    controlFinishLoad: true, //允许加载
+  );
   RewardsMyExpiredState initState() {
     return RewardsMyExpiredState(
-      curPage: 1,
-      pageSize: 10,
-      list: [
-        {
-          "id": 1,
-          "title":
-              "The community will hold the activity of making Zongzi on the Loong Boat ……",
-          "price": "Monday 14 0ct 2024, 15:00 PM~18:00PM",
-        },
-        {
-          "id": 2,
-          "title": "Community basketball competition activities",
-          "price": "Monday 14 Oct 2024, 10:19 AM",
-        },
-      ],
-      filterCount: 2,
+      list: [],
     );
   }
 
@@ -40,50 +38,74 @@ class RewardsMyExpiredVm extends _$RewardsMyExpiredVm {
     return state;
   }
 
-  // 初始化页面数据
+//刷新页面状态
+  void changeLoadingState(LoadState loadState, String? errorMsg) {
+    state = state.copyWith(loadingState: loadState, errorMessage: errorMsg);
+  }
+
+  // 初始化页面数据&0
   initPageData() {
     Log.d("----property_news_vm-----initPageData");
-    refreshListData();
+    onRefresh();
   }
 
-  // 上拉加载
-  Future onLoadData() async {
-    Log.d("----property_news_vm-----initListData");
+  // 上拉加载 更多
+  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 = page + 1;
+    //   state = state.copyWith(page: page,);
     //   getListData();
     // }
+    // 检查 page 是否为 null,并初始化为 1
+    page++;
+
+    getListData();
+  }
+
+  // 下拉刷新
+  Future onRefresh() async {
+    Log.d("----property_news_vm-----onRefresh ");
+
+    // await Future.delayed(const Duration(seconds: 2));
+    page = 1;
     getListData();
   }
 
-// 去新闻详情页
-  void goNewsDetail(String item) {
-    Log.d(item);
-    // PropertyPage.startInstance(context: context, item: item);
+  // 重试请求
+  Future retryRequest() async {
+    page = 1;
+    _needShowPlaceholder = true;
+    getListData();
   }
 
   // 获取list 列表数据
-  void getListData<T>() async {
-    Log.d("加载listData数据---------------start-----");
+  Future getListData<T>() async {
+    // if (_needShowPlaceholder) {
+    //   changeLoadingState(LoadState.State_Loading, null);
+    // }
+
+    Log.d("加载listData数据---------------start--${page}---");
     try {
       //请求网络
       Map<String, dynamic> params = {
-        "curPage": state.curPage,
-        "pageSize": state.pageSize,
+        "page": page,
+        "limit": limit,
+        "list_type": 'expired'
       };
       Log.d("请求参数------$params");
-      final result = await rewardsMyExpiredRepository.fetchPropertyNewsList(params);
-      Log.d("请求完成结果------${result.data}");
+      final result = await rewardsMyExpiredRepository.fetchList(params);
       //校验成功失败
       if (result.isSuccess) {
-        // state = state.copyWith(serverTime: result.data);
-        state = state;
-        ToastEngine.show("获取数据成功");
+        handlerResultList((result.data as RewardsHistoryEarnedEntity)
+            .list
+            .cast<RewardsHistoryEarnedEntity>());
       } else {
+        String errorMessage = result.errorMsg!;
+        changeLoadingState(LoadState.State_Error, errorMessage);
         ToastEngine.show(result.errorMsg ?? "Network Load Error");
       }
     } catch (e) {
@@ -91,15 +113,39 @@ class RewardsMyExpiredVm extends _$RewardsMyExpiredVm {
     }
   }
 
-  // 下拉刷新
-  Future refreshListData() async {
-    Log.d("----property_news_vm-----refreshListData ");
-
-    // await Future.delayed(const Duration(seconds: 2));
+  void handlerResultList(List<RewardsHistoryEarnedEntity>? list) {
+    if (list != null && list.isNotEmpty) {
+      //有数据,判断是刷新还是加载更多的数据
+      if (page == 1) {
+        //刷新的方式
+        state.list!.clear();
+        state.list!.addAll(list.map((item) => item.toJson()).toList());
+        refreshController.finishRefresh();
 
-    state = state.copyWith(curPage: 1, pageSize: 10);
-    // ref.invalidateSelf();
-    // ref.invalidate(propertyNewsVmProvider);
-    getListData();
+        //更新展示的状态
+        changeLoadingState(LoadState.State_Success, null);
+      } else {
+        //加载更多
+        final allList = state.list;
+        state = state.copyWith(list: allList);
+        refreshController.finishLoad();
+        // update();
+      }
+    } else {
+      if (page == 1) {
+        //展示无数据的布局
+        state.list!.clear();
+        changeLoadingState(LoadState.State_Empty, null);
+        refreshController.finishRefresh();
+      } else {
+        //展示加载完成,没有更多数据了
+        if (state.list!.length == 0) {
+          changeLoadingState(LoadState.State_Empty, null);
+        } else {
+          changeLoadingState(LoadState.State_Success, null);
+        }
+        refreshController.finishLoad(IndicatorResult.noMore);
+      }
+    }
   }
 }

+ 39 - 18
packages/cpt_rewards/lib/modules/rewards_my/rewards_my_used/rewards_my_used_page.dart

@@ -1,11 +1,13 @@
 import 'package:cpt_rewards/modules/rewards_transaction/rewards_transaction_page.dart';
 import 'package:flutter/material.dart';
 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/log_utils.dart';
 import 'package:shared/utils/color_utils.dart';
 import 'package:widgets/ext/ex_widget.dart';
+import 'package:widgets/load_state_layout.dart';
 import 'package:widgets/my_load_image.dart';
 import 'package:widgets/widget_export.dart';
 import 'package:cs_resources/generated/assets.dart';
@@ -193,26 +195,45 @@ class RewardsMyUsedPage extends HookConsumerWidget {
 
   @override
   Widget build(BuildContext context, WidgetRef ref) {
-    final _vm = ref.read(rewardsMyUsedVmProvider.notifier);
-
+    final vm = ref.read(rewardsMyUsedVmProvider.notifier);
+    final state = ref.watch(rewardsMyUsedVmProvider);
+    useEffect(() {
+      // 组件挂载时执行 - 执行接口请求
+      Future.microtask(() => vm.initPageData());
+      return () {
+        // 组件卸载时执行
+        Log.d("property_news_page 组件卸载时执行");
+      };
+    }, []);
     return Scaffold(
       // appBar: AppBar(title: Text("资产")),
-      body: EasyRefresh(
-        // 上拉加载
-        onLoad: () async {
-          Log.d("----onLoad");
-          _vm.onLoadData();
-        },
-        // 下拉刷新
-        onRefresh: () async {
-          Log.d("----onRefresh");
-          _vm.refreshListData();
-        },
-        child: Container(
-            color: ColorUtils.string2Color('#F2F3F6'),
-            padding: const EdgeInsets.only(top: 15),
-            child: _buildSaleList(context, ref, _vm)),
-      ),
+      body: SizedBox(
+          width: double.infinity,
+          height: double.infinity,
+          child: EasyRefresh(
+              controller: vm.refreshController,
+              // 上拉加载
+              onLoad: () async {
+                Log.d("----onLoad");
+                vm.loadMore();
+              },
+              // 下拉刷新
+              onRefresh: () async {
+                Log.d("----onRefresh");
+                vm.onRefresh();
+              },
+              child: Container(
+                color: ColorUtils.string2Color('#F2F3F6'),
+                padding: const EdgeInsets.only(top: 15),
+                child: LoadStateLayout(
+                  state: state.loadingState,
+                  errorMessage: state.errorMessage,
+                  errorRetry: () {
+                    vm.retryRequest();
+                  },
+                  successSliverWidget: [_buildSaleList(context, ref, vm)],
+                ),
+              ))),
     );
   }
 }

+ 13 - 16
packages/cpt_rewards/lib/modules/rewards_my/rewards_my_used/rewards_my_used_repository.dart

@@ -1,9 +1,11 @@
 import 'package:domain/constants/api_constants.dart';
+import 'package:domain/entity/rewards_history_earned_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';
@@ -26,19 +28,14 @@ class RewardsMyUsedRepository {
 
   RewardsMyUsedRepository({required this.dioEngine});
 
-  Future<HttpResult<Object>> fetchPropertyNewsList(
-      Map<String, dynamic>? data, {
-        CancelToken? cancelToken,
-      }) async {
+  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";
@@ -46,25 +43,25 @@ class RewardsMyUsedRepository {
 
     final result = await dioEngine.requestNetResult(
       // ApiConstants.apiServerTime, // api 地址
-      '/index.php/api/employee/extra/time', // api 地址
+      '/api/v1/user/reward/sale/index', // api 地址
       params: params,
       headers: headers,
       method: HttpMethod.GET,
-      isShowLoadingDialog: true,  //是否展示默认的Loading弹窗
-      networkDebounce: true,   //是否防抖防止重复请求
+      isShowLoadingDialog: false, //是否展示默认的Loading弹窗
+      networkDebounce: true, //是否防抖防止重复请求
       cancelToken: cancelToken,
     );
 
+    Log.d("------请求返回的result--$result--------");
     //根据返回的结果,封装原始数据为Bean/Entity对象
     if (result.isSuccess) {
       //重新赋值data或list
       final json = result.getDataJson();
-      var data = RewardsMyUsedState.fromJson(json!);
+      var data = RewardsHistoryEarnedEntity.fromJson(json!);
       //重新赋值data或list
-      return result.convert<RewardsMyUsedState>(data: data);
+      return result.convert<RewardsHistoryEarnedEntity>(data: data);
     }
     return result.convert();
   }
-
-
 }
+

+ 43 - 31
packages/cpt_rewards/lib/modules/rewards_my/rewards_my_used/rewards_my_used_state.dart

@@ -2,48 +2,60 @@
 
 import 'dart:convert';
 
-RewardsMyUsedState rewardsMyUsedStateFromJson(String str) => RewardsMyUsedState.fromJson(json.decode(str));
-
-String rewardsMyUsedStateToJson(RewardsMyUsedState data) => json.encode(data.toJson());
+import 'package:widgets/load_state_layout.dart';
 
 class RewardsMyUsedState {
+  //页面 LoadView 状态的展示
+  LoadState loadingState;
+  String? errorMessage;
+
+  int? page;
+  int? limit = 10;
+  int? count = 1;
+  List<Map<String, dynamic>>? list;
+
   RewardsMyUsedState({
-    required this.curPage,
-    required this.pageSize,
+    this.loadingState = LoadState.State_Loading,
+    String? errorMessage,
+    this.page = 1,
+    this.limit = 10,
+    this.count = 1,
     required this.list,
-    required this.filterCount,
   });
 
-  int curPage;
-  int pageSize;
-  List<Map<String, dynamic>> list;
-  int filterCount;
-
-  factory RewardsMyUsedState.fromJson(Map<dynamic, dynamic> json) => RewardsMyUsedState(
-    curPage: json["curPage"],
-    pageSize: json["pageSize"],
-    list: List<Map<String, dynamic>>.from(json["list"].map((x) => x)),
-    filterCount: json["filterCount"],
-  );
-
-  Map<dynamic, dynamic> toJson() => {
-    "curPage": curPage,
-    "pageSize": pageSize,
-    "list": List<dynamic>.from(list.map((x) => x)),
-    "filterCount": filterCount,
-  };
-
   RewardsMyUsedState copyWith({
-    int? curPage,
-    int? pageSize,
+    LoadState? loadingState,
+    String? errorMessage,
+    int? page,
+    int? limit,
+    int? count,
     List<Map<String, dynamic>>? list,
-    int? filterCount,
   }) {
     return RewardsMyUsedState(
-      curPage: curPage ?? this.curPage,
-      pageSize: pageSize ?? this.pageSize,
+      loadingState: loadingState ?? this.loadingState,
+      errorMessage: errorMessage ?? this.errorMessage,
+      page: page ?? this.page,
+      limit: limit ?? this.limit,
+      count: count ?? this.count,
       list: list ?? this.list,
-      filterCount: filterCount ?? this.filterCount,
+    );
+  }
+
+  Map<String, dynamic> toMap() {
+    return {
+      'page': this.page,
+      'limit': this.limit,
+      'count': this.count,
+      'list': this.list,
+    };
+  }
+
+  factory RewardsMyUsedState.fromMap(Map<String, dynamic> map) {
+    return RewardsMyUsedState(
+      page: map['page'] as int,
+      limit: map['limit'] as int,
+      count: map['count'] as int,
+      list: map['list'] as List<Map<String, dynamic>>,
     );
   }
 }

+ 92 - 46
packages/cpt_rewards/lib/modules/rewards_my/rewards_my_used/rewards_my_used_vm.dart

@@ -1,7 +1,10 @@
+import 'package:domain/entity/rewards_history_earned_entity.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:plugin_platform/engine/toast/toast_engine.dart';
+import 'package:widgets/load_state_layout.dart';
+import 'package:widgets/widget_export.dart';
 import './rewards_my_used_state.dart';
 import './rewards_my_used_repository.dart';
 part 'rewards_my_used_vm.g.dart';
@@ -9,24 +12,19 @@ part 'rewards_my_used_vm.g.dart';
 @riverpod
 class RewardsMyUsedVm extends _$RewardsMyUsedVm {
   late RewardsMyUsedRepository rewardsMyUsedRepository;
+   var page = 1;
+  var limit = 10;
+
+  bool _needShowPlaceholder = false; //是否展示LoadingView
+
+  // Refresh 控制器
+  final EasyRefreshController refreshController = EasyRefreshController(
+    controlFinishRefresh: true, //允许刷新
+    controlFinishLoad: true, //允许加载
+  );
   RewardsMyUsedState initState() {
     return RewardsMyUsedState(
-      curPage: 1,
-      pageSize: 10,
-      list: [
-        {
-          "id": 1,
-          "title":
-              "The community will hold the activity of making Zongzi on the Loong Boat ……",
-          "price": "Monday 14 0ct 2024, 15:00 PM~18:00PM",
-        },
-        {
-          "id": 2,
-          "title": "Community basketball competition activities",
-          "price": "Monday 14 Oct 2024, 10:19 AM",
-        },
-      ],
-      filterCount: 2,
+      list: [],
     );
   }
 
@@ -40,50 +38,74 @@ class RewardsMyUsedVm extends _$RewardsMyUsedVm {
     return state;
   }
 
-  // 初始化页面数据
+//刷新页面状态
+  void changeLoadingState(LoadState loadState, String? errorMsg) {
+    state = state.copyWith(loadingState: loadState, errorMessage: errorMsg);
+  }
+
+  // 初始化页面数据&0
   initPageData() {
     Log.d("----property_news_vm-----initPageData");
-    refreshListData();
+    onRefresh();
   }
 
-  // 上拉加载
-  Future onLoadData() async {
-    Log.d("----property_news_vm-----initListData");
+  // 上拉加载 更多
+  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 = page + 1;
+    //   state = state.copyWith(page: page,);
     //   getListData();
     // }
+    // 检查 page 是否为 null,并初始化为 1
+    page++;
+
+    getListData();
+  }
+
+  // 下拉刷新
+  Future onRefresh() async {
+    Log.d("----property_news_vm-----onRefresh ");
+
+    // await Future.delayed(const Duration(seconds: 2));
+    page = 1;
     getListData();
   }
 
-// 去新闻详情页
-  void goNewsDetail(String item) {
-    Log.d(item);
-    // PropertyPage.startInstance(context: context, item: item);
+  // 重试请求
+  Future retryRequest() async {
+    page = 1;
+    _needShowPlaceholder = true;
+    getListData();
   }
 
   // 获取list 列表数据
-  void getListData<T>() async {
-    Log.d("加载listData数据---------------start-----");
+  Future getListData<T>() async {
+    // if (_needShowPlaceholder) {
+    //   changeLoadingState(LoadState.State_Loading, null);
+    // }
+
+    Log.d("加载listData数据---------------start--${page}---");
     try {
       //请求网络
       Map<String, dynamic> params = {
-        "curPage": state.curPage,
-        "pageSize": state.pageSize,
+        "page": page,
+        "limit": limit,
+        "list_type": 'used'
       };
       Log.d("请求参数------$params");
-      final result = await rewardsMyUsedRepository.fetchPropertyNewsList(params);
-      Log.d("请求完成结果------${result.data}");
+      final result = await rewardsMyUsedRepository.fetchList(params);
       //校验成功失败
       if (result.isSuccess) {
-        // state = state.copyWith(serverTime: result.data);
-        state = state;
-        ToastEngine.show("获取数据成功");
+        handlerResultList((result.data as RewardsHistoryEarnedEntity)
+            .list
+            .cast<RewardsHistoryEarnedEntity>());
       } else {
+        String errorMessage = result.errorMsg!;
+        changeLoadingState(LoadState.State_Error, errorMessage);
         ToastEngine.show(result.errorMsg ?? "Network Load Error");
       }
     } catch (e) {
@@ -91,15 +113,39 @@ class RewardsMyUsedVm extends _$RewardsMyUsedVm {
     }
   }
 
-  // 下拉刷新
-  Future refreshListData() async {
-    Log.d("----property_news_vm-----refreshListData ");
-
-    // await Future.delayed(const Duration(seconds: 2));
+  void handlerResultList(List<RewardsHistoryEarnedEntity>? list) {
+    if (list != null && list.isNotEmpty) {
+      //有数据,判断是刷新还是加载更多的数据
+      if (page == 1) {
+        //刷新的方式
+        state.list!.clear();
+        state.list!.addAll(list.map((item) => item.toJson()).toList());
+        refreshController.finishRefresh();
 
-    state = state.copyWith(curPage: 1, pageSize: 10);
-    // ref.invalidateSelf();
-    // ref.invalidate(propertyNewsVmProvider);
-    getListData();
+        //更新展示的状态
+        changeLoadingState(LoadState.State_Success, null);
+      } else {
+        //加载更多
+        final allList = state.list;
+        state = state.copyWith(list: allList);
+        refreshController.finishLoad();
+        // update();
+      }
+    } else {
+      if (page == 1) {
+        //展示无数据的布局
+        state.list!.clear();
+        changeLoadingState(LoadState.State_Empty, null);
+        refreshController.finishRefresh();
+      } else {
+        //展示加载完成,没有更多数据了
+        if (state.list!.length == 0) {
+          changeLoadingState(LoadState.State_Empty, null);
+        } else {
+          changeLoadingState(LoadState.State_Success, null);
+        }
+        refreshController.finishLoad(IndicatorResult.noMore);
+      }
+    }
   }
 }

+ 54 - 5
packages/cpt_rewards/lib/router/page/rewards_page_router.gr.dart

@@ -64,9 +64,17 @@ abstract class _$RewardsPageRouter extends RootStackRouter {
       );
     },
     RewardsDetailPageRoute.name: (routeData) {
+      final pathParams = routeData.inheritedPathParams;
+      final args = routeData.argsAs<RewardsDetailPageRouteArgs>(
+          orElse: () => RewardsDetailPageRouteArgs(
+                id: pathParams.optInt('id'),
+              ));
       return AutoRoutePage<dynamic>(
         routeData: routeData,
-        child: const RewardsDetailPage(),
+        child: RewardsDetailPage(
+          key: args.key,
+          id: args.id,
+        ),
       );
     },
     RewardsConfirmPageRoute.name: (routeData) {
@@ -241,18 +249,59 @@ class RewardsCodePageRoute extends PageRouteInfo<void> {
 
 /// generated route for
 /// [RewardsDetailPage]
-class RewardsDetailPageRoute extends PageRouteInfo<void> {
-  const RewardsDetailPageRoute({List<PageRouteInfo>? children})
-      : super(
+// class RewardsDetailPageRoute extends PageRouteInfo<void> {
+//   const RewardsDetailPageRoute({List<PageRouteInfo>? children, int? id})
+//       : super(
+//           RewardsDetailPageRoute.name,
+//           initialChildren: children,
+//         );
+
+//   static const String name = 'RewardsDetailPageRoute';
+
+//   static const PageInfo<void> page = PageInfo<void>(name);
+// }
+
+class RewardsDetailPageRoute
+    extends PageRouteInfo<RewardsDetailPageRouteArgs> {
+  RewardsDetailPageRoute({
+    Key? key,
+    required int? id,
+    List<PageRouteInfo>? children,
+  }) : super(
           RewardsDetailPageRoute.name,
+          args: RewardsDetailPageRouteArgs(
+            key: key,
+            id: id,
+          ),
+          rawPathParams: {
+            'id': id,
+          },
           initialChildren: children,
         );
 
   static const String name = 'RewardsDetailPageRoute';
 
-  static const PageInfo<void> page = PageInfo<void>(name);
+  static const PageInfo<RewardsDetailPageRouteArgs> page =
+      PageInfo<RewardsDetailPageRouteArgs>(name);
 }
 
+class RewardsDetailPageRouteArgs {
+  const RewardsDetailPageRouteArgs({
+    this.key,
+    required this.id,
+  });
+
+  final Key? key;
+
+  final int? id;
+
+  @override
+  String toString() {
+    return 'RewardsDetailPageRouteArgs{key: $key, id: $id}';
+  }
+}
+
+
 /// generated route for
 /// [RewardsConfirmPage]
 class RewardsConfirmPageRoute extends PageRouteInfo<void> {

+ 22 - 0
packages/cs_domain/lib/entity/rewards_category_entity.dart

@@ -0,0 +1,22 @@
+import 'package:domain/generated/json/base/json_field.dart';
+import 'package:domain/generated/json/rewards_category_entity.g.dart';
+import 'dart:convert';
+export 'package:domain/generated/json/rewards_category_entity.g.dart';
+
+@JsonSerializable()
+class RewardsCategoryEntity {
+	late int id = 0;
+	late String icon = '';
+	late String name = '';
+
+	RewardsCategoryEntity();
+
+	factory RewardsCategoryEntity.fromJson(Map<String, dynamic> json) => $RewardsCategoryEntityFromJson(json);
+
+	Map<String, dynamic> toJson() => $RewardsCategoryEntityToJson(this);
+
+	@override
+	String toString() {
+		return jsonEncode(this);
+	}
+}

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

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

+ 61 - 0
packages/cs_domain/lib/entity/rewards_home_entity.dart

@@ -0,0 +1,61 @@
+import 'package:domain/generated/json/base/json_field.dart';
+import 'package:domain/generated/json/rewards_home_entity.g.dart';
+import 'dart:convert';
+export 'package:domain/generated/json/rewards_home_entity.g.dart';
+
+@JsonSerializable()
+class RewardsHomeEntity {
+	late List<RewardsHomeData> data = [];
+	late String message = '';
+	late int code = 0;
+
+	RewardsHomeEntity();
+
+	factory RewardsHomeEntity.fromJson(Map<String, dynamic> json) => $RewardsHomeEntityFromJson(json);
+
+	Map<String, dynamic> toJson() => $RewardsHomeEntityToJson(this);
+
+	@override
+	String toString() {
+		return jsonEncode(this);
+	}
+}
+
+@JsonSerializable()
+class RewardsHomeData {
+	late int id = 0;
+	late String name = '';
+	late List<RewardsHomeDataRewards> rewards = [];
+
+	RewardsHomeData();
+
+	factory RewardsHomeData.fromJson(Map<String, dynamic> json) => $RewardsHomeDataFromJson(json);
+
+	Map<String, dynamic> toJson() => $RewardsHomeDataToJson(this);
+
+	@override
+	String toString() {
+		return jsonEncode(this);
+	}
+}
+
+@JsonSerializable()
+class RewardsHomeDataRewards {
+	late int id = 0;
+	late String name = '';
+	late List<String> resources = [];
+	@JSONField(name: "original_point")
+	late int originalPoint = 0;
+	late int point = 0;
+
+	RewardsHomeDataRewards();
+
+	factory RewardsHomeDataRewards.fromJson(Map<String, dynamic> json) => $RewardsHomeDataRewardsFromJson(json);
+
+	Map<String, dynamic> toJson() => $RewardsHomeDataRewardsToJson(this);
+
+	@override
+	String toString() {
+		return jsonEncode(this);
+	}
+}

+ 43 - 0
packages/cs_domain/lib/entity/rewards_home_tes_entity.dart

@@ -0,0 +1,43 @@
+import 'package:domain/generated/json/base/json_field.dart';
+import 'package:domain/generated/json/rewards_home_tes_entity.g.dart';
+import 'dart:convert';
+export 'package:domain/generated/json/rewards_home_tes_entity.g.dart';
+
+@JsonSerializable()
+class RewardsHomeTesEntity {
+	late double id;
+	late String name = '';
+	late List<RewardsHomeTesRewards> rewards = [];
+
+	RewardsHomeTesEntity();
+
+	factory RewardsHomeTesEntity.fromJson(Map<String, dynamic> json) => $RewardsHomeTesEntityFromJson(json);
+
+	Map<String, dynamic> toJson() => $RewardsHomeTesEntityToJson(this);
+
+	@override
+	String toString() {
+		return jsonEncode(this);
+	}
+}
+
+@JsonSerializable()
+class RewardsHomeTesRewards {
+	late double id;
+	late String name = '';
+	late List<String> resources = [];
+	@JSONField(name: "original_point")
+	late double originalPoint;
+	late double point;
+
+	RewardsHomeTesRewards();
+
+	factory RewardsHomeTesRewards.fromJson(Map<String, dynamic> json) => $RewardsHomeTesRewardsFromJson(json);
+
+	Map<String, dynamic> toJson() => $RewardsHomeTesRewardsToJson(this);
+
+	@override
+	String toString() {
+		return jsonEncode(this);
+	}
+}

+ 22 - 0
packages/cs_domain/lib/entity/rewards_home_test_entity.dart

@@ -0,0 +1,22 @@
+import 'package:domain/generated/json/base/json_field.dart';
+import 'package:domain/generated/json/rewards_home_test_entity.g.dart';
+import 'dart:convert';
+export 'package:domain/generated/json/rewards_home_test_entity.g.dart';
+
+@JsonSerializable()
+class RewardsHomeTestEntity {
+	late int id = 0;
+	late String name = '';
+	late List<dynamic> rewards = [];
+
+	RewardsHomeTestEntity();
+
+	factory RewardsHomeTestEntity.fromJson(Map<String, dynamic> json) => $RewardsHomeTestEntityFromJson(json);
+
+	Map<String, dynamic> toJson() => $RewardsHomeTestEntityToJson(this);
+
+	@override
+	String toString() {
+		return jsonEncode(this);
+	}
+}

+ 23 - 0
packages/cs_domain/lib/entity/rewards_home_tx_entity.dart

@@ -0,0 +1,23 @@
+import 'package:domain/generated/json/base/json_field.dart';
+import 'package:domain/generated/json/rewards_home_tx_entity.g.dart';
+import 'dart:convert';
+export 'package:domain/generated/json/rewards_home_tx_entity.g.dart';
+
+@JsonSerializable()
+class RewardsHomeTxEntity {
+  late double id;
+  late String name = '';
+  late List<dynamic> rewards = [];
+
+  RewardsHomeTxEntity();
+
+  factory RewardsHomeTxEntity.fromJson(Map<String, dynamic> json) =>
+      $RewardsHomeTxEntityFromJson(json);
+
+  Map<String, dynamic> toJson() => $RewardsHomeTxEntityToJson(this);
+
+  @override
+  String toString() {
+    return jsonEncode(this);
+  }
+}

+ 61 - 0
packages/cs_domain/lib/entity/rewards_index_entity.dart

@@ -0,0 +1,61 @@
+import 'package:domain/generated/json/base/json_field.dart';
+import 'package:domain/generated/json/rewards_index_entity.g.dart';
+import 'dart:convert';
+export 'package:domain/generated/json/rewards_index_entity.g.dart';
+
+@JsonSerializable()
+class RewardsIndexEntity {
+	late int points = 0;
+	late RewardsIndexContinuous continuous;
+	late RewardsIndexTasks tasks;
+	late List<dynamic> latest = [];
+
+	RewardsIndexEntity();
+
+	factory RewardsIndexEntity.fromJson(Map<String, dynamic> json) => $RewardsIndexEntityFromJson(json);
+
+	Map<String, dynamic> toJson() => $RewardsIndexEntityToJson(this);
+
+	@override
+	String toString() {
+		return jsonEncode(this);
+	}
+}
+
+@JsonSerializable()
+class RewardsIndexContinuous {
+	late int count = 0;
+	@JSONField(name: "current_week_checkin")
+	late List<dynamic> currentWeekCheckin = [];
+
+	RewardsIndexContinuous();
+
+	factory RewardsIndexContinuous.fromJson(Map<String, dynamic> json) => $RewardsIndexContinuousFromJson(json);
+
+	Map<String, dynamic> toJson() => $RewardsIndexContinuousToJson(this);
+
+	@override
+	String toString() {
+		return jsonEncode(this);
+	}
+}
+@JsonSerializable()
+class RewardsIndexTasks {
+	@JSONField(name: "daily_checkin")
+	late bool dailyCheckin = false;
+	@JSONField(name: "news_feed_post")
+	late bool newsFeedPost = false;
+	@JSONField(name: "give_10_likes")
+	late int give10Likes = 0;
+
+	RewardsIndexTasks();
+
+	factory RewardsIndexTasks.fromJson(Map<String, dynamic> json) => $RewardsIndexTasksFromJson(json);
+
+	Map<String, dynamic> toJson() => $RewardsIndexTasksToJson(this);
+
+	@override
+	String toString() {
+		return jsonEncode(this);
+	}
+}

+ 46 - 0
packages/cs_domain/lib/entity/rewards_list_entity.dart

@@ -0,0 +1,46 @@
+import 'package:domain/generated/json/base/json_field.dart';
+import 'package:domain/generated/json/rewards_list_entity.g.dart';
+import 'dart:convert';
+export 'package:domain/generated/json/rewards_list_entity.g.dart';
+
+@JsonSerializable()
+class RewardsListEntity {
+	late int count = 0;
+	late int page = 0;
+	late int limit = 0;
+	@JSONField(name: "count_page")
+	late int countPage = 0;
+	late List<RewardsListList> list = [];
+
+	RewardsListEntity();
+
+	factory RewardsListEntity.fromJson(Map<String, dynamic> json) => $RewardsListEntityFromJson(json);
+
+	Map<String, dynamic> toJson() => $RewardsListEntityToJson(this);
+
+	@override
+	String toString() {
+		return jsonEncode(this);
+	}
+}
+
+@JsonSerializable()
+class RewardsListList {
+	late int id = 0;
+	late String name = '';
+	late List<String> resources = [];
+	@JSONField(name: "original_point")
+	late int originalPoint = 0;
+	late int point = 0;
+
+	RewardsListList();
+
+	factory RewardsListList.fromJson(Map<String, dynamic> json) => $RewardsListListFromJson(json);
+
+	Map<String, dynamic> toJson() => $RewardsListListToJson(this);
+
+	@override
+	String toString() {
+		return jsonEncode(this);
+	}
+}

+ 20 - 0
packages/cs_domain/lib/entity/text_kon_entity.dart

@@ -0,0 +1,20 @@
+import 'package:domain/generated/json/base/json_field.dart';
+import 'package:domain/generated/json/text_kon_entity.g.dart';
+import 'dart:convert';
+export 'package:domain/generated/json/text_kon_entity.g.dart';
+
+@JsonSerializable()
+class TextKonEntity {
+
+
+	TextKonEntity();
+
+	factory TextKonEntity.fromJson(Map<String, dynamic> json) => $TextKonEntityFromJson(json);
+
+	Map<String, dynamic> toJson() => $TextKonEntityToJson(this);
+
+	@override
+	String toString() {
+		return jsonEncode(this);
+	}
+} 

+ 99 - 0
packages/cs_domain/lib/generated/assets.dart

@@ -0,0 +1,99 @@
+///This file is automatically generated. DO NOT EDIT, all your changes would be lost.
+class Assets {
+  Assets._();
+
+  static const String baseJsonConvertContent = 'lib/generated/json/base/json_convert_content.dart';
+  static const String baseJsonField = 'lib/generated/json/base/json_field.dart';
+  static const String constantsApiConstants = 'lib/constants/api_constants.dart';
+  static const String entityAuthLoginEntity = 'lib/entity/auth_login_entity.dart';
+  static const String entityCaptchaImgEntity = 'lib/entity/captcha_img_entity.dart';
+  static const String entityFacilityBookEntity = 'lib/entity/facility_book_entity.dart';
+  static const String entityFacilityPageEntity = 'lib/entity/facility_page_entity.dart';
+  static const String entityFeedbackDetailEntity = 'lib/entity/feedback_detail_entity.dart';
+  static const String entityFeedbackListEntity = 'lib/entity/feedback_list_entity.dart';
+  static const String entityFormContentEntity = 'lib/entity/form_content_entity.dart';
+  static const String entityFormDetailEntity = 'lib/entity/form_detail_entity.dart';
+  static const String entityFormListEntity = 'lib/entity/form_list_entity.dart';
+  static const String entityFormOptionEntity = 'lib/entity/form_option_entity.dart';
+  static const String entityFormSubmittedEntity = 'lib/entity/form_submitted_entity.dart';
+  static const String entityFormSubmittedPageEntity = 'lib/entity/form_submitted_page_entity.dart';
+  static const String entityGarageSaleRentDetailEntity = 'lib/entity/garage_sale_rent_detail_entity.dart';
+  static const String entityGarageSaleRentEntity = 'lib/entity/garage_sale_rent_entity.dart';
+  static const String entityHomeModule = 'lib/entity/home_module.dart';
+  static const String entityIdNameEntity = 'lib/entity/id_name_entity.dart';
+  static const String entityMyfollowingListEntity = 'lib/entity/myfollowing_list_entity.dart';
+  static const String entityMypostsSaleRentEntity = 'lib/entity/myposts_sale_rent_entity.dart';
+  static const String entityNewsfeedCommentPublishEntity = 'lib/entity/newsfeed_comment_publish_entity.dart';
+  static const String entityNewsfeedDetailEntity = 'lib/entity/newsfeed_detail_entity.dart';
+  static const String entityNewsfeedFollowingEntity = 'lib/entity/newsfeed_following_entity.dart';
+  static const String entityNewsfeedForyouEntity = 'lib/entity/newsfeed_foryou_entity.dart';
+  static const String entityNewsfeedNewsEntity = 'lib/entity/newsfeed_news_entity.dart';
+  static const String entityNoticeBoardAnnounEntity = 'lib/entity/notice_board_announ_entity.dart';
+  static const String entityNoticeBoardDocumentsEntity = 'lib/entity/notice_board_documents_entity.dart';
+  static const String entityNoticeBoardEventEntity = 'lib/entity/notice_board_event_entity.dart';
+  static const String entityPropertyNewsEntity = 'lib/entity/property_news_entity.dart';
+  static const String entityPropertySaleRentEntity = 'lib/entity/property_sale_rent_entity.dart';
+  static const String entityRewardsCategoryEntity = 'lib/entity/rewards_category_entity.dart';
+  static const String entityRewardsHistoryEarnedEntity = 'lib/entity/rewards_history_earned_entity.dart';
+  static const String entityRewardsHomeEntity = 'lib/entity/rewards_home_entity.dart';
+  static const String entityRewardsHomeTesEntity = 'lib/entity/rewards_home_tes_entity.dart';
+  static const String entityRewardsHomeTestEntity = 'lib/entity/rewards_home_test_entity.dart';
+  static const String entityRewardsHomeTxEntity = 'lib/entity/rewards_home_tx_entity.dart';
+  static const String entityRewardsIndexEntity = 'lib/entity/rewards_index_entity.dart';
+  static const String entityRewardsListEntity = 'lib/entity/rewards_list_entity.dart';
+  static const String entityServerTime = 'lib/entity/server_time.dart';
+  static const String entityTextKonEntity = 'lib/entity/text_kon_entity.dart';
+  static const String entityUserMeEntity = 'lib/entity/user_me_entity.dart';
+  static const String generatedAssets = 'lib/generated/assets.dart';
+  static const String jsonAuthLoginEntity.g = 'lib/generated/json/auth_login_entity.g.dart';
+  static const String jsonCaptchaImgEntity.g = 'lib/generated/json/captcha_img_entity.g.dart';
+  static const String jsonFacilityBookEntity.g = 'lib/generated/json/facility_book_entity.g.dart';
+  static const String jsonFacilityPageEntity.g = 'lib/generated/json/facility_page_entity.g.dart';
+  static const String jsonFeedbackDetailEntity.g = 'lib/generated/json/feedback_detail_entity.g.dart';
+  static const String jsonFeedbackListEntity.g = 'lib/generated/json/feedback_list_entity.g.dart';
+  static const String jsonFormContentEntity.g = 'lib/generated/json/form_content_entity.g.dart';
+  static const String jsonFormDetailEntity.g = 'lib/generated/json/form_detail_entity.g.dart';
+  static const String jsonFormListEntity.g = 'lib/generated/json/form_list_entity.g.dart';
+  static const String jsonFormOptionEntity.g = 'lib/generated/json/form_option_entity.g.dart';
+  static const String jsonFormSubmittedEntity.g = 'lib/generated/json/form_submitted_entity.g.dart';
+  static const String jsonFormSubmittedPageEntity.g = 'lib/generated/json/form_submitted_page_entity.g.dart';
+  static const String jsonGarageSaleRentDetailEntity.g = 'lib/generated/json/garage_sale_rent_detail_entity.g.dart';
+  static const String jsonGarageSaleRentEntity.g = 'lib/generated/json/garage_sale_rent_entity.g.dart';
+  static const String jsonIdNameEntity.g = 'lib/generated/json/id_name_entity.g.dart';
+  static const String jsonMyfollowingListEntity.g = 'lib/generated/json/myfollowing_list_entity.g.dart';
+  static const String jsonMypostsSaleRentEntity.g = 'lib/generated/json/myposts_sale_rent_entity.g.dart';
+  static const String jsonNewsfeedCommentPublishEntity.g = 'lib/generated/json/newsfeed_comment_publish_entity.g.dart';
+  static const String jsonNewsfeedDetailEntity.g = 'lib/generated/json/newsfeed_detail_entity.g.dart';
+  static const String jsonNewsfeedFollowingEntity.g = 'lib/generated/json/newsfeed_following_entity.g.dart';
+  static const String jsonNewsfeedForyouEntity.g = 'lib/generated/json/newsfeed_foryou_entity.g.dart';
+  static const String jsonNewsfeedNewsEntity.g = 'lib/generated/json/newsfeed_news_entity.g.dart';
+  static const String jsonNoticeBoardAnnounEntity.g = 'lib/generated/json/notice_board_announ_entity.g.dart';
+  static const String jsonNoticeBoardDocumentsEntity.g = 'lib/generated/json/notice_board_documents_entity.g.dart';
+  static const String jsonNoticeBoardEventEntity.g = 'lib/generated/json/notice_board_event_entity.g.dart';
+  static const String jsonPropertyNewsEntity.g = 'lib/generated/json/property_news_entity.g.dart';
+  static const String jsonPropertySaleRentEntity.g = 'lib/generated/json/property_sale_rent_entity.g.dart';
+  static const String jsonRewardsCategoryEntity.g = 'lib/generated/json/rewards_category_entity.g.dart';
+  static const String jsonRewardsHistoryEarnedEntity.g = 'lib/generated/json/rewards_history_earned_entity.g.dart';
+  static const String jsonRewardsHomeEntity.g = 'lib/generated/json/rewards_home_entity.g.dart';
+  static const String jsonRewardsHomeTesEntity.g = 'lib/generated/json/rewards_home_tes_entity.g.dart';
+  static const String jsonRewardsHomeTestEntity.g = 'lib/generated/json/rewards_home_test_entity.g.dart';
+  static const String jsonRewardsHomeTxEntity.g = 'lib/generated/json/rewards_home_tx_entity.g.dart';
+  static const String jsonRewardsIndexEntity.g = 'lib/generated/json/rewards_index_entity.g.dart';
+  static const String jsonRewardsListEntity.g = 'lib/generated/json/rewards_list_entity.g.dart';
+  static const String jsonServerTime.g = 'lib/generated/json/server_time.g.dart';
+  static const String jsonTextKonEntity.g = 'lib/generated/json/text_kon_entity.g.dart';
+  static const String jsonUserMeEntity.g = 'lib/generated/json/user_me_entity.g.dart';
+  static const String repositoryAuthRepository = 'lib/repository/auth_repository.dart';
+  static const String repositoryAuthRepository.g = 'lib/repository/auth_repository.g.dart';
+  static const String repositoryDemoRepository = 'lib/repository/demo_repository.dart';
+  static const String repositoryDemoRepository.g = 'lib/repository/demo_repository.g.dart';
+  static const String repositoryFacilityRepository = 'lib/repository/facility_repository.dart';
+  static const String repositoryFacilityRepository.g = 'lib/repository/facility_repository.g.dart';
+  static const String repositoryFormRepository = 'lib/repository/form_repository.dart';
+  static const String repositoryFormRepository.g = 'lib/repository/form_repository.g.dart';
+  static const String repositoryMainRepository = 'lib/repository/main_repository.dart';
+  static const String repositoryMainRepository.g = 'lib/repository/main_repository.g.dart';
+  static const String repositoryProfileRepository = 'lib/repository/profile_repository.dart';
+  static const String repositoryProfileRepository.g = 'lib/repository/profile_repository.g.dart';
+
+}

+ 113 - 14
packages/cs_domain/lib/generated/json/base/json_convert_content.dart

@@ -31,7 +31,16 @@ import 'package:domain/entity/notice_board_documents_entity.dart';
 import 'package:domain/entity/notice_board_event_entity.dart';
 import 'package:domain/entity/property_news_entity.dart';
 import 'package:domain/entity/property_sale_rent_entity.dart';
+import 'package:domain/entity/rewards_category_entity.dart';
+import 'package:domain/entity/rewards_history_earned_entity.dart';
+import 'package:domain/entity/rewards_home_entity.dart';
+import 'package:domain/entity/rewards_home_tes_entity.dart';
+import 'package:domain/entity/rewards_home_test_entity.dart';
+import 'package:domain/entity/rewards_home_tx_entity.dart';
+import 'package:domain/entity/rewards_index_entity.dart';
+import 'package:domain/entity/rewards_list_entity.dart';
 import 'package:domain/entity/server_time.dart';
+import 'package:domain/entity/text_kon_entity.dart';
 import 'package:domain/entity/user_me_entity.dart';
 
 JsonConvert jsonConvert = JsonConvert();
@@ -179,37 +188,48 @@ class JsonConvert {
           CaptchaImgEntity.fromJson(e)).toList() as M;
     }
     if (<FacilityBookEntity>[] is M) {
-      return data.map<FacilityBookEntity>((Map<String, dynamic> e) => FacilityBookEntity.fromJson(e)).toList() as M;
+      return data.map<FacilityBookEntity>((Map<String, dynamic> e) =>
+          FacilityBookEntity.fromJson(e)).toList() as M;
     }
     if (<FacilityBookFacilityType>[] is M) {
-      return data.map<FacilityBookFacilityType>((Map<String, dynamic> e) => FacilityBookFacilityType.fromJson(e)).toList() as M;
+      return data.map<FacilityBookFacilityType>((Map<String, dynamic> e) =>
+          FacilityBookFacilityType.fromJson(e)).toList() as M;
     }
     if (<FacilityBookFacilities>[] is M) {
-      return data.map<FacilityBookFacilities>((Map<String, dynamic> e) => FacilityBookFacilities.fromJson(e)).toList() as M;
+      return data.map<FacilityBookFacilities>((Map<String, dynamic> e) =>
+          FacilityBookFacilities.fromJson(e)).toList() as M;
     }
     if (<FacilityBookFacilitiesPeriods>[] is M) {
-      return data.map<FacilityBookFacilitiesPeriods>((Map<String, dynamic> e) => FacilityBookFacilitiesPeriods.fromJson(e)).toList() as M;
+      return data.map<FacilityBookFacilitiesPeriods>((Map<String, dynamic> e) =>
+          FacilityBookFacilitiesPeriods.fromJson(e)).toList() as M;
     }
     if (<FacilityPageEntity>[] is M) {
-      return data.map<FacilityPageEntity>((Map<String, dynamic> e) => FacilityPageEntity.fromJson(e)).toList() as M;
+      return data.map<FacilityPageEntity>((Map<String, dynamic> e) =>
+          FacilityPageEntity.fromJson(e)).toList() as M;
     }
     if (<FacilityPageList>[] is M) {
-      return data.map<FacilityPageList>((Map<String, dynamic> e) => FacilityPageList.fromJson(e)).toList() as M;
+      return data.map<FacilityPageList>((Map<String, dynamic> e) =>
+          FacilityPageList.fromJson(e)).toList() as M;
     }
     if (<FacilityPageListBooking>[] is M) {
-      return data.map<FacilityPageListBooking>((Map<String, dynamic> e) => FacilityPageListBooking.fromJson(e)).toList() as M;
+      return data.map<FacilityPageListBooking>((Map<String, dynamic> e) =>
+          FacilityPageListBooking.fromJson(e)).toList() as M;
     }
     if (<FacilityPageListFacility>[] is M) {
-      return data.map<FacilityPageListFacility>((Map<String, dynamic> e) => FacilityPageListFacility.fromJson(e)).toList() as M;
+      return data.map<FacilityPageListFacility>((Map<String, dynamic> e) =>
+          FacilityPageListFacility.fromJson(e)).toList() as M;
     }
     if (<FacilityPageListFacilityType>[] is M) {
-      return data.map<FacilityPageListFacilityType>((Map<String, dynamic> e) => FacilityPageListFacilityType.fromJson(e)).toList() as M;
+      return data.map<FacilityPageListFacilityType>((Map<String, dynamic> e) =>
+          FacilityPageListFacilityType.fromJson(e)).toList() as M;
     }
     if (<FacilityPageListTimePeriod>[] is M) {
-      return data.map<FacilityPageListTimePeriod>((Map<String, dynamic> e) => FacilityPageListTimePeriod.fromJson(e)).toList() as M;
+      return data.map<FacilityPageListTimePeriod>((Map<String, dynamic> e) =>
+          FacilityPageListTimePeriod.fromJson(e)).toList() as M;
     }
     if (<FacilityPageListAccount>[] is M) {
-      return data.map<FacilityPageListAccount>((Map<String, dynamic> e) => FacilityPageListAccount.fromJson(e)).toList() as M;
+      return data.map<FacilityPageListAccount>((Map<String, dynamic> e) =>
+          FacilityPageListAccount.fromJson(e)).toList() as M;
     }
     if (<FeedbackDetailEntity>[] is M) {
       return data.map<FeedbackDetailEntity>((Map<String, dynamic> e) =>
@@ -372,10 +392,70 @@ class JsonConvert {
       return data.map<PropertySaleRentList>((Map<String, dynamic> e) =>
           PropertySaleRentList.fromJson(e)).toList() as M;
     }
+    if (<RewardsCategoryEntity>[] is M) {
+      return data.map<RewardsCategoryEntity>((Map<String, dynamic> e) =>
+          RewardsCategoryEntity.fromJson(e)).toList() as M;
+    }
+    if (<RewardsHistoryEarnedEntity>[] is M) {
+      return data.map<RewardsHistoryEarnedEntity>((Map<String, dynamic> e) =>
+          RewardsHistoryEarnedEntity.fromJson(e)).toList() as M;
+    }
+    if (<RewardsHomeEntity>[] is M) {
+      return data.map<RewardsHomeEntity>((Map<String, dynamic> e) =>
+          RewardsHomeEntity.fromJson(e)).toList() as M;
+    }
+    if (<RewardsHomeData>[] is M) {
+      return data.map<RewardsHomeData>((Map<String, dynamic> e) =>
+          RewardsHomeData.fromJson(e)).toList() as M;
+    }
+    if (<RewardsHomeDataRewards>[] is M) {
+      return data.map<RewardsHomeDataRewards>((Map<String, dynamic> e) =>
+          RewardsHomeDataRewards.fromJson(e)).toList() as M;
+    }
+    if (<RewardsHomeTesEntity>[] is M) {
+      return data.map<RewardsHomeTesEntity>((Map<String, dynamic> e) =>
+          RewardsHomeTesEntity.fromJson(e)).toList() as M;
+    }
+    if (<RewardsHomeTesRewards>[] is M) {
+      return data.map<RewardsHomeTesRewards>((Map<String, dynamic> e) =>
+          RewardsHomeTesRewards.fromJson(e)).toList() as M;
+    }
+    if (<RewardsHomeTestEntity>[] is M) {
+      return data.map<RewardsHomeTestEntity>((Map<String, dynamic> e) =>
+          RewardsHomeTestEntity.fromJson(e)).toList() as M;
+    }
+    if (<RewardsHomeTxEntity>[] is M) {
+      return data.map<RewardsHomeTxEntity>((Map<String, dynamic> e) =>
+          RewardsHomeTxEntity.fromJson(e)).toList() as M;
+    }
+    if (<RewardsIndexEntity>[] is M) {
+      return data.map<RewardsIndexEntity>((Map<String, dynamic> e) =>
+          RewardsIndexEntity.fromJson(e)).toList() as M;
+    }
+    if (<RewardsIndexContinuous>[] is M) {
+      return data.map<RewardsIndexContinuous>((Map<String, dynamic> e) =>
+          RewardsIndexContinuous.fromJson(e)).toList() as M;
+    }
+    if (<RewardsIndexTasks>[] is M) {
+      return data.map<RewardsIndexTasks>((Map<String, dynamic> e) =>
+          RewardsIndexTasks.fromJson(e)).toList() as M;
+    }
+    if (<RewardsListEntity>[] is M) {
+      return data.map<RewardsListEntity>((Map<String, dynamic> e) =>
+          RewardsListEntity.fromJson(e)).toList() as M;
+    }
+    if (<RewardsListList>[] is M) {
+      return data.map<RewardsListList>((Map<String, dynamic> e) =>
+          RewardsListList.fromJson(e)).toList() as M;
+    }
     if (<ServerTime>[] is M) {
       return data.map<ServerTime>((Map<String, dynamic> e) =>
           ServerTime.fromJson(e)).toList() as M;
     }
+    if (<TextKonEntity>[] is M) {
+      return data.map<TextKonEntity>((Map<String, dynamic> e) =>
+          TextKonEntity.fromJson(e)).toList() as M;
+    }
     if (<UserMeEntity>[] is M) {
       return data.map<UserMeEntity>((Map<String, dynamic> e) =>
           UserMeEntity.fromJson(e)).toList() as M;
@@ -430,13 +510,16 @@ class JsonConvertClassCollection {
     (FacilityBookEntity).toString(): FacilityBookEntity.fromJson,
     (FacilityBookFacilityType).toString(): FacilityBookFacilityType.fromJson,
     (FacilityBookFacilities).toString(): FacilityBookFacilities.fromJson,
-    (FacilityBookFacilitiesPeriods).toString(): FacilityBookFacilitiesPeriods.fromJson,
+    (FacilityBookFacilitiesPeriods).toString(): FacilityBookFacilitiesPeriods
+        .fromJson,
     (FacilityPageEntity).toString(): FacilityPageEntity.fromJson,
     (FacilityPageList).toString(): FacilityPageList.fromJson,
     (FacilityPageListBooking).toString(): FacilityPageListBooking.fromJson,
     (FacilityPageListFacility).toString(): FacilityPageListFacility.fromJson,
-    (FacilityPageListFacilityType).toString(): FacilityPageListFacilityType.fromJson,
-    (FacilityPageListTimePeriod).toString(): FacilityPageListTimePeriod.fromJson,
+    (FacilityPageListFacilityType).toString(): FacilityPageListFacilityType
+        .fromJson,
+    (FacilityPageListTimePeriod).toString(): FacilityPageListTimePeriod
+        .fromJson,
     (FacilityPageListAccount).toString(): FacilityPageListAccount.fromJson,
     (FeedbackDetailEntity).toString(): FeedbackDetailEntity.fromJson,
     (FeedbackDetailReplies).toString(): FeedbackDetailReplies.fromJson,
@@ -486,7 +569,23 @@ class JsonConvertClassCollection {
     (PropertyNewsList).toString(): PropertyNewsList.fromJson,
     (PropertySaleRentEntity).toString(): PropertySaleRentEntity.fromJson,
     (PropertySaleRentList).toString(): PropertySaleRentList.fromJson,
+    (RewardsCategoryEntity).toString(): RewardsCategoryEntity.fromJson,
+    (RewardsHistoryEarnedEntity).toString(): RewardsHistoryEarnedEntity
+        .fromJson,
+    (RewardsHomeEntity).toString(): RewardsHomeEntity.fromJson,
+    (RewardsHomeData).toString(): RewardsHomeData.fromJson,
+    (RewardsHomeDataRewards).toString(): RewardsHomeDataRewards.fromJson,
+    (RewardsHomeTesEntity).toString(): RewardsHomeTesEntity.fromJson,
+    (RewardsHomeTesRewards).toString(): RewardsHomeTesRewards.fromJson,
+    (RewardsHomeTestEntity).toString(): RewardsHomeTestEntity.fromJson,
+    (RewardsHomeTxEntity).toString(): RewardsHomeTxEntity.fromJson,
+    (RewardsIndexEntity).toString(): RewardsIndexEntity.fromJson,
+    (RewardsIndexContinuous).toString(): RewardsIndexContinuous.fromJson,
+    (RewardsIndexTasks).toString(): RewardsIndexTasks.fromJson,
+    (RewardsListEntity).toString(): RewardsListEntity.fromJson,
+    (RewardsListList).toString(): RewardsListList.fromJson,
     (ServerTime).toString(): ServerTime.fromJson,
+    (TextKonEntity).toString(): TextKonEntity.fromJson,
     (UserMeEntity).toString(): UserMeEntity.fromJson,
     (UserMeHouseholds).toString(): UserMeHouseholds.fromJson,
     (UserMeEstates).toString(): UserMeEstates.fromJson,

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

@@ -7,16 +7,22 @@ FacilityBookEntity $FacilityBookEntityFromJson(Map<String, dynamic> json) {
   if (remainQuota != null) {
     facilityBookEntity.remainQuota = remainQuota;
   }
-  final String? quotaResetOn = jsonConvert.convert<String>(json['quota_reset_on']);
+  final String? quotaResetOn = jsonConvert.convert<String>(
+      json['quota_reset_on']);
   if (quotaResetOn != null) {
     facilityBookEntity.quotaResetOn = quotaResetOn;
   }
-  final FacilityBookFacilityType? facilityType = jsonConvert.convert<FacilityBookFacilityType>(json['facility_type']);
+  final FacilityBookFacilityType? facilityType = jsonConvert.convert<
+      FacilityBookFacilityType>(json['facility_type']);
   if (facilityType != null) {
     facilityBookEntity.facilityType = facilityType;
   }
-  final List<FacilityBookFacilities>? facilities = (json['facilities'] as List<dynamic>?)?.map(
-          (e) => jsonConvert.convert<FacilityBookFacilities>(e) as FacilityBookFacilities).toList();
+  final List<FacilityBookFacilities>? facilities = (json['facilities'] as List<
+      dynamic>?)
+      ?.map(
+          (e) =>
+      jsonConvert.convert<FacilityBookFacilities>(e) as FacilityBookFacilities)
+      .toList();
   if (facilities != null) {
     facilityBookEntity.facilities = facilities;
   }
@@ -47,9 +53,11 @@ extension FacilityBookEntityExtension on FacilityBookEntity {
   }
 }
 
-FacilityBookFacilityType $FacilityBookFacilityTypeFromJson(Map<String, dynamic> json) {
+FacilityBookFacilityType $FacilityBookFacilityTypeFromJson(
+    Map<String, dynamic> json) {
   final FacilityBookFacilityType facilityBookFacilityType = FacilityBookFacilityType();
-  final int? bookAdvanceDays = jsonConvert.convert<int>(json['book_advance_days']);
+  final int? bookAdvanceDays = jsonConvert.convert<int>(
+      json['book_advance_days']);
   if (bookAdvanceDays != null) {
     facilityBookFacilityType.bookAdvanceDays = bookAdvanceDays;
   }
@@ -57,14 +65,16 @@ FacilityBookFacilityType $FacilityBookFacilityTypeFromJson(Map<String, dynamic>
   if (quota != null) {
     facilityBookFacilityType.quota = quota;
   }
-  final String? quotaResetType = jsonConvert.convert<String>(json['quota_reset_type']);
+  final String? quotaResetType = jsonConvert.convert<String>(
+      json['quota_reset_type']);
   if (quotaResetType != null) {
     facilityBookFacilityType.quotaResetType = quotaResetType;
   }
   return facilityBookFacilityType;
 }
 
-Map<String, dynamic> $FacilityBookFacilityTypeToJson(FacilityBookFacilityType entity) {
+Map<String, dynamic> $FacilityBookFacilityTypeToJson(
+    FacilityBookFacilityType entity) {
   final Map<String, dynamic> data = <String, dynamic>{};
   data['book_advance_days'] = entity.bookAdvanceDays;
   data['quota'] = entity.quota;
@@ -85,7 +95,8 @@ extension FacilityBookFacilityTypeExtension on FacilityBookFacilityType {
   }
 }
 
-FacilityBookFacilities $FacilityBookFacilitiesFromJson(Map<String, dynamic> json) {
+FacilityBookFacilities $FacilityBookFacilitiesFromJson(
+    Map<String, dynamic> json) {
   final FacilityBookFacilities facilityBookFacilities = FacilityBookFacilities();
   final String? id = jsonConvert.convert<String>(json['id']);
   if (id != null) {
@@ -95,15 +106,19 @@ FacilityBookFacilities $FacilityBookFacilitiesFromJson(Map<String, dynamic> json
   if (name != null) {
     facilityBookFacilities.name = name;
   }
-  final List<FacilityBookFacilitiesPeriods>? periods = (json['periods'] as List<dynamic>?)?.map(
-          (e) => jsonConvert.convert<FacilityBookFacilitiesPeriods>(e) as FacilityBookFacilitiesPeriods).toList();
+  final List<FacilityBookFacilitiesPeriods>? periods = (json['periods'] as List<
+      dynamic>?)?.map(
+          (e) =>
+      jsonConvert.convert<FacilityBookFacilitiesPeriods>(
+          e) as FacilityBookFacilitiesPeriods).toList();
   if (periods != null) {
     facilityBookFacilities.periods = periods;
   }
   return facilityBookFacilities;
 }
 
-Map<String, dynamic> $FacilityBookFacilitiesToJson(FacilityBookFacilities entity) {
+Map<String, dynamic> $FacilityBookFacilitiesToJson(
+    FacilityBookFacilities entity) {
   final Map<String, dynamic> data = <String, dynamic>{};
   data['id'] = entity.id;
   data['name'] = entity.name;
@@ -124,7 +139,8 @@ extension FacilityBookFacilitiesExtension on FacilityBookFacilities {
   }
 }
 
-FacilityBookFacilitiesPeriods $FacilityBookFacilitiesPeriodsFromJson(Map<String, dynamic> json) {
+FacilityBookFacilitiesPeriods $FacilityBookFacilitiesPeriodsFromJson(
+    Map<String, dynamic> json) {
   final FacilityBookFacilitiesPeriods facilityBookFacilitiesPeriods = FacilityBookFacilitiesPeriods();
   final String? id = jsonConvert.convert<String>(json['id']);
   if (id != null) {
@@ -157,7 +173,8 @@ FacilityBookFacilitiesPeriods $FacilityBookFacilitiesPeriodsFromJson(Map<String,
   return facilityBookFacilitiesPeriods;
 }
 
-Map<String, dynamic> $FacilityBookFacilitiesPeriodsToJson(FacilityBookFacilitiesPeriods entity) {
+Map<String, dynamic> $FacilityBookFacilitiesPeriodsToJson(
+    FacilityBookFacilitiesPeriods entity) {
   final Map<String, dynamic> data = <String, dynamic>{};
   data['id'] = entity.id;
   data['start'] = entity.start;

+ 38 - 19
packages/cs_domain/lib/generated/json/facility_page_entity.g.dart

@@ -19,12 +19,15 @@ FacilityPageEntity $FacilityPageEntityFromJson(Map<String, dynamic> json) {
   if (countPage != null) {
     facilityPageEntity.countPage = countPage;
   }
-  final String? totalDeposit = jsonConvert.convert<String>(json['total_deposit']);
+  final String? totalDeposit = jsonConvert.convert<String>(
+      json['total_deposit']);
   if (totalDeposit != null) {
     facilityPageEntity.totalDeposit = totalDeposit;
   }
-  final List<FacilityPageList>? list = (json['list'] as List<dynamic>?)?.map(
-          (e) => jsonConvert.convert<FacilityPageList>(e) as FacilityPageList).toList();
+  final List<FacilityPageList>? list = (json['list'] as List<dynamic>?)
+      ?.map(
+          (e) => jsonConvert.convert<FacilityPageList>(e) as FacilityPageList)
+      .toList();
   if (list != null) {
     facilityPageEntity.list = list;
   }
@@ -63,19 +66,23 @@ extension FacilityPageEntityExtension on FacilityPageEntity {
 
 FacilityPageList $FacilityPageListFromJson(Map<String, dynamic> json) {
   final FacilityPageList facilityPageList = FacilityPageList();
-  final FacilityPageListBooking? booking = jsonConvert.convert<FacilityPageListBooking>(json['booking']);
+  final FacilityPageListBooking? booking = jsonConvert.convert<
+      FacilityPageListBooking>(json['booking']);
   if (booking != null) {
     facilityPageList.booking = booking;
   }
-  final FacilityPageListFacility? facility = jsonConvert.convert<FacilityPageListFacility>(json['facility']);
+  final FacilityPageListFacility? facility = jsonConvert.convert<
+      FacilityPageListFacility>(json['facility']);
   if (facility != null) {
     facilityPageList.facility = facility;
   }
-  final FacilityPageListTimePeriod? timePeriod = jsonConvert.convert<FacilityPageListTimePeriod>(json['time_period']);
+  final FacilityPageListTimePeriod? timePeriod = jsonConvert.convert<
+      FacilityPageListTimePeriod>(json['time_period']);
   if (timePeriod != null) {
     facilityPageList.timePeriod = timePeriod;
   }
-  final FacilityPageListAccount? account = jsonConvert.convert<FacilityPageListAccount>(json['account']);
+  final FacilityPageListAccount? account = jsonConvert.convert<
+      FacilityPageListAccount>(json['account']);
   if (account != null) {
     facilityPageList.account = account;
   }
@@ -106,7 +113,8 @@ extension FacilityPageListExtension on FacilityPageList {
   }
 }
 
-FacilityPageListBooking $FacilityPageListBookingFromJson(Map<String, dynamic> json) {
+FacilityPageListBooking $FacilityPageListBookingFromJson(
+    Map<String, dynamic> json) {
   final FacilityPageListBooking facilityPageListBooking = FacilityPageListBooking();
   final String? date = jsonConvert.convert<String>(json['date']);
   if (date != null) {
@@ -124,14 +132,16 @@ FacilityPageListBooking $FacilityPageListBookingFromJson(Map<String, dynamic> js
   if (depositPaid != null) {
     facilityPageListBooking.depositPaid = depositPaid;
   }
-  final String? depositRefund = jsonConvert.convert<String>(json['deposit_refund']);
+  final String? depositRefund = jsonConvert.convert<String>(
+      json['deposit_refund']);
   if (depositRefund != null) {
     facilityPageListBooking.depositRefund = depositRefund;
   }
   return facilityPageListBooking;
 }
 
-Map<String, dynamic> $FacilityPageListBookingToJson(FacilityPageListBooking entity) {
+Map<String, dynamic> $FacilityPageListBookingToJson(
+    FacilityPageListBooking entity) {
   final Map<String, dynamic> data = <String, dynamic>{};
   data['date'] = entity.date;
   data['start'] = entity.start;
@@ -158,7 +168,8 @@ extension FacilityPageListBookingExtension on FacilityPageListBooking {
   }
 }
 
-FacilityPageListFacility $FacilityPageListFacilityFromJson(Map<String, dynamic> json) {
+FacilityPageListFacility $FacilityPageListFacilityFromJson(
+    Map<String, dynamic> json) {
   final FacilityPageListFacility facilityPageListFacility = FacilityPageListFacility();
   final String? id = jsonConvert.convert<String>(json['id']);
   if (id != null) {
@@ -168,14 +179,16 @@ FacilityPageListFacility $FacilityPageListFacilityFromJson(Map<String, dynamic>
   if (name != null) {
     facilityPageListFacility.name = name;
   }
-  final FacilityPageListFacilityType? type = jsonConvert.convert<FacilityPageListFacilityType>(json['type']);
+  final FacilityPageListFacilityType? type = jsonConvert.convert<
+      FacilityPageListFacilityType>(json['type']);
   if (type != null) {
     facilityPageListFacility.type = type;
   }
   return facilityPageListFacility;
 }
 
-Map<String, dynamic> $FacilityPageListFacilityToJson(FacilityPageListFacility entity) {
+Map<String, dynamic> $FacilityPageListFacilityToJson(
+    FacilityPageListFacility entity) {
   final Map<String, dynamic> data = <String, dynamic>{};
   data['id'] = entity.id;
   data['name'] = entity.name;
@@ -196,7 +209,8 @@ extension FacilityPageListFacilityExtension on FacilityPageListFacility {
   }
 }
 
-FacilityPageListFacilityType $FacilityPageListFacilityTypeFromJson(Map<String, dynamic> json) {
+FacilityPageListFacilityType $FacilityPageListFacilityTypeFromJson(
+    Map<String, dynamic> json) {
   final FacilityPageListFacilityType facilityPageListFacilityType = FacilityPageListFacilityType();
   final String? id = jsonConvert.convert<String>(json['id']);
   if (id != null) {
@@ -209,7 +223,8 @@ FacilityPageListFacilityType $FacilityPageListFacilityTypeFromJson(Map<String, d
   return facilityPageListFacilityType;
 }
 
-Map<String, dynamic> $FacilityPageListFacilityTypeToJson(FacilityPageListFacilityType entity) {
+Map<String, dynamic> $FacilityPageListFacilityTypeToJson(
+    FacilityPageListFacilityType entity) {
   final Map<String, dynamic> data = <String, dynamic>{};
   data['id'] = entity.id;
   data['name'] = entity.name;
@@ -227,7 +242,8 @@ extension FacilityPageListFacilityTypeExtension on FacilityPageListFacilityType
   }
 }
 
-FacilityPageListTimePeriod $FacilityPageListTimePeriodFromJson(Map<String, dynamic> json) {
+FacilityPageListTimePeriod $FacilityPageListTimePeriodFromJson(
+    Map<String, dynamic> json) {
   final FacilityPageListTimePeriod facilityPageListTimePeriod = FacilityPageListTimePeriod();
   final String? price = jsonConvert.convert<String>(json['price']);
   if (price != null) {
@@ -240,7 +256,8 @@ FacilityPageListTimePeriod $FacilityPageListTimePeriodFromJson(Map<String, dynam
   return facilityPageListTimePeriod;
 }
 
-Map<String, dynamic> $FacilityPageListTimePeriodToJson(FacilityPageListTimePeriod entity) {
+Map<String, dynamic> $FacilityPageListTimePeriodToJson(
+    FacilityPageListTimePeriod entity) {
   final Map<String, dynamic> data = <String, dynamic>{};
   data['price'] = entity.price;
   data['deposit'] = entity.deposit;
@@ -258,7 +275,8 @@ extension FacilityPageListTimePeriodExtension on FacilityPageListTimePeriod {
   }
 }
 
-FacilityPageListAccount $FacilityPageListAccountFromJson(Map<String, dynamic> json) {
+FacilityPageListAccount $FacilityPageListAccountFromJson(
+    Map<String, dynamic> json) {
   final FacilityPageListAccount facilityPageListAccount = FacilityPageListAccount();
   final String? id = jsonConvert.convert<String>(json['id']);
   if (id != null) {
@@ -271,7 +289,8 @@ FacilityPageListAccount $FacilityPageListAccountFromJson(Map<String, dynamic> js
   return facilityPageListAccount;
 }
 
-Map<String, dynamic> $FacilityPageListAccountToJson(FacilityPageListAccount entity) {
+Map<String, dynamic> $FacilityPageListAccountToJson(
+    FacilityPageListAccount entity) {
   final Map<String, dynamic> data = <String, dynamic>{};
   data['id'] = entity.id;
   data['name'] = entity.name;

+ 42 - 0
packages/cs_domain/lib/generated/json/rewards_category_entity.g.dart

@@ -0,0 +1,42 @@
+import 'package:domain/generated/json/base/json_convert_content.dart';
+import 'package:domain/entity/rewards_category_entity.dart';
+
+RewardsCategoryEntity $RewardsCategoryEntityFromJson(
+    Map<String, dynamic> json) {
+  final RewardsCategoryEntity rewardsCategoryEntity = RewardsCategoryEntity();
+  final int? id = jsonConvert.convert<int>(json['id']);
+  if (id != null) {
+    rewardsCategoryEntity.id = id;
+  }
+  final String? icon = jsonConvert.convert<String>(json['icon']);
+  if (icon != null) {
+    rewardsCategoryEntity.icon = icon;
+  }
+  final String? name = jsonConvert.convert<String>(json['name']);
+  if (name != null) {
+    rewardsCategoryEntity.name = name;
+  }
+  return rewardsCategoryEntity;
+}
+
+Map<String, dynamic> $RewardsCategoryEntityToJson(
+    RewardsCategoryEntity entity) {
+  final Map<String, dynamic> data = <String, dynamic>{};
+  data['id'] = entity.id;
+  data['icon'] = entity.icon;
+  data['name'] = entity.name;
+  return data;
+}
+
+extension RewardsCategoryEntityExtension on RewardsCategoryEntity {
+  RewardsCategoryEntity copyWith({
+    int? id,
+    String? icon,
+    String? name,
+  }) {
+    return RewardsCategoryEntity()
+      ..id = id ?? this.id
+      ..icon = icon ?? this.icon
+      ..name = name ?? this.name;
+  }
+}

+ 57 - 0
packages/cs_domain/lib/generated/json/rewards_history_earned_entity.g.dart

@@ -0,0 +1,57 @@
+import 'package:domain/generated/json/base/json_convert_content.dart';
+import 'package:domain/entity/rewards_history_earned_entity.dart';
+
+RewardsHistoryEarnedEntity $RewardsHistoryEarnedEntityFromJson(
+    Map<String, dynamic> json) {
+  final RewardsHistoryEarnedEntity rewardsHistoryEarnedEntity = RewardsHistoryEarnedEntity();
+  final int? count = jsonConvert.convert<int>(json['count']);
+  if (count != null) {
+    rewardsHistoryEarnedEntity.count = count;
+  }
+  final int? page = jsonConvert.convert<int>(json['page']);
+  if (page != null) {
+    rewardsHistoryEarnedEntity.page = page;
+  }
+  final int? limit = jsonConvert.convert<int>(json['limit']);
+  if (limit != null) {
+    rewardsHistoryEarnedEntity.limit = limit;
+  }
+  final int? countPage = jsonConvert.convert<int>(json['count_page']);
+  if (countPage != null) {
+    rewardsHistoryEarnedEntity.countPage = countPage;
+  }
+  final List<dynamic>? list = (json['list'] as List<dynamic>?)?.map(
+          (e) => e).toList();
+  if (list != null) {
+    rewardsHistoryEarnedEntity.list = list;
+  }
+  return rewardsHistoryEarnedEntity;
+}
+
+Map<String, dynamic> $RewardsHistoryEarnedEntityToJson(
+    RewardsHistoryEarnedEntity 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 RewardsHistoryEarnedEntityExtension on RewardsHistoryEarnedEntity {
+  RewardsHistoryEarnedEntity copyWith({
+    int? count,
+    int? page,
+    int? limit,
+    int? countPage,
+    List<dynamic>? list,
+  }) {
+    return RewardsHistoryEarnedEntity()
+      ..count = count ?? this.count
+      ..page = page ?? this.page
+      ..limit = limit ?? this.limit
+      ..countPage = countPage ?? this.countPage
+      ..list = list ?? this.list;
+  }
+}

+ 141 - 0
packages/cs_domain/lib/generated/json/rewards_home_entity.g.dart

@@ -0,0 +1,141 @@
+import 'package:domain/generated/json/base/json_convert_content.dart';
+import 'package:domain/entity/rewards_home_entity.dart';
+
+RewardsHomeEntity $RewardsHomeEntityFromJson(Map<String, dynamic> json) {
+  final RewardsHomeEntity rewardsHomeEntity = RewardsHomeEntity();
+  final List<RewardsHomeData>? data = (json['data'] as List<dynamic>?)
+      ?.map(
+          (e) => jsonConvert.convert<RewardsHomeData>(e) as RewardsHomeData)
+      .toList();
+  if (data != null) {
+    rewardsHomeEntity.data = data;
+  }
+  final String? message = jsonConvert.convert<String>(json['message']);
+  if (message != null) {
+    rewardsHomeEntity.message = message;
+  }
+  final int? code = jsonConvert.convert<int>(json['code']);
+  if (code != null) {
+    rewardsHomeEntity.code = code;
+  }
+  return rewardsHomeEntity;
+}
+
+Map<String, dynamic> $RewardsHomeEntityToJson(RewardsHomeEntity entity) {
+  final Map<String, dynamic> data = <String, dynamic>{};
+  data['data'] = entity.data.map((v) => v.toJson()).toList();
+  data['message'] = entity.message;
+  data['code'] = entity.code;
+  return data;
+}
+
+extension RewardsHomeEntityExtension on RewardsHomeEntity {
+  RewardsHomeEntity copyWith({
+    List<RewardsHomeData>? data,
+    String? message,
+    int? code,
+  }) {
+    return RewardsHomeEntity()
+      ..data = data ?? this.data
+      ..message = message ?? this.message
+      ..code = code ?? this.code;
+  }
+}
+
+RewardsHomeData $RewardsHomeDataFromJson(Map<String, dynamic> json) {
+  final RewardsHomeData rewardsHomeData = RewardsHomeData();
+  final int? id = jsonConvert.convert<int>(json['id']);
+  if (id != null) {
+    rewardsHomeData.id = id;
+  }
+  final String? name = jsonConvert.convert<String>(json['name']);
+  if (name != null) {
+    rewardsHomeData.name = name;
+  }
+  final List<RewardsHomeDataRewards>? rewards = (json['rewards'] as List<
+      dynamic>?)
+      ?.map(
+          (e) =>
+      jsonConvert.convert<RewardsHomeDataRewards>(e) as RewardsHomeDataRewards)
+      .toList();
+  if (rewards != null) {
+    rewardsHomeData.rewards = rewards;
+  }
+  return rewardsHomeData;
+}
+
+Map<String, dynamic> $RewardsHomeDataToJson(RewardsHomeData entity) {
+  final Map<String, dynamic> data = <String, dynamic>{};
+  data['id'] = entity.id;
+  data['name'] = entity.name;
+  data['rewards'] = entity.rewards.map((v) => v.toJson()).toList();
+  return data;
+}
+
+extension RewardsHomeDataExtension on RewardsHomeData {
+  RewardsHomeData copyWith({
+    int? id,
+    String? name,
+    List<RewardsHomeDataRewards>? rewards,
+  }) {
+    return RewardsHomeData()
+      ..id = id ?? this.id
+      ..name = name ?? this.name
+      ..rewards = rewards ?? this.rewards;
+  }
+}
+
+RewardsHomeDataRewards $RewardsHomeDataRewardsFromJson(
+    Map<String, dynamic> json) {
+  final RewardsHomeDataRewards rewardsHomeDataRewards = RewardsHomeDataRewards();
+  final int? id = jsonConvert.convert<int>(json['id']);
+  if (id != null) {
+    rewardsHomeDataRewards.id = id;
+  }
+  final String? name = jsonConvert.convert<String>(json['name']);
+  if (name != null) {
+    rewardsHomeDataRewards.name = name;
+  }
+  final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
+          (e) => jsonConvert.convert<String>(e) as String).toList();
+  if (resources != null) {
+    rewardsHomeDataRewards.resources = resources;
+  }
+  final int? originalPoint = jsonConvert.convert<int>(json['original_point']);
+  if (originalPoint != null) {
+    rewardsHomeDataRewards.originalPoint = originalPoint;
+  }
+  final int? point = jsonConvert.convert<int>(json['point']);
+  if (point != null) {
+    rewardsHomeDataRewards.point = point;
+  }
+  return rewardsHomeDataRewards;
+}
+
+Map<String, dynamic> $RewardsHomeDataRewardsToJson(
+    RewardsHomeDataRewards entity) {
+  final Map<String, dynamic> data = <String, dynamic>{};
+  data['id'] = entity.id;
+  data['name'] = entity.name;
+  data['resources'] = entity.resources;
+  data['original_point'] = entity.originalPoint;
+  data['point'] = entity.point;
+  return data;
+}
+
+extension RewardsHomeDataRewardsExtension on RewardsHomeDataRewards {
+  RewardsHomeDataRewards copyWith({
+    int? id,
+    String? name,
+    List<String>? resources,
+    int? originalPoint,
+    int? point,
+  }) {
+    return RewardsHomeDataRewards()
+      ..id = id ?? this.id
+      ..name = name ?? this.name
+      ..resources = resources ?? this.resources
+      ..originalPoint = originalPoint ?? this.originalPoint
+      ..point = point ?? this.point;
+  }
+}

+ 101 - 0
packages/cs_domain/lib/generated/json/rewards_home_tes_entity.g.dart

@@ -0,0 +1,101 @@
+import 'package:domain/generated/json/base/json_convert_content.dart';
+import 'package:domain/entity/rewards_home_tes_entity.dart';
+
+RewardsHomeTesEntity $RewardsHomeTesEntityFromJson(Map<String, dynamic> json) {
+  final RewardsHomeTesEntity rewardsHomeTesEntity = RewardsHomeTesEntity();
+  final double? id = jsonConvert.convert<double>(json['id']);
+  if (id != null) {
+    rewardsHomeTesEntity.id = id;
+  }
+  final String? name = jsonConvert.convert<String>(json['name']);
+  if (name != null) {
+    rewardsHomeTesEntity.name = name;
+  }
+  final List<RewardsHomeTesRewards>? rewards = (json['rewards'] as List<
+      dynamic>?)
+      ?.map(
+          (e) =>
+      jsonConvert.convert<RewardsHomeTesRewards>(e) as RewardsHomeTesRewards)
+      .toList();
+  if (rewards != null) {
+    rewardsHomeTesEntity.rewards = rewards;
+  }
+  return rewardsHomeTesEntity;
+}
+
+Map<String, dynamic> $RewardsHomeTesEntityToJson(RewardsHomeTesEntity entity) {
+  final Map<String, dynamic> data = <String, dynamic>{};
+  data['id'] = entity.id;
+  data['name'] = entity.name;
+  data['rewards'] = entity.rewards.map((v) => v.toJson()).toList();
+  return data;
+}
+
+extension RewardsHomeTesEntityExtension on RewardsHomeTesEntity {
+  RewardsHomeTesEntity copyWith({
+    double? id,
+    String? name,
+    List<RewardsHomeTesRewards>? rewards,
+  }) {
+    return RewardsHomeTesEntity()
+      ..id = id ?? this.id
+      ..name = name ?? this.name
+      ..rewards = rewards ?? this.rewards;
+  }
+}
+
+RewardsHomeTesRewards $RewardsHomeTesRewardsFromJson(
+    Map<String, dynamic> json) {
+  final RewardsHomeTesRewards rewardsHomeTesRewards = RewardsHomeTesRewards();
+  final double? id = jsonConvert.convert<double>(json['id']);
+  if (id != null) {
+    rewardsHomeTesRewards.id = id;
+  }
+  final String? name = jsonConvert.convert<String>(json['name']);
+  if (name != null) {
+    rewardsHomeTesRewards.name = name;
+  }
+  final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
+          (e) => jsonConvert.convert<String>(e) as String).toList();
+  if (resources != null) {
+    rewardsHomeTesRewards.resources = resources;
+  }
+  final double? originalPoint = jsonConvert.convert<double>(
+      json['original_point']);
+  if (originalPoint != null) {
+    rewardsHomeTesRewards.originalPoint = originalPoint;
+  }
+  final double? point = jsonConvert.convert<double>(json['point']);
+  if (point != null) {
+    rewardsHomeTesRewards.point = point;
+  }
+  return rewardsHomeTesRewards;
+}
+
+Map<String, dynamic> $RewardsHomeTesRewardsToJson(
+    RewardsHomeTesRewards entity) {
+  final Map<String, dynamic> data = <String, dynamic>{};
+  data['id'] = entity.id;
+  data['name'] = entity.name;
+  data['resources'] = entity.resources;
+  data['original_point'] = entity.originalPoint;
+  data['point'] = entity.point;
+  return data;
+}
+
+extension RewardsHomeTesRewardsExtension on RewardsHomeTesRewards {
+  RewardsHomeTesRewards copyWith({
+    double? id,
+    String? name,
+    List<String>? resources,
+    double? originalPoint,
+    double? point,
+  }) {
+    return RewardsHomeTesRewards()
+      ..id = id ?? this.id
+      ..name = name ?? this.name
+      ..resources = resources ?? this.resources
+      ..originalPoint = originalPoint ?? this.originalPoint
+      ..point = point ?? this.point;
+  }
+}

+ 43 - 0
packages/cs_domain/lib/generated/json/rewards_home_test_entity.g.dart

@@ -0,0 +1,43 @@
+import 'package:domain/generated/json/base/json_convert_content.dart';
+import 'package:domain/entity/rewards_home_test_entity.dart';
+
+RewardsHomeTestEntity $RewardsHomeTestEntityFromJson(
+    Map<String, dynamic> json) {
+  final RewardsHomeTestEntity rewardsHomeTestEntity = RewardsHomeTestEntity();
+  final int? id = jsonConvert.convert<int>(json['id']);
+  if (id != null) {
+    rewardsHomeTestEntity.id = id;
+  }
+  final String? name = jsonConvert.convert<String>(json['name']);
+  if (name != null) {
+    rewardsHomeTestEntity.name = name;
+  }
+  final List<dynamic>? rewards = (json['rewards'] as List<dynamic>?)?.map(
+          (e) => e).toList();
+  if (rewards != null) {
+    rewardsHomeTestEntity.rewards = rewards;
+  }
+  return rewardsHomeTestEntity;
+}
+
+Map<String, dynamic> $RewardsHomeTestEntityToJson(
+    RewardsHomeTestEntity entity) {
+  final Map<String, dynamic> data = <String, dynamic>{};
+  data['id'] = entity.id;
+  data['name'] = entity.name;
+  data['rewards'] = entity.rewards;
+  return data;
+}
+
+extension RewardsHomeTestEntityExtension on RewardsHomeTestEntity {
+  RewardsHomeTestEntity copyWith({
+    int? id,
+    String? name,
+    List<dynamic>? rewards,
+  }) {
+    return RewardsHomeTestEntity()
+      ..id = id ?? this.id
+      ..name = name ?? this.name
+      ..rewards = rewards ?? this.rewards;
+  }
+}

+ 41 - 0
packages/cs_domain/lib/generated/json/rewards_home_tx_entity.g.dart

@@ -0,0 +1,41 @@
+import 'package:domain/generated/json/base/json_convert_content.dart';
+import 'package:domain/entity/rewards_home_tx_entity.dart';
+
+RewardsHomeTxEntity $RewardsHomeTxEntityFromJson(Map<String, dynamic> json) {
+  final RewardsHomeTxEntity rewardsHomeTxEntity = RewardsHomeTxEntity();
+  final double? id = jsonConvert.convert<double>(json['id']);
+  if (id != null) {
+    rewardsHomeTxEntity.id = id;
+  }
+  final String? name = jsonConvert.convert<String>(json['name']);
+  if (name != null) {
+    rewardsHomeTxEntity.name = name;
+  }
+  final List<dynamic>? rewards = (json['rewards'] as List<dynamic>?)?.map(
+          (e) => e).toList();
+  if (rewards != null) {
+    rewardsHomeTxEntity.rewards = rewards;
+  }
+  return rewardsHomeTxEntity;
+}
+
+Map<String, dynamic> $RewardsHomeTxEntityToJson(RewardsHomeTxEntity entity) {
+  final Map<String, dynamic> data = <String, dynamic>{};
+  data['id'] = entity.id;
+  data['name'] = entity.name;
+  data['rewards'] = entity.rewards;
+  return data;
+}
+
+extension RewardsHomeTxEntityExtension on RewardsHomeTxEntity {
+  RewardsHomeTxEntity copyWith({
+    double? id,
+    String? name,
+    List<dynamic>? rewards,
+  }) {
+    return RewardsHomeTxEntity()
+      ..id = id ?? this.id
+      ..name = name ?? this.name
+      ..rewards = rewards ?? this.rewards;
+  }
+}

+ 124 - 0
packages/cs_domain/lib/generated/json/rewards_index_entity.g.dart

@@ -0,0 +1,124 @@
+import 'package:domain/generated/json/base/json_convert_content.dart';
+import 'package:domain/entity/rewards_index_entity.dart';
+
+RewardsIndexEntity $RewardsIndexEntityFromJson(Map<String, dynamic> json) {
+  final RewardsIndexEntity rewardsIndexEntity = RewardsIndexEntity();
+  final int? points = jsonConvert.convert<int>(json['points']);
+  if (points != null) {
+    rewardsIndexEntity.points = points;
+  }
+  final RewardsIndexContinuous? continuous = jsonConvert.convert<
+      RewardsIndexContinuous>(json['continuous']);
+  if (continuous != null) {
+    rewardsIndexEntity.continuous = continuous;
+  }
+  final RewardsIndexTasks? tasks = jsonConvert.convert<RewardsIndexTasks>(
+      json['tasks']);
+  if (tasks != null) {
+    rewardsIndexEntity.tasks = tasks;
+  }
+  final List<dynamic>? latest = (json['latest'] as List<dynamic>?)?.map(
+          (e) => e).toList();
+  if (latest != null) {
+    rewardsIndexEntity.latest = latest;
+  }
+  return rewardsIndexEntity;
+}
+
+Map<String, dynamic> $RewardsIndexEntityToJson(RewardsIndexEntity entity) {
+  final Map<String, dynamic> data = <String, dynamic>{};
+  data['points'] = entity.points;
+  data['continuous'] = entity.continuous.toJson();
+  data['tasks'] = entity.tasks.toJson();
+  data['latest'] = entity.latest;
+  return data;
+}
+
+extension RewardsIndexEntityExtension on RewardsIndexEntity {
+  RewardsIndexEntity copyWith({
+    int? points,
+    RewardsIndexContinuous? continuous,
+    RewardsIndexTasks? tasks,
+    List<dynamic>? latest,
+  }) {
+    return RewardsIndexEntity()
+      ..points = points ?? this.points
+      ..continuous = continuous ?? this.continuous
+      ..tasks = tasks ?? this.tasks
+      ..latest = latest ?? this.latest;
+  }
+}
+
+RewardsIndexContinuous $RewardsIndexContinuousFromJson(
+    Map<String, dynamic> json) {
+  final RewardsIndexContinuous rewardsIndexContinuous = RewardsIndexContinuous();
+  final int? count = jsonConvert.convert<int>(json['count']);
+  if (count != null) {
+    rewardsIndexContinuous.count = count;
+  }
+  final List<
+      dynamic>? currentWeekCheckin = (json['current_week_checkin'] as List<
+      dynamic>?)?.map(
+          (e) => e).toList();
+  if (currentWeekCheckin != null) {
+    rewardsIndexContinuous.currentWeekCheckin = currentWeekCheckin;
+  }
+  return rewardsIndexContinuous;
+}
+
+Map<String, dynamic> $RewardsIndexContinuousToJson(
+    RewardsIndexContinuous entity) {
+  final Map<String, dynamic> data = <String, dynamic>{};
+  data['count'] = entity.count;
+  data['current_week_checkin'] = entity.currentWeekCheckin;
+  return data;
+}
+
+extension RewardsIndexContinuousExtension on RewardsIndexContinuous {
+  RewardsIndexContinuous copyWith({
+    int? count,
+    List<dynamic>? currentWeekCheckin,
+  }) {
+    return RewardsIndexContinuous()
+      ..count = count ?? this.count
+      ..currentWeekCheckin = currentWeekCheckin ?? this.currentWeekCheckin;
+  }
+}
+
+RewardsIndexTasks $RewardsIndexTasksFromJson(Map<String, dynamic> json) {
+  final RewardsIndexTasks rewardsIndexTasks = RewardsIndexTasks();
+  final bool? dailyCheckin = jsonConvert.convert<bool>(json['daily_checkin']);
+  if (dailyCheckin != null) {
+    rewardsIndexTasks.dailyCheckin = dailyCheckin;
+  }
+  final bool? newsFeedPost = jsonConvert.convert<bool>(json['news_feed_post']);
+  if (newsFeedPost != null) {
+    rewardsIndexTasks.newsFeedPost = newsFeedPost;
+  }
+  final int? give10Likes = jsonConvert.convert<int>(json['give_10_likes']);
+  if (give10Likes != null) {
+    rewardsIndexTasks.give10Likes = give10Likes;
+  }
+  return rewardsIndexTasks;
+}
+
+Map<String, dynamic> $RewardsIndexTasksToJson(RewardsIndexTasks entity) {
+  final Map<String, dynamic> data = <String, dynamic>{};
+  data['daily_checkin'] = entity.dailyCheckin;
+  data['news_feed_post'] = entity.newsFeedPost;
+  data['give_10_likes'] = entity.give10Likes;
+  return data;
+}
+
+extension RewardsIndexTasksExtension on RewardsIndexTasks {
+  RewardsIndexTasks copyWith({
+    bool? dailyCheckin,
+    bool? newsFeedPost,
+    int? give10Likes,
+  }) {
+    return RewardsIndexTasks()
+      ..dailyCheckin = dailyCheckin ?? this.dailyCheckin
+      ..newsFeedPost = newsFeedPost ?? this.newsFeedPost
+      ..give10Likes = give10Likes ?? this.give10Likes;
+  }
+}

+ 110 - 0
packages/cs_domain/lib/generated/json/rewards_list_entity.g.dart

@@ -0,0 +1,110 @@
+import 'package:domain/generated/json/base/json_convert_content.dart';
+import 'package:domain/entity/rewards_list_entity.dart';
+
+RewardsListEntity $RewardsListEntityFromJson(Map<String, dynamic> json) {
+  final RewardsListEntity rewardsListEntity = RewardsListEntity();
+  final int? count = jsonConvert.convert<int>(json['count']);
+  if (count != null) {
+    rewardsListEntity.count = count;
+  }
+  final int? page = jsonConvert.convert<int>(json['page']);
+  if (page != null) {
+    rewardsListEntity.page = page;
+  }
+  final int? limit = jsonConvert.convert<int>(json['limit']);
+  if (limit != null) {
+    rewardsListEntity.limit = limit;
+  }
+  final int? countPage = jsonConvert.convert<int>(json['count_page']);
+  if (countPage != null) {
+    rewardsListEntity.countPage = countPage;
+  }
+  final List<RewardsListList>? list = (json['list'] as List<dynamic>?)
+      ?.map(
+          (e) => jsonConvert.convert<RewardsListList>(e) as RewardsListList)
+      .toList();
+  if (list != null) {
+    rewardsListEntity.list = list;
+  }
+  return rewardsListEntity;
+}
+
+Map<String, dynamic> $RewardsListEntityToJson(RewardsListEntity 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 RewardsListEntityExtension on RewardsListEntity {
+  RewardsListEntity copyWith({
+    int? count,
+    int? page,
+    int? limit,
+    int? countPage,
+    List<RewardsListList>? list,
+  }) {
+    return RewardsListEntity()
+      ..count = count ?? this.count
+      ..page = page ?? this.page
+      ..limit = limit ?? this.limit
+      ..countPage = countPage ?? this.countPage
+      ..list = list ?? this.list;
+  }
+}
+
+RewardsListList $RewardsListListFromJson(Map<String, dynamic> json) {
+  final RewardsListList rewardsListList = RewardsListList();
+  final int? id = jsonConvert.convert<int>(json['id']);
+  if (id != null) {
+    rewardsListList.id = id;
+  }
+  final String? name = jsonConvert.convert<String>(json['name']);
+  if (name != null) {
+    rewardsListList.name = name;
+  }
+  final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
+          (e) => jsonConvert.convert<String>(e) as String).toList();
+  if (resources != null) {
+    rewardsListList.resources = resources;
+  }
+  final int? originalPoint = jsonConvert.convert<int>(json['original_point']);
+  if (originalPoint != null) {
+    rewardsListList.originalPoint = originalPoint;
+  }
+  final int? point = jsonConvert.convert<int>(json['point']);
+  if (point != null) {
+    rewardsListList.point = point;
+  }
+  return rewardsListList;
+}
+
+Map<String, dynamic> $RewardsListListToJson(RewardsListList entity) {
+  final Map<String, dynamic> data = <String, dynamic>{};
+  data['id'] = entity.id;
+  data['name'] = entity.name;
+  data['resources'] = entity.resources;
+  data['original_point'] = entity.originalPoint;
+  data['point'] = entity.point;
+  return data;
+}
+
+extension RewardsListListExtension on RewardsListList {
+  RewardsListList copyWith({
+    int? id,
+    String? name,
+    List<String>? resources,
+    int? originalPoint,
+    int? point,
+  }) {
+    return RewardsListList()
+      ..id = id ?? this.id
+      ..name = name ?? this.name
+      ..resources = resources ?? this.resources
+      ..originalPoint = originalPoint ?? this.originalPoint
+      ..point = point ?? this.point;
+  }
+}

+ 15 - 0
packages/cs_domain/lib/generated/json/text_kon_entity.g.dart

@@ -0,0 +1,15 @@
+import 'package:domain/generated/json/base/json_convert_content.dart';
+import 'package:domain/entity/text_kon_entity.dart';
+
+TextKonEntity $TextKonEntityFromJson(Map<String, dynamic> json) {
+  final TextKonEntity textKonEntity = TextKonEntity();
+  return textKonEntity;
+}
+
+Map<String, dynamic> $TextKonEntityToJson(TextKonEntity entity) {
+  final Map<String, dynamic> data = <String, dynamic>{};
+  return data;
+}
+
+extension TextKonEntityExtension on TextKonEntity {
+}

+ 3 - 0
packages/cs_domain/pubspec.yaml

@@ -58,4 +58,7 @@ dev_dependencies:
 
 flutter:
   uses-material-design: true
+  assets:
+    - lib/entity/
+
 

BIN
packages/cs_resources/assets/rewards/reward_list_choose.png


BIN
packages/cs_resources/assets/rewards/reward_list_high.png


BIN
packages/cs_resources/assets/rewards/reward_list_hot.png


BIN
packages/cs_resources/assets/rewards/reward_list_low.png


BIN
packages/cs_resources/assets/rewards/reward_list_new.png


+ 5 - 0
packages/cs_resources/lib/generated/assets.dart

@@ -190,6 +190,11 @@ class Assets {
   static const String propertyRefinancing = 'assets/property/refinancing.webp';
   static const String propertyRent = 'assets/property/rent.webp';
   static const String propertySale = 'assets/property/sale.webp';
+  static const String rewardsRewardListChoose = 'assets/rewards/reward_list_choose.png';
+  static const String rewardsRewardListHigh = 'assets/rewards/reward_list_high.png';
+  static const String rewardsRewardListHot = 'assets/rewards/reward_list_hot.png';
+  static const String rewardsRewardListLow = 'assets/rewards/reward_list_low.png';
+  static const String rewardsRewardListNew = 'assets/rewards/reward_list_new.png';
   static const String rewardsRewardsBack = 'assets/rewards/rewards_back.png';
   static const String rewardsRewardsDetailDay = 'assets/rewards/rewards_detail_day.png';
   static const String rewardsRewardsDetailDeal = 'assets/rewards/rewards_detail_deal.png';