mirror of
https://github.com/QingdaoU/OnlineJudgeFE.git
synced 2025-01-01 09:31:42 +00:00
problem添加快捷编辑;
修复development mode问题
This commit is contained in:
parent
9a72d11a40
commit
6b238b3c94
@ -1,6 +1,7 @@
|
||||
const webpack = require('webpack');
|
||||
const path = require('path');
|
||||
const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
|
||||
const config = require('../config')
|
||||
|
||||
const vendors = [
|
||||
'vue/dist/vue.esm.js',
|
||||
@ -23,6 +24,9 @@ module.exports = {
|
||||
library: '[name]_dll',
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': config.build.env
|
||||
}),
|
||||
new webpack.optimize.ModuleConcatenationPlugin(),
|
||||
new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /zh-cn/),
|
||||
new UglifyJSPlugin({
|
||||
|
@ -108,6 +108,10 @@ http {
|
||||
|
||||
proxy_pass http://oj-backend:8080;
|
||||
}
|
||||
location /admin {
|
||||
root /OJ_FE/dist/admin;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
location / {
|
||||
root /OJ_FE/dist;
|
||||
try_files $uri $uri/ /index.html;
|
||||
|
@ -12,18 +12,6 @@
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
[class^="el-icon-fa"], [class*=" el-icon-fa"] {
|
||||
display: inline-block;
|
||||
font: normal normal normal 14px/1 FontAwesome !important;
|
||||
font-size: inherit;
|
||||
text-rendering: auto;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
@import url("../../../node_modules/font-awesome/less/font-awesome");
|
||||
@fa-css-prefix: el-icon-fa;
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
@ -11,6 +11,7 @@ import Panel from './components/Panel.vue'
|
||||
import IconBtn from './components/btn/IconBtn.vue'
|
||||
import Save from './components/btn/Save.vue'
|
||||
import Cancel from './components/btn/Cancel.vue'
|
||||
import './style.less'
|
||||
|
||||
// register global utility filters.
|
||||
Object.keys(filters).forEach(key => {
|
||||
|
11
src/pages/admin/style.less
Normal file
11
src/pages/admin/style.less
Normal file
@ -0,0 +1,11 @@
|
||||
[class^="el-icon-fa"], [class*=" el-icon-fa"] {
|
||||
display: inline-block;
|
||||
font: normal normal normal 14px/1 FontAwesome !important;
|
||||
font-size: inherit;
|
||||
text-rendering: auto;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
@import url("../../../node_modules/font-awesome/less/font-awesome");
|
||||
@fa-css-prefix: el-icon-fa;
|
@ -13,6 +13,7 @@
|
||||
element-loading-text="loading"
|
||||
ref="table"
|
||||
:data="problemList"
|
||||
@cell-dblclick="handleDblclick"
|
||||
style="width: 100%">
|
||||
<el-table-column
|
||||
width="100"
|
||||
@ -21,12 +22,19 @@
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
width="150"
|
||||
prop="_id"
|
||||
label="Display ID">
|
||||
<template slot-scope="{row}">
|
||||
<span v-show="!row.isEditing">{{row._id}}</span>
|
||||
<el-input v-show="row.isEditing" v-model="row._id" @keyup.enter.native="handleInlineEdit(row)"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="title"
|
||||
label="Title">
|
||||
<template slot-scope="{row}">
|
||||
<span v-show="!row.isEditing">{{row.title}}</span>
|
||||
<el-input v-show="row.isEditing" v-model="row.title" @keyup.enter.native="handleInlineEdit(row)"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="created_by.username"
|
||||
@ -48,7 +56,7 @@
|
||||
<el-switch v-model="scope.row.visible"
|
||||
on-text=""
|
||||
off-text=""
|
||||
@change="handleVisibleSwitch(scope.row)">
|
||||
@change="handleInlineEdit(scope.row)">
|
||||
</el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -106,6 +114,9 @@
|
||||
this.getProblemList(this.currentPage)
|
||||
},
|
||||
methods: {
|
||||
handleDblclick (row) {
|
||||
row.isEditing = true
|
||||
},
|
||||
goEdit (problemId) {
|
||||
if (this.routeName === 'problem-list') {
|
||||
this.$router.push({name: 'edit-problem', params: {problemId}})
|
||||
@ -131,6 +142,9 @@
|
||||
api[funcName]((page - 1) * this.pageSize, this.pageSize, this.keyword, this.contestId).then(res => {
|
||||
this.loading = false
|
||||
this.total = res.data.data.total
|
||||
for (let problem of res.data.data.results) {
|
||||
problem.isEditing = false
|
||||
}
|
||||
this.problemList = res.data.data.results
|
||||
}, res => {
|
||||
this.loading = false
|
||||
@ -142,18 +156,24 @@
|
||||
}, () => {
|
||||
})
|
||||
},
|
||||
handleVisibleSwitch (row) {
|
||||
let data = Object.assign({}, row)
|
||||
let funcName = ''
|
||||
if (this.contestId) {
|
||||
data.contest_id = this.contestId
|
||||
funcName = 'editContestProblem'
|
||||
} else {
|
||||
funcName = 'editProblem'
|
||||
}
|
||||
api[funcName](data).then(res => {
|
||||
this.currentChange(this.currentPage)
|
||||
}).catch()
|
||||
handleInlineEdit (row) {
|
||||
this.$confirm('Sure to update the problem?', '', {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
let data = Object.assign({}, row)
|
||||
let funcName = ''
|
||||
if (this.contestId) {
|
||||
data.contest_id = this.contestId
|
||||
funcName = 'editContestProblem'
|
||||
} else {
|
||||
funcName = 'editProblem'
|
||||
}
|
||||
api[funcName](data).then(res => {
|
||||
this.getProblemList(this.currentPage)
|
||||
}).catch()
|
||||
}).catch(() => {
|
||||
this.getProblemList(this.currentPage)
|
||||
})
|
||||
},
|
||||
downloadTestCase (problemID) {
|
||||
let url = '/admin/test_case?problem_id=' + problemID
|
||||
|
@ -1,10 +1,10 @@
|
||||
const pieColorMap = {
|
||||
'AC': {color: '#19be6b'},
|
||||
'WA': {color: '#ed3f14'},
|
||||
'TLE': {color: '#495060'},
|
||||
'MLE': {color: '#80848f'},
|
||||
'TLE': {color: '#ff9300'},
|
||||
'MLE': {color: '#f7de00'},
|
||||
'RE': {color: '#ff6104'},
|
||||
'CE': {color: '#ff9900'},
|
||||
'CE': {color: '#80848f'},
|
||||
'PAC': {color: '#2d8cf0'}
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
<Alert :type="status.type" showIcon>
|
||||
<span class="title">{{status.statusName}}</span>
|
||||
<div slot="desc" class="content">
|
||||
<template v-if="submission.result == -2">
|
||||
<template v-if="isCE">
|
||||
<pre>{{submission.statistic_info.err_info}}</pre>
|
||||
</template>
|
||||
<template v-else>
|
||||
@ -18,7 +18,7 @@
|
||||
</Col>
|
||||
|
||||
<!--后台返info就显示出来, 权限控制放后台 -->
|
||||
<Col v-if="submission.info && submission.result != -2" :span="20">
|
||||
<Col v-if="submission.info && !isCE" :span="20">
|
||||
<Alert type="warning">
|
||||
<div class="admin-info-content">
|
||||
<Icon type="information-circled" color="#f90"></Icon>
|
||||
@ -117,7 +117,7 @@
|
||||
getSubmission () {
|
||||
api.getSubmission(this.$route.params.id).then(res => {
|
||||
let data = res.data.data
|
||||
if (data.info && !data.info.data[0].score) {
|
||||
if (data.info && data.info.data && !data.info.data[0].score) {
|
||||
this.columns.splice(this.columns.length - 1, 1)
|
||||
}
|
||||
this.submission = data
|
||||
@ -139,6 +139,9 @@
|
||||
statusName: JUDGE_STATUS[this.submission.result].name,
|
||||
color: JUDGE_STATUS[this.submission.result].color
|
||||
}
|
||||
},
|
||||
isCE () {
|
||||
return this.submission.result === -2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -193,8 +193,9 @@
|
||||
this.contestID = this.$route.params.contestID
|
||||
let query = this.$route.query
|
||||
this.problemID = query.problemID
|
||||
this.myself = query.myself === '1'
|
||||
this.result = query.result || ''
|
||||
this.formFilter.myself = query.myself === '1'
|
||||
this.formFilter.result = query.result || ''
|
||||
this.formFilter.username = query.username || ''
|
||||
this.page = parseInt(query.page) || 1
|
||||
this.routeName = this.$route.name
|
||||
this.getSubmissions()
|
||||
|
Loading…
Reference in New Issue
Block a user