Branch_d40a2540
wangchenguang 2 years ago
parent 7887d28243
commit 13d0e57d9a
  1. 34
      src/pages/match/add/index.vue
  2. 6
      src/pages/match/add/step1.vue
  3. 6
      src/pages/match/add/step2.vue
  4. 4
      src/pages/match/add/step3.vue
  5. 14
      src/pages/match/manage/index.vue
  6. 1
      src/pages/project/list/index.vue

@ -106,6 +106,21 @@ export default {
step3, step3,
step4 step4
}, },
// ,
beforeRouteLeave(to, from, next) {
const { updateTime } = this.$refs['step' + this.step]
if(updateTime){
this.$confirm(`您所更改的内容未更新,是否更新?`, '提示', {
type: 'warning'
}).then(() => {
this.save(this.step,to.path,next)
}).catch(() => {
next()
})
}else{
next()
}
},
mounted() { mounted() {
this.getPer() this.getPer()
}, },
@ -134,8 +149,11 @@ export default {
this.loadIns.close() this.loadIns.close()
}, },
// //
save(status, next = 0) { save(status, next = 0,cb) {
this.$refs['step' + this.step].save(status, next, this.releaseType) console.log('status=>',status)
console.log('cb=>',cb)
console.log('this.step=>',this.step)
this.$refs['step' + this.step].save(status, next, this.releaseType,cb)
}, },
// //
prev() { prev() {
@ -154,7 +172,10 @@ export default {
} }
}, },
// //
next(next, setupId, competitionId) { next(next, setupId, competitionId,type) {
console.log('next==>',next)
console.log('setupId==>',setupId)
console.log('competitionId==>',competitionId)
if (!next) { if (!next) {
this.$router.push(`/match?page=${this.$store.state.matchPage}`) this.$router.push(`/match?page=${this.$store.state.matchPage}`)
} else if (next === 2) { } else if (next === 2) {
@ -167,6 +188,13 @@ export default {
this.step++ this.step++
} else if (next === 1) { } else if (next === 1) {
this.step-- this.step--
} else {
console.log(99999999)
if(typeof setupId === 'function') {
setupId()
}else if(typeof type === 'function') {
type()
}
} }
}, },
// //

@ -589,7 +589,7 @@ export default {
* next 0返回1不做任何操作2下一步 * next 0返回1不做任何操作2下一步
* releaseType 发布类型0发布信息1完整比赛 * releaseType 发布类型0发布信息1完整比赛
* */ * */
save(status, next = 0, releaseType = 0) { save(status, next = 0, releaseType = 0,cb) {
const { form } = this const { form } = this
form.sponsor = this.sponsorList.filter(d => d).join(); form.sponsor = this.sponsorList.filter(d => d).join();
form.undertaker = this.undertakerList.filter(d => d).join(); form.undertaker = this.undertakerList.filter(d => d).join();
@ -633,7 +633,7 @@ export default {
this.updateTime = 0 this.updateTime = 0
this.$parent.hideLoad() this.$parent.hideLoad()
util.successMsg("修改成功"); util.successMsg("修改成功");
this.$emit('next', next) this.$emit('next', next,cb)
}).catch(err => { }).catch(err => {
this.$parent.hideLoad() this.$parent.hideLoad()
}); });
@ -642,7 +642,7 @@ export default {
this.updateTime = 0 this.updateTime = 0
this.$parent.hideLoad() this.$parent.hideLoad()
util.successMsg("创建成功"); util.successMsg("创建成功");
this.$emit('next', next, setupId, competitionId) this.$emit('next', next, setupId, competitionId,cb)
}).catch(err => { }).catch(err => {
this.$parent.hideLoad() this.$parent.hideLoad()
}); });

@ -295,7 +295,7 @@ export default {
} }
}, },
// //
save(status, next = 0) { save(status, next = 0,releaseType,cb) {
let { form } = this let { form } = this
const { rule } = form const { rule } = form
let invalid = 0 let invalid = 0
@ -396,7 +396,7 @@ export default {
this.$post(this.api.editCompetitionRule, form).then(res => { this.$post(this.api.editCompetitionRule, form).then(res => {
this.$parent.hideLoad() this.$parent.hideLoad()
util.successMsg("修改成功"); util.successMsg("修改成功");
this.$emit('next', next) this.$emit('next', next,cb)
}).catch(err => { }).catch(err => {
this.$parent.hideLoad() this.$parent.hideLoad()
}) })
@ -405,7 +405,7 @@ export default {
this.$post(this.api.addCompetitionRule, form).then(res => { this.$post(this.api.addCompetitionRule, form).then(res => {
this.$parent.hideLoad() this.$parent.hideLoad()
util.successMsg("创建成功"); util.successMsg("创建成功");
this.$emit('next', next) this.$emit('next', next,cb)
}).catch(err => { }).catch(err => {
this.$parent.hideLoad() this.$parent.hideLoad()
}) })

@ -201,7 +201,7 @@ export default {
this.competitionId && this.$post(`${this.api.publishCompetition}?competitionId=${this.competitionId}&publishStatus=1`).then(res => {}).catch(err => {}) this.competitionId && this.$post(`${this.api.publishCompetition}?competitionId=${this.competitionId}&publishStatus=1`).then(res => {}).catch(err => {})
}, },
// //
save(status, next = 0) { save(status, next = 0,releaseType,cb) {
const { form } = this const { form } = this
if (!form.length) { if (!form.length) {
this.$parent.hideLoad() this.$parent.hideLoad()
@ -280,7 +280,7 @@ export default {
// //
status && this.publish(status) status && this.publish(status)
util.successMsg((status ? '发布' : '保存') + '成功') util.successMsg((status ? '发布' : '保存') + '成功')
this.$emit('next', next) this.$emit('next', next,cb)
}).catch(err => { }).catch(err => {
this.$parent.hideLoad() this.$parent.hideLoad()
}) })

@ -61,6 +61,20 @@ export default {
mounted() { mounted() {
Setting.dynamicRoute && this.initTabs() Setting.dynamicRoute && this.initTabs()
}, },
beforeRouteLeave(to, from, next) {
const detail = this.$refs.detail
if (detail.step < 4 && detail.$refs['step' + detail.step].updateTime) {
this.$confirm(`编辑的内容未保存,是否保存并且发布?`, '提示.......', {
type: 'warning'
}).then(() => {
detail.save(1,to.path,next)
}).catch(() => {
next()
})
} else {
next()
}
},
methods: { methods: {
initTabs() { initTabs() {
const { btns } = this const { btns } = this

@ -254,6 +254,7 @@ export default {
}, },
mounted() { mounted() {
this.getSystemData() this.getSystemData()
this.getData()
if(this.queryDataStatus.platformId) { if(this.queryDataStatus.platformId) {
this.queryData = this.queryDataStatus this.queryData = this.queryDataStatus
} }

Loading…
Cancel
Save