diff --git a/src/pages/Submit/Submit.vue b/src/pages/Submit/Submit.vue index 53cd9f8..0912af1 100644 --- a/src/pages/Submit/Submit.vue +++ b/src/pages/Submit/Submit.vue @@ -21,7 +21,7 @@
-
+
@@ -35,7 +35,7 @@ d="M1423.09935933 752.52420883l-0.60714098-0.91071264c-0.45535687-0.60714211-39.16065678-59.04455566-115.96411448-111.1069787-47.66064413-32.33030941-195.80328163-123.55338923-197.3211375-124.46410182l-0.60714213-0.45535686 62.0802651-98.35699769 0.60714212 0.45535685c1.51785472 1.06249899 145.41049969 110.95519346 183.66044275 144.49978598 13.66069362 11.99105365 34.75887673 32.48209465 62.99097882 61.16955248l212.49968584-307.82097291c39.16065678-56.6159872 189.883648-249.68713102 191.40150272-251.66034265l0.60714213-0.75892734 0.60714212 0.75892734 112.47304816 139.03550921-0.60714212 0.45535572c-2.12499682 1.82142635-210.22290375 190.03543325-264.10675199 243.61571216-43.41065045 43.25886521-149.05335125 172.42831645-208.24969328 245.74070784l-39.46422728 59.80348303z m-312.37453825-237.54429212c10.77676942 6.67856099 150.57120597 92.89271979 196.71399537 124.1605313 71.64275143 48.57135673 110.34805134 102.7587766 115.66054287 110.49983661l38.40172944-57.98205667c59.19634091-73.31239139 164.83904171-202.63362901 208.40147737-245.89249423 52.66956515-52.21420829 251.81212786-232.53537109 263.65139629-243.16035527l-111.1069787-137.21408285c-10.3214137 13.35712313-152.99977443 195.95506802-190.79436061 250.74963002l-213.56218482 309.33882765-0.60714211-0.60714098c-28.38388621-28.99102834-49.78564096-49.63385571-63.4463346-61.7766946-36.88387357-32.33030941-172.2765312-135.69622813-182.90151539-143.892645l-60.41062511 95.77664402z" p-id="2971" fill="#36ab60"> -
您已上传
+
@@ -69,7 +69,7 @@ export default { return { fileList: [], uploadActionUrl:"/api/comp/uploadImg", - + uploadMessage:"", uploadData: { fileName : this.$route.params.compId + '-submit-', @@ -82,8 +82,19 @@ export default { onlineScript: false, onlineInter: '', uploadStatus: false, + uploadIF: false, //是否上传过 loading: true, - file: '' + file: '', + submitPerDay:"", // 提交次数 + + submitInfo:{ + submitNum : null, + compId : '', + teamId: '', + file: '', + score: null, + status: 0 //已提交次数 + } }; }, @@ -120,13 +131,20 @@ export default { importSuccess(res) { if(res.status == 0){ - this.$message({ - showClose: true, - message: '上传报名表成功', - type: 'success' - }); - this.file=res.url + + this.submitInfo.file=res.url //TODO:更新提案提交信息到数据库 + this.submitInfo.compId = this.$route.params.compId + this.$api.insertSubmitInfo(this.submitInfo).then((res) =>{ + if (res.status == 0) { + this.$message({ + showClose: true, + message: '上传报名表成功', + type: 'success' + }); + } + }) + }else{ this.$message({ showClose: true, @@ -233,7 +251,10 @@ export default { if (res.status == 0) { //查询成功 this.onlineScript = res.data.onlineScript - this.onlineInter = res.date.onlineInter + this.onlineInter = res.data.onlineInter + + //提交次数 + this.submitPerDay = res.data.submitPerDay } else { Message.error("获取比赛信息失败") } @@ -246,23 +267,83 @@ export default { this.$api.getApplyForPerson(applyInfo).then((res) => { if (res.status == 0 && res.data.applyInfo.status == 2) { //有报名信息 查询提交记录 + this.submitInfo.teamId = res.data.applyInfo.teamId var teamId = res.data.applyInfo.teamId var submitInfo = { compId: this.$route.params.compId, teamId } this.$api.getSubmitInfo(submitInfo).then((res) => { + if (res.status == 0) { // 有提交信息 - this.fileList.push({ - name: res.data.file.split("/")[3], - url: res.data.file - } - ) + // 需要判断是否可以再次提交 以及其他提示信息 + /** + * 先判断提交次数设置 + */ + this.uploadIF = true + this.submitInfo.status = res.data.status + if (this.submitPerDay == 0) { + // 比赛全过程只可以提交一次 + if (res.data.status == -1) { + //被打回,可再次提交 + this.fileList.push({ + name: res.data.file.split("/")[3], + url: res.data.file + } + ) + this.uploadMessage="

您的提交已经被打回 可再次提交

" + this.loading = false + }else if (res.data.status == 0){ + // 已提交,不可再次提交 + this.fileList.push({ + name: res.data.file.split("/")[3], + url: res.data.file + } + ) + this.uploadMessage="

您已经提交作品,如有问题请联系管理员

" + + //设置上传状态 + this.uploadStatus = true + this.loading = false + } + }else if (this.submitPerDay == -1){ + //无限次 + this.fileList.push({ + name: res.data.file.split("/")[3], + url: res.data.file + } + ) + this.uploadMessage="

您已经提交作品,再次提交作品将会覆盖

" + this.loading = false + }else { + //可提交指定次数 + if (res.data.status < this.submitPerDay){ + //已提交次数 小于当日可提交次数 可以再次提交 + this.fileList.push({ + name: res.data.file.split("/")[3], + url: res.data.file + } + ) + var num = this.submitPerDay - res.data.status + this.uploadMessage="

您已经提交作品,本日还有"+ num + "次提交机会

" + this.loading = false + }else{ + //不可再次提交 + this.fileList.push({ + name: res.data.file.split("/")[3], + url: res.data.file + } + ) + this.uploadMessage="

您已经提交作品,本日提交机会已用尽" + + //设置上传状态 + this.uploadStatus = true + this.loading = false + } + } + // res.data.status == 0 - //设置上传状态 - this.uploadStatus = true - this.loading = false } else if (res.status == 10) { // 没有提交信息 this.loading = false diff --git a/src/utils/http/interface.js b/src/utils/http/interface.js index dca3713..fe22851 100644 --- a/src/utils/http/interface.js +++ b/src/utils/http/interface.js @@ -271,6 +271,18 @@ export const getSubmitInfo = (data) => { }) }; + +export const insertSubmitInfo = (data) => { + return axios({ + headers:{ + "Authorization": localStorage.getItem("systemToken") + }, + url: '/submit/insertSubmitInfo', + method: 'post', + data + }) +}; + // 默认全部倒出 // 根据需要进行 export default { @@ -298,5 +310,6 @@ export default { updateApplyInfo, getDivisionAndKind, getSubmitCust, - getSubmitInfo + getSubmitInfo, + insertSubmitInfo } \ No newline at end of file