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/employee.ts |  100 +++++++++----------------------------------------
 1 files changed, 19 insertions(+), 81 deletions(-)

diff --git a/web/src/api/employee.ts b/web/src/api/employee.ts
index dd55bc7..6cb318e 100644
--- a/web/src/api/employee.ts
+++ b/web/src/api/employee.ts
@@ -1,5 +1,7 @@
 // 鍛樺伐绠$悊API
 
+import { API_CONFIG, graphqlRequest } from '@/config/api'
+
 // 鍛樺伐鐩稿叧鐨� GraphQL 鏌ヨ鍜屽彉鏇�
 export const EMPLOYEE_QUERIES = {
   // 鑾峰彇鎵�鏈夊憳宸�
@@ -17,7 +19,7 @@
     }
   `,
   
-  // 鏍规嵁濮撳悕鎼滅储鍛樺伐
+  // 鎼滅储鍛樺伐
   SEARCH_EMPLOYEES: `
     query SearchEmployees($name: String) {
       employeesByName(name: $name) {
@@ -94,92 +96,41 @@
 
 // API 鍑芥暟
 export const employeeApi = {
-  // 鑾峰彇鎵�鏈夊憳宸�
+  // 鑾峰彇鍛樺伐鍒楄〃
   async getEmployees(): Promise<Employee[]> {
     try {
-      const response = await fetch('http://localhost:8080/api/graphql', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          query: EMPLOYEE_QUERIES.GET_EMPLOYEES
-        })
-      })
-      const result = await response.json()
-      if (result.errors) {
-        throw new Error(result.errors[0].message)
-      }
-      return result.data?.employees || []
+      const result = await graphqlRequest(EMPLOYEE_QUERIES.GET_EMPLOYEES)
+      return result?.data?.employees || []
     } catch (error: any) {
       throw new Error(error.message || '鑾峰彇鍛樺伐鍒楄〃澶辫触')
     }
   },
 
-  // 鏍规嵁鍚嶇О鎼滅储鍛樺伐
-  async searchEmployees(name?: string): Promise<Employee[]> {
+  // 鎼滅储鍛樺伐
+  async searchEmployees(name: string): Promise<Employee[]> {
     try {
-      const response = await fetch('http://localhost:8080/api/graphql', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          query: EMPLOYEE_QUERIES.SEARCH_EMPLOYEES,
-          variables: { name }
-        })
-      })
-      const result = await response.json()
-      if (result.errors) {
-        throw new Error(result.errors[0].message)
-      }
-      return result.data?.employeesByName || []
+      const result = await graphqlRequest(EMPLOYEE_QUERIES.SEARCH_EMPLOYEES, { name })
+      return result?.data?.employeesByName || []
     } catch (error: any) {
       throw new Error(error.message || '鎼滅储鍛樺伐澶辫触')
     }
   },
 
-  // 鑾峰彇鍛樺伐璇︽儏
+  // 鏍规嵁ID鑾峰彇鍛樺伐璇︽儏
   async getEmployee(id: string): Promise<Employee | null> {
     try {
-      const response = await fetch('http://localhost:8080/api/graphql', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          query: EMPLOYEE_QUERIES.GET_EMPLOYEE,
-          variables: { id }
-        })
-      })
-      const result = await response.json()
-      if (result.errors) {
-        throw new Error(result.errors[0].message)
-      }
-      return result.data?.employee || null
+      const result = await graphqlRequest(EMPLOYEE_QUERIES.GET_EMPLOYEE, { id })
+      return result?.data?.employee || null
     } catch (error: any) {
       throw new Error(error.message || '鑾峰彇鍛樺伐璇︽儏澶辫触')
     }
   },
 
-  // 淇濆瓨鍛樺伐
-  async saveEmployee(input: EmployeeInput): Promise<Employee> {
+  // 淇濆瓨鍛樺伐锛堟柊澧炴垨鏇存柊锛�
+  async saveEmployee(employee: EmployeeInput): Promise<Employee> {
     try {
-      const response = await fetch('http://localhost:8080/api/graphql', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          query: EMPLOYEE_MUTATIONS.SAVE_EMPLOYEE,
-          variables: { input }
-        })
-      })
-      const result = await response.json()
-      if (result.errors) {
-        throw new Error(result.errors[0].message)
-      }
-      return result.data?.saveEmployee
+      const result = await graphqlRequest(EMPLOYEE_MUTATIONS.SAVE_EMPLOYEE, { input: employee })
+      return result?.data?.saveEmployee
     } catch (error: any) {
       throw new Error(error.message || '淇濆瓨鍛樺伐澶辫触')
     }
@@ -188,21 +139,8 @@
   // 鍒犻櫎鍛樺伐
   async deleteEmployee(id: string): Promise<boolean> {
     try {
-      const response = await fetch('http://localhost:8080/api/graphql', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          query: EMPLOYEE_MUTATIONS.DELETE_EMPLOYEE,
-          variables: { id }
-        })
-      })
-      const result = await response.json()
-      if (result.errors) {
-        throw new Error(result.errors[0].message)
-      }
-      return result.data?.deleteEmployee || false
+      const result = await graphqlRequest(EMPLOYEE_MUTATIONS.DELETE_EMPLOYEE, { id })
+      return result?.data?.deleteEmployee || false
     } catch (error: any) {
       throw new Error(error.message || '鍒犻櫎鍛樺伐澶辫触')
     }

--
Gitblit v1.8.0