| | |
| | | error: '', |
| | | statusText: '', |
| | | genderText: '', |
| | | educationText: '' |
| | | educationText: '', |
| | | // 时间轴相关数据 |
| | | timeline: [], |
| | | timelineLoading: false, |
| | | timelineError: '', |
| | | showRatingDetail: false, |
| | | ratingDetail: null |
| | | }, |
| | | |
| | | onLoad(options) { |
| | |
| | | educationText: this.getEducationText(projectDetail.playerInfo?.education), |
| | | loading: false |
| | | }) |
| | | |
| | | // 加载时间轴数据 |
| | | this.loadProjectTimeline() |
| | | } else { |
| | | throw new Error('项目详情获取失败') |
| | | } |
| | |
| | | |
| | | // 从API获取项目详情 |
| | | async getProjectDetailFromAPI(projectId) { |
| | | // 构建GraphQL查询 |
| | | // 构建GraphQL查询 - 与后端schema匹配 |
| | | const query = ` |
| | | query GetProjectDetail($id: ID!) { |
| | | activityPlayerDetail(id: $id) { |
| | | id |
| | | activityId |
| | | playerId |
| | | playerName |
| | | playerGender |
| | | playerPhone |
| | | playerEducation |
| | | playerBirthDate |
| | | playerIdCard |
| | | playerAddress |
| | | activityName |
| | | projectName |
| | | projectDescription |
| | | projectCategory |
| | | projectTags |
| | | projectFiles { |
| | | id |
| | | fileName |
| | | fileUrl |
| | | fileSize |
| | | fileType |
| | | uploadTime |
| | | } |
| | | submitTime |
| | | reviewTime |
| | | reviewerId |
| | | reviewerName |
| | | score |
| | | rating { |
| | | id |
| | | judgeId |
| | | judgeName |
| | | score |
| | | feedback |
| | | ratingTime |
| | | } |
| | | state |
| | | description |
| | | feedback |
| | | state |
| | | stageId |
| | | playerInfo { |
| | | id |
| | | name |
| | | phone |
| | | gender |
| | | birthday |
| | | education |
| | | introduction |
| | | description |
| | | avatarUrl |
| | | avatar { |
| | | id |
| | | name |
| | | path |
| | | } |
| | | userInfo { |
| | | userId |
| | | name |
| | | phone |
| | | avatarUrl |
| | | avatar { |
| | | id |
| | | name |
| | | path |
| | | } |
| | | } |
| | | } |
| | | regionInfo { |
| | | id |
| | | name |
| | | fullPath |
| | | } |
| | | submissionFiles { |
| | | id |
| | | name |
| | | path |
| | | url |
| | | fullUrl |
| | | fullThumbUrl |
| | | fileExt |
| | | fileSize |
| | | thumbUrl |
| | | } |
| | | ratingForm { |
| | | schemeId |
| | | schemeName |
| | | totalMaxScore |
| | | items { |
| | | id |
| | | name |
| | | maxScore |
| | | weight |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ` |
| | |
| | | async getRatingStatsFromAPI(projectId) { |
| | | const query = ` |
| | | query GetRatingStats($activityPlayerId: ID!) { |
| | | ratingStats(activityPlayerId: $activityPlayerId) { |
| | | averageScore |
| | | totalRatings |
| | | scoreDistribution { |
| | | score |
| | | count |
| | | } |
| | | judgeRatingsForPlayer(activityPlayerId: $activityPlayerId) { |
| | | judgeId |
| | | judgeName |
| | | hasRated |
| | | totalScore |
| | | ratingTime |
| | | } |
| | | averageScoreForPlayer(activityPlayerId: $activityPlayerId) |
| | | } |
| | | ` |
| | | |
| | | try { |
| | | const result = await app.graphqlRequest(query, { activityPlayerId: projectId }) |
| | | return result.ratingStats |
| | | const ratings = result.judgeRatingsForPlayer || [] |
| | | const averageScore = result.averageScoreForPlayer || 0 |
| | | |
| | | // 只计算已评分的评委 |
| | | const ratedJudges = ratings.filter(rating => rating.hasRated) |
| | | |
| | | return { |
| | | averageScore: averageScore, |
| | | totalRatings: ratedJudges.length, |
| | | ratings: ratings |
| | | } |
| | | } catch (error) { |
| | | throw error |
| | | } |
| | |
| | | } catch (error) { |
| | | throw error |
| | | } |
| | | }, |
| | | |
| | | // 加载项目时间轴 |
| | | async loadProjectTimeline() { |
| | | try { |
| | | this.setData({ |
| | | timelineLoading: true, |
| | | timelineError: '' |
| | | }) |
| | | |
| | | const timeline = await this.getProjectTimelineFromAPI(this.data.projectId) |
| | | |
| | | if (timeline && timeline.stages) { |
| | | // 处理时间轴数据 |
| | | const processedTimeline = timeline.stages.map(stage => { |
| | | return { |
| | | stageId: stage.stageId, |
| | | stageName: stage.stageName, |
| | | matchTime: stage.matchTime, |
| | | matchTimeText: stage.matchTime ? this.formatDateTime(stage.matchTime) : '时间待定', |
| | | participated: stage.participated, |
| | | activityPlayerId: stage.activityPlayerId, |
| | | averageScore: stage.averageScore, |
| | | ratingCount: stage.ratingCount, |
| | | hasRating: stage.hasRating, |
| | | scoreText: stage.averageScore ? `${stage.averageScore.toFixed(1)}分` : '', |
| | | isClickable: stage.hasRating && stage.activityPlayerId |
| | | } |
| | | }) |
| | | |
| | | this.setData({ |
| | | timeline: processedTimeline, |
| | | timelineLoading: false |
| | | }) |
| | | } else { |
| | | this.setData({ |
| | | timeline: [], |
| | | timelineLoading: false |
| | | }) |
| | | } |
| | | } catch (error) { |
| | | console.error('加载时间轴失败:', error) |
| | | this.setData({ |
| | | timelineError: error.message || '时间轴加载失败', |
| | | timelineLoading: false |
| | | }) |
| | | } |
| | | }, |
| | | |
| | | // 从API获取项目时间轴 |
| | | async getProjectTimelineFromAPI(activityPlayerId) { |
| | | const query = ` |
| | | query GetProjectTimeline($activityPlayerId: ID!) { |
| | | projectStageTimeline(activityPlayerId: $activityPlayerId) { |
| | | activityId |
| | | activityName |
| | | stages { |
| | | stageId |
| | | stageName |
| | | matchTime |
| | | sortOrder |
| | | participated |
| | | activityPlayerId |
| | | averageScore |
| | | ratingCount |
| | | hasRating |
| | | latestRatingTime |
| | | } |
| | | } |
| | | } |
| | | ` |
| | | |
| | | try { |
| | | const result = await app.graphqlRequest(query, { activityPlayerId }) |
| | | return result.projectStageTimeline |
| | | } catch (error) { |
| | | throw error |
| | | } |
| | | }, |
| | | |
| | | // 打开阶段详情 |
| | | openStageDetail(e) { |
| | | const { playerId, clickable, participated } = e.currentTarget.dataset |
| | | |
| | | if (!clickable || !participated || !playerId) { |
| | | wx.showToast({ |
| | | title: '暂无评分详情', |
| | | icon: 'none' |
| | | }) |
| | | return |
| | | } |
| | | |
| | | // 跳转到评分详情页面或显示详情弹窗 |
| | | wx.navigateTo({ |
| | | url: `/pages/review/stage-detail?playerId=${playerId}` |
| | | }) |
| | | }, |
| | | |
| | | // 关闭阶段详情 |
| | | closeStageDetail() { |
| | | this.setData({ |
| | | showRatingDetail: false, |
| | | ratingDetail: null |
| | | }) |
| | | }, |
| | | |
| | | // 预览文件 |
| | |
| | | // 获取性别文本 |
| | | getGenderText(gender) { |
| | | const genderMap = { |
| | | 1: '男', |
| | | 2: '女', |
| | | 'MALE': '男', |
| | | 'FEMALE': '女' |
| | | } |
| | |
| | | 'COLLEGE': '大专', |
| | | 'BACHELOR': '本科', |
| | | 'MASTER': '硕士', |
| | | 'DOCTOR': '博士' |
| | | 'DOCTOR': '博士', |
| | | '高中及以下': '高中及以下', |
| | | '大专': '大专', |
| | | '本科': '本科', |
| | | '硕士': '硕士', |
| | | '博士': '博士' |
| | | } |
| | | return educationMap[education] || '' |
| | | return educationMap[education] || education || '' |
| | | }, |
| | | |
| | | // 分享功能 |