!32 增加csv格式 作品提交,差作品上传信息至后端。以及监测是否需要自动打榜

Merge pull request !32 from Sky_ID/lwh
This commit is contained in:
Sky_ID 2022-06-29 14:15:22 +00:00 committed by Gitee
commit 909ef8b3c0
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 23 additions and 17 deletions

View File

@ -6,15 +6,14 @@
<div class="card">
<el-upload
drag
name="importSubmitFile"
:limit="1"
:on-exceed="handleExceed"
:action="uploadActionUrl"
accept=".zip,.rar"
:data="uploadData"
accept=".zip,.rar,.csv"
:before-upload="onBeforeUpload"
:on-progress="onUpload"
:on-success="(res)=>{importSuccess(res)}"
:before-remove="beforeRemove"
:file-list="fileList"
:disabled="uploadStatus"
class="import-submit-file"
@ -69,7 +68,13 @@ export default {
data() {
return {
fileList: [],
uploadActionUrl:"/api/comp/uploadImg",
uploadData: {
fileName : this.$route.params.compId + '-submit-',
type: 'submit'
},
downloadActionUrl: "",
applyTime: [],
@ -77,7 +82,8 @@ export default {
onlineScript: false,
onlineInter: '',
uploadStatus: false,
loading: true
loading: true,
file: ''
};
},
@ -91,13 +97,13 @@ export default {
//
onBeforeUpload(file) {
const isIMAGE = file.type === "rar" || "zip";
const isLt1M = file.size / 1024 / 1024 < 1;
const isIMAGE = file.type === "rar" || "zip"||"csv";
const isLt1M = file.size / 1024 / 1024 < 50;
if (!isIMAGE) {
this.$message.error("上传文件只能是rar/zip压缩包格式!");
this.$message.error("上传文件只能是rar/zip/csv压缩包格式!");
}
if (!isLt1M) {
this.$message.error("上传文件大小不能超过 1MB!");
this.$message.error("上传文件大小不能超过 50MB!");
}
// false
return isIMAGE && isLt1M;
@ -113,15 +119,15 @@ export default {
//
importSuccess(res) {
if (res.code == "0") {
if (res.data == 0) {
this.$message({
showClose: true,
message: '上传报名表成功',
type: 'success',
});
}
} else {
if(res.status == 0){
this.$message({
showClose: true,
message: '上传报名表成功',
type: 'success'
});
this.file=res.url
//TODO:
}else{
this.$message({
showClose: true,
message: '上传报名表失败' + res.message,