Skip to content

Let's use AI to Earn!

1

DESKTOP-ZTS2NQJNAd4f3b37f73ac
diff --git a/src/views/task/components/carInfo.tsx b/src/views/task/components/carInfo.tsx
index 9d05a85d..fbb490fc 100644
--- a/src/views/task/components/carInfo.tsx
+++ b/src/views/task/components/carInfo.tsx
@@ -5,7 +5,7 @@
* @LastEditors: nevin
* @Description: 挂车
*/
-import { Button, Modal } from 'antd';
+import { Button, Modal, message } from 'antd';
import { Task, TaskProduct } from '@@/types/task';
import { forwardRef, useImperativeHandle, useState } from 'react';
import { taskApi } from '@/api/task';
@@ -35,10 +35,27 @@ const Com = forwardRef<TaskInfoRef>((props: any, ref) => {
*/
async function taskApply() {
if (!taskInfo) return;
-
- const res = await taskApi.taskApply(taskInfo?._id);
- setTaskInfo(res as any);
- setIsModalOpen(false);
+ console.log('taskInfo', taskInfo);
+ try {
+ const res = await taskApi.taskApply(taskInfo?._id);
+ setTaskInfo(res as any);
+ setIsModalOpen(false);
+
+ // 添加成功提示
+ message.success('任务接受成功');
+
+ // 跳转到已参与任务选项卡
+ const taskTabElement = document.querySelector('[data-tab="mine"]');
+ if (taskTabElement) {
+ (taskTabElement as HTMLElement).click();
+ } else {
+ // 如果找不到元素,则使用URL参数方式跳转
+ window.location.href = '/task?tab=mine';
+ }
+ } catch (error) {
+ console.error('接受任务失败:', error);
+ message.error('接受任务失败,请重试');
+ }
}
const handleCancel = () => {
diff --git a/src/views/task/components/mineInfo.tsx b/src/views/task/components/mineInfo.tsx
index d16faaac..579d7f18 100644
--- a/src/views/task/components/mineInfo.tsx
+++ b/src/views/task/components/mineInfo.tsx
@@ -109,7 +109,10 @@ const Com = forwardRef<MineTaskInfoRef>((props: any, ref) => {
// 处理截图文件
const screenshotUrls = fileList
.filter((file) => file.status === 'done')
- .map((file) => file.url || file.response?.url);
+ .map((file) => {
+ console.log('file', file);
+ return file.response?.data.name;
+ });
const doneInfo = {
submissionUrl: values.submissionUrl,
diff --git a/src/views/task/components/popInfo.tsx b/src/views/task/components/popInfo.tsx
index 1352317b..2388b46a 100644
--- a/src/views/task/components/popInfo.tsx
+++ b/src/views/task/components/popInfo.tsx
@@ -50,7 +50,7 @@ const Com = forwardRef<TaskInfoRef>((props: any, ref) => {
if (!taskInfo) return;
try {
- const res = await taskApi.taskApply(taskInfo?.id);
+ const res = await taskApi.taskApply(taskInfo?._id);
setTaskInfo(res);
message.success('任务接受成功!');
setIsModalOpen(false);