@@ -346,7 +346,7 @@ export function getProblemSetSubmissions(
|
||||
language?: string
|
||||
offset?: number
|
||||
limit?: number
|
||||
} = {}
|
||||
} = {},
|
||||
) {
|
||||
return http.get(`problemset/${problemSetId}/submissions`, {
|
||||
params,
|
||||
@@ -359,15 +359,10 @@ export function getProblemSetStatistics(problemSetId: number) {
|
||||
|
||||
export function updateProblemSetProgress(
|
||||
problemSetId: number,
|
||||
data: {
|
||||
problem_id: number
|
||||
status: string
|
||||
score?: number
|
||||
submit_time?: string
|
||||
}
|
||||
problemId: number,
|
||||
) {
|
||||
return http.put("problemset/progress", {
|
||||
problemset_id: problemSetId,
|
||||
...data,
|
||||
problem_id: problemId,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ const problemStore = useProblemStore()
|
||||
const { problem } = storeToRefs(problemStore)
|
||||
const route = useRoute()
|
||||
const contestID = <string>route.params.contestID ?? ""
|
||||
const problemsetID = computed(() => route.params.problemSetId as string || "")
|
||||
const problemSetID = computed(() => route.params.problemSetID as string || "")
|
||||
const [commentPanel] = useToggle()
|
||||
|
||||
const { isDesktop } = useBreakpoints()
|
||||
@@ -100,6 +100,9 @@ async function submit() {
|
||||
if (contestID) {
|
||||
data.contest_id = parseInt(contestID)
|
||||
}
|
||||
if (problemSetID.value) {
|
||||
data.problemset_id = parseInt(problemSetID.value)
|
||||
}
|
||||
|
||||
// 2. 提交代码到后端
|
||||
const res = await submitCode(data)
|
||||
@@ -119,16 +122,10 @@ watch(
|
||||
// 1. 刷新题目状态
|
||||
problem.value!.my_status = 0
|
||||
|
||||
// 2. 更新题单进度(如果来自题单)
|
||||
if (problemsetID.value) {
|
||||
// 2. 更新题单进度
|
||||
if (problemSetID.value) {
|
||||
try {
|
||||
await updateProblemSetProgress(Number(problemsetID.value), {
|
||||
problem_id: problem.value!.id,
|
||||
status: "completed",
|
||||
score: 100, // 通过得满分
|
||||
submit_time: new Date().toISOString(),
|
||||
})
|
||||
console.log(`[ProblemSet] 题单进度已更新: problemset=${problemsetID.value}, problem=${problem.value!.id}`)
|
||||
await updateProblemSetProgress(Number(problemSetID.value), problem.value!.id)
|
||||
} catch (error) {
|
||||
console.error("更新题单进度失败:", error)
|
||||
}
|
||||
|
||||
@@ -45,9 +45,6 @@ const { convertToMermaid } = useMermaidConverter()
|
||||
const { renderError, renderFlowchart } = useMermaid()
|
||||
const route = useRoute()
|
||||
|
||||
// 获取题单ID
|
||||
const problemsetID = computed(() => route.params.problemSetId as string || "")
|
||||
|
||||
// 状态管理
|
||||
const rendering = ref(false)
|
||||
const loading = ref(false)
|
||||
@@ -66,7 +63,7 @@ const evaluation = ref<Evaluation>({
|
||||
|
||||
// ==================== WebSocket 相关函数 ====================
|
||||
// 处理 WebSocket 消息
|
||||
const handleWebSocketMessage = async (data: FlowchartEvaluationUpdate) => {
|
||||
const handleWebSocketMessage = (data: FlowchartEvaluationUpdate) => {
|
||||
console.log("收到流程图评分更新:", data)
|
||||
|
||||
if (data.type === "flowchart_evaluation_completed") {
|
||||
@@ -76,21 +73,6 @@ const handleWebSocketMessage = async (data: FlowchartEvaluationUpdate) => {
|
||||
grade: data.grade || "",
|
||||
}
|
||||
message.success(`流程图评分完成!得分: ${data.score}分 (${data.grade}级)`)
|
||||
|
||||
// 更新题单进度(如果来自题单)
|
||||
if (problemsetID.value) {
|
||||
try {
|
||||
await updateProblemSetProgress(Number(problemsetID.value), {
|
||||
problem_id: problem.value!.id,
|
||||
status: "completed",
|
||||
score: data.score || 0,
|
||||
submit_time: new Date().toISOString(),
|
||||
})
|
||||
console.log(`[ProblemSet] 题单进度已更新: problemset=${problemsetID.value}, problem=${problem.value!.id}, score=${data.score}`)
|
||||
} catch (error) {
|
||||
console.error("更新题单进度失败:", error)
|
||||
}
|
||||
}
|
||||
} else if (data.type === "flowchart_evaluation_failed") {
|
||||
console.log("处理评分失败消息")
|
||||
loading.value = false
|
||||
|
||||
@@ -33,21 +33,18 @@ const ProblemFlowchart = defineAsyncComponent(
|
||||
interface Props {
|
||||
problemID: string
|
||||
contestID?: string
|
||||
problemSetId?: string
|
||||
problemSetID?: string
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
contestID: "",
|
||||
problemSetId: "",
|
||||
problemSetID: "",
|
||||
})
|
||||
|
||||
const errMsg = ref("无数据")
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
// 从路由参数中获取题单ID
|
||||
const problemsetID = computed(() => props.problemSetId || route.params.problemSetId as string)
|
||||
|
||||
const problemStore = useProblemStore()
|
||||
const screenModeStore = useScreenModeStore()
|
||||
const { problem } = storeToRefs(problemStore)
|
||||
|
||||
@@ -280,6 +280,7 @@ export interface SubmitCodePayload {
|
||||
language: LANGUAGE
|
||||
code: string
|
||||
contest_id?: number
|
||||
problemset_id?: number
|
||||
}
|
||||
|
||||
// ==================== 流程图相关类型 ====================
|
||||
|
||||
Reference in New Issue
Block a user