Skip to content

Commit

Permalink
Big update QingdaoU#3
Browse files Browse the repository at this point in the history
  • Loading branch information
lvdat committed Feb 26, 2021
1 parent 4a130d5 commit a2a9669
Show file tree
Hide file tree
Showing 5 changed files with 207 additions and 5 deletions.
142 changes: 140 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"each-async": "^1.1.1",
"echarts": "^3.8.5",
"element-ui": "^2.3.7",
"eslint-plugin-vue": "^7.6.0",
"font-awesome": "^4.7.0",
"highlight.js": "^9.12.0",
"iview": "^2.13.0",
Expand Down
60 changes: 59 additions & 1 deletion src/pages/oj/views/general/Announcements.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,40 @@
</template>
</transition-group>
</Panel>
<Row v-if="!isContest" type="flex" :gutter="10" style="margin-top: 70px;">
<Col :span="12">
<Panel shadow style="padding-top: 0px;padding-bottom: 10px;">
<div slot="title" style="margin-left: -10px;margin-bottom: -10px;">Bài tập mới up lên</div>
<ul style="margin-left: 40px;margin-bottom: 20px;">
<li style="padding: 5px 0px;" v-for="p in problemList" :key="p.id">
<a class="link-style" :href="'/problem/' + p._id">{{p._id}} - {{p.title}}</a>
</li>
</ul>
</Panel>
</Col>
<Col :span="12">
<Panel shadow style="padding: 10px;padding-bottom: 10px;">
<div slot="title" style="margin-left: -10px;margin-bottom: -10px;">TOP 20 PRO</div>
<ol style="margin-left: 40px;margin-bottom: 20px;">
<li style="padding: 6px 0px;" v-for="u in dataRank" :key="u.id">
<a :style="'font-weight: 600;color: ' + u.color" :href="'/user-home?username=' + u.user.username"
:title=" u.title + ' ' + u.user.username">
{{u.user.username}}
</a> - đã giải {{u.accepted_number}} bài
</li>
</ol>
</Panel>
</Col>
</Row>
</Col>
</Row>
</template>

<script>
import api from '@oj/api'
import Pagination from '@oj/components/Pagination'
import { mapState } from 'vuex'
import { RULE_TYPE, USER_TYPE } from '@/utils/constants'
export default {
name: 'Announcement',
components: {
Expand All @@ -51,6 +79,17 @@
return {
limit: 10,
total: 10,
dataRank: [],
rankLimit: 20,
problemList: [],
problemLimit: 15,
query: {
keyword: '',
difficulty: '',
tag: '',
page: 1,
orderby: '-create_time'
},
btnLoading: false,
announcements: [],
announcement: '',
Expand All @@ -59,6 +98,8 @@
},
mounted () {
this.init()
this.getRankData()
this.getProblemList()
},
methods: {
init () {
Expand All @@ -68,6 +109,23 @@
this.getAnnouncementList()
}
},
getRankData () {
api.getUserRank(0, this.rankLimit, RULE_TYPE.ACM).then(res => {
this.dataRank = res.data.data.results
for (let i in this.dataRank) {
this.dataRank[i]['color'] = '#365899'
this.dataRank[i]['title'] = 'User'
}
}).catch(() => {
})
},
getProblemList () {
let offset = 0
api.getProblemList(offset, this.problemLimit, this.query).then(res => {
this.problemList = res.data.data.results
console.log(res.data.data.results)
})
},
getAnnouncementList (page = 1) {
this.btnLoading = true
api.getAnnouncementList((page - 1) * this.limit, this.limit).then(res => {
Expand Down
4 changes: 4 additions & 0 deletions src/pages/oj/views/problem/Problem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,9 @@
},
beforeRouteEnter (to, from, next) {
let problemCode = storage.get(buildProblemCodeKey(to.params.problemID, to.params.contestID))
if (!problemCode) {
problemCode = storage.get(buildProblemCodeKey('prefer_ide'))
}
if (problemCode) {
next(vm => {
vm.language = problemCode.language
Expand All @@ -318,6 +321,7 @@
mounted () {
this.$store.commit(types.CHANGE_CONTEST_ITEM_VISIBLE, {menu: false})
this.init()
this.getProblemList()
},
methods: {
...mapActions(['changeDomTitle']),
Expand Down
5 changes: 3 additions & 2 deletions src/pages/oj/views/submission/SubmissionList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<script>
import { mapGetters } from 'vuex'
import api from '@oj/api'
import { JUDGE_STATUS, USER_TYPE, RULE_TYPE } from '@/utils/constants'
import { RULE_TYPE, JUDGE_STATUS, USER_TYPE } from '@/utils/constants'
import utils from '@/utils/utils'
import time from '@/utils/time'
import Pagination from '@/pages/oj/components/Pagination'
Expand Down Expand Up @@ -197,6 +197,7 @@
},
mounted () {
this.init()
this.getRankData()
this.JUDGE_STATUS = Object.assign({}, JUDGE_STATUS)
// 去除submitting的状态 和 两个
delete this.JUDGE_STATUS['9']
Expand All @@ -222,7 +223,7 @@
this.dataRank = res.data.data.result
for (let i in this.dataRank) {
this.dataRank[i]['color'] = '#365899'
this.dataRank[i]['title'] = 'User'
this.dataRank[i]['title'] = 'Xem trang cá nhân'
}
}).catch(() => {
})
Expand Down

0 comments on commit a2a9669

Please sign in to comment.