Skip to content

Commit

Permalink
Merge branch 'forum'
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry-zklcdc committed Aug 1, 2020
2 parents 3237cbc + 8ca8758 commit deb4728
Show file tree
Hide file tree
Showing 18 changed files with 1,356 additions and 10 deletions.
6 changes: 6 additions & 0 deletions src/i18n/admin/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ export const m = {
Footer: 'Footer',
Allow_Register: 'Allow Register',
Submission_List_Show_All: 'Submission List Show All',
Sort: 'Sort',
Sort_Name: 'Sort Name',
Sort_Permission: 'Sort Permission',
Add_Sort: 'Add Sort',
Allow_Post: 'Allow Post',
Allow_Reply: 'Allow Reply',
// JudgeServer.vue
Judge_Server_Token: 'Judge Server Token',
Judge_Server_Info: 'Judge Server',
Expand Down
6 changes: 6 additions & 0 deletions src/i18n/admin/zh-CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ export const m = {
Footer: '页脚',
Allow_Register: '是否允许注册',
Submission_List_Show_All: '显示全部题目的提交',
Sort: '板块',
Sort_Name: '板块名称',
Sort_Permission: '板块权限',
Add_Sort: '添加板块',
Allow_Post: '是否允许发帖',
Allow_Reply: '是否允许回复',
// JudgeServer.vue
Judge_Server_Token: '判题服务器接口',
Judge_Server_Info: '判题服务器',
Expand Down
6 changes: 6 additions & 0 deletions src/i18n/admin/zh-TW.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ export const m = {
Footer: '頁尾',
Allow_Register: '是否允許註冊',
Submission_List_Show_All: '顯示全部題目的提交',
Sort: '板塊',
Sort_Name: '板塊名稱',
Sort_Permission: '板塊許可權',
Add_Sort: '添加板塊',
Allow_Post: '是否允許發帖',
Allow_Reply: '是否允許回復',
// JudgeServer.vue
Judge_Server_Token: 'Judge 伺服器 Token',
Judge_Server_Info: 'Judge 伺服器',
Expand Down
19 changes: 19 additions & 0 deletions src/i18n/oj/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,25 @@ export const m = {
AboutUs: 'About Us',
App: 'APP',
IDE: 'Online IDE',
Forum: 'Forum',
Forum_List: 'Post List',
Forum_Title: 'Title',
Forum_Content: 'content',
Forum_Post_Time: 'Post Time',
Forum_Last_Update_Time: 'Last Update Time',
Forum_Post_Information: 'Post Information',
Forum_Post: 'Post',
Forum_Edit: 'Edit',
Forum_Delete: 'Delete',
Forum_Top: 'Top',
Forum_Light: 'Light',
Forum_Nice: 'Nice',
Forum_ToolBox: 'Tool Box',
Forum_ConfirmDelete: 'Do you Confirm Delete?',
Forum_Reply: 'Reply',
Forum_Reply_List: 'Reply List',
Forum_No_Reply: 'No Reply',
Sort: 'Plate',
Judger: 'Judger',
FAQ: 'FAQ',
Login: 'Login',
Expand Down
19 changes: 19 additions & 0 deletions src/i18n/oj/zh-CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,25 @@ export const m = {
AboutUs: '关于我们',
App: '应用',
IDE: '在线 IDE',
Forum: '讨论版',
Forum_List: '帖子列表',
Forum_Title: '标题',
Forum_Content: '内容',
Forum_Post_Time: '发布时间',
Forum_Last_Update_Time: '最后更新时间',
Forum_Post_Information: '帖子信息',
Forum_Post: '发帖',
Forum_Edit: '编辑',
Forum_Delete: '删除',
Forum_Top: '置顶',
Forum_Light: '高亮',
Forum_Nice: '精品',
Forum_ToolBox: '工具箱',
Forum_ConfirmDelete: '确认删除?',
Forum_Reply: '回复',
Forum_Reply_List: '回复列表',
Forum_No_Reply: '暂无回复',
Sort: '板块',
Judger: '评测机信息',
FAQ: '常见问题',
Login: '登录',
Expand Down
19 changes: 19 additions & 0 deletions src/i18n/oj/zh-TW.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,25 @@ export const m = {
About: '關於',
App: '應用',
IDE: '線上IDE',
Forum: '討論版',
Forum_List: '帖子列表',
Forum_Title: '標題',
Forum_Content: '內容',
Forum_Post_Time: '發佈時間',
Forum_Last_Update_Time: '最後更新時間',
Forum_Post_Information: '帖子資訊',
Forum_Post: '發帖',
Forum_Edit: '編輯',
Forum_Delete: '删除',
Forum_Top: '置頂',
Forum_Light: '高亮',
Forum_Nice: '精品',
Forum_ToolBox: '工具箱',
Forum_ConfirmDelete: '確認删除?',
Forum_Reply: '回復',
Forum_Reply_List: '回復清單',
Forum_No_Reply: '暫無回復',
Sort: '板塊',
AboutUs: '關於我們',
Judger: 'Judge 說明',
FAQ: '常見問題',
Expand Down
90 changes: 84 additions & 6 deletions src/pages/admin/views/general/Conf.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,28 +62,79 @@
</el-form-item>
</el-col>
<el-col :span="24">
<el-col :span="12">
<el-form-item :label="$t('m.Allow_Register')" label-width="200px">
<el-col :span="6">
<el-form-item :label="$t('m.Allow_Register')" label-width="150px">
<el-switch
v-model="websiteConfig.allow_register"
active-color="#13ce66"
inactive-color="#ff4949">
</el-switch>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('m.Submission_List_Show_All')" label-width="200px">
<el-col :span="6">
<el-form-item :label="$t('m.Submission_List_Show_All')" label-width="150px">
<el-switch
v-model="websiteConfig.submission_list_show_all"
active-color="#13ce66"
inactive-color="#ff4949">
</el-switch>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item :label="$t('m.Allow_Post')" label-width="150px">
<el-switch
v-model="websiteConfig.allow_forum_post"
active-color="#13ce66"
inactive-color="#ff4949">
</el-switch>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item :label="$t('m.Allow_Reply')" label-width="150px">
<el-switch
v-model="websiteConfig.allow_forum_reply"
active-color="#13ce66"
inactive-color="#ff4949">
</el-switch>
</el-form-item>
</el-col>
</el-col>
<el-col :span="24">
<div>
<el-form-item v-for="(forum_sort, index) in websiteConfig.forum_sort" :key="$t('m.Sort') + index">
<Accordion :title="$t('m.Sort') + (index + 1)" style="margin-left: -100px;">
<el-button type="warning" size="small" icon="el-icon-delete" slot="header" @click="deleteSort(index)">
Delete
</el-button>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item :label="$t('m.Sort_Name')" required>
<el-input
:placeholder="$t('m.Sort_Name')"
v-model="forum_sort.name">
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('m.Sort_Permission')" required>
<el-select v-model="forum_sort.permission" placeholder="All">
<el-option label="All" value="All"></el-option>
<el-option label="Super Admin" value="Super Admin"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</Accordion>
</el-form-item>
</div>
<div class="add-sample-btn">
<button type="button" class="add-sorts" @click="addSort()"><i class="el-icon-plus"></i>{{$t('m.Add_Sort')}}
</button>
</div>
</el-col>
</el-row>
</el-form>
<save @click.native="saveWebsiteConfig"></save>
<save @click.native="saveWebsiteConfig" style="margin-top: 20px;"></save>
</Panel>

<Panel :title="$t('About Us Config')">
Expand All @@ -102,13 +153,15 @@
</template>

<script>
import Accordion from '../../components/Accordion'
import Simditor from '../../components/Simditor.vue'
import api from '../../api.js'
export default {
name: 'Conf',
components: {
Simditor
Simditor,
Accordion
},
data () {
return {
Expand Down Expand Up @@ -187,6 +240,12 @@
}).catch(() => {
})
},
addSort () {
this.websiteConfig.forum_sort.push({name: '', permission: ''})
},
deleteSort (index) {
this.websiteConfig.forum_sort.splice(index, 1)
},
saveAboutUs (data) {
if (this.onit === false) {
api.updateAboutUs(this.aboutus).then(() => {
Expand Down Expand Up @@ -214,3 +273,22 @@
}
}
</script>

<style lang="less" scoped>
.add-sorts {
width: 100%;
background-color: #fff;
border: 1px dashed #aaa;
outline: none;
cursor: pointer;
color: #666;
height: 35px;
font-size: 14px;
&:hover {
background-color: #f9fafc;
}
i {
margin-right: 10px;
}
}
</style>
3 changes: 3 additions & 0 deletions src/pages/oj/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@
}
.ivu-card {
background: @color2;
}
.ivu-layout {
background: transparent;
}
.ivu-menu-light.ivu-menu-horizontal .ivu-menu-submenu:hover{
color: @color;
Expand Down
59 changes: 59 additions & 0 deletions src/pages/oj/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,65 @@ export default {
},
UserSighin () {
return ajax('sighin', 'post')
},
getForumList (offset, limit, searchParams) {
let params = {
paging: true,
offset,
limit
}
Object.keys(searchParams).forEach((element) => {
if (searchParams[element]) {
params[element] = searchParams[element]
}
})
return ajax('forumpost', 'get', {
params: params
})
},
getForum (forumpostID) {
return ajax('forumpost', 'get', {
params: {
forumpost_id: forumpostID
}
})
},
submitFourmPost (data) {
return ajax('forumpost', 'post', {
data
})
},
deleteFourmPost (forumpostID) {
let params = {
forumpost_id: forumpostID
}
return ajax('forumpost', 'delete', {
params: params
})
},
getForumReplyList (offset, limit, forumpostID) {
let params = {
paging: true,
offset,
limit,
fa_id: forumpostID
}
return ajax('forumreply', 'get', {
params: params
})
},
submitFourmReply (data) {
return ajax('forumreply', 'post', {
data
})
},
deleteFourmReply (id) {
let params = {
id: id
}
return ajax('forumreply', 'delete', {
params: params
})
}
}

Expand Down
1 change: 1 addition & 0 deletions src/pages/oj/components/CodeMirror.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
// mode
import 'codemirror/mode/clike/clike.js'
import 'codemirror/mode/python/python.js'
import 'codemirror/mode/go/go.js'
// active-line.js
import 'codemirror/addon/selection/active-line.js'
Expand Down
3 changes: 3 additions & 0 deletions src/pages/oj/components/NavBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
<Menu-item name="/IDE">
{{$t('m.IDE')}}
</Menu-item>
<Menu-item name="/Forum">
{{$t('m.Forum')}}
</Menu-item>
</Submenu>
<Submenu name="about">
<template slot="title">
Expand Down
Loading

0 comments on commit deb4728

Please sign in to comment.