From cdf6d1de360d65fdc435195e1f75017ac6b51c94 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Wed, 15 Nov 2023 20:11:32 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/index.js | 2 + src/libs/util.js | 8 +- src/pages/assessment/list/index.vue | 2 +- src/pages/course/contentSettings/index.vue | 1745 +++++++++++--------- src/pages/match/add/step3.vue | 100 ++ src/pages/match/manage/matchArch.vue | 9 +- src/pages/match/manage/matchArchList.vue | 822 +++++---- src/pages/project/add/index.vue | 2 +- src/pages/station/list/index.vue | 4 +- src/setting.js | 2 +- 10 files changed, 1580 insertions(+), 1116 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index a12652d..fff3fa3 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -251,6 +251,8 @@ export default { cancelCompetitionStageRankingTime: `competition/competitionReleaseTime/cancelCompetitionStageRankingTime`, getCompetitionStageRankingTime: `competition/competitionReleaseTime/getCompetitionStageRankingTime`, frontOfficeCompetitionRanking: `competition/competition/rank/frontOfficeCompetitionRanking`, + cCompetitionStageFileList: `competition/cCompetitionStageFile/listByEntity`, + derive: `${host}competition/cCompetitionStageFile/deriveAll`, gradeImport: `https://www.occupationlab.com/template/赛事成绩导入模板.xlsx`, rankImportTeam: `https://www.occupationlab.com/template/赛事排名导入模板(团队赛).xlsx`, rankImportPerson: `https://www.occupationlab.com/template/赛事排名导入模板(个人赛).xlsx`, diff --git a/src/libs/util.js b/src/libs/util.js index 20412b1..05cbc69 100644 --- a/src/libs/util.js +++ b/src/libs/util.js @@ -12,7 +12,8 @@ const exts = { video: 'mp4,3gp,mov,m4v,avi,dat,mkv,flv,vob,rmvb,rm,qlv', audio: 'mp3,aac,ape,flac,wav,wma,amr,mid', img: 'jpg,jpeg,png,gif,svg,psd', - doc: 'doc,docx,txt,xls,xlsx,csv,xml,ppt,pptx' + doc: 'doc,docx,txt,xls,xlsx,csv,xml,ppt,pptx', + compress: 'zip,rar,7z,tar,gz,bz2', } const util = { cookies, @@ -91,6 +92,11 @@ const util = { if (exts.doc.includes(ext)) return true; return false; }, + // 传入文件后缀判断是否是压缩包 + isCompress(ext) { + if (exts.compress.includes(ext)) return true; + return false; + }, // 判断是否能够预览 canPreview(ext) { if (!util.isVideo(ext) && !util.isAudio(ext) && !util.isImg(ext) && !util.isDoc(ext)) return false diff --git a/src/pages/assessment/list/index.vue b/src/pages/assessment/list/index.vue index c81e99d..b741e1b 100644 --- a/src/pages/assessment/list/index.vue +++ b/src/pages/assessment/list/index.vue @@ -156,7 +156,7 @@ label="起始时间" align="center"> -
- -
- +
+ +
+ +
+
+ + +
+
+
内容设置
+
+ + +
+
+ +
+
+
+
{{ chapter.name }}
+
+ + +
- - - -
-
-
内容设置
-
- - -
-
- -
-
-
-
{{ chapter.name }}
-
- - -
-
- - - - - - - - - - - - - - - - -
+ + + + + + + + + + + + + + + + +
- - - - - - - - 取消 - 确定 - - + + + + + + + + 取消 + 确定 + + - - - - - 上传资源 -
视频请上传MP4格式,大小不超过30M;office文件大小不要超过10M
-
- -
- - - -
- - 取消 - 确定 - -
+ + + + + 上传资源 +
视频请上传MP4格式,大小不超过30M;office文件大小不要超过10M
+
+ +
+ + + +
+ + 取消 + 确定 + +
- -
- - 上传资源 - - -
- - 取消 - 确定 - -
- - - - - - - - - 取消 - 确定 - - + +
+ + 上传资源 + + +
+ + 取消 + 确定 + +
-
-
- -
- -
-
-
-
- -
- - - - -
-
-
-
- -
-
+ + + + + + + + 取消 + 确定 + + - -
+
+
+ +
+
- +
+
+
+ +
+ + + + +
+
+
+
+ +
+
+ + +
+
+ - - - - - - - - - - - - - - - 取消 - 确定 - - -
+ + + + + + + + + + + + + + + 取消 + 确定 + + +
@@ -839,15 +980,15 @@ export default { } } /deep/.el-progress-bar { - padding-right: 70px; - margin-right: -70px; + padding-right: 70px; + margin-right: -70px; } .el-upload__tip { - position: absolute; - top: -4px; - right: 0; - width: 300px; - line-height: 1.4; + position: absolute; + top: -4px; + right: 0; + width: 300px; + line-height: 1.4; } .sort-icon { font-size: 24px; @@ -855,16 +996,16 @@ export default { &.disabled { color: #ccc; - cursor: not-allowed + cursor: not-allowed; } } .el-image-viewer__wrapper { transform: translateY(-10px); - transition: transform .5s; + transition: transform 0.5s; &.active { - transform: translateY(0) + transform: translateY(0); } } diff --git a/src/pages/match/add/step3.vue b/src/pages/match/add/step3.vue index 7506d06..699aa24 100644 --- a/src/pages/match/add/step3.vue +++ b/src/pages/match/add/step3.vue @@ -46,6 +46,40 @@ + + + + +
+ +
+
+ + + +
+
import util from "@/libs/util"; +import Setting from "@/setting"; import set from './set' export default { props: ['setupId', 'competitionId', 'editing'], data () { return { + headers: { + token: util.local.get(Setting.tokenKey) + }, id: this.$route.query.id, updateTime: 0, step1: this.$parent.$refs.step1.form, @@ -186,6 +224,26 @@ export default { } else { form.time = [] } + // 线下赛事要另外加一个对象处理系统链接等字段 + if (e.method === 2) { + if (!form.competitionStageContentSetting) { + form.competitionStageContentSetting = { + whetherToUploadFiles: 0, + stageExplain: '', + fileUrl: '', + systemLink: '', + fileList: [] + } + } + if (form.competitionStageContentSetting.fileUrl) { + form.competitionStageContentSetting.fileList = [{ + name: form.competitionStageContentSetting.fileName, + url: form.competitionStageContentSetting.fileUrl, + }] + } + form.competitionStageContentSetting.competitionId = this.id + form.competitionStageContentSetting.stageId = e.stageId + } form.offlineButton = !!form.offlineButton form.onlineButton = !!form.onlineButton form.method = e.method @@ -232,6 +290,43 @@ export default { } } }, + + + // 附件上传前 + beforeUpload (file) { + const isLt2M = file.size / 1024 / 1024 < 10 + if (!isLt2M) util.warningMsg('请上传小于10MB的附件!') + if (isLt2M) { + this.fileName = file.name + return true + } else { + return false + } + }, + uploadError (err, file, fileList) { + this.$message({ + message: "上传出错,请重试!", + type: "error", + center: true + }) + }, + beforeRemove (file, fileList) { + return this.$confirm(`确定移除 ${file.name}?`); + }, + handleRemove (file, fileList, item) { + item.fileName = '' + item.fileUrl = '' + }, + uploadSuccess (res, item) { + const { originalFileName, fileUrl } = res.filesResult + item.competitionStageContentSetting.fileUrl = fileUrl + item.competitionStageContentSetting.fileName = originalFileName + item.competitionStageContentSetting.fileList = [{ + name: originalFileName, + url: fileUrl + }] + }, + // 发布赛事 publish () { this.competitionId && this.$post(`${this.api.publishCompetition}?competitionId=${this.competitionId}&publishStatus=1`).then(res => { }).catch(err => { }) @@ -283,6 +378,11 @@ export default { util.errorMsg('请输入评分规则') break } + if (e.competitionStageContentSetting.whetherToUploadFiles && !e.competitionStageContentSetting.stageExplain) { + invalid = 1 + util.errorMsg('请输入说明') + break + } } else { if (e.onlineButton && !e.onlineAddress) { invalid = 1 diff --git a/src/pages/match/manage/matchArch.vue b/src/pages/match/manage/matchArch.vue index 04cd8d6..136896a 100644 --- a/src/pages/match/manage/matchArch.vue +++ b/src/pages/match/manage/matchArch.vue @@ -44,7 +44,7 @@ @@ -116,9 +116,10 @@ export default { toRank (row, i) { this.$router.push(`rank?id=${this.id}&stageId=${row.stageId}&index=${i}&method=${row.method}&competitionType=${row.competitionType}&rule=${row.rule}`) }, - // 成绩管理 - toArch (row) { - this.$router.push(`archList?id=${this.id}&stageId=${row.stageId}&method=${row.method}&competitionType=${row.competitionType}`) + toArch (row, i) { + const cur = this.form.competitionStage[i] + const showFile = !!(cur.method === 2 && cur.competitionStageContentSetting && cur.competitionStageContentSetting.whetherToUploadFiles) + this.$router.push(`archList?id=${this.id}&stageId=${row.stageId}&method=${row.method}&competitionType=${row.competitionType}&showFile=${showFile}`) } } }; diff --git a/src/pages/match/manage/matchArchList.vue b/src/pages/match/manage/matchArchList.vue index 1355dd1..310facd 100644 --- a/src/pages/match/manage/matchArchList.vue +++ b/src/pages/match/manage/matchArchList.vue @@ -1,111 +1,258 @@