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">是 +
+ 说明 + +
@@ -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 ? '正在导出' : '批量导出' }}