From ba94ceae1315174798ae1967ef62268c6d16cd5b Mon Sep 17 00:00:00 2001 From: Codex Assistant <codex@example.com> Date: 星期一, 06 十月 2025 22:07:06 +0800 Subject: [PATCH] feat: 评审与活动相关改动 - backend(GraphQL): Activity schema 增加 updateActivityState(id, state);实现 resolver/service 仅更新 state=2 作为逻辑删除 - backend(GraphQL): region.graphqls 新增 Query leafRegions - backend(GraphQL): player.graphqls 的 projectReviewApplications 增加可选参数 regionId - backend(Service): listProjectReviewApplications 绑定 regionId 参数,修复 QueryParameterException - frontend(web): 新增 api/activity.js 的 updateActivityState 并接入 activity-list 删除逻辑 - frontend(web): review-list.vue 权限仅校验登录,移除角色限制;查询参数修正为 name/regionId - frontend(web): 删除未引用的 ActivityList.vue - frontend(web): projectReviewNew.js GraphQL 查询增加 name 参数 --- web/src/config/api.ts | 49 +++++++++++++++++++++++++++++++------------------ 1 files changed, 31 insertions(+), 18 deletions(-) diff --git a/web/src/config/api.ts b/web/src/config/api.ts index 485abb2..c1430be 100644 --- a/web/src/config/api.ts +++ b/web/src/config/api.ts @@ -20,33 +20,46 @@ // 鑾峰彇JWT token const { getToken } = await import('@/utils/auth'); const token = getToken(); + + // 鏋勫缓璇锋眰澶� const headers: Record<string, string> = { 'Content-Type': 'application/json', }; + if (token) { headers['Authorization'] = `Bearer ${token}`; } - const response = await fetch(API_CONFIG.GRAPHQL_ENDPOINT, { - method: 'POST', - headers: headers, - body: JSON.stringify({ - query, - variables, - }), - }) + // 鏋勫缓璇锋眰浣� + const requestBody = JSON.stringify({ + query, + variables, + }); - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`) + try { + // 鍙戦�佽姹� + const response = await fetch(API_CONFIG.GRAPHQL_ENDPOINT, { + method: 'POST', + headers, + body: requestBody, + }); + + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + + const result = await response.json(); + + if (result.errors) { + throw new Error(`GraphQL errors: ${JSON.stringify(result.errors)}`); + } + + return result; + } catch (error) { + console.error('=== GraphQL璇锋眰澶辫触 ==='); + console.error('閿欒璇︽儏:', error); + throw error; } - - const result = await response.json() - - if (result.errors) { - throw new Error(result.errors[0].message) - } - - return result.data } // 閫氱敤API璇锋眰宸ュ叿鍑芥暟 -- Gitblit v1.8.0