From c4a9cad1c50e89365e2a58b50e259af642ed3b8c Mon Sep 17 00:00:00 2001 From: Codex Assistant <codex@example.com> Date: 星期二, 07 十月 2025 16:12:20 +0800 Subject: [PATCH] feat(review): 调整评审详情展示顺序与样式,描述支持多行,项目信息列宽40/60 fix(auth): 登录页与首页循环跳转保护;api.ts 在登录页不再重定向;401分支在登录页不跳转 fix(router): /login 放行策略优化,避免死循环;评审列表跳转到 /project-review/:id/detail fix(frontend): 补齐 utils/appConfig.ts,避免启动白屏 fix(review): 详情页提交评分缺少stageId时回退使用项目详情的stageId feat(backend): ActivityPlayerDetailResponse.playerInfo 补充 avatarUrl/avatar,服务组装时填充用户头像 chore(dev): 启动脚本注入本地JWT密钥,重启前后端 --- web/src/api/media.js | 55 +++---------------------------------------------------- 1 files changed, 3 insertions(+), 52 deletions(-) diff --git a/web/src/api/media.js b/web/src/api/media.js index ac6a772..c351e39 100644 --- a/web/src/api/media.js +++ b/web/src/api/media.js @@ -38,50 +38,12 @@ `; export const getMediasByTarget = async (targetType, targetId) => { - // 鑾峰彇JWT token - const { getToken } = await import('@/utils/auth'); - const token = getToken(); - const headers = { 'Content-Type': 'application/json' }; - if (token) { - headers['Authorization'] = `Bearer ${token}`; - } - - const res = await fetch(GRAPHQL_ENDPOINT, { - method: 'POST', - headers: headers, - body: JSON.stringify({ - query: MEDIAS_BY_TARGET_QUERY, - variables: { targetType, targetId } - }) - }); - const result = await res.json(); - if (result.errors) { - throw new Error(result.errors[0].message); - } + const result = await graphqlRequest(MEDIAS_BY_TARGET_QUERY, { targetType, targetId }); return result.data.mediasByTarget || []; }; export const saveMedia = async (input) => { - // 鑾峰彇JWT token - const { getToken } = await import('@/utils/auth'); - const token = getToken(); - const headers = { 'Content-Type': 'application/json' }; - if (token) { - headers['Authorization'] = `Bearer ${token}`; - } - - const res = await fetch(GRAPHQL_ENDPOINT, { - method: 'POST', - headers: headers, - body: JSON.stringify({ - query: SAVE_MEDIA_MUTATION, - variables: { input } - }) - }); - const result = await res.json(); - if (result.errors) { - throw new Error(result.errors[0].message); - } + const result = await graphqlRequest(SAVE_MEDIA_MUTATION, { input }); return result.data.saveMedia; }; @@ -215,17 +177,6 @@ // 缁熶竴鐨� V2 淇濆瓨鎺ュ彛锛堣繑鍥� { success, message, mediaId }锛夛紝绀轰緥锛� // await saveMediaV2({ targetType: 'player', targetId: 123, path: 'avatar/xxx.jpg', fileName: 'avatar.jpg', fileExt: 'jpg', fileSize: 2048, mediaType: 1 }) export const saveMediaV2 = async (input) => { - const res = await fetch(GRAPHQL_ENDPOINT, { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ - query: SAVE_MEDIA_V2_MUTATION, - variables: { input } - }) - }); - const result = await res.json(); - if (result.errors) { - throw new Error(result.errors[0].message); - } + const result = await graphqlRequest(SAVE_MEDIA_V2_MUTATION, { input }); return result.data.saveMediaV2; }; \ No newline at end of file -- Gitblit v1.8.0