!32 增加csv格式 作品提交,差作品上传信息至后端。以及监测是否需要自动打榜
Merge pull request !32 from Sky_ID/lwh
This commit is contained in:
commit
909ef8b3c0
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue