feat(题单): 题单页重做——布置中的放最上面,详情顶上一条进度和奖章阶梯,没加入看得见题点不进;老师看全班、后台一屏编辑
Deploy / deploy (push) Canceled after 0s
Deploy / deploy (push) Canceled after 0s
- 列表:布置中的大卡片(做对几道、布置到哪天、再做对几道拿哪个奖章),其余小卡片,加入过的在前 - 详情:进度 + 奖章阶梯(下一个金圈「再做对 n 道」),题目两列写几点做对 / 交过几次; 以前做对过的标「旧代码先藏着」;做完整条变绿,烟花只在做完那一刻放 - 老师多一个「全班情况」页签;题目页从链接直接进来没加入时,条上给「加入题单」 - 后台一屏编辑:布置一周 / 两周 / 四周 / 选日期,公开开关,粘贴多个题号一次加,拖动排序,奖章只剩两种条件 - 旧代码藏着的地方都说清楚是哪个题单、哪天之后能看 - 修掉列表卡片把选做题数说成「新加了 N 题」 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8c53e28dcb
commit
c17f88cdbb
32 files changed
+2630
-2181
No files matched your search
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { storeToRefs } from "pinia"
|
||||
import type { RouteLocationRaw } from "vue-router"
|
||||
import { getProblemSetDetail, getProblemSetProblems } from "oj/api"
|
||||
import { getProblemSetDetail, getProblemSetProblems, joinProblemSet } from "oj/api"
|
||||
import { useContestStore } from "oj/store/contest"
|
||||
import { isFlowchartPass, useFlowchartStore } from "oj/store/flowchart"
|
||||
import { useLessonStore } from "oj/store/lesson"
|
||||
@@ -161,6 +161,7 @@ const setBar = computed(() => {
|
||||
const done = required.filter((item) => item.isCompleted).length
|
||||
return {
|
||||
title: problemSet.value.title,
|
||||
joined: problemSet.value.userProgress.isJoined,
|
||||
home: { name: "problemset", params: { problemSetId: ctx.value.problemSetId } },
|
||||
done,
|
||||
total: required.length,
|
||||
@@ -171,6 +172,22 @@ const setBar = computed(() => {
|
||||
}
|
||||
})
|
||||
|
||||
// 没加入就点进了题(直接打开的链接):在条上给个「加入」,不然做对了也不记进度
|
||||
const joiningSet = ref(false)
|
||||
async function joinHere() {
|
||||
const id = ctx.value.problemSetId
|
||||
if (!id || joiningSet.value) return
|
||||
joiningSet.value = true
|
||||
try {
|
||||
await joinProblemSet(Number(id))
|
||||
problemSet.value = await getProblemSetDetail(Number(id))
|
||||
} catch {
|
||||
// 加入失败就还是那条提示,回题单页再点一次
|
||||
} finally {
|
||||
joiningSet.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 判题那一路已经记了账(judge/run.ts),这里只是把这一条就地改掉,不用重拉
|
||||
onSolvedHere(() => {
|
||||
const item = setProblems.value.find(
|
||||
@@ -294,13 +311,19 @@ onSolvedHere(() => {
|
||||
<router-link :to="setBar.home" class="back set-back" :title="`回到题单:${setBar.title}`">
|
||||
‹ {{ setBar.title }}
|
||||
</router-link>
|
||||
<div class="set-progress" aria-hidden="true">
|
||||
<div v-if="setBar.joined" class="set-progress" aria-hidden="true">
|
||||
<div class="set-progress-fill" :style="{ width: `${setBar.percentage}%` }" />
|
||||
</div>
|
||||
<span class="meta">
|
||||
<span v-if="setBar.joined" class="meta">
|
||||
做完 {{ setBar.done }}/{{ setBar.total }}
|
||||
<template v-if="setBar.position"> · 第 {{ setBar.position }} 题</template>
|
||||
</span>
|
||||
<template v-else>
|
||||
<span class="meta">还没加入,在这里做对了不算进度</span>
|
||||
<n-button size="tiny" type="primary" :loading="joiningSet" @click="joinHere"
|
||||
>加入题单</n-button
|
||||
>
|
||||
</template>
|
||||
<div class="spacer" />
|
||||
<component
|
||||
:is="setBar.previous ? 'router-link' : 'span'"
|
||||
|
||||
Reference in new issue
Block a user