dev_review
yujialong 1 year ago
parent a6cec79bdc
commit 2f2e521494
  1. 2
      src/libs/util.js
  2. 3
      src/setting.js
  3. 72
      src/views/Home.vue
  4. 128
      src/views/course/contentSettings.vue
  5. 56
      src/views/match/add/step3.vue
  6. 3
      src/views/match/manage/matchArch.vue
  7. 34
      src/views/match/manage/matchArchList.vue
  8. 44
      src/views/match/manage/matchInfo.vue

@ -109,7 +109,7 @@ const util = {
return fileName.substring(fileName.lastIndexOf('.') + 1) return fileName.substring(fileName.lastIndexOf('.') + 1)
}, },
// 传入文件名和路径,下载图片视频,支持跨域,a标签加download不支持跨域 // 传入文件名和路径,下载图片视频,支持跨域,a标签加download不支持跨域
downloadFile(fileName,url) { downloadFile(fileName, url) {
var x = new XMLHttpRequest() var x = new XMLHttpRequest()
x.open("GET", url, true) x.open("GET", url, true)
x.responseType = 'blob' x.responseType = 'blob'

@ -13,7 +13,7 @@ if (isDev) {
sandPath = `http://${location.hostname}:9520` sandPath = `http://${location.hostname}:9520`
host = 'http://121.37.12.51/' host = 'http://121.37.12.51/'
// host = 'https://huorantech.cn/' // 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/'// 赓 // host = 'http://192.168.31.51:9000/'// 赓
} else if (isPro) { } else if (isPro) {
jumpPath = 'https://www.huorantech.cn/judgmentPoint/' jumpPath = 'https://www.huorantech.cn/judgmentPoint/'
@ -26,6 +26,7 @@ const Setting = {
* */ * */
platformId: 3, // 平台标识,1职站,2数据平台,3中台,4合伙人 platformId: 3, // 平台标识,1职站,2数据平台,3中台,4合伙人
platformSource: 0, // 平台来源(0中台,1职站) platformSource: 0, // 平台来源(0中台,1职站)
autoLogoutTime: 1000 * 60 * 60, // 长时间未操作,自动退出登录时间
jumpPath, // 判分点系统跳转路径前缀 jumpPath, // 判分点系统跳转路径前缀
sandPath, // 沙盘地址 sandPath, // 沙盘地址
apiBaseURL: host, // 请求路径前缀 apiBaseURL: host, // 请求路径前缀

@ -1,34 +1,60 @@
<template> <template>
<div class="wrapper"> <div class="wrapper">
<v-head></v-head> <v-head></v-head>
<v-sidebar></v-sidebar> <v-sidebar></v-sidebar>
<div class="content-box" > <div class="content-box">
<div class="content"> <div class="content">
<transition name="move" mode="out-in"> <transition name="move"
<!-- <keep-alive> --> mode="out-in">
<router-view></router-view> <!-- <keep-alive> -->
<!-- </keep-alive> --> <router-view></router-view>
</transition> <!-- </keep-alive> -->
<el-backtop target=".content"></el-backtop> </transition>
</div> <el-backtop target=".content"></el-backtop>
</div> </div>
</div> </div>
</div>
</template> </template>
<script> <script>
import vHead from '../components/Header.vue'; import vHead from '../components/Header.vue';
import vSidebar from '../components/Sidebar.vue'; import vSidebar from '../components/Sidebar.vue';
import Setting from "@/setting";
import util from "@/libs/util";
export default { export default {
data() { data () {
return { return {
tagsList: [], tagsList: [],
}; };
}, },
components: { components: {
vHead, vHead,
vSidebar, vSidebar,
}, },
created() { created () {
this.autoLogout()
},
methods: {
// ,退
autoLogout () {
let lastTime = new Date().getTime();
document.onmousedown = () => {
lastTime = new Date().getTime();
};
const timer = setInterval(() => {
if (sessionStorage.getItem('token') && (new Date().getTime() - lastTime) > Setting.autoLogoutTime) {
clearInterval(timer)
util.errorMsg("由于您已经有一个小时没有操作,系统自动登出,请重新登录。页面刷新到登录页。");
setTimeout(() => {
localStorage.removeItem('ms_username');
localStorage.removeItem('token');
sessionStorage.clear()
location.reload()
}, 1500);
}
}, 1000);
} }
}
}; };
</script> </script>

@ -544,74 +544,74 @@ export default {
}, },
// //
handleRequest (data) { handleRequest (data) {
console.log(33, Util.isVideo(this.fileType)) // console.log(33, Util.isVideo(this.fileType))
// // //
if (Util.isVideo(this.fileType)) { // if (Util.isVideo(this.fileType)) {
console.log("🚀 ~ file: contentSettings.vue:587 ~ handleRequest ~ AliyunUpload:", AliyunUpload) // console.log("🚀 ~ file: contentSettings.vue:587 ~ handleRequest ~ AliyunUpload:", AliyunUpload)
var uploader = new AliyunUpload.Vod({ // var uploader = new AliyunUpload.Vod({
// userID使访https://account.console.aliyun.com/ID // // userID使访https://account.console.aliyun.com/ID
userId: "1686385620732064", // userId: "1686385620732064",
// 1 MB100 KB100*1024 // // 1 MB100 KB100*1024
partSize: 1048576, // partSize: 1048576,
// 5 // // 5
parallel: 5, // parallel: 5,
// 3 // // 3
retryCount: 3, // retryCount: 3,
// 2 // // 2
retryDuration: 2, // retryDuration: 2,
// // //
'onUploadstarted': function (uploadInfo) { // 'onUploadstarted': function (uploadInfo) {
console.log("🚀 ~ file: contentSettings.vue:567 ~ handleRequest ~ uploadInfo:", uploadInfo) // console.log("🚀 ~ file: contentSettings.vue:567 ~ handleRequest ~ uploadInfo:", uploadInfo)
debugger // debugger
}, // },
// // //
'onUploadSucceed': function (uploadInfo) { // 'onUploadSucceed': function (uploadInfo) {
console.log("🚀 ~ file: contentSettings.vue:571 ~ handleRequest ~ uploadInfo:", uploadInfo) // console.log("🚀 ~ file: contentSettings.vue:571 ~ handleRequest ~ uploadInfo:", uploadInfo)
}, // },
// // //
'onUploadFailed': function (uploadInfo, code, message) { // 'onUploadFailed': function (uploadInfo, code, message) {
console.log("🚀 ~ file: contentSettings.vue:576 ~ handleRequest ~ uploadInfo, code, message:", uploadInfo, code, message) // console.log("🚀 ~ file: contentSettings.vue:576 ~ handleRequest ~ uploadInfo, code, message:", uploadInfo, code, message)
}, // },
// // //
'onUploadProgress': function (uploadInfo, totalSize, loadedPercent) { // 'onUploadProgress': function (uploadInfo, totalSize, loadedPercent) {
console.log("🚀 ~ file: contentSettings.vue:578 ~ handleRequest ~ uploadInfo, totalSize, loadedPercent:", uploadInfo, totalSize, loadedPercent) // console.log("🚀 ~ file: contentSettings.vue:578 ~ handleRequest ~ uploadInfo, totalSize, loadedPercent:", uploadInfo, totalSize, loadedPercent)
}, // },
// STS token // // STS token
'onUploadTokenExpired': function (uploadInfo) { // 'onUploadTokenExpired': function (uploadInfo) {
}, // },
// // //
'onUploadEnd': function (uploadInfo) { // 'onUploadEnd': function (uploadInfo) {
} // }
}); // });
} else { // } else {
const param = new FormData() const param = new FormData()
param.append('file', data.file) param.append('file', data.file)
const config = { const config = {
timeout: 10000000000, timeout: 10000000000,
headers: { headers: {
'Accept': '*/*', 'Accept': '*/*',
'Content-Type': 'multipart/form-data' 'Content-Type': 'multipart/form-data'
}, },
// //
onUploadProgress: progressEvent => { onUploadProgress: progressEvent => {
const per = Number((progressEvent.loaded / progressEvent.total * 100).toFixed(2)) const per = Number((progressEvent.loaded / progressEvent.total * 100).toFixed(2))
console.log("🚀 ~ file: contentSettings.vue ~ line 329 ~ handleRequest ~ per", per, this.progressPercent) 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 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) { uploadError (err, file, fileList) {
this.$message({ this.$message({

@ -60,8 +60,7 @@
:label="1"></el-radio> :label="1"></el-radio>
<template v-if="item.competitionStageContentSetting.whetherToUploadFiles"> <template v-if="item.competitionStageContentSetting.whetherToUploadFiles">
<el-upload accept=".jpg,.png,.jpeg,.gif" <el-upload :on-remove="(file, fileList) => handleRemove(file, fileList, item)"
:on-remove="(file, fileList) => handleRemove(file, fileList, item)"
:on-error="uploadError" :on-error="uploadError"
:on-success="res => uploadSuccess(res, item)" :on-success="res => uploadSuccess(res, item)"
:before-remove="beforeRemove" :before-remove="beforeRemove"
@ -70,15 +69,18 @@
:file-list="item.competitionStageContentSetting.fileList" :file-list="item.competitionStageContentSetting.fileList"
name="file"> name="file">
<el-button size="small" <el-button size="small"
type="primary">上传试卷</el-button> type="primary">上传文件</el-button>
</el-upload> </el-upload>
<span style="margin: 0 10px 0 30px;">说明</span>
<el-input maxlength="1000"
placeholder="请输入内容"
v-model="item.competitionStageContentSetting.stageExplain"
style="width: calc(80% - 216px);"></el-input>
</template> </template>
</div> </div>
<div style="display: flex;align-items: flex-start;margin-top: 10px">
<span style="margin: 0 10px 0 30px;">说明</span>
<el-input maxlength="1000"
placeholder="请输入内容"
type="textarea"
v-model="item.competitionStageContentSetting.stageExplain"
style="width: calc(80% - 216px);"></el-input>
</div>
</el-form-item> </el-form-item>
<el-form-item class="req" <el-form-item class="req"
label="比赛内容"> label="比赛内容">
@ -233,11 +235,17 @@ export default {
fileList: [] fileList: []
} }
} }
//
if (form.competitionStageContentSetting.fileUrl) { if (form.competitionStageContentSetting.fileUrl) {
form.competitionStageContentSetting.fileList = [{ const urls = form.competitionStageContentSetting.fileUrl.split('|')
name: form.competitionStageContentSetting.fileName, const names = form.competitionStageContentSetting.fileName.split('|')
url: form.competitionStageContentSetting.fileUrl, form.competitionStageContentSetting.fileList = []
}] urls.map((n, i) => {
form.competitionStageContentSetting.fileList.push({
name: names[i],
url: n
})
})
} }
form.competitionStageContentSetting.competitionId = this.id form.competitionStageContentSetting.competitionId = this.id
form.competitionStageContentSetting.stageId = e.stageId form.competitionStageContentSetting.stageId = e.stageId
@ -312,17 +320,15 @@ export default {
return this.$confirm(`确定移除 ${file.name}`); return this.$confirm(`确定移除 ${file.name}`);
}, },
handleRemove (file, fileList, item) { handleRemove (file, fileList, item) {
item.fileName = '' const i = item.competitionStageContentSetting.fileList.findIndex(e => e.url === file.url)
item.fileUrl = '' item.competitionStageContentSetting.fileList.splice(i, 1)
}, },
uploadSuccess (res, item) { uploadSuccess (res, item) {
const { originalFileName, fileUrl } = res.filesResult const { originalFileName, fileUrl } = res.filesResult
item.competitionStageContentSetting.fileUrl = fileUrl item.competitionStageContentSetting.fileList.push({
item.competitionStageContentSetting.fileName = originalFileName
item.competitionStageContentSetting.fileList = [{
name: originalFileName, name: originalFileName,
url: fileUrl url: fileUrl
}] })
}, },
// //
publish () { publish () {
@ -375,11 +381,11 @@ export default {
util.errorMsg('请输入评分规则') util.errorMsg('请输入评分规则')
break break
} }
if (e.competitionStageContentSetting.whetherToUploadFiles && !e.competitionStageContentSetting.stageExplain) { // if (e.competitionStageContentSetting.whetherToUploadFiles && !e.competitionStageContentSetting.stageExplain) {
invalid = 1 // invalid = 1
util.errorMsg('请输入说明') // util.errorMsg('')
break // break
} // }
} else { } else {
if (e.onlineButton && !e.onlineAddress) { if (e.onlineButton && !e.onlineAddress) {
invalid = 1 invalid = 1
@ -404,6 +410,10 @@ export default {
for (const e of form) { for (const e of form) {
e.offlineButton = e.offlineButton ? 1 : 0 e.offlineButton = e.offlineButton ? 1 : 0
e.onlineButton = e.onlineButton ? 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.$parent.showLoad()
this.$post(this.api[form[0].contentId ? 'editCompetitionContent' : 'addCompetitionContent'], { this.$post(this.api[form[0].contentId ? 'editCompetitionContent' : 'addCompetitionContent'], {

@ -16,6 +16,9 @@
{{ scope.$index + 1 }} {{ scope.$index + 1 }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="stageName"
label="阶段名称"
align="center"></el-table-column>
<el-table-column prop="methodName" <el-table-column prop="methodName"
label="比赛方式" label="比赛方式"
align="center"></el-table-column> align="center"></el-table-column>

@ -59,7 +59,8 @@
</div> </div>
<div v-else> <div v-else>
<el-button type="primary" <el-button type="primary"
@click="exportData1">批量导出</el-button> :loading="loading"
@click="exportData1">{{ loading ? '正在导出' : '批量导出' }}</el-button>
</div> </div>
</div> </div>
<template v-if="!active"> <template v-if="!active">
@ -177,7 +178,7 @@
<el-table-column prop="fileSize" <el-table-column prop="fileSize"
label="文件大小" label="文件大小"
align="center"></el-table-column> align="center"></el-table-column>
<el-table-column prop="fileFormat" <el-table-column prop="fileType"
label="文件类型" label="文件类型"
align="center"></el-table-column> align="center"></el-table-column>
<el-table-column prop="fileFormat" <el-table-column prop="fileFormat"
@ -189,13 +190,14 @@
align="center"> align="center">
</el-table-column> </el-table-column>
<el-table-column label="操作" <el-table-column label="操作"
align="center"
width="160"> width="160">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button v-if="!isCompress(scope.row.fileFormat)" <el-button v-if="!isCompress(scope.row.fileFormat)"
type="text" type="text"
@click="preview(scope.row)">预览文件</el-button> @click="preview(scope.row)">预览文件</el-button>
<el-button type="text" <el-button type="primary"
size="mini"
:loading="scope.row.loading"
@click="exportFile(scope.row)">导出文件</el-button> @click="exportFile(scope.row)">导出文件</el-button>
</template> </template>
</el-table-column> </el-table-column>
@ -294,7 +296,8 @@ export default {
}, },
statData: {}, statData: {},
tabs: ['成绩列表', '文件列表'], tabs: ['成绩列表', '文件列表'],
active: 0 active: 0,
loading: false
}; };
}, },
watch: { watch: {
@ -319,6 +322,22 @@ export default {
stageId: this.stageId, stageId: this.stageId,
keyWord: this.keyword, keyWord: this.keyword,
}).then(({ data }) => { }).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.list1 = data.records
this.total1 = data.total this.total1 = data.total
}).catch(res => { }) }).catch(res => { })
@ -376,12 +395,13 @@ export default {
stageId: this.stageId, stageId: this.stageId,
} }
if (ids) data.ids = ids if (ids) data.ids = ids
this.loading = true
axios.post(this.api.derive, data, { axios.post(this.api.derive, data, {
headers: this.headers, headers: this.headers,
responseType: 'blob' responseType: 'blob'
}).then((res) => { }).then((res) => {
console.log("🚀 ~ file: matchArchList.vue:378 ~ exportData1 ~ res:", res)
util.downloadFileDirect(`批量导出.zip`, new Blob([res.data])) util.downloadFileDirect(`批量导出.zip`, new Blob([res.data]))
this.loading = false
}).catch(res => { }) }).catch(res => { })
}, },
handleDelete (row) { // handleDelete (row) { //
@ -536,7 +556,9 @@ export default {
}, },
// //
exportFile (item) { exportFile (item) {
item.loading = true
util.downloadFile(item.userName + '-' + item.fileName, item.filePath) util.downloadFile(item.userName + '-' + item.fileName, item.filePath)
item.loading = false
}, },
} }
}; };

@ -578,33 +578,27 @@ export default {
selectPar (row) { selectPar (row) {
const item = this.form.competitionStage.find(e => e.stageId == row.stageId) const item = this.form.competitionStage.find(e => e.stageId == row.stageId)
if (item) { if (item) {
// const { teamLimit, stages, teamDetail } = this.info
const now = new Date() // teamLimit=truestagesparticipantAccountIdsaccountId
if (now >= new Date(item.startTime) && now <= new Date(item.endTime)) { if (teamLimit) {
return util.errorMsg('该阶段比赛已经开始,无法修改允许参赛人员!') 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 { } else {
const { teamLimit, stages, teamDetail } = this.info this.chooses = this.info.teamDetail
// teamLimit=truestagesparticipantAccountIdsaccountId
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.curRow = row
this.checkedMembers = []
this.chooseVisible = true
} }
}, },
// //

Loading…
Cancel
Save