merge: lesson plan laptop setup bugfix

bugfix/ai-assessment-evidence-rescore
chenyuan 3 months ago
commit f73765306f

@ -1,21 +0,0 @@
const LESSON_PLAN_MODULES = [
"互联网产品开发基础认知",
"市场洞察与需求分析",
"产品规划与设计",
"产品开发与测试验证",
"产品上线与运营推广",
"综合实训",
];
function buildTeachingPlanPrompt(moduleName) {
return `请为“互联网产品开发实训课程”的“${moduleName}”模块生成一份实训教案。
请按以下结构输出:
1. 教学目标
2. 实训任务
3. 实施步骤
4. 预期成果
5. 评价要点
内容应贴合互联网产品开发的真实业务场景,并给出可直接用于课堂组织的说明。`;
}
module.exports = { LESSON_PLAN_MODULES, buildTeachingPlanPrompt };

@ -0,0 +1,34 @@
const LESSON_PLAN_MODULES = [
"互联网产品开发基础认知",
"市场洞察与需求分析",
"产品规划与设计",
"产品开发与测试验证",
"产品上线与运营推广",
"综合实训",
];
function buildTeachingPlanPrompt(moduleName) {
return `请为“互联网产品开发实训课程”的“${moduleName}”模块生成一份实训教案。
请按以下结构输出:
1. 教学目标
2. 实训任务
3. 实施步骤
4. 预期成果
5. 评价要点
内容应贴合互联网产品开发的真实业务场景,并给出可直接用于课堂组织的说明。`;
}
function buildTeachingPlanRequest(moduleName, prompt, templateName, templateContent) {
const normalizedPrompt = String(prompt || buildTeachingPlanPrompt(moduleName)).trim();
const normalizedTemplate = String(templateContent || "").trim();
if (!normalizedTemplate) return normalizedPrompt;
return `${normalizedPrompt}
以下为学校参考模板“${String(templateName || "未命名模板").trim()}”的正文内容。请优先遵循模板中的章节结构、字段和校内要求,不要遗漏必填项;模板中的示例内容仅作格式参考:
--- 参考模板开始 ---
${normalizedTemplate}
--- 参考模板结束 ---`;
}
export { LESSON_PLAN_MODULES, buildTeachingPlanPrompt, buildTeachingPlanRequest };

@ -1,106 +1,773 @@
<!--
* @Author: qinzhenpen qzp1807@126.com
* @Date: 2025-03-27 13:40:09
* @LastEditors: qinzhenpen qzp1807@126.com
* @LastEditTime: 2025-05-16 17:00:58
* @FilePath: \corporate-finance\src\components\AI\stu-analysis-of-students.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="stu-analysis-of-students">
<div class="handren-title">
<h3>此处为AI根据实训模块内容智能生成的实训教案,仅供参考</h3>
</div>
<div class="content">
<div class="teaching-plan">
<template v-for="(item, index) in dialogue" :key="item">
<div :style="{ background: col[index] }" class="teaching-plan-item" @click="generateTeachingPlan(item)">{{ item }}</div>
</template>
<main class="lesson-plan-page">
<header class="lesson-plan-hero">
<div>
<span class="eyebrow">AI · TEACHING STUDIO</span>
<h1>AI 实训教案</h1>
<p>选择实训模块,结合学校模板和教学要求,在生成前完成提示词配置。</p>
</div>
</div>
</div>
<ol class="workflow" aria-label="教案生成流程">
<li><b>01</b><span>选择模块</span></li>
<li><b>02</b><span>配置要求</span></li>
<li><b>03</b><span>确认生成</span></li>
</ol>
</header>
<section class="module-section" aria-labelledby="module-heading">
<div class="section-heading">
<div>
<span>实训课程模块</span>
<h2 id="module-heading">从一个模块开始备课</h2>
</div>
<p>AI 生成内容仅供参考,请老师结合实际授课安排审核调整。</p>
</div>
<div class="module-grid">
<button
v-for="(item, index) in dialogue"
:key="item"
type="button"
class="module-card"
:style="{ '--module-accent': col[index] }"
@click="openLessonPlanSetup(item, index)"
>
<span class="module-index">{{ String(index + 1).padStart(2, "0") }}</span>
<span class="module-card__content">
<small>MODULE {{ String(index + 1).padStart(2, "0") }}</small>
<strong>{{ item }}</strong>
<em>配置生成要求 <span aria-hidden="true">→</span></em>
</span>
</button>
</div>
</section>
<el-dialog
v-model="setupVisible"
class="lesson-plan-dialog"
width="860px"
destroy-on-close
:close-on-click-modal="false"
>
<template #header>
<div class="dialog-heading">
<span class="dialog-module-index">{{ selectedModuleNumber }}</span>
<div>
<small>生成前配置</small>
<h2>{{ selectedModule }}</h2>
</div>
</div>
</template>
<div class="setup-layout">
<section class="prompt-panel">
<div class="panel-title">
<div>
<span>参考提示词</span>
<p>可按学校课程标准、课时安排和评价方式直接修改。</p>
</div>
<button type="button" class="text-action" @click="resetPrompt">恢复默认</button>
</div>
<el-input
v-model="customPrompt"
type="textarea"
:rows="12"
maxlength="6000"
show-word-limit
resize="none"
aria-label="教案生成提示词"
/>
</section>
<aside class="template-panel">
<div class="panel-title">
<div>
<span>学校参考模板</span>
<p>模板正文将随提示词用于本次生成。</p>
</div>
</div>
<input
ref="templateInput"
class="visually-hidden"
type="file"
accept=".docx,.txt,.md,application/vnd.openxmlformats-officedocument.wordprocessingml.document,text/plain,text/markdown"
@change="handleTemplateChange"
/>
<div
v-if="!templateFileName"
class="template-dropzone"
:class="{ 'is-reading': readingTemplate }"
role="button"
tabindex="0"
@click="templateInput?.click()"
@keydown.enter.prevent="templateInput?.click()"
@keydown.space.prevent="templateInput?.click()"
@dragover.prevent
@drop.prevent="handleTemplateDrop"
>
<span class="upload-mark" aria-hidden="true">↑</span>
<strong>{{ readingTemplate ? "正在读取模板…" : "上传参考模板" }}</strong>
<p>拖放或点击选择 DOCX、TXT、MD</p>
<small>单个文件不超过 10MB,仅用于本次生成</small>
</div>
<div v-else class="template-file">
<span class="file-badge">{{ templateExtension }}</span>
<div>
<strong :title="templateFileName">{{ templateFileName }}</strong>
<p>已读取 {{ templateCharacterCount }} 个字符</p>
</div>
<button type="button" aria-label="移除参考模板" @click="removeTemplate">×</button>
</div>
<div class="template-note">
<b>提示</b>
<p>建议模板包含教学目标、课时、教学过程、成果要求和评价标准。</p>
</div>
</aside>
</div>
<template #footer>
<div class="dialog-footer">
<span>生成后仍可在 AI 对话中继续修改教案。</span>
<div>
<el-button @click="setupVisible = false">取消</el-button>
<el-button type="primary" :disabled="!customPrompt.trim() || readingTemplate" @click="generateTeachingPlan">
生成教案
</el-button>
</div>
</div>
</template>
</el-dialog>
</main>
</template>
<script setup>
import { LESSON_PLAN_MODULES, buildTeachingPlanPrompt } from "./lessonPlanPrompt.cjs";
import JSZip from "jszip";
import {
LESSON_PLAN_MODULES,
buildTeachingPlanPrompt,
buildTeachingPlanRequest,
} from "./lessonPlanPrompt.mjs";
const { proxy } = getCurrentInstance();
const router = useRouter();
const dialogue = LESSON_PLAN_MODULES;
const col = ["#4db7c1", "#3169b5", "#d8a03b", "#6570e3", "#ed8989", "#46a8b2", "#2f66b1"];
const generateTeachingPlan = (val) => {
const col = ["#48d5ca", "#4a8dff", "#f6b84a", "#8b7cff", "#ff8294", "#3fc0dd"];
const MAX_TEMPLATE_SIZE = 10 * 1024 * 1024;
const MAX_TEMPLATE_CHARACTERS = 30000;
const setupVisible = ref(false);
const selectedModule = ref("");
const selectedModuleIndex = ref(0);
const customPrompt = ref("");
const templateInput = ref(null);
const templateFileName = ref("");
const templateContent = ref("");
const readingTemplate = ref(false);
const selectedModuleNumber = computed(() => String(selectedModuleIndex.value + 1).padStart(2, "0"));
const templateExtension = computed(() => templateFileName.value.split(".").pop()?.toUpperCase() || "FILE");
const templateCharacterCount = computed(() => templateContent.value.length.toLocaleString("zh-CN"));
function openLessonPlanSetup(moduleName, index) {
selectedModule.value = moduleName;
selectedModuleIndex.value = index;
customPrompt.value = buildTeachingPlanPrompt(moduleName);
removeTemplate();
setupVisible.value = true;
}
function resetPrompt() {
customPrompt.value = buildTeachingPlanPrompt(selectedModule.value);
}
function removeTemplate() {
templateFileName.value = "";
templateContent.value = "";
if (templateInput.value) templateInput.value.value = "";
}
async function extractDocxText(file) {
const archive = await JSZip.loadAsync(file);
const documentFile = archive.file("word/document.xml");
if (!documentFile) throw new Error("未找到 Word 正文,请检查模板文件");
const xml = await documentFile.async("string");
const documentXml = new DOMParser().parseFromString(xml, "application/xml");
if (documentXml.querySelector("parsererror")) throw new Error("Word 模板解析失败");
return Array.from(documentXml.getElementsByTagNameNS("*", "p"))
.map((paragraph) => Array.from(paragraph.getElementsByTagNameNS("*", "t"))
.map((node) => node.textContent)
.join(""))
.filter(Boolean)
.join("\n");
}
async function readTemplate(file) {
if (!file) return;
const extension = file.name.split(".").pop()?.toLowerCase();
if (!["docx", "txt", "md"].includes(extension)) {
proxy.$message.error("请上传 DOCX、TXT 或 MD 格式的参考模板");
if (templateInput.value) templateInput.value.value = "";
return;
}
if (file.size > MAX_TEMPLATE_SIZE) {
proxy.$message.error("参考模板不能超过 10MB");
if (templateInput.value) templateInput.value.value = "";
return;
}
readingTemplate.value = true;
try {
const rawText = extension === "docx" ? await extractDocxText(file) : await file.text();
const normalizedText = rawText.replace(/\r\n/g, "\n").replace(/\n{3,}/g, "\n\n").trim();
if (!normalizedText) throw new Error("模板中没有可读取的文字内容");
templateFileName.value = file.name;
templateContent.value = normalizedText.slice(0, MAX_TEMPLATE_CHARACTERS);
if (normalizedText.length > MAX_TEMPLATE_CHARACTERS) {
proxy.$message.warning("模板内容较长,本次生成读取前 30000 个字符");
} else {
proxy.$message.success("参考模板读取成功");
}
} catch (error) {
removeTemplate();
proxy.$message.error(error?.message || "参考模板读取失败");
} finally {
readingTemplate.value = false;
}
}
function handleTemplateChange(event) {
readTemplate(event.target.files?.[0]);
}
function handleTemplateDrop(event) {
readTemplate(event.dataTransfer?.files?.[0]);
}
function generateTeachingPlan() {
const prompt = customPrompt.value.trim();
if (!prompt) {
proxy.$message.warning("请填写教案生成提示词");
return;
}
proxy.$cache.session.remove("scoreList");
proxy.$cache.session.remove("msg");
proxy.$cache.session.setJSON("teachingPlan", buildTeachingPlanPrompt(val));
proxy.$cache.session.setJSON("teachingPlan", buildTeachingPlanRequest(
selectedModule.value,
prompt,
templateFileName.value,
templateContent.value,
));
router.push("/ai/learning-situation-dialogue");
};
onMounted(() => {});
}
</script>
<style lang='scss' scoped>
.stu-analysis-of-students {
padding: 20px 40px;
height: calc(100vh - 2.5rem);
<style lang="scss" scoped>
.lesson-plan-page {
--panel: rgba(2, 20, 48, 0.82);
--line: rgba(92, 180, 255, 0.22);
--muted: #91acc5;
min-height: calc(100vh - 50px);
padding: clamp(22px, 3vw, 46px);
overflow: auto;
color: #f5fbff;
background:
radial-gradient(circle at 84% 2%, rgba(40, 128, 224, 0.2), transparent 32%),
linear-gradient(rgba(2, 17, 39, 0.88), rgba(2, 13, 31, 0.94)),
url("@/assets/images/背景.webp") center / cover fixed;
}
.lesson-plan-hero {
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 32px;
width: min(1120px, 100%);
margin: 0 auto clamp(24px, 4vh, 44px);
h1 {
margin: 8px 0 10px;
font-family: "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
font-size: clamp(30px, 3.2vw, 48px);
letter-spacing: -0.04em;
}
p {
max-width: 620px;
margin: 0;
color: var(--muted);
font-size: clamp(14px, 1.3vw, 17px);
line-height: 1.8;
}
}
.eyebrow {
color: #59e5dd;
font: 600 12px/1 "Consolas", monospace;
letter-spacing: 0.16em;
}
.workflow {
display: flex;
gap: 24px;
margin: 0;
padding: 0;
list-style: none;
li {
display: grid;
grid-template-columns: auto 1fr;
align-items: center;
gap: 8px;
min-width: 92px;
color: var(--muted);
font-size: 13px;
}
b {
color: #59e5dd;
font: 600 12px/1 "Consolas", monospace;
}
}
.module-section {
width: min(1120px, 100%);
margin: 0 auto;
}
.section-heading {
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 24px;
margin-bottom: 20px;
span {
color: #59e5dd;
font-size: 13px;
}
h2 {
margin: 5px 0 0;
font-size: clamp(20px, 2vw, 28px);
}
> p {
max-width: 390px;
margin: 0;
color: var(--muted);
font-size: 13px;
line-height: 1.7;
text-align: right;
}
}
.module-grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: clamp(14px, 2vw, 24px);
}
.module-card {
position: relative;
background: url("@/assets/images/背景.webp") no-repeat;
background-size: 100% 100%;
.handren-title {
text-align: center;
h3 {
font-size: 1.5rem;
line-height: 2.5rem;
margin-top: 0px;
color: #ffffff;
font-weight: 600;
}
display: flex;
align-items: flex-start;
gap: 18px;
min-width: 0;
min-height: 150px;
padding: 24px;
overflow: hidden;
color: inherit;
text-align: left;
background: linear-gradient(145deg, rgba(7, 35, 69, 0.95), rgba(3, 20, 45, 0.9));
border: 1px solid var(--line);
border-radius: 16px;
box-shadow: 0 18px 40px rgba(0, 4, 17, 0.2);
cursor: pointer;
transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
&::after {
content: "";
position: absolute;
right: -32px;
bottom: -52px;
width: 135px;
height: 135px;
background: radial-gradient(circle, var(--module-accent) 0, transparent 68%);
opacity: 0.2;
transition: opacity 180ms ease, transform 180ms ease;
}
&:hover,
&:focus-visible {
border-color: var(--module-accent);
box-shadow: 0 18px 42px rgba(0, 8, 26, 0.42);
outline: none;
transform: translateY(-4px);
}
&:hover::after,
&:focus-visible::after {
opacity: 0.38;
transform: scale(1.12);
}
}
.module-index,
.dialog-module-index {
display: inline-grid;
flex: 0 0 44px;
width: 44px;
height: 44px;
place-items: center;
color: #031425;
background: var(--module-accent, #59e5dd);
border-radius: 12px;
font: 700 14px/1 "Consolas", monospace;
}
.module-card__content {
display: flex;
min-width: 0;
flex: 1;
flex-direction: column;
small {
color: var(--module-accent);
font: 600 10px/1.2 "Consolas", monospace;
letter-spacing: 0.12em;
}
strong {
min-height: 48px;
margin: 9px 0 12px;
font-size: clamp(16px, 1.35vw, 20px);
line-height: 1.5;
}
em {
color: var(--muted);
font-size: 12px;
font-style: normal;
}
}
:deep(.lesson-plan-dialog) {
max-width: calc(100vw - 32px);
background: #061a31;
border: 1px solid rgba(92, 180, 255, 0.3);
border-radius: 18px;
box-shadow: 0 28px 90px rgba(0, 5, 18, 0.68);
.el-dialog__header {
margin: 0;
padding: 22px 26px 18px;
border-bottom: 1px solid rgba(92, 180, 255, 0.18);
}
.el-dialog__body {
padding: 22px 26px;
color: #eff9ff;
}
.el-dialog__footer {
padding: 16px 26px 22px;
border-top: 1px solid rgba(92, 180, 255, 0.18);
}
.el-dialog__close {
color: #b9d2e8;
}
.el-button {
min-width: 88px;
color: #c5dced !important;
background: #0a2947 !important;
background-image: none !important;
border: 1px solid rgba(92, 180, 255, 0.35) !important;
border-radius: 8px !important;
}
.el-button--primary {
color: #031425 !important;
background: #59e5dd !important;
border-color: #59e5dd !important;
font-weight: 700;
}
}
.dialog-heading {
display: flex;
align-items: center;
gap: 14px;
h2 {
margin: 3px 0 0;
color: #f5fbff;
font-size: 20px;
}
small {
color: #59e5dd;
}
}
.dialog-module-index {
--module-accent: #59e5dd;
}
.setup-layout {
display: grid;
grid-template-columns: minmax(0, 1.55fr) minmax(250px, 0.85fr);
gap: 20px;
}
.prompt-panel,
.template-panel {
min-width: 0;
}
.setup-layout > .template-panel {
padding: 0;
color: #eff9ff;
background: transparent;
border: 0;
border-radius: 0;
box-shadow: none;
}
.panel-title {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 14px;
margin-bottom: 13px;
span {
font-weight: 700;
}
p {
margin: 5px 0 0;
color: #8ca9c0;
font-size: 12px;
line-height: 1.5;
}
}
.text-action {
flex: 0 0 auto;
padding: 0;
color: #59e5dd;
background: transparent;
border: 0;
font: inherit;
cursor: pointer;
}
.prompt-panel :deep(.el-textarea__inner) {
padding: 15px 16px;
color: #eaf8ff;
background: #031326;
border: 1px solid rgba(92, 180, 255, 0.24);
border-radius: 12px;
box-shadow: none;
font-family: "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
line-height: 1.75;
&:focus {
border-color: #59e5dd;
}
}
.template-dropzone {
display: flex;
min-height: 210px;
align-items: center;
justify-content: center;
flex-direction: column;
padding: 22px;
text-align: center;
background: rgba(3, 19, 38, 0.76);
border: 1px dashed rgba(89, 229, 221, 0.48);
border-radius: 14px;
cursor: pointer;
transition: border-color 160ms ease, background 160ms ease;
&:hover,
&:focus-visible {
background: rgba(10, 47, 70, 0.78);
border-color: #59e5dd;
outline: none;
}
p {
margin: 9px 0 5px;
color: #aec5d7;
font-size: 13px;
}
small {
color: #7895ad;
}
}
.upload-mark {
display: grid;
width: 46px;
height: 46px;
margin-bottom: 14px;
place-items: center;
color: #031425;
background: #59e5dd;
border-radius: 14px;
font-size: 25px;
font-weight: 700;
}
.template-file {
display: grid;
grid-template-columns: 48px minmax(0, 1fr) 26px;
align-items: center;
gap: 12px;
min-height: 92px;
padding: 15px;
background: rgba(3, 19, 38, 0.76);
border: 1px solid rgba(89, 229, 221, 0.34);
border-radius: 14px;
strong,
p {
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
p {
margin: 6px 0 0;
color: #8ca9c0;
font-size: 12px;
}
button {
color: #a9c2d5;
background: transparent;
border: 0;
font-size: 22px;
cursor: pointer;
}
}
.file-badge {
display: grid;
width: 48px;
height: 48px;
place-items: center;
color: #59e5dd;
background: rgba(89, 229, 221, 0.11);
border-radius: 10px;
font: 700 10px/1 "Consolas", monospace;
}
.template-note {
margin-top: 14px;
padding: 13px 14px;
color: #92aec4;
background: rgba(73, 139, 255, 0.08);
border-left: 2px solid #4a8dff;
border-radius: 0 9px 9px 0;
b {
color: #b9d8ff;
font-size: 12px;
}
p {
margin: 4px 0 0;
font-size: 12px;
line-height: 1.6;
}
}
.dialog-footer {
display: flex;
align-items: center;
justify-content: space-between;
gap: 20px;
> span {
color: #829eb5;
font-size: 12px;
}
}
.visually-hidden {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
@media (max-width: 1180px) {
.lesson-plan-page {
padding: 24px 28px;
}
.content {
color: #ffffff;
margin-top: 4rem;
height: calc(100vh - 200px);
padding: 0px 10rem;
.teaching-plan {
display: flex;
align-items: center;
justify-content: center;
gap: 7rem;
flex-wrap: wrap;
.teaching-plan-item {
position: relative;
min-width: 13rem;
height: 10rem;
border-radius: 8px;
padding: 0px 1rem;
background: #ffffff;
display: flex;
align-items: center;
justify-content: center;
font-size: 1.5rem;
font-weight: 600;
color: #ffffff;
background: linear-gradient(135deg, #6b46c1 0%, #805ad5 100%);
// 鼠标小手
cursor: pointer;
overflow: hidden;
&::before {
content: "";
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: linear-gradient(45deg, transparent 0%, rgba(255, 255, 255, 0.1) 45%, rgba(255, 255, 255, 0.5) 50%, rgba(255, 255, 255, 0.1) 55%, transparent 100%);
transform: rotate(45deg);
animation: shine 3s infinite;
}
}
@keyframes shine {
0% {
left: -50%;
}
100% {
left: 150%;
}
}
.lesson-plan-hero {
align-items: flex-start;
}
.workflow {
gap: 12px;
li {
min-width: auto;
}
}
.module-card {
min-height: 136px;
padding: 20px;
}
}
@media (max-width: 900px) {
.lesson-plan-hero,
.section-heading,
.dialog-footer {
align-items: flex-start;
flex-direction: column;
}
.module-grid,
.setup-layout {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.section-heading > p {
text-align: left;
}
}
@media (max-width: 640px) {
.lesson-plan-page {
padding: 20px 16px;
}
.workflow {
width: 100%;
justify-content: space-between;
}
.module-grid,
.setup-layout {
grid-template-columns: 1fr;
}
.module-card {
min-height: 128px;
}
}
</style>

@ -1,25 +0,0 @@
const assert = require("assert");
const {
LESSON_PLAN_MODULES,
buildTeachingPlanPrompt,
} = require("../src/views/analysis-of-students/lessonPlanPrompt.cjs");
const expectedModules = [
"互联网产品开发基础认知",
"市场洞察与需求分析",
"产品规划与设计",
"产品开发与测试验证",
"产品上线与运营推广",
"综合实训",
];
assert.deepStrictEqual(LESSON_PLAN_MODULES, expectedModules, "lesson-plan module selector must expose the six current modules");
const prompt = buildTeachingPlanPrompt("市场洞察与需求分析");
assert.match(prompt, /互联网产品开发实训课程/, "prompt must identify the course");
assert.match(prompt, /市场洞察与需求分析/, "prompt must identify the selected module");
for (const section of ["教学目标", "实训任务", "实施步骤", "预期成果", "评价要点"]) {
assert.match(prompt, new RegExp(section), `prompt must require ${section}`);
}
console.log("AI training lesson plan checks passed");

@ -0,0 +1,51 @@
import assert from "node:assert";
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import {
LESSON_PLAN_MODULES,
buildTeachingPlanPrompt,
buildTeachingPlanRequest,
} from "../src/views/analysis-of-students/lessonPlanPrompt.mjs";
const expectedModules = [
"互联网产品开发基础认知",
"市场洞察与需求分析",
"产品规划与设计",
"产品开发与测试验证",
"产品上线与运营推广",
"综合实训",
];
assert.deepStrictEqual(LESSON_PLAN_MODULES, expectedModules, "lesson-plan module selector must expose the six current modules");
const prompt = buildTeachingPlanPrompt("市场洞察与需求分析");
assert.match(prompt, /互联网产品开发实训课程/, "prompt must identify the course");
assert.match(prompt, /市场洞察与需求分析/, "prompt must identify the selected module");
for (const section of ["教学目标", "实训任务", "实施步骤", "预期成果", "评价要点"]) {
assert.match(prompt, new RegExp(section), `prompt must require ${section}`);
}
const customized = buildTeachingPlanRequest(
"市场洞察与需求分析",
"生成两课时教案",
"学校教案模板.docx",
"一、教学目标\n二、教学过程",
);
assert.match(customized, /生成两课时教案/, "teacher-edited prompt must be used");
assert.match(customized, /学校教案模板\.docx/, "template name must be identified");
assert.match(customized, /一、教学目标/, "template content must be included in the generation request");
const currentDirectory = path.dirname(fileURLToPath(import.meta.url));
const page = fs.readFileSync(
path.join(currentDirectory, "..", "src", "views", "analysis-of-students", "training-lesson-plan.vue"),
"utf8",
);
assert.match(page, /openLessonPlanSetup/, "module click must open setup instead of generating immediately");
assert.doesNotMatch(page, /@click="generateTeachingPlan\(item\)"/, "module click must not generate immediately");
assert.match(page, /参考提示词/);
assert.match(page, /学校参考模板/);
assert.match(page, /生成教案/);
assert.match(page, /grid-template-columns: repeat\(3/, "laptop layout must use a compact three-column grid");
console.log("AI training lesson plan checks passed");
Loading…
Cancel
Save