This commit is contained in:
2024-01-25 14:17:10 +08:00
parent 87fcb12960
commit 6464a1eee6
16 changed files with 191 additions and 148 deletions

148
package-lock.json generated
View File

@@ -13,7 +13,7 @@
"@vueuse/core": "^10.7.2",
"@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-vue": "^5.1.12",
"axios": "1.6.5",
"axios": "^1.6.6",
"canvas-confetti": "^1.9.2",
"chart.js": "^4.4.1",
"codemirror": "^6.0.1",
@@ -23,22 +23,22 @@
"naive-ui": "^2.37.3",
"normalize.css": "^8.0.1",
"pinia": "^2.1.7",
"vue": "^3.4.14",
"vue": "^3.4.15",
"vue-chartjs": "^5.3.0",
"vue-codemirror": "^6.1.1",
"vue-router": "^4.2.5"
},
"devDependencies": {
"@types/node": "^20.11.5",
"@types/node": "^20.11.6",
"@vitejs/plugin-legacy": "^5.2.0",
"@vitejs/plugin-vue": "^5.0.3",
"prettier": "^3.2.4",
"terser": "^5.27.0",
"typescript": "^5.3.3",
"unplugin-auto-import": "^0.17.3",
"unplugin-auto-import": "^0.17.4",
"unplugin-vue-components": "^0.26.0",
"unplugin-vue-markdown": "^0.25.2",
"vite": "^5.0.11",
"vite": "^5.0.12",
"vue-tsc": "^1.8.27"
}
},
@@ -2737,9 +2737,9 @@
"dev": true
},
"node_modules/@types/node": {
"version": "20.11.5",
"resolved": "https://registry.npmmirror.com/@types/node/-/node-20.11.5.tgz",
"integrity": "sha512-g557vgQjUUfN76MZAN/dt1z3dzcUsimuysco0KeluHgrPdJXkP/XdAURgyO2W9fZWHRtRBiVKzKn8vyOAwlG+w==",
"version": "20.11.6",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.6.tgz",
"integrity": "sha512-+EOokTnksGVgip2PbYbr3xnR7kZigh4LbybAfBAw5BpnQ+FqBYUsvCEjYd70IXKlbohQ64mzEYmMtlWUY8q//Q==",
"dev": true,
"dependencies": {
"undici-types": "~5.26.4"
@@ -2888,12 +2888,12 @@
}
},
"node_modules/@vue/compiler-core": {
"version": "3.4.14",
"resolved": "https://registry.npmmirror.com/@vue/compiler-core/-/compiler-core-3.4.14.tgz",
"integrity": "sha512-ro4Zzl/MPdWs7XwxT7omHRxAjMbDFRZEEjD+2m3NBf8YzAe3HuoSEZosXQo+m1GQ1G3LQ1LdmNh1RKTYe+ssEg==",
"version": "3.4.15",
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.4.15.tgz",
"integrity": "sha512-XcJQVOaxTKCnth1vCxEChteGuwG6wqnUHxAm1DO3gCz0+uXKaJNx8/digSz4dLALCy8n2lKq24jSUs8segoqIw==",
"dependencies": {
"@babel/parser": "^7.23.6",
"@vue/shared": "3.4.14",
"@vue/shared": "3.4.15",
"entities": "^4.5.0",
"estree-walker": "^2.0.2",
"source-map-js": "^1.0.2"
@@ -2901,31 +2901,34 @@
},
"node_modules/@vue/compiler-core/node_modules/entities": {
"version": "4.5.0",
"resolved": "https://registry.npmmirror.com/entities/-/entities-4.5.0.tgz",
"resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
"integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==",
"engines": {
"node": ">=0.12"
},
"funding": {
"url": "https://github.com/fb55/entities?sponsor=1"
}
},
"node_modules/@vue/compiler-dom": {
"version": "3.4.14",
"resolved": "https://registry.npmmirror.com/@vue/compiler-dom/-/compiler-dom-3.4.14.tgz",
"integrity": "sha512-nOZTY+veWNa0DKAceNWxorAbWm0INHdQq7cejFaWM1WYnoNSJbSEKYtE7Ir6lR/+mo9fttZpPVI9ZFGJ1juUEQ==",
"version": "3.4.15",
"resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.4.15.tgz",
"integrity": "sha512-wox0aasVV74zoXyblarOM3AZQz/Z+OunYcIHe1OsGclCHt8RsRm04DObjefaI82u6XDzv+qGWZ24tIsRAIi5MQ==",
"dependencies": {
"@vue/compiler-core": "3.4.14",
"@vue/shared": "3.4.14"
"@vue/compiler-core": "3.4.15",
"@vue/shared": "3.4.15"
}
},
"node_modules/@vue/compiler-sfc": {
"version": "3.4.14",
"resolved": "https://registry.npmmirror.com/@vue/compiler-sfc/-/compiler-sfc-3.4.14.tgz",
"integrity": "sha512-1vHc9Kv1jV+YBZC/RJxQJ9JCxildTI+qrhtDh6tPkR1O8S+olBUekimY0km0ZNn8nG1wjtFAe9XHij+YLR8cRQ==",
"version": "3.4.15",
"resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.4.15.tgz",
"integrity": "sha512-LCn5M6QpkpFsh3GQvs2mJUOAlBQcCco8D60Bcqmf3O3w5a+KWS5GvYbrrJBkgvL1BDnTp+e8q0lXCLgHhKguBA==",
"dependencies": {
"@babel/parser": "^7.23.6",
"@vue/compiler-core": "3.4.14",
"@vue/compiler-dom": "3.4.14",
"@vue/compiler-ssr": "3.4.14",
"@vue/shared": "3.4.14",
"@vue/compiler-core": "3.4.15",
"@vue/compiler-dom": "3.4.15",
"@vue/compiler-ssr": "3.4.15",
"@vue/shared": "3.4.15",
"estree-walker": "^2.0.2",
"magic-string": "^0.30.5",
"postcss": "^8.4.33",
@@ -2934,12 +2937,12 @@
},
"node_modules/@vue/compiler-sfc/node_modules/@jridgewell/sourcemap-codec": {
"version": "1.4.15",
"resolved": "https://registry.npmmirror.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz",
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz",
"integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg=="
},
"node_modules/@vue/compiler-sfc/node_modules/magic-string": {
"version": "0.30.5",
"resolved": "https://registry.npmmirror.com/magic-string/-/magic-string-0.30.5.tgz",
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.5.tgz",
"integrity": "sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==",
"dependencies": {
"@jridgewell/sourcemap-codec": "^1.4.15"
@@ -2949,12 +2952,12 @@
}
},
"node_modules/@vue/compiler-ssr": {
"version": "3.4.14",
"resolved": "https://registry.npmmirror.com/@vue/compiler-ssr/-/compiler-ssr-3.4.14.tgz",
"integrity": "sha512-bXT6+oAGlFjTYVOTtFJ4l4Jab1wjsC0cfSfOe2B4Z0N2vD2zOBSQ9w694RsCfhjk+bC2DY5Gubb1rHZVii107Q==",
"version": "3.4.15",
"resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.4.15.tgz",
"integrity": "sha512-1jdeQyiGznr8gjFDadVmOJqZiLNSsMa5ZgqavkPZ8O2wjHv0tVuAEsw5hTdUoUW4232vpBbL/wJhzVW/JwY1Uw==",
"dependencies": {
"@vue/compiler-dom": "3.4.14",
"@vue/shared": "3.4.14"
"@vue/compiler-dom": "3.4.15",
"@vue/shared": "3.4.15"
}
},
"node_modules/@vue/devtools-api": {
@@ -2988,53 +2991,53 @@
}
},
"node_modules/@vue/reactivity": {
"version": "3.4.14",
"resolved": "https://registry.npmmirror.com/@vue/reactivity/-/reactivity-3.4.14.tgz",
"integrity": "sha512-xRYwze5Q4tK7tT2J4uy4XLhK/AIXdU5EBUu9PLnIHcOKXO0uyXpNNMzlQKuq7B+zwtq6K2wuUL39pHA6ZQzObw==",
"version": "3.4.15",
"resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.4.15.tgz",
"integrity": "sha512-55yJh2bsff20K5O84MxSvXKPHHt17I2EomHznvFiJCAZpJTNW8IuLj1xZWMLELRhBK3kkFV/1ErZGHJfah7i7w==",
"dependencies": {
"@vue/shared": "3.4.14"
"@vue/shared": "3.4.15"
}
},
"node_modules/@vue/runtime-core": {
"version": "3.4.14",
"resolved": "https://registry.npmmirror.com/@vue/runtime-core/-/runtime-core-3.4.14.tgz",
"integrity": "sha512-qu+NMkfujCoZL6cfqK5NOfxgXJROSlP2ZPs4CTcVR+mLrwl4TtycF5Tgo0QupkdBL+2kigc6EsJlTcuuZC1NaQ==",
"version": "3.4.15",
"resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.4.15.tgz",
"integrity": "sha512-6E3by5m6v1AkW0McCeAyhHTw+3y17YCOKG0U0HDKDscV4Hs0kgNT5G+GCHak16jKgcCDHpI9xe5NKb8sdLCLdw==",
"dependencies": {
"@vue/reactivity": "3.4.14",
"@vue/shared": "3.4.14"
"@vue/reactivity": "3.4.15",
"@vue/shared": "3.4.15"
}
},
"node_modules/@vue/runtime-dom": {
"version": "3.4.14",
"resolved": "https://registry.npmmirror.com/@vue/runtime-dom/-/runtime-dom-3.4.14.tgz",
"integrity": "sha512-B85XmcR4E7XsirEHVqhmy4HPbRT9WLFWV9Uhie3OapV9m1MEN9+Er6hmUIE6d8/l2sUygpK9RstFM2bmHEUigA==",
"version": "3.4.15",
"resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.4.15.tgz",
"integrity": "sha512-EVW8D6vfFVq3V/yDKNPBFkZKGMFSvZrUQmx196o/v2tHKdwWdiZjYUBS+0Ez3+ohRyF8Njwy/6FH5gYJ75liUw==",
"dependencies": {
"@vue/runtime-core": "3.4.14",
"@vue/shared": "3.4.14",
"@vue/runtime-core": "3.4.15",
"@vue/shared": "3.4.15",
"csstype": "^3.1.3"
}
},
"node_modules/@vue/runtime-dom/node_modules/csstype": {
"version": "3.1.3",
"resolved": "https://registry.npmmirror.com/csstype/-/csstype-3.1.3.tgz",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz",
"integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="
},
"node_modules/@vue/server-renderer": {
"version": "3.4.14",
"resolved": "https://registry.npmmirror.com/@vue/server-renderer/-/server-renderer-3.4.14.tgz",
"integrity": "sha512-pwSKXQfYdJBTpvWHGEYI+akDE18TXAiLcGn+Q/2Fj8wQSHWztoo7PSvfMNqu6NDhp309QXXbPFEGCU5p85HqkA==",
"version": "3.4.15",
"resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.4.15.tgz",
"integrity": "sha512-3HYzaidu9cHjrT+qGUuDhFYvF/j643bHC6uUN9BgM11DVy+pM6ATsG6uPBLnkwOgs7BpJABReLmpL3ZPAsUaqw==",
"dependencies": {
"@vue/compiler-ssr": "3.4.14",
"@vue/shared": "3.4.14"
"@vue/compiler-ssr": "3.4.15",
"@vue/shared": "3.4.15"
},
"peerDependencies": {
"vue": "3.4.14"
"vue": "3.4.15"
}
},
"node_modules/@vue/shared": {
"version": "3.4.14",
"resolved": "https://registry.npmmirror.com/@vue/shared/-/shared-3.4.14.tgz",
"integrity": "sha512-nmi3BtLpvqXAWoRZ6HQ+pFJOHBU4UnH3vD3opgmwXac7vhaHKA9nj1VeGjMggdB9eLtW83eHyPCmOU1qzdsC7Q=="
"version": "3.4.15",
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.15.tgz",
"integrity": "sha512-KzfPTxVaWfB+eGcGdbSf4CWdaXcGDqckoeXUh7SB3fZdEtzPCK2Vq9B/lRRL3yutax/LWITz+SwvgyOxz5V75g=="
},
"node_modules/@vueuse/core": {
"version": "10.7.2",
@@ -3325,9 +3328,9 @@
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
"node_modules/axios": {
"version": "1.6.5",
"resolved": "https://registry.npmmirror.com/axios/-/axios-1.6.5.tgz",
"integrity": "sha512-Ii012v05KEVuUoFWmMW/UQv9aRIc3ZwkWDcM+h5Il8izZCtRVpDUfwpoFf7eOtajT3QiGR4yDUx7lPqHJULgbg==",
"version": "1.6.6",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.6.6.tgz",
"integrity": "sha512-XZLZDFfXKM9U/Y/B4nNynfCRUqNyVZ4sBC/n9GDRCkq9vd2mIvKjKKsbIh1WPmHmNbg6ND7cTBY3Y2+u1G3/2Q==",
"dependencies": {
"follow-redirects": "^1.15.4",
"form-data": "^4.0.0",
@@ -5623,9 +5626,9 @@
}
},
"node_modules/unplugin-auto-import": {
"version": "0.17.3",
"resolved": "https://registry.npmmirror.com/unplugin-auto-import/-/unplugin-auto-import-0.17.3.tgz",
"integrity": "sha512-0cn0wr8X579TtdZKUAps0dDVrYzttx38ImdxZjmCeNlMDJX8UuSjO83vFqgS4ClNDIGWAute+xl9j5vRSX+vsw==",
"version": "0.17.4",
"resolved": "https://registry.npmjs.org/unplugin-auto-import/-/unplugin-auto-import-0.17.4.tgz",
"integrity": "sha512-sInr7+UOeFMtiRCr7lYZXouTnVqXNUJtN5yN5GDzg6Sr2rwY5ZWZmqf4yvItYCm8mq1PdzPw3oojYHgZAJnTRQ==",
"dev": true,
"dependencies": {
"@antfu/utils": "^0.7.7",
@@ -5634,12 +5637,15 @@
"local-pkg": "^0.5.0",
"magic-string": "^0.30.5",
"minimatch": "^9.0.3",
"unimport": "^3.7.0",
"unimport": "^3.7.1",
"unplugin": "^1.6.0"
},
"engines": {
"node": ">=14"
},
"funding": {
"url": "https://github.com/sponsors/antfu"
},
"peerDependencies": {
"@nuxt/kit": "^3.2.2",
"@vueuse/core": "*"
@@ -5900,15 +5906,15 @@
}
},
"node_modules/vue": {
"version": "3.4.14",
"resolved": "https://registry.npmmirror.com/vue/-/vue-3.4.14.tgz",
"integrity": "sha512-Rop5Al/ZcBbBz+KjPZaZDgHDX0kUP4duEzDbm+1o91uxYUNmJrZSBuegsNIJvUGy+epLevNRNhLjm08VKTgGyw==",
"version": "3.4.15",
"resolved": "https://registry.npmjs.org/vue/-/vue-3.4.15.tgz",
"integrity": "sha512-jC0GH4KkWLWJOEQjOpkqU1bQsBwf4R1rsFtw5GQJbjHVKWDzO6P0nWWBTmjp1xSemAioDFj1jdaK1qa3DnMQoQ==",
"dependencies": {
"@vue/compiler-dom": "3.4.14",
"@vue/compiler-sfc": "3.4.14",
"@vue/runtime-dom": "3.4.14",
"@vue/server-renderer": "3.4.14",
"@vue/shared": "3.4.14"
"@vue/compiler-dom": "3.4.15",
"@vue/compiler-sfc": "3.4.15",
"@vue/runtime-dom": "3.4.15",
"@vue/server-renderer": "3.4.15",
"@vue/shared": "3.4.15"
},
"peerDependencies": {
"typescript": "*"

View File

@@ -14,7 +14,7 @@
"@vueuse/core": "^10.7.2",
"@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-vue": "^5.1.12",
"axios": "1.6.5",
"axios": "^1.6.6",
"canvas-confetti": "^1.9.2",
"chart.js": "^4.4.1",
"codemirror": "^6.0.1",
@@ -24,22 +24,22 @@
"naive-ui": "^2.37.3",
"normalize.css": "^8.0.1",
"pinia": "^2.1.7",
"vue": "^3.4.14",
"vue": "^3.4.15",
"vue-chartjs": "^5.3.0",
"vue-codemirror": "^6.1.1",
"vue-router": "^4.2.5"
},
"devDependencies": {
"@types/node": "^20.11.5",
"@types/node": "^20.11.6",
"@vitejs/plugin-legacy": "^5.2.0",
"@vitejs/plugin-vue": "^5.0.3",
"prettier": "^3.2.4",
"terser": "^5.27.0",
"typescript": "^5.3.3",
"unplugin-auto-import": "^0.17.3",
"unplugin-auto-import": "^0.17.4",
"unplugin-vue-components": "^0.26.0",
"unplugin-vue-markdown": "^0.25.2",
"vite": "^5.0.11",
"vite": "^5.0.12",
"vue-tsc": "^1.8.27"
}
}

View File

@@ -102,7 +102,12 @@ watch(
<span>我猜你要</span>
<n-button @click="router.push('/admin/problem/create')">新题目</n-button>
<n-button @click="router.push('/admin/contest/create')">新比赛</n-button>
<n-input clearable v-model:value="query.username" placeholder="班级前缀" />
<n-input
clearable
@change="listRanks"
v-model:value="query.username"
placeholder="班级前缀"
/>
<n-button @click="listRanks">用户排名</n-button>
<Pagination
class="pagination"

1
src/components.d.ts vendored
View File

@@ -23,6 +23,7 @@ declare module 'vue' {
NDropdown: typeof import('naive-ui')['NDropdown']
NDynamicTags: typeof import('naive-ui')['NDynamicTags']
NEmpty: typeof import('naive-ui')['NEmpty']
NFlex: typeof import('naive-ui')['NFlex']
NForm: typeof import('naive-ui')['NForm']
NFormItem: typeof import('naive-ui')['NFormItem']
NFormItemGi: typeof import('naive-ui')['NFormItemGi']

View File

@@ -10,7 +10,6 @@ const contestStore = useContestStore()
<template>
<n-popover
v-if="contestStore.contest"
trigger="click"
placement="bottom-end"
:show-arrow="false"
>

View File

@@ -46,7 +46,7 @@ const options: DropdownOption[] = [
比赛排名
</n-button>
</n-space>
<n-dropdown v-else :options="options" trigger="click" @select="goto">
<n-dropdown v-else :options="options" @select="goto">
<n-button>菜单</n-button>
</n-dropdown>
</div>

View File

@@ -91,12 +91,20 @@ function clear() {
onMounted(listContests)
watch(() => query.page, routerPush)
watch(
() => [query.limit, query.keyword, query.status],
() => [query.limit, query.status],
() => {
query.page = 1
routerPush()
},
)
watchDebounced(
() => [query.keyword],
() => {
query.page = 1
routerPush()
},
{ debounce: 500, maxWait: 1000 },
)
watch(
() => route.name === "contests" && route.query,
(newVal) => {
@@ -129,7 +137,11 @@ function rowProps(row: Contest) {
/>
</n-form-item>
<n-form-item>
<n-input clearable @change="search" placeholder="比赛标题" />
<n-input
clearable
v-model:value="query.keyword"
placeholder="比赛标题"
/>
</n-form-item>
</n-form>
<n-form :show-feedback="false" label-placement="left" inline>

View File

@@ -203,7 +203,6 @@ watch(
<template>
<n-popover
trigger="click"
placement="bottom-end"
scrollable
:show-arrow="false"

View File

@@ -19,7 +19,6 @@ function clear() {
</script>
<template>
<n-popover
trigger="click"
placement="bottom-end"
scrollable
:show-arrow="false"

View File

@@ -110,15 +110,21 @@ async function getRandom() {
}
watch(() => query.page, routerPush)
watch(
() => [query.tag, query.difficulty, query.limit, query.keyword],
() => [query.tag, query.difficulty, query.limit],
() => {
query.page = 1
routerPush()
},
)
watchDebounced(
() => [query.keyword],
() => {
query.page = 1
routerPush()
},
{ debounce: 500, maxWait: 1000 },
)
watch(
() => query.tag,
() => {
@@ -128,7 +134,6 @@ watch(
}))
},
)
watch(
() => route.path === "/" && route.query,
(newVal) => {
@@ -199,7 +204,11 @@ function rowProps(row: ProblemFiltered) {
/>
</n-form-item>
<n-form-item>
<n-input clearable @change="search" placeholder="题号或者标题" />
<n-input
clearable
v-model:value="query.keyword"
placeholder="题号或者标题"
/>
</n-form-item>
</n-form>
<n-form :show-feedback="false" inline label-placement="left">

View File

@@ -0,0 +1,17 @@
<script lang="ts" setup>
import Filter from "~/shared/icons/Filter.vue"
defineEmits(["click", "search"])
</script>
<template>
<n-flex align="center">
<n-button text type="info" @click="$emit('click')"><slot></slot></n-button>
<n-button text @click="$emit('search')">
<template #icon>
<n-icon color="#ccc">
<Filter />
</n-icon>
</template>
</n-button>
</n-flex>
</template>

View File

@@ -13,6 +13,7 @@ import { adminRejudge, getSubmissions } from "oj/api"
import { isDesktop } from "~/shared/composables/breakpoints"
import { useUserStore } from "~/shared/store/user"
import { LANGUAGE_SHOW_VALUE } from "~/utils/constants"
import ButtonWithSearch from "./components/ButtonWithSearch.vue"
interface Query {
username: string
@@ -81,14 +82,6 @@ function routerPush() {
})
}
function searchUser(value: string) {
query.username = value
}
function searchProblem(value: string) {
query.problem = value
}
function search(username: string, problem: string) {
query.username = username
query.problem = problem
@@ -107,22 +100,38 @@ async function rejudge(submissionID: string) {
listSubmissions()
}
function problemClicked(row: Submission) {
if (route.name === "contest submissions") {
router.push({
name: "contest problem",
params: {
problemID: row.problem,
},
})
} else {
router.push("/problem/" + row.problem)
}
}
watch(() => query.page, routerPush)
watch(
() => [
query.limit,
query.myself,
query.username,
query.result,
query.problem,
],
() => [query.limit, query.myself, query.result],
() => {
query.page = 1
routerPush()
},
)
watchDebounced(
() => [query.username, query.problem],
() => {
query.page = 1
routerPush()
},
{ debounce: 500, maxWait: 1000 },
)
watch(
() =>
(route.name === "submissions" || route.name === "contest submissions") &&
@@ -176,22 +185,10 @@ const columns = computed(() => {
width: 120,
render: (row) =>
h(
NButton,
ButtonWithSearch,
{
text: true,
type: "info",
onClick: () => {
if (route.name === "contest submissions") {
router.push({
name: "contest problem",
params: {
problemID: row.problem,
},
})
} else {
router.push("/problem/" + row.problem)
}
},
onClick: () => problemClicked(row),
onSearch: () => (query.problem = row.problem),
},
() => row.problem,
),
@@ -220,11 +217,10 @@ const columns = computed(() => {
minWidth: 120,
render: (row) =>
h(
NButton,
ButtonWithSearch,
{
text: true,
type: "info",
onClick: () => router.push("/user?name=" + row.username),
onSearch: () => (query.username = row.username),
},
() => row.username,
),
@@ -267,10 +263,14 @@ const columns = computed(() => {
</n-form>
<n-form :show-feedback="false" inline label-placement="left">
<n-form-item>
<n-input clearable @change="searchUser" placeholder="用户" />
<n-input
clearable
v-model:value="query.username"
placeholder="用户"
/>
</n-form-item>
<n-form-item>
<n-input clearable @change="searchProblem" placeholder="题号" />
<n-input clearable v-model:value="query.problem" placeholder="题号" />
</n-form-item>
</n-form>
<n-form :show-feedback="false" inline label-placement="left">

View File

@@ -39,15 +39,15 @@ const menus = computed<MenuOption[]>(() => [
label: () => h(RouterLink, { to: "/" }, { default: () => "题库" }),
key: "problem",
},
{
label: () => h(RouterLink, { to: "/contest" }, { default: () => "比赛" }),
key: "contest",
},
{
label: () =>
h(RouterLink, { to: "/submission" }, { default: () => "提交" }),
key: "submission",
},
{
label: () => h(RouterLink, { to: "/contest" }, { default: () => "比赛" }),
key: "contest",
},
{
label: () => h(RouterLink, { to: "/rank" }, { default: () => "排名" }),
key: "rank",
@@ -109,7 +109,7 @@ function goHome() {
/>
</n-space>
<n-space align="center">
<n-dropdown v-if="isMobile" :options="menus" trigger="click">
<n-dropdown v-if="isMobile" :options="menus">
<n-button>菜单</n-button>
</n-dropdown>
<n-button
@@ -122,11 +122,7 @@ function goHome() {
{{ screenSwitchLabel }}
</n-button>
<div v-if="userStore.isFinished">
<n-dropdown
v-if="userStore.isAuthed"
:options="options"
trigger="click"
>
<n-dropdown v-if="userStore.isAuthed" :options="options">
<n-button>{{ userStore.user!.username }}</n-button>
</n-dropdown>
<n-space align="center" v-else>

View File

@@ -0,0 +1,13 @@
<template>
<svg
xmlns="http://www.w3.org/2000/svg"
width="1em"
height="1em"
viewBox="0 0 24 24"
>
<path
fill="currentColor"
d="M11 20q-.425 0-.712-.288T10 19v-6L4.2 5.6q-.375-.5-.112-1.05T5 4h14q.65 0 .913.55T19.8 5.6L14 13v6q0 .425-.288.713T13 20z"
></path>
</svg>
</template>

View File

@@ -1,13 +0,0 @@
<template>
<svg
xmlns="http://www.w3.org/2000/svg"
width="1em"
height="1em"
viewBox="0 0 24 24"
>
<path
fill="currentColor"
d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 0 0 1.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 0 0-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 0 0 5.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0c.41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5S14 7.01 14 9.5S11.99 14 9.5 14z"
></path>
</svg>
</template>

View File

@@ -218,7 +218,7 @@ export interface Submission {
ip: string
// TODO: 这里不知道是什么
contest: null
problem: number
problem: string
can_unshare: boolean
}
@@ -346,4 +346,4 @@ export interface AnnouncementEdit {
title: string
content: string
visible: boolean
}
}