feat(阶段1): 端到端串通,前端显示本地库真实题目

This commit is contained in:
2026-08-06 21:19:52 -06:00
parent ae1fb329b5
commit e6329ecabb
3 changed files with 37 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
<script setup lang="ts">
import type { ProblemSummary } from "@oj2/contract"
import { onMounted, ref } from "vue"
const problems = ref<ProblemSummary[]>([])
const error = ref("")
onMounted(async () => {
try {
const response = await fetch("/api2/problems")
const body = await response.json()
problems.value = body.data
} catch (cause) {
error.value = String(cause)
}
})
</script>
<template>
<div style="padding: 24px">
<h2>阶段 1 链路验证临时页阶段 3 删除</h2>
<p v-if="error" style="color: red">{{ error }}</p>
<p> {{ problems.length }} 道题</p>
<ul>
<li v-for="problem in problems" :key="problem.id">
{{ problem._id }} {{ problem.title }}{{ problem.difficulty }}通过
{{ problem.acceptedNumber }}/{{ problem.submissionNumber }}
</li>
</ul>
</div>
</template>

View File

@@ -5,6 +5,7 @@ export const ojs: RouteRecordRaw = {
component: () => import("shared/layout/default.vue"),
children: [
{ path: "", component: () => import("oj/problem/list.vue") },
{ path: "dev-problems", component: () => import("oj/dev-problems.vue") },
{
path: "problem/:problemID",
component: () => import("oj/problem/detail.vue"),