| | |
| | | isJudge: false, |
| | | isOrganizer: false, |
| | | hasPlayer: false, |
| | | isEmployee: false, |
| | | |
| | | // 员工审核统计 |
| | | employeeReviewStats: { |
| | | pendingCount: 0, |
| | | approvedCount: 0, |
| | | rejectedCount: 0 |
| | | }, |
| | | |
| | | // 评委相关数据 |
| | | judgeStats: { |
| | |
| | | grade |
| | | roles |
| | | createdAt |
| | | employee { |
| | | id |
| | | name |
| | | roleId |
| | | description |
| | | } |
| | | player { |
| | | id |
| | | name |
| | |
| | | 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) |
| | |
| | | userRoles, |
| | | isJudge, |
| | | isOrganizer, |
| | | hasPlayer |
| | | hasPlayer, |
| | | isEmployee |
| | | }) |
| | | |
| | | // 更新全局用户信息 |
| | |
| | | |
| | | if (isOrganizer) { |
| | | this.loadOrganizerStats() |
| | | } |
| | | |
| | | if (isEmployee) { |
| | | this.loadEmployeeReviewStats() |
| | | } else { |
| | | this.setData({ |
| | | employeeReviewStats: { |
| | | pendingCount: 0, |
| | | approvedCount: 0, |
| | | rejectedCount: 0 |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } catch (error) { |
| | |
| | | } |
| | | }, |
| | | |
| | | // 加载员工审核统计 |
| | | 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 { |
| | |
| | | }) |
| | | }, |
| | | |
| | | // 跳转到员工审核页面 |
| | | goToEmployeeReviewPage() { |
| | | if (!this.data.isEmployee) { |
| | | return |
| | | } |
| | | |
| | | wx.navigateTo({ |
| | | url: '/pages/profile/employee-review' |
| | | }) |
| | | }, |
| | | |
| | | |
| | | |
| | | // 查看报名详情 |