feat(阶段1): 搬入 ojnext 为 apps/web,未改业务代码
This commit is contained in:
1 parent
3c975e85ee
commit
ae1fb329b5
258 files changed
+40490
-91
No files matched your search
@@ -0,0 +1,34 @@
|
||||
import { defineStore } from "pinia"
|
||||
import type { LANGUAGE, Problem } from "utils/types"
|
||||
|
||||
export const useProblemStore = defineStore("problem", () => {
|
||||
const problem = ref<Problem | null>(null)
|
||||
const route = useRoute()
|
||||
|
||||
const failCount = ref(0)
|
||||
|
||||
const languages = computed<LANGUAGE[]>(() => {
|
||||
if (route.name === "problem" && problem.value?.allow_flowchart) {
|
||||
return ["Flowchart", ...problem.value?.languages]
|
||||
}
|
||||
return problem.value?.languages ?? []
|
||||
})
|
||||
|
||||
function incrementFailCount() {
|
||||
failCount.value++
|
||||
}
|
||||
|
||||
watch(
|
||||
() => problem.value?.id,
|
||||
() => {
|
||||
failCount.value = 0
|
||||
},
|
||||
)
|
||||
|
||||
return {
|
||||
problem,
|
||||
failCount,
|
||||
languages,
|
||||
incrementFailCount,
|
||||
}
|
||||
})
|
||||
Reference in new issue
Block a user