From 121b50bc312adcf7c3f80753a554304cc05bc636 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Thu, 8 Dec 2022 14:49:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E8=B5=9B=E6=96=B0=E5=A2=9E=E8=81=94?= =?UTF-8?q?=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/api.js | 1 + src/views/match/add/index.vue | 19 +- src/views/match/add/set.vue | 169 ++++++++++ src/views/match/add/step1.vue | 12 +- src/views/match/add/step2.vue | 5 +- src/views/match/add/step3.vue | 598 ++++++++-------------------------- 6 files changed, 317 insertions(+), 487 deletions(-) create mode 100644 src/views/match/add/set.vue diff --git a/src/utils/api.js b/src/utils/api.js index 903dccb..e738c95 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -317,6 +317,7 @@ export default { addCompetitionRule: `competition/competition/rule/addCompetitionRule`, editCompetitionRule: `competition/competition/rule/editCompetitionRule`, getCompetitionRule: `competition/competition/rule/getCompetitionRule`, + queryCompetitionStageBySetupId: `competition/competition/stage/queryCompetitionStageBySetupId`, // 竞赛进展 addCompetitionProgress: `competition/competition/progress/addCompetitionProgress`, deleteCompetitionProgress: `competition/competition/progress/deleteCompetitionProgress`, diff --git a/src/views/match/add/index.vue b/src/views/match/add/index.vue index adfbbee..442eac5 100644 --- a/src/views/match/add/index.vue +++ b/src/views/match/add/index.vue @@ -25,7 +25,8 @@
- + +
保存{{ releaseType ? '草稿' : '' }} @@ -44,6 +45,7 @@ import util from "@/libs/util"; import quill from "@/components/quill"; import step1 from './step1' import step2 from './step2' +import step3 from './step3' export default { name: "add", data() { @@ -59,7 +61,8 @@ export default { components: { quill, step1, - step2 + step2, + step3 }, mounted() { @@ -70,10 +73,14 @@ export default { // if (this.submiting) return false this.$refs['step' + this.step].save(status, next, this.releaseType) }, - // 下一步 - next(id) { - this.setupId = id - this.step++ + // 发布后的逻辑 + next(next, id) { + if (!next) { + this.$router.push(`/match?page=${this.$store.state.matchPage}`) + } else if (next === 2) { + if (id) this.setupId = id + this.step++ + } }, // 预览 preview() { diff --git a/src/views/match/add/set.vue b/src/views/match/add/set.vue new file mode 100644 index 0000000..8cc1a0b --- /dev/null +++ b/src/views/match/add/set.vue @@ -0,0 +1,169 @@ + + + + + \ No newline at end of file diff --git a/src/views/match/add/step1.vue b/src/views/match/add/step1.vue index 54b541b..22b738c 100644 --- a/src/views/match/add/step1.vue +++ b/src/views/match/add/step1.vue @@ -559,14 +559,6 @@ export default { const id = this.form.competitionAnnexList.find(e => e.fileName === name).id id && this.$post(`${this.api.deleteAnnex}?id=${id}`).then(res => {}).catch(res => {}) }, - // 发布后的逻辑 - done(next, id) { - !next ? - this.$router.push(`/match?page=${this.$store.state.matchPage}`) : - next === 2 ? - this.$emit('next', id) : - '' - }, /** * @description 提交 * status 0:草稿,1发布 @@ -598,12 +590,12 @@ export default { if (this.form.id) { this.$post(this.api.editCompetition, form).then(res => { util.successMsg("修改成功"); - this.done(next) + this.$emit('next', next) }).catch(err => {}); } else { this.$post(this.api.addCompetition, form).then(({ setupId }) => { util.successMsg("创建成功"); - this.done(next, setupId) + this.$emit('next', next, setupId) }).catch(err => {}); } }, diff --git a/src/views/match/add/step2.vue b/src/views/match/add/step2.vue index a5905ef..44de9c2 100644 --- a/src/views/match/add/step2.vue +++ b/src/views/match/add/step2.vue @@ -280,7 +280,7 @@ export default { this.form.competitionStageList = list }, // 提交 - save(status, frame) { + save(status, next = 0) { const { form } = this if (form.rule === 1) { form.competitionStageList.map(e => { @@ -294,10 +294,9 @@ export default { }).catch(err => {}) } else { form.setupId = this.setupId - debugger - this.$post(this.api.addCompetitionRule, form).then(res => { util.successMsg("创建成功"); + this.$emit('next', next) }).catch(err => {}) } }, diff --git a/src/views/match/add/step3.vue b/src/views/match/add/step3.vue index 6f2dfed..10aabbf 100644 --- a/src/views/match/add/step3.vue +++ b/src/views/match/add/step3.vue @@ -1,132 +1,73 @@