Skip to content

Commit

Permalink
支持多个分类
Browse files Browse the repository at this point in the history
  • Loading branch information
ZnPdCo committed Dec 3, 2024
1 parent 223bce5 commit df3dce6
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 14 deletions.
4 changes: 2 additions & 2 deletions backend/package-lock.json

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

2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rating-system-backend",
"version": "0.3.0",
"version": "0.4.0",
"scripts": {
"format": "npx prettier --write app/ && python -m black app/",
"lint": "pylint app/"
Expand Down
4 changes: 2 additions & 2 deletions frontend/package-lock.json

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

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rating-system-frontend",
"version": "0.3.0",
"version": "0.4.0",
"private": true,
"type": "module",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/views/AdminView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function addUpdateLinks(row, id) {
placeholder="额外信息"
type="text"
name="info"
value='{"links": "https://codeforces.com/contest/2024/problem/A", "pid": "2024A", "type": "未分类"}'
value='{"links": "https://codeforces.com/contest/2024/problem/A", "pid": "2024A", "type": ["未分类"]}'
/>
</div>
<button type="submit" class="ui blue submit button">提交</button>
Expand Down Expand Up @@ -176,7 +176,7 @@ function addUpdateLinks(row, id) {
placeholder="额外信息"
type="text"
name="info"
value='{"links": "https://codeforces.com/contest/2024/problem/A", "pid": "2024A", "type": "未分类"}'
value='{"links": "https://codeforces.com/contest/2024/problem/A", "pid": "2024A", "type": ["未分类"]}'
/>
</div>
<button type="submit" class="ui blue submit button">提交</button>
Expand Down
14 changes: 8 additions & 6 deletions frontend/src/views/ProblemsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const voteModal = ref(false)
const pid = ref(1)
const showVotesModal = ref(false)
const selected = ref()
const options = ref([{ text: '未分类', value: '未分类' }])
const options = ref([])
const detailsModal = ref(false)
const loggedIn = window.loggedIn
Expand Down Expand Up @@ -160,12 +160,14 @@ function showTable() {
let table = $('#problems-table tbody')
table.empty()
for (let i = 0; i < problemsData.length; i++) {
var type = '未分类'
var type = ['未分类']
if ('type' in problemsData[i]['info']) type = problemsData[i]['info']['type']
if (!Object.values(options.value).some((el) => el.value == type)) {
options.value.push({ text: type, value: type })
}
if (selected.value != undefined && selected.value.value != type) continue
type.forEach(function (t) {
if (!options.value.some((el) => el.value == t)) {
options.value.push({ text: t, value: t })
}
})
if (selected.value != undefined && !type.includes(selected.value.value)) continue
let row = $('<tr>')
;(function (data) {
row.append($('<td>').text(data['pid']))
Expand Down

0 comments on commit df3dce6

Please sign in to comment.