diff --git a/src/components.d.ts b/src/components.d.ts
index 534a97b..d5783f6 100644
--- a/src/components.d.ts
+++ b/src/components.d.ts
@@ -45,6 +45,7 @@ declare module 'vue' {
NPagination: typeof import('naive-ui')['NPagination']
NPopconfirm: typeof import('naive-ui')['NPopconfirm']
NPopover: typeof import('naive-ui')['NPopover']
+ NRate: typeof import('naive-ui')['NRate']
NScrollbar: typeof import('naive-ui')['NScrollbar']
NSelect: typeof import('naive-ui')['NSelect']
NSpace: typeof import('naive-ui')['NSpace']
diff --git a/src/oj/api.ts b/src/oj/api.ts
index c280117..67aead5 100644
--- a/src/oj/api.ts
+++ b/src/oj/api.ts
@@ -189,3 +189,22 @@ export function createMessage(data: {
export function getMessageList(offset = 0, limit = 10) {
return http.get("message", { params: { limit, offset } })
}
+
+export function createComment(data: {
+ problem_id: number
+ description_rating: number
+ difficulty_rating: number
+ comprehensive_rating: number
+ content: string
+ submission_id?: string
+}) {
+ return http.post("comment", data)
+}
+
+export function getComment(problemID: number) {
+ return http.get("comment", { params: { problem_id: problemID } })
+}
+
+export function getCommentStatistics(problemID: number) {
+ return http.get("comment/statistics", { params: { problem_id: problemID } })
+}
diff --git a/src/oj/problem/components/ProblemComment.vue b/src/oj/problem/components/ProblemComment.vue
new file mode 100644
index 0000000..88a9e8d
--- /dev/null
+++ b/src/oj/problem/components/ProblemComment.vue
@@ -0,0 +1,201 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ content }}
+
+
+ 查看统计
+
+ 提交
+
+
+
+
+ {{ count }}
+
+
+ {{ rating.description }}
+
+
+ {{ rating.difficulty }}
+
+
+ {{ rating.comprehensive }}
+
+
+
+ 以下是一些评论留言:
+
+ {{ item }}
+
+
+
+ 暂无记录,快去评论吧
+
+
+
+
+
+
+
diff --git a/src/oj/problem/components/ProblemSubmission.vue b/src/oj/problem/components/ProblemSubmission.vue
index 9479e3e..c53aeb0 100644
--- a/src/oj/problem/components/ProblemSubmission.vue
+++ b/src/oj/problem/components/ProblemSubmission.vue
@@ -4,7 +4,6 @@ import { Submission } from "~/utils/types"
import { parseTime } from "~/utils/functions"
import { LANGUAGE_SHOW_VALUE } from "~/utils/constants"
import { getSubmissions } from "~/oj/api"
-import { isDesktop } from "~/shared/composables/breakpoints"
import SubmissionResultTag from "~/shared/components/SubmissionResultTag.vue"
import Pagination from "~/shared/components/Pagination.vue"
import { NButton } from "naive-ui"
diff --git a/src/oj/problem/components/Submit.vue b/src/oj/problem/components/Submit.vue
index cfd27f3..bf4e7c6 100644
--- a/src/oj/problem/components/Submit.vue
+++ b/src/oj/problem/components/Submit.vue
@@ -5,13 +5,16 @@ import { isDesktop } from "~/shared/composables/breakpoints"
import { JUDGE_STATUS, SubmissionStatus } from "utils/constants"
import { submissionMemoryFormat, submissionTimeFormat } from "utils/functions"
import { Submission, SubmitCodePayload } from "utils/types"
-import { getSubmission, submitCode } from "oj/api"
+import { getComment, getSubmission, submitCode } from "oj/api"
import SubmissionResultTag from "~/shared/components/SubmissionResultTag.vue"
import { useUserStore } from "~/shared/store/user"
// @ts-ignore
import confetti from "canvas-confetti"
import { Icon } from "@iconify/vue"
+const ProblemComment = defineAsyncComponent(
+ () => import("./ProblemComment.vue"),
+)
const userStore = useUserStore()
const route = useRoute()
@@ -20,12 +23,23 @@ const contestID = route.params.contestID ?? ""
const submissionId = ref("")
const submission = ref()
const [submitted] = useToggle()
+const [commentPanel] = useToggle()
const { start: submitPending, isPending } = useTimeout(5000, {
controls: true,
immediate: false,
})
+const { start: showCommentPanel } = useTimeoutFn(
+ async () => {
+ const res = await getComment(problem.value!.id)
+ if (res.data) return
+ commentPanel.value = true
+ },
+ 2000,
+ { immediate: false },
+)
+
const { start: fetchSubmission } = useTimeoutFn(
async () => {
const res = await getSubmission(submissionId.value)
@@ -187,6 +201,9 @@ watch(
() => submission?.value?.result,
(result) => {
if (result === SubmissionStatus.accepted) {
+ // 刷新题目状态
+ problem.value!.my_status = 0
+ // 放烟花
confetti({
particleCount: 300,
startVelocity: 30,
@@ -194,6 +211,8 @@ watch(
spread: 350,
origin: { x: 0.5, y: 0.4 },
})
+ // 题目在第一次完成之后,弹出点评框
+ showCommentPanel()
}
},
)
@@ -244,6 +263,14 @@ watch(
/>
+
+
+