From 7921edd71ec2e52194a396aa22b53a3e3fe3efe1 Mon Sep 17 00:00:00 2001 From: Gmaker689 <1711322114@qq.com> Date: Mon, 25 May 2026 20:15:06 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BB=BB=E5=8A=A1=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E9=A1=B5=20JWT=20=E9=89=B4=E6=9D=83=E5=A4=B1=E8=B4=A5=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E5=9B=9E=E9=80=80=E7=99=BB=E5=BD=95=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - TaskListPanel 用 React Router 替代原生 ,避免整页刷新 - auth store 初始化时同步读取 token 设置 isAuthenticated,避免 useEffect 异步执行前 ProtectedRoute 误判未登录 --- frontend/src/components/TaskListPanel.tsx | 12 ++++++++---- frontend/src/stores/auth.ts | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/TaskListPanel.tsx b/frontend/src/components/TaskListPanel.tsx index 61f55f4..ad0d90a 100644 --- a/frontend/src/components/TaskListPanel.tsx +++ b/frontend/src/components/TaskListPanel.tsx @@ -1,5 +1,5 @@ import { useEffect, useState, useCallback } from 'react' -import { useParams } from 'react-router-dom' +import { Link, useParams } from 'react-router-dom' import { getTasks } from '../api/project' import type { Task } from '../api/types' import StatusBadge from './StatusBadge' @@ -67,9 +67,9 @@ export default function TaskListPanel() {

) : ( tasks.map(task => ( -
{ + if (task.status !== 'completed') e.preventDefault() + }} onMouseEnter={e => { if (task.status === 'completed') (e.currentTarget as HTMLElement).style.background = 'var(--accent-dim)' @@ -115,7 +119,7 @@ export default function TaskListPanel() { )} - + )) )} diff --git a/frontend/src/stores/auth.ts b/frontend/src/stores/auth.ts index 6a34804..7a9fb92 100755 --- a/frontend/src/stores/auth.ts +++ b/frontend/src/stores/auth.ts @@ -22,7 +22,7 @@ interface AuthState { export const useAuthStore = create((set) => ({ user: null, - isAuthenticated: false, + isAuthenticated: getToken() !== null, loading: false, error: null, From acef46063c3eedddcaccde67b9572704548945d9 Mon Sep 17 00:00:00 2001 From: Gmaker689 <1711322114@qq.com> Date: Mon, 25 May 2026 20:19:09 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E4=BB=BB=E5=8A=A1=E4=BE=A7=E8=BE=B9?= =?UTF-8?q?=E6=A0=8F=E7=82=B9=E5=87=BB=E8=AF=A6=E6=83=85=E5=90=8E"?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E4=B8=8D=E5=AD=98=E5=9C=A8"=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GetTasks 返回的 TaskResponse.ID 使用了数据库自增 ID (t.ID) 而非 ExternalID, 导致前端用错误 ID 调用 GetTask 接口时 external_id 查询不到记录。 改为返回 t.ExternalID 与实际查询字段一致。 --- backend/internal/service/project.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/internal/service/project.go b/backend/internal/service/project.go index 14138f3..30fde5a 100644 --- a/backend/internal/service/project.go +++ b/backend/internal/service/project.go @@ -198,7 +198,7 @@ func (s *ProjectService) GetTasks(ctx context.Context, userID uint, projectID ui response := make([]model.TaskResponse, len(tasks)) for i, t := range tasks { response[i] = model.TaskResponse{ - ID: fmt.Sprintf("%d", t.ID), + ID: t.ExternalID, ProjectID: fmt.Sprintf("%d", t.ProjectID), Prompt: t.Prompt, AssetType: t.AssetType,