diff --git a/src/pages/Apply/Apply.vue b/src/pages/Apply/Apply.vue index e033052..98d4c68 100644 --- a/src/pages/Apply/Apply.vue +++ b/src/pages/Apply/Apply.vue @@ -144,14 +144,14 @@
@@ -184,9 +184,15 @@ export default { data() { return { + uploadData: { + fileName : this.$route.params.compId + '-报名-', + type: 'apply' + }, + fileList: [ + + ], divisionList : [], kindList : [], - applyTime:[], submitTime:[], isReady : false, @@ -223,7 +229,7 @@ export default { addForm: [], // 临时变量:逐个添加的表单 - uploadActionUrl: "", // 上传后端接口url + uploadActionUrl: "/api/comp/uploadImg", // 上传后端接口url applyFilterUrl: "", // 下载报名表的url disabledIf: false, // 提交后禁用表达按钮 @@ -395,35 +401,31 @@ export default { onBeforeUpload(file){ const isIMAGE = file.type === "rar"||"zip"; - const isLt1M = file.size / 1024 / 1024 < 1; + const isLt20M = file.size / 1024 / 1024 < 20; if (!isIMAGE) { this.$message.error("上传文件只能是rar/zip压缩包格式!"); } - if (!isLt1M) { - this.$message.error("上传文件大小不能超过 1MB!"); + if (!isLt20M) { + this.$message.error("上传文件大小不能超过 20MB!"); } // 返回false不会自动上传 - return isIMAGE && isLt1M; + return isIMAGE && isLt20M; }, // 文件上传等待 - onUpload(){ - this.loading_text = "拼命导入中...请稍等"; - this.loading = true; - }, + // 上传文件结果 importSuccess(res){ - if(res.code == "0"){ - if(res.data == 0){ - this.$message({ - showClose: true, - message: '上传报名表成功', - type: 'success' + if(res.status == 0){ + this.$message({ + showClose: true, + message: '上传报名表成功', + type: 'success' }); - } + this.applyForm.applyFile=res.url }else{ this.$message({ showClose: true, @@ -550,6 +552,15 @@ export default { memberList : res.data.memberInfoList } this.applyForm = getApplyInfo + + if (res.data.applyInfo.file != ''){ + this.fileList.push({ + name: res.data.applyInfo.file.split("/")[3].split("-")[2], + url: res.data.applyInfo.file + } + ) + } + if (this.applyForm.applySource == "自主提交") { this.radioValue = 2 this.inputIf = true; @@ -579,6 +590,13 @@ export default { status : 1, memberList : res.data.memberInfoList } + if (res.data.applyInfo.file != ''){ + this.fileList.push({ + name: res.data.applyInfo.file.split("/")[3].split("-")[2], + url: res.data.applyInfo.file + } + ) + } if (this.applyForm.applySource == "自主提交") { this.radioValue = 2 this.inputIf = true; @@ -608,6 +626,13 @@ export default { status : 2, memberList : res.data.memberInfoList } + if (res.data.applyInfo.file != ''){ + this.fileList.push({ + name: res.data.applyInfo.file.split("/")[3].split("-")[2], + url: res.data.applyInfo.file + } + ) + } if (this.applyForm.applySource == "自主提交") { this.radioValue = 2 this.inputIf = true; diff --git a/src/pages/Submit/Submit.vue b/src/pages/Submit/Submit.vue index 510972b..385688d 100644 --- a/src/pages/Submit/Submit.vue +++ b/src/pages/Submit/Submit.vue @@ -16,10 +16,35 @@ :on-success="(res)=>{importSuccess(res)}" :before-remove="beforeRemove" :file-list="fileList" + :disabled="uploadStatus" class="import-submit-file" > - -
将文件拖到此处,或点击上传
+
+ + +
+ + + + + +
您已上传
+
+
+ +
将文件拖到此处,或点击上传
+
+ + +
只能上传zip/rar文件,且不超过1M
@@ -43,9 +68,7 @@ export default { data() { return { - fileList: [ - - ], + fileList: [], downloadActionUrl: "", @@ -53,6 +76,8 @@ export default { submitTime: [], onlineScript: false, onlineInter: '', + uploadStatus: false, + loading: true }; }, @@ -82,7 +107,7 @@ export default { // 文件上传等待 onUpload() { this.loading_text = "拼命导入中...请稍等"; - this.loading = true; + this.loading = null; }, // 上传文件结果 @@ -213,7 +238,7 @@ export default { userId: localStorage.getItem("userId") } this.$api.getApplyForPerson(applyInfo).then((res) => { - if (res.status == 0) { + if (res.status == 0 && res.data.applyInfo.status == 2) { //有报名信息 查询提交记录 var teamId = res.data.applyInfo.teamId var submitInfo = { @@ -229,8 +254,13 @@ export default { } ) + //设置上传状态 + this.uploadStatus = true + this.loading = false } else if (res.status == 10) { // 没有提交信息 + this.loading = false + } else { Message.error("权限不足或其他错误") } @@ -240,8 +270,12 @@ export default { Message.error("当前用户未报名") this.$router.go(-1) + } else if (res.status == 0 && res.data.applyInfo.status != 2) { + Message.error("当前用户未通过报名审核") + this.$router.go(-1) } else { Message.error("权限不足或其他错误") + this.$router.go(-1) } })