fix
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled

This commit is contained in:
2026-05-19 04:29:04 -06:00
parent a72317173b
commit ef7aa44577
3 changed files with 7 additions and 20 deletions

View File

@@ -61,7 +61,7 @@ watch(
() => [
problem.value?._id,
problem.value?.my_status,
problemStore.totalFailCount,
problemStore.failCount,
],
([, status, failCount]) => {
if (status === 0 || (failCount as number) >= 3) {

View File

@@ -51,7 +51,7 @@ const msg = computed(() => {
const showAIHint = computed(() => {
if (!props.submission) return false
return (
problemStore.totalFailCount >= 3 &&
problemStore.failCount >= 3 &&
props.submission.result !== SubmissionStatus.accepted &&
props.submission.result !== SubmissionStatus.pending &&
props.submission.result !== SubmissionStatus.judging &&

View File

@@ -1,19 +1,12 @@
import { defineStore } from "pinia"
import { LANGUAGE, Problem } from "utils/types"
import type { LANGUAGE, Problem } from "utils/types"
/**
* 题目状态管理 Store
* 管理当前题目的信息
*/
export const useProblemStore = defineStore("problem", () => {
// ==================== 状态 ====================
const problem = ref<Problem | null>(null)
const route = useRoute()
// 本次会话内累计的失败次数(与服务端 my_failed_count 叠加)
const localFailCount = ref(0)
const failCount = ref(0)
// ==================== 计算属性 ====================
const languages = computed<LANGUAGE[]>(() => {
if (route.name === "problem" && problem.value?.allow_flowchart) {
return ["Flowchart", ...problem.value?.languages]
@@ -21,27 +14,21 @@ export const useProblemStore = defineStore("problem", () => {
return problem.value?.languages ?? []
})
const totalFailCount = computed(
() => (problem.value?.my_failed_count ?? 0) + localFailCount.value,
)
function incrementFailCount() {
localFailCount.value++
failCount.value++
}
// 切题时重置
watch(
() => problem.value?.id,
() => {
localFailCount.value = 0
failCount.value = 0
},
)
return {
problem,
localFailCount,
failCount,
languages,
totalFailCount,
incrementFailCount,
}
})