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/utils/cos-simple.ts | 128 +++++++++++++++++++++--------------------- 1 files changed, 64 insertions(+), 64 deletions(-) diff --git a/web/src/utils/cos-simple.ts b/web/src/utils/cos-simple.ts index 24a983d..6f3e835 100644 --- a/web/src/utils/cos-simple.ts +++ b/web/src/utils/cos-simple.ts @@ -1,65 +1,65 @@ -import axios from 'axios' - -// GraphQL鏌ヨ鑾峰彇涓婁紶鍑瘉 -const GET_UPLOAD_CREDENTIALS = ` - query GetUploadCredentials { - getUploadCredentials { - bucket - region - key - presignedUrl - expiration - } - } -` - -// 浠庡悗绔疓raphQL鑾峰彇涓婁紶鍑瘉 -const getUploadCredentials = async () => { - try { - const response = await axios.post('http://localhost:8080/graphql', { - query: GET_UPLOAD_CREDENTIALS - }) - - if (response.data.errors) { - throw new Error(response.data.errors[0].message) - } - - return response.data.data.getUploadCredentials - } catch (error) { - console.error('鑾峰彇涓婁紶鍑瘉澶辫触:', error) - throw error - } -} - -/** - * 浣跨敤棰勭鍚峌RL涓婁紶鏂囦欢鍒拌吘璁簯COS - * @param file 瑕佷笂浼犵殑鏂囦欢 - * @returns Promise<string> 杩斿洖鏂囦欢鐨勮闂甎RL - */ -export const uploadToCOS = async (file: File): Promise<string> => { - try { - // 鑾峰彇涓婁紶鍑瘉 - const credentials = await getUploadCredentials() - - // 浣跨敤棰勭鍚峌RL - const uploadUrl = credentials.presignedUrl - - // 浣跨敤棰勭鍚峌RL涓婁紶鏂囦欢 - const uploadResponse = await axios.put(uploadUrl, file, { - headers: { - 'Content-Type': file.type, - } - }) - - if (uploadResponse.status === 200) { - // 杩斿洖鏂囦欢鐨勮闂甎RL锛堝幓鎺夋煡璇㈠弬鏁帮級 - const fileUrl = `https://${credentials.bucket}.cos.${credentials.region}.myqcloud.com/${credentials.key}` - return fileUrl - } else { - throw new Error(`涓婁紶澶辫触锛岀姸鎬佺爜: ${uploadResponse.status}`) - } - - } catch (error) { - throw error - } +import axios from 'axios' + +// GraphQL鏌ヨ鑾峰彇涓婁紶鍑瘉 +const GET_UPLOAD_CREDENTIALS = ` + query GetUploadCredentials { + getUploadCredentials { + bucket + region + key + presignedUrl + expiration + } + } +` + +// 浠庡悗绔疓raphQL鑾峰彇涓婁紶鍑瘉 +const getUploadCredentials = async () => { + try { + const response = await axios.post('http://localhost:8080/graphql', { + query: GET_UPLOAD_CREDENTIALS + }) + + if (response.data.errors) { + throw new Error(response.data.errors[0].message) + } + + return response.data.data.getUploadCredentials + } catch (error) { + console.error('鑾峰彇涓婁紶鍑瘉澶辫触:', error) + throw error + } +} + +/** + * 浣跨敤棰勭鍚峌RL涓婁紶鏂囦欢鍒拌吘璁簯COS + * @param file 瑕佷笂浼犵殑鏂囦欢 + * @returns Promise<string> 杩斿洖鏂囦欢鐨勮闂甎RL + */ +export const uploadToCOS = async (file: File): Promise<string> => { + try { + // 鑾峰彇涓婁紶鍑瘉 + const credentials = await getUploadCredentials() + + // 浣跨敤棰勭鍚峌RL + const uploadUrl = credentials.presignedUrl + + // 浣跨敤棰勭鍚峌RL涓婁紶鏂囦欢 + const uploadResponse = await axios.put(uploadUrl, file, { + headers: { + 'Content-Type': file.type, + } + }) + + if (uploadResponse.status === 200) { + // 杩斿洖鏂囦欢鐨勮闂甎RL锛堝幓鎺夋煡璇㈠弬鏁帮級 + const fileUrl = `https://${credentials.bucket}.cos.${credentials.region}.myqcloud.com/${credentials.key}` + return fileUrl + } else { + throw new Error(`涓婁紶澶辫触锛岀姸鎬佺爜: ${uploadResponse.status}`) + } + + } catch (error) { + throw error + } } \ No newline at end of file -- Gitblit v1.8.0