contest rank chart 的状态在整个contest view内保存

admin problem的一些调整
This commit is contained in:
zema1 2017-11-02 15:30:13 +08:00
parent 91f1d91db6
commit 5e3385fef1
7 changed files with 38 additions and 9 deletions

View File

@ -265,11 +265,13 @@
data () {
return {
rules: {
_id: {required: true, message: 'Display ID is required', trigger: 'blur'},
title: {required: true, message: 'Title is required', trigger: 'blur'},
input_description: {required: true, message: 'Input Description is required', trigger: 'blur'},
output_description: {required: true, message: 'Output Description is required', trigger: 'blur'}
},
mode: '',
contest: {},
problem: {
languages: []
},
@ -326,10 +328,11 @@
}
let contestID = this.$route.params.contestId
if (contestID) {
this.problem.contest_id = contestID
this.problem.contest_id = this.reProblem.contest_id = contestID
this.disableRuleType = true
api.getContest(contestID).then(res => {
this.problem.rule_type = this.reProblem.rule_type = res.data.data.rule_type
this.contest = res.data.data
})
}
@ -511,6 +514,10 @@
'create-contest-problem': 'createContestProblem',
'edit-contest-problem': 'editContestProblem'
}[this.routeName]
// edit contest problem , contest_id
if (funcName === 'editContestProblem') {
this.problem.contest_id = this.contest.id
}
api[funcName](this.problem).then(res => {
if (this.routeName === 'create-contest-problem' || this.routeName === 'edit-contest-problem') {
this.$router.push({name: 'contest-problem-list', params: {contestId: this.$route.params.contestId}})

View File

@ -3,6 +3,8 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="renderer" content="webkit"/>
<title>OnlineJudge</title>
</head>
<style>

View File

@ -9,7 +9,8 @@ const state = {
created_by: {}
},
contestProblems: [],
contestMenuVisible: true
showMenu: true,
showChart: true
}
const getters = {
@ -86,7 +87,10 @@ const mutations = {
state.contest = payload.contest
},
[types.CHANGE_CONTEST_MENU_VISIBLE] (state, payload) {
state.contestMenuVisible = payload.visible
state.showMenu = payload.visible
},
[types.CHANGE_CONTEST_CHART_VISIBLE] (state, payload) {
state.showChart = payload.visible
},
[types.CHANGE_CONTEST_PROBLEMS] (state, payload) {
state.contestProblems = payload.contestProblems
@ -94,7 +98,8 @@ const mutations = {
[types.CLEAR_CONTEST] (state) {
state.contest = {created_by: {}}
state.contestProblems = []
state.contestMenuVisible = true
state.showMenu = true
state.showChart = true
},
[types.NOW] (state, payload) {
state.now = payload.now

View File

@ -18,5 +18,6 @@ export default keyMirror({
'CHANGE_CONTEST': null,
'CHANGE_CONTEST_PROBLEMS': null,
'CHANGE_CONTEST_MENU_VISIBLE': null,
'CHANGE_CONTEST_CHART_VISIBLE': null,
'CLEAR_CONTEST': null
})

View File

@ -127,7 +127,7 @@
},
computed: {
...mapState({
showMenu: state => state.contest.contestMenuVisible,
showMenu: state => state.contest.showMenu,
contest: state => state.contest.contest,
contest_table: state => [state.contest.contest]
}),

View File

@ -47,7 +47,6 @@
return {
limit: 10,
total: 0,
showChart: true,
contestID: '',
columns: [
{
@ -297,9 +296,17 @@
'contest': state => state.contest.contest,
'contestProblems': state => state.contest.contestProblems
}),
showChart: {
get () {
return this.$store.state.contest.showChart
},
set (value) {
this.$store.commit(types.CHANGE_CONTEST_CHART_VISIBLE, {visible: value})
}
},
showMenu: {
get () {
return this.$store.state.contest.contestMenuVisible
return this.$store.state.contest.showMenu
},
set (value) {
this.$store.commit(types.CHANGE_CONTEST_MENU_VISIBLE, {visible: value})

View File

@ -45,7 +45,6 @@
return {
limit: 10,
total: 0,
showChart: true,
contestID: '',
columns: [
{
@ -224,9 +223,17 @@
'contest': state => state.contest.contest,
'contestProblems': state => state.contest.contestProblems
}),
showChart: {
get () {
return this.$store.state.contest.showChart
},
set (value) {
this.$store.commit(types.CHANGE_CONTEST_CHART_VISIBLE, {visible: value})
}
},
showMenu: {
get () {
return this.$store.state.contest.contestMenuVisible
return this.$store.state.contest.showMenu
},
set (value) {
this.$store.commit(types.CHANGE_CONTEST_MENU_VISIBLE, {visible: value})