소스 검색

update community

glglove 2 달 전
부모
커밋
79223bd04f
24개의 변경된 파일438개의 추가작업 그리고 211개의 파일을 삭제
  1. 2 2
      packages/cpt_community/lib/components/garage_card.dart
  2. 29 49
      packages/cpt_community/lib/modules/community/community_page.dart
  3. 117 62
      packages/cpt_community/lib/modules/community/community_vm.dart
  4. 2 2
      packages/cpt_community/lib/modules/community/following/following_page.dart
  5. 18 0
      packages/cpt_community/lib/modules/community/following/following_vm.dart
  6. 2 2
      packages/cpt_community/lib/modules/community/foryou/foryou_page.dart
  7. 19 0
      packages/cpt_community/lib/modules/community/foryou/foryou_vm.dart
  8. 2 2
      packages/cpt_community/lib/modules/community/news/news_page.dart
  9. 19 0
      packages/cpt_community/lib/modules/community/news/news_vm.dart
  10. 1 1
      packages/cpt_community/lib/modules/community/newsfeed_detail/comments_input.dart
  11. 1 1
      packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_vm.dart
  12. 2 7
      packages/cpt_community/lib/modules/community/newsfeed_post/newsfeed_post_page.dart
  13. 10 2
      packages/cpt_community/lib/modules/community/newsfeed_post/newsfeed_post_vm.dart
  14. 13 0
      packages/cpt_community/lib/modules/garage/for_rent/for_rent_state.dart
  15. 56 33
      packages/cpt_community/lib/modules/garage/for_rent/for_rent_vm.dart
  16. 13 1
      packages/cpt_community/lib/modules/garage/for_sale/for_sale_state.dart
  17. 22 0
      packages/cpt_community/lib/modules/garage/for_sale/for_sale_vm.dart
  18. 6 4
      packages/cpt_community/lib/modules/garage/garagesale_post/garagesale_post_page.dart
  19. 82 41
      packages/cpt_community/lib/modules/garage/garagesale_post/garagesale_post_vm.dart
  20. 1 1
      packages/cpt_community/lib/modules/my_posts/my_posts_newsfeed/my_posts_newsfeed_page.dart
  21. 12 0
      packages/cpt_community/lib/respository/common_garage.dart
  22. 4 1
      packages/cpt_community/lib/respository/common_newsfeed.dart
  23. 4 0
      packages/cpt_profile/lib/modules/setting/setting_view_model.dart
  24. 1 0
      packages/cs_plugin_basic/lib/constants/app_constant.dart

+ 2 - 2
packages/cpt_community/lib/components/garage_card.dart

@@ -59,7 +59,7 @@ class GarageCard extends StatelessWidget {
     String card_price = itemObj.getValue("price", "");
     String card_created_at = itemObj.getValue("created_at", "");
     Map<String, dynamic>? card_account = itemObj.getValue<Map<String,dynamic>>("account", null);
-    String card_avator = card_account?['avator']?? "";
+    String card_avatar = card_account?['avatar']?? "";
     String card_publish_name = card_account?['name']?? "";
     bool card_liked = itemObj.getValue("liked", false);
     int card_likes_count = itemObj.getValue("likes_count", 0);
@@ -144,7 +144,7 @@ class GarageCard extends StatelessWidget {
               children: [
                 if (useType == GarageCardUseType.forSale || useType == GarageCardUseType.forRent)
                   MyLoadImage(
-                    card_avator,
+                    card_avatar,
                     width: 30,
                     height: 30,
                     isCircle: true,

+ 29 - 49
packages/cpt_community/lib/modules/community/community_page.dart

@@ -5,6 +5,7 @@ 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:plugin_basic/provider/user_config/user_config_service.dart';
 import 'package:router/ext/auto_router_extensions.dart';
 import 'package:shared/utils/color_utils.dart';
 import 'package:shared/utils/log_utils.dart';
@@ -22,6 +23,7 @@ import 'community_vm.dart';
 import 'customSilverHeaderTabs.dart';
 
 final tabsRouterKey = GlobalKey<AutoTabsRouterState>();
+final ScrollController _scrollController = useScrollController();
 
 
 @RoutePage()
@@ -42,6 +44,7 @@ class CommunityPage extends HookConsumerWidget {
         final vm = ref.read(communityVmProvider.notifier);
         final state = ref.watch(communityVmProvider);
 
+
         useEffect((){
           Log.d("CommunityPage initState");
           // 延迟监听
@@ -49,6 +52,13 @@ class CommunityPage extends HookConsumerWidget {
             if(tabsRouterKey.currentState?.controller != null){
               tabsRouterKey.currentState?.controller?.addListener((){
                 vm.tabsRouterChange();
+
+                // _scrollController.animateTo(
+                //   // _scrollController.position.maxScrollExtent,
+                //   100,
+                //   duration: Duration(milliseconds: 300),
+                //   curve: Curves.easeOut,
+                // );
               });
             }
           });
@@ -85,6 +95,7 @@ class CommunityPage extends HookConsumerWidget {
             ),
           backgroundColor: context.appColors.backgroundDefault,
           body:  NestedScrollView(
+            controller: _scrollController,
             headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
               return [
               // top 组件,转换为 Sliver 组件
@@ -130,53 +141,7 @@ class CommunityPage extends HookConsumerWidget {
                 )
               ]
             )
-          )
-
-          // AutoTabsRouter.pageView(
-          //   key: tabsRouterKey,
-          //   routes: const [
-          //     NewsPageRoute(),
-          //     FollowingPageRoute(),
-          //     ForyouPageRoute(),
-          //     ForsalePageRoute(),
-          //     ForrentPageRoute(),
-          //   ],
-          //   // physics: const NeverScrollableScrollPhysics(), // 禁止滚动
-          //   builder: (context, child, pageController) {
-          //     final tabsRouter = AutoTabsRouter.of(context);
-          //
-          //     return NestedScrollView(
-          //       headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
-          //         return [
-          //           // top 组件,转换为 Sliver 组件
-          //           SliverToBoxAdapter(
-          //             child: _buildTopSection(context, ref, vm, state),
-          //           ),
-          //           // tab 组件,使用 SliverPersistentHeader 实现吸顶
-          //           // SliverPersistentHeader(
-          //           //   pinned: true,
-          //           //   delegate: CustomSliverPersistentHeaderDelegate(
-          //           //     child: _buildTabsSection(context, ref, tabsRouter, vm, state),
-          //           //   ),
-          //           // ),
-          //           // SliverToBoxAdapter(
-          //           //   child: _buildPostSection(context, ref, vm, state),
-          //           // ),
-          //         ];
-          //       },
-          //       body: Column(
-          //         mainAxisSize: MainAxisSize.max,
-          //         children: [
-          //           _buildTabsSection(context, ref, tabsRouter, vm, state),
-          //           _buildPostSection(context, ref, vm, state),
-          //           Expanded(
-          //               child: child
-          //           ),
-          //         ],
-          //       ), // post 组件和其他内容
-          //     );
-          //   },
-          // ),
+          ).constrained(height: 5000)
         );
     }
 
@@ -287,6 +252,7 @@ class CommunityPage extends HookConsumerWidget {
       }
 
       Widget _buildNewsFeedPost(BuildContext context, WidgetRef ref, vm, state){
+        final userConfig = UserConfigService.getState(ref: ref);
         return Container(
           height: 65.5,
           width: double.infinity,
@@ -294,7 +260,14 @@ class CommunityPage extends HookConsumerWidget {
           color: Colors.white,
           child: Row(
             children: [
-              const MyAssetImage(Assets.communityNesFeed, width: 45,height: 45,),
+              // const MyAssetImage(Assets.communityNesFeed, width: 45,height: 45,),
+              MyLoadImage(
+                userConfig.user?.avatar,
+                width: 45,
+                height: 45,
+                isCircle: true,
+                fit: BoxFit.fill,
+              ),
               Expanded(
                 child: MyTextView(
                   "What’s on your mind?",
@@ -321,6 +294,7 @@ class CommunityPage extends HookConsumerWidget {
       }
 
       Widget _buildGarageSalePost(BuildContext context, WidgetRef ref, vm, state){
+        final userConfig = UserConfigService.getState(ref: ref);
         return Container(
           height: 65.5,
           width: double.infinity,
@@ -328,7 +302,13 @@ class CommunityPage extends HookConsumerWidget {
           color: Colors.white,
           child: Row(
             children: [
-              const MyAssetImage(Assets.communityNesFeed, width: 45,height: 45,),
+              MyLoadImage(
+                userConfig.user?.avatar,
+                width: 45,
+                height: 45,
+                isCircle: true,
+                fit: BoxFit.fill,
+              ),
               Expanded(
                 child: MyTextView(
                   "Sell Item",

+ 117 - 62
packages/cpt_community/lib/modules/community/community_vm.dart

@@ -10,7 +10,9 @@ import 'package:cs_resources/theme/app_colors_theme.dart';
 import 'package:flutter/cupertino.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter_riverpod/flutter_riverpod.dart';
+import 'package:plugin_basic/constants/app_constant.dart';
 import 'package:plugin_platform/engine/dialog/dialog_engine.dart';
+import 'package:plugin_platform/engine/sp/sp_util.dart';
 import 'package:plugin_platform/engine/toast/toast_engine.dart';
 import 'package:riverpod_annotation/riverpod_annotation.dart';
 import 'package:router/path/router_path.dart';
@@ -38,8 +40,18 @@ class CommunityVm extends _$CommunityVm {
   get topSectionsData => state.topSectionsData;
   late CommonNewsFeedRespository commonNewsFeedRespositoryInstance;
   late CommonGarageRespository commonGarageRespositoryInstance;
+  late Map<int, dynamic> providerMap = {};
+
+  bool _isSingleSelect = true;
+  List<Map<String, dynamic>> _currentSelectedGarageCategory = [];
+
+  Map<String, dynamic>? _queryParams = {
+    'keyword': null,
+    'is_liked': null,
+    'category_id': null
+  };
+
 
-  final Map<int, dynamic> providerMap = {};
 
 // 根据索引获取 Provider
   ProviderBase getProvider(int index) {
@@ -91,14 +103,10 @@ class CommunityVm extends _$CommunityVm {
             providerMap[key] = ref.read(forrentVmProvider.notifier);
         }
       });
-
-      // 获取第一个 provider
-      // final newsVmProvider = providerMap[0]['provider'] as AutoDisposeNotifierProviderImpl<NewsVm, NewsState>;
-      // Log.d("444444  ${newsVmProvider}");
-      // ref.read(newsVmProvider.notifier).test();
     });
     Log.d("-------------community vm-------------build---------------------");
     ref.onDispose((){
+      providerMap = {};
       Log.d("-------------community vm-------------dispose---------------------");
     });
     return state;
@@ -106,8 +114,16 @@ class CommunityVm extends _$CommunityVm {
 
   tabsRouterChange(){
     Log.d("----tabsRouterChange---${tabsRouterKey.currentState?.controller?.activeIndex}-");
-    
     state = state.copyWith(currentPageViewIdx: tabsRouterKey.currentState?.controller?.activeIndex ?? 0);
+    // 设置当前导航栏的 图标 等状态
+    WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
+      Log.d("获取当前的导航栏 相关状态resMap444 ${providerMap[state.currentPageViewIdx]} ");
+      Map<String, dynamic> resMap = providerMap[state.currentPageViewIdx]?.getCurrentQueryParams(null);
+      Log.d("获取当前的导航栏 相关状态resMap $resMap ");
+      _queryParams = resMap;
+
+    });
+
   }
 
   // 点击tab 切换tab
@@ -202,65 +218,94 @@ class CommunityVm extends _$CommunityVm {
 
     // 获取分类列表
     try {
-      final result = await getGarageSaleCategoryOptions();
-      if(result.isSuccess){
-        final listJson = result.getListJson();
-        // 将 listJson 转换为 List<Map<String, dynamic>>
-        garageCategoryList = (listJson as List?)?.map((item) => item as Map<String, dynamic>).toList() ?? [];
-        state = state.copyWith(
-            garageCategoryList: garageCategoryList
-        );
-
-        await DialogEngine.show(
-            tag: "chooseGarageSaleCategory",
-            position: DialogPosition.center,
-            widget: AppCustomDialog(
-              message: '',
-              dialogWidth: MediaQuery.of(context).size.width * 0.8,
-              // contentBoxMaxHeight: 350,
-              // contentBoxMinHeight: 300,
-              isShowConfirmBtn: state.garageCategoryList!.length > 0 ? true: false,
-              confirmTxt: "Ok",
-              messageBuilder: (BuildContext context){
-                return Container(
-                  color: context.appColors.textWhite,
-                  child: Column(
-                    mainAxisAlignment: MainAxisAlignment.start,
-                    crossAxisAlignment: CrossAxisAlignment.start,
-                    children: state.garageCategoryList!.length > 0 ? [
-                      MyCheckboxGroup(
-                          isSingleSelect: false,
-                          labelStyle: const TextStyle(
-                            fontSize: 16,
-                            fontWeight: FontWeight.w500,
-                          ),
-                          items: state.garageCategoryList!,
-                          onChanged: (List<Map<String, dynamic>> selectedItems){
-                            Log.d("----MyCheckboxGroup onChanged  $selectedItems");
-                          }
-                      )
-                    ]: [
-                      Container(
-                        child: CircularProgressIndicator(
-                          strokeWidth: 3,
-                          valueColor: AlwaysStoppedAnimation(context.appColors.textDarkGray),
-                        ),
-                      )
-                    ],
-                  ),
-                );
-              },
-              isShowCancelBtn:false,
-              confirmAction: (){
-
-              },
-            )
-        );
+      // 加入有缓存 就取缓存
+      List<Map<String, dynamic>>? StorageCategoryList = SPUtil.getObjectList(AppConstant.storageGarageCategoryList)?.cast<Map<String, dynamic>>();
+
+      if(StorageCategoryList != null && StorageCategoryList.isNotEmpty){
+        Log.d("取StorageCategoryList 缓存: $StorageCategoryList ");
+        garageCategoryList = StorageCategoryList;
+      }else {
+        final result = await getGarageSaleCategoryOptions();
+        if(result.isSuccess){
+          final listJson = result.getListJson();
+          // 将 listJson 转换为 List<Map<String, dynamic>>
+          List<Map<String, dynamic>> garageCategoryList = (listJson as List?)?.map((item) => item as Map<String, dynamic>).toList() ?? [];
+          // 将 garageCategoryList 存入缓存
+          Log.d("设置StorageCategoryList 缓存");
+          SPUtil.putObjectList(AppConstant.storageGarageCategoryList, garageCategoryList);
+        }
       }
+      state = state.copyWith(
+          garageCategoryList: garageCategoryList
+      );
+      // 显示弹框
+      handlerShowChooseGarageCategoryDialog(context, garageCategoryList);
     }catch(error){
-      Log.d("---------------- $error");
+      Log.d("------获取分类列表error---------- $error");
     }
+  }
 
+  Future<void> handlerShowChooseGarageCategoryDialog(BuildContext context, List<Map<String, dynamic>> garageCategoryList) async{
+    await DialogEngine.show(
+        tag: "chooseGarageSaleCategory",
+        position: DialogPosition.center,
+        widget: AppCustomDialog(
+          message: '',
+          dialogWidth: MediaQuery.of(context).size.width * 0.8,
+          // contentBoxMaxHeight: 350,
+          // contentBoxMinHeight: 300,
+          isShowConfirmBtn: state.garageCategoryList!.length > 0 ? true: false,
+          confirmTxt: "Ok",
+          messageBuilder: (BuildContext context){
+            return Container(
+              color: context.appColors.textWhite,
+              child: Column(
+                mainAxisAlignment: MainAxisAlignment.start,
+                crossAxisAlignment: CrossAxisAlignment.start,
+                children: state.garageCategoryList!.length > 0 ? [
+                  MyCheckboxGroup(
+                      isSingleSelect: _isSingleSelect,
+                      labelStyle: const TextStyle(
+                        fontSize: 16,
+                        fontWeight: FontWeight.w500,
+                      ),
+                      items: state.garageCategoryList!,
+                      defaultSelectedItems: [],
+                      onChanged: (List<Map<String, dynamic>> selectedItems){
+                        Log.d("----MyCheckboxGroup onChanged  $selectedItems");
+                        _currentSelectedGarageCategory = selectedItems;
+                      }
+                  )
+                ]: [
+                  Container(
+                    child: CircularProgressIndicator(
+                      strokeWidth: 3,
+                      valueColor: AlwaysStoppedAnimation(context.appColors.textDarkGray),
+                    ),
+                  )
+                ],
+              ),
+            );
+          },
+          isShowCancelBtn:false,
+          confirmAction: (){
+            // 点击了确定
+            Log.d("----点击了确定按钮");
+            int? categoryId;
+            if(_isSingleSelect){
+              if(_currentSelectedGarageCategory.length > 0){
+                categoryId = _currentSelectedGarageCategory[0]['id'];
+              }
+            }
+
+            providerMap[state.currentPageViewIdx]
+              ..setCurrentQueryParams({
+                "category_id": categoryId!,
+              })
+              ..retryRequest();
+          },
+        )
+    );
   }
 
   // 点击了导航栏的 like btn
@@ -268,11 +313,20 @@ class CommunityVm extends _$CommunityVm {
     if(state.currentCategoryIdx ==0){
       //
       ToastEngine.show("点击了 newsfeed like");
+
     }else if(state.currentCategoryIdx == 1){
       //
       ToastEngine.show("点击了 garagesale like");
 
     }
+
+    _queryParams?['is_liked'] = !(_queryParams?['is_liked']??false);
+
+    providerMap[state.currentPageViewIdx]
+      ..setCurrentQueryParams({
+        "is_liked": _queryParams?['is_liked'],
+      })
+      ..retryRequest();
   }
 
   // 点击了导航栏的 filter btn
@@ -302,6 +356,7 @@ class CommunityVm extends _$CommunityVm {
           }
         }
     });
+
     GaragesalePostPage.startInstance(type: type);
   }
 

+ 2 - 2
packages/cpt_community/lib/modules/community/following/following_page.dart

@@ -100,7 +100,7 @@ class FollowingPage extends HookConsumerWidget {
     String card_title = item.getValue("title", "");
     String card_created_at = item.getValue("created_at", "");
     Map<String, dynamic>? card_account = item.getValue<Map<String,dynamic>>("account", {});
-    String card_avator = card_account?['avator']?? "";
+    String card_avatar = card_account?['avatar']?? "";
     String card_count_name = card_account?['name']?? "";
     bool card_followed = card_account?['followed']??false;
     String card_content = item.getValue("content", "");
@@ -134,7 +134,7 @@ class FollowingPage extends HookConsumerWidget {
                   child: NewsFeedCardHeader(
                     key: UniqueKey(),
                     title: card_count_name,
-                    avator: card_avator,
+                    avator: card_avatar,
                     time: card_created_at,
                   ),
                 ),

+ 18 - 0
packages/cpt_community/lib/modules/community/following/following_vm.dart

@@ -23,6 +23,11 @@ class FollowingVm extends _$FollowingVm {
   int _page = 1;  // 当前页
   int _limit = 10; // 每页数量
   int _count = 0; // 总条数
+
+  Map<String, dynamic> _queryParams = {
+    'keyword': null,
+    'is_liked': null,
+  };
   
   bool _needShowPlaceholder = false; //是否展示LoadingView
   // Refresh 控制器
@@ -280,6 +285,19 @@ class FollowingVm extends _$FollowingVm {
     }
   }
 
+  // 设置当前的 _queryParams
+  setCurrentQueryParams(Map<String, dynamic> params){
+    _queryParams.addAll(params);
+  }
+
+  // 获取当前的 _queryParams
+  Map<String, dynamic> getCurrentQueryParams(String? key){
+    if(key!=null && key!.isNotEmpty){
+      return _queryParams[key];
+    }
+    return _queryParams;
+  }
+
   // 去详情页面
   void handlerGotoDetail(BuildContext? context, int id){
     Log.d("去详情页面");

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

@@ -100,7 +100,7 @@ class ForyouPage extends HookConsumerWidget {
     String card_title = item.getValue("title", "");
     String card_created_at = item.getValue("created_at", "");
     Map<String, dynamic>? card_account = item.getValue<Map<String,dynamic>>("account", {});
-    String card_avator = card_account?['avator']?? "";
+    String card_avatar = card_account?['avatar']?? "";
     String card_count_name = card_account?['name']?? "";
     bool card_followed = card_account?['followed']??false;
     String card_content = item.getValue("content", "");
@@ -134,7 +134,7 @@ class ForyouPage extends HookConsumerWidget {
                   child: NewsFeedCardHeader(
                     key: UniqueKey(),
                     title: card_count_name,
-                    avator: card_avator,
+                    avator: card_avatar,
                     time: card_created_at,
                   ),
                 ),

+ 19 - 0
packages/cpt_community/lib/modules/community/foryou/foryou_vm.dart

@@ -25,6 +25,12 @@ class ForyouVm extends _$ForyouVm {
   int _page = 1;  // 当前页
   int _limit = 10; // 每页数量
   int _count = 0; // 总条数
+
+  Map<String, dynamic> _queryParams = {
+    'keyword': null,
+    'is_liked': null,
+  };
+
   // Refresh 控制器
   final EasyRefreshController refreshController = EasyRefreshController(
     controlFinishRefresh: true,  //允许刷新
@@ -401,6 +407,19 @@ class ForyouVm extends _$ForyouVm {
     }
   }
 
+  // 设置当前的 _queryParams
+  setCurrentQueryParams(Map<String, dynamic> params){
+    _queryParams.addAll(params);
+  }
+
+  // 获取当前的 _queryParams
+  Map<String, dynamic> getCurrentQueryParams(String? key){
+    if(key!=null && key!.isNotEmpty){
+      return _queryParams[key];
+    }
+    return _queryParams;
+  }
+
   // 去详情页面
   void handlerGotoDetail(BuildContext? context, int id){
     Log.d("去详情页面");

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

@@ -102,7 +102,7 @@ class NewsPage extends HookConsumerWidget {
     int card_id = item.getValue("id", null);
     String card_created_at = item.getValue("created_at", "");
     Map<String, dynamic>? card_account = item.getValue<Map<String,dynamic>>("account", null);
-    String card_avator = card_account?['avator']?? "";
+    String card_avatar = card_account?['avatar']?? "";
     String card_count_name = card_account?['name']?? "";
     bool card_followed = card_account?['followed']??false;
     int card_count_id = card_account?['id']?? null;
@@ -139,7 +139,7 @@ class NewsPage extends HookConsumerWidget {
                     child: NewsFeedCardHeader(
                       key: UniqueKey(),
                       title: card_count_name,
-                      avator: card_avator,
+                      avator: card_avatar,
                       time: card_created_at,
                     ),
                   ),

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

@@ -26,6 +26,11 @@ class NewsVm extends _$NewsVm {
   int _page = 1;  // 当前页
   int _limit = 10; // 每页数量
   int _count = 0; // 总条数
+
+  Map<String, dynamic> _queryParams = {
+    'keyword': null,
+    'is_liked': null,
+  };
   
   bool _needShowPlaceholder = false; //是否展示LoadingView
 
@@ -283,6 +288,20 @@ class NewsVm extends _$NewsVm {
     }
   }
 
+
+  // 设置当前的 _queryParams
+  setCurrentQueryParams(Map<String, dynamic> params){
+    _queryParams.addAll(params);
+  }
+
+  // 获取当前的 _queryParams
+  Map<String, dynamic> getCurrentQueryParams(String? key){
+    if(key!=null && key!.isNotEmpty){
+      return _queryParams[key]??{};
+    }
+    return _queryParams;
+  }
+
   // 去详情页面
   void handlerGotoDetail(BuildContext? context, int id){
     Log.d("去详情页面");

+ 1 - 1
packages/cpt_community/lib/modules/community/newsfeed_detail/comments_input.dart

@@ -67,7 +67,7 @@ class CommentsTextareaInput extends HookConsumerWidget {
             onChanged: (text) {
               // 当文本改变时,更新字符数量
               Log.d("text  $text");
-              Log.d("4  ${state.commentFieldInfo!['controller']?.text}");
+              Log.d("文本改变  ${state.commentFieldInfo!['controller']?.text}");
               if(showCounter){
                 noteCount.value = text.length;
               }

+ 1 - 1
packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_vm.dart

@@ -282,7 +282,7 @@ class NewsfeedDetailVm extends _$NewsfeedDetailVm {
     BuildContext contextPage = context;
     // double height = MediaQuery.of(contextPage).size.height;
     double commentInputHeight = 150.0;
-        await DialogEngine.show(
+    await DialogEngine.show(
       tag: "newsFeedComments",
       position: DialogPosition.bottom,
       widget: CommentsDialog(

+ 2 - 7
packages/cpt_community/lib/modules/community/newsfeed_post/newsfeed_post_page.dart

@@ -109,13 +109,8 @@ class NewsfeedPostPage extends HookConsumerWidget {
                         textColor: Colors.white,
                         fontWeight: FontWeight.w500,
                         fontSize: 16,
-                        onPressed: () async{
-                          final asyncResult = await vm.submitNewsfeedPost(context, sCallback: sCallback, fCallback: fCallback);
-                          if(asyncResult){
-                            final communitVm = ref.read(communityVmProvider.notifier);
-                            communitVm.getCurrentPageViewVm(null).initPageData();
-                            Navigator.pop(context);
-                          }
+                        onPressed: () {
+                          vm.submitNewsfeedPost(context, sCallback: sCallback, fCallback: fCallback);
                         },
                       ),
                     ),

+ 10 - 2
packages/cpt_community/lib/modules/community/newsfeed_post/newsfeed_post_vm.dart

@@ -4,6 +4,7 @@ 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/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';
@@ -110,7 +111,7 @@ class NewsfeedPostVm extends _$NewsfeedPostVm {
   }
 
   ///newsfeed 发布提交
-  Future<bool> submitNewsfeedPost(BuildContext? context, {VoidCallback? sCallback, VoidCallback? fCallback}) async {
+  Future submitNewsfeedPost(BuildContext? context, {VoidCallback? sCallback, VoidCallback? fCallback}) async {
     state = state.copyWith(mindFieldErrorText: null);
 
     _dismissKeyboard(keyStr: 'mind');
@@ -132,7 +133,14 @@ class NewsfeedPostVm extends _$NewsfeedPostVm {
       return false;
     }
 
-    return await handlerSubmitPostNewsfeed(mindValue, state.imgList,  sCallback: sCallback, fCallback: fCallback);
+    bool resResult = await handlerSubmitPostNewsfeed(mindValue, state.imgList,  sCallback: sCallback, fCallback: fCallback);
+
+    if(resResult){
+      final communitVm = ref.read(communityVmProvider.notifier);
+      communitVm.getCurrentPageViewVm(null).initPageData();
+      // Navigator.pop(context);
+      appRouter.maybePop();
+    }
   }
 
   Future<bool> handlerSubmitPostNewsfeed(String mindValue,List<String> imgList,{VoidCallback? sCallback, VoidCallback? fCallback}) async{

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

@@ -6,6 +6,9 @@ class ForrentState {
   LoadState loadingState;
   String? errorMessage;
 
+  String? keyword;
+  bool? isLiked;
+
   List<Map<String, dynamic>> list;
 
 
@@ -13,6 +16,8 @@ class ForrentState {
     this.activeTabIndex,
     this.loadingState = LoadState.State_Loading,
     String? errorMessage,
+    this.keyword,
+    this.isLiked,
     required this.list,
   });
 
@@ -20,12 +25,16 @@ class ForrentState {
     int? activeTabIndex,
     LoadState? loadingState,
     String? errorMessage,
+    String? keyword,
+    bool? isLiked,
     List<Map<String, dynamic>>? list,
   }) {
     return ForrentState(
       activeTabIndex: activeTabIndex ?? this.activeTabIndex,
       loadingState: loadingState ?? this.loadingState,
       errorMessage: errorMessage ?? this.errorMessage,
+      keyword: keyword ?? this.keyword,
+      isLiked: isLiked ?? this.isLiked,
       list: list ?? this.list,
     );
   }
@@ -35,6 +44,8 @@ class ForrentState {
       'activeTabIndex': this.activeTabIndex,
       'loadingState': this.loadingState,
       'errorMessage': this.errorMessage,
+      'keyword': this.keyword,
+      'isLiked': this.isLiked,
       'list': this.list,
     };
   }
@@ -44,6 +55,8 @@ class ForrentState {
       activeTabIndex: map['activeTabIndex'] as int,
       loadingState: map['loadingState'] as LoadState,
       errorMessage: map['errorMessage'] as String,
+      keyword: map['keyword'] as String,
+      isLiked: map['isLiked'] as bool,
       list: map['list'] as List<Map<String, dynamic>>,
     );
   }

+ 56 - 33
packages/cpt_community/lib/modules/garage/for_rent/for_rent_vm.dart

@@ -24,6 +24,13 @@ class ForrentVm extends _$ForrentVm {
   int _page = 1;  // 当前页
   int _limit = 10; // 每页数量
   int _count = 0; // 总条数
+
+  Map<String, dynamic> _queryParams = {
+    'category_id': null,
+    'keyword': null,
+    'is_liked': null,
+  };
+
   // Refresh 控制器
   final EasyRefreshController refreshController = EasyRefreshController(
     controlFinishRefresh: true,  //允许刷新
@@ -33,39 +40,39 @@ class ForrentVm extends _$ForrentVm {
   ForrentState initState() {
     return ForrentState(
         list: [
-          {
-            'id':1,
-            'goods_img':  'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
-            'title': 'Electronic keyboard',
-            'price': '\$66',
-            'isCollection': true,
-            'collection_num': 12,
-            'publisher': 'William Jefferson',
-            'publish_time': 'June 17,2016 at 7:23 p.m.',
-            'publisrher_avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
-          },
-          {
-            'id':2,
-            'goods_img':  'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
-            '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': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
-          },
-          {
-            'id':3,
-            'goods_img':  'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
-            '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': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
-          },
+          // {
+          //   'id':1,
+          //   'goods_img':  'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
+          //   'title': 'Electronic keyboard',
+          //   'price': '\$66',
+          //   'isCollection': true,
+          //   'collection_num': 12,
+          //   'publisher': 'William Jefferson',
+          //   'publish_time': 'June 17,2016 at 7:23 p.m.',
+          //   'publisrher_avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
+          // },
+          // {
+          //   'id':2,
+          //   'goods_img':  'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
+          //   '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': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
+          // },
+          // {
+          //   'id':3,
+          //   'goods_img':  'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
+          //   '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': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
+          // },
         ]
     );
   }
@@ -192,6 +199,8 @@ class ForrentVm extends _$ForrentVm {
       //请求网络
       Map<String, dynamic>  params = {
         "type": 2,  // 类型(1=Sale,2=Rent)
+        "category_id": _queryParams['category_id'],
+        "keyword": _queryParams['keyword'],
         "page": _page,
         "limit": _limit,
       };
@@ -294,6 +303,20 @@ class ForrentVm extends _$ForrentVm {
       ToastEngine.show("Error: $e");
     }
   }
+
+  // 设置当前的 _queryParams
+  setCurrentQueryParams(Map<String, dynamic> params){
+    _queryParams.addAll(params);
+  }
+
+  // 获取当前的 _queryParams
+  Map<String, dynamic> getCurrentQueryParams(String? key){
+    if(key!=null && key!.isNotEmpty){
+      return _queryParams[key];
+    }
+    return _queryParams;
+  }
+
   // 去详情页面
   void handlerGotoDetail({BuildContext? context, required int id, String type='forRent'}){
     Log.d("去详情页面");

+ 13 - 1
packages/cpt_community/lib/modules/garage/for_sale/for_sale_state.dart

@@ -5,6 +5,9 @@ class ForsaleState {
   //页面 LoadView 状态的展示
   LoadState loadingState;
   String? errorMessage;
+
+  String? keyword;
+  bool? isLiked;
   List<Map<String, dynamic>> list;
 
 
@@ -12,6 +15,8 @@ class ForsaleState {
     this.activeTabIndex,
     this.loadingState = LoadState.State_Loading,
     String? errorMessage,
+    this.keyword,
+    this.isLiked,
     required this.list,
   });
 
@@ -19,13 +24,16 @@ class ForsaleState {
     int? activeTabIndex,
     LoadState? loadingState,
     String? errorMessage,
+    String? keyword,
+    bool? isLiked,
     List<Map<String, dynamic>>? list,
-    List<String>? tabsList,
   }) {
     return ForsaleState(
       activeTabIndex: activeTabIndex ?? this.activeTabIndex,
       loadingState: loadingState ?? this.loadingState,
       errorMessage: errorMessage ?? this.errorMessage,
+      keyword: keyword ?? this.keyword,
+      isLiked: isLiked ?? this.isLiked,
       list: list ?? this.list,
     );
   }
@@ -35,6 +43,8 @@ class ForsaleState {
       'activeTabIndex': this.activeTabIndex,
       'loadingState': this.loadingState,
       'errorMessage': this.errorMessage,
+      'keyword': this.keyword,
+      'isLiked': this.isLiked,
       'list': this.list,
     };
   }
@@ -44,6 +54,8 @@ class ForsaleState {
       activeTabIndex: map['activeTabIndex'] as int,
       loadingState: map['loadingState'] as LoadState,
       errorMessage: map['errorMessage'] as String,
+      keyword: map['keyword'] as String,
+      isLiked: map['isLiked'] as bool,
       list: map['list'] as List<Map<String, dynamic>>,
     );
   }

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

@@ -26,6 +26,12 @@ class ForsaleVm extends _$ForsaleVm {
   int _limit = 10; // 每页数量
   int _count = 0; // 总条数
 
+  Map<String, dynamic> _queryParams = {
+    'category_id': null,
+    'keyword': null,
+    'is_liked': null,
+  };
+
   // Refresh 控制器
   final EasyRefreshController refreshController = EasyRefreshController(
     controlFinishRefresh: true,  //允许刷新
@@ -212,6 +218,8 @@ class ForsaleVm extends _$ForsaleVm {
       //请求网络
       Map<String, dynamic>  params = {
         "type": 1,  // 类型(1=Sale,2=Rent)
+        "category_id": _queryParams['category_id'],
+        "keyword": _queryParams['keyword'],
         "page": _page,
         "limit": _limit,
       };
@@ -308,6 +316,20 @@ class ForsaleVm extends _$ForsaleVm {
       ToastEngine.show("Error: $e");
     }
   }
+
+  // 设置当前的 _queryParams
+  setCurrentQueryParams(Map<String, dynamic> params){
+    _queryParams.addAll(params);
+  }
+
+  // 获取当前的 _queryParams
+  Map<String, dynamic> getCurrentQueryParams(String? key){
+    if(key!=null && key!.isNotEmpty){
+      return _queryParams[key];
+    }
+    return _queryParams;
+  }
+
   // 去详情页面
   void handlerGotoDetail({BuildContext? context, required int id, String type='forSale'}){
     Log.d("去详情页面");

+ 6 - 4
packages/cpt_community/lib/modules/garage/garagesale_post/garagesale_post_page.dart

@@ -42,9 +42,11 @@ class GaragesalePostPage extends HookConsumerWidget {
     final state = ref.watch(garagesalePostVmProvider);
 
     useEffect((){
-      vm.initData(
-        type:type
-      );
+      WidgetsBinding.instance!.addPostFrameCallback((_) {
+        vm.initData(
+            type:type
+        );
+      });
       return () => (){
 
       };
@@ -210,7 +212,7 @@ class GaragesalePostPage extends HookConsumerWidget {
                         textColor: Colors.white,
                         fontWeight: FontWeight.w500,
                         fontSize: 16,
-                        onPressed: (){
+                        onPressed: () {
                           // Navigator.pop(context);
                           vm.submitGaragesalePost(context, sCallback: sCallback, fCallback: fCallback);
                           // final communitVm = ref.read(communityVmProvider.notifier);

+ 82 - 41
packages/cpt_community/lib/modules/garage/garagesale_post/garagesale_post_vm.dart

@@ -1,9 +1,15 @@
 
+import 'dart:async';
+
 import 'package:cpt_community/modules/community/community_vm.dart';
 import 'package:cs_resources/generated/assets.dart';
 import 'package:flutter/material.dart';
+import 'package:plugin_basic/constants/app_constant.dart';
+import 'package:plugin_platform/engine/sp/sp_util.dart';
 import 'package:plugin_platform/engine/toast/toast_engine.dart';
+import 'package:plugin_platform/http/http_result.dart';
 import 'package:riverpod_annotation/riverpod_annotation.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';
@@ -129,33 +135,51 @@ class GaragesalePostVm extends _$GaragesalePostVm {
         }
       }
     });
-    // state = state.copyWith(
-    //     saleSelectedOption:_initialSaleSelectedItem,
-    // );
   }
 
-  Future getGarageCategoryList() async {
-    final communityVm = ref.read(communityVmProvider.notifier);
-    final result = await communityVm.getGarageSaleCategoryOptions();
-    if (result.isSuccess) {
-      // state.categoryOptions = result.data!;
-    //   将 [{id: 1, name: Kids}, {id: 2, name: Homeware}, {id: 3, name: Fashion}, {id: 4, name: Electronics}, {id: 5, name: Sports}, {id: 6, name: Furniture}, {id: 7, name: Others}] 处理成
-    //   ['Kids', 'Homeware', 'Fashion', 'Electronics', 'Sports', 'Furniture', 'Others']
-      final listJson = result.getListJson();
-      _resCategoryOptionsList = listJson;
-      Log.d("_resCategoryOptionsList   $_resCategoryOptionsList");
-
-      List<String> catList = (listJson as List)!.map((e) => (e['name'] as String)).toList()?? [];
-
-
-      Log.d("--initialSelectedItem----$_initialSaleSelectedItem-");
-
-       state = state.copyWith(
-         saleSelectedOption:_initialSaleSelectedItem,
-         categoryOptionsList: catList,
-       );
+  Future<List<String>> getGarageCategoryList() async{
+    // 获取分类列表
+    List<String> catNameResult = [];
+    try {
+      // 加入有缓存 就取缓存
+      List<Map<String, dynamic>>? StorageCategoryList = SPUtil.getObjectList(AppConstant.storageGarageCategoryList)?.cast<Map<String, dynamic>>();
+
+      if(StorageCategoryList != null && StorageCategoryList.isNotEmpty){
+        Log.d("取StorageCategoryList 缓存: $StorageCategoryList ");
+        _resCategoryOptionsList = StorageCategoryList;
+        // 将 listJson 转换为 List<String>
+        catNameResult = (StorageCategoryList as List)!.map((e) => (e['name'] as String)).toList()?? [];;
+      }else {
+        final communityVm = ref.read(communityVmProvider.notifier);
+        final result = await communityVm.getGarageSaleCategoryOptions();
+        if (result.isSuccess) {
+          // state.categoryOptions = result.data!;
+          //   将 [{id: 1, name: Kids}, {id: 2, name: Homeware}, {id: 3, name: Fashion}, {id: 4, name: Electronics}, {id: 5, name: Sports}, {id: 6, name: Furniture}, {id: 7, name: Others}] 处理成
+          //   ['Kids', 'Homeware', 'Fashion', 'Electronics', 'Sports', 'Furniture', 'Others']
+          final listJson = result.getListJson();
+          Log.d("_resCategoryOptionsList   $_resCategoryOptionsList");
+          // 将 listJson 转换为 List<Map<String, dynamic>>
+          List<Map<String, dynamic>> garageCategoryList = (listJson as List?)?.map((item) => item as Map<String, dynamic>).toList() ?? [];
+          _resCategoryOptionsList = garageCategoryList;
+          // 将 garageCategoryList 存入缓存
+          Log.d("设置StorageCategoryList 缓存");
+          SPUtil.putObjectList(AppConstant.storageGarageCategoryList, garageCategoryList);
+
+          // 将 listJson 转换为 List<String>
+          List<String> catNameResult = (listJson as List)!.map((e) => (e['name'] as String)).toList()?? [];
+
+          Log.d("--initialSelectedItem----$_initialSaleSelectedItem-");
+        }
+      }
+      state = state.copyWith(
+        saleSelectedOption:_initialSaleSelectedItem,
+        categoryOptionsList: catNameResult,
+      );
+    }catch(error){
+      Log.d("------获取分类列表error---------- $error");
     }
-    return result;
+
+    return catNameResult;
   }
 
   //catogery 选择选项
@@ -253,7 +277,7 @@ class GaragesalePostVm extends _$GaragesalePostVm {
   }
 
   ///提交反馈
-  void submitGaragesalePost(BuildContext context, {VoidCallback? sCallback, VoidCallback? fCallback}) {
+  Future submitGaragesalePost(BuildContext context, {VoidCallback? sCallback, VoidCallback? fCallback}) async{
     Log.d("GaragesalePostPageState 提交表单");
     state = state.copyWith(titleErrorText: null, descriptionErrorText: null);
     _dismissKeyboard(keyStr: "");
@@ -261,6 +285,7 @@ class GaragesalePostVm extends _$GaragesalePostVm {
     // 获取表单的值
     String  saleValue= state.saleSelectedOption ?? "";
     String  categoryValue= state.categorySelectedOption ?? "";
+    int categoryId;
     String  contactTypeValue= state.contactTypeSelectedOption ?? "";
 
     String  titleValue= _getFormFieldValue(keyStr: 'title');
@@ -278,6 +303,17 @@ class GaragesalePostVm extends _$GaragesalePostVm {
     if (Utils.isEmpty(categoryValue)) {
       ToastEngine.show('Category is empty');
       return;
+    }else {
+      // 通过 categoryValue 值 来获取 categoryId
+      Log.d("_resCategoryOptionsList  $_resCategoryOptionsList");
+      try {
+        Map<String, dynamic>? categoryItem = _resCategoryOptionsList.firstWhere((element) => element['name'] == categoryValue, orElse: () => {'id': -1});
+        categoryId = categoryItem?['id'];
+      } catch (e) {
+        Log.d("未找到匹配的 categoryValue: $categoryValue");
+        ToastEngine.show('Category is invalid');
+        return;
+      }
     }
     if (Utils.isEmpty(contactTypeValue)) {
       ToastEngine.show('ContactType is empty');
@@ -325,18 +361,25 @@ class GaragesalePostVm extends _$GaragesalePostVm {
     }
 
     // 提交数据
-    handlerSubmitPost(
+    final resResult = await handlerSubmitPost(
       type: saleValue == 'For Sale'? 1:2,
       titleValue: titleValue,
-      categoryId: 1,
+      categoryId: categoryId!,
       priceValue: priceValue,
       descriptionValue: descriptionValue,
       contactValue: totalContactStr,
       imgList: state.imgList,
     );
+
+    if(resResult.isSuccess){
+      final communitVm = ref.read(communityVmProvider.notifier);
+      communitVm.getCurrentPageViewVm(null).initPageData();
+      // Navigator.pop(context);
+      appRouter.maybePop();
+    }
   }
 
-  Future handlerSubmitPost({
+  Future<HttpResult<Object>> handlerSubmitPost({
     required int type,
     required String titleValue,
     required int categoryId,
@@ -345,17 +388,17 @@ class GaragesalePostVm extends _$GaragesalePostVm {
     required String descriptionValue,
     required List imgList,
   }) async{
-    final params = <String, dynamic>{
-      "type": type, // 1 = Sale  2 = Rent
-      "category_id": categoryId,
-      "title": titleValue,
-      "price": priceValue,
-      "description": descriptionValue,
-      "contact": contactValue,  // string($例如:whatsapp:+8617671757687 或 mobile:+8617671757687)
-      "resources": imgList,
-    };
-    final result =  await commonGarageRespositoryInstance.fetchPublishGarage(params);
-    return result;
+      final params = <String, dynamic>{
+        "type": type, // 1 = Sale  2 = Rent
+        "category_id": categoryId,
+        "title": titleValue,
+        "price": priceValue,
+        "description": descriptionValue,
+        "contact": contactValue,  // string($例如:whatsapp:+8617671757687 或 mobile:+8617671757687)
+        "resources": imgList,
+      };
+      final result =  await commonGarageRespositoryInstance.fetchPublishGarage(params);
+      return result;
   }
 
 
@@ -402,6 +445,4 @@ class GaragesalePostVm extends _$GaragesalePostVm {
 
     Log.d("GaragesalePostPageState 销毁 onDispose");
   }
-
-
 }

+ 1 - 1
packages/cpt_community/lib/modules/my_posts/my_posts_newsfeed/my_posts_newsfeed_page.dart

@@ -148,7 +148,7 @@ class MyPostsNewsfeedPage extends HookConsumerWidget {
       int card_id = itemJson.getValue("id", null);
       String card_created_at = itemJson.getValue("created_at", "");
       // Map<String, dynamic>? card_account = itemJson.getValue<Map<String,dynamic>>("account", null);
-      // String card_avator = card_account?['avator']?? "";
+      // String card_avatar = card_account?['avatar']?? "";
       // String card_count_name = card_account?['name']?? "";
       // bool card_followed = card_account?['followed']??false;
       // int card_count_id = card_account?['id']?? null;

+ 12 - 0
packages/cpt_community/lib/respository/common_garage.dart

@@ -193,10 +193,22 @@ class CommonGarageRespository {
     headers["Content-Type"] = "application/x-www-form-urlencoded";
     headers["Accept"] = "application/x.yyjobs-api.v1+json";
 
+    List<String> paths = data!["resources"] as List<String>;
+
+    Map<String, String> files = {};
+    if (paths != null && paths.isNotEmpty) {
+      paths.asMap().forEach((index, path) {
+        files["resources[$index]"] = path;
+      });
+    }
+    // 删除 resources 属性
+    params.remove("resources");
+
     final result = await dioEngine.requestNetResult(
       // ApiConstants.apiServerTime, // api 地址
       '/api/v1/user/garage-sale/index/publish', // api 地址
       params: params,
+      paths: files,
       headers: headers,
       method: HttpMethod.POST,
       isShowLoadingDialog: true,  //是否展示默认的Loading弹窗

+ 4 - 1
packages/cpt_community/lib/respository/common_newsfeed.dart

@@ -227,7 +227,7 @@ class CommonNewsFeedRespository {
     Map<String, dynamic> params = {};
     params = data!;
     Map<String, String> headers = {};
-    headers["Content-Type"] = "multipart/form-data";
+    headers["Content-Type"] = "application/x-www-form-urlencoded";
     headers["Accept"] = "application/x.yyjobs-api.v1+json";
 
     List<String> paths = data!["resources"] as List<String>;
@@ -239,6 +239,9 @@ class CommonNewsFeedRespository {
       });
     }
 
+    // 删除 resources 属性
+    params.remove("resources");
+
     final result = await dioEngine.requestNetResult(
       // ApiConstants.apiServerTime, // api 地址
       '/api/v1/user/news-feed/index/publish', // api 地址

+ 4 - 0
packages/cpt_profile/lib/modules/setting/setting_view_model.dart

@@ -2,8 +2,10 @@ import 'package:cpt_profile/modules/change_mobile/change_mobile_page.dart';
 import 'package:cpt_profile/modules/reset_password/reset_password_page.dart';
 import 'package:cpt_profile/modules/setting/dialog/account_deactivation_dialog.dart';
 import 'package:cpt_profile/modules/setting/setting_state.dart';
+import 'package:plugin_basic/constants/app_constant.dart';
 import 'package:plugin_basic/provider/user_config/user_config_service.dart';
 import 'package:plugin_platform/engine/dialog/dialog_engine.dart';
+import 'package:plugin_platform/engine/sp/sp_util.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';
@@ -39,6 +41,8 @@ class SettingViewModel extends _$SettingViewModel {
       confirmAction: () {
         //清除用户登录信息
         UserConfigService.getInstance().handleLogoutParams();
+        // 清除 garagesale category 缓存
+        SPUtil.remove(AppConstant.storageGarageCategoryList);
         //清除全部页面栈去登录页面
         ComponentServiceManager().authService.startAndPopAllLoginPage();
       },

+ 1 - 0
packages/cs_plugin_basic/lib/constants/app_constant.dart

@@ -17,6 +17,7 @@ class AppConstant {
   static const storageNotificationEnable = 'storage_notification_enable'; //应用设置的推送是否开启
   static const storageDeviceUUID = 'storage_device_uuid'; //设备的UUID
   static const storageDarkModel = 'storage_dark_model'; //设备当前配置的模式
+  static const storageGarageCategoryList = 'staorage_garage_category_list'; // 存储garage的分类列表
 
   //消息通知Key
   static const eventProfileRefresh = 'event_profile_refresh'; //通知用户信息需要刷新