From 58d9f460b2f8c34430285115e2557d18333c5cab Mon Sep 17 00:00:00 2001 From: Codex Assistant <codex@example.com> Date: 星期三, 08 十月 2025 14:16:55 +0800 Subject: [PATCH] feat: 修复Player实体phone字段数据冗余问题并优化小程序报名逻辑 --- wx/pages/profile/profile.js | 76 +++++++++++++++++++++++++++++++++++++ 1 files changed, 75 insertions(+), 1 deletions(-) diff --git a/wx/pages/profile/profile.js b/wx/pages/profile/profile.js index 15cedc9..a1123db 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: { @@ -197,7 +205,15 @@ major grade roles + gender + birthday createdAt + employee { + id + name + roleId + description + } player { id name @@ -218,6 +234,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 +245,8 @@ userRoles, isJudge, isOrganizer, - hasPlayer + hasPlayer, + isEmployee }) // 鏇存柊鍏ㄥ眬鐢ㄦ埛淇℃伅 @@ -241,6 +259,18 @@ if (isOrganizer) { this.loadOrganizerStats() + } + + if (isEmployee) { + this.loadEmployeeReviewStats() + } else { + this.setData({ + employeeReviewStats: { + pendingCount: 0, + approvedCount: 0, + rejectedCount: 0 + } + }) } } } catch (error) { @@ -358,6 +388,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 +528,17 @@ }) }, + // 璺宠浆鍒板憳宸ュ鏍搁〉闈� + goToEmployeeReviewPage() { + if (!this.data.isEmployee) { + return + } + + wx.navigateTo({ + url: '/pages/profile/employee-review' + }) + }, + // 鏌ョ湅鎶ュ悕璇︽儏 -- Gitblit v1.8.0