Codex Assistant
14 小时以前 915d80766dd8e0157e9b9510b3634ed758eb5c5a
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'
    })
  },
  // 查看报名详情