From 10a362ccff15a7efd7cc1b242790b0243f623951 Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期一, 29 十二月 2025 17:04:50 +0800
Subject: [PATCH] Merge branch 'master' of http://120.26.58.240:8888/r/flexJobMiniApp
---
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