mirror of
https://github.com/QingdaoU/OnlineJudgeFE.git
synced 2025-01-16 17:25:35 +00:00
init
This commit is contained in:
parent
f061a648bf
commit
f25f5e94f7
@ -17,6 +17,15 @@ module.exports = {
|
||||
// allow async-await
|
||||
'generator-star-spacing': 0,
|
||||
// allow debugger during development
|
||||
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
|
||||
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
|
||||
"space-before-function-paren": ["error", {
|
||||
"anonymous": "always",
|
||||
"named": "never",
|
||||
"asyncArrow": "always"
|
||||
}],
|
||||
"no-irregular-whitespace": ["error", {
|
||||
"skipComments": true,
|
||||
"skipTemplates": true
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<div>
|
||||
<SideMenu></SideMenu>
|
||||
<Navbar></Navbar>
|
||||
</div>
|
||||
<div class="content-app">
|
||||
<router-view></router-view>
|
||||
@ -14,8 +14,9 @@
|
||||
|
||||
<script>
|
||||
import 'font-awesome/css/font-awesome.min.css'
|
||||
import SideMenu from './components/SideMenu.vue'
|
||||
import api from './api.js'
|
||||
// import SideMenu from './components/SideMenu.vue'
|
||||
import Navbar from './components/Navbar.vue'
|
||||
// import api from './api.js'
|
||||
|
||||
export default {
|
||||
name: 'app',
|
||||
@ -25,12 +26,12 @@
|
||||
}
|
||||
},
|
||||
components: {
|
||||
SideMenu
|
||||
Navbar
|
||||
},
|
||||
methods: {},
|
||||
mounted () {
|
||||
api.login('root', 'rootroot').then(res => {})
|
||||
}
|
||||
methods: {}
|
||||
// mounted () {
|
||||
// api.login('root', 'rootroot').then(res => {})
|
||||
// }
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -42,15 +43,15 @@
|
||||
|
||||
a {
|
||||
background-color: transparent;
|
||||
-webkit-text-decoration-skip: objects
|
||||
-webkit-text-decoration-skip: objects;
|
||||
}
|
||||
|
||||
a:active, a:hover {
|
||||
outline-width: 0
|
||||
a:active,
|
||||
a:hover {
|
||||
outline-width: 0;
|
||||
}
|
||||
|
||||
img {
|
||||
border-style: none
|
||||
border-style: none;
|
||||
}
|
||||
|
||||
body {
|
||||
@ -69,7 +70,7 @@
|
||||
.content-app {
|
||||
padding-top: 20px;
|
||||
padding-right: 10px;
|
||||
padding-left: 210px;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.footer {
|
||||
|
@ -25,7 +25,7 @@ Vue.http.interceptors.push((request, next) => {
|
||||
export default {
|
||||
// 登录
|
||||
login(username, password) {
|
||||
return ajax('login', 'get', {
|
||||
return ajax('/api/login', 'post', {
|
||||
options: {
|
||||
params: {
|
||||
username,
|
||||
@ -79,7 +79,11 @@ export default {
|
||||
},
|
||||
// 获取用户列表
|
||||
getUserList(offset, limit, keyword) {
|
||||
let params = {paging: true, offset, limit}
|
||||
let params = {
|
||||
paging: true,
|
||||
offset,
|
||||
limit
|
||||
}
|
||||
if (keyword) {
|
||||
params.keyword = keyword
|
||||
}
|
||||
@ -161,7 +165,11 @@ export default {
|
||||
})
|
||||
},
|
||||
getContestList(offset, limit, keyword) {
|
||||
let params = {paging: true, offset, limit}
|
||||
let params = {
|
||||
paging: true,
|
||||
offset,
|
||||
limit
|
||||
}
|
||||
if (keyword) {
|
||||
params.keyword = keyword
|
||||
}
|
||||
@ -217,7 +225,11 @@ export default {
|
||||
})
|
||||
},
|
||||
getProblemList(offset, limit, keyword) {
|
||||
let params = {paging: true, offset, limit}
|
||||
let params = {
|
||||
paging: true,
|
||||
offset,
|
||||
limit
|
||||
}
|
||||
if (keyword) {
|
||||
params.keyword = keyword
|
||||
}
|
||||
@ -228,7 +240,12 @@ export default {
|
||||
})
|
||||
},
|
||||
getContestProblemList(offset, limit, keyword, contestId) {
|
||||
let params = {paging: true, offset, limit, contest_id: contestId}
|
||||
let params = {
|
||||
paging: true,
|
||||
offset,
|
||||
limit,
|
||||
contest_id: contestId
|
||||
}
|
||||
if (keyword) {
|
||||
params.keyword = keyword
|
||||
}
|
||||
|
38
oj/src/components/Navbar.vue
Normal file
38
oj/src/components/Navbar.vue
Normal file
@ -0,0 +1,38 @@
|
||||
<template>
|
||||
<el-menu theme="dark" :default-active="activeIndex" class="el-menu-demo" mode="horizontal">
|
||||
<el-row :gutter="10">
|
||||
<el-col :xs="3" :sm="3" :lg="3"> </el-col>
|
||||
<el-col :xs="2" :sm="2" :lg="2">
|
||||
<div style="color:#bfcbd9;margin-top:16px;font-size:20px;">QDUOJ</div>
|
||||
</el-col>
|
||||
<el-col :xs="16" :sm="16" :lg="16">
|
||||
<el-menu-item index="1">题目</el-menu-item>
|
||||
<el-menu-item index="2">提交</el-menu-item>
|
||||
<el-menu-item index="3">比赛</el-menu-item>
|
||||
<el-menu-item index="4">排名</el-menu-item>
|
||||
<el-menu-item index="5">帮助</el-menu-item>
|
||||
</el-col>
|
||||
<el-col :xs="3" :sm="3" :lg="3">
|
||||
<el-submenu index="2">
|
||||
<template slot="title">Hieda no Chiaki
|
||||
</template>
|
||||
<el-menu-item index="2-1">我的主页</el-menu-item>
|
||||
<el-menu-item index="2-2">我的提交</el-menu-item>
|
||||
<el-menu-item index="2-3">设置</el-menu-item>
|
||||
<el-menu-item index="2-4">退出</el-menu-item>
|
||||
</el-submenu>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-menu>
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
activeIndex: '1'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
@ -27,12 +27,17 @@ Vue.component(Cancel.name, Cancel)
|
||||
|
||||
// 引入 view 组件
|
||||
import { Announcement, User, Conf, JudgeServer, Problem, Contest, ContestList,
|
||||
ContestAnnouncement, ProblemList } from './views'
|
||||
ContestAnnouncement, ProblemList, Login } from './views'
|
||||
|
||||
const router = new VueRouter({
|
||||
mode: 'history',
|
||||
scrollBehavior: () => ({ y: 0 }),
|
||||
routes: [
|
||||
{
|
||||
path: '/login',
|
||||
name: 'login',
|
||||
component: Login
|
||||
},
|
||||
{
|
||||
path: '/announcement',
|
||||
name: 'announcement',
|
||||
|
@ -7,8 +7,9 @@ import ProblemList from './problem/ProblemList.vue'
|
||||
import ContestList from './contest/ContestList.vue'
|
||||
import Contest from './contest/Contest.vue'
|
||||
import ContestAnnouncement from './contest/Announcement.vue'
|
||||
import Login from './user/Login.vue'
|
||||
|
||||
export {
|
||||
Announcement, User, Conf, JudgeServer, Problem, ProblemList, Contest,
|
||||
ContestList, ContestAnnouncement
|
||||
ContestList, ContestAnnouncement, Login
|
||||
}
|
||||
|
66
oj/src/views/user/Login.vue
Normal file
66
oj/src/views/user/Login.vue
Normal file
@ -0,0 +1,66 @@
|
||||
<template>
|
||||
<div class="center">
|
||||
<el-card class="box-card" id="login-card">
|
||||
|
||||
<div slot="header" class="clearfix" id="login-title">
|
||||
<span style="line-height: 36px;">用户登录</span>
|
||||
</div>
|
||||
|
||||
<el-form :label-position="labelPosition" label-width="80px" :model="formLabelAlign">
|
||||
<el-form-item label="账号">
|
||||
<el-input v-model="formLabelAlign.name"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="密码">
|
||||
<el-input v-model="formLabelAlign.password" type="password"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="二次验证">
|
||||
<el-input v-model="formLabelAlign.totp"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="onSubmit">立即登录</el-button>
|
||||
<el-button>用户注册</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import api from '../../api.js'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
labelPosition: 'top',
|
||||
formLabelAlign: {
|
||||
name: '',
|
||||
region: '',
|
||||
type: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onSubmit() {
|
||||
console.log('submit!')
|
||||
api.login(this.formLabelAlign.name, this.formLabelAlign.password).then(function (res) {
|
||||
console.log(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="css">
|
||||
.center{
|
||||
margin-top: 50px;
|
||||
}
|
||||
#login-card{
|
||||
max-width: 400px;
|
||||
margin: auto;
|
||||
}
|
||||
#login-title{
|
||||
text-align: center;
|
||||
font-size: 20px;
|
||||
}
|
||||
</style>
|
Loading…
x
Reference in New Issue
Block a user