默认是这个班上一次布置选的语言。学生那边首页、题号下拉、题目页课堂条都写上「C语言」; 打开这节课的题时编辑器自动切过去,每道题只切一次,学生自己再换就按他的。提交列表的 「这节课」连语言一起筛。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a18e129f4c
commit
773d15b033
7 files changed
+93
-14
No files matched your search
@@ -232,7 +232,10 @@ onSolvedHere(() => {
|
||||
<template>
|
||||
<!-- 课堂 -->
|
||||
<div v-if="lesson" class="context-bar lesson">
|
||||
<span class="lead lesson-lead">这节课 做完 {{ lesson.done }}/{{ lesson.total }}</span>
|
||||
<span class="lead lesson-lead"
|
||||
>这节课<template v-if="lessonStore.languageText"> · {{ lessonStore.languageText }}</template>
|
||||
做完 {{ lesson.done }}/{{ lesson.total }}</span
|
||||
>
|
||||
<!-- 手机上放不下一排题号:只说是第几道,箭头做大(设计稿「手机:题目 / 代码 / 结果」) -->
|
||||
<span v-if="isMobile" class="meta">这是第 {{ lesson.position }} 道</span>
|
||||
<ProblemChips v-else :items="lesson.chips" :current="currentId" variant="lesson" />
|
||||
|
||||
@@ -16,6 +16,7 @@ import { useCollabHere, useTeacherCollab } from "../composables/teacherCollab"
|
||||
import { useProblemPageContext } from "../composables/problemPageContext"
|
||||
import CollabBar from "./CollabBar.vue"
|
||||
import { useFlowchartStore } from "oj/store/flowchart"
|
||||
import { useLessonStore } from "oj/store/lesson"
|
||||
|
||||
const FlowchartEditor = defineAsyncComponent(
|
||||
() => import("shared/components/FlowchartEditor/index.vue"),
|
||||
@@ -151,6 +152,30 @@ watch(
|
||||
},
|
||||
)
|
||||
|
||||
/**
|
||||
* 老师在课堂看板布置这节课时选了语言:打开这节课的题,编辑器默认就用它。学 C 的班,
|
||||
* 编辑器停在默认的 Python(或者上一个用这台电脑的人留下的偏好)的话,学生交上去才发现
|
||||
* 不算数。课堂条只在题库入口出现,这里同一个范围。
|
||||
*
|
||||
* 每道题只自动换一次:学生自己再切回别的语言,就按他的来。课堂状态可能比题面晚到
|
||||
* (课堂条进页面才去拉),所以两边都等到了再判断;画着流程图时不动他。
|
||||
*/
|
||||
const lessonStore = useLessonStore()
|
||||
let lessonLanguageFor: string | null = null
|
||||
watch(
|
||||
() => [problem.value?._id, lessonStore.activity] as const,
|
||||
([id, activity]) => {
|
||||
if (!id || !activity || lessonLanguageFor === id) return
|
||||
lessonLanguageFor = id
|
||||
const language = activity.language
|
||||
if (!language || ctx.value.entry !== "problem" || teacherCollab.value) return
|
||||
if (!lessonStore.includes(id) || !problemStore.codeLanguages.includes(language)) return
|
||||
if (codeStore.code.language === language || codeStore.code.language === "Flowchart") return
|
||||
problemStore.switchLanguage(language)
|
||||
},
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
/**
|
||||
* 画着流程图时忽然不让画了:工具栏的「写代码 / 画流程图」和语言下拉都跟着 canDraw 藏起来,
|
||||
* 编辑器要是还停在画布上,学生就回不去写代码了。拖窄到手机宽度时页面会换一套布局、编辑器
|
||||
|
||||
Reference in new issue
Block a user