You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

119 lines
3.8 KiB

<template>
<!-- 赛事管理 -->
<div>
<el-card shadow="hover" class="m-b-20">
<div class="flex-between">
3 years ago
<el-page-header @back="back" :content="name + '/管理'"></el-page-header>
</div>
</el-card>
<div class="page" style="margin-bottom: 24px">
<div class="tabs">
3 years ago
<a class="item" v-for="(item,index) in tabs" :key="index" :class="{active: index == active}" @click="tabChange(index)">{{ item }}</a>
</div>
<MatchDetail v-if="active == 'tab1'" ref="detail" />
<MatchArch v-if="active == 'tab2'" />
<MatchProgress v-else-if="active == 'tab3'" />
<notice v-else-if="active == 'tab4'" />
<MatchSignup v-else-if="active == 'tab5'" />
</div>
</div>
</template>
<script>
3 years ago
import Setting from "@/setting";
3 years ago
import MatchDetail from "../add";
import MatchArch from "./matchArch";
4 years ago
import MatchProgress from "./matchProgress";
3 years ago
import notice from "./notice";
4 years ago
import MatchSignup from "./matchSignup";
export default {
4 years ago
name: "matchManage",
data() {
return {
3 years ago
name: this.$route.query.name,
active: this.$route.query.tab || "tab1",
tabs: {
tab1: "大赛详情",
tab2: "大赛成绩管理",
tab3: "竞赛进展",
tab4: "公告通知",
tab5: "报名人员"
4 years ago
}
};
},
components: {
MatchDetail,
MatchArch,
MatchProgress,
3 years ago
notice,
MatchSignup
},
3 years ago
mounted() {
Setting.dynamicRoute && this.initTabs()
},
methods: {
3 years ago
initTabs() {
const btns = this.$store.state.btns
const tab1 = btns.includes('/match:管理:大赛详情')
const tab2 = btns.includes('/match:管理:竞赛进展')
const tab3 = btns.includes('/match:管理:公告通知')
const tab4 = btns.includes('/match:管理:报名人员')
3 years ago
tab1 || delete this.tabs.tab1
tab2 || delete this.tabs.tab2
tab3 || delete this.tabs.tab3
tab4 || delete this.tabs.tab4
3 years ago
const type = this.$route.query.tab
const keys = Object.keys(this.tabs)
this.active = keys.includes(type) ? type : keys[0]
},
3 years ago
back() {
3 years ago
this.handleSave(0) && this.backPage()
},
3 years ago
// 判断是否需要confirm
handleSave(i) {
// 如果是赛事详情,则要判断是否已经保存,未保存则提示是否保存
if (this.active === 'tab1') {
3 years ago
const detail = this.$refs.detail
if (detail.step < 4 && detail.$refs['step' + detail.step].updateTime) {
3 years ago
this.$confirm(`编辑的内容未保存,是否保存并且发布?`, '提示', {
3 years ago
type: 'warning'
}).then(() => {
3 years ago
detail.save(1, 1)
3 years ago
this.backOrTab(i)
}).catch(() => {
this.backOrTab(i)
})
} else {
this.backOrTab(i)
3 years ago
}
3 years ago
return false
} else {
return true
}
3 years ago
},
// 返回列表
3 years ago
backPage(){
this.$router.push(`/match?page=${this.$store.state.matchPage}&platformSource=${this.$store.state.platformSource}`)
3 years ago
},
// tab切换
3 years ago
tabSwitch(i) {
this.active = i
3 years ago
this.$router.push(`/match/manage?id=${this.$route.query.id}&tab=${i}&name=${this.name}`)
3 years ago
},
// 判断返回还是tab
3 years ago
backOrTab(i) {
i ? this.tabSwitch(i) : this.backPage()
},
// tab回调
3 years ago
tabChange(i) {
this.handleSave(i) && this.tabSwitch(i)
}
}
};
</script>
<style scoped>
</style>