From 9289f5fd30c4cf89845482cb5ec351962dce852a Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期二, 30 十二月 2025 16:20:17 +0800
Subject: [PATCH] fix: bug

---
 packages/hooks/task.ts |   44 +++++++++++++++++++++++++++++++-------------
 1 files changed, 31 insertions(+), 13 deletions(-)

diff --git a/packages/hooks/task.ts b/packages/hooks/task.ts
index 58642d8..2729392 100644
--- a/packages/hooks/task.ts
+++ b/packages/hooks/task.ts
@@ -10,6 +10,7 @@
   EnumTaskStatus,
   EnumUserGender,
   EnumTaskUserApplyStatus,
+  EnumReadScene,
 } from '@12333/constants';
 import _ from 'lodash';
 import { OrderUtils, trim } from '@12333/utils';
@@ -27,6 +28,7 @@
 type UseTaskListOptions = {
   cityCode?: MaybeRef<string>;
   enabled?: MaybeRef<boolean>;
+  needLogin?: MaybeRef<boolean>;
 
   defaultQueryMenuState?: {
     releaseStatus?: EnumTaskReleaseStatus;
@@ -46,7 +48,13 @@
  * @description 浠匔绔娇鐢�
  */
 export function useTaskList(options: UseTaskListOptions = {}) {
-  const { cityCode = '', enabled = true, defaultQueryMenuState = {}, beforeRequest } = options;
+  const {
+    cityCode = '',
+    enabled = true,
+    needLogin = false,
+    defaultQueryMenuState = {},
+    beforeRequest,
+  } = options;
 
   const searchValue = ref('');
 
@@ -109,12 +117,18 @@
         params = beforeRequest(params);
       }
 
-      return taskServices.getOpenTaskInfos(params, {
-        showLoading: false,
-      });
+      if (unref(needLogin)) {
+        return taskServices.getTaskInfos(params, {
+          showLoading: false,
+        });
+      } else {
+        return taskServices.getOpenTaskInfos(params, {
+          showLoading: false,
+        });
+      }
     },
     {
-      queryKey: ['taskServices/getOpenTaskInfos', queryState, queryMenuState, cityCode],
+      queryKey: ['taskServices/getOpenTaskInfos', queryState, queryMenuState, cityCode, needLogin],
       enabled: enabled,
     }
   );
@@ -228,24 +242,28 @@
 
 type UseTaskInfoOptions = {
   id: MaybeRef<string>;
+  readScene?: string | EnumReadScene;
   onSuccess?: (data: API.GetTaskInfoQueryResult) => any;
 };
 
-export function useTaskInfo({ id, onSuccess }: UseTaskInfoOptions) {
+export function useTaskInfo({ id, readScene, onSuccess }: UseTaskInfoOptions) {
   const {
     isLoading,
     isError,
     data: detail,
     refetch,
   } = useQuery({
-    queryKey: ['taskServices/getTaskInfo', id],
+    queryKey: ['taskServices/getTaskInfo', id, readScene],
     queryFn: async () => {
-      return await taskServices.getTaskInfo(
-        { id: unref(id) },
-        {
-          showLoading: false,
-        }
-      );
+      const params: API.APIgetTaskInfoParams = {
+        id: unref(id),
+      };
+      if (!!readScene) {
+        params.readScene = Number(readScene);
+      }
+      return await taskServices.getTaskInfo(params, {
+        showLoading: false,
+      });
     },
     placeholderData: () => ({} as API.GetTaskInfoQueryResult),
     onSuccess(data) {

--
Gitblit v1.10.0