From 356a9f7a6e789ff152b80f917233b8736dfb0d7f Mon Sep 17 00:00:00 2001
From: peng <peng.com>
Date: 星期五, 07 十一月 2025 11:17:10 +0800
Subject: [PATCH] 页面显示字段调整
---
wx/pages/project/detail.js | 246 ++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 200 insertions(+), 46 deletions(-)
diff --git a/wx/pages/project/detail.js b/wx/pages/project/detail.js
index 9e95a97..779d642 100644
--- a/wx/pages/project/detail.js
+++ b/wx/pages/project/detail.js
@@ -10,7 +10,13 @@
error: '',
statusText: '',
genderText: '',
- educationText: ''
+ educationText: '',
+ // 鏃堕棿杞寸浉鍏虫暟鎹�
+ timeline: [],
+ timelineLoading: false,
+ timelineError: '',
+ showRatingDetail: false,
+ ratingDetail: null
},
onLoad(options) {
@@ -66,6 +72,9 @@
educationText: this.getEducationText(projectDetail.playerInfo?.education),
loading: false
})
+
+ // 鍔犺浇鏃堕棿杞存暟鎹�
+ this.loadProjectTimeline()
} else {
throw new Error('椤圭洰璇︽儏鑾峰彇澶辫触')
}
@@ -80,47 +89,71 @@
// 浠嶢PI鑾峰彇椤圭洰璇︽儏
async getProjectDetailFromAPI(projectId) {
- // 鏋勫缓GraphQL鏌ヨ
+ // 鏋勫缓GraphQL鏌ヨ - 涓庡悗绔痵chema鍖归厤
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
+ }
+ }
}
}
`
@@ -137,20 +170,30 @@
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
}
@@ -172,6 +215,110 @@
} 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
+ })
+ }
+ },
+
+ // 浠嶢PI鑾峰彇椤圭洰鏃堕棿杞�
+ 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
+ })
},
// 棰勮鏂囦欢
@@ -430,6 +577,8 @@
// 鑾峰彇鎬у埆鏂囨湰
getGenderText(gender) {
const genderMap = {
+ 1: '鐢�',
+ 2: '濂�',
'MALE': '鐢�',
'FEMALE': '濂�'
}
@@ -443,9 +592,14 @@
'COLLEGE': '澶т笓',
'BACHELOR': '鏈',
'MASTER': '纭曞+',
- 'DOCTOR': '鍗氬+'
+ 'DOCTOR': '鍗氬+',
+ '楂樹腑鍙婁互涓�': '楂樹腑鍙婁互涓�',
+ '澶т笓': '澶т笓',
+ '鏈': '鏈',
+ '纭曞+': '纭曞+',
+ '鍗氬+': '鍗氬+'
}
- return educationMap[education] || ''
+ return educationMap[education] || education || ''
},
// 鍒嗕韩鍔熻兘
--
Gitblit v1.8.0