From 2ea6cc73859c46eab129abbf859f621529b92071 Mon Sep 17 00:00:00 2001 From: xuyue <517252939@qq.com> Date: Wed, 15 Feb 2023 22:24:36 +0800 Subject: [PATCH] add user homepage. --- package-lock.json | 48 +++++++++---------- package.json | 8 ++-- src/components.d.ts | 5 +- src/oj/contest/pages/rank.vue | 10 +++- src/oj/rank/list.vue | 7 ++- src/oj/submission/detail.vue | 2 +- src/oj/submission/list.vue | 10 +++- src/oj/user/index.vue | 87 +++++++++++++++++++++++++++++++++-- 8 files changed, 141 insertions(+), 36 deletions(-) diff --git a/package-lock.json b/package-lock.json index 186706c..97cf87e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,8 +11,8 @@ "@element-plus/icons-vue": "^2.0.10", "@monaco-editor/loader": "^1.3.2", "@vueuse/core": "^9.12.0", - "axios": "1.3.2", - "chart.js": "^4.2.0", + "axios": "1.3.3", + "chart.js": "^4.2.1", "copy-text-to-clipboard": "^3.0.1", "date-fns": "^2.29.3", "highlight.js": "^11.7.0", @@ -24,7 +24,7 @@ "vue-router": "^4.1.6" }, "devDependencies": { - "@iconify-json/ep": "^1.1.8", + "@iconify-json/ep": "^1.1.9", "@types/node": "^18.13.0", "@vitejs/plugin-vue": "^4.0.0", "markdown-it-shiki": "^0.7.2", @@ -32,7 +32,7 @@ "prettier": "^2.8.4", "typescript": "^4.9.5", "unplugin-auto-import": "^0.14.2", - "unplugin-icons": "^0.15.2", + "unplugin-icons": "^0.15.3", "unplugin-vue-components": "^0.23.0", "vite": "^4.1.1", "vite-plugin-vue-markdown": "^0.22.4", @@ -790,9 +790,9 @@ } }, "node_modules/@iconify-json/ep": { - "version": "1.1.8", - "resolved": "https://registry.npmmirror.com/@iconify-json/ep/-/ep-1.1.8.tgz", - "integrity": "sha512-pHCrsWU1R9/pTDU+Fps4+mjqOQFLtpGdXWegkhQ1P1DlgQAlCPyICtl6E1s8b7VwJMeZXaK84HA02UF6WD0o/Q==", + "version": "1.1.9", + "resolved": "https://registry.npmmirror.com/@iconify-json/ep/-/ep-1.1.9.tgz", + "integrity": "sha512-vhrCvikS/uRsEaM8eMyH7Fj13TSbkOuXqn0W/hqj79C9mtlUZMXPq31f+Mr5Cw4ag6sBPt8uY5WMhbwAR0vOMA==", "dev": true, "dependencies": { "@iconify/types": "*" @@ -805,17 +805,17 @@ "dev": true }, "node_modules/@iconify/utils": { - "version": "2.1.1", - "resolved": "https://registry.npmmirror.com/@iconify/utils/-/utils-2.1.1.tgz", - "integrity": "sha512-H8xz74JDzDw8f0qLxwIaxFMnFkbXTZNWEufOk3WxaLFHV4h0A2FjIDgNk5LzC0am4jssnjdeJJdRs3UFu3582Q==", + "version": "2.1.3", + "resolved": "https://registry.npmmirror.com/@iconify/utils/-/utils-2.1.3.tgz", + "integrity": "sha512-4rnzpZ2AWztPKDyWtw+DwJ9uko24it6YS+cnVpZveOrvLErwg22eXcGnIfuMFyECvsfbFhMqZW5YYWHe3CyEEg==", "dev": true, "dependencies": { "@antfu/install-pkg": "^0.1.1", "@antfu/utils": "^0.7.2", "@iconify/types": "^2.0.0", "debug": "^4.3.4", - "kolorist": "^1.6.0", - "local-pkg": "^0.4.2" + "kolorist": "^1.7.0", + "local-pkg": "^0.4.3" } }, "node_modules/@jridgewell/gen-mapping": { @@ -1442,9 +1442,9 @@ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, "node_modules/axios": { - "version": "1.3.2", - "resolved": "https://registry.npmmirror.com/axios/-/axios-1.3.2.tgz", - "integrity": "sha512-1M3O703bYqYuPhbHeya5bnhpYVsDDRyQSabNja04mZtboLNSuZ4YrltestrLXfHgmzua4TpUqRiVKbiQuo2epw==", + "version": "1.3.3", + "resolved": "https://registry.npmmirror.com/axios/-/axios-1.3.3.tgz", + "integrity": "sha512-eYq77dYIFS77AQlhzEL937yUBSepBfPIe8FcgEDN35vMNZKMrs81pgnyrQpwfy4NF4b4XWX1Zgx7yX+25w8QJA==", "dependencies": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", @@ -1551,9 +1551,9 @@ } }, "node_modules/chart.js": { - "version": "4.2.0", - "resolved": "https://registry.npmmirror.com/chart.js/-/chart.js-4.2.0.tgz", - "integrity": "sha512-wbtcV+QKeH0F7gQZaCJEIpsNriFheacouJQTVIjITi3eQA8bTlIBoknz0+dgV79aeKLNMAX+nDslIVE/nJ3rzA==", + "version": "4.2.1", + "resolved": "https://registry.npmmirror.com/chart.js/-/chart.js-4.2.1.tgz", + "integrity": "sha512-6YbpQ0nt3NovAgOzbkSSeeAQu/3za1319dPUQTXn9WcOpywM8rGKxJHrhS8V8xEkAlk8YhEfjbuAPfUyp6jIsw==", "dependencies": { "@kurkle/color": "^0.3.0" }, @@ -3485,17 +3485,17 @@ } }, "node_modules/unplugin-icons": { - "version": "0.15.2", - "resolved": "https://registry.npmmirror.com/unplugin-icons/-/unplugin-icons-0.15.2.tgz", - "integrity": "sha512-oWTTdLMuqfEYfZcko+KZHDEOIsqT4OeyJB1e4U7luCOo9gto/JLyHkqfbqjmjkjdQqA3DNHS18WOKh5esqQM5g==", + "version": "0.15.3", + "resolved": "https://registry.npmmirror.com/unplugin-icons/-/unplugin-icons-0.15.3.tgz", + "integrity": "sha512-YWgJqv5AahrokeOnta8uX/m1damZA6Rf6zPClgHg2Fa/45iyOe3Lj+Wn/Ba+CSsq9yBffn17YfKfJNyWCNZPvw==", "dev": true, "dependencies": { "@antfu/install-pkg": "^0.1.1", "@antfu/utils": "^0.7.2", - "@iconify/utils": "^2.1.0", + "@iconify/utils": "^2.1.2", "debug": "^4.3.4", - "kolorist": "^1.6.0", - "local-pkg": "^0.4.2", + "kolorist": "^1.7.0", + "local-pkg": "^0.4.3", "unplugin": "^1.0.1" }, "peerDependencies": { diff --git a/package.json b/package.json index 967f41b..1eb43a4 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,8 @@ "@element-plus/icons-vue": "^2.0.10", "@monaco-editor/loader": "^1.3.2", "@vueuse/core": "^9.12.0", - "axios": "1.3.2", - "chart.js": "^4.2.0", + "axios": "1.3.3", + "chart.js": "^4.2.1", "copy-text-to-clipboard": "^3.0.1", "date-fns": "^2.29.3", "highlight.js": "^11.7.0", @@ -26,7 +26,7 @@ "vue-router": "^4.1.6" }, "devDependencies": { - "@iconify-json/ep": "^1.1.8", + "@iconify-json/ep": "^1.1.9", "@types/node": "^18.13.0", "@vitejs/plugin-vue": "^4.0.0", "markdown-it-shiki": "^0.7.2", @@ -34,7 +34,7 @@ "prettier": "^2.8.4", "typescript": "^4.9.5", "unplugin-auto-import": "^0.14.2", - "unplugin-icons": "^0.15.2", + "unplugin-icons": "^0.15.3", "unplugin-vue-components": "^0.23.0", "vite": "^4.1.1", "vite-plugin-vue-markdown": "^0.22.4", diff --git a/src/components.d.ts b/src/components.d.ts index cfd12ab..2c75b7c 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -16,20 +16,23 @@ declare module '@vue/runtime-core' { IEpMoreFilled: typeof import('~icons/ep/more-filled')['default'] IEpSunny: typeof import('~icons/ep/sunny')['default'] NAlert: typeof import('naive-ui')['NAlert'] + NAvatar: typeof import('naive-ui')['NAvatar'] NButton: typeof import('naive-ui')['NButton'] NCard: typeof import('naive-ui')['NCard'] - NCode: typeof import('naive-ui')['NCode'] + NCode: typeof import("naive-ui")["NCode"] NConfigProvider: typeof import('naive-ui')['NConfigProvider'] NCountdown: typeof import("naive-ui")["NCountdown"] NDataTable: typeof import('naive-ui')['NDataTable'] NDescriptions: typeof import('naive-ui')['NDescriptions'] NDescriptionsItem: typeof import('naive-ui')['NDescriptionsItem'] NDropdown: typeof import('naive-ui')['NDropdown'] + NEmpty: typeof import('naive-ui')['NEmpty'] NForm: typeof import('naive-ui')['NForm'] NFormItem: typeof import('naive-ui')['NFormItem'] NGi: typeof import('naive-ui')['NGi'] NGrid: typeof import('naive-ui')['NGrid'] NIcon: typeof import('naive-ui')['NIcon'] + NImage: typeof import("naive-ui")["NImage"] NInput: typeof import('naive-ui')['NInput'] NLayout: typeof import('naive-ui')['NLayout'] NLayoutContent: typeof import('naive-ui')['NLayoutContent'] diff --git a/src/oj/contest/pages/rank.vue b/src/oj/contest/pages/rank.vue index 30052cc..e285df1 100644 --- a/src/oj/contest/pages/rank.vue +++ b/src/oj/contest/pages/rank.vue @@ -40,7 +40,15 @@ const columns = ref[]>([ fixed: "left", align: "center", render: (row) => - h(NButton, { text: true, type: "info" }, () => row.user.username), + h( + NButton, + { + text: true, + type: "info", + onClick: () => router.push("/user?name=" + row.user.username), + }, + () => row.user.username + ), }, { title: "正确数/总提交", diff --git a/src/oj/rank/list.vue b/src/oj/rank/list.vue index f42ed5a..9832481 100644 --- a/src/oj/rank/list.vue +++ b/src/oj/rank/list.vue @@ -6,6 +6,7 @@ import { Rank } from "utils/types" import { getRank } from "oj/api" import { getACRate } from "utils/functions" +const router = useRouter() const data = ref([]) const total = ref(0) const query = reactive({ @@ -39,7 +40,11 @@ const columns: DataTableColumn[] = [ render: (row) => h( NButton, - { text: true, type: "info", onClick: () => {} }, + { + text: true, + type: "info", + onClick: () => router.push("/user?name=" + row.user.username), + }, () => row.user.username ), }, diff --git a/src/oj/submission/detail.vue b/src/oj/submission/detail.vue index 0f63912..635c871 100644 --- a/src/oj/submission/detail.vue +++ b/src/oj/submission/detail.vue @@ -61,7 +61,7 @@ onMounted(init) > 提交时间:{{ parseTime(submission.create_time) }} - 语言:{{ submission.language }} + 编程语言:{{ submission.language }} 用户:{{ submission.username }} diff --git a/src/oj/submission/list.vue b/src/oj/submission/list.vue index b40a9cd..026835b 100644 --- a/src/oj/submission/list.vue +++ b/src/oj/submission/list.vue @@ -196,7 +196,15 @@ const columns = computed(() => { key: "username", minWidth: 120, render: (row) => - h(NButton, { text: true, type: "info" }, () => row.username), + h( + NButton, + { + text: true, + type: "info", + onClick: () => router.push("/user?name=" + row.username), + }, + () => row.username + ), }, ] if (!route.params.contestID && userStore.isSuperAdmin) { diff --git a/src/oj/user/index.vue b/src/oj/user/index.vue index a46b7b5..af00144 100644 --- a/src/oj/user/index.vue +++ b/src/oj/user/index.vue @@ -1,3 +1,84 @@ - - - + + +