From 2f2e5214940d61e645eb7991a304d428c79257e9 Mon Sep 17 00:00:00 2001
From: yujialong <479214531@qq.com>
Date: Tue, 21 Nov 2023 10:22:45 +0800
Subject: [PATCH] fix
---
src/libs/util.js | 2 +-
src/setting.js | 3 +-
src/views/Home.vue | 72 +++++++++----
src/views/course/contentSettings.vue | 128 +++++++++++------------
src/views/match/add/step3.vue | 56 ++++++----
src/views/match/manage/matchArch.vue | 3 +
src/views/match/manage/matchArchList.vue | 34 ++++--
src/views/match/manage/matchInfo.vue | 44 ++++----
8 files changed, 199 insertions(+), 143 deletions(-)
diff --git a/src/libs/util.js b/src/libs/util.js
index 91c2630..7d39ce1 100644
--- a/src/libs/util.js
+++ b/src/libs/util.js
@@ -109,7 +109,7 @@ const util = {
return fileName.substring(fileName.lastIndexOf('.') + 1)
},
// 传入文件名和路径,下载图片视频,支持跨域,a标签加download不支持跨域
- downloadFile(fileName,url) {
+ downloadFile(fileName, url) {
var x = new XMLHttpRequest()
x.open("GET", url, true)
x.responseType = 'blob'
diff --git a/src/setting.js b/src/setting.js
index 281be88..b8ddb3a 100644
--- a/src/setting.js
+++ b/src/setting.js
@@ -13,7 +13,7 @@ if (isDev) {
sandPath = `http://${location.hostname}:9520`
host = 'http://121.37.12.51/'
// host = 'https://huorantech.cn/'
- host = 'http://192.168.31.217:9000/'// 榕
+ // host = 'http://192.168.31.217:9000/'// 榕
// host = 'http://192.168.31.51:9000/'// 赓
} else if (isPro) {
jumpPath = 'https://www.huorantech.cn/judgmentPoint/'
@@ -26,6 +26,7 @@ const Setting = {
* */
platformId: 3, // 平台标识,1职站,2数据平台,3中台,4合伙人
platformSource: 0, // 平台来源(0中台,1职站)
+ autoLogoutTime: 1000 * 60 * 60, // 长时间未操作,自动退出登录时间
jumpPath, // 判分点系统跳转路径前缀
sandPath, // 沙盘地址
apiBaseURL: host, // 请求路径前缀
diff --git a/src/views/Home.vue b/src/views/Home.vue
index e043743..9daf27b 100644
--- a/src/views/Home.vue
+++ b/src/views/Home.vue
@@ -1,34 +1,60 @@
-
-
-
-
+
diff --git a/src/views/course/contentSettings.vue b/src/views/course/contentSettings.vue
index 51b034d..8e00d39 100644
--- a/src/views/course/contentSettings.vue
+++ b/src/views/course/contentSettings.vue
@@ -544,74 +544,74 @@ export default {
},
// 自定义上传
handleRequest (data) {
- console.log(33, Util.isVideo(this.fileType))
- // 视频上传另外调阿里云的接口处理
- if (Util.isVideo(this.fileType)) {
+ // console.log(33, Util.isVideo(this.fileType))
+ // // 视频上传另外调阿里云的接口处理
+ // if (Util.isVideo(this.fileType)) {
- console.log("🚀 ~ file: contentSettings.vue:587 ~ handleRequest ~ AliyunUpload:", AliyunUpload)
- var uploader = new AliyunUpload.Vod({
- // userID,必填,您可以使用阿里云账号访问账号中心(https://account.console.aliyun.com/),即可查看账号ID
- userId: "1686385620732064",
- // 分片大小默认1 MB,不能小于100 KB(100*1024)
- partSize: 1048576,
- // 并行上传分片个数,默认5
- parallel: 5,
- // 网络原因失败时,重新上传次数,默认为3
- retryCount: 3,
- // 网络原因失败时,重新上传间隔时间,默认为2秒
- retryDuration: 2,
- // 开始上传
- 'onUploadstarted': function (uploadInfo) {
- console.log("🚀 ~ file: contentSettings.vue:567 ~ handleRequest ~ uploadInfo:", uploadInfo)
- debugger
- },
- // 文件上传成功
- 'onUploadSucceed': function (uploadInfo) {
- console.log("🚀 ~ file: contentSettings.vue:571 ~ handleRequest ~ uploadInfo:", uploadInfo)
- },
- // 文件上传失败
- 'onUploadFailed': function (uploadInfo, code, message) {
- console.log("🚀 ~ file: contentSettings.vue:576 ~ handleRequest ~ uploadInfo, code, message:", uploadInfo, code, message)
- },
- // 文件上传进度,单位:字节
- 'onUploadProgress': function (uploadInfo, totalSize, loadedPercent) {
- console.log("🚀 ~ file: contentSettings.vue:578 ~ handleRequest ~ uploadInfo, totalSize, loadedPercent:", uploadInfo, totalSize, loadedPercent)
- },
- // 上传凭证或STS token超时
- 'onUploadTokenExpired': function (uploadInfo) {
- },
- // 全部文件上传结束
- 'onUploadEnd': function (uploadInfo) {
- }
- });
+ // console.log("🚀 ~ file: contentSettings.vue:587 ~ handleRequest ~ AliyunUpload:", AliyunUpload)
+ // var uploader = new AliyunUpload.Vod({
+ // // userID,必填,您可以使用阿里云账号访问账号中心(https://account.console.aliyun.com/),即可查看账号ID
+ // userId: "1686385620732064",
+ // // 分片大小默认1 MB,不能小于100 KB(100*1024)
+ // partSize: 1048576,
+ // // 并行上传分片个数,默认5
+ // parallel: 5,
+ // // 网络原因失败时,重新上传次数,默认为3
+ // retryCount: 3,
+ // // 网络原因失败时,重新上传间隔时间,默认为2秒
+ // retryDuration: 2,
+ // // 开始上传
+ // 'onUploadstarted': function (uploadInfo) {
+ // console.log("🚀 ~ file: contentSettings.vue:567 ~ handleRequest ~ uploadInfo:", uploadInfo)
+ // debugger
+ // },
+ // // 文件上传成功
+ // 'onUploadSucceed': function (uploadInfo) {
+ // console.log("🚀 ~ file: contentSettings.vue:571 ~ handleRequest ~ uploadInfo:", uploadInfo)
+ // },
+ // // 文件上传失败
+ // 'onUploadFailed': function (uploadInfo, code, message) {
+ // console.log("🚀 ~ file: contentSettings.vue:576 ~ handleRequest ~ uploadInfo, code, message:", uploadInfo, code, message)
+ // },
+ // // 文件上传进度,单位:字节
+ // 'onUploadProgress': function (uploadInfo, totalSize, loadedPercent) {
+ // console.log("🚀 ~ file: contentSettings.vue:578 ~ handleRequest ~ uploadInfo, totalSize, loadedPercent:", uploadInfo, totalSize, loadedPercent)
+ // },
+ // // 上传凭证或STS token超时
+ // 'onUploadTokenExpired': function (uploadInfo) {
+ // },
+ // // 全部文件上传结束
+ // 'onUploadEnd': function (uploadInfo) {
+ // }
+ // });
- } else {
- const param = new FormData()
- param.append('file', data.file)
- const config = {
- timeout: 10000000000,
- headers: {
- 'Accept': '*/*',
- 'Content-Type': 'multipart/form-data'
- },
- // 获取上传进度,自带的组件上传进度不准确
- onUploadProgress: progressEvent => {
- const per = Number((progressEvent.loaded / progressEvent.total * 100).toFixed(2))
- console.log("🚀 ~ file: contentSettings.vue ~ line 329 ~ handleRequest ~ per", per, this.progressPercent)
- if (this.progressPercent <= 80) this.progressPercent = (per > 80) ? (Math.random() * 10 + 80).toFixed(2) : per
- }
+ // } else {
+ const param = new FormData()
+ param.append('file', data.file)
+ const config = {
+ timeout: 10000000000,
+ headers: {
+ 'Accept': '*/*',
+ 'Content-Type': 'multipart/form-data'
+ },
+ // 获取上传进度,自带的组件上传进度不准确
+ onUploadProgress: progressEvent => {
+ const per = Number((progressEvent.loaded / progressEvent.total * 100).toFixed(2))
+ console.log("🚀 ~ file: contentSettings.vue ~ line 329 ~ handleRequest ~ per", per, this.progressPercent)
+ if (this.progressPercent <= 80) this.progressPercent = (per > 80) ? (Math.random() * 10 + 80).toFixed(2) : per
}
- axios.post(this.api.fileupload, param, config).then(res => {
- this.progressPercent = 100
- this.showProgress = false
- const { fileId, fileType, fileUrl, ossFileName } = res.data.data.filesResult
- this.uploading = false
- this.fileId = fileId
- this.fileType = fileType
- this.fileUrl = fileUrl
- this.fileName = ossFileName
- })
}
+ axios.post(this.api.fileupload, param, config).then(res => {
+ this.progressPercent = 100
+ this.showProgress = false
+ const { fileId, fileType, fileUrl, ossFileName } = res.data.data.filesResult
+ this.uploading = false
+ this.fileId = fileId
+ this.fileType = fileType
+ this.fileUrl = fileUrl
+ this.fileName = ossFileName
+ })
+ // }
},
uploadError (err, file, fileList) {
this.$message({
diff --git a/src/views/match/add/step3.vue b/src/views/match/add/step3.vue
index 990592b..34cdfbe 100644
--- a/src/views/match/add/step3.vue
+++ b/src/views/match/add/step3.vue
@@ -60,8 +60,7 @@
:label="1">是
-
上传试卷
+ type="primary">上传文件
- 说明
-
+
+ 说明
+
+
@@ -233,11 +235,17 @@ export default {
fileList: []
}
}
+ // 文件路径名称处理
if (form.competitionStageContentSetting.fileUrl) {
- form.competitionStageContentSetting.fileList = [{
- name: form.competitionStageContentSetting.fileName,
- url: form.competitionStageContentSetting.fileUrl,
- }]
+ const urls = form.competitionStageContentSetting.fileUrl.split('|')
+ const names = form.competitionStageContentSetting.fileName.split('|')
+ form.competitionStageContentSetting.fileList = []
+ urls.map((n, i) => {
+ form.competitionStageContentSetting.fileList.push({
+ name: names[i],
+ url: n
+ })
+ })
}
form.competitionStageContentSetting.competitionId = this.id
form.competitionStageContentSetting.stageId = e.stageId
@@ -312,17 +320,15 @@ export default {
return this.$confirm(`确定移除 ${file.name}?`);
},
handleRemove (file, fileList, item) {
- item.fileName = ''
- item.fileUrl = ''
+ const i = item.competitionStageContentSetting.fileList.findIndex(e => e.url === file.url)
+ item.competitionStageContentSetting.fileList.splice(i, 1)
},
uploadSuccess (res, item) {
const { originalFileName, fileUrl } = res.filesResult
- item.competitionStageContentSetting.fileUrl = fileUrl
- item.competitionStageContentSetting.fileName = originalFileName
- item.competitionStageContentSetting.fileList = [{
+ item.competitionStageContentSetting.fileList.push({
name: originalFileName,
url: fileUrl
- }]
+ })
},
// 发布赛事
publish () {
@@ -375,11 +381,11 @@ export default {
util.errorMsg('请输入评分规则')
break
}
- if (e.competitionStageContentSetting.whetherToUploadFiles && !e.competitionStageContentSetting.stageExplain) {
- invalid = 1
- util.errorMsg('请输入说明')
- break
- }
+ // if (e.competitionStageContentSetting.whetherToUploadFiles && !e.competitionStageContentSetting.stageExplain) {
+ // invalid = 1
+ // util.errorMsg('请输入说明')
+ // break
+ // }
} else {
if (e.onlineButton && !e.onlineAddress) {
invalid = 1
@@ -404,6 +410,10 @@ export default {
for (const e of form) {
e.offlineButton = e.offlineButton ? 1 : 0
e.onlineButton = e.onlineButton ? 1 : 0
+ if (e.competitionStageContentSetting && e.competitionStageContentSetting.fileList && e.competitionStageContentSetting.fileList.length) {
+ e.competitionStageContentSetting.fileName = e.competitionStageContentSetting.fileList.map(n => n.name).join('|')
+ e.competitionStageContentSetting.fileUrl = e.competitionStageContentSetting.fileList.map(n => n.url).join('|')
+ }
}
this.$parent.showLoad()
this.$post(this.api[form[0].contentId ? 'editCompetitionContent' : 'addCompetitionContent'], {
diff --git a/src/views/match/manage/matchArch.vue b/src/views/match/manage/matchArch.vue
index d257f13..96ad0a4 100644
--- a/src/views/match/manage/matchArch.vue
+++ b/src/views/match/manage/matchArch.vue
@@ -16,6 +16,9 @@
{{ scope.$index + 1 }}
+
diff --git a/src/views/match/manage/matchArchList.vue b/src/views/match/manage/matchArchList.vue
index fb31499..bdb772d 100644
--- a/src/views/match/manage/matchArchList.vue
+++ b/src/views/match/manage/matchArchList.vue
@@ -59,7 +59,8 @@
批量导出
+ :loading="loading"
+ @click="exportData1">{{ loading ? '正在导出' : '批量导出' }}
@@ -177,7 +178,7 @@
-
预览文件
- 导出文件
@@ -294,7 +296,8 @@ export default {
},
statData: {},
tabs: ['成绩列表', '文件列表'],
- active: 0
+ active: 0,
+ loading: false
};
},
watch: {
@@ -319,6 +322,22 @@ export default {
stageId: this.stageId,
keyWord: this.keyword,
}).then(({ data }) => {
+ data.records.forEach(e => {
+ e.fileType = '其他'
+ if (util.isVideo(e.fileFormat)) {
+ e.fileType = '视频'
+ } else if (util.isAudio(e.fileFormat)) {
+ e.fileType = '音频'
+ } else if (util.isImg(e.fileFormat)) {
+ e.fileType = '图片'
+ } else if (util.isDoc(e.fileFormat)) {
+ e.fileType = '文档'
+ } else if (util.isCompress(e.fileFormat)) {
+ e.fileType = '压缩包'
+ } else if (e.fileType === 'pdf') {
+ e.fileType = 'pdf'
+ }
+ })
this.list1 = data.records
this.total1 = data.total
}).catch(res => { })
@@ -376,12 +395,13 @@ export default {
stageId: this.stageId,
}
if (ids) data.ids = ids
+ this.loading = true
axios.post(this.api.derive, data, {
headers: this.headers,
responseType: 'blob'
}).then((res) => {
- console.log("🚀 ~ file: matchArchList.vue:378 ~ exportData1 ~ res:", res)
util.downloadFileDirect(`批量导出.zip`, new Blob([res.data]))
+ this.loading = false
}).catch(res => { })
},
handleDelete (row) { // 删除
@@ -536,7 +556,9 @@ export default {
},
// 导出文件
exportFile (item) {
+ item.loading = true
util.downloadFile(item.userName + '-' + item.fileName, item.filePath)
+ item.loading = false
},
}
};
diff --git a/src/views/match/manage/matchInfo.vue b/src/views/match/manage/matchInfo.vue
index 1510baf..3f6c1c9 100644
--- a/src/views/match/manage/matchInfo.vue
+++ b/src/views/match/manage/matchInfo.vue
@@ -578,33 +578,27 @@ export default {
selectPar (row) {
const item = this.form.competitionStage.find(e => e.stageId == row.stageId)
if (item) {
- // 该阶段已经开始比赛则不能修改
- const now = new Date()
- if (now >= new Date(item.startTime) && now <= new Date(item.endTime)) {
- return util.errorMsg('该阶段比赛已经开始,无法修改允许参赛人员!')
+ const { teamLimit, stages, teamDetail } = this.info
+ // teamLimit=true,则每个成员只能参加一个阶段的比赛,要获取stages里返回的所有participantAccountIds(参赛人员的accountId),然后不显示这些参赛人员
+ if (teamLimit) {
+ const chooses = []
+ let ids = []
+ // 获取已经允许参赛的人员accountId
+ stages.map(e => {
+ let id = e.participantAccountIds
+ if (e.stageId != row.stageId && id) ids.push(...id.split(',').map(n => +n))
+ })
+ ids = [...new Set(ids)]
+ teamDetail.map(e => {
+ ids.includes(e.accountId) || chooses.push(e) // 没有参赛的人员则显示出来
+ })
+ this.chooses = chooses
} else {
- const { teamLimit, stages, teamDetail } = this.info
- // teamLimit=true,则每个成员只能参加一个阶段的比赛,要获取stages里返回的所有participantAccountIds(参赛人员的accountId),然后不显示这些参赛人员
- if (teamLimit) {
- const chooses = []
- let ids = []
- // 获取已经允许参赛的人员accountId
- stages.map(e => {
- let id = e.participantAccountIds
- if (e.stageId != row.stageId && id) ids.push(...id.split(',').map(n => +n))
- })
- ids = [...new Set(ids)]
- teamDetail.map(e => {
- ids.includes(e.accountId) || chooses.push(e) // 没有参赛的人员则显示出来
- })
- this.chooses = chooses
- } else {
- this.chooses = this.info.teamDetail
- }
- this.curRow = row
- this.checkedMembers = []
- this.chooseVisible = true
+ this.chooses = this.info.teamDetail
}
+ this.curRow = row
+ this.checkedMembers = []
+ this.chooseVisible = true
}
},
// 选择参赛人员提交