From 915d80766dd8e0157e9b9510b3634ed758eb5c5a Mon Sep 17 00:00:00 2001 From: Codex Assistant <codex@example.com> Date: 星期日, 05 十月 2025 14:45:58 +0800 Subject: [PATCH] feat: 新增员工审核入口与审核页面 --- wx/pages/profile/profile.js | 74 ++++++++++++++++++++++++++++++++++++ 1 files changed, 73 insertions(+), 1 deletions(-) diff --git a/wx/pages/profile/profile.js b/wx/pages/profile/profile.js index 15cedc9..99de718 100644 --- a/wx/pages/profile/profile.js +++ b/wx/pages/profile/profile.js @@ -27,6 +27,14 @@ isJudge: false, isOrganizer: false, hasPlayer: false, + isEmployee: false, + + // 鍛樺伐瀹℃牳缁熻 + employeeReviewStats: { + pendingCount: 0, + approvedCount: 0, + rejectedCount: 0 + }, // 璇勫鐩稿叧鏁版嵁 judgeStats: { @@ -198,6 +206,12 @@ grade roles createdAt + employee { + id + name + roleId + description + } player { id name @@ -218,6 +232,7 @@ const isJudge = userRoles.includes('JUDGE') const isOrganizer = userRoles.includes('ORGANIZER') const hasPlayer = userInfo.player && userInfo.player.id + const isEmployee = !!(userInfo.employee && userInfo.employee.id) // 澶勭悊澶村儚鏂囧瓧 const avatarText = (userInfo.name || '鐢ㄦ埛').substring(0, 1) @@ -228,7 +243,8 @@ userRoles, isJudge, isOrganizer, - hasPlayer + hasPlayer, + isEmployee }) // 鏇存柊鍏ㄥ眬鐢ㄦ埛淇℃伅 @@ -241,6 +257,18 @@ if (isOrganizer) { this.loadOrganizerStats() + } + + if (isEmployee) { + this.loadEmployeeReviewStats() + } else { + this.setData({ + employeeReviewStats: { + pendingCount: 0, + approvedCount: 0, + rejectedCount: 0 + } + }) } } } catch (error) { @@ -358,6 +386,39 @@ } }, + // 鍔犺浇鍛樺伐瀹℃牳缁熻 + async loadEmployeeReviewStats(keyword = null) { + if (!this.data.isEmployee) { + return + } + + try { + const query = ` + query EmployeeReviewStats($keyword: String) { + employeeReviewStats(keyword: $keyword) { + pendingCount + approvedCount + rejectedCount + } + } + ` + + const variables = {} + if (keyword && typeof keyword === 'string' && keyword.trim()) { + variables.keyword = keyword.trim() + } + + const result = await graphqlRequest(query, variables) + + if (result && result.employeeReviewStats) { + this.setData({ + employeeReviewStats: result.employeeReviewStats + }) + } + } catch (error) { + console.error('鍔犺浇鍛樺伐瀹℃牳缁熻澶辫触:', error) + } + }, // 鍔犺浇璇勫缁熻鏁版嵁 async loadJudgeStats() { try { @@ -465,6 +526,17 @@ }) }, + // 璺宠浆鍒板憳宸ュ鏍搁〉闈� + goToEmployeeReviewPage() { + if (!this.data.isEmployee) { + return + } + + wx.navigateTo({ + url: '/pages/profile/employee-review' + }) + }, + // 鏌ョ湅鎶ュ悕璇︽儏 -- Gitblit v1.8.0