Bläddra i källkod

Merge remote-tracking branch 'origin/dev' into dev

liukai 4 dagar sedan
förälder
incheckning
e2b1624b32
100 ändrade filer med 3631 tillägg och 1466 borttagningar
  1. 69 0
      packages/cpt_community/lib/components/garage_card_content.dart
  2. 111 0
      packages/cpt_community/lib/components/garage_card_footer.dart
  3. 149 0
      packages/cpt_community/lib/components/garage_card_header.dart
  4. 80 51
      packages/cpt_community/lib/modules/community/community_page.dart
  5. 6 10
      packages/cpt_community/lib/modules/community/community_state.dart
  6. 13 22
      packages/cpt_community/lib/modules/community/community_vm.dart
  7. 1 1
      packages/cpt_community/lib/modules/community/community_vm.g.dart
  8. 37 6
      packages/cpt_community/lib/modules/community/foryou/foryou_page.dart
  9. 9 9
      packages/cpt_community/lib/modules/newsfeed/newsfeed_repository.dart
  10. 9 10
      packages/cpt_community/lib/modules/garagesale/garagesale_repository.g.dart
  11. 22 0
      packages/cpt_community/lib/modules/community/foryou/foryou_state.dart
  12. 91 5
      packages/cpt_community/lib/modules/community/foryou/foryou_vm.dart
  13. 1 1
      packages/cpt_community/lib/modules/community/foryou/foryou_vm.g.dart
  14. 17 66
      packages/cpt_community/lib/modules/community/news/news_page.dart
  15. 9 9
      packages/cpt_community/lib/modules/garagesale/garagesale_repository.dart
  16. 27 0
      packages/cpt_community/lib/modules/community/news/news_respository.g.dart
  17. 22 0
      packages/cpt_community/lib/modules/community/news/news_state.dart
  18. 8 19
      packages/cpt_community/lib/modules/community/news/news_vm.dart
  19. 1 1
      packages/cpt_community/lib/modules/community/news/news_vm.g.dart
  20. 6 5
      packages/cpt_community/lib/modules/newsfeed/newsfeed_detail/newsfeed_detail_page.dart
  21. 0 0
      packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_state.dart
  22. 0 0
      packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_vm.dart
  23. 0 0
      packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_vm.g.dart
  24. 0 0
      packages/cpt_community/lib/modules/community/newsfeed_myposts/newsfeed_myposts_page.dart
  25. 0 0
      packages/cpt_community/lib/modules/community/newsfeed_post/newsfeed_post_page.dart
  26. 0 0
      packages/cpt_community/lib/modules/community/newsfeed_post/newsfeed_post_page_state.dart
  27. 0 0
      packages/cpt_community/lib/modules/community/newsfeed_post/newsfeed_post_vm.dart
  28. 0 0
      packages/cpt_community/lib/modules/community/newsfeed_post/newsfeed_post_vm.g.dart
  29. 13 9
      packages/cpt_community/lib/modules/newsfeed/newsfeed_tabs.dart
  30. 0 159
      packages/cpt_community/lib/modules/community1/community_page.dart
  31. 0 51
      packages/cpt_community/lib/modules/community1/community_state.dart
  32. 0 62
      packages/cpt_community/lib/modules/community1/community_vm.dart
  33. 80 0
      packages/cpt_community/lib/modules/garage/for_rent/for_rent_page.dart
  34. 71 0
      packages/cpt_community/lib/modules/garage/for_rent/for_rent_respository.dart
  35. 27 0
      packages/cpt_community/lib/modules/garage/for_rent/for_rent_respository.g.dart
  36. 57 0
      packages/cpt_community/lib/modules/garage/for_rent/for_rent_state.dart
  37. 196 241
      packages/cpt_community/lib/modules/newsfeed/newsfeed_vm.dart
  38. 10 10
      packages/cpt_community/lib/modules/community1/community_vm.g.dart
  39. 138 0
      packages/cpt_community/lib/modules/garage/for_sale/for_sale_page.dart
  40. 71 0
      packages/cpt_community/lib/modules/garage/for_sale/for_sale_respository.dart
  41. 27 0
      packages/cpt_community/lib/modules/garage/for_sale/for_sale_respository.g.dart
  42. 57 0
      packages/cpt_community/lib/modules/garage/for_sale/for_sale_state.dart
  43. 185 0
      packages/cpt_community/lib/modules/garage/for_sale/for_sale_vm.dart
  44. 25 0
      packages/cpt_community/lib/modules/garage/for_sale/for_sale_vm.g.dart
  45. 112 69
      packages/cpt_community/lib/modules/garagesale/garagesale_page.dart
  46. 71 0
      packages/cpt_community/lib/modules/garage/garage_repository.dart
  47. 27 0
      packages/cpt_community/lib/modules/garage/garage_repository.g.dart
  48. 19 21
      packages/cpt_community/lib/modules/garagesale/garagesale_state.dart
  49. 17 17
      packages/cpt_community/lib/modules/garagesale/garagesale_tabs.dart
  50. 43 21
      packages/cpt_community/lib/modules/garagesale/garagesale_vm.dart
  51. 10 10
      packages/cpt_community/lib/modules/garagesale/garagesale_vm.g.dart
  52. 8 5
      packages/cpt_community/lib/modules/garagesale/garagesale_detail/garagesale_detail_page.dart
  53. 0 0
      packages/cpt_community/lib/modules/garage/garagesale_myposts/garagesale_myposts_page.dart
  54. 0 0
      packages/cpt_community/lib/modules/garage/garagesale_post/garagesale_post_page.dart
  55. 0 0
      packages/cpt_community/lib/modules/garage/garagesale_post/garagesale_post_state.dart
  56. 0 0
      packages/cpt_community/lib/modules/garage/garagesale_post/garagesale_post_vm.dart
  57. 0 0
      packages/cpt_community/lib/modules/garage/garagesale_post/garagesale_post_vm.g.dart
  58. 0 269
      packages/cpt_community/lib/modules/newsfeed/newsfeed_page.dart
  59. 0 69
      packages/cpt_community/lib/modules/newsfeed/newsfeed_state.dart
  60. 33 28
      packages/cpt_community/lib/router/page/community_page_router.dart
  61. 105 44
      packages/cpt_community/lib/router/page/community_page_router.gr.dart
  62. 3 1
      packages/cpt_notice_board/lib/modules/documents/page/documents_page.dart
  63. 154 0
      packages/cpt_notice_board/lib/modules/documents_list/page/documents_list_page.dart
  64. 49 0
      packages/cpt_notice_board/lib/modules/documents_list/page/documents_list_state.dart
  65. 70 0
      packages/cpt_notice_board/lib/modules/documents_list/repository/documents_list_repository.dart
  66. 28 0
      packages/cpt_notice_board/lib/modules/documents_list/repository/documents_list_repository.g.dart
  67. 105 0
      packages/cpt_notice_board/lib/modules/documents_list/vm/documents_list_vm.dart
  68. 25 0
      packages/cpt_notice_board/lib/modules/documents_list/vm/documents_list_vm.g.dart
  69. 6 1
      packages/cpt_notice_board/lib/modules/event/page/event_page.dart
  70. 121 0
      packages/cpt_notice_board/lib/modules/event_detail/page/event_detail_page.dart
  71. 49 0
      packages/cpt_notice_board/lib/modules/event_detail/page/event_detail_state.dart
  72. 70 0
      packages/cpt_notice_board/lib/modules/event_detail/repository/event_detail_repository.dart
  73. 28 0
      packages/cpt_notice_board/lib/modules/event_detail/repository/event_detail_repository.g.dart
  74. 105 0
      packages/cpt_notice_board/lib/modules/event_detail/vm/event_detail_vm.dart
  75. 10 10
      packages/cpt_services/lib/modules/services/vm/services_view_model.g.dart
  76. 0 71
      packages/cpt_notice_board/lib/modules/notice_board/page/notice_board_page.dart
  77. 1 1
      packages/cpt_notice_board/lib/modules/notice_board/vm/notice_board_view_model.dart
  78. 1 1
      packages/cpt_notice_board/lib/modules/notice_board/vm/notice_board_view_model.g.dart
  79. 12 0
      packages/cpt_notice_board/lib/router/page/notice_board_page_router.dart
  80. 40 0
      packages/cpt_notice_board/lib/router/page/notice_board_page_router.gr.dart
  81. 17 10
      packages/cpt_property/lib/modules/news/page/property_news_page.dart
  82. 2 2
      packages/cpt_property/lib/modules/rent/page/property_rent_page.dart
  83. 122 0
      packages/cpt_services/lib/modules/services/dialog/account_deactivation_dialog.dart
  84. 0 33
      packages/cpt_services/lib/modules/services/page/services_page.dart
  85. 206 0
      packages/cpt_services/lib/modules/services/services_page.dart
  86. 70 0
      packages/cpt_services/lib/modules/services/services_repository.dart
  87. 10 10
      packages/cpt_community/lib/modules/newsfeed/newsfeed_repository.g.dart
  88. 50 0
      packages/cpt_services/lib/modules/services/services_state.dart
  89. 175 0
      packages/cpt_services/lib/modules/services/services_view_model.dart
  90. 10 10
      packages/cpt_community/lib/modules/newsfeed/newsfeed_vm.g.dart
  91. 0 14
      packages/cpt_services/lib/modules/services/vm/services_view_model.dart
  92. 1 1
      packages/cpt_services/lib/router/component/services_component_service.dart
  93. 1 1
      packages/cpt_services/lib/router/page/services_page_router.dart
  94. BIN
      packages/cs_resources/assets/service/service_icon_1.png
  95. BIN
      packages/cs_resources/assets/service/service_icon_10.png
  96. BIN
      packages/cs_resources/assets/service/service_icon_11.png
  97. BIN
      packages/cs_resources/assets/service/service_icon_12.png
  98. BIN
      packages/cs_resources/assets/service/service_icon_13.png
  99. BIN
      packages/cs_resources/assets/service/service_icon_14.png
  100. 0 0
      packages/cs_resources/assets/service/service_icon_2.png

+ 69 - 0
packages/cpt_community/lib/components/garage_card_content.dart

@@ -0,0 +1,69 @@
+import 'package:flutter/material.dart';
+import 'package:flutter/widgets.dart';
+import 'package:shared/utils/color_utils.dart';
+import 'package:widgets/my_text_view.dart';
+
+// 'id':1,
+// 'avator': Assets.communityCamera,
+// 'title': 'William Jefferson',
+// 'isFollow': false,
+// 'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+// 'imageUrls': ['https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg'],
+// 'time': 'June 17,2016 at 7:23 p.m.',
+// 'likeno': 12
+
+class GarageCardContent extends StatelessWidget {
+  const GarageCardContent({
+    Key? key,
+    required this.content,
+    this.imageUrls,
+  }) : super(key: key);
+
+  final String content;
+  final List? imageUrls;
+
+  @override
+  Widget build(BuildContext context) {
+    return Container(
+      padding: const EdgeInsets.symmetric(horizontal: 16),
+      child: Column(
+          children: [
+            Expanded(
+              child: Container(
+                // color: Colors.red,
+                child: MyTextView(
+                  content,
+                  textColor: ColorUtils.string2Color('#000000'),
+                  fontSize: 15,
+                  maxLines: 3,
+                  isTextEllipsis: true,
+                ),
+              ),
+            ),
+            const SizedBox(height: 12),
+            // 图片
+            if (imageUrls != null && imageUrls!.isNotEmpty)
+              Container(
+                width: double.infinity,
+                height: 87,
+                child: Row(
+                  mainAxisAlignment: MainAxisAlignment.center,
+                  children: [
+                    for (var item in imageUrls!)
+                      Expanded(
+                        child: Container(
+                          // width: 87,
+                          // height: 87,
+                          // margin: const EdgeInsets.only(right: 30),
+                          margin: const EdgeInsets.only(left: 15,right: 18),
+                          color: ColorUtils.string2Color("#F2F3F6"),
+                        ),
+                      )
+                  ],
+                ),
+              )
+          ]
+      ),
+    );
+  }
+}

+ 111 - 0
packages/cpt_community/lib/components/garage_card_footer.dart

@@ -0,0 +1,111 @@
+import 'package:cpt_community/components/newfeed_card_header.dart';
+import 'package:cs_resources/generated/assets.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter/widgets.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/my_load_image.dart';
+import 'package:widgets/my_text_view.dart';
+
+// 'id':1,
+// 'avator': Assets.communityCamera,
+// 'title': 'William Jefferson',
+// 'isFollow': false,
+// 'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+// 'imageUrls': ['https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg'],
+// 'time': 'June 17,2016 at 7:23 p.m.',
+// 'likeno': 12
+
+class GarageCardFooter extends StatelessWidget {
+  final bool isLike;
+  final VoidCallback? onLike;
+  final VoidCallback? onComment;
+  final VoidCallback? onShare;
+
+  const GarageCardFooter({
+    Key? key,
+    required this.isLike,
+    this.onLike,
+    this.onComment,
+    this.onShare
+  })
+      : super(key: key);
+
+  @override
+  Widget build(BuildContext context) {
+    return Container(
+        height: 40,
+        width: double.infinity,
+        padding: const EdgeInsets.symmetric(horizontal: 16),
+        // color: Colors.red,
+        child: Expanded(
+          child:  Row(
+              mainAxisAlignment: MainAxisAlignment.spaceBetween,
+              children: [
+                Container(
+                  height: 40,
+                  padding: const EdgeInsets.all(8),
+                  child: Row(
+                    children: [
+                      const MyAssetImage(Assets.communityLike, width: 16,height: 16,),
+                      MyTextView(
+                        'Like',
+                        textColor: ColorUtils.string2Color('#767676'),
+                        fontSize: 14,
+                        isFontRegular: true,
+                        textAlign: TextAlign.left,
+                        marginLeft: 8,
+                      ),
+                    ],
+                  ),
+                ).onTap((){
+                  Log.d("点击了like");
+                  onLike?.call();
+                }),
+                Container(
+                  height: 40,
+                  padding: const EdgeInsets.all(8),
+                  child: Row(
+                    children: [
+                      const MyAssetImage(Assets.communityComments, width: 16,height: 16,),
+                      MyTextView(
+                        'Comments',
+                        textColor: ColorUtils.string2Color('#767676'),
+                        fontSize: 14,
+                        isFontRegular: true,
+                        textAlign: TextAlign.left,
+                        marginLeft: 8,
+                      ),
+                    ],
+                  ),
+                ).onTap((){
+                  Log.d("点击了comments");
+                  onComment?.call();
+                }),
+                Container(
+                  height: 40,
+                  padding: const EdgeInsets.all(8),
+                  child: Row(
+                    children: [
+                      const MyAssetImage(Assets.communityShare, width: 16,height: 16,),
+                      MyTextView(
+                        'Share',
+                        textColor: ColorUtils.string2Color('#767676'),
+                        fontSize: 14,
+                        isFontRegular: true,
+                        textAlign: TextAlign.left,
+                        marginLeft: 8,
+                      ),
+                    ],
+                  ),
+                ).onTap((){
+                  Log.d("点击了share");
+                  onShare?.call();
+                }),
+              ]
+          ),
+        )
+    );
+  }
+}

+ 149 - 0
packages/cpt_community/lib/components/garage_card_header.dart

@@ -0,0 +1,149 @@
+import 'package:cs_resources/generated/assets.dart';
+import 'package:cs_resources/theme/app_colors_theme.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter/widgets.dart';
+import 'package:flutter_hooks/flutter_hooks.dart';
+import 'package:hooks_riverpod/hooks_riverpod.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/my_load_image.dart';
+import 'package:widgets/my_text_view.dart';
+
+import '../modules/garage/for_sale/for_sale_vm.dart';
+
+// 'id':1,
+// 'goods_img':  'https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg',
+// 'title': 'Electronic keyboard',
+// 'price': '\$66',
+// 'isCollection': true,
+// 'collection_num': '12',
+// 'publisher': 'William Jefferson',
+// 'publish_time': 'June 17,2016 at 7:23 p.m.',
+// 'publisher_avator': Assets.communityCamera,'
+
+
+
+
+
+class GarageCardHeader extends StatelessWidget {
+  Map<String, dynamic> itemObj;
+  final Function()? onTap;
+
+  GarageCardHeader({
+    Key? key,
+    required this.itemObj,
+    this.onTap,
+  }) : super(key: key);
+
+
+
+  @override
+  Widget build(BuildContext context) {
+    return Column(
+      children: [
+        Row(
+          mainAxisAlignment: MainAxisAlignment.center,
+          crossAxisAlignment: CrossAxisAlignment.center,
+          children: [
+            Expanded(
+              child: MyLoadImage(
+                itemObj['goods_img'],
+                width: 166.5,
+                height: 102.5,
+                isCircle: false,
+                fit: BoxFit.cover,
+              ).onTap(() {
+                // 点击头像
+                // onTap?.call();
+              }),
+            ),
+          ],
+        ),
+        Row(
+          mainAxisAlignment: MainAxisAlignment.center,
+          children: [
+            Expanded(
+              child: MyTextView(
+                itemObj['title'],
+                maxLines: 1,
+                isTextEllipsis: true,
+                textAlign: TextAlign.center,
+                textColor: context.appColors.textBlack,
+                fontSize: 16,
+                isFontRegular: true,
+                marginLeft: 12,
+                marginRight: 12,
+              ),
+            ),
+          ],
+        ),
+        Row(
+          mainAxisAlignment: MainAxisAlignment.spaceAround,
+          crossAxisAlignment: CrossAxisAlignment.center,
+          children: [
+            Expanded(
+              child: MyTextView(
+                itemObj['price'],
+                maxLines: 1,
+                isTextEllipsis: true,
+                textAlign: TextAlign.start,
+                textColor: ColorUtils.string2Color('#4161D0'),
+                fontSize: 18,
+                isFontMedium: true,
+              ),
+            ),
+            // 动态的 收藏数
+            CollectionWidget(collectionNum: itemObj['collection_num'], isCollection: itemObj['isCollection']),
+          ],
+        ),
+      ],
+    );
+  }
+}
+
+
+
+class CollectionWidget extends HookConsumerWidget {
+  int collectionNum = 0;
+  bool isCollection = false;
+  CollectionWidget({
+    Key? key,
+    required this.collectionNum,
+    required this.isCollection,
+  }) : super(key: key);
+  @override
+  Widget build(BuildContext context, WidgetRef ref) {
+    final collectionNumState = useState(collectionNum);
+    final isCollectionState = useState(isCollection);
+
+    return Container(
+      width: 60,
+      height: 30,
+      alignment: Alignment.center,
+      decoration: BoxDecoration(
+        color: ColorUtils.string2Color('#E5E5E5'),
+        borderRadius: BorderRadius.circular(15),
+      ),
+      child: Row(
+        mainAxisAlignment: MainAxisAlignment.center,
+        children: [
+          MyTextView(
+            '${collectionNumState.value}',
+            textColor: ColorUtils.string2Color('#999999'),
+            fontSize: 14,
+            isFontRegular: true,
+          ),
+          MyLoadImage(
+            isCollectionState.value? Assets.communityLikeActive: Assets.communityLike,
+            width: 14,
+            height: 14,
+          )
+        ]
+      ).onTap((){
+        // 点击 收餐/取消收藏
+        Log.d("点击了收藏按钮");
+      })
+    );
+  }
+}

+ 80 - 51
packages/cpt_community/lib/modules/community/community_page.dart

@@ -16,7 +16,7 @@ import 'package:cs_resources/theme/app_colors_theme.dart';
 import 'package:widgets/widget_export.dart';
 
 import '../../router/page/community_page_router.dart';
-import '../newsfeed/newsfeed_tabs.dart';
+import 'newsfeed_tabs.dart';
 import 'community_vm.dart';
 import 'customSilverHeaderTabs.dart';
 
@@ -33,13 +33,50 @@ class CommunityPage extends HookConsumerWidget {
       }
     }
 
+    bool _isPreventScroll(ScrollNotification notification, WidgetRef ref){
+      // 检查当前页面是否是可见的
+      bool isDownOrUp = notification.metrics.axis == Axis.vertical;
+      if (notification is UserScrollNotification) {
+        // 检查滚动方向
+        switch (notification.direction) {
+          case ScrollDirection.forward:
+            print('Scrolling down');
+            break;
+          case ScrollDirection.reverse:
+            print('Scrolling up');
+            break;
+          case ScrollDirection.idle:
+            print('Scrolling stopped');
+            break;
+        }
+      } else if (notification is ScrollUpdateNotification) {
+        // 检查滚动位置变化
+        double currentScrollPosition = notification.metrics.pixels;
+        double maxScrollExtent = notification.metrics.maxScrollExtent;
+
+        // 判断是否满足某个条件
+        if (currentScrollPosition > 0 && currentScrollPosition < maxScrollExtent) {
+          print('Current scroll position: $currentScrollPosition');
+          // 在这里添加你的条件判断逻辑
+        }
+
+        // 只有当上下滚动时才拦截通知
+        if (isDownOrUp) {
+          final tabsRouter = ref.watch(communityVmProvider).tabsRouter;
+        }
+      }
+      return false;
+    }
 
     @override
     Widget build(BuildContext context, WidgetRef ref) {
         final vm = ref.read(communityVmProvider.notifier);
+        final state = ref.watch(communityVmProvider);
         final stateTabsRouter = ref.watch(communityVmProvider).tabsRouter;
         // final state = ref.watch(communityVmProvider);
         BuildContext contextPage = context;
+        // 创建 GlobalKey
+        final _tabsRouterKey = GlobalKey<AutoTabsRouterState>();
 
         // useEffect((){
         //   Log.d("CommunityPage initState");
@@ -61,14 +98,7 @@ class CommunityPage extends HookConsumerWidget {
                   SliverToBoxAdapter(
                       child: Consumer(
                         builder: (context, ref, _) {
-                          final tabsRouter = ref.watch(communityVmProvider).tabsRouter;
-                          // final vm = ref.read(communityVmProvider.notifier);
-                          if(tabsRouter != null){
-                            return _buildTopSection(context, ref, vm, tabsRouter);
-                          }else {
-                            return const SizedBox.shrink();
-                          }
-
+                          return _buildTopSection(context, ref, vm);
                         },
                       ),
                   ),
@@ -80,49 +110,48 @@ class CommunityPage extends HookConsumerWidget {
                   // ),
                 ];
               },
-              body: AutoTabsRouter.pageView(
-                routes: const [
-                  NewsPageRoute(),
-                  FollowingPageRoute(),
-                  ForyouPageRoute()
-                ],
-                builder: (context, child, pageController) {
-                  final tabsRouter = AutoTabsRouter.of(context);
-                  Log.d("autotabsRouter ---build  ${tabsRouter.activeIndex}");
-                  // 将tabsRouter 放入 CommunityVmProvider 中
-                  // if(stateTabsRouter == null){
-                  //   vm.setTabsRouterAndPageController(tabsRouter, pageController);
-                  // }else {
-                  //
-                  // }
-                  vm.setTabsRouterAndPageController(tabsRouter, pageController);
-
-                  return Column(
-                    children: [
-                      // Text("${vm.state.activeTabIdx}"),
-                      // _buildTabsSection(contextPage, ref, tabsRouter),
-                      // tabs 组件
-                      // Visibility(
-                      //   visible: true,
-                      //   child: _buildTabsSection(contextPage, ref, tabsRouter),
-                      // ),
-
-                      // post 组件
-                      // _buildPostSection(context, ref, vm),
-                      Expanded(
-                        child: child,
-                      ),
-                    ],
-                  );
+              body: NotificationListener<ScrollNotification>(
+                onNotification: (ScrollNotification notification) {
+                  // 是否拦截滚动  false 表示不拦截通知
+                  // return _isPreventScroll(notification, ref);
+                  return false;
                 },
+                child: AutoTabsRouter.pageView(
+                  key: _tabsRouterKey,
+                  routes: const [
+                    NewsPageRoute(),
+                    FollowingPageRoute(),
+                    ForyouPageRoute()
+                  ],
+                  builder: (context, child, pageController) {
+                    final tabsRouter = AutoTabsRouter.of(context);
+                    // Log.d("autotabsrouter build  ${tabsRouter.activeIndex}");
+                    // Log.d("communityVmProvider.notifier state.tabsRouter.tabsRouter:  ${ref.read(communityVmProvider.notifier).state.tabsRouter}");
+                    // ref.read(communityVmProvider.notifier).state.tabsRouter = tabsRouter;
+                    // ref.read(communityVmProvider.notifier).state.pageController = pageController;
+                    // Log.d("communityVmProvider.notifier state.tabsRouter.tabsRouter.activeIndex:  ${ref.read(communityVmProvider.notifier).state.tabsRouter.activeIndex}");
+
+                    return Column(
+                      children: [
+                        // tab 组件
+                        _buildTabsSection(contextPage, ref, tabsRouter),
+                        // post 组件
+                        _buildPostSection(context, ref, vm),
+                        Expanded(
+                          child: child,
+                        ),
+                      ],
+                    );
+                  },
+                ),
               ),
-          )
+            )
         );
     }
 
-     Widget _buildTopSection(BuildContext context, WidgetRef ref, vm, tabsRouter) {
+     Widget _buildTopSection(BuildContext context, WidgetRef ref, vm) {
         final topSectionsData = vm.topSectionsData;
-        final currentTabIdx = tabsRouter.activeIndex;
+        int curTagIdx = 0;
         return Container(
           color: Colors.white,
           padding: const EdgeInsets.only(top: 30, bottom: 30),
@@ -142,7 +171,7 @@ class CommunityPage extends HookConsumerWidget {
                         decoration: BoxDecoration(
                           // color: currentTabIdx == index ? ColorUtils.string2Color('#E6F2FF') : Colors.white,
                           shape: BoxShape.circle, // 设置为圆形
-                          boxShadow: index == 0 ? [
+                          boxShadow: index == curTagIdx ? [
                             BoxShadow(
                               color: context.appColors.tabLightBlueShadow, // 设置阴影颜色
                               blurRadius: 5, // 设置模糊半径
@@ -164,7 +193,7 @@ class CommunityPage extends HookConsumerWidget {
                       MyTextView(
                         item['title'],
                         fontSize: 15,
-                        textColor: index ==0 ? ColorUtils.string2Color('#4161D0'):Colors.black,
+                        textColor: index == curTagIdx ? ColorUtils.string2Color('#4161D0'):Colors.black,
                         textAlign: TextAlign.center,
                         isFontMedium: true,
                       ),
@@ -179,6 +208,7 @@ class CommunityPage extends HookConsumerWidget {
 
      Widget _buildTabsSection(BuildContext context, WidgetRef ref, tabsRouter){
        final vm = ref.read(communityVmProvider.notifier);
+       final state = ref.watch(communityVmProvider);
        final tabsList = ref.watch(communityVmProvider.select((state) => state.tabsList));
        return Container(
         width: double.infinity,
@@ -186,10 +216,9 @@ class CommunityPage extends HookConsumerWidget {
         child: NewsfeedTabs(
           key: UniqueKey(),
           tabsList: tabsList!,
+            tabsRouter: tabsRouter,
           onClickAction:(activeTabIdx){
-            print('点击了tab ${activeTabIdx}');
-            // vm.handlerChangeTab(activeTabIdx);
-            // tabsRouter.setActiveIndex(activeTabIdx);
+            vm.handlerChangeTab(activeTabIdx, tabsRouter);
           }
         ),
       );

+ 6 - 10
packages/cpt_community/lib/modules/community/community_state.dart

@@ -1,12 +1,11 @@
+import 'package:cpt_community/modules/community/community_page.dart';
 import 'package:cs_resources/generated/assets.dart';
 
-import '../garagesale/garagesale_page.dart';
-import '../newsfeed/newsfeed_page.dart';
+import '../garage/garage_page.dart';
 
 class CommunityVmState {
   List<Map<String, dynamic>>? topSectionsData;
   List? tabsList = ["News", "Following", "For You"];
-  int? activeTabIdx = 0;
   dynamic? tabsRouter;
   dynamic? pageController;
 
@@ -14,35 +13,32 @@ class CommunityVmState {
   CommunityVmState({
     List<Map<String, dynamic>>? topSectionsData,
     this.tabsList,
-    this.activeTabIdx,
     this.tabsRouter,
     this.pageController,
   }) : topSectionsData = topSectionsData?? [
     {
       "title": "News Feed",
       "icon": Assets.communityNesFeed,
-      "pageStartInstanceFn": NewsfeedPage.startInstance,
-      "page": const NewsfeedPage(),
+      "pageStartInstanceFn": CommunityPage.startInstance,
+      "page": const CommunityPage(),
     },
     {
       "title": "Garage Sale",
       "icon": Assets.communityGarageSale,
-      "pageStartInstanceFn": GaragesalePage.startInstance,
-      "page": const GaragesalePage(),
+      "pageStartInstanceFn": GaragePage.startInstance,
+      "page": const GaragePage(),
     },
   ];
 
   CommunityVmState copyWith({
     List<Map<String, dynamic>>? topSectionsData,
     List? tabsList,
-    int? activeTabIdx,
     dynamic? tabsRouter,
     dynamic? pageController,
   }) {
     return CommunityVmState(
       topSectionsData: topSectionsData ?? this.topSectionsData,
       tabsList: tabsList ?? this.tabsList,
-      activeTabIdx: activeTabIdx ?? this.activeTabIdx,
       tabsRouter: tabsRouter ?? this.tabsRouter,
       pageController: pageController ?? this.pageController,
     );

+ 13 - 22
packages/cpt_community/lib/modules/community/community_vm.dart

@@ -1,4 +1,6 @@
 
+import 'package:cpt_community/modules/garage/garage_page.dart';
+import 'package:cpt_community/router/page/community_page_router.dart';
 import 'package:cs_resources/generated/assets.dart';
 import 'package:flutter/cupertino.dart';
 import 'package:plugin_platform/engine/toast/toast_engine.dart';
@@ -7,18 +9,18 @@ import 'package:router/path/router_path.dart';
 import 'package:shared/utils/log_utils.dart';
 import 'package:auto_route/auto_route.dart';
 
-import '../newsfeed/newsfeed_post/newsfeed_post_page.dart';
 import 'community_state.dart';
+import 'newsfeed_post/newsfeed_post_page.dart';
 
 part 'community_vm.g.dart';
 
 @riverpod
 class CommunityVm extends _$CommunityVm {
+  late PageController _pageController;
   get topSectionsData => state.topSectionsData;
 
   CommunityVmState initState() {
     return CommunityVmState(
-      activeTabIdx: 0,
       tabsList: ["News", "Following", "For You"],
     );
   }
@@ -39,33 +41,22 @@ class CommunityVm extends _$CommunityVm {
     return state;
   }
 
-  // 切换tab
-  handlerChangeTab(int index) {
-    // state.tabsRouter.setActiveIndex(activeTabIdx);
-    // if(tabItem == "News"){
-    //   state = state.copyWith(activeTabIdx: 0);
-    // }else if(tabItem == "Following"){
-    //   state = state.copyWith(activeTabIdx: 1);
-    // }else if(tabItem == "For You"){
-    //   state = state.copyWith(activeTabIdx: 2);
-    // }
-    // state = state.copyWith(activeTabIdx: index);
-    state.pageController?.jumpToPage(index);
-  }
 
+  // 切换tab
+  handlerChangeTab(int index, tabsRouter) {
 
-   // 设置当前的 tabsRouter 和 pageController
-  Future setTabsRouterAndPageController(dynamic tabsRouter, dynamic pageController) async{
-    // state = await state.copyWith(activeTabIdx: tabsRouter.activeIndex);
-    Log.d("setTabsRouterAndPageController---: $tabsRouter");
-    state = await state.copyWith(tabsRouter: tabsRouter, pageController: pageController,activeTabIdx: tabsRouter.activeIndex);
-    // state = await state.copyWith(activeTabIdx: state.tabsRouter.activeIndex);
+    tabsRouter.setActiveIndex(index);
+    // state = state.copyWith(tabsRouter: tabsRouter ,activeTabIdx: index);
+    Log.d("community_vm handlerChangeTab--index:    $index");
   }
 
+
   handlerChangeCommunityType(BuildContext context, int index){
     if(index == 1){
+      Log.d("去往garage 页面");
       // 跳转到 garage sale 页面
-      AutoRouter.of(context).pushNamed(RouterPath.garageSale);
+      GaragePage.startInstance(context: context);
+      // AutoRouter.of(context).push(const GaragePageRoute());
     }
   }
 

+ 1 - 1
packages/cpt_community/lib/modules/community/community_vm.g.dart

@@ -6,7 +6,7 @@ part of 'community_vm.dart';
 // RiverpodGenerator
 // **************************************************************************
 
-String _$communityVmHash() => r'a967355f8abbdda59a2001d7766b42f8d7ebb6af';
+String _$communityVmHash() => r'5d1bae55bf25ed93006f6e35a20a27627183f458';
 
 /// See also [CommunityVm].
 @ProviderFor(CommunityVm)

+ 37 - 6
packages/cpt_community/lib/modules/community/foryou/foryou_page.dart

@@ -31,18 +31,49 @@ class ForyouPage extends HookConsumerWidget {
 
   @override
   Widget build(BuildContext context, WidgetRef ref) {
-    return const Scaffold(
+    final vm = ref.read(foryouVmProvider.notifier);
+    return Scaffold(
       // appBar: MyAppBar.appBar(
       //   context,
       //   "foryou",
       //   backgroundColor: context.appColors.whiteBG,
       // ),
       // backgroundColor: ColorUtils.string2Color("#F2F3F6"),
-      body: Column(
-        children: [
-          Text("newspage-foryou"),
-        ],
-      )
+        body: Column(
+          children: [
+            Expanded(
+              child: EasyRefresh(
+                // 上拉加载
+                onLoad: () async{
+                  Log.d("----onLoad");
+                  vm.onLoadData();
+                },
+                // 下拉刷新
+                onRefresh: () async{
+                  Log.d("----onRefresh");
+                  vm.refreshListData();
+                },
+                child: _buildForyouList(context, ref, vm),
+              ),
+            )
+          ],
+        )
     );
   }
+
+
+  Widget _buildForyouList(BuildContext context, WidgetRef ref, ForyouVm vm) {
+
+    return ListView.builder(
+      itemCount: 3,
+      itemBuilder: (context, index) {
+        return _buildListItem(context, ref, vm, index);
+      },
+    );
+  }
+
+  Widget _buildListItem(BuildContext context, WidgetRef ref, ForyouVm vm, int index) {
+    return Text("list-item");
+  }
+
 }

+ 9 - 9
packages/cpt_community/lib/modules/newsfeed/newsfeed_repository.dart

@@ -9,25 +9,25 @@ import 'package:shared/utils/util.dart';
 import 'package:flutter_riverpod/flutter_riverpod.dart';
 import 'package:plugin_basic/provider/http_provider/http_provider.dart';
 
-import 'newsfeed_state.dart';
+import 'foryou_state.dart';
 
-part 'newsfeed_repository.g.dart';
+part 'foryou_respository.g.dart';
 
 @Riverpod(keepAlive: true)
-NewsfeedRepository newsfeedRepository(Ref ref) {
+ForyouRepository foryouRepository(Ref ref) {
   final dioEngine = ref.watch(dioEngineProvider);
-  return NewsfeedRepository(dioEngine: dioEngine);
+  return ForyouRepository(dioEngine: dioEngine);
 }
 
 /*
  * 数据仓库
  */
-class NewsfeedRepository {
+class ForyouRepository {
   DioEngine dioEngine;
 
-  NewsfeedRepository({required this.dioEngine});
+  ForyouRepository({required this.dioEngine});
 
-  Future<HttpResult<Object>> fetchNewsfeedList(
+  Future<HttpResult<Object>> fetchForyouList(
       Map<String, dynamic>? data, {
         CancelToken? cancelToken,
       }) async {
@@ -60,9 +60,9 @@ class NewsfeedRepository {
     if (result.isSuccess) {
       //重新赋值data或list
       final json = result.getDataJson();
-      var data = NewsfeedState.fromMap(json!);
+      var data = ForyouState.fromMap(json!);
       //重新赋值data或list
-      return result.convert<NewsfeedState>(data: data);
+      return result.convert<ForyouState>(data: data);
     }
     return result.convert();
   }

+ 9 - 10
packages/cpt_community/lib/modules/garagesale/garagesale_repository.g.dart

@@ -1,28 +1,27 @@
 // GENERATED CODE - DO NOT MODIFY BY HAND
 
-part of 'garagesale_repository.dart';
+part of 'foryou_respository.dart';
 
 // **************************************************************************
 // RiverpodGenerator
 // **************************************************************************
 
-String _$garagesaleRepositoryHash() =>
-    r'0b158a0c8d06f9f2fa4b6646c215f09c0656eaad';
+String _$foryouRepositoryHash() => r'e56fd60e2f4586dd9f445e0dc74353e0eaa8cdab';
 
-/// See also [garagesaleRepository].
-@ProviderFor(garagesaleRepository)
-final garagesaleRepositoryProvider = Provider<GaragesaleRepository>.internal(
-  garagesaleRepository,
-  name: r'garagesaleRepositoryProvider',
+/// See also [foryouRepository].
+@ProviderFor(foryouRepository)
+final foryouRepositoryProvider = Provider<ForyouRepository>.internal(
+  foryouRepository,
+  name: r'foryouRepositoryProvider',
   debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
       ? null
-      : _$garagesaleRepositoryHash,
+      : _$foryouRepositoryHash,
   dependencies: null,
   allTransitiveDependencies: null,
 );
 
 @Deprecated('Will be removed in 3.0. Use Ref instead')
 // ignore: unused_element
-typedef GaragesaleRepositoryRef = ProviderRef<GaragesaleRepository>;
+typedef ForyouRepositoryRef = ProviderRef<ForyouRepository>;
 // ignore_for_file: type=lint
 // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package

+ 22 - 0
packages/cpt_community/lib/modules/community/foryou/foryou_state.dart

@@ -32,4 +32,26 @@ class ForyouState {
       list: list ?? this.list,
     );
   }
+
+  Map<String, dynamic> toMap() {
+    return {
+      'activeTabIndex': this.activeTabIndex,
+      'curPage': this.curPage,
+      'pageSize': this.pageSize,
+      'filterCount': this.filterCount,
+      'tabsList': this.tabsList,
+      'list': this.list,
+    };
+  }
+
+  factory ForyouState.fromMap(Map<String, dynamic> map) {
+    return ForyouState(
+      activeTabIndex: map['activeTabIndex'] as int,
+      curPage: map['curPage'] as int,
+      pageSize: map['pageSize'] as int,
+      filterCount: map['filterCount'] as int,
+      tabsList: map['tabsList'] as List<String>,
+      list: map['list'] as List<Map<String, dynamic>>,
+    );
+  }
 }

+ 91 - 5
packages/cpt_community/lib/modules/community/foryou/foryou_vm.dart

@@ -2,18 +2,22 @@ import 'package:cs_resources/generated/assets.dart';
 import 'package:flutter/cupertino.dart';
 import 'package:plugin_platform/engine/toast/toast_engine.dart';
 import 'package:riverpod_annotation/riverpod_annotation.dart';
+import 'package:router/ext/auto_router_extensions.dart';
 import 'package:shared/utils/log_utils.dart';
 
+import '../../../router/page/community_page_router.dart';
+import '../newsfeed_detail/newsfeed_detail_page.dart';
+import 'foryou_respository.dart';
 import 'foryou_state.dart';
 
 part 'foryou_vm.g.dart';
 
 @riverpod
 class ForyouVm extends _$ForyouVm {
-
+  late ForyouRepository ForyouRepositoryInstance;
   ForyouState initState() {
     return ForyouState(
-      list: [
+        list: [
           {
             'id':1,
             'avator': Assets.communityCamera,
@@ -22,7 +26,7 @@ class ForyouVm extends _$ForyouVm {
             'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
             'imageUrls': ['https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg'],
             'time': 'June 17,2016 at 7:23 p.m.',
-              'isLike': true,
+            'isLike': true,
             'likeno': 12
           },
           {
@@ -91,20 +95,102 @@ class ForyouVm extends _$ForyouVm {
             'isLike': false,
             'likeno': 12
           },
-      ]
+        ]
     );
   }
 
   @override
   ForyouState build(){
+    // 引入数据仓库
+    ForyouRepositoryInstance = ref.read(foryouRepositoryProvider);
     final state = initState();
     Log.d("--------------------------build---------------------");
 
     return state;
   }
 
-   // 设置当前的 tabsRouter 和 pageController
+  // 设置当前的 tabsRouter 和 pageController
   Future setTabsRouterAndPageController(dynamic tabsRouter, dynamic pageController) async{
     Log.d("setTabsRouterAndPageController---:$tabsRouter");
   }
+
+// 上拉加载
+  Future onLoadData() async {
+    Log.d("----Foryou_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();
+  }
+
+  // 获取list 列表数据
+  void getListData<T>() async {
+    Log.d("加载listData数据---------------start-----");
+    try {
+      //请求网络
+      Map<String, dynamic>  params = {
+        "curPage": state.curPage,
+        "pageSize": state.pageSize,
+      };
+      Log.d("请求参数------$params");
+      final result = await ForyouRepositoryInstance.fetchForyouList(params);
+      Log.d("请求完成结果------${result.data}");
+      //校验成功失败
+      if (result.isSuccess) {
+        // state = state.copyWith(serverTime: result.data);
+        state = state;
+        ToastEngine.show("获取数据成功");
+      } else {
+        ToastEngine.show(result.errorMsg ?? "Network Load Error");
+      }
+    } catch (e) {
+      ToastEngine.show("Error: $e");
+    }
+  }
+
+
+  // 下拉刷新
+  Future refreshListData() async {
+    Log.d("----property_foryou_vm-----refreshListData ");
+
+    // await Future.delayed(const Duration(seconds: 2));
+
+    state = state.copyWith(curPage: 1, pageSize: 10);
+    // ref.invalidateSelf();
+    // ref.invalidate(ForyouVmProvider);
+    getListData();
+
+  }
+
+
+  // 点击 like comments  share
+  void handlerClickActionBtn(String? actionStr, item){
+    final id = item['id'];
+    switch (actionStr) {
+      case 'like':
+        Log.d("点击了 点赞");
+        handlerGotoDetail(id);
+        break;
+      case 'comments':
+        Log.d("点击了 评论");
+        handlerGotoDetail(id);
+        break;
+      case 'share':
+        Log.d("点击了 分享");
+        handlerGotoDetail(id);
+        break;
+      default:
+        break;
+    }
+  }
+  // 去详情页面
+  void handlerGotoDetail(id){
+    Log.d("去详情页面");
+    appRouter.push(NewsfeedDetailPageRoute(id: id, type: 'foryou'));
+  }
 }

+ 1 - 1
packages/cpt_community/lib/modules/community/foryou/foryou_vm.g.dart

@@ -6,7 +6,7 @@ part of 'foryou_vm.dart';
 // RiverpodGenerator
 // **************************************************************************
 
-String _$foryouVmHash() => r'7acf0e7960a6da7abec459d1c2be65ad11f64c04';
+String _$foryouVmHash() => r'69331ffc075d0cb4409a72d3a08782ad534ffa8e';
 
 /// See also [ForyouVm].
 @ProviderFor(ForyouVm)

+ 17 - 66
packages/cpt_community/lib/modules/community/news/news_page.dart

@@ -46,76 +46,26 @@ class NewsPage extends HookConsumerWidget {
       // backgroundColor: ColorUtils.string2Color("#F2F3F6"),
       body: Column(
         children: [
-            Text("news -page"),
-            // post 组件
-            _buildPostSection(context, ref, vm),
-
-            // Expanded(
-            //   child: EasyRefresh(
-            //     // 上拉加载
-            //     onLoad: () async{
-            //       Log.d("----onLoad");
-            //       vm.onLoadData();
-            //     },
-            //     // 下拉刷新
-            //     onRefresh: () async{
-            //       Log.d("----onRefresh");
-            //       vm.refreshListData();
-            //     },
-            //     child: _buildNesFeedList(context, ref, vm),
-            //   ),
-            // )
-           _buildNesFeedList(context, ref, vm),
+            Expanded(
+              child: EasyRefresh(
+                // 上拉加载
+                onLoad: () async{
+                  Log.d("----onLoad");
+                  vm.onLoadData();
+                },
+                // 下拉刷新
+                onRefresh: () async{
+                  Log.d("----onRefresh");
+                  vm.refreshListData();
+                },
+                child: _buildNewsFeedList(context, ref, vm),
+              ),
+            )
         ],
       )
     );
   }
 
-
-  Widget _buildPostSection(BuildContext context, WidgetRef ref, vm){
-    return Container(
-      height: 65.5,
-      width: double.infinity,
-      padding: const EdgeInsets.only(left: 20, right: 20),
-      color: Colors.white,
-      child: Row(
-        children: [
-          const MyAssetImage(Assets.communityNesFeed, width: 45,height: 45,),
-         Expanded(
-            child: Row(
-              children: [
-                Expanded(
-                  child: Container(
-                    // height: 65.5,
-                    // color: Colors.blue,
-                    child: MyTextView(
-                      "What’s on your mind?",
-                      textColor: ColorUtils.string2Color('#000000'),
-                      fontSize: 15,
-                      marginLeft: 15,
-                      alignment: Alignment.centerLeft,
-                      textAlign: TextAlign.left,
-                      backgroundColor: ColorUtils.string2Color('#ffffff'),
-                      maxLines: 1,
-                      isFontMedium: true,
-                    ),
-                  ),
-                ),
-                const MyAssetImage(
-                  Assets.communityCamera,
-                  width: 21,
-                  height: 16.5,
-                ),
-              ],
-            ).onTap((){
-              vm.handlerGotoPost(context);
-            }),
-          ),
-        ],
-      ),
-    );
-  }
-
   Widget _buildNewsItem(BuildContext context, WidgetRef ref, item, vm){
     return Container(
       width: double.infinity,
@@ -200,7 +150,7 @@ class NewsPage extends HookConsumerWidget {
     );
   }
 
-  Widget _buildNesFeedList(BuildContext context, WidgetRef ref, vm){
+  Widget _buildNewsFeedList(BuildContext context, WidgetRef ref, vm){
     final itemList = vm.state.list?? [];
     if(itemList.isEmpty){
       return const Center(child: Text('No Data'));
@@ -214,5 +164,6 @@ class NewsPage extends HookConsumerWidget {
         },
       );
     }
+    // return Text("879424");
   }
 }

+ 9 - 9
packages/cpt_community/lib/modules/garagesale/garagesale_repository.dart

@@ -9,25 +9,25 @@ import 'package:shared/utils/util.dart';
 import 'package:flutter_riverpod/flutter_riverpod.dart';
 import 'package:plugin_basic/provider/http_provider/http_provider.dart';
 
-import 'garagesale_state.dart';
+import 'news_state.dart';
 
-part 'garagesale_repository.g.dart';
+part 'news_respository.g.dart';
 
 @Riverpod(keepAlive: true)
-GaragesaleRepository garagesaleRepository(Ref ref) {
+NewsRepository newsRepository(Ref ref) {
   final dioEngine = ref.watch(dioEngineProvider);
-  return GaragesaleRepository(dioEngine: dioEngine);
+  return NewsRepository(dioEngine: dioEngine);
 }
 
 /*
  * 数据仓库
  */
-class GaragesaleRepository {
+class NewsRepository {
   DioEngine dioEngine;
 
-  GaragesaleRepository({required this.dioEngine});
+  NewsRepository({required this.dioEngine});
 
-  Future<HttpResult<Object>> fetchGaragesaleList(
+  Future<HttpResult<Object>> fetchNewsList(
       Map<String, dynamic>? data, {
         CancelToken? cancelToken,
       }) async {
@@ -60,9 +60,9 @@ class GaragesaleRepository {
     if (result.isSuccess) {
       //重新赋值data或list
       final json = result.getDataJson();
-      var data = GaragesaleState.fromMap(json!);
+      var data = NewsState.fromMap(json!);
       //重新赋值data或list
-      return result.convert<GaragesaleState>(data: data);
+      return result.convert<NewsState>(data: data);
     }
     return result.convert();
   }

+ 27 - 0
packages/cpt_community/lib/modules/community/news/news_respository.g.dart

@@ -0,0 +1,27 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'news_respository.dart';
+
+// **************************************************************************
+// RiverpodGenerator
+// **************************************************************************
+
+String _$newsRepositoryHash() => r'097145b82f467702467a6b71c1500d8364d69eb7';
+
+/// See also [newsRepository].
+@ProviderFor(newsRepository)
+final newsRepositoryProvider = Provider<NewsRepository>.internal(
+  newsRepository,
+  name: r'newsRepositoryProvider',
+  debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
+      ? null
+      : _$newsRepositoryHash,
+  dependencies: null,
+  allTransitiveDependencies: null,
+);
+
+@Deprecated('Will be removed in 3.0. Use Ref instead')
+// ignore: unused_element
+typedef NewsRepositoryRef = ProviderRef<NewsRepository>;
+// ignore_for_file: type=lint
+// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package

+ 22 - 0
packages/cpt_community/lib/modules/community/news/news_state.dart

@@ -32,4 +32,26 @@ class NewsState {
       list: list ?? this.list,
     );
   }
+
+  Map<String, dynamic> toMap() {
+    return {
+      'activeTabIndex': this.activeTabIndex,
+      'curPage': this.curPage,
+      'pageSize': this.pageSize,
+      'filterCount': this.filterCount,
+      'tabsList': this.tabsList,
+      'list': this.list,
+    };
+  }
+
+  factory NewsState.fromMap(Map<String, dynamic> map) {
+    return NewsState(
+      activeTabIndex: map['activeTabIndex'] as int,
+      curPage: map['curPage'] as int,
+      pageSize: map['pageSize'] as int,
+      filterCount: map['filterCount'] as int,
+      tabsList: map['tabsList'] as List<String>,
+      list: map['list'] as List<Map<String, dynamic>>,
+    );
+  }
 }

+ 8 - 19
packages/cpt_community/lib/modules/community/news/news_vm.dart

@@ -6,15 +6,15 @@ import 'package:router/ext/auto_router_extensions.dart';
 import 'package:shared/utils/log_utils.dart';
 
 import '../../../router/page/community_page_router.dart';
-import '../../newsfeed/newsfeed_post/newsfeed_post_page.dart';
-import '../../newsfeed/newsfeed_repository.dart';
+import '../newsfeed_detail/newsfeed_detail_page.dart';
+import 'news_respository.dart';
 import 'news_state.dart';
 
 part 'news_vm.g.dart';
 
 @riverpod
 class NewsVm extends _$NewsVm {
-  late NewsfeedRepository newsfeedRepository;
+  late NewsRepository NewsRepositoryInstance;
   NewsState initState() {
     return NewsState(
       list: [
@@ -102,7 +102,7 @@ class NewsVm extends _$NewsVm {
   @override
   NewsState build(){
     // 引入数据仓库
-    newsfeedRepository = ref.read(newsfeedRepositoryProvider);
+    NewsRepositoryInstance = ref.read(newsRepositoryProvider);
     final state = initState();
     Log.d("--------------------------build---------------------");
 
@@ -116,7 +116,7 @@ class NewsVm extends _$NewsVm {
 
 // 上拉加载
   Future onLoadData() async {
-    Log.d("----newsfeed_vm-----initListData");
+    Log.d("----News_vm-----initListData");
     // await Future.delayed(const Duration(seconds: 2));
     // if(state.list.length >= state.filterCount){
     //   return;
@@ -138,7 +138,7 @@ class NewsVm extends _$NewsVm {
         "pageSize": state.pageSize,
       };
       Log.d("请求参数------$params");
-      final result = await newsfeedRepository.fetchNewsfeedList(params);
+      final result = await NewsRepositoryInstance.fetchNewsList(params);
       Log.d("请求完成结果------${result.data}");
       //校验成功失败
       if (result.isSuccess) {
@@ -162,23 +162,12 @@ class NewsVm extends _$NewsVm {
 
     state = state.copyWith(curPage: 1, pageSize: 10);
     // ref.invalidateSelf();
-    // ref.invalidate(newsfeedVmProvider);
+    // ref.invalidate(NewsVmProvider);
     getListData();
 
   }
 
 
-
-  // 点击发布的按钮 跳转到发布的页面
-  void handlerGotoPost(context){
-    // ComponentServiceManager().communityService.startCommunityPage();
-
-    // AutoRouter.of(context).pushNamed(RouterPath.newsFeedPost);
-
-    NewsfeedPostPage.startInstance();
-  }
-
-
   // 点击 like comments  share
   void handlerClickActionBtn(String? actionStr, item){
     final id = item['id'];
@@ -202,6 +191,6 @@ class NewsVm extends _$NewsVm {
   // 去详情页面
   void handlerGotoDetail(id){
     Log.d("去详情页面");
-    appRouter.push(NewsfeedDetailPageRoute(id: id));
+    appRouter.push(NewsfeedDetailPageRoute(id: id, type:'news'));
   }
 }

+ 1 - 1
packages/cpt_community/lib/modules/community/news/news_vm.g.dart

@@ -6,7 +6,7 @@ part of 'news_vm.dart';
 // RiverpodGenerator
 // **************************************************************************
 
-String _$newsVmHash() => r'22a6c6162c190b569df6ddef86ffd46f687c17e1';
+String _$newsVmHash() => r'f5a5a082bc85c87229ff78e9b20eef1acb230831';
 
 /// See also [NewsVm].
 @ProviderFor(NewsVm)

+ 6 - 5
packages/cpt_community/lib/modules/newsfeed/newsfeed_detail/newsfeed_detail_page.dart

@@ -1,4 +1,3 @@
-import 'package:cpt_community/modules/newsfeed/newsfeed_detail/newsfeed_detail_vm.dart';
 import 'package:cpt_community/router/page/community_page_router.dart';
 import 'package:cs_resources/theme/app_colors_theme.dart';
 import 'package:flutter/material.dart';
@@ -17,18 +16,20 @@ import '../../../components/newfeed_card_header.dart';
 import '../../../components/newsfeed_card_content.dart';
 import '../../../components/newsfeed_card_footer.dart';
 import 'newsfeed_detail_state.dart';
+import 'newsfeed_detail_vm.dart';
 
 @RoutePage()
 class NewsfeedDetailPage extends HookConsumerWidget {
   final int? id;
+  final String? type;  // news  following foryou
 
-  const NewsfeedDetailPage({Key? key, required this.id}) : super(key: key);
+  const NewsfeedDetailPage({Key? key, required this.id, required this.type}) : super(key: key);
   // 启动当前页面
-  static void startInstance({BuildContext? context, int? id}) {
+  static void startInstance({BuildContext? context, int? id, String? type='news'}) {
     if (context != null) {
-      context.router.push(NewsfeedDetailPageRoute(id: id));
+      context.router.push(NewsfeedDetailPageRoute(id: id, type: type));
     } else {
-      appRouter.push(NewsfeedDetailPageRoute(id: id));
+      appRouter.push(NewsfeedDetailPageRoute(id: id, type: type));
     }
   }
 

packages/cpt_community/lib/modules/newsfeed/newsfeed_detail/newsfeed_detail_state.dart → packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_state.dart


packages/cpt_community/lib/modules/newsfeed/newsfeed_detail/newsfeed_detail_vm.dart → packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_vm.dart


packages/cpt_community/lib/modules/newsfeed/newsfeed_detail/newsfeed_detail_vm.g.dart → packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_vm.g.dart


packages/cpt_community/lib/modules/newsfeed/newsfeed_myposts/newsfeed_myposts_page.dart → packages/cpt_community/lib/modules/community/newsfeed_myposts/newsfeed_myposts_page.dart


packages/cpt_community/lib/modules/newsfeed/newsfeed_post/newsfeed_post_page.dart → packages/cpt_community/lib/modules/community/newsfeed_post/newsfeed_post_page.dart


packages/cpt_community/lib/modules/newsfeed/newsfeed_post/newsfeed_post_page_state.dart → packages/cpt_community/lib/modules/community/newsfeed_post/newsfeed_post_page_state.dart


packages/cpt_community/lib/modules/newsfeed/newsfeed_post/newsfeed_post_vm.dart → packages/cpt_community/lib/modules/community/newsfeed_post/newsfeed_post_vm.dart


packages/cpt_community/lib/modules/newsfeed/newsfeed_post/newsfeed_post_vm.g.dart → packages/cpt_community/lib/modules/community/newsfeed_post/newsfeed_post_vm.g.dart


+ 13 - 9
packages/cpt_community/lib/modules/newsfeed/newsfeed_tabs.dart

@@ -1,4 +1,3 @@
-import 'package:cpt_community/modules/newsfeed/newsfeed_vm.dart';
 import 'package:cs_resources/theme/app_colors_theme.dart';
 import 'package:flutter/material.dart';
 import 'package:auto_route/auto_route.dart';
@@ -12,16 +11,18 @@ import 'package:widgets/ext/ex_widget.dart';
 import 'package:widgets/my_text_view.dart';
 import 'package:widgets/my_appbar.dart';
 
-import '../community/community_vm.dart';
-import '../garagesale/garagesale_vm.dart';
+import 'community_vm.dart';
+import '../garage/garage_vm.dart';
 
 class NewsfeedTabs extends HookConsumerWidget {
   List tabsList;
   Widget? Function(BuildContext)? tabItemBuilder;
+  dynamic? tabsRouter;
   void Function(int)? onClickAction;
   NewsfeedTabs({
     Key? key,
     required this.tabsList,
+    this.tabsRouter,
     this.onClickAction,
     this.tabItemBuilder
   }) : super(key: key);
@@ -30,7 +31,10 @@ class NewsfeedTabs extends HookConsumerWidget {
     // Log.d("NewsfeedTabs _buildTabItem index: ${vm.state.tabsList}");
     // Log.d("NewsfeedTabs _buildTabItem index: ${vm.state.activeTabIdx}");
     // 监听 activeTabIdx 的变化
-    final activeTabIdx = ref.watch(communityVmProvider.select((state) => state.activeTabIdx));
+    // final activeTabIdx = ref.watch(communityVmProvider.select((state) => state.activeTabIdx));
+
+    final activeTabIdx = tabsRouter!.activeIndex;
+
     // Log.d("NewsfeedTabs _buildTabItem activeTabIdx: $activeTabIdx");
     return Container(
       width: MediaQuery.of(context).size.width / vm.state.tabsList.length - 30,
@@ -60,14 +64,14 @@ class NewsfeedTabs extends HookConsumerWidget {
                 isFontMedium: true,
                 textColor: index == activeTabIdx ? Colors.white :ColorUtils.string2Color("#000000"),
               ),
-            ),
+            ).onTap((){
+              print("newsfeed_tabs 中点击的tab index:  $index");
+              onClickAction?.call(index);
+            }),
           ),
         ],
       ),
-    ).onTap((){
-      print("22222 $index");
-      onClickAction?.call(index);
-    });
+    );
   }
 
   List<Widget> _buildTabs(BuildContext context, WidgetRef ref, vm){

+ 0 - 159
packages/cpt_community/lib/modules/community1/community_page.dart

@@ -1,159 +0,0 @@
-
-import 'package:flutter/material.dart';
-import 'package:auto_route/auto_route.dart';
-import 'package:flutter/rendering.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/color_utils.dart';
-import 'package:shared/utils/log_utils.dart';
-import 'package:widgets/my_load_image.dart';
-import 'package:widgets/ext/ex_widget.dart';
-import 'package:widgets/my_text_view.dart';
-import 'package:widgets/my_appbar.dart';
-import 'package:cs_resources/theme/app_colors_theme.dart';
-import 'package:widgets/widget_export.dart';
-
-import '../../router/page/community_page_router.dart';
-import 'community_vm.dart';
-
-@RoutePage()
-class CommunityPage extends HookConsumerWidget {
-    const CommunityPage({Key? key}) : super(key: key);
-
-    //启动当前页面
-    static void startInstance({BuildContext? context}) {
-      if (context != null) {
-        context.router.push(const CommunityPageRoute());
-      } else {
-        appRouter.push(const CommunityPageRoute());
-      }
-    }
-
-
-     Widget _buildTopSection(BuildContext context, WidgetRef ref, vm, tabsRouter) {
-        final topSectionsData = vm.topSectionsData;
-        final currentTabIdx = tabsRouter.activeIndex;
-        // 监听 curIdx 的变化
-        // final curIdx = ref.watch(communityVmProvider.select((value) => value.curIdx));
-        return Container(
-          color: Colors.white,
-          padding: const EdgeInsets.only(top: 30, bottom: 30),
-          child: Center(
-            child: Row(
-              mainAxisAlignment: MainAxisAlignment.center,
-              crossAxisAlignment: CrossAxisAlignment.center,
-              children: List.generate(topSectionsData.length, (index) {
-                final item = topSectionsData[index];
-                return Flexible(
-                  flex: 1,
-                  child: Column(
-                    children: [
-                      Container(
-                        width: MediaQuery.of(context).size.width / topSectionsData.length - 36,
-                        height: 70,
-                        decoration: BoxDecoration(
-                          // color: currentTabIdx == index ? ColorUtils.string2Color('#E6F2FF') : Colors.white,
-                          shape: BoxShape.circle, // 设置为圆形
-                          boxShadow: currentTabIdx == index ? [
-                            BoxShadow(
-                              color: context.appColors.tabLightBlueShadow, // 设置阴影颜色
-                              blurRadius: 5, // 设置模糊半径
-                              spreadRadius: 0.05, // 控制阴影扩散
-                              offset: const Offset(0, 4), // 设置阴影偏移量
-                            ),
-                          ] : [],// 未选中时无阴影,
-                        ),
-                        child: MyAssetImage(
-                          item['icon'],
-                          width: MediaQuery.of(context).size.width / topSectionsData.length - 36,
-                          height: 70,
-                        ).onTap(() {
-                            tabsRouter.setActiveIndex(index);
-                          },
-                          type: ClickType.throttle,
-                        ),
-                      ),
-                      SizedBox.fromSize(size: const Size(0, 9)),
-                      Text(
-                        item['title'],
-                        maxLines: 1, // 设置最大行数为2
-                        overflow: TextOverflow.ellipsis, // 超出部分用省略号表示
-                        style: TextStyle(
-                            fontSize: 15.0,
-                            color: currentTabIdx == index ? ColorUtils.string2Color('#4161D0'):Colors.black,
-                            fontWeight: FontWeight.w500
-                        ), // 设置字体大小
-                      ),
-                    ],
-                  ),
-                ).marginOnly(left: 18, right: 18, top: 10, bottom: 10);
-              }),
-            ),
-          ),
-        );
-    }
-
-    @override
-    Widget build(BuildContext context, WidgetRef ref) {
-        final vm = ref.read(communityVmProvider.notifier);
-
-        return Scaffold(
-            appBar: MyAppBar.appBar(
-              context,
-              "Community",
-              backgroundColor: context.appColors.whiteBG,
-            ),
-            backgroundColor: context.appColors.backgroundDefault,
-          body: NestedScrollView(
-              headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled){
-                return <Widget>[
-                  SliverToBoxAdapter(
-                    child: Container(
-                      child: const SizedBox.shrink(),
-                    )
-                  ),
-                  SliverToBoxAdapter(
-                    child: Consumer(
-                      builder: (context, ref, _) {
-                        final tabsRouter = ref.watch(communityVmProvider).tabsRouter;
-                        final vm = ref.read(communityVmProvider.notifier);
-                        Log.d("community_page---buildTopSection ---${tabsRouter}");
-                        Log.d("community_page---buildTopSection ---${vm.state.curIdx}");
-
-                        // return _buildTopSection(context, ref, vm, tabsRouter);
-                        if(tabsRouter != null){
-                          return _buildTopSection(context, ref, vm, tabsRouter);
-                        }else {
-                          return const SizedBox.shrink();
-                        }
-                      },
-                    ),
-                  ),
-                ];
-              },
-              body: AutoTabsRouter.pageView(
-                routes: const [
-                  NewsfeedPageRoute(),
-                  GaragesalePageRoute(),
-                ],
-                builder: (context, child, pageController) {
-                  final tabsRouter = AutoTabsRouter.of(context);
-                  // 设置当前的 useTag 0 newsFeed 1 garageSale
-                  vm.setCurrentUseTag(tabsRouter.activeIndex);
-                  // 将tabsRouter 放入 CommunityVmProvider 中
-                  vm.setTabsRouterAndPageController(tabsRouter, pageController);
-                  return Column(
-                    children: [
-                      // _buildTopSection(context, ref, vm, tabsRouter),
-                      Expanded(
-                        child: child,
-                      ),
-                    ],
-                  );
-                },
-              ),
-          ),
-        );
-    }
-}

+ 0 - 51
packages/cpt_community/lib/modules/community1/community_state.dart

@@ -1,51 +0,0 @@
-import 'package:cs_resources/generated/assets.dart';
-
-import '../garagesale/garagesale_page.dart';
-import '../newsfeed/newsfeed_page.dart';
-
-class CommunityVmState {
-  int? useTag = 0;
-  List<Map<String, dynamic>>? topSectionsData;
-  int? curIdx;
-
-  dynamic? tabsRouter;
-  dynamic? pageController;
-
-
-  CommunityVmState({
-    this.useTag = 0,
-    List<Map<String, dynamic>>? topSectionsData,
-    this.curIdx = 0,
-    this.tabsRouter,
-    this.pageController,
-  }) : topSectionsData = topSectionsData?? [
-    {
-      "title": "News Feed",
-      "icon": Assets.communityNesFeed,
-      "pageStartInstanceFn": NewsfeedPage.startInstance,
-      "page": const NewsfeedPage(),
-    },
-    {
-      "title": "Garage Sale",
-      "icon": Assets.communityGarageSale,
-      "pageStartInstanceFn": GaragesalePage.startInstance,
-      "page": const GaragesalePage(),
-    },
-  ];
-
-  CommunityVmState copyWith({
-    int? useTag,
-    List<Map<String, dynamic>>? topSectionsData,
-    int? curIdx = 0,
-    dynamic? tabsRouter,
-    dynamic? pageController,
-  }) {
-    return CommunityVmState(
-      useTag: useTag ?? this.useTag,
-      topSectionsData: topSectionsData ?? this.topSectionsData,
-      curIdx: curIdx ?? 0,
-      tabsRouter: tabsRouter ?? this.tabsRouter,
-      pageController: pageController ?? this.pageController,
-    );
-  }
-}

+ 0 - 62
packages/cpt_community/lib/modules/community1/community_vm.dart

@@ -1,62 +0,0 @@
-
-import 'package:cs_resources/generated/assets.dart';
-import 'package:flutter/cupertino.dart';
-import 'package:plugin_platform/engine/toast/toast_engine.dart';
-import 'package:riverpod_annotation/riverpod_annotation.dart';
-import 'package:shared/utils/log_utils.dart';
-
-import 'community_state.dart';
-
-import '../garagesale/garagesale_page.dart';
-import '../newsfeed/newsfeed_page.dart';
-
-part 'community_vm.g.dart';
-
-@riverpod
-class CommunityVm extends _$CommunityVm {
-  get topSectionsData => state.topSectionsData;
-
-  CommunityVmState initState() {
-    return CommunityVmState();
-  }
-
-  @override
-  CommunityVmState build(){
-    final state = initState();
-    Log.d("--------------------------build---------------------");
-
-    return state;
-  }
-
-   // 设置当前的 tabsRouter 和 pageController
-  Future setTabsRouterAndPageController(dynamic tabsRouter, dynamic pageController) async{
-    Log.d("setTabsRouterAndPageController---: $tabsRouter");
-    state = await state.copyWith(tabsRouter: tabsRouter, pageController: pageController,curIdx: tabsRouter.activeIndex);
-  }
-
-
-   Future setCurrentUseTag(int useTag) async {
-    state = await state.copyWith(useTag: useTag, curIdx: useTag);
-    Log.d("useTag----: $useTag");
-  }
-
-  // 页面切换
-  switchPage(int index,int useTag,BuildContext? context, [bool? isFirstInitSwitch] ){
-    if(state.curIdx != index){
-      state = state.copyWith(curIdx: index, useTag: useTag);
-      final List<Map<String, dynamic>>? topSectionsData = state.topSectionsData;
-      // Log.d("当前页面${topSectionsData?[index]['pageStartInstanceFn']}");
-      final pageStartInstanceFn = topSectionsData?[index]['pageStartInstanceFn'] as Function({BuildContext? context});
-      pageStartInstanceFn(context:context);
-    }else {
-      if(isFirstInitSwitch??false){
-        final List<Map<String, dynamic>>? topSectionsData = state.topSectionsData;
-        // Log.d("当前页面${topSectionsData?[index]['pageStartInstanceFn']}");
-        final pageStartInstanceFn = topSectionsData?[index]['pageStartInstanceFn'] as Function({BuildContext? context});
-        pageStartInstanceFn(context:context);
-      }
-    }
-  }
-
-}
-

+ 80 - 0
packages/cpt_community/lib/modules/garage/for_rent/for_rent_page.dart

@@ -0,0 +1,80 @@
+import 'package:flutter/material.dart';
+import 'package:auto_route/auto_route.dart';
+import 'package:flutter/rendering.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/color_utils.dart';
+import 'package:shared/utils/log_utils.dart';
+import 'package:widgets/my_load_image.dart';
+import 'package:widgets/ext/ex_widget.dart';
+import 'package:widgets/my_text_view.dart';
+import 'package:widgets/my_appbar.dart';
+import 'package:cs_resources/theme/app_colors_theme.dart';
+import 'package:widgets/widget_export.dart';
+
+import '../../../router/page/community_page_router.dart';
+import 'for_rent_vm.dart';
+
+@RoutePage()
+class ForrentPage extends HookConsumerWidget {
+  const ForrentPage({Key? key}) : super(key: key);
+
+  //启动当前页面
+  static void startInstance({BuildContext? context}) {
+    if (context != null) {
+      context.router.push(const ForrentPageRoute());
+    } else {
+      appRouter.push(const ForrentPageRoute());
+    }
+  }
+
+  @override
+  Widget build(BuildContext context, WidgetRef ref) {
+    final vm = ref.read(forrentVmProvider.notifier);
+    return const Scaffold(
+      // appBar: MyAppBar.appBar(
+      //   context,
+      //   "forrent",
+      //   backgroundColor: context.appColors.whiteBG,
+      // ),
+      // backgroundColor: ColorUtils.string2Color("#F2F3F6"),
+        body: Column(
+          children: [
+            // Expanded(
+            //   child: EasyRefresh(
+            //     // 上拉加载
+            //     onLoad: () async{
+            //       Log.d("----onLoad");
+            //       vm.onLoadData();
+            //     },
+            //     // 下拉刷新
+            //     onRefresh: () async{
+            //       Log.d("----onRefresh");
+            //       vm.refreshListData();
+            //     },
+            //     child: _buildForrentList(context, ref, vm),
+            //   ),
+            // )
+            Text("FOR RENT PAGE"),
+          ],
+        )
+    );
+  }
+
+
+  Widget _buildForrentList(BuildContext context, WidgetRef ref, ForrentVm vm) {
+
+    return ListView.builder(
+      itemCount: 3,
+      itemBuilder: (context, index) {
+        return _buildListItem(context, ref, vm, index);
+      },
+    );
+  }
+
+  Widget _buildListItem(BuildContext context, WidgetRef ref, ForrentVm vm, int index) {
+    return Text("list-item");
+  }
+
+}

+ 71 - 0
packages/cpt_community/lib/modules/garage/for_rent/for_rent_respository.dart

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

+ 27 - 0
packages/cpt_community/lib/modules/garage/for_rent/for_rent_respository.g.dart

@@ -0,0 +1,27 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'for_rent_respository.dart';
+
+// **************************************************************************
+// RiverpodGenerator
+// **************************************************************************
+
+String _$forrentRepositoryHash() => r'71a721607b225fc5d56217c1fc769af32a7510de';
+
+/// See also [forrentRepository].
+@ProviderFor(forrentRepository)
+final forrentRepositoryProvider = Provider<ForrentRepository>.internal(
+  forrentRepository,
+  name: r'forrentRepositoryProvider',
+  debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
+      ? null
+      : _$forrentRepositoryHash,
+  dependencies: null,
+  allTransitiveDependencies: null,
+);
+
+@Deprecated('Will be removed in 3.0. Use Ref instead')
+// ignore: unused_element
+typedef ForrentRepositoryRef = ProviderRef<ForrentRepository>;
+// ignore_for_file: type=lint
+// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package

+ 57 - 0
packages/cpt_community/lib/modules/garage/for_rent/for_rent_state.dart

@@ -0,0 +1,57 @@
+class ForrentState {
+  int? activeTabIndex =0;
+  int? curPage =0;
+  int? pageSize =10;
+  int? filterCount =0;
+  List<String>? tabsList = ['For Sale', 'For Rent'];
+  List<Map<String, dynamic>>? list = [];
+
+  ForrentState({
+    this.activeTabIndex,
+    this.curPage,
+    this.pageSize,
+    this.filterCount,
+    this.tabsList,
+    this.list,
+  });
+
+  ForrentState copyWith({
+    int? activeTabIndex,
+    int? curPage,
+    int? pageSize,
+    int? filterCount,
+    List<String>? tabsList,
+    List<Map<String, dynamic>>? list,
+  }) {
+    return ForrentState(
+      activeTabIndex: activeTabIndex ?? this.activeTabIndex,
+      curPage: curPage ?? this.curPage,
+      pageSize: pageSize ?? this.pageSize,
+      filterCount: filterCount ?? this.filterCount,
+      tabsList: tabsList ?? this.tabsList,
+      list: list ?? this.list,
+    );
+  }
+
+  Map<String, dynamic> toMap() {
+    return {
+      'activeTabIndex': this.activeTabIndex,
+      'curPage': this.curPage,
+      'pageSize': this.pageSize,
+      'filterCount': this.filterCount,
+      'tabsList': this.tabsList,
+      'list': this.list,
+    };
+  }
+
+  factory ForrentState.fromMap(Map<String, dynamic> map) {
+    return ForrentState(
+      activeTabIndex: map['activeTabIndex'] as int,
+      curPage: map['curPage'] as int,
+      pageSize: map['pageSize'] as int,
+      filterCount: map['filterCount'] as int,
+      tabsList: map['tabsList'] as List<String>,
+      list: map['list'] as List<Map<String, dynamic>>,
+    );
+  }
+}

+ 196 - 241
packages/cpt_community/lib/modules/newsfeed/newsfeed_vm.dart

@@ -1,241 +1,196 @@
-
-import 'package:cpt_community/modules/newsfeed/newsfeed_post/newsfeed_post_page.dart';
-import 'package:cs_resources/generated/assets.dart';
-import 'package:flutter/material.dart';
-import 'package:plugin_platform/engine/toast/toast_engine.dart';
-import 'package:riverpod_annotation/riverpod_annotation.dart';
-import 'package:router/componentRouter/component_service_manager.dart';
-import 'package:router/ext/auto_router_extensions.dart';
-import 'package:router/path/router_path.dart';
-import 'package:shared/utils/color_utils.dart';
-import 'package:shared/utils/log_utils.dart';
-import 'package:auto_route/auto_route.dart';
-
-import '../../router/page/community_page_router.dart';
-import 'newsfeed_detail/newsfeed_detail_page.dart';
-import 'newsfeed_state.dart';
-import 'newsfeed_repository.dart';
-
-part 'newsfeed_vm.g.dart';
-
-@riverpod
-class NewsfeedVm extends _$NewsfeedVm {
-  late NewsfeedRepository newsfeedRepository;
-  NewsfeedState initState() {
-    return NewsfeedState(
-      useTag: 0,  // 当前 大类目的 标签  (News Feed / Garage Sale)
-      activeIndex: 0,  // 当前tab 索引
-      tabsList: [
-        {
-          'title': 'News',
-          'icon': null,
-          'active': true,
-          'activeTitleColor': Colors.white,
-          'activeTitleFontSize': 16,
-          'activeTitleBackgroundColor': ColorUtils.string2Color("#4161D0"),
-        },
-        {
-          'title': 'Following',
-          'icon': null,
-          'active': false,
-          'activeTitleColor': Colors.white,
-          'activeTitleFontSize': 16,
-          'activeTitleBackgroundColor': ColorUtils.string2Color("#4161D0"),
-        },
-        {
-          'title': 'For You',
-          'icon': null,
-          'activeTitleColor': Colors.white,
-          'activeTitleFontSize': 16,
-          'activeTitleBackgroundColor': ColorUtils.string2Color("#4161D0"),
-        }
-      ],
-      list: [
-          {
-            'id':1,
-            'avator': Assets.communityCamera,
-            'title': 'William Jefferson',
-            'isFollow': false,
-            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
-            'imageUrls': ['https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg'],
-            'time': 'June 17,2016 at 7:23 p.m.',
-              'isLike': true,
-            'likeno': 12
-          },
-          {
-            'id':2,
-            'avator': Assets.communityCamera,
-            'title': 'William fdsaf的飞洒发生的',
-            'isFollow': true,
-            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
-            'imageUrls': [],
-            'time': 'June 17,2016 at 7:23 p.m.',
-            'isLike': true,
-            'likeno': 12
-          },
-          {
-            'id':3,
-            'avator': Assets.communityCamera,
-            'title': 'Fsjfkds  dfsk',
-            'isFollow': false,
-            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
-            'imageUrls': [],
-            'time': 'June 17,2016 at 7:23 p.m.',
-            'isLike': false,
-            'likeno': 12
-          },
-          {
-            'id':4,
-            'avator': Assets.communityCamera,
-            'title': 'Fsjfkds  dfsk',
-            'isFollow': false,
-            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
-            'imageUrls': [],
-            'time': 'June 17,2016 at 7:23 p.m.',
-            'isLike': false,
-            'likeno': 12
-          },
-          {
-            'id':5,
-            'avator': Assets.communityCamera,
-            'title': 'Fsjfkds  dfsk',
-            'isFollow': false,
-            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
-            'imageUrls': [],
-            'time': 'June 17,2016 at 7:23 p.m.',
-            'isLike': false,
-            'likeno': 12
-          },
-          {
-            'id':6,
-            'avator': Assets.communityCamera,
-            'title': 'Fsjfkds  dfsk',
-            'isFollow': false,
-            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
-            'imageUrls': [],
-            'time': 'June 17,2016 at 7:23 p.m.',
-            'isLike': false,
-            'likeno': 12
-          },
-          {
-            'id':7,
-            'avator': Assets.communityCamera,
-            'title': '放大发大水',
-            'isFollow': false,
-            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
-            'imageUrls': [],
-            'time': 'June 17,2016 at 7:23 p.m.',
-            'isLike': false,
-            'likeno': 12
-          },
-      ]
-    );
-  }
-  @override
-  NewsfeedState build(){
-    // 引入数据仓库
-    newsfeedRepository = ref.read(newsfeedRepositoryProvider);
-    // 初始化状态
-    NewsfeedState state = initState();
-    return state;
-  }
-
-  // 上拉加载
-  Future onLoadData() async {
-    Log.d("----newsfeed_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();
-  }
-
-  // 获取list 列表数据
-  void getListData<T>() async {
-    Log.d("加载listData数据---------------start-----");
-    try {
-      //请求网络
-      Map<String, dynamic>  params = {
-        "curPage": state.curPage,
-        "pageSize": state.pageSize,
-      };
-      Log.d("请求参数------$params");
-      final result = await newsfeedRepository.fetchNewsfeedList(params);
-      Log.d("请求完成结果------${result.data}");
-      //校验成功失败
-      if (result.isSuccess) {
-        // state = state.copyWith(serverTime: result.data);
-        state = state;
-        ToastEngine.show("获取数据成功");
-      } else {
-        ToastEngine.show(result.errorMsg ?? "Network Load Error");
-      }
-    } catch (e) {
-      ToastEngine.show("Error: $e");
-    }
-  }
-
-
-  // 下拉刷新
-  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(newsfeedVmProvider);
-    getListData();
-
-  }
-
-
-
-  // 点击发布的按钮 跳转到发布的页面
-  void handlerGotoPost(context){
-    // ComponentServiceManager().communityService.startCommunityPage();
-
-    // AutoRouter.of(context).pushNamed(RouterPath.newsFeedPost);
-
-    NewsfeedPostPage.startInstance();
-  }
-
-  // 点击tab (news 、 following 、 for you)
-  void handlerClickTab(int index, item){
-    // 修改当前tab 的索引
-    state = state.copyWith(activeIndex: index);
-    print("切换后新的 sate, ${state.tabsList}");
-
-    // ref.invalidate(customTabsVmProvider);
-  }
-
-  // 点击 like comments  share
-  void handlerClickActionBtn(String? actionStr, item){
-    final id = item['id'];
-    switch (actionStr) {
-      case 'like':
-        Log.d("点击了 点赞");
-        handlerGotoDetail(id);
-        break;
-      case 'comments':
-        Log.d("点击了 评论");
-        handlerGotoDetail(id);
-        break;
-      case 'share':
-        Log.d("点击了 分享");
-        handlerGotoDetail(id);
-        break;
-      default:
-        break;
-    }
-  }
-  // 去详情页面
-  void handlerGotoDetail(id){
-    Log.d("去详情页面");
-    appRouter.push(NewsfeedDetailPageRoute(id: id));
-  }
-}
+import 'package:cs_resources/generated/assets.dart';
+import 'package:flutter/cupertino.dart';
+import 'package:plugin_platform/engine/toast/toast_engine.dart';
+import 'package:riverpod_annotation/riverpod_annotation.dart';
+import 'package:router/ext/auto_router_extensions.dart';
+import 'package:shared/utils/log_utils.dart';
+
+import '../../../router/page/community_page_router.dart';
+import '../garagesale_detail/garagesale_detail_page.dart';
+import 'for_rent_respository.dart';
+import 'for_rent_state.dart';
+
+part 'for_rent_vm.g.dart';
+
+@riverpod
+class ForrentVm extends _$ForrentVm {
+  late ForrentRepository ForrentRepositoryInstance;
+  ForrentState initState() {
+    return ForrentState(
+        list: [
+          {
+            'id':1,
+            'avator': Assets.communityCamera,
+            'title': 'William Jefferson',
+            'isFollow': false,
+            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+            'imageUrls': ['https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg'],
+            'time': 'June 17,2016 at 7:23 p.m.',
+            'isLike': true,
+            'likeno': 12
+          },
+          {
+            'id':2,
+            'avator': Assets.communityCamera,
+            'title': 'William fdsaf的飞洒发生的',
+            'isFollow': true,
+            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+            'imageUrls': [],
+            'time': 'June 17,2016 at 7:23 p.m.',
+            'isLike': true,
+            'likeno': 12
+          },
+          {
+            'id':3,
+            'avator': Assets.communityCamera,
+            'title': 'Fsjfkds  dfsk',
+            'isFollow': false,
+            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+            'imageUrls': [],
+            'time': 'June 17,2016 at 7:23 p.m.',
+            'isLike': false,
+            'likeno': 12
+          },
+          {
+            'id':4,
+            'avator': Assets.communityCamera,
+            'title': 'Fsjfkds  dfsk',
+            'isFollow': false,
+            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+            'imageUrls': [],
+            'time': 'June 17,2016 at 7:23 p.m.',
+            'isLike': false,
+            'likeno': 12
+          },
+          {
+            'id':5,
+            'avator': Assets.communityCamera,
+            'title': 'Fsjfkds  dfsk',
+            'isFollow': false,
+            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+            'imageUrls': [],
+            'time': 'June 17,2016 at 7:23 p.m.',
+            'isLike': false,
+            'likeno': 12
+          },
+          {
+            'id':6,
+            'avator': Assets.communityCamera,
+            'title': 'Fsjfkds  dfsk',
+            'isFollow': false,
+            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+            'imageUrls': [],
+            'time': 'June 17,2016 at 7:23 p.m.',
+            'isLike': false,
+            'likeno': 12
+          },
+          {
+            'id':7,
+            'avator': Assets.communityCamera,
+            'title': '放大发大水',
+            'isFollow': false,
+            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+            'imageUrls': [],
+            'time': 'June 17,2016 at 7:23 p.m.',
+            'isLike': false,
+            'likeno': 12
+          },
+        ]
+    );
+  }
+
+  @override
+  ForrentState build(){
+    // 引入数据仓库
+    ForrentRepositoryInstance = ref.read(forrentRepositoryProvider);
+    final state = initState();
+    Log.d("--------------------------build---------------------");
+
+    return state;
+  }
+
+  // 设置当前的 tabsRouter 和 pageController
+  Future setTabsRouterAndPageController(dynamic tabsRouter, dynamic pageController) async{
+    Log.d("setTabsRouterAndPageController---:$tabsRouter");
+  }
+
+// 上拉加载
+  Future onLoadData() async {
+    Log.d("----Forrent_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();
+  }
+
+  // 获取list 列表数据
+  void getListData<T>() async {
+    Log.d("加载listData数据---------------start-----");
+    try {
+      //请求网络
+      Map<String, dynamic>  params = {
+        "curPage": state.curPage,
+        "pageSize": state.pageSize,
+      };
+      Log.d("请求参数------$params");
+      final result = await ForrentRepositoryInstance.fetchForrentList(params);
+      Log.d("请求完成结果------${result.data}");
+      //校验成功失败
+      if (result.isSuccess) {
+        // state = state.copyWith(serverTime: result.data);
+        state = state;
+        ToastEngine.show("获取数据成功");
+      } else {
+        ToastEngine.show(result.errorMsg ?? "Network Load Error");
+      }
+    } catch (e) {
+      ToastEngine.show("Error: $e");
+    }
+  }
+
+
+  // 下拉刷新
+  Future refreshListData() async {
+    Log.d("----property_forrent_vm-----refreshListData ");
+
+    // await Future.delayed(const Duration(seconds: 2));
+
+    state = state.copyWith(curPage: 1, pageSize: 10);
+    // ref.invalidateSelf();
+    // ref.invalidate(ForrentVmProvider);
+    getListData();
+
+  }
+
+
+  // 点击 like comments  share
+  void handlerClickActionBtn(String? actionStr, item){
+    final id = item['id'];
+    switch (actionStr) {
+      case 'like':
+        Log.d("点击了 点赞");
+        handlerGotoDetail(id);
+        break;
+      case 'comments':
+        Log.d("点击了 评论");
+        handlerGotoDetail(id);
+        break;
+      case 'share':
+        Log.d("点击了 分享");
+        handlerGotoDetail(id);
+        break;
+      default:
+        break;
+    }
+  }
+  // 去详情页面
+  void handlerGotoDetail(id){
+    Log.d("去详情页面");
+    appRouter.push(GaragesaleDetailPageRoute(id: id, type: 'forrent'));
+  }
+}

+ 10 - 10
packages/cpt_community/lib/modules/community1/community_vm.g.dart

@@ -1,25 +1,25 @@
 // GENERATED CODE - DO NOT MODIFY BY HAND
 
-part of 'community_vm.dart';
+part of 'for_rent_vm.dart';
 
 // **************************************************************************
 // RiverpodGenerator
 // **************************************************************************
 
-String _$communityVmHash() => r'a967355f8abbdda59a2001d7766b42f8d7ebb6af';
+String _$forrentVmHash() => r'be5b4f8c70608acb43dcdf0a5562a821168feaca';
 
-/// See also [CommunityVm].
-@ProviderFor(CommunityVm)
-final communityVmProvider =
-    AutoDisposeNotifierProvider<CommunityVm, CommunityVmState>.internal(
-  CommunityVm.new,
-  name: r'communityVmProvider',
+/// See also [ForrentVm].
+@ProviderFor(ForrentVm)
+final forrentVmProvider =
+    AutoDisposeNotifierProvider<ForrentVm, ForrentState>.internal(
+  ForrentVm.new,
+  name: r'forrentVmProvider',
   debugGetCreateSourceHash:
-      const bool.fromEnvironment('dart.vm.product') ? null : _$communityVmHash,
+      const bool.fromEnvironment('dart.vm.product') ? null : _$forrentVmHash,
   dependencies: null,
   allTransitiveDependencies: null,
 );
 
-typedef _$CommunityVm = AutoDisposeNotifier<CommunityVmState>;
+typedef _$ForrentVm = AutoDisposeNotifier<ForrentState>;
 // ignore_for_file: type=lint
 // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package

+ 138 - 0
packages/cpt_community/lib/modules/garage/for_sale/for_sale_page.dart

@@ -0,0 +1,138 @@
+import 'package:cpt_community/components/garage_card_content.dart';
+import 'package:cpt_community/components/garage_card_footer.dart';
+import 'package:cs_resources/generated/assets.dart';
+import 'package:flutter/material.dart';
+import 'package:auto_route/auto_route.dart';
+import 'package:flutter/rendering.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/color_utils.dart';
+import 'package:shared/utils/log_utils.dart';
+import 'package:widgets/my_button.dart';
+import 'package:widgets/my_load_image.dart';
+import 'package:widgets/ext/ex_widget.dart';
+import 'package:widgets/my_text_view.dart';
+import 'package:widgets/my_appbar.dart';
+import 'package:cs_resources/theme/app_colors_theme.dart';
+import 'package:widgets/widget_export.dart';
+
+import '../../../components/garage_card_header.dart';
+import '../../../components/newfeed_card_header.dart';
+import '../../../router/page/community_page_router.dart';
+import 'for_sale_vm.dart';
+
+@RoutePage()
+class ForsalePage extends HookConsumerWidget {
+  const ForsalePage({Key? key}) : super(key: key);
+
+  //启动当前页面
+  static void startInstance({BuildContext? context}) {
+    if (context != null) {
+      context.router.push(const ForsalePageRoute());
+    } else {
+      appRouter.push(const ForsalePageRoute());
+    }
+  }
+
+  @override
+  Widget build(BuildContext context, WidgetRef ref) {
+    final vm = ref.read(forsaleVmProvider.notifier);
+    return Scaffold(
+      // appBar: MyAppBar.appBar(
+      //   context,
+      //   "Forsale",
+      //   backgroundColor: context.appColors.whiteBG,
+      // ),
+      // backgroundColor: ColorUtils.string2Color("#F2F3F6"),
+      body: Column(
+        children: [
+            Expanded(
+              child: EasyRefresh(
+                // 上拉加载
+                onLoad: () async{
+                  Log.d("----onLoad");
+                  vm.onLoadData();
+                },
+                // 下拉刷新
+                onRefresh: () async{
+                  Log.d("----onRefresh");
+                  vm.refreshListData();
+                },
+                child: _buildForsaleFeedList(context, ref, vm),
+              ),
+            )
+        ],
+      )
+    );
+  }
+
+  Widget _buildForsaleItem(BuildContext context, WidgetRef ref, item, vm){
+    return Container(
+      width: double.infinity,
+      //   color: Colors.yellow,
+      child: Stack(
+        children: [
+          Container(
+            margin: const EdgeInsets.only(left: 15, right: 15,top: 14,bottom: 14),
+            color: Colors.white,
+            padding: const EdgeInsets.only(left: 15, right: 15,top: 17,bottom: 17),
+            height: 280,
+            child: Column(
+                mainAxisAlignment: MainAxisAlignment.center,
+                crossAxisAlignment: CrossAxisAlignment.start,
+                children: [
+                  // 卡片头部(头像 标题 时间)
+                  GarageCardHeader(
+                    key: UniqueKey(),
+                    itemObj: item,
+                  ),
+                  const SizedBox(height: 15),
+                  // 卡片中间 (文字和图片)
+                  // Expanded(
+                  //   child: GarageCardContent(
+                  //     key: UniqueKey(),
+                  //     content: item['content'],
+                  //     imageUrls: item['imageUrls'],
+                  //   ),
+                  // ),
+                  const SizedBox(height: 26),
+                  // // 卡片底部 (点赞 评论 分享)
+                  // GarageCardFooter(
+                  //     key: UniqueKey(),
+                  //     isLike: item['isLike'],
+                  //     onLike: (){
+                  //       vm.handlerClickActionBtn('like', item);
+                  //     },
+                  //     onComment: (){
+                  //       vm.handlerClickActionBtn('comments', item);
+                  //     },
+                  //     onShare: (){
+                  //       vm.handlerClickActionBtn('share', item);
+                  //     },
+                  // ),
+                ]
+            ),
+          ),
+        ],
+      ),
+    );
+  }
+
+  Widget _buildForsaleFeedList(BuildContext context, WidgetRef ref, vm){
+    final itemList = vm.state.list?? [];
+    if(itemList.isEmpty){
+      return const Center(child: Text('No Data'));
+    }else {
+      List itemsList = vm.state.list.toList();
+      return ListView.builder(
+        key: UniqueKey(),
+        itemCount: itemsList.length,
+        itemBuilder: (context, index) {
+          return _buildForsaleItem(context, ref, itemsList[index], vm);
+        },
+      );
+    }
+    // return Text("879424");
+  }
+}

+ 71 - 0
packages/cpt_community/lib/modules/garage/for_sale/for_sale_respository.dart

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

+ 27 - 0
packages/cpt_community/lib/modules/garage/for_sale/for_sale_respository.g.dart

@@ -0,0 +1,27 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'for_sale_respository.dart';
+
+// **************************************************************************
+// RiverpodGenerator
+// **************************************************************************
+
+String _$newsRepositoryHash() => r'7ab7678f2c759f5bb8c99a9fcab769638c327fa0';
+
+/// See also [newsRepository].
+@ProviderFor(newsRepository)
+final newsRepositoryProvider = Provider<ForsaleRepository>.internal(
+  newsRepository,
+  name: r'newsRepositoryProvider',
+  debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
+      ? null
+      : _$newsRepositoryHash,
+  dependencies: null,
+  allTransitiveDependencies: null,
+);
+
+@Deprecated('Will be removed in 3.0. Use Ref instead')
+// ignore: unused_element
+typedef NewsRepositoryRef = ProviderRef<ForsaleRepository>;
+// ignore_for_file: type=lint
+// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package

+ 57 - 0
packages/cpt_community/lib/modules/garage/for_sale/for_sale_state.dart

@@ -0,0 +1,57 @@
+class ForsaleState {
+  int? activeTabIndex =0;
+  int? curPage =0;
+  int? pageSize =10;
+  int? filterCount =0;
+  List<String>? tabsList = ['For Sale', 'For Rent'];
+  List<Map<String, dynamic>>? list = [];
+
+  ForsaleState({
+    this.activeTabIndex,
+    this.curPage,
+    this.pageSize,
+    this.filterCount,
+    this.tabsList,
+    this.list,
+  });
+
+  ForsaleState copyWith({
+    int? activeTabIndex,
+    int? curPage,
+    int? pageSize,
+    int? filterCount,
+    List<String>? tabsList,
+    List<Map<String, dynamic>>? list,
+  }) {
+    return ForsaleState(
+      activeTabIndex: activeTabIndex ?? this.activeTabIndex,
+      curPage: curPage ?? this.curPage,
+      pageSize: pageSize ?? this.pageSize,
+      filterCount: filterCount ?? this.filterCount,
+      tabsList: tabsList ?? this.tabsList,
+      list: list ?? this.list,
+    );
+  }
+
+  Map<String, dynamic> toMap() {
+    return {
+      'activeTabIndex': this.activeTabIndex,
+      'curPage': this.curPage,
+      'pageSize': this.pageSize,
+      'filterCount': this.filterCount,
+      'tabsList': this.tabsList,
+      'list': this.list,
+    };
+  }
+
+  factory ForsaleState.fromMap(Map<String, dynamic> map) {
+    return ForsaleState(
+      activeTabIndex: map['activeTabIndex'] as int,
+      curPage: map['curPage'] as int,
+      pageSize: map['pageSize'] as int,
+      filterCount: map['filterCount'] as int,
+      tabsList: map['tabsList'] as List<String>,
+      list: map['list'] as List<Map<String, dynamic>>,
+    );
+  }
+}

+ 185 - 0
packages/cpt_community/lib/modules/garage/for_sale/for_sale_vm.dart

@@ -0,0 +1,185 @@
+import 'package:cs_resources/generated/assets.dart';
+import 'package:flutter/cupertino.dart';
+import 'package:plugin_platform/engine/toast/toast_engine.dart';
+import 'package:riverpod_annotation/riverpod_annotation.dart';
+import 'package:router/ext/auto_router_extensions.dart';
+import 'package:shared/utils/log_utils.dart';
+
+import '../../../router/page/community_page_router.dart';
+import '../garagesale_detail/garagesale_detail_page.dart';
+import 'for_sale_respository.dart';
+import 'for_sale_state.dart';
+
+part 'for_sale_vm.g.dart';
+
+@riverpod
+class ForsaleVm extends _$ForsaleVm {
+  late ForsaleRepository ForsaleRepositoryInstance;
+  ForsaleState initState() {
+    return ForsaleState(
+      list: [
+          {
+            'id':1,
+            'goods_img':  'https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg',
+            'title': 'Electronic keyboard',
+            'price': '\$66',
+            'isCollection': true,
+            'collection_num': '12',
+            'publisher': 'William Jefferson',
+            'publish_time': 'June 17,2016 at 7:23 p.m.',
+            'publisher_avator': Assets.communityCamera
+          },
+          {
+            'id':2,
+            'goods_img':  'https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg',
+            'title': 'Electronic keyboard',
+            'price': '\$88',
+            'isCollection': false,
+            'collection_num': '12',
+            'publisher': 'William Jefferson',
+            'publish_time': 'June 17,2016 at 7:23 p.m.',
+            'publisher_avator': Assets.communityCamera
+          },
+          {
+            'id':3,
+            'goods_img':  'https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg',
+            'title': 'Electronic keyboard',
+            'price': '\$66',
+            'isCollection': true,
+            'collection_num': '12',
+            'publisher': 'William Jefferson',
+            'publish_time': 'June 17,2016 at 7:23 p.m.',
+            'publisher_avator': Assets.communityCamera
+          },
+          {
+            'id':4,
+            'goods_img':  'https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg',
+            'title': 'Electronic keyboard',
+            'price': '\$88',
+            'isCollection': false,
+            'collection_num': '12',
+            'publisher': 'William Jefferson',
+            'publish_time': 'June 17,2016 at 7:23 p.m.',
+            'publisher_avator': Assets.communityCamera
+          },
+          {
+            'id':5,
+            'goods_img':  'https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg',
+            'title': 'Electronic keyboard',
+            'price': '\$66',
+            'isCollection': true,
+            'collection_num': '12',
+            'publisher': 'William Jefferson',
+            'publish_time': 'June 17,2016 at 7:23 p.m.',
+            'publisher_avator': Assets.communityCamera
+          },
+          {
+            'id':6,
+            'goods_img':  'https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg',
+            'title': 'Electronic keyboard',
+            'price': '\$88',
+            'isCollection': false,
+            'collection_num': '12',
+            'publisher': 'William Jefferson',
+            'publish_time': 'June 17,2016 at 7:23 p.m.',
+            'publisher_avator': Assets.communityCamera
+          },
+      ]
+    );
+  }
+
+  @override
+  ForsaleState build(){
+    // 引入数据仓库
+    ForsaleRepositoryInstance = ref.read(newsRepositoryProvider);
+    final state = initState();
+    Log.d("--------------------------build---------------------");
+
+    return state;
+  }
+
+   // 设置当前的 tabsRouter 和 pageController
+  Future setTabsRouterAndPageController(dynamic tabsRouter, dynamic pageController) async{
+    Log.d("setTabsRouterAndPageController---:$tabsRouter");
+  }
+
+// 上拉加载
+  Future onLoadData() async {
+    Log.d("----Forsale_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();
+  }
+
+  // 获取list 列表数据
+  void getListData<T>() async {
+    Log.d("加载listData数据---------------start-----");
+    try {
+      //请求网络
+      Map<String, dynamic>  params = {
+        "curPage": state.curPage,
+        "pageSize": state.pageSize,
+      };
+      Log.d("请求参数------$params");
+      final result = await ForsaleRepositoryInstance.fetchForsaleList(params);
+      Log.d("请求完成结果------${result.data}");
+      //校验成功失败
+      if (result.isSuccess) {
+        // state = state.copyWith(serverTime: result.data);
+        state = state;
+        ToastEngine.show("获取数据成功");
+      } else {
+        ToastEngine.show(result.errorMsg ?? "Network Load Error");
+      }
+    } catch (e) {
+      ToastEngine.show("Error: $e");
+    }
+  }
+
+
+  // 下拉刷新
+  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(ForsaleVmProvider);
+    getListData();
+
+  }
+
+
+  // 点击 like comments  share
+  void handlerClickActionBtn(String? actionStr, item){
+    final id = item['id'];
+    switch (actionStr) {
+      case 'like':
+        Log.d("点击了 点赞");
+        handlerGotoDetail(id);
+        break;
+      case 'comments':
+        Log.d("点击了 评论");
+        handlerGotoDetail(id);
+        break;
+      case 'share':
+        Log.d("点击了 分享");
+        handlerGotoDetail(id);
+        break;
+      default:
+        break;
+    }
+  }
+  // 去详情页面
+  void handlerGotoDetail(id){
+    Log.d("去详情页面");
+    appRouter.push(GaragesaleDetailPageRoute(id: id, type: 'forsale'));
+  }
+}

+ 25 - 0
packages/cpt_community/lib/modules/garage/for_sale/for_sale_vm.g.dart

@@ -0,0 +1,25 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'for_sale_vm.dart';
+
+// **************************************************************************
+// RiverpodGenerator
+// **************************************************************************
+
+String _$forsaleVmHash() => r'a63dd5772509b90fac8ede5ec692e01754dc6a22';
+
+/// See also [ForsaleVm].
+@ProviderFor(ForsaleVm)
+final forsaleVmProvider =
+    AutoDisposeNotifierProvider<ForsaleVm, ForsaleState>.internal(
+  ForsaleVm.new,
+  name: r'forsaleVmProvider',
+  debugGetCreateSourceHash:
+      const bool.fromEnvironment('dart.vm.product') ? null : _$forsaleVmHash,
+  dependencies: null,
+  allTransitiveDependencies: null,
+);
+
+typedef _$ForsaleVm = AutoDisposeNotifier<ForsaleState>;
+// ignore_for_file: type=lint
+// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package

+ 112 - 69
packages/cpt_community/lib/modules/garagesale/garagesale_page.dart

@@ -18,32 +18,38 @@ import 'package:widgets/widget_export.dart';
 
 import '../../components/newfeed_card_header.dart';
 import '../../router/page/community_page_router.dart';
-import '../community/community_vm.dart';
-import 'garagesale_tabs.dart';
+import '../garage/garage_vm.dart';
 
-import 'garagesale_vm.dart';
+import 'garage_tabs.dart';
+
+import 'garage_vm.dart';
 
 
 @RoutePage()
-class GaragesalePage extends HookConsumerWidget {
-  const GaragesalePage({Key? key}) : super(key: key);
+class GaragePage extends HookConsumerWidget {
+  const GaragePage({Key? key}) : super(key: key);
 
   //启动当前页面
   static void startInstance({BuildContext? context}) {
     if (context != null) {
-      context.router.push(const GaragesalePageRoute());
+      context.router.push(const GaragePageRoute());
     } else {
-      appRouter.push(const GaragesalePageRoute());
+      appRouter.push(const GaragePageRoute());
     }
   }
 
-  Widget _buildTabsSection(BuildContext context, WidgetRef ref, vm){
+  Widget _buildTabsSection(BuildContext context, WidgetRef ref, tabsRouter){
+    final vm = ref.read(garageVmProvider.notifier);
     return Container(
       width: double.infinity,
       padding: const EdgeInsets.only(left: 15, right: 15,top: 14,bottom: 14),
-      child: GaragesaleTabs(
-        key: ValueKey(vm.state.activeIndex),
+      child: GarageTabs(
+        key: UniqueKey(),
         tabsList: vm.state.tabsList,
+        tabsRouter: tabsRouter,
+        onClickAction:(activeTabIdx){
+          vm.handlerChangeTab(activeTabIdx, tabsRouter);
+        }
       ),
     );
   }
@@ -134,7 +140,7 @@ class GaragesalePage extends HookConsumerWidget {
     );
   }
 
-  Widget _buildNesFeedList(BuildContext context, WidgetRef ref, vm){
+  Widget _buildNewsFeedList(BuildContext context, WidgetRef ref, vm){
     final itemList = vm.state.list?? [];
     if(itemList.isEmpty){
       return const Center(child: Text('No Data'));
@@ -153,7 +159,7 @@ class GaragesalePage extends HookConsumerWidget {
 
   @override
   Widget build(BuildContext context, WidgetRef ref) {
-    final vm = ref.read(garagesaleVmProvider.notifier);
+    final vm = ref.read(garageVmProvider.notifier);
 
     return Scaffold(
       appBar: MyAppBar.searchAppBar(
@@ -169,66 +175,103 @@ class GaragesalePage extends HookConsumerWidget {
         ],
       ),
       backgroundColor: ColorUtils.string2Color("#F2F3F6"),
-      body: Column(
-        children: [
-          //  tab 分类 (For sale  For Rent)
-          _buildTabsSection(context, ref, vm),
-
-          // 发布组件
-          _buildPostSection(context, ref, vm),
-
-          NotificationListener<ScrollNotification>(
-            onNotification: (ScrollNotification notification) {
-              // 检查当前页面是否是可见的
-              bool isDownOrUp = notification.metrics.axis == Axis.vertical;
-              if (notification is UserScrollNotification) {
-                // 检查滚动方向
-                switch (notification.direction) {
-                  case ScrollDirection.forward:
-                    print('Scrolling down');
-                    break;
-                  case ScrollDirection.reverse:
-                    print('Scrolling up');
-                    break;
-                  case ScrollDirection.idle:
-                    print('Scrolling stopped');
-                    break;
-                }
-              } else if (notification is ScrollUpdateNotification) {
-                // 检查滚动位置变化
-                double currentScrollPosition = notification.metrics.pixels;
-                double maxScrollExtent = notification.metrics.maxScrollExtent;
-
-                // 判断是否满足某个条件
-                if (currentScrollPosition > 0 && currentScrollPosition < maxScrollExtent) {
-                  print('Current scroll position: $currentScrollPosition');
-                  // 在这里添加你的条件判断逻辑
-                }
-
-                // 只有当上下滚动时才拦截通知
-                if (notification.metrics.axis == Axis.vertical) {
-                  final tabsRouter = ref.watch(communityVmProvider).tabsRouter;
-                }
-              }
-              return false; // 返回 false 表示不拦截通知
-            },
-            child: Expanded(
-              child: EasyRefresh(
-                // 上拉加载
-                onLoad: () async{
-                  Log.d("----onLoad");
-                  vm.onLoadData();
-                },
-                // 下拉刷新
-                onRefresh: () async{
-                  Log.d("----onRefresh");
-                  vm.refreshListData();
+      body: NestedScrollView(
+        headerSliverBuilder: (context, innerBoxIsScrolled) {
+          return [
+            SliverToBoxAdapter(
+              child: Consumer(
+                builder: (context, ref, _) {
+                  return _buildTopSection(context, ref, vm);
                 },
-                child: _buildNesFeedList(context, ref, vm),
               ),
             ),
-          )
-        ],
+          ];
+        },
+        body: NotificationListener<ScrollNotification>(
+          onNotification: (ScrollNotification notification) {
+            // 是否拦截滚动  false 表示不拦截通知
+            // return _isPreventScroll(notification, ref);
+            return false;
+          },
+          child: AutoTabsRouter.pageView(
+            key: UniqueKey(),
+            routes: const [
+              ForsalePageRoute(),
+              ForrentPageRoute(),
+            ],
+            builder: (context, child, animation) {
+              final tabsRouter = AutoTabsRouter.of(context);
+              return Column(
+                children: [
+                  //  garagesale tab 分类 (For sale  For Rent)
+                  _buildTabsSection(context, ref, tabsRouter),
+                  // 发布 garage sale 组件
+                  _buildPostSection(context, ref, vm),
+                  Expanded(
+                    child: child,
+                  )
+                ],
+              );
+            },
+          ),
+        ),
+      ),
+    );
+  }
+
+  Widget _buildTopSection(BuildContext context, WidgetRef ref, vm) {
+    final topSectionsData = vm.topSectionsData;
+    int curTagIdx = 1;
+    return Container(
+      color: Colors.white,
+      padding: const EdgeInsets.only(top: 30, bottom: 30),
+      child: Center(
+        child: Row(
+          mainAxisAlignment: MainAxisAlignment.center,
+          crossAxisAlignment: CrossAxisAlignment.center,
+          children: List.generate(topSectionsData.length, (index) {
+            final item = topSectionsData[index];
+            return Flexible(
+              flex: 1,
+              child: Column(
+                children: [
+                  Container(
+                    width: MediaQuery.of(context).size.width / topSectionsData.length - 36,
+                    height: 70,
+                    decoration: BoxDecoration(
+                      // color: currentTabIdx == index ? ColorUtils.string2Color('#E6F2FF') : Colors.white,
+                      shape: BoxShape.circle, // 设置为圆形
+                      boxShadow: index == curTagIdx ? [
+                        BoxShadow(
+                          color: context.appColors.tabLightBlueShadow, // 设置阴影颜色
+                          blurRadius: 5, // 设置模糊半径
+                          spreadRadius: 0.05, // 控制阴影扩散
+                          offset: const Offset(0, 4), // 设置阴影偏移量
+                        ),                          ] : [],// 未选中时无阴影,
+                    ),
+                    child: MyAssetImage(
+                      item['icon'],
+                      width: MediaQuery.of(context).size.width / topSectionsData.length - 36,
+                      height: 70,
+                    ).onTap(() {
+                      vm.handlerChangeCommunityType(context,index);
+                    },
+                      type: ClickType.throttle,
+                    ),
+                  ),
+                  SizedBox.fromSize(size: const Size(0, 9)),
+                  MyTextView(
+                    item['title'],
+                    fontSize: 15,
+                    textColor: index == curTagIdx ? ColorUtils.string2Color('#4161D0'):Colors.black,
+                    textAlign: TextAlign.center,
+                    isFontMedium: true,
+                  ),
+                ],
+              ),
+            ).marginOnly(left: 18, right: 18, top: 10, bottom: 10);
+          }),
+        ),
       ),
     );
   }

+ 71 - 0
packages/cpt_community/lib/modules/garage/garage_repository.dart

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

+ 27 - 0
packages/cpt_community/lib/modules/garage/garage_repository.g.dart

@@ -0,0 +1,27 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'garage_repository.dart';
+
+// **************************************************************************
+// RiverpodGenerator
+// **************************************************************************
+
+String _$garageRepositoryHash() => r'93e545c5f107ba1eb1f1e188d7a4744046d0da64';
+
+/// See also [garageRepository].
+@ProviderFor(garageRepository)
+final garageRepositoryProvider = Provider<GarageRepository>.internal(
+  garageRepository,
+  name: r'garageRepositoryProvider',
+  debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
+      ? null
+      : _$garageRepositoryHash,
+  dependencies: null,
+  allTransitiveDependencies: null,
+);
+
+@Deprecated('Will be removed in 3.0. Use Ref instead')
+// ignore: unused_element
+typedef GarageRepositoryRef = ProviderRef<GarageRepository>;
+// ignore_for_file: type=lint
+// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package

+ 19 - 21
packages/cpt_community/lib/modules/garagesale/garagesale_state.dart

@@ -2,8 +2,8 @@ import 'package:cs_resources/generated/assets.dart';
 import 'package:flutter/material.dart';
 import 'package:shared/utils/color_utils.dart';
 
-class GaragesaleState {
-  int? useTag;
+class GarageState {
+  List<Map<String, dynamic>>? topSectionsData;
   int? curPage;
   int? pageSize;
   int? filterCount;
@@ -11,10 +11,18 @@ class GaragesaleState {
   List tabsList = [];
   List? list = [];
 
+  GarageState({
+    this.topSectionsData,
+    this.curPage,
+    this.pageSize,
+    this.filterCount,
+    this.activeIndex,
+    required this.tabsList,
+    this.list,
+  });
 
-
-  GaragesaleState copyWith({
-    int? useTag,
+  GarageState copyWith({
+    List<Map<String, dynamic>>? topSectionsData,
     int? curPage,
     int? pageSize,
     int? filterCount,
@@ -22,8 +30,8 @@ class GaragesaleState {
     List? tabsList,
     List? list,
   }) {
-    return GaragesaleState(
-      useTag: useTag ?? this.useTag,
+    return GarageState(
+      topSectionsData: topSectionsData ?? this.topSectionsData,
       curPage: curPage ?? this.curPage,
       pageSize: pageSize ?? this.pageSize,
       filterCount: filterCount ?? this.filterCount,
@@ -35,7 +43,7 @@ class GaragesaleState {
 
   Map<String, dynamic> toMap() {
     return {
-      'useTag': this.useTag,
+      'topSectionsData': this.topSectionsData,
       'curPage': this.curPage,
       'pageSize': this.pageSize,
       'filterCount': this.filterCount,
@@ -45,9 +53,9 @@ class GaragesaleState {
     };
   }
 
-  factory GaragesaleState.fromMap(Map<String, dynamic> map) {
-    return GaragesaleState(
-      useTag: map['useTag'] as int,
+  factory GarageState.fromMap(Map<String, dynamic> map) {
+    return GarageState(
+      topSectionsData: map['topSectionsData'] as List<Map<String, dynamic>>,
       curPage: map['curPage'] as int,
       pageSize: map['pageSize'] as int,
       filterCount: map['filterCount'] as int,
@@ -56,14 +64,4 @@ class GaragesaleState {
       list: map['list'] as List,
     );
   }
-
-  GaragesaleState({
-    this.useTag,
-    this.curPage,
-    this.pageSize,
-    this.filterCount,
-    this.activeIndex,
-    required this.tabsList,
-    this.list,
-  });
 }

+ 17 - 17
packages/cpt_community/lib/modules/garagesale/garagesale_tabs.dart

@@ -1,4 +1,3 @@
-import 'package:cpt_community/modules/newsfeed/newsfeed_vm.dart';
 import 'package:cs_resources/theme/app_colors_theme.dart';
 import 'package:flutter/material.dart';
 import 'package:auto_route/auto_route.dart';
@@ -13,30 +12,31 @@ import 'package:widgets/my_text_view.dart';
 import 'package:widgets/my_appbar.dart';
 
 import '../community/community_vm.dart';
-import '../garagesale/garagesale_vm.dart';
+import '../garage/garage_vm.dart';
 
-class GaragesaleTabs extends HookConsumerWidget {
+class GarageTabs extends HookConsumerWidget {
   List tabsList;
   Widget? Function(BuildContext)? tabItemBuilder;
-  VoidCallback? onClickAction;
-  GaragesaleTabs({
+  dynamic? tabsRouter;
+  void Function(int)? onClickAction;
+  GarageTabs({
     Key? key,
     required this.tabsList,
+    this.tabsRouter,
     this.onClickAction,
     this.tabItemBuilder
   }) : super(key: key);
 
   Widget _buildTabItem(BuildContext context, WidgetRef ref, vm, item, index) {
     // 监听 activeIndex 的变化
-    final activeIndex = ref.watch(garagesaleVmProvider.select((state) => state.activeIndex));
-
+    final activeTabIdx = tabsRouter!.activeIndex;
 
     return Container(
       width: MediaQuery.of(context).size.width / vm.state.tabsList.length - 30,
       height: 43,
       padding: const EdgeInsets.only(top: 10, bottom: 10, left: 10, right: 10),
-      decoration: index==activeIndex? BoxDecoration(
-        color: index==activeIndex? context.appColors.btnBgDefault: ColorUtils.string2Color("#F2F3F6"),
+      decoration: index==activeTabIdx? BoxDecoration(
+        color: index==activeTabIdx? context.appColors.btnBgDefault: ColorUtils.string2Color("#F2F3F6"),
         borderRadius: BorderRadius.circular(20),
         boxShadow: [
           BoxShadow(
@@ -57,22 +57,22 @@ class GaragesaleTabs extends HookConsumerWidget {
                 fontSize: 16,
                 textAlign: TextAlign.center,
                 isFontMedium: true,
-                textColor: index == activeIndex ? Colors.white :ColorUtils.string2Color("#000000"),
+                textColor: index == activeTabIdx ? Colors.white :ColorUtils.string2Color("#000000"),
               ),
-            ),
+            ).onTap((){
+              print("garage_tabs 中点击的tab index:  $index");
+              onClickAction?.call(index);
+            }),
           ),
         ],
       ),
-    ).onTap((){
-      vm.handlerClickTab(index, item);
-    });
+    );
   }
 
   List<Widget> _buildTabs(BuildContext context, WidgetRef ref, vm){
 
-    int currentUseTag = ref.watch(garagesaleVmProvider.select((state) => state.useTag!));
 
-    List tabsList = ref.read(garagesaleVmProvider).tabsList;
+    List tabsList = ref.read(garageVmProvider).tabsList;
 
     int tabsLength = tabsList.length;
 
@@ -83,7 +83,7 @@ class GaragesaleTabs extends HookConsumerWidget {
 
   @override
   Widget build(BuildContext context, WidgetRef ref) {
-    final vm = ref.read(garagesaleVmProvider.notifier);
+    final vm = ref.read(garageVmProvider.notifier);
     // 使用useEffect钩子
     useEffect(() {
       print('副作用函数执行');

+ 43 - 21
packages/cpt_community/lib/modules/garagesale/garagesale_vm.dart

@@ -1,4 +1,5 @@
 
+import 'package:cpt_community/modules/community/community_page.dart';
 import 'package:cs_resources/generated/assets.dart';
 import 'package:flutter/material.dart';
 import 'package:plugin_platform/engine/toast/toast_engine.dart';
@@ -8,18 +9,33 @@ import 'package:shared/utils/color_utils.dart';
 import 'package:shared/utils/log_utils.dart';
 import 'package:auto_route/auto_route.dart';
 
-import 'garagesale_state.dart';
-import 'garagesale_repository.dart';
+import 'garage_page.dart';
+import 'garage_state.dart';
+import 'garage_repository.dart';
 
-part 'garagesale_vm.g.dart';
+part 'garage_vm.g.dart';
 
 @riverpod
-class GaragesaleVm extends _$GaragesaleVm {
-  late GaragesaleRepository garagesaleRepository;
-  GaragesaleState initState() {
-    return GaragesaleState(
-        useTag: 1,
+class GarageVm extends _$GarageVm {
+  late GarageRepository garageRepository;
+  get topSectionsData => state.topSectionsData;
+  GarageState initState() {
+    return GarageState(
         activeIndex: 0,
+        topSectionsData: [
+          {
+            "title": "News Feed",
+            "icon": Assets.communityNesFeed,
+            "pageStartInstanceFn": CommunityPage.startInstance,
+            "page": const CommunityPage(),
+          },
+          {
+            "title": "Garage Sale",
+            "icon": Assets.communityGarageSale,
+            "pageStartInstanceFn": GaragePage.startInstance,
+            "page": const GaragePage(),
+          },
+        ],
         tabsList: [
           {
             'title': 'For Sale',
@@ -65,17 +81,17 @@ class GaragesaleVm extends _$GaragesaleVm {
     );
   }
   @override
-  GaragesaleState build(){
+  GarageState build(){
     // 引入数据仓库
-    garagesaleRepository = ref.read(garagesaleRepositoryProvider);
+    garageRepository = ref.read(garageRepositoryProvider);
     // 初始化状态
-    GaragesaleState state = initState();
+    GarageState state = initState();
     return state;
   }
 
   // 上拉加载
   Future onLoadData() async {
-    Log.d("----garagesale_vm-----initListData");
+    Log.d("----garage_vm-----initListData");
     // await Future.delayed(const Duration(seconds: 2));
     // if(state.list.length >= state.filterCount){
     //   return;
@@ -97,7 +113,7 @@ class GaragesaleVm extends _$GaragesaleVm {
         "pageSize": state.pageSize,
       };
       Log.d("请求参数------$params");
-      final result = await garagesaleRepository.fetchGaragesaleList(params);
+      final result = await garageRepository.fetchGarageList(params);
       Log.d("请求完成结果------${result.data}");
       //校验成功失败
       if (result.isSuccess) {
@@ -115,31 +131,37 @@ class GaragesaleVm extends _$GaragesaleVm {
 
   // 下拉刷新
   Future refreshListData() async {
-    Log.d("----garagesale_vm-----refreshListData ");
+    Log.d("----garage_vm-----refreshListData ");
 
     // await Future.delayed(const Duration(seconds: 2));
 
     state = state.copyWith(curPage: 1, pageSize: 10);
     // ref.invalidateSelf();
-    // ref.invalidate(garagesaleVmProvider);
+    // ref.invalidate(garageVmProvider);
     getListData();
 
   }
 
+  // 切换tab
+  handlerChangeTab(int index, tabsRouter) {
+    tabsRouter.setActiveIndex(index);
+    // state = state.copyWith(tabsRouter: tabsRouter ,activeTabIdx: index);
+    Log.d("garage_vm handlerChangeTab--index:    $index");
+  }
 
 
   // 点击发布的按钮 跳转到发布的页面
   void handlerGotoPost(context){
     // ComponentServiceManager().communityService.startCommunityPage();
-
     AutoRouter.of(context).pushNamed(RouterPath.garageSalePost);
   }
 
-  // 点击tab
-  void handlerClickTab(int index, item){
-    state = state.copyWith(activeIndex: index);
-    print("切换后新的 sate, ${state.tabsList}");
 
-    // ref.invalidate(customTabsVmProvider);
+  handlerChangeCommunityType(context, int index){
+    if(index == 0){
+      // 返回到 newsfeed 页面
+      Navigator.pop(context);
+    }
   }
+
 }

+ 10 - 10
packages/cpt_community/lib/modules/garagesale/garagesale_vm.g.dart

@@ -1,25 +1,25 @@
 // GENERATED CODE - DO NOT MODIFY BY HAND
 
-part of 'garagesale_vm.dart';
+part of 'garage_vm.dart';
 
 // **************************************************************************
 // RiverpodGenerator
 // **************************************************************************
 
-String _$garagesaleVmHash() => r'd531a4a4393b7310a34957d2636d8be9f4a3d697';
+String _$garageVmHash() => r'04b50f6dd914e6c44422b4ca33154dddf07e4cd0';
 
-/// See also [GaragesaleVm].
-@ProviderFor(GaragesaleVm)
-final garagesaleVmProvider =
-    AutoDisposeNotifierProvider<GaragesaleVm, GaragesaleState>.internal(
-  GaragesaleVm.new,
-  name: r'garagesaleVmProvider',
+/// See also [GarageVm].
+@ProviderFor(GarageVm)
+final garageVmProvider =
+    AutoDisposeNotifierProvider<GarageVm, GarageState>.internal(
+  GarageVm.new,
+  name: r'garageVmProvider',
   debugGetCreateSourceHash:
-      const bool.fromEnvironment('dart.vm.product') ? null : _$garagesaleVmHash,
+      const bool.fromEnvironment('dart.vm.product') ? null : _$garageVmHash,
   dependencies: null,
   allTransitiveDependencies: null,
 );
 
-typedef _$GaragesaleVm = AutoDisposeNotifier<GaragesaleState>;
+typedef _$GarageVm = AutoDisposeNotifier<GarageState>;
 // ignore_for_file: type=lint
 // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package

+ 8 - 5
packages/cpt_community/lib/modules/garagesale/garagesale_detail/garagesale_detail_page.dart

@@ -8,17 +8,20 @@ import 'package:widgets/my_appbar.dart';
 
 @RoutePage()
 class GaragesaleDetailPage extends HookConsumerWidget {
-  const GaragesaleDetailPage({Key? key}) : super(key: key);
+  final int? id;
+  final String? type;  // forsale  forrent
 
-  //启动当前页面
-  static void startInstance({BuildContext? context}) {
+  const GaragesaleDetailPage({Key? key, required this.id, required this.type}) : super(key: key);
+  // 启动当前页面
+  static void startInstance({BuildContext? context, int? id, String? type = 'forsale'}) {
     if (context != null) {
-      context.router.push(const GaragesaleDetailPageRoute());
+      context.router.push(GaragesaleDetailPageRoute(id: id, type: type));
     } else {
-      appRouter.push(const GaragesaleDetailPageRoute());
+      appRouter.push(GaragesaleDetailPageRoute(id: id, type: type));
     }
   }
 
+
   @override
   Widget build(BuildContext context, WidgetRef ref) {
     // final viewModel = ref.watch(newsfeedPostVmProvider.notifier);

packages/cpt_community/lib/modules/garagesale/garagesale_myposts/garagesale_myposts_page.dart → packages/cpt_community/lib/modules/garage/garagesale_myposts/garagesale_myposts_page.dart


packages/cpt_community/lib/modules/garagesale/garagesale_post/garagesale_post_page.dart → packages/cpt_community/lib/modules/garage/garagesale_post/garagesale_post_page.dart


packages/cpt_community/lib/modules/garagesale/garagesale_post/garagesale_post_state.dart → packages/cpt_community/lib/modules/garage/garagesale_post/garagesale_post_state.dart


packages/cpt_community/lib/modules/garagesale/garagesale_post/garagesale_post_vm.dart → packages/cpt_community/lib/modules/garage/garagesale_post/garagesale_post_vm.dart


packages/cpt_community/lib/modules/garagesale/garagesale_post/garagesale_post_vm.g.dart → packages/cpt_community/lib/modules/garage/garagesale_post/garagesale_post_vm.g.dart


+ 0 - 269
packages/cpt_community/lib/modules/newsfeed/newsfeed_page.dart

@@ -1,269 +0,0 @@
-
-import 'package:cpt_community/components/newsfeed_card_content.dart';
-import 'package:cpt_community/components/newsfeed_card_footer.dart';
-import 'package:cs_resources/generated/assets.dart';
-import 'package:flutter/material.dart';
-import 'package:auto_route/auto_route.dart';
-import 'package:flutter/rendering.dart';
-import 'package:hooks_riverpod/hooks_riverpod.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/my_load_image.dart';
-import 'package:widgets/my_text_view.dart';
-import 'package:widgets/widget_export.dart';
-import 'package:widgets/my_button.dart';
-
-import '../../components/newfeed_card_header.dart';
-import '../../router/page/community_page_router.dart';
-import '../community/community_vm.dart';
-import 'newsfeed_tabs.dart';
-import 'newsfeed_vm.dart';
-
-@RoutePage()
-class NewsfeedPage extends HookConsumerWidget {
-  const NewsfeedPage({Key? key}) : super(key: key);
-
-  //启动当前页面
-  static void startInstance({BuildContext? context}) {
-    if (context != null) {
-      context.router.push(const NewsfeedPageRoute());
-    } else {
-      appRouter.push(const NewsfeedPageRoute());
-    }
-  }
-
-  Widget _buildTabsSection(BuildContext context, WidgetRef ref, vm){
-    return Container(
-      width: double.infinity,
-      padding: const EdgeInsets.only(left: 15, right: 15,top: 14,bottom: 14),
-      child: NewsfeedTabs(
-        key: UniqueKey(),
-        tabsList: vm.state.tabsList,
-      ),
-    );
-  }
-
-  Widget _buildPostSection(BuildContext context, WidgetRef ref, vm){
-    return Container(
-      height: 65.5,
-      width: double.infinity,
-      padding: const EdgeInsets.only(left: 20, right: 20),
-      color: Colors.white,
-      child: Row(
-        children: [
-          const MyAssetImage(Assets.communityNesFeed, width: 45,height: 45,),
-         Expanded(
-            child: Row(
-              children: [
-                Expanded(
-                  child: Container(
-                    // height: 65.5,
-                    // color: Colors.blue,
-                    child: MyTextView(
-                      "What’s on your mind?",
-                      textColor: ColorUtils.string2Color('#000000'),
-                      fontSize: 15,
-                      marginLeft: 15,
-                      alignment: Alignment.centerLeft,
-                      textAlign: TextAlign.left,
-                      backgroundColor: ColorUtils.string2Color('#ffffff'),
-                      maxLines: 1,
-                      isFontMedium: true,
-                    ),
-                  ),
-                ),
-                const MyAssetImage(
-                  Assets.communityCamera,
-                  width: 21,
-                  height: 16.5,
-                ),
-              ],
-            ).onTap((){
-              vm.handlerGotoPost(context);
-            }),
-          ),
-        ],
-      ),
-    );
-  }
-
-  Widget _buildNewsItem(BuildContext context, WidgetRef ref, item, vm){
-    return Container(
-      width: double.infinity,
-      //   color: Colors.yellow,
-      child: Stack(
-        children: [
-          Container(
-            margin: const EdgeInsets.only(left: 15, right: 15,top: 14,bottom: 14),
-            color: Colors.white,
-            padding: const EdgeInsets.only(left: 15, right: 15,top: 17,bottom: 17),
-            height: 280,
-            child: Column(
-                mainAxisAlignment: MainAxisAlignment.center,
-                crossAxisAlignment: CrossAxisAlignment.start,
-                children: [
-                  // 卡片头部(头像 标题 时间)
-                  NewsFeedCardHeader(
-                    key: UniqueKey(),
-                    title: item['title'],
-                    avator: item['avator'],
-                    time: item['time'],
-                  ),
-                  const SizedBox(height: 15),
-                  // 卡片中间 (文字和图片)
-                  Expanded(
-                    child: NewsFeedCardContent(
-                      key: UniqueKey(),
-                      content: item['content'],
-                      imageUrls: item['imageUrls'],
-                    ),
-                  ),
-                  const SizedBox(height: 26),
-                  // // 卡片底部 (点赞 评论 分享)
-                  NewsFeedCardFooter(
-                      key: UniqueKey(),
-                      isLike: item['isLike'],
-                      onLike: (){
-                        vm.handlerClickActionBtn('like', item);
-                      },
-                      onComment: (){
-                        vm.handlerClickActionBtn('comments', item);
-                      },
-                      onShare: (){
-                        vm.handlerClickActionBtn('share', item);
-                      },
-                  ),
-                ]
-            ),
-          ),
-          // 右上角 关注/取消关注 按钮
-          Visibility(
-            visible: !item['isFollow'],
-            child: Positioned(
-              right: 40,
-              top: 35,
-              child: Container(
-                width: 83.5,
-                height: 45.5,
-                alignment: Alignment.center,
-                // decoration: BoxDecoration(
-                //   color:  ColorUtils.string2Color('#4161D0'),
-                //   borderRadius: BorderRadius.circular(5),
-                // ),
-                child: MyButton(
-                  text: '+Follow',
-                  textColor: Colors.white,
-                  backgroundColor: ColorUtils.string2Color('#4161D0'),
-                  radius: 8,
-                  minHeight: 27.5,
-                  padding: const EdgeInsets.only(left: 5, right: 5,top:9,bottom:9),
-                  fontWeight: FontWeight.w400,
-                  fontSize: 14,
-                  onPressed: (){
-                    // Navigator.pop(context);
-                  },
-                ),
-              )
-            ),
-          )
-        ],
-      ),
-    );
-  }
-
-  Widget _buildNesFeedList(BuildContext context, WidgetRef ref, vm){
-    final itemList = vm.state.list?? [];
-    if(itemList.isEmpty){
-      return const Center(child: Text('No Data'));
-    }else {
-      List itemsList = vm.state.list.toList();
-      return ListView.builder(
-        key: UniqueKey(),
-        itemCount: itemsList.length,
-        itemBuilder: (context, index) {
-          return _buildNewsItem(context, ref, itemsList[index], vm);
-        },
-      );
-    }
-  }
-
-
-  @override
-  Widget build(BuildContext context, WidgetRef ref) {
-    final vm = ref.read(newsfeedVmProvider.notifier);
-
-    return Scaffold(
-      backgroundColor: ColorUtils.string2Color("#F2F3F6"),
-      body: Column(
-          children: [
-            // 顶部的 tab
-            _buildTabsSection(context, ref, vm),
-            // post 组件
-            _buildPostSection(context, ref, vm),
-
-            // Expanded(
-            //   child: EasyRefresh(
-            //     // 上拉加载
-            //     onLoad: () async{
-            //       Log.d("----onLoad");
-            //       vm.onLoadData();
-            //     },
-            //     // 下拉刷新
-            //     onRefresh: () async{
-            //       Log.d("----onRefresh");
-            //       vm.refreshListData();
-            //     },
-            //     child: _buildNesFeedList(context, ref, vm),
-            //   ),
-            // )
-            NotificationListener <ScrollNotification>(
-              onNotification: (ScrollNotification notification) {
-                // // 检查当前页面是否是可见的
-                // bool isDownOrUp = notification.metrics.axis == Axis.vertical;
-                // if (notification is UserScrollNotification) {
-                //   // 检查滚动方向
-                //   switch (notification.direction) {
-                //     case ScrollDirection.forward:
-                //       print('Scrolling down');
-                //       break;
-                //     case ScrollDirection.reverse:
-                //       print('Scrolling up');
-                //       break;
-                //     case ScrollDirection.idle:
-                //       print('Scrolling stopped');
-                //       break;
-                //   }
-                // } else if (notification is ScrollUpdateNotification) {
-                //   // 检查滚动位置变化
-                //   double currentScrollPosition = notification.metrics.pixels;
-                //   double maxScrollExtent = notification.metrics.maxScrollExtent;
-                //
-                //   // 判断是否满足某个条件
-                //   if (currentScrollPosition > 0 && currentScrollPosition < maxScrollExtent) {
-                //     print('Current scroll position: $currentScrollPosition');
-                //     // 在这里添加你的条件判断逻辑
-                //   }
-                //
-                //   // 只有当上下滚动时才拦截通知
-                //   if (notification.metrics.axis == Axis.vertical) {
-                //     final tabsRouter = ref.watch(communityVmProvider).tabsRouter;
-                //     final curUseTag = ref.watch(communityVmProvider).useTag;
-                //     if(curUseTag != 0 ){
-                //       // 非当前 页面都阻止滚动
-                //       return true; // 返回 true 表示已处理通知
-                //     }
-                //   }
-                // }
-                return false; // 返回 false 表示不拦截通知
-              },
-              child: Expanded(
-                child: _buildNesFeedList(context, ref, vm),
-              ),
-            )
-          ],
-      ),
-    );
-  }
-}

+ 0 - 69
packages/cpt_community/lib/modules/newsfeed/newsfeed_state.dart

@@ -1,69 +0,0 @@
-import 'package:cs_resources/generated/assets.dart';
-import 'package:flutter/material.dart';
-import 'package:shared/utils/color_utils.dart';
-
-class NewsfeedState {
-  int? useTag = 0;
-  int? curPage;
-  int? pageSize;
-  int? filterCount;
-  int? activeIndex = 0;
-  List tabsList = [];
-  List? list = [];
-
-
-
-  NewsfeedState copyWith({
-    int? useTag,
-    int? curPage,
-    int? pageSize,
-    int? filterCount,
-    int? activeIndex,
-    List? tabsList,
-    List? list,
-  }) {
-    return NewsfeedState(
-      useTag: useTag ?? this.useTag,
-      curPage: curPage ?? this.curPage,
-      pageSize: pageSize ?? this.pageSize,
-      filterCount: filterCount ?? this.filterCount,
-      activeIndex: activeIndex ?? this.activeIndex,
-      tabsList: tabsList ?? this.tabsList,
-      list: list ?? this.list,
-    );
-  }
-
-  Map<String, dynamic> toMap() {
-    return {
-      'useTag': this.useTag,
-      'curPage': this.curPage,
-      'pageSize': this.pageSize,
-      'filterCount': this.filterCount,
-      'activeIndex': this.activeIndex,
-      'tabsList': this.tabsList,
-      'list': this.list,
-    };
-  }
-
-  factory NewsfeedState.fromMap(Map<String, dynamic> map) {
-    return NewsfeedState(
-      useTag: map['useTag'] as int,
-      curPage: map['curPage'] as int,
-      pageSize: map['pageSize'] as int,
-      filterCount: map['filterCount'] as int,
-      activeIndex: map['activeIndex'] as int,
-      tabsList: map['tabsList'] as List,
-      list: map['list'] as List,
-    );
-  }
-
-  NewsfeedState({
-    this.useTag,
-    this.curPage,
-    this.pageSize,
-    this.filterCount,
-    this.activeIndex,
-    required this.tabsList,
-    this.list,
-  });
-}

+ 33 - 28
packages/cpt_community/lib/router/page/community_page_router.dart

@@ -4,17 +4,22 @@ import 'package:router/ext/auto_router_extensions.dart';
 import 'package:router/path/router_path.dart';
 
 import '../../modules/community/community_page.dart';
-import '../../modules/garagesale/garagesale_detail/garagesale_detail_page.dart';
-import '../../modules/newsfeed/newsfeed_page.dart';
-import '../../modules/garagesale/garagesale_page.dart';
-import '../../modules/newsfeed/newsfeed_post/newsfeed_post_page.dart';
-import '../../modules/newsfeed/newsfeed_detail/newsfeed_detail_page.dart';
-import '../../modules/newsfeed/newsfeed_myposts/newsfeed_myposts_page.dart';
-import '../../modules/garagesale/garagesale_myposts/garagesale_myposts_page.dart';
-import '../../modules/garagesale/garagesale_post/garagesale_post_page.dart';
 import '../../modules/community/news/news_page.dart';
 import '../../modules/community/following/following_page.dart';
 import '../../modules/community/foryou/foryou_page.dart';
+import '../../modules/community/newsfeed_detail/newsfeed_detail_page.dart';
+import '../../modules/community/newsfeed_post/newsfeed_post_page.dart';
+import '../../modules/community/newsfeed_myposts/newsfeed_myposts_page.dart';
+
+import '../../modules/garage/garage_page.dart';
+import '../../modules/garage/for_sale/for_sale_page.dart';
+import '../../modules/garage/for_rent/for_rent_page.dart';
+import '../../modules/garage/garagesale_detail/garagesale_detail_page.dart';
+import '../../modules/garage/garagesale_post/garagesale_post_page.dart';
+import '../../modules/garage/garagesale_myposts/garagesale_myposts_page.dart';
+
+
+
 
 part 'community_page_router.gr.dart';
 
@@ -49,29 +54,9 @@ class CommunityPageRouter extends _$CommunityPageRouter {
                 path: RouterPath.newsfeedForyou,
                 transitionsBuilder: applySlideTransition,
             ),
-            // CustomRoute(
-            //     page: NewsfeedPageRoute.page,
-            //     path: RouterPath.newsFeed,
-            //     transitionsBuilder: applySlideTransition,
-            // ),
-            // CustomRoute(
-            //   page: GaragesalePageRoute.page,
-            //   path: RouterPath.garageSale,
-            //   transitionsBuilder: applySlideTransition,
-            // ),
         ],
     ),
     CustomRoute(
-        page: NewsfeedPageRoute.page,
-        path: RouterPath.newsFeed,
-        transitionsBuilder: applySlideTransition,
-    ),
-    CustomRoute(
-      page: GaragesalePageRoute.page,
-      path: RouterPath.garageSale,
-      transitionsBuilder: applySlideTransition,
-    ),
-    CustomRoute(
       page: NewsfeedPostPageRoute.page,
       path: RouterPath.newsFeedPost,
       transitionsBuilder: applySlideTransition,
@@ -86,6 +71,26 @@ class CommunityPageRouter extends _$CommunityPageRouter {
       path: RouterPath.newsFeedMyPosts,
       transitionsBuilder: applySlideTransition,
     ),
+    // Garage
+    CustomRoute(
+      page: GaragePageRoute.page,
+      path: RouterPath.garage,
+      transitionsBuilder: applySlideTransition,
+      children: [
+        // garageSale-forSale page
+        CustomRoute(
+          page: ForsalePageRoute.page,
+          path: RouterPath.garageForSale,
+          transitionsBuilder: applySlideTransition,
+        ),
+        // garageSale-forRent page
+        CustomRoute(
+          page: ForrentPageRoute.page,
+          path: RouterPath.garageForRent,
+          transitionsBuilder: applySlideTransition,
+        )
+      ]
+    ),
     CustomRoute(
       page: GaragesalePostPageRoute.page,
       path: RouterPath.garageSalePost,

+ 105 - 44
packages/cpt_community/lib/router/page/community_page_router.gr.dart

@@ -27,28 +27,45 @@ abstract class _$CommunityPageRouter extends RootStackRouter {
         child: const FollowingPage(),
       );
     },
+    ForrentPageRoute.name: (routeData) {
+      return AutoRoutePage<dynamic>(
+        routeData: routeData,
+        child: const ForrentPage(),
+      );
+    },
+    ForsalePageRoute.name: (routeData) {
+      return AutoRoutePage<dynamic>(
+        routeData: routeData,
+        child: const ForsalePage(),
+      );
+    },
     ForyouPageRoute.name: (routeData) {
       return AutoRoutePage<dynamic>(
         routeData: routeData,
         child: const ForyouPage(),
       );
     },
-    GaragesaleDetailPageRoute.name: (routeData) {
+    GaragePageRoute.name: (routeData) {
       return AutoRoutePage<dynamic>(
         routeData: routeData,
-        child: const GaragesaleDetailPage(),
+        child: const GaragePage(),
       );
     },
-    GaragesaleMypostsPageRoute.name: (routeData) {
+    GaragesaleDetailPageRoute.name: (routeData) {
+      final args = routeData.argsAs<GaragesaleDetailPageRouteArgs>();
       return AutoRoutePage<dynamic>(
         routeData: routeData,
-        child: const GaragesaleMypostsPage(),
+        child: GaragesaleDetailPage(
+          key: args.key,
+          id: args.id,
+          type: args.type,
+        ),
       );
     },
-    GaragesalePageRoute.name: (routeData) {
+    GaragesaleMypostsPageRoute.name: (routeData) {
       return AutoRoutePage<dynamic>(
         routeData: routeData,
-        child: const GaragesalePage(),
+        child: const GaragesaleMypostsPage(),
       );
     },
     GaragesalePostPageRoute.name: (routeData) {
@@ -70,6 +87,7 @@ abstract class _$CommunityPageRouter extends RootStackRouter {
         child: NewsfeedDetailPage(
           key: args.key,
           id: args.id,
+          type: args.type,
         ),
       );
     },
@@ -79,12 +97,6 @@ abstract class _$CommunityPageRouter extends RootStackRouter {
         child: const NewsfeedMypostsPage(),
       );
     },
-    NewsfeedPageRoute.name: (routeData) {
-      return AutoRoutePage<dynamic>(
-        routeData: routeData,
-        child: const NewsfeedPage(),
-      );
-    },
     NewsfeedPostPageRoute.name: (routeData) {
       return AutoRoutePage<dynamic>(
         routeData: routeData,
@@ -123,6 +135,34 @@ class FollowingPageRoute extends PageRouteInfo<void> {
 }
 
 /// generated route for
+/// [ForrentPage]
+class ForrentPageRoute extends PageRouteInfo<void> {
+  const ForrentPageRoute({List<PageRouteInfo>? children})
+      : super(
+          ForrentPageRoute.name,
+          initialChildren: children,
+        );
+
+  static const String name = 'ForrentPageRoute';
+
+  static const PageInfo<void> page = PageInfo<void>(name);
+}
+
+/// generated route for
+/// [ForsalePage]
+class ForsalePageRoute extends PageRouteInfo<void> {
+  const ForsalePageRoute({List<PageRouteInfo>? children})
+      : super(
+          ForsalePageRoute.name,
+          initialChildren: children,
+        );
+
+  static const String name = 'ForsalePageRoute';
+
+  static const PageInfo<void> page = PageInfo<void>(name);
+}
+
+/// generated route for
 /// [ForyouPage]
 class ForyouPageRoute extends PageRouteInfo<void> {
   const ForyouPageRoute({List<PageRouteInfo>? children})
@@ -137,43 +177,73 @@ class ForyouPageRoute extends PageRouteInfo<void> {
 }
 
 /// generated route for
-/// [GaragesaleDetailPage]
-class GaragesaleDetailPageRoute extends PageRouteInfo<void> {
-  const GaragesaleDetailPageRoute({List<PageRouteInfo>? children})
+/// [GaragePage]
+class GaragePageRoute extends PageRouteInfo<void> {
+  const GaragePageRoute({List<PageRouteInfo>? children})
       : super(
-          GaragesaleDetailPageRoute.name,
+          GaragePageRoute.name,
           initialChildren: children,
         );
 
-  static const String name = 'GaragesaleDetailPageRoute';
+  static const String name = 'GaragePageRoute';
 
   static const PageInfo<void> page = PageInfo<void>(name);
 }
 
 /// generated route for
-/// [GaragesaleMypostsPage]
-class GaragesaleMypostsPageRoute extends PageRouteInfo<void> {
-  const GaragesaleMypostsPageRoute({List<PageRouteInfo>? children})
-      : super(
-          GaragesaleMypostsPageRoute.name,
+/// [GaragesaleDetailPage]
+class GaragesaleDetailPageRoute
+    extends PageRouteInfo<GaragesaleDetailPageRouteArgs> {
+  GaragesaleDetailPageRoute({
+    Key? key,
+    required int? id,
+    required String? type,
+    List<PageRouteInfo>? children,
+  }) : super(
+          GaragesaleDetailPageRoute.name,
+          args: GaragesaleDetailPageRouteArgs(
+            key: key,
+            id: id,
+            type: type,
+          ),
           initialChildren: children,
         );
 
-  static const String name = 'GaragesaleMypostsPageRoute';
+  static const String name = 'GaragesaleDetailPageRoute';
 
-  static const PageInfo<void> page = PageInfo<void>(name);
+  static const PageInfo<GaragesaleDetailPageRouteArgs> page =
+      PageInfo<GaragesaleDetailPageRouteArgs>(name);
+}
+
+class GaragesaleDetailPageRouteArgs {
+  const GaragesaleDetailPageRouteArgs({
+    this.key,
+    required this.id,
+    required this.type,
+  });
+
+  final Key? key;
+
+  final int? id;
+
+  final String? type;
+
+  @override
+  String toString() {
+    return 'GaragesaleDetailPageRouteArgs{key: $key, id: $id, type: $type}';
+  }
 }
 
 /// generated route for
-/// [GaragesalePage]
-class GaragesalePageRoute extends PageRouteInfo<void> {
-  const GaragesalePageRoute({List<PageRouteInfo>? children})
+/// [GaragesaleMypostsPage]
+class GaragesaleMypostsPageRoute extends PageRouteInfo<void> {
+  const GaragesaleMypostsPageRoute({List<PageRouteInfo>? children})
       : super(
-          GaragesalePageRoute.name,
+          GaragesaleMypostsPageRoute.name,
           initialChildren: children,
         );
 
-  static const String name = 'GaragesalePageRoute';
+  static const String name = 'GaragesaleMypostsPageRoute';
 
   static const PageInfo<void> page = PageInfo<void>(name);
 }
@@ -213,12 +283,14 @@ class NewsfeedDetailPageRoute
   NewsfeedDetailPageRoute({
     Key? key,
     required int? id,
+    required String? type,
     List<PageRouteInfo>? children,
   }) : super(
           NewsfeedDetailPageRoute.name,
           args: NewsfeedDetailPageRouteArgs(
             key: key,
             id: id,
+            type: type,
           ),
           initialChildren: children,
         );
@@ -233,15 +305,18 @@ class NewsfeedDetailPageRouteArgs {
   const NewsfeedDetailPageRouteArgs({
     this.key,
     required this.id,
+    required this.type,
   });
 
   final Key? key;
 
   final int? id;
 
+  final String? type;
+
   @override
   String toString() {
-    return 'NewsfeedDetailPageRouteArgs{key: $key, id: $id}';
+    return 'NewsfeedDetailPageRouteArgs{key: $key, id: $id, type: $type}';
   }
 }
 
@@ -260,20 +335,6 @@ class NewsfeedMypostsPageRoute extends PageRouteInfo<void> {
 }
 
 /// generated route for
-/// [NewsfeedPage]
-class NewsfeedPageRoute extends PageRouteInfo<void> {
-  const NewsfeedPageRoute({List<PageRouteInfo>? children})
-      : super(
-          NewsfeedPageRoute.name,
-          initialChildren: children,
-        );
-
-  static const String name = 'NewsfeedPageRoute';
-
-  static const PageInfo<void> page = PageInfo<void>(name);
-}
-
-/// generated route for
 /// [NewsfeedPostPage]
 class NewsfeedPostPageRoute extends PageRouteInfo<void> {
   const NewsfeedPostPageRoute({List<PageRouteInfo>? children})

+ 3 - 1
packages/cpt_notice_board/lib/modules/documents/page/documents_page.dart

@@ -11,6 +11,7 @@ import 'package:widgets/widget_export.dart';
 import 'package:cs_resources/generated/assets.dart';
 
 import '../../../router/page/notice_board_page_router.dart';
+import '../../documents_list/page/documents_list_page.dart';
 import '../vm/documents_vm.dart';
 
 @RoutePage()
@@ -104,7 +105,8 @@ class DocumentsPage extends HookConsumerWidget {
         ],
       ).onTap(() {
         // 去详情
-        _vm.goNewsDetail(item);
+        // _vm.goNewsDetail(item);
+        DocumentsListPage.startInstance(context: context);
       }),
     ).marginOnly(left: 15, bottom: 15, right: 15);
   }

+ 154 - 0
packages/cpt_notice_board/lib/modules/documents_list/page/documents_list_page.dart

@@ -0,0 +1,154 @@
+import 'package:cpt_notice_board/modules/notice_board/page/notice_board_page.dart';
+import 'package:cs_resources/theme/app_colors_theme.dart';
+import 'package:flutter/material.dart';
+import 'package:auto_route/auto_route.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/my_appbar.dart';
+import 'package:widgets/my_load_image.dart';
+import 'package:widgets/widget_export.dart';
+import 'package:cs_resources/generated/assets.dart';
+
+import '../../../router/page/notice_board_page_router.dart';
+import '../vm/documents_list_vm.dart';
+
+@RoutePage()
+class DocumentsListPage extends HookConsumerWidget {
+  const DocumentsListPage({Key? key}) : super(key: key);
+
+  //启动当前页面
+  static void startInstance({BuildContext? context}) {
+    if (context != null) {
+      context.router.push(const DocumentsListPageRoute());
+    } else {
+      appRouter.push(const DocumentsListPageRoute());
+    }
+  }
+
+  Widget _buildItemLeftSection(BuildContext context, WidgetRef ref, item, _vm) {
+    return Container(
+      // color: Colors.blue,
+      child: Text(
+        item['title'],
+        maxLines: 2, // 设置最大行数为2
+        overflow: TextOverflow.ellipsis, // 超出部分用省略号表示
+        style: const TextStyle(
+            fontSize: 16.0,
+            color: Colors.black,
+            fontWeight: FontWeight.w700), // 设置字体大小
+      ),
+    ).marginOnly(right: 17.5);
+  }
+
+  Widget _buildItemRightSection(
+      BuildContext context, WidgetRef ref, item, _vm) {
+    return Container(
+      color: Colors.white,
+      child: TextButton(
+        onPressed: () {},
+        style: TextButton.styleFrom(
+          foregroundColor: Colors.black,
+          backgroundColor: ColorUtils.string2Color('#4161D0'), // 背景颜色
+          minimumSize: const Size(91.5, 30), // 最小宽度和高度
+          padding:
+              const EdgeInsets.symmetric(horizontal: 11.0, vertical: 9), // 内边距
+          shape: RoundedRectangleBorder(
+            borderRadius: BorderRadius.circular(5), // 圆角
+            side: BorderSide(
+              color: ColorUtils.string2Color('#4161D0'),
+              width: 1.0,
+            ), // 边框
+          ),
+        ),
+        child: const Text('Open Folder',
+          style: const TextStyle(color: Colors.white,),
+        ),
+      ),
+    );
+  }
+
+  // listitem
+  Widget _buildSaleItem(BuildContext context, WidgetRef ref, item, _vm) {
+    return Container(
+      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: Row(
+        mainAxisAlignment: MainAxisAlignment.center,
+        crossAxisAlignment: CrossAxisAlignment.center,
+        mainAxisSize: MainAxisSize.max,
+        children: [
+          Container(
+            width: MediaQuery.of(context).size.width - 30,
+            height: 70,
+            child: Row(
+              mainAxisAlignment: MainAxisAlignment.start,
+              crossAxisAlignment: CrossAxisAlignment.center,
+              children: [
+                Expanded(child: _buildItemLeftSection(context, ref, item, _vm)),
+                Container(
+                  // width: 120,
+                  // child: _buildItemRightSection(context, ref, item, _vm),
+                  // child: TextButton(onPressed: (){}, child: Text("fdsfds")),
+                ),
+              ],
+            ).paddingOnly(left: 20,right: 20),
+          ).constrained(
+            minHeight: 70,
+          ),
+        ],
+      ).onTap(() {
+        // 去详情
+        _vm.goNewsDetail(item);
+      }),
+    ).marginOnly(left: 15, bottom: 15, right: 15);
+  }
+
+  // list
+  Widget _buildSaleList(BuildContext context, WidgetRef ref, _vm) {
+    List itemsList = _vm.state.list.toList();
+    return ListView.builder(
+      itemCount: itemsList.length,
+      itemBuilder: (context, index) {
+        return _buildSaleItem(context, ref, itemsList[index], _vm);
+      },
+    );
+  }
+
+  @override
+  Widget build(BuildContext context, WidgetRef ref) {
+    final _vm = ref.read(documentsListVmProvider.notifier);
+
+    return Scaffold(
+      appBar: MyAppBar.appBar(
+        context,
+        "Documents",
+        backgroundColor: context.appColors.whiteBG,
+      ),
+      body: Container(
+          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),
+            child: _buildSaleList(context, ref, _vm)),
+      )),
+    );
+  }
+}

+ 49 - 0
packages/cpt_notice_board/lib/modules/documents_list/page/documents_list_state.dart

@@ -0,0 +1,49 @@
+/// YApi QuickType插件生成,具体参考文档:https://plugins.jetbrains.com/plugin/18847-yapi-quicktype/documentation
+
+import 'dart:convert';
+
+DocumentsListState documentsListStateFromJson(String str) => DocumentsListState.fromJson(json.decode(str));
+
+String documentsListStateToJson(DocumentsListState data) => json.encode(data.toJson());
+
+class DocumentsListState {
+  DocumentsListState({
+    required this.curPage,
+    required this.pageSize,
+    required this.list,
+    required this.filterCount,
+  });
+
+  int curPage;
+  int pageSize;
+  List<Map<String, dynamic>> list;
+  int filterCount;
+
+  factory DocumentsListState.fromJson(Map<dynamic, dynamic> json) => DocumentsListState(
+    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,
+  };
+
+  DocumentsListState copyWith({
+    int? curPage,
+    int? pageSize,
+    List<Map<String, dynamic>>? list,
+    int? filterCount,
+  }) {
+    return DocumentsListState(
+      curPage: curPage ?? this.curPage,
+      pageSize: pageSize ?? this.pageSize,
+      list: list ?? this.list,
+      filterCount: filterCount ?? this.filterCount,
+    );
+  }
+}

+ 70 - 0
packages/cpt_notice_board/lib/modules/documents_list/repository/documents_list_repository.dart

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

+ 28 - 0
packages/cpt_notice_board/lib/modules/documents_list/repository/documents_list_repository.g.dart

@@ -0,0 +1,28 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'documents_list_repository.dart';
+
+// **************************************************************************
+// RiverpodGenerator
+// **************************************************************************
+
+String _$documentsListRepositoryHash() =>
+    r'68370656250ee691445b4293c3b30568d4ebf20b';
+
+/// See also [documentsListRepository].
+@ProviderFor(documentsListRepository)
+final documentsListRepositoryProvider = Provider<DocumentsListRepository>.internal(
+  documentsListRepository,
+  name: r'documentsListRepositoryProvider',
+  debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
+      ? null
+      : _$documentsListRepositoryHash,
+  dependencies: null,
+  allTransitiveDependencies: null,
+);
+
+@Deprecated('Will be removed in 3.0. Use Ref instead')
+// ignore: unused_element
+typedef DocumentsListRepositoryRef = ProviderRef<DocumentsListRepository>;
+// ignore_for_file: type=lint
+// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package

+ 105 - 0
packages/cpt_notice_board/lib/modules/documents_list/vm/documents_list_vm.dart

@@ -0,0 +1,105 @@
+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 '../page/documents_list_state.dart';
+import '../repository/documents_list_repository.dart';
+part 'documents_list_vm.g.dart';
+
+@riverpod
+class DocumentsListVm extends _$DocumentsListVm {
+  late DocumentsListRepository documentsListRepository;
+  DocumentsListState initState() {
+    return DocumentsListState(
+      curPage: 1,
+      pageSize: 10,
+      list: [
+        {
+          "id": 1,
+          "title": "18 Sep 2024 BIK 39#09-XX 1337 psd 1001 sqft 39#09-XX 1337 psd 1001",
+          "price": "\$1.338 M",
+        },  
+        {
+          "id": 2,
+          "title": "18 Sep 2024 BIK 39#09-XX 1337 psd 1001 sqft",
+          "price": "\$1.338 M",
+        },
+      ],
+      filterCount: 2,
+    );
+  }
+
+  @override
+  DocumentsListState build() {
+    // 引入数据仓库
+    documentsListRepository = ref.read(documentsListRepositoryProvider);
+    // 初始化状态
+    DocumentsListState state = initState();
+    // 初始化列表数据
+    return state;
+  }
+
+  // 初始化页面数据
+  initPageData() {
+    Log.d("----property_news_vm-----initPageData");
+    refreshListData();
+  }
+
+  // 上拉加载
+  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();
+  }
+// 去新闻详情页
+  void goNewsDetail(String item) {
+    Log.d(item);
+    // PropertyPage.startInstance(context: context, item: item);
+  }
+  // 获取list 列表数据
+  void getListData<T>() async {
+    Log.d("加载listData数据---------------start-----");
+    try {
+      //请求网络
+      Map<String, dynamic>  params = {
+        "curPage": state.curPage,
+        "pageSize": state.pageSize,
+      };
+      Log.d("请求参数------$params");
+      final result = await documentsListRepository.fetchPropertyNewsList(params);
+      Log.d("请求完成结果------${result.data}");
+      //校验成功失败
+      if (result.isSuccess) {
+        // state = state.copyWith(serverTime: result.data);
+        state = state;
+        ToastEngine.show("获取数据成功");
+      } else {
+        ToastEngine.show(result.errorMsg ?? "Network Load Error");
+      }
+    } catch (e) {
+      ToastEngine.show("Error: $e");
+    }
+  }
+
+
+  // 下拉刷新
+  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();
+
+  }
+
+}

+ 25 - 0
packages/cpt_notice_board/lib/modules/documents_list/vm/documents_list_vm.g.dart

@@ -0,0 +1,25 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'documents_list_vm.dart';
+
+// **************************************************************************
+// RiverpodGenerator
+// **************************************************************************
+
+String _$documentsListVmHash() => r'066315b56e78a801d048576f75f1e30b4816dbf5';
+
+/// See also [DocumentsListVm].
+@ProviderFor(DocumentsListVm)
+final documentsListVmProvider =
+    AutoDisposeNotifierProvider<DocumentsListVm, DocumentsListState>.internal(
+  DocumentsListVm.new,
+  name: r'documentsListVmProvider',
+  debugGetCreateSourceHash:
+      const bool.fromEnvironment('dart.vm.product') ? null : _$documentsListVmHash,
+  dependencies: null,
+  allTransitiveDependencies: null,
+);
+
+typedef _$DocumentsListVm = AutoDisposeNotifier<DocumentsListState>;
+// ignore_for_file: type=lint
+// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package

+ 6 - 1
packages/cpt_notice_board/lib/modules/event/page/event_page.dart

@@ -1,3 +1,4 @@
+import 'package:cpt_notice_board/modules/event_detail/page/event_detail_page.dart';
 import 'package:cpt_notice_board/modules/notice_board/page/notice_board_page.dart';
 import 'package:flutter/material.dart';
 import 'package:auto_route/auto_route.dart';
@@ -86,7 +87,11 @@ class EventPage extends HookConsumerWidget {
         ],
       ).onTap(() {
         // 去详情
-        _vm.goNewsDetail(item['title']);
+        // _vm.goNewsDetail(item['title']);
+        Navigator.push(
+          context,
+          MaterialPageRoute(builder: (context) => const EventDetailPage()),
+        );
       }),
     ).marginOnly(left: 15, bottom: 15, right: 15);
   }

+ 121 - 0
packages/cpt_notice_board/lib/modules/event_detail/page/event_detail_page.dart

@@ -0,0 +1,121 @@
+import 'package:cpt_notice_board/modules/notice_board/page/notice_board_page.dart';
+import 'package:cs_resources/theme/app_colors_theme.dart';
+import 'package:flutter/material.dart';
+import 'package:auto_route/auto_route.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/my_appbar.dart';
+import 'package:widgets/my_load_image.dart';
+import 'package:widgets/widget_export.dart';
+import 'package:cs_resources/generated/assets.dart';
+
+import '../../../router/page/notice_board_page_router.dart';
+import '../vm/event_detail_vm.dart';
+
+@RoutePage()
+class EventDetailPage extends HookConsumerWidget {
+  const EventDetailPage({Key? key}) : super(key: key);
+
+  //启动当前页面
+  static void startInstance({BuildContext? context}) {
+    if (context != null) {
+      context.router.push(const EventDetailPageRoute());
+    } else {
+      appRouter.push(const EventDetailPageRoute());
+    }
+  }
+
+  Widget _buildDetailTop(BuildContext context, WidgetRef ref, _vm) {
+    // List itemsList = _vm.state.list.toList();
+    return Column(
+      children: [
+        Column(children: [
+          const Text(
+            'STANDARD OPERATING PROCEDURE FOR REPLACEMENT VEHICLES AND OVERNICHT PARKING VEHICLES(REMINDER)',
+            style: TextStyle(
+                fontSize: 18.0,
+                color: Colors.black,
+                fontWeight: FontWeight.w700), // 设置字体大小
+          ),
+          Row(
+            mainAxisAlignment: MainAxisAlignment.start,
+            crossAxisAlignment: CrossAxisAlignment.center,
+            children: [
+              const MyAssetImage(
+                Assets.noticeBoardAnnouncementDetailOur,
+                width: 15,
+                height: 15,
+              ).marginOnly(right: 8),
+              const Text(
+                'Our ref: ',
+                style: TextStyle(
+                    fontSize: 15.0,
+                    color: Colors.black,
+                    fontWeight: FontWeight.w700), // 设置字体大小
+              ),
+              const Text(
+                '2024/CORR/CIR/112.V5',
+                style: TextStyle(
+                    fontSize: 15.0,
+                    color: Colors.black,
+                    fontWeight: FontWeight.w400), // 设置字体大小
+              ),
+            ],
+          ).marginOnly(top: 15),
+          const MyAssetImage(
+            Assets.propertyHomeLoanBg,
+            // width: 15,
+            // height: 15,
+          ).marginOnly(top: 25),
+        ]).paddingOnly(bottom: 25),
+        Column(
+          children: [
+            const Column(
+              mainAxisAlignment: MainAxisAlignment.center,
+              crossAxisAlignment: CrossAxisAlignment.center,
+              children: [
+                Text(
+                  'IMPORTANT',
+                  style: TextStyle(
+                      fontSize: 18.0,
+                      color: Colors.black,
+                      fontWeight: FontWeight.w700), // 设置字体大小
+                )
+              ],
+            ).marginOnly(bottom: 25),
+            const Text(
+              'Dear Residents,STANDARD OPERATING PROCEDURE FORREPLACEMENT VEHICLES ANDOVERNICHT PARKING VEHICLES',
+              style: TextStyle(
+                  fontSize: 15.0,
+                  color: Colors.black,
+                  fontWeight: FontWeight.w400), // 设置字体大小
+            ),
+          ],
+        ).paddingOnly(top: 25, bottom: 50),
+      ],
+    );
+  }
+
+  @override
+  Widget build(BuildContext context, WidgetRef ref) {
+    final _vm = ref.read(eventDetailVmProvider.notifier);
+
+    return Scaffold(
+      appBar: MyAppBar.appBar(
+        context,
+        "Lift Padding",
+        backgroundColor: context.appColors.whiteBG,
+      ),
+      body: Container(
+          child: EasyRefresh(
+        child: Container(
+            color: ColorUtils.string2Color('#FFFFFF'),
+            padding: const EdgeInsets.only(top: 30, left: 15, right: 15),
+            child: _buildDetailTop(context, ref, _vm)),
+      )),
+    );
+  }
+}

+ 49 - 0
packages/cpt_notice_board/lib/modules/event_detail/page/event_detail_state.dart

@@ -0,0 +1,49 @@
+/// YApi QuickType插件生成,具体参考文档:https://plugins.jetbrains.com/plugin/18847-yapi-quicktype/documentation
+
+import 'dart:convert';
+
+EventDetailState eventDetailStateFromJson(String str) => EventDetailState.fromJson(json.decode(str));
+
+String eventDetailStateToJson(EventDetailState data) => json.encode(data.toJson());
+
+class EventDetailState {
+  EventDetailState({
+    required this.curPage,
+    required this.pageSize,
+    required this.list,
+    required this.filterCount,
+  });
+
+  int curPage;
+  int pageSize;
+  List<Map<String, dynamic>> list;
+  int filterCount;
+
+  factory EventDetailState.fromJson(Map<dynamic, dynamic> json) => EventDetailState(
+    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,
+  };
+
+  EventDetailState copyWith({
+    int? curPage,
+    int? pageSize,
+    List<Map<String, dynamic>>? list,
+    int? filterCount,
+  }) {
+    return EventDetailState(
+      curPage: curPage ?? this.curPage,
+      pageSize: pageSize ?? this.pageSize,
+      list: list ?? this.list,
+      filterCount: filterCount ?? this.filterCount,
+    );
+  }
+}

+ 70 - 0
packages/cpt_notice_board/lib/modules/event_detail/repository/event_detail_repository.dart

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

+ 28 - 0
packages/cpt_notice_board/lib/modules/event_detail/repository/event_detail_repository.g.dart

@@ -0,0 +1,28 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'event_detail_repository.dart';
+
+// **************************************************************************
+// RiverpodGenerator
+// **************************************************************************
+
+String _$eventDetailRepositoryHash() =>
+    r'73919ad1420beb9634eb70952bebb29e6b8f21d7';
+
+/// See also [eventDetailRepository].
+@ProviderFor(eventDetailRepository)
+final eventDetailRepositoryProvider = Provider<EventDetailRepository>.internal(
+  eventDetailRepository,
+  name: r'eventDetailRepositoryProvider',
+  debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
+      ? null
+      : _$eventDetailRepositoryHash,
+  dependencies: null,
+  allTransitiveDependencies: null,
+);
+
+@Deprecated('Will be removed in 3.0. Use Ref instead')
+// ignore: unused_element
+typedef EventDetailRepositoryRef = ProviderRef<EventDetailRepository>;
+// ignore_for_file: type=lint
+// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package

+ 105 - 0
packages/cpt_notice_board/lib/modules/event_detail/vm/event_detail_vm.dart

@@ -0,0 +1,105 @@
+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 '../page/event_detail_state.dart';
+import '../repository/event_detail_repository.dart';
+part 'event_detail_vm.g.dart';
+
+@riverpod
+class EventDetailVm extends _$EventDetailVm {
+  late EventDetailRepository eventDetailRepository;
+  EventDetailState initState() {
+    return EventDetailState(
+      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,
+    );
+  }
+
+  @override
+  EventDetailState build() {
+    // 引入数据仓库
+    eventDetailRepository = ref.read(eventDetailRepositoryProvider);
+    // 初始化状态
+    EventDetailState state = initState();
+    // 初始化列表数据
+    return state;
+  }
+
+  // 初始化页面数据
+  initPageData() {
+    Log.d("----property_news_vm-----initPageData");
+    refreshListData();
+  }
+
+  // 上拉加载
+  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();
+  }
+
+// 去新闻详情页
+  void goNewsDetail(String item) {
+    Log.d(item);
+    // PropertyPage.startInstance(context: context, item: item);
+  }
+
+  // 获取list 列表数据
+  void getListData<T>() async {
+    Log.d("加载listData数据---------------start-----");
+    try {
+      //请求网络
+      Map<String, dynamic> params = {
+        "curPage": state.curPage,
+        "pageSize": state.pageSize,
+      };
+      Log.d("请求参数------$params");
+      final result = await eventDetailRepository.fetchPropertyNewsList(params);
+      Log.d("请求完成结果------${result.data}");
+      //校验成功失败
+      if (result.isSuccess) {
+        // state = state.copyWith(serverTime: result.data);
+        state = state;
+        ToastEngine.show("获取数据成功");
+      } else {
+        ToastEngine.show(result.errorMsg ?? "Network Load Error");
+      }
+    } catch (e) {
+      ToastEngine.show("Error: $e");
+    }
+  }
+
+  // 下拉刷新
+  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();
+  }
+}

+ 10 - 10
packages/cpt_services/lib/modules/services/vm/services_view_model.g.dart

@@ -1,26 +1,26 @@
 // GENERATED CODE - DO NOT MODIFY BY HAND
 
-part of 'services_view_model.dart';
+part of 'event_detail_vm.dart';
 
 // **************************************************************************
 // RiverpodGenerator
 // **************************************************************************
 
-String _$servicesViewModelHash() => r'f2f28efe8edb9b152be0a1a4de4563d8d50cee29';
+String _$eventDetailVmHash() => r'7fe0ebbd7df15c661751f2b01a9d2efe53f975c7';
 
-/// See also [ServicesViewModel].
-@ProviderFor(ServicesViewModel)
-final servicesViewModelProvider =
-    AutoDisposeNotifierProvider<ServicesViewModel, void>.internal(
-  ServicesViewModel.new,
-  name: r'servicesViewModelProvider',
+/// See also [EventDetailVm].
+@ProviderFor(EventDetailVm)
+final eventDetailVmProvider =
+    AutoDisposeNotifierProvider<EventDetailVm, EventDetailState>.internal(
+  EventDetailVm.new,
+  name: r'eventDetailVmProvider',
   debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
       ? null
-      : _$servicesViewModelHash,
+      : _$eventDetailVmHash,
   dependencies: null,
   allTransitiveDependencies: null,
 );
 
-typedef _$ServicesViewModel = AutoDisposeNotifier<void>;
+typedef _$EventDetailVm = AutoDisposeNotifier<EventDetailState>;
 // ignore_for_file: type=lint
 // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package

+ 0 - 71
packages/cpt_notice_board/lib/modules/notice_board/page/notice_board_page.dart

@@ -128,75 +128,4 @@ class NoticeBoardPage extends HookConsumerWidget {
           },
         ));
   }
-  // @override
-  // Widget build(BuildContext context, WidgetRef ref) {
-  //   final _viewModel = ref.read(noticeBoardVmProvider.notifier);
-  //   return Scaffold(
-  //     // appBar: MyAppBar.titleBar(context, "Test Title"),
-  //     body: Container(
-  //       child: Column(
-  //         children: [
-
-  //           MyAppBar.titleBar(context, "Test Title"),
-  //           const Padding(
-  //             padding: EdgeInsets.fromLTRB(15, 0, 15, 30),
-  //             child: Row(
-  //               mainAxisAlignment: MainAxisAlignment.spaceBetween,
-  //               children: [
-  //                 Column(children: [
-  //                   MyAssetImage(
-  //                     Assets.noticeBoardAnnouncementIcon,
-  //                     height: 70,
-  //                     width: 70,
-  //                   ),
-  //                   Text(
-  //                     "Announcement",
-  //                     style: TextStyle(
-  //                       color: Colors.black,
-  //                       fontSize: 15,
-  //                       fontWeight: FontWeight.bold,
-  //                       height: 1.5,
-  //                     ),
-  //                   )
-  //                 ]),
-  //                 Column(children: [
-  //                   MyAssetImage(
-  //                     Assets.noticeBoardEventIcon,
-  //                     height: 70,
-  //                     width: 70,
-  //                   ),
-  //                   Text(
-  //                     "Event",
-  //                     style: TextStyle(
-  //                       color: Colors.black,
-  //                       fontSize: 15,
-  //                       fontWeight: FontWeight.bold,
-  //                       height: 1.5,
-  //                     ),
-  //                   )
-  //                 ]),
-  //                 Column(children: [
-  //                   MyAssetImage(
-  //                     Assets.noticeBoardDocumentsIcon,
-  //                     height: 70,
-  //                     width: 70,
-  //                   ),
-  //                   Text(
-  //                     "Documents",
-  //                     style: TextStyle(
-  //                       color: Colors.black,
-  //                       fontSize: 15,
-  //                       fontWeight: FontWeight.bold,
-  //                       height: 1.5,
-  //                     ),
-  //                   )
-  //                 ]),
-  //               ],
-  //             ),
-  //           ),
-  //         ],
-  //       ),
-  //     ),
-  //   );
-  // }
 }

+ 1 - 1
packages/cpt_notice_board/lib/modules/notice_board/vm/notice_board_view_model.dart

@@ -82,7 +82,7 @@ class NoticeBoardVm extends _$NoticeBoardVm {
 
     // 初始时导航到子路由
     WidgetsBinding.instance.addPostFrameCallback((_) {
-      switchPage(state.curIdx ?? 0, null, true);
+      // switchPage(state.curIdx ?? 0, null, true);
     });
 
     return state;

+ 1 - 1
packages/cpt_notice_board/lib/modules/notice_board/vm/notice_board_view_model.g.dart

@@ -6,7 +6,7 @@ part of 'notice_board_view_model.dart';
 // RiverpodGenerator
 // **************************************************************************
 
-String _$noticeBoardVmHash() => r'35dfbf4845c7dca80ef6f737fbc529cb1f232a4f';
+String _$noticeBoardVmHash() => r'6692916d5cff8146096cd702bc90d2e5a53b355d';
 
 /// See also [NoticeBoardVm].
 @ProviderFor(NoticeBoardVm)

+ 12 - 0
packages/cpt_notice_board/lib/router/page/notice_board_page_router.dart

@@ -8,6 +8,8 @@ import '../../modules/announ/page/announ_page.dart';
 import '../../modules/event/page/event_page.dart';
 import '../../modules/documents/page/documents_page.dart';
 import '../../modules/announcement_detail/page/announcement_detail_page.dart';
+import '../../modules/event_detail/page/event_detail_page.dart';
+import '../../modules/documents_list/page/documents_list_page.dart';
 
 part 'notice_board_page_router.gr.dart';
 
@@ -44,5 +46,15 @@ class NoticeBoardPageRouter extends _$NoticeBoardPageRouter {
             path: RouterPath.announcementDetail,
             transitionsBuilder: applySlideTransition,
             children: []),
+            CustomRoute(
+            page: EventDetailPageRoute.page,
+            path: RouterPath.eventDetail,
+            transitionsBuilder: applySlideTransition,
+            children: []),
+            CustomRoute(
+            page: DocumentsListPageRoute.page,
+            path: RouterPath.documentsList,
+            transitionsBuilder: applySlideTransition,
+            children: []),
       ];
 }

+ 40 - 0
packages/cpt_notice_board/lib/router/page/notice_board_page_router.gr.dart

@@ -33,6 +33,18 @@ abstract class _$NoticeBoardPageRouter extends RootStackRouter {
         child: const DocumentsPage(),
       );
     },
+    EventDetailPageRoute.name: (routeData) {
+      return AutoRoutePage<dynamic>(
+        routeData: routeData,
+        child: const EventDetailPage(),
+      );
+    },
+    DocumentsListPageRoute.name: (routeData) {
+      return AutoRoutePage<dynamic>(
+        routeData: routeData,
+        child: const DocumentsListPage(),
+      );
+    },
     EventPageRoute.name: (routeData) {
       return AutoRoutePage<dynamic>(
         routeData: routeData,
@@ -91,6 +103,34 @@ class DocumentsPageRoute extends PageRouteInfo<void> {
 }
 
 /// generated route for
+/// [EventDetailPage]
+class EventDetailPageRoute extends PageRouteInfo<void> {
+  const EventDetailPageRoute({List<PageRouteInfo>? children})
+      : super(
+          EventDetailPageRoute.name,
+          initialChildren: children,
+        );
+
+  static const String name = 'EventDetailPageRoute';
+
+  static const PageInfo<void> page = PageInfo<void>(name);
+}
+
+/// generated route for
+/// [DocumentsListPage]
+class DocumentsListPageRoute extends PageRouteInfo<void> {
+  const DocumentsListPageRoute({List<PageRouteInfo>? children})
+      : super(
+          DocumentsListPageRoute.name,
+          initialChildren: children,
+        );
+
+  static const String name = 'DocumentsListPageRoute';
+
+  static const PageInfo<void> page = PageInfo<void>(name);
+}
+
+/// generated route for
 /// [EventPage]
 class EventPageRoute extends PageRouteInfo<void> {
   const EventPageRoute({List<PageRouteInfo>? children})

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

@@ -7,6 +7,7 @@ import 'package:shared/utils/log_utils.dart';
 import 'package:shared/utils/util.dart';
 import 'package:widgets/ext/ex_widget.dart';
 import 'package:widgets/my_load_image.dart';
+import 'package:widgets/my_text_view.dart';
 import 'package:widgets/widget_export.dart';
 import 'package:cs_resources/generated/assets.dart';
 
@@ -68,11 +69,13 @@ class PropertyNewsPage extends HookConsumerWidget {
                 Row(
                   children: [
                     Expanded(
-                      child: Text(
+                      child: MyTextView(
                         item['title'],
                         maxLines: 2, // 设置最大行数为2
-                        overflow: TextOverflow.ellipsis, // 超出部分用省略号表示
-                        style: const TextStyle(fontSize: 16.0, color: Colors.black, fontWeight: FontWeight.w400), // 设置字体大小
+                        isTextEllipsis: true, // 超出部分用省略号表示
+                        fontSize: 16,
+                        textColor: Colors.black,
+                        isFontMedium: true,
                       ),
                     )
                   ],
@@ -81,12 +84,14 @@ class PropertyNewsPage extends HookConsumerWidget {
                 Row(
                   children: [
                     Expanded(
-                      child: Text(
+                      child: MyTextView(
                         item['description'],
                         maxLines: 2, // 设置最大行数为2
-                        overflow: TextOverflow.ellipsis, // 超出部分用省略号表示
-                        style: const TextStyle(fontSize: 12.0, color: Colors.black), // 设置字体大小
-                      ),
+                        isTextEllipsis: true, // 超出部分用省略号表示
+                        fontSize: 12,
+                        textColor: Colors.black,
+                        isFontRegular: true,
+                      )
                     )
                   ]
                 ),
@@ -94,11 +99,13 @@ class PropertyNewsPage extends HookConsumerWidget {
                 Row(
                     children: [
                       Expanded(
-                        child: Text(
+                        child: MyTextView(
                           Utils.getTimeAgo(item['time']),
                           maxLines: 1, // 设置最大行数为2
-                          overflow: TextOverflow.ellipsis, // 超出部分用省略号表示
-                          style: const TextStyle(fontSize: 12.0, color: Colors.black), // 设置字体大小
+                          isTextEllipsis: true, // 超出部分用省略号表示
+                          fontSize: 12,
+                          textColor: Colors.black,
+                          isFontRegular: true,
                         ),
                       )
                     ]

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

@@ -30,13 +30,13 @@ class PropertyRentPage extends HookConsumerWidget {
   Widget _buildItemLeftSection(BuildContext context,WidgetRef ref, item, _vm) {
     return Container(
       // color: Colors.blue,
-      child:MyTextView(
+      child: MyTextView(
         item['title'],
         maxLines: 1, // 设置最大行数为2
         isTextEllipsis: true, // 超出部分用省略号表示
         fontSize: 16,
         textColor: Colors.black,
-        isFontRegular: true,
+        isFontMedium: true,
       )
     ).marginOnly(right: 17.5);
   }

+ 122 - 0
packages/cpt_services/lib/modules/services/dialog/account_deactivation_dialog.dart

@@ -0,0 +1,122 @@
+import 'package:cs_resources/generated/assets.dart';
+import 'package:cs_resources/generated/l10n.dart';
+import 'package:cs_resources/theme/app_colors_theme.dart';
+import 'package:flutter/material.dart';
+import 'package:widgets/ext/ex_widget.dart';
+import 'package:widgets/my_load_image.dart';
+import 'package:widgets/my_text_view.dart';
+import 'package:widgets/widget_export.dart';
+
+class AccountDeactivationDialog extends StatelessWidget {
+  VoidCallback confirmAction;
+
+  AccountDeactivationDialog({
+    required this.confirmAction,
+  });
+  Widget CheckboxList(BuildContext context) {
+    final List<String> items = ['苹果', '香蕉', '橙子'];
+    final List<bool> selections = [false, false, false];
+    return Expanded(child:ListView.builder(
+      itemCount: items.length,
+      itemBuilder: (context, index) {
+        return Container(
+          padding: EdgeInsets.symmetric(vertical: 5.0),
+          child: CheckboxListTile(
+            value: selections[index],
+            onChanged: (bool? val) {
+              selections[index] = val!;
+            },
+            title: Text(items[index]),
+          ),
+        );
+      },
+    )
+    );
+  }
+
+  @override
+  Widget build(BuildContext context) {
+    return Column(
+      crossAxisAlignment: CrossAxisAlignment.center,
+      mainAxisAlignment: MainAxisAlignment.center,
+      children: [
+        Container(
+          width: double.infinity,
+          height: 55,
+          decoration: BoxDecoration(
+            color: context.appColors.btnBgDefault,
+            borderRadius: const BorderRadius.only(
+              topRight: Radius.circular(15),
+              topLeft: Radius.circular(15),
+            ),
+          ),
+          child: Row(
+            children: [
+              const SizedBox(width: 45),
+              MyTextView(
+                'Choose a Category',
+                fontSize: 18,
+                textAlign: TextAlign.center,
+                isFontMedium: true,
+                textColor: Colors.white,
+              ).expanded(),
+              const MyAssetImage(
+                Assets.baseServiceDialogDeleteIcon,
+                width: 25,
+                height: 25.5,
+              ).onTap(() {
+                onCancel();
+              }, padding: 10)
+            ],
+          ),
+        ),
+        Container(
+          width: double.infinity,
+          padding: const EdgeInsets.only(top: 22),
+          decoration: BoxDecoration(
+            color: context.appColors.whiteSecondBG,
+            borderRadius: const BorderRadius.only(
+              bottomLeft: Radius.circular(15),
+              bottomRight: Radius.circular(15),
+            ),
+          ),
+          child: Column(
+            children: [
+              CheckboxList(context),
+              Row(
+                children: [
+                  const SizedBox(width: 18),
+                  Expanded(
+                      flex: 1,
+                      child: InkWell(
+                        onTap: () async {
+                          onCancel();
+                          confirmAction();
+                        },
+                        child: MyTextView(
+                          'Ok',
+                          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),
+            ],
+          ),
+        ),
+      ],
+    ).constrained(width: 340);
+  }
+
+//取消弹框
+  void onCancel() async {
+    SmartDialog.dismiss();
+  }
+}

+ 0 - 33
packages/cpt_services/lib/modules/services/page/services_page.dart

@@ -1,33 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:auto_route/auto_route.dart';
-import 'package:hooks_riverpod/hooks_riverpod.dart';
-import 'package:router/ext/auto_router_extensions.dart';
-
-import '../../../router/page/services_page_router.dart';
-import '../../services/vm/services_view_model.dart';
-
-@RoutePage()
-class ServicesPage extends HookConsumerWidget {
-  const ServicesPage({Key? key}) : super(key: key);
-
-  //启动当前页面
-  static void startInstance({BuildContext? context}) {
-    if (context != null) {
-      context.router.push(const ServicesPageRoute());
-    } else {
-      appRouter.push(const ServicesPageRoute());
-    }
-  }
-
-  @override
-  Widget build(BuildContext context, WidgetRef ref) {
-    final _viewModel = ref.read(servicesViewModelProvider.notifier);
-
-    return Scaffold(
-      appBar: AppBar(title: Text("广告服务")),
-      body: Center(
-        child: Text("广告服务的主页面"),
-      ),
-    );
-  }
-}

+ 206 - 0
packages/cpt_services/lib/modules/services/services_page.dart

@@ -0,0 +1,206 @@
+import 'package:shared/utils/log_utils.dart';
+import 'package:cs_resources/generated/assets.dart';
+import 'package:cs_resources/theme/app_colors_theme.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/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/widget_export.dart';
+
+import '../../../router/page/services_page_router.dart';
+import 'services_view_model.dart';
+
+@RoutePage()
+class ServicesPage extends HookConsumerWidget {
+  const ServicesPage({Key? key}) : super(key: key);
+
+  //启动当前页面
+  static void startInstance({BuildContext? context}) {
+    if (context != null) {
+      context.router.push(const ServicesPageRoute());
+    } else {
+      appRouter.push(const ServicesPageRoute());
+    }
+  }
+
+  Widget _buildTop(BuildContext context, WidgetRef ref, _vm) {
+    // List itemsList = _vm.state.list.toList();
+    return Container(
+        color: ColorUtils.string2Color('#FFFFFF'),
+        child: Column(children: [
+          Container(
+            width: double.infinity,
+            height: 160,
+            decoration: const BoxDecoration(
+              image: DecorationImage(
+                image: AssetImage(
+                    'packages/cs_resources/${Assets.propertyHomeLoanBg}'),
+                fit: BoxFit.fill, // 设置图片平铺
+              ),
+            ),
+          ).marginOnly(bottom: 15),
+          Row(
+            mainAxisAlignment: MainAxisAlignment.spaceBetween,
+            crossAxisAlignment: CrossAxisAlignment.center,
+            children: [
+              const Text(
+                'Home Services!',
+                style: TextStyle(
+                    fontSize: 16.0,
+                    color: Colors.black,
+                    fontWeight: FontWeight.w400), // 设置字体大小
+              ),
+              TextButton(
+                onPressed: () {
+                  _vm.doDeleteAccount();
+                },
+                style: TextButton.styleFrom(
+                  foregroundColor: Colors.black,
+                  backgroundColor: ColorUtils.string2Color('#4161D0'), // 背景颜色
+                  minimumSize: const Size(70, 30), // 最小宽度和高度
+                  padding: const EdgeInsets.symmetric(
+                      horizontal: 11.0, vertical: 9), // 内边距
+                  shape: RoundedRectangleBorder(
+                    borderRadius: BorderRadius.circular(5), // 圆角
+                    side: BorderSide(
+                      color: ColorUtils.string2Color('#4161D0'),
+                      width: 1.0,
+                    ), // 边框
+                  ),
+                ),
+                child: const Text(
+                  'Filter',
+                  style: const TextStyle(
+                    color: Colors.white,
+                  ),
+                ),
+              ),
+            ],
+          ),
+        ])).paddingOnly(top: 10, left: 15, right: 15);
+  }
+
+  Widget _buildItem(BuildContext context, WidgetRef ref, _vm, item) {
+    return Container(
+            width: MediaQuery.of(context).size.width / 2 - 25,
+            height: 146,
+            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: Column(
+              mainAxisAlignment: MainAxisAlignment.spaceBetween,
+              children: [
+                Row(
+                  crossAxisAlignment: CrossAxisAlignment.start,
+                  children: [
+                    Expanded(
+                      child: Text(
+                        maxLines: 2, // 设置最大行数为2
+                        overflow: TextOverflow.ellipsis, // 超出部分用省略号表示
+                        item['title'],
+                        style: const TextStyle(
+                            fontSize: 16.0,
+                            color: Colors.black,
+                            fontWeight: FontWeight.w700),
+                      ),
+                    )
+                  ],
+                ),
+                Row(
+                  mainAxisAlignment: MainAxisAlignment.end,
+                  children: [
+                    MyAssetImage(
+                      item['price'],
+                      width: 110,
+                      height: 80,
+                    )
+                  ],
+                ),
+              ],
+            ).paddingOnly(top: 15, left: 15))
+        .marginOnly(bottom: 15);
+  }
+
+// list
+  Widget _buildSaleList(BuildContext context, WidgetRef ref, _vm) {
+    List itemsList = _vm.state.list.toList();
+    return ListView.builder(
+      itemCount: itemsList.length,
+      itemBuilder: (context, index) {
+        bool noLast = !(index == itemsList.length - 1);
+        bool isLast = index == itemsList.length - 1;
+        if (index % 2 == 0 && noLast) {
+          return Row(
+            mainAxisAlignment: MainAxisAlignment.spaceBetween,
+            children: [
+              _buildItem(context, ref, _vm, itemsList[index]),
+              _buildItem(context, ref, _vm, itemsList[index + 1]),
+            ],
+          );
+        } else if (index % 2 != 0 && noLast) {
+          return Row();
+        } else if (index % 2 != 0 && isLast) {
+          return Row();
+        } else {
+          return Row(
+            mainAxisAlignment: MainAxisAlignment.spaceBetween,
+            children: [
+              _buildItem(context, ref, _vm, itemsList[index]),
+            ],
+          );
+        }
+        // _buildSaleItem(context, ref, itemsList[index], _vm);
+      },
+    );
+  }
+
+  @override
+  Widget build(BuildContext context, WidgetRef ref) {
+    final state = ref.watch(servicesVmProvider);
+    final _vm = ref.read(servicesVmProvider.notifier);
+    return Scaffold(
+      appBar: MyAppBar.appBar(
+        context,
+        "Service",
+        backgroundColor: context.appColors.whiteBG,
+      ),
+      body: Container(
+        child: Column(
+          children: [
+            _buildTop(context, ref, _vm),
+            Expanded(
+              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(
+                        bottom: 15, left: 15, right: 15, top: 15),
+                    child: _buildSaleList(context, ref, _vm)),
+              ),
+            )
+          ],
+        ),
+      ),
+    );
+  }
+}

+ 70 - 0
packages/cpt_services/lib/modules/services/services_repository.dart

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

+ 10 - 10
packages/cpt_community/lib/modules/newsfeed/newsfeed_repository.g.dart

@@ -1,28 +1,28 @@
 // GENERATED CODE - DO NOT MODIFY BY HAND
 
-part of 'newsfeed_repository.dart';
+part of 'services_repository.dart';
 
 // **************************************************************************
 // RiverpodGenerator
 // **************************************************************************
 
-String _$newsfeedRepositoryHash() =>
-    r'79d5132feb0bc631d47ec659702f854189feec5b';
+String _$servicesRepositoryHash() =>
+    r'68370656250ee691445b4293c3b30568d4ebf20b';
 
-/// See also [newsfeedRepository].
-@ProviderFor(newsfeedRepository)
-final newsfeedRepositoryProvider = Provider<NewsfeedRepository>.internal(
-  newsfeedRepository,
-  name: r'newsfeedRepositoryProvider',
+/// See also [servicesRepository].
+@ProviderFor(servicesRepository)
+final servicesRepositoryProvider = Provider<ServicesRepository>.internal(
+  servicesRepository,
+  name: r'servicesRepositoryProvider',
   debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
       ? null
-      : _$newsfeedRepositoryHash,
+      : _$servicesRepositoryHash,
   dependencies: null,
   allTransitiveDependencies: null,
 );
 
 @Deprecated('Will be removed in 3.0. Use Ref instead')
 // ignore: unused_element
-typedef NewsfeedRepositoryRef = ProviderRef<NewsfeedRepository>;
+typedef ServicesRepositoryRef = ProviderRef<ServicesRepository>;
 // ignore_for_file: type=lint
 // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package

+ 50 - 0
packages/cpt_services/lib/modules/services/services_state.dart

@@ -0,0 +1,50 @@
+/// YApi QuickType插件生成,具体参考文档:https://plugins.jetbrains.com/plugin/18847-yapi-quicktype/documentation
+
+import 'dart:convert';
+
+ServicesState servicesStateFromJson(String str) =>
+    ServicesState.fromJson(json.decode(str));
+
+String servicesStateToJson(ServicesState data) => json.encode(data.toJson());
+
+class ServicesState {
+  ServicesState({
+    required this.curPage,
+    required this.pageSize,
+    required this.list,
+    required this.filterCount,
+  });
+
+  int curPage;
+  int pageSize;
+  List<Map<String, dynamic>> list;
+  int filterCount;
+
+  factory ServicesState.fromJson(Map<dynamic, dynamic> json) => ServicesState(
+        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,
+      };
+
+  ServicesState copyWith({
+    int? curPage,
+    int? pageSize,
+    List<Map<String, dynamic>>? list,
+    int? filterCount,
+  }) {
+    return ServicesState(
+      curPage: curPage ?? this.curPage,
+      pageSize: pageSize ?? this.pageSize,
+      list: list ?? this.list,
+      filterCount: filterCount ?? this.filterCount,
+    );
+  }
+}

+ 175 - 0
packages/cpt_services/lib/modules/services/services_view_model.dart

@@ -0,0 +1,175 @@
+import 'package:cpt_services/modules/services/dialog/account_deactivation_dialog.dart';
+import 'package:cs_resources/generated/assets.dart';
+import 'package:plugin_platform/engine/dialog/dialog_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:plugin_platform/engine/toast/toast_engine.dart';
+import 'services_state.dart';
+import 'services_repository.dart';
+part 'services_view_model.g.dart';
+
+@riverpod
+class ServicesVm extends _$ServicesVm {
+  late ServicesRepository servicesRepository;
+  ServicesState initState() {
+    return ServicesState(
+      curPage: 1,
+      pageSize: 10,
+      list: [
+        {
+          "id": 1,
+          "title": "Part-TimeCleaning",
+          "price": Assets.serviceServiceIcon1,
+        },
+        {
+          "id": 2,
+          "title": "Move in/outcleaning",
+          "price": Assets.serviceServiceIcon2,
+        },
+        {
+          "id": 3,
+          "title": "Laundry AnddryCleaning",
+          "price": Assets.serviceServiceIcon3,
+        },
+        {
+          "id": 4,
+          "title": "SofaCleaning",
+          "price": Assets.serviceServiceIcon4,
+        },
+        {
+          "id": 5,
+          "title": "MattressCleaning",
+          "price": Assets.serviceServiceIcon5,
+        },
+         {
+          "id": 5,
+          "title": "MarbleCleaning",
+          "price": Assets.serviceServiceIcon6,
+        },
+        {
+          "id": 6,
+          "title": "ParquetCleaning",
+          "price": Assets.serviceServiceIcon7,
+        },
+        {
+          "id": 6,
+          "title": "Removalist",
+          "price": Assets.serviceServiceIcon8,
+        },
+         {
+          "id": 7,
+          "title": "CarpetCleaning",
+          "price": Assets.serviceServiceIcon9,
+        },
+        {
+          "id": 7,
+          "title": "InteriorDesign",
+          "price": Assets.serviceServiceIcon10,
+        },
+        {
+          "id": 7,
+          "title": "DomesticHelper agency",
+          "price": Assets.serviceServiceIcon11,
+        },
+        {
+          "id": 7,
+          "title": "Recycling AndDisposal Service",
+          "price": Assets.serviceServiceIcon12,
+        },
+        {
+          "id": 7,
+          "title": "Sell YourPre-Loved Items",
+          "price": Assets.serviceServiceIcon13,
+        },
+        {
+          "id": 7,
+          "title": "UpholsteryCleaning",
+          "price": Assets.serviceServiceIcon14,
+        },
+      ],
+      filterCount: 6,
+    );
+  }
+
+  @override
+  ServicesState build() {
+    // 引入数据仓库
+    servicesRepository = ref.read(servicesRepositoryProvider);
+    // 初始化状态
+    ServicesState state = initState();
+    // 初始化列表数据
+    return state;
+  }
+
+  // 初始化页面数据
+  initPageData() {
+    Log.d("----property_news_vm-----initPageData");
+    refreshListData();
+  }
+
+  // 上拉加载
+  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();
+  }
+
+// 去新闻详情页
+  void goNewsDetail(String item) {
+    Log.d(item);
+    // PropertyPage.startInstance(context: context, item: item);
+  }
+
+  // 获取list 列表数据
+  void getListData<T>() async {
+    Log.d("加载listData数据---------------start-----");
+    try {
+      //请求网络
+      Map<String, dynamic> params = {
+        "curPage": state.curPage,
+        "pageSize": state.pageSize,
+      };
+      Log.d("请求参数------$params");
+      final result = await servicesRepository.fetchPropertyNewsList(params);
+      Log.d("请求完成结果------${result.data}");
+      //校验成功失败
+      if (result.isSuccess) {
+        // state = state.copyWith(serverTime: result.data);
+        state = state;
+        ToastEngine.show("获取数据成功");
+      } else {
+        ToastEngine.show(result.errorMsg ?? "Network Load Error");
+      }
+    } catch (e) {
+      ToastEngine.show("Error: $e");
+    }
+  }
+
+  // 下拉刷新
+  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();
+  }
+
+  void doDeleteAccount() {
+    DialogEngine.show(widget: AccountDeactivationDialog(
+      confirmAction: () {
+        ToastEngine.show("点击了确定");
+      },
+    ));
+  }
+}

+ 10 - 10
packages/cpt_community/lib/modules/newsfeed/newsfeed_vm.g.dart

@@ -1,25 +1,25 @@
 // GENERATED CODE - DO NOT MODIFY BY HAND
 
-part of 'newsfeed_vm.dart';
+part of 'services_view_model.dart';
 
 // **************************************************************************
 // RiverpodGenerator
 // **************************************************************************
 
-String _$newsfeedVmHash() => r'dbb005d81ceec888822144d16f911262a5d5587e';
+String _$servicesVmHash() => r'066315b56e78a801d048576f75f1e30b4816dbf5';
 
-/// See also [NewsfeedVm].
-@ProviderFor(NewsfeedVm)
-final newsfeedVmProvider =
-    AutoDisposeNotifierProvider<NewsfeedVm, NewsfeedState>.internal(
-  NewsfeedVm.new,
-  name: r'newsfeedVmProvider',
+/// See also [ServicesVm].
+@ProviderFor(ServicesVm)
+final servicesVmProvider =
+    AutoDisposeNotifierProvider<ServicesVm, ServicesState>.internal(
+  ServicesVm.new,
+  name: r'servicesVmProvider',
   debugGetCreateSourceHash:
-      const bool.fromEnvironment('dart.vm.product') ? null : _$newsfeedVmHash,
+      const bool.fromEnvironment('dart.vm.product') ? null : _$servicesVmHash,
   dependencies: null,
   allTransitiveDependencies: null,
 );
 
-typedef _$NewsfeedVm = AutoDisposeNotifier<NewsfeedState>;
+typedef _$ServicesVm = AutoDisposeNotifier<ServicesState>;
 // ignore_for_file: type=lint
 // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package

+ 0 - 14
packages/cpt_services/lib/modules/services/vm/services_view_model.dart

@@ -1,14 +0,0 @@
-
-import 'package:riverpod_annotation/riverpod_annotation.dart';
-
-part 'services_view_model.g.dart';
-
-@riverpod
-class ServicesViewModel extends _$ServicesViewModel {
-
-  @override
-  void build(){
-
-  }
-
-}

+ 1 - 1
packages/cpt_services/lib/router/component/services_component_service.dart

@@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
 import 'package:hooks_riverpod/hooks_riverpod.dart';
 import 'package:riverpod_annotation/riverpod_annotation.dart';
 
-import '../../modules/services/page/services_page.dart';
+import '../../modules/services/services_page.dart';
 
 part 'services_component_service.g.dart';
 

+ 1 - 1
packages/cpt_services/lib/router/page/services_page_router.dart

@@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
 import 'package:router/ext/auto_router_extensions.dart';
 import 'package:router/path/router_path.dart';
 
-import '../../modules/services/page/services_page.dart';
+import '../../modules/services/services_page.dart';
 
 
 part 'services_page_router.gr.dart';

BIN
packages/cs_resources/assets/service/service_icon_1.png


BIN
packages/cs_resources/assets/service/service_icon_10.png


BIN
packages/cs_resources/assets/service/service_icon_11.png


BIN
packages/cs_resources/assets/service/service_icon_12.png


BIN
packages/cs_resources/assets/service/service_icon_13.png


BIN
packages/cs_resources/assets/service/service_icon_14.png


+ 0 - 0
packages/cs_resources/assets/service/service_icon_2.png


Vissa filer visades inte eftersom för många filer har ändrats