adjust codemirror line-height, fixed template languages order

This commit is contained in:
zema1 2017-11-26 17:41:22 +08:00
parent 28249159df
commit 32655f1f79
3 changed files with 12 additions and 3 deletions

View File

@ -5,6 +5,7 @@
import { codemirror } from 'vue-codemirror-lite'
import 'codemirror/mode/clike/clike.js'
import 'codemirror/mode/python/python.js'
import 'codemirror/theme/solarized.css'
export default {
name: 'CodeMirror',
@ -15,6 +16,7 @@
mode: 'text/x-csrc',
lineNumbers: true,
lineWrapping: false,
theme: 'solarized',
tabSize: 4,
line: true,
foldGutter: true,

View File

@ -102,6 +102,7 @@
</el-form-item>
</el-col>
<el-col :span="8">
{{problem.languages}}
<el-form-item label="Languages" :error="error.languages" required>
<el-checkbox-group v-model="problem.languages">
<el-tooltip class="spj-radio" v-for="lang in allLanguage.languages" :key="'spj'+lang.name" effect="dark"
@ -363,7 +364,9 @@
},
'problem.languages' (newVal) {
let data = {}
for (let item of newVal) {
// use deep copy to avoid infinite loop
let languages = JSON.parse(JSON.stringify(newVal)).sort()
for (let item of languages) {
if (this.template[item] === undefined) {
let langConfig = this.allLanguage.languages.find(lang => {
return lang.name === item
@ -528,6 +531,7 @@
}
}
}
this.problem.languages = this.problem.languages.sort()
this.problem.template = {}
for (let k in this.template) {
if (this.template[k].checked) {

View File

@ -107,7 +107,8 @@
time_cost: '',
memory_cost: ''
}
}
},
isSplice: false
}
},
mounted () {
@ -117,8 +118,9 @@
getSubmission () {
api.getSubmission(this.$route.params.id).then(res => {
let data = res.data.data
if (data.info && data.info.data && !data.info.data[0].score) {
if (data.info && data.info.data && !data.info.data[0].score && !this.isSplice) {
this.columns.splice(this.columns.length - 1, 1)
this.isSplice = true
}
this.submission = data
}, () => {
@ -128,6 +130,7 @@
let data = {id: this.submission.id, shared: shared}
api.updateSubmission(data).then(res => {
this.getSubmission()
this.$success('Succeeded')
}, () => {
})
}