From db97703c92a874fad938d58c5a4c2a467fdde0d3 Mon Sep 17 00:00:00 2001
From: yujialong <479214531@qq.com>
Date: Tue, 7 Feb 2023 15:50:09 +0800
Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=AE=A1=E7=90=86=E6=B7=BB?=
=?UTF-8?q?=E5=8A=A0=E5=A4=87=E6=B3=A8=E5=AD=97=E6=AE=B5=EF=BC=8C=E8=B5=9B?=
=?UTF-8?q?=E4=BA=8B=E4=BF=AE=E5=A4=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/utils/api.js | 1 +
src/views/course/AddCurriculum.vue | 3 +-
src/views/match/add/set.vue | 7 +-
src/views/match/add/step1.vue | 9 +-
src/views/match/add/step3.vue | 5 +
src/views/match/manage/matchRank.vue | 143 +++++++++++++++++++--------
src/views/match/preview/index.vue | 6 +-
src/views/serve/projectAdd.vue | 4 +
8 files changed, 131 insertions(+), 47 deletions(-)
diff --git a/src/utils/api.js b/src/utils/api.js
index fc49dfd..0e8274d 100644
--- a/src/utils/api.js
+++ b/src/utils/api.js
@@ -382,6 +382,7 @@ export default {
manuallyRankTheUploadList: `${host1}competition/competition/rank/manuallyRankTheUploadList`,
queryPublicationSource: `${host1}competition/competition/rank/queryPublicationSource`,
releaseVerification: `${host1}competition/competition/rank/releaseVerification`,
+ totalRankingScoreDetails: `${host1}competition/competition/rank/totalRankingScoreDetails`,
gradeImport: `http://121.37.12.51/template/赛事成绩导入模板.xlsx`,
rankImportTeam: `http://121.37.12.51/template/赛事排名导入模板(团队赛).xlsx`,
rankImportPerson: `http://121.37.12.51/template/赛事排名导入模板(个人赛).xlsx`,
diff --git a/src/views/course/AddCurriculum.vue b/src/views/course/AddCurriculum.vue
index 9aabc35..faa95f8 100644
--- a/src/views/course/AddCurriculum.vue
+++ b/src/views/course/AddCurriculum.vue
@@ -354,7 +354,7 @@
checkAllChange(val, projects[0].systemId)">
-
- projectChange(val, item)">
+ projectChange(val, item)">
@@ -377,6 +377,7 @@
{{ scope.row.type ? '流程类' : '编程类' }}
+
diff --git a/src/views/match/add/set.vue b/src/views/match/add/set.vue
index e66f997..d72dce3 100644
--- a/src/views/match/add/set.vue
+++ b/src/views/match/add/set.vue
@@ -211,12 +211,13 @@ export default {
save() {
const { form } = this
if (!form.time.length) return util.warningMsg('请选择比赛时间')
- if (this.timeInvalid) return util.warningMsg('设置的阶段比赛时间必须要在第一步设置的竞赛时间范围内,请重新设置。')
+ const { playStartTime, playEndTime } = this.step1
+ if (new Date(form.time[0]) < new Date(playStartTime) || new Date(form.time[1]) > new Date(playEndTime)) return util.warningMsg('设置的阶段比赛时间必须要在第一步设置的竞赛时间范围内,请重新设置。')
if (!form.cid) return util.warningMsg('请选择课程')
if (!form.projectId) return util.warningMsg('请选择项目')
const { systemId, projectName } = this.projects.find(e => e.projectId == form.projectId)
- form.systemId = systemId
- form.projectName = projectName
+ if (systemId) form.systemId = systemId
+ if (projectName) form.projectName = projectName
form.startTime = form.time[0]
form.endTime = form.time[1]
this.$emit('hideSet', this.form)
diff --git a/src/views/match/add/step1.vue b/src/views/match/add/step1.vue
index 4910571..262e72c 100644
--- a/src/views/match/add/step1.vue
+++ b/src/views/match/add/step1.vue
@@ -138,7 +138,7 @@
-
+
{
+ this.quillShow = true
+ })
+ },
// 监听信息是否有更改,有的话页面离开的时候要询问是否要保存
form: {
handler(){
diff --git a/src/views/match/add/step3.vue b/src/views/match/add/step3.vue
index fd94b8c..5babcf3 100644
--- a/src/views/match/add/step3.vue
+++ b/src/views/match/add/step3.vue
@@ -247,6 +247,11 @@ export default {
util.errorMsg('请输入线下地点')
break
}
+ if (!e.onlineAddress && !e.offlineAddress) {
+ invalid = 1
+ util.errorMsg('请输入比赛地点')
+ break
+ }
}
}
if (invalid) return
diff --git a/src/views/match/manage/matchRank.vue b/src/views/match/manage/matchRank.vue
index cac9ac4..d87f19b 100644
--- a/src/views/match/manage/matchRank.vue
+++ b/src/views/match/manage/matchRank.vue
@@ -73,7 +73,12 @@
{{ item.stageName }} |
- {{ item.teamScore }} |
+
+ {{ item.teamScore }}
+ {{ item.teamCalculationMethodName }}
+ 权重:
+ {{ item.pointWeight }}%
+ |
{{ i + 1 }} |
{{ item.userName }} |
@@ -90,7 +95,7 @@
综合得分 |
- {{ totalScore }} |
+ {{ curRow.score }} |
总排名:第{{ curRow.index }}名 |
@@ -149,6 +154,20 @@ export default {
method: this.$route.query.method,
competitionType: +this.$route.query.competitionType,
rule: +this.$route.query.rule,
+ teamCalculationMethods: [
+ {
+ id: 0,
+ name: '最高分'
+ },
+ {
+ id: 1,
+ name: '平均分'
+ },
+ {
+ id: 2,
+ name: '求和'
+ }
+ ],
headers: {
token: sessionStorage.getItem("token")
},
@@ -279,46 +298,82 @@ export default {
}).catch(res => {})
} else {
const ids = this.grades.map(e => e.stageId)
- data.stageIds = ids.splice(0, ids.length - 1)
- this.$post(this.api.detailsOfTotalTeamScores, data).then(({ data, resultCalculationMethod }) => {
- const result = []
- let totalScore = 0
- // 合并数据
- data.map(e => {
- const team = e.stageTeamInformation
- if (team.length) {
- // 第一条才赋值团队得分和合并行数
- const method = e.teamCalculationMethod
- const scores = team.map(n => +n.score)
- let score
- // 根据团队规则计算方式计算团队得分
- if (method == 0) { // 最高分
- score = Math.max(scores)
- } else if (method == 1) { // 平均分
- score = scores.reduce((prev, next) => prev + next) / scores.length
- } else { // 求和
- score = scores.reduce((prev, next) => prev + next)
- }
- team[0].teamScore = score
- team[0].rowspan = team.length
- team.map(n => {
- n = Object.assign(n, e)
+ ids.pop()
+ data.stageIds = ids.splice(0, this.index + 1)
+ // 发布跟没发布调不同的接口
+ // if (this.published) {
+ this.$post(this.api.totalRankingScoreDetails, data).then(({ data }) => {
+ if (data.length && data[0].stageTeamInformation.length) {
+ const resultCalculationMethod = data[0].stageTeamInformation[0].resultCalculationMethod
+ const result = []
+ let totalScore = 0
+ // 合并数据
+ data.map(e => {
+ const team = e.stageTeamInformation
+ if (team.length) {
+ // 第一条才赋值团队得分和合并行数
+ const method = e.teamCalculationMethod
+ const scores = team.map(n => +n.score)
+ let score
+ // 根据团队规则计算方式计算团队得分
+ if (method == 0) { // 最高分
+ score = Math.max(scores)
+ } else if (method == 1) { // 平均分
+ score = scores.reduce((prev, next) => prev + next) / scores.length
+ } else { // 求和
+ score = scores.reduce((prev, next) => prev + next)
+ }
+ team[0].teamScore = score
+ const teamCItem = this.teamCalculationMethods.find(n => n.id == e.teamCalculationMethod)
+ if (teamCItem) team[0].teamCalculationMethodName = teamCItem.name
+ team[0].rowspan = team.length
+ team.map(n => {
+ n = Object.assign(n, e)
+ })
+ console.log("🚀 ~ file: matchRank.vue:334 ~ this.$post ~ resultCalculationMethod", resultCalculationMethod, score)
+
+ // 计算权重(权重为0则不计入总成绩) 团队得分*权重/100 总成绩计算方式选的是加权求和才需要计算
+ if (e.pointWeight && !resultCalculationMethod) totalScore += score * e.pointWeight / 100
+ result.push(...team)
+ }
})
- // 计算权重(权重为0则不计入总成绩) 团队得分*权重/100 总成绩计算方式选的是加权求和才需要计算
- if (e.pointWeight && !resultCalculationMethod) totalScore += score * e.pointWeight / 100
- result.push(...team)
+ // 根据总成绩计算方式计算总分
+ const teamScores = data.map(e => e.teamScore)
+ console.log("🚀 ~ file: matchRank.vue:339 ~ this.$post ~ teamScores", teamScores, totalScore)
+ if (resultCalculationMethod === 1) { // 求和
+ totalScore = teamScores.reduce((prev, next) => prev + next)
+ } else if (resultCalculationMethod === 2) { // 平均分
+ totalScore = teamScores.reduce((prev, next) => prev + next) / teamScores.length
+ }
+ this.totalScore = totalScore
+ this.teams = result
}
- })
- // 根据总成绩计算方式计算总分
- const teamScores = data.map(e => e.teamScore)
- if (resultCalculationMethod === 1) { // 求和
- totalScore = teamScores.reduce((prev, next) => prev + next)
- } else if (resultCalculationMethod === 2) { // 平均分
- totalScore = teamScores.reduce((prev, next) => prev + next) / teamScores.length
- }
- this.totalScore = totalScore
- this.teams = result
- }).catch(res => {})
+ }).catch(res => {})
+ // } else { // 没发布
+ // this.$post(this.api.totalRankingScoreDetails, data).then(({ page }) => {
+ // const list = page.records
+ // page.records.map((e, i) => {
+ // if (!list.find(n => n.stageId == e.stageId && n.rowspan)) {
+ // e.rowspan = list.filter(n => n.stageId == e.stageId).length
+ // this.$post(this.api.stageTeamScoreDetails, {
+ // pageNum: 1,
+ // pageSize: 100,
+ // competitionId: this.id,
+ // teamId: row.teamId,
+ // stageId: e.stageId
+ // }).then(({ page }) => {
+
+ // }).catch(res => {})
+ // }
+ // })
+ // let totalScore = 0
+ // this.totalScore = totalScore
+ // this.teams = list
+ // console.log("🚀 ~ file: matchRank.vue:346 ~ this.$post ~ list", list)
+
+ // }).catch(res => {})
+ // }
+
}
} else {
this.toReport(row)
@@ -477,5 +532,13 @@ export default {
text-align: center;
background-color: #f8faff;
}
+ .scores {
+ line-height: 1.6;
+ }
+ .score {
+ font-size: 16px;
+ font-weight: 600;
+ color: #9076FF;
+ }
}
\ No newline at end of file
diff --git a/src/views/match/preview/index.vue b/src/views/match/preview/index.vue
index d3b6191..566954a 100644
--- a/src/views/match/preview/index.vue
+++ b/src/views/match/preview/index.vue
@@ -35,8 +35,9 @@
-
- 赛程、规则与内容
+
+
+ 赛程、规则与内容
共{{ form.competitionStage.length }}个竞赛阶段,同一个团队每个成员只能参加一个阶段赛项
{{ rule.stageName }}
@@ -65,6 +66,7 @@
+
竞赛进展
diff --git a/src/views/serve/projectAdd.vue b/src/views/serve/projectAdd.vue
index 7daca91..1fb8a5f 100644
--- a/src/views/serve/projectAdd.vue
+++ b/src/views/serve/projectAdd.vue
@@ -27,6 +27,9 @@
+
+
+
@@ -236,6 +239,7 @@ export default {
projectManage: {
founder: 0, // 创建人角色(0、系统 1、老师)
projectName: "", // 项目名称
+ remark: '',
permissions: 0, // 项目权限(0、练习 1、考核 2、竞赛)
systemId: this.$route.query.systemId, // 系统id
hintOpen: 1, // 实验提示是否开启(0开启 1不开启 默认1)