lrj
6 小时以前 ae3349d2ff53767b5bc9cb30e1bf7e15f9e814ee
web/src/views/review-detail.vue
@@ -225,48 +225,64 @@
      return false
    }
    
    // 检查是否有employee身份
    if (userInfo.employee) {
      isEmployee.value = true
    // 设置员工身份标识
    isEmployee.value = !!userInfo.employee
    // 优先检查评委身份和权限(即使用户同时有员工身份)
    const judgeInfo = await userApi.getCurrentJudgeInfo()
    if (judgeInfo) {
      currentJudge.value = judgeInfo
      hasJudgePermission.value = true
      // 检查是否在当前比赛阶段的评委列表中
      if (projectDetail.value && projectDetail.value.stageId) {
        const isInActivity = await userApi.checkJudgeInActivity(
          projectDetail.value.stageId,
          judgeInfo.judgeId
        )
        if (isInActivity) {
          isJudgeInActivity.value = true
          canModifyRating.value = true // 有评委权限,可以修改评分
          permissionChecked.value = true
          if (isEmployee.value) {
            ElMessage.success('您同时拥有员工和评委身份,当前以评委身份进行评审')
          }
          return true
        } else {
          isJudgeInActivity.value = false
          // 如果没有当前比赛的评委权限,但有员工身份,则以员工身份查看
          if (isEmployee.value) {
            canModifyRating.value = false
            permissionChecked.value = true
            ElMessage.info('您没有当前比赛的评委权限,以员工身份查看评审详情')
            return true
          } else {
            ElMessage.error('您不是当前比赛的评委,无法进行评审')
            router.push('/project-review')
            return false
          }
        }
      }
    }
    // 如果没有评委身份,但有员工身份,则以员工身份查看
    if (isEmployee.value) {
      hasJudgePermission.value = false
      canModifyRating.value = false // employee只能查看,不能修改
      permissionChecked.value = true
      ElMessage.info('您以员工身份查看评审详情,只能查看不能修改评分')
      return true
    }
    
    // 如果没有employee身份,检查judge身份和权限
    const judgeInfo = await userApi.getCurrentJudgeInfo()
    // 既没有评委身份也没有员工身份
    hasJudgePermission.value = false
    ElMessage.error('您没有评委权限,无法进行评审')
    router.push('/project-review')
    return false
    
    if (!judgeInfo) {
      hasJudgePermission.value = false
      ElMessage.error('您没有评委权限,无法进行评审')
      router.push('/project-review')
      return false
    }
    currentJudge.value = judgeInfo
    hasJudgePermission.value = true
    // 检查是否在当前比赛阶段的评委列表中
    if (projectDetail.value && projectDetail.value.stageId) {
      const isInActivity = await userApi.checkJudgeInActivity(
        projectDetail.value.stageId,
        judgeInfo.judgeId
      )
      if (!isInActivity) {
        isJudgeInActivity.value = false
        ElMessage.error('您不是当前比赛的评委,无法进行评审')
        router.push('/project-review')
        return false
      }
      isJudgeInActivity.value = true
      canModifyRating.value = true // judge有权限修改评分
    }
    permissionChecked.value = true
    return true
  } catch (error) {
    console.error('权限验证失败:', error)
    hasJudgePermission.value = false
@@ -278,8 +294,8 @@
// 加载当前评委已有的评审数据
const loadExistingRating = async () => {
  // employee用户不需要加载评委的评分数据
  if (isEmployee.value || !hasJudgePermission.value) return
  // 只有具有评委权限且可以修改评分的用户才需要加载评委的评分数据
  if (!hasJudgePermission.value || !canModifyRating.value) return
  
  try {
    const rating = await getCurrentJudgeRating(parseInt(projectId.value))