mirror of
https://github.com/QingdaoU/OnlineJudgeFE.git
synced 2024-12-28 07:21:50 +00:00
about/judge display data from server,
adjust problem language logic.
This commit is contained in:
parent
9cc9c02fb6
commit
f0c1e34cd0
@ -60,7 +60,8 @@ Modern browsers and Internet Explorer 10+.
|
||||
## Development
|
||||
|
||||
```bash
|
||||
# we use webpack DllReference to decrease the build time, this command only needs execute once unless you upgrade the package in build/webpack.dll.conf.js
|
||||
# we use webpack DllReference to decrease the build time,
|
||||
# this command only needs execute once unless you upgrade the package in build/webpack.dll.conf.js
|
||||
npm run build:dll
|
||||
|
||||
# the dev-server will set proxy table to your backend
|
||||
|
@ -94,27 +94,22 @@ http {
|
||||
listen 80 default_server;
|
||||
server_name _;
|
||||
|
||||
location /static/avatar {
|
||||
expires max;
|
||||
alias /data/avatar;
|
||||
}
|
||||
location /static/upload {
|
||||
expires max;
|
||||
alias /data/upload;
|
||||
location /public {
|
||||
root /app/data;
|
||||
}
|
||||
location /api {
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header Host $host;
|
||||
|
||||
proxy_pass http://oj-backend:8080;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header Host $http_host;
|
||||
client_max_body_size 200M;
|
||||
}
|
||||
location /admin {
|
||||
alias /OJ_FE/dist/admin;
|
||||
try_files $uri $uri/ /admin/index.html;
|
||||
root /app/dist/admin;
|
||||
try_files $uri $uri/ /index.html =404;
|
||||
}
|
||||
location / {
|
||||
root /OJ_FE/dist;
|
||||
try_files $uri $uri/ /index.html;
|
||||
root /app/dist;
|
||||
try_files $uri $uri/ /index.html =404;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div style="display: inline-block;">
|
||||
<el-tooltip class="item" effect="dark" :content="name" placement="top">
|
||||
<el-button plain :icon="'el-icon-fa-' + icon" size="small">
|
||||
<el-button plain :icon="'el-icon-fa-' + icon" size="mini">
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
|
@ -18,7 +18,7 @@ Object.keys(filters).forEach(key => {
|
||||
Vue.filter(key, filters[key])
|
||||
})
|
||||
|
||||
Vue.use(Element, {locale})
|
||||
Vue.use(Element, {locale, size: 'small'})
|
||||
// Vue.use(VueI18n)
|
||||
Vue.component(IconBtn.name, IconBtn)
|
||||
Vue.component(Panel.name, Panel)
|
||||
|
@ -199,7 +199,6 @@
|
||||
visible: this.announcement.visible
|
||||
}
|
||||
}
|
||||
console.log(data)
|
||||
if (this.contestID) {
|
||||
data.contest_id = this.contestID
|
||||
funcName = this.mode === 'edit' ? 'updateContestAnnouncement' : 'createContestAnnouncement'
|
||||
|
@ -116,28 +116,33 @@
|
||||
|
||||
<Panel title="Generate User">
|
||||
<el-form :model="formGenerateUser" ref="formGenerateUser">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="10">
|
||||
<el-row type="flex" justify="space-between">
|
||||
<el-col :span="4">
|
||||
<el-form-item label="Prefix" prop="prefix">
|
||||
<el-input v-model="formGenerateUser.prefix" placeholder="Prefix"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item label="Suffix" prop="suffix">
|
||||
<el-input v-model="formGenerateUser.suffix" placeholder="Suffix"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item label="Start Number" prop="number_from" required>
|
||||
<el-input-number v-model="formGenerateUser.number_from" style="width: 100%"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item label="End Number" prop="number_to" required>
|
||||
<el-input-number v-model="formGenerateUser.number_to" style="width: 100%"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item label="Password Length" prop="password_length" required>
|
||||
<el-input v-model="formGenerateUser.password_length"
|
||||
placeholder="Password Length"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="10" :offset="1">
|
||||
<el-form-item label="Suffix" prop="suffix">
|
||||
<el-input v-model="formGenerateUser.suffix" placeholder="Suffix"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="End Number" prop="number_to" required>
|
||||
<el-input-number v-model="formGenerateUser.number_to" style="width: 100%"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form-item>
|
||||
|
@ -494,7 +494,6 @@
|
||||
return
|
||||
}
|
||||
if (this.problem.spj) {
|
||||
console.log(this.problem)
|
||||
if (!this.problem.spj_code) {
|
||||
this.error.spj = 'Spj code is required'
|
||||
this.$error(this.error.spj)
|
||||
|
@ -25,10 +25,8 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import utils from '@/utils/utils'
|
||||
import { codemirror } from 'vue-codemirror-lite'
|
||||
import storage from '@/utils/storage'
|
||||
import {STORAGE_KEY} from '@/utils/constants'
|
||||
import api from '@oj/api'
|
||||
|
||||
// theme
|
||||
import 'codemirror/theme/monokai.css'
|
||||
@ -97,25 +95,16 @@
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
this.getLanguages()
|
||||
utils.getLanguages().then(languages => {
|
||||
let mode = {}
|
||||
languages.forEach(lang => {
|
||||
mode[lang.name] = lang.content_type
|
||||
})
|
||||
this.mode = mode
|
||||
})
|
||||
this.editor.focus()
|
||||
},
|
||||
methods: {
|
||||
getLanguages () {
|
||||
let languages = storage.get(STORAGE_KEY.languages)
|
||||
if (languages) {
|
||||
this.mode = languages
|
||||
return
|
||||
}
|
||||
api.getLanguages().then(res => {
|
||||
let mode = {}
|
||||
res.data.data.languages.forEach(language => {
|
||||
mode[language.name] = language.content_type
|
||||
})
|
||||
this.mode = mode
|
||||
storage.set(STORAGE_KEY.languages, mode)
|
||||
})
|
||||
},
|
||||
onEditorCodeChange (newCode) {
|
||||
this.$emit('update:value', newCode)
|
||||
},
|
||||
|
@ -65,7 +65,7 @@
|
||||
<Dropdown-menu slot="list">
|
||||
<Dropdown-item name="/user-home">Home</Dropdown-item>
|
||||
<Dropdown-item name="/status?myself=1">Submissions</Dropdown-item>
|
||||
<Dropdown-item name="/setting">Settings</Dropdown-item>
|
||||
<Dropdown-item name="/setting/profile">Settings</Dropdown-item>
|
||||
<Dropdown-item v-if="isAdmin" name="/admin">Management</Dropdown-item>
|
||||
<Dropdown-item divided name="/logout">Logout</Dropdown-item>
|
||||
</Dropdown-menu>
|
||||
|
@ -4,22 +4,8 @@
|
||||
<div slot="title">Compiler & Judger</div>
|
||||
<div class="content markdown-body">
|
||||
<ul>
|
||||
<li>C (GCC 4.8)
|
||||
<pre>gcc -DONLINE_JUDGE -O2 -w -fmax-errors=3 -std=c99 {src_path} -lm -o {exe_path}</pre>
|
||||
</li>
|
||||
|
||||
<li>C++ (G++ 4.8)
|
||||
<pre>g++ -DONLINE_JUDGE -O2 -w -fmax-errors=3 -std=c++11 {src_path} -lm -o {exe_path}</pre>
|
||||
</li>
|
||||
|
||||
<li>JAVA (OpenJDK 1.7)
|
||||
<pre>
|
||||
javac {src_path} -d {exe_dir} -encoding UTF8
|
||||
java -cp {exe_dir} -Xss1M -Xms16M -Xmx{max_memory}k -Djava.security.manager -Djava.security.policy=={policy} -Djava.awt.headless=true Main</pre>
|
||||
</li>
|
||||
|
||||
<li>Python (Python2.7)
|
||||
<pre>python -m py_compile {src_path}</pre>
|
||||
<li v-for="lang in languages">{{lang.name}} ( {{lang.description}} )
|
||||
<pre>{{lang.config.compile.compile_command}}</pre>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -31,7 +17,7 @@ java -cp {exe_dir} -Xss1M -Xms16M -Xmx{max_memory}k -Djava.security.manager -Dja
|
||||
<ul>
|
||||
<li><b>Pending & Juding</b> : You solution will be judged soon, please wait for result</li>
|
||||
<li><b>Compile Error</b> : Failed to compile your source code. Click on the link to see compiler's output.
|
||||
</li>
|
||||
</li>
|
||||
<li><b>Accepted</b> : Congratulations. Your solution is correct.</li>
|
||||
<li><b>Wrong Answer</b> : Your program's output doesn't match judger's answer.</li>
|
||||
<li>
|
||||
@ -52,7 +38,22 @@ java -cp {exe_dir} -Xss1M -Xms16M -Xmx{max_memory}k -Djava.security.manager -Dja
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import utils from '@/utils/utils'
|
||||
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
languages: []
|
||||
}
|
||||
},
|
||||
beforeRouteEnter (to, from, next) {
|
||||
utils.getLanguages().then(languages => {
|
||||
next(vm => {
|
||||
vm.languages = languages
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
|
@ -65,7 +65,7 @@
|
||||
<div v-else-if="this.contestID && !OIContestRealTimePermission && submissionExists">
|
||||
<Alert type="success" show-icon>You have submitted a solution.</Alert>
|
||||
</div>
|
||||
<div class="status" v-if="contestEnded">
|
||||
<div v-if="contestEnded">
|
||||
<Alert type="warning" show-icon>Contest has ended</Alert>
|
||||
</div>
|
||||
</Col>
|
||||
@ -213,7 +213,7 @@
|
||||
problemID: '',
|
||||
submitting: false,
|
||||
code: '',
|
||||
language: 'C++',
|
||||
language: undefined,
|
||||
submissionId: '',
|
||||
result: {
|
||||
result: 9
|
||||
@ -268,9 +268,10 @@
|
||||
this.changePie(res.data.data)
|
||||
|
||||
// 在beforeRouteEnter中修改了, 说明本地有code, 无需加载template
|
||||
if (this.language !== 'C++' || this.code !== '') {
|
||||
if (this.language || this.code !== '') {
|
||||
return
|
||||
}
|
||||
this.language = this.problem.languages[0]
|
||||
let template = this.problem.template
|
||||
if (template && template[this.language]) {
|
||||
this.code = template[this.language]
|
||||
@ -316,12 +317,16 @@
|
||||
},
|
||||
onChangeLang (newLang) {
|
||||
if (this.problem.template[newLang]) {
|
||||
this.$Modal.confirm({
|
||||
content: 'The problem has template for ' + newLang + ', Do you want to replace your code with template?',
|
||||
onOk: () => {
|
||||
this.code = this.problem.template[newLang]
|
||||
}
|
||||
})
|
||||
if (this.code.trim() === '') {
|
||||
this.code = this.problem.template[newLang]
|
||||
} else {
|
||||
this.$Modal.confirm({
|
||||
content: 'The problem has template for ' + newLang + ', Do you want to replace your code with template?',
|
||||
onOk: () => {
|
||||
this.code = this.problem.template[newLang]
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
this.language = newLang
|
||||
},
|
||||
|
@ -3,7 +3,7 @@
|
||||
<Card :padding="0">
|
||||
<div class="flex-container">
|
||||
<div class="menu">
|
||||
<Menu accordion @on-select="goRoute" activeName="" style="text-align: center;" width="auto">
|
||||
<Menu accordion @on-select="goRoute" :activeName="activeName" style="text-align: center;" width="auto">
|
||||
<div class="avatar-editor">
|
||||
<div class="avatar-container">
|
||||
<img class="avatar" :src="profile.avatar"/>
|
||||
@ -43,7 +43,10 @@
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['profile'])
|
||||
...mapGetters(['profile']),
|
||||
activeName () {
|
||||
return this.$route.path
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -109,7 +109,7 @@ export const USER_TYPE = {
|
||||
|
||||
export const STORAGE_KEY = {
|
||||
AUTHED: 'authed',
|
||||
PROBLEM_CODE: 'problem_code',
|
||||
PROBLEM_CODE: 'problemCode',
|
||||
languages: 'languages'
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,7 @@
|
||||
import Vue from 'vue'
|
||||
import storage from '@/utils/storage'
|
||||
import { STORAGE_KEY } from '@/utils/constants'
|
||||
import ojAPI from '@oj/api'
|
||||
|
||||
function submissionMemoryFormat (memory) {
|
||||
if (memory === undefined) return '--'
|
||||
@ -28,7 +31,7 @@ function filterEmptyValue (object) {
|
||||
return query
|
||||
}
|
||||
|
||||
// 按指定字符数截断添加换行,非英文字符按指定字符的半数添加
|
||||
// 按指定字符数截断添加换行,非英文字符按指定字符的半数截断
|
||||
function breakLongWords (value, length = 16) {
|
||||
let re
|
||||
if (escape(value).indexOf('%u') === -1) {
|
||||
@ -76,11 +79,28 @@ function downloadFile (url) {
|
||||
})
|
||||
}
|
||||
|
||||
function getLanguages () {
|
||||
return new Promise((resolve, reject) => {
|
||||
let languages = storage.get(STORAGE_KEY.languages)
|
||||
if (languages) {
|
||||
resolve(languages)
|
||||
}
|
||||
ojAPI.getLanguages().then(res => {
|
||||
let languages = res.data.data.languages
|
||||
storage.set(STORAGE_KEY.languages, languages)
|
||||
resolve(languages)
|
||||
}, err => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export default {
|
||||
submissionMemoryFormat: submissionMemoryFormat,
|
||||
submissionTimeFormat: submissionTimeFormat,
|
||||
getACRate: getACRate,
|
||||
filterEmptyValue: filterEmptyValue,
|
||||
breakLongWords: breakLongWords,
|
||||
downloadFile: downloadFile
|
||||
downloadFile: downloadFile,
|
||||
getLanguages: getLanguages
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user