466 lines
62 KiB
HTML
466 lines
62 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="zh-CN">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>学情分析报告 - 用户12345 Level1 Unit1</title>
|
||
<script src="https://cdn.jsdelivr.net/npm/echarts@5.4.3/dist/echarts.min.js"></script>
|
||
<script src="https://cdn.tailwindcss.com"></script>
|
||
<script>
|
||
tailwind.config = {
|
||
theme: {
|
||
extend: {
|
||
colors: {
|
||
accent: { DEFAULT: '#7A5ADB', light: '#EDE9F9', dark: '#5B3DB0' }
|
||
}
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
<style>
|
||
.chart-container { height: 360px; width: 100%; }
|
||
.lesson-detail { display: none; }
|
||
.lesson-detail.active { display: block; }
|
||
.lesson-card { transition: all 0.25s ease; }
|
||
.lesson-card:hover { transform: translateY(-2px); }
|
||
.lesson-card.active {
|
||
background: linear-gradient(135deg, #7A5ADB 0%, #5B3DB0 100%);
|
||
color: white;
|
||
border-color: transparent;
|
||
}
|
||
.lesson-card.active .stat-value-oops,
|
||
.lesson-card.active .stat-value-wrong { color: #fecaca !important; }
|
||
.lesson-card.active .time-label-dim { opacity: 0.7; }
|
||
.lesson-card.active .border-accent-light { border-color: rgba(255,255,255,0.25); }
|
||
.audio-btn { cursor: pointer; transition: opacity 0.2s; }
|
||
.audio-btn:hover { opacity: 1; }
|
||
.audio-btn.playing { color: #7A5ADB; opacity: 1; }
|
||
table { border-collapse: collapse; }
|
||
</style>
|
||
</head>
|
||
<body class="bg-gray-50 text-gray-700 antialiased">
|
||
<div class="max-w-6xl mx-auto px-4 sm:px-6 py-6 sm:py-10">
|
||
|
||
<!-- Header -->
|
||
<div class="rounded-2xl bg-gradient-to-br from-accent to-accent-dark text-white px-6 sm:px-10 py-8 mb-6">
|
||
<h1 class="text-2xl sm:text-3xl font-bold tracking-tight">学情分析报告</h1>
|
||
<p class="mt-2 text-sm opacity-80">用户ID:12345 · Level 1 · Unit 1 · 2026-04-03 10:13:13</p>
|
||
</div>
|
||
|
||
<!-- 总览 -->
|
||
<div class="bg-white rounded-2xl shadow-sm p-6 mb-5">
|
||
<h2 class="text-lg font-semibold text-gray-800 border-l-4 border-accent pl-3 mb-5">总览</h2>
|
||
<div class="grid grid-cols-2 sm:grid-cols-4 gap-4" id="stats-grid"></div>
|
||
</div>
|
||
|
||
<!-- 图表 -->
|
||
<div class="grid grid-cols-1 lg:grid-cols-3 gap-5 mb-5">
|
||
<div class="bg-white rounded-2xl shadow-sm p-6">
|
||
<h2 class="text-base font-semibold text-gray-800 border-l-4 border-accent pl-3 mb-4">互动组件表现</h2>
|
||
<div id="interactive-chart" class="chart-container"></div>
|
||
</div>
|
||
<div class="bg-white rounded-2xl shadow-sm p-6">
|
||
<h2 class="text-base font-semibold text-gray-800 border-l-4 border-accent pl-3 mb-4">巩固练习正确率</h2>
|
||
<div id="exercise-chart" class="chart-container"></div>
|
||
</div>
|
||
<div class="bg-white rounded-2xl shadow-sm p-6">
|
||
<h2 class="text-base font-semibold text-gray-800 border-l-4 border-accent pl-3 mb-4">能力训练正确率</h2>
|
||
<div id="ability-chart" class="chart-container"></div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 课程详情 -->
|
||
<div class="bg-white rounded-2xl shadow-sm p-6 mb-5">
|
||
<h2 class="text-lg font-semibold text-gray-800 border-l-4 border-accent pl-3 mb-5">课程详情</h2>
|
||
<div class="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3 mb-6" id="lesson-nav"></div>
|
||
<div id="lesson-details"></div>
|
||
</div>
|
||
|
||
<!-- 能力训练 -->
|
||
<div class="bg-white rounded-2xl shadow-sm p-6 mb-5">
|
||
<h2 class="text-lg font-semibold text-gray-800 border-l-4 border-accent pl-3 mb-5">能力训练</h2>
|
||
<div class="overflow-x-auto">
|
||
<table class="w-full text-sm" id="ability-training-table">
|
||
<thead>
|
||
<tr class="border-b-2 border-gray-100">
|
||
<th class="text-left py-3 px-3 font-semibold text-gray-500 bg-gray-50/60">#</th>
|
||
<th class="text-left py-3 px-3 font-semibold text-gray-500 bg-gray-50/60">来源</th>
|
||
<th class="text-left py-3 px-3 font-semibold text-gray-500 bg-gray-50/60">题型</th>
|
||
<th class="text-left py-3 px-3 font-semibold text-gray-500 bg-gray-50/60">标题</th>
|
||
<th class="text-left py-3 px-3 font-semibold text-gray-500 bg-gray-50/60 hidden sm:table-cell">题目详情</th>
|
||
<th class="text-left py-3 px-3 font-semibold text-gray-500 bg-gray-50/60">子题目</th>
|
||
<th class="text-left py-3 px-3 font-semibold text-gray-500 bg-gray-50/60">结果</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody id="ability-training-tbody"></tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<script>
|
||
const data = {"role_id": 12345, "level": 1, "unit": 1, "unit_name": "Unit 1: Hello World", "lessons": [{"lesson_id": 1, "lesson_name": "Lesson 1: Greetings", "entry_time": "2024-01-15T09:00:00Z", "completion_time": "2024-01-15T09:25:30Z", "consolidation_entry_time": "2024-01-15T09:26:00Z", "consolidation_completion_time": "2024-01-15T09:40:00Z", "knowledge_points": {"words": [{"word": "hello", "meaning": "你好", "pos": "int."}, {"word": "hi", "meaning": "嗨", "pos": "int."}, {"word": "goodbye", "meaning": "再见", "pos": "int."}, {"word": "name", "meaning": "名字", "pos": "n."}], "sentence_patterns": [{"pattern": "Hello, my name is [name].", "meaning": "你好,我的名字是[名字]。", "example": "Hello, my name is Tom."}, {"pattern": "Nice to meet you.", "meaning": "很高兴认识你。", "example": "Nice to meet you too."}]}, "interactive_components": [{"component_id": "ic_001", "type": "单词跟读", "detail": "请跟读单词 hello,注意发音准确", "user_result": "perfect", "knowledge": "hello", "audio": "https://audio.valavala.com/ic_001.mp3"}, {"component_id": "ic_002", "type": "单词跟读", "detail": "请跟读单词 hi,注意语调自然", "user_result": "good", "knowledge": "hi", "audio": "https://audio.valavala.com/ic_002.mp3"}, {"component_id": "ic_003", "type": "单词听选", "detail": "听录音,选择正确的单词 goodbye", "user_result": "perfect", "knowledge": "goodbye"}, {"component_id": "ic_004", "type": "单词拼写", "detail": "根据发音,拼写出单词 name", "user_result": "good", "knowledge": "name"}, {"component_id": "ic_005", "type": "句型跟读", "detail": "请跟读句型:Hello, my name is [name]", "user_result": "perfect", "knowledge": "Hello, my name is [name].", "audio": "https://audio.valavala.com/ic_005.mp3"}, {"component_id": "ic_006", "type": "句型替换练习", "detail": "替换名字,完成句子:Hello, my name is ______", "user_result": "oops", "knowledge": "Hello, my name is [name]."}, {"component_id": "ic_007", "type": "情景对话", "detail": "在情景中与角色进行打招呼对话", "user_result": "good", "knowledge": "Hello, my name is [name].", "audio": "https://audio.valavala.com/ic_007.mp3"}, {"component_id": "ic_008", "type": "听力理解", "detail": "听录音,选择正确的问候回应", "user_result": "perfect", "knowledge": "Nice to meet you."}, {"component_id": "ic_009", "type": "语音识别", "detail": "请说出单词 hi", "user_result": "good", "knowledge": "hi", "audio": "https://audio.valavala.com/ic_009.mp3"}, {"component_id": "ic_010", "type": "图文匹配", "detail": "将单词与对应的图片进行匹配", "user_result": "perfect", "knowledge": "hello"}, {"component_id": "ic_011", "type": "句型听选", "detail": "听录音,选择正确的回应", "user_result": "good", "knowledge": "Nice to meet you."}, {"component_id": "ic_012", "type": "角色扮演", "detail": "扮演角色进行自我介绍对话", "user_result": "perfect", "knowledge": "Hello, my name is [name].", "audio": "https://audio.valavala.com/ic_012.mp3"}, {"component_id": "ic_013", "type": "单词排序", "detail": "将单词按正确顺序排列成句子", "user_result": "oops", "knowledge": "Hello, my name is [name]."}, {"component_id": "ic_014", "type": "发音练习", "detail": "练习疑问句和陈述句的语调区别", "user_result": "good", "knowledge": "Nice to meet you.", "audio": "https://audio.valavala.com/ic_014.mp3"}, {"component_id": "ic_015", "type": "单词填空", "detail": "在句子中填入正确的单词", "user_result": "perfect", "knowledge": "name"}, {"component_id": "ic_016", "type": "情景判断", "detail": "根据情景选择最合适的回应", "user_result": "good", "knowledge": "Nice to meet you."}, {"component_id": "ic_017", "type": "综合对话", "detail": "完成完整的打招呼和自我介绍对话", "user_result": "perfect", "knowledge": "Hello, my name is [name].", "audio": "https://audio.valavala.com/ic_017.mp3"}, {"component_id": "ic_018", "type": "复习测验", "detail": "完成本课知识点的综合复习测验", "user_result": "good", "knowledge": "Nice to meet you."}], "consolidation_exercises": [{"exercise_id": "ce_001", "type": "单词听选", "detail": "听录音,从A、B、C三个选项中选择听到的单词", "is_correct": true, "knowledge": "hello"}, {"exercise_id": "ce_002", "type": "单词拼写", "detail": "根据中文意思,写出对应的英文单词:你好", "is_correct": true, "knowledge": "hello"}, {"exercise_id": "ce_003", "type": "图文匹配", "detail": "将单词 goodbye 与对应的图片匹配", "is_correct": false, "knowledge": "goodbye"}, {"exercise_id": "ce_004", "type": "句型填空", "detail": "用正确的单词填空:Hello, my ______ is Tom.", "is_correct": true, "knowledge": "Hello, my name is [name]."}, {"exercise_id": "ce_005", "type": "情景选择", "detail": "初次见面时,应该说:A. Hello B. Goodbye C. Hi", "is_correct": true, "knowledge": "hello"}, {"exercise_id": "ce_006", "type": "句子排序", "detail": "将下列单词排列成正确的句子:name / my / is / Hello", "is_correct": true, "knowledge": "Hello, my name is [name]."}, {"exercise_id": "ce_007", "type": "听力理解", "detail": "听对话,回答问题:他们正在做什么?", "is_correct": false, "knowledge": "Nice to meet you."}, {"exercise_id": "ce_008", "type": "发音选择", "detail": "听录音,选择包含 /eɪ/ 音的单词", "is_correct": true, "knowledge": "name", "audio": "https://audio.valavala.com/ce_008.mp3"}, {"exercise_id": "ce_009", "type": "翻译练习", "detail": "将下列句子翻译成英文:很高兴认识你。", "is_correct": true, "knowledge": "Nice to meet you."}, {"exercise_id": "ce_010", "type": "对话补全", "detail": "补全对话:A: Hello! B: ______!", "is_correct": true, "knowledge": "hello"}, {"exercise_id": "ce_011", "type": "单词分类", "detail": "将单词按问候语和非问候语分类", "is_correct": false, "knowledge": "hello"}, {"exercise_id": "ce_012", "type": "句型转换", "detail": "将 Hello 转换为同义词", "is_correct": true, "knowledge": "hi"}, {"exercise_id": "ce_013", "type": "连线匹配", "detail": "将单词与对应的中文意思连线", "is_correct": true, "knowledge": "goodbye"}, {"exercise_id": "ce_014", "type": "判断正误", "detail": "判断句子是否正确:Goodbye 用于告别时说。", "is_correct": true, "knowledge": "goodbye"}, {"exercise_id": "ce_015", "type": "选词填空", "detail": "选择合适的单词填空:______ to meet you. (Nice/Fine/Good)", "is_correct": true, "knowledge": "Nice to meet you."}, {"exercise_id": "ce_016", "type": "语音辨识", "detail": "听录音,判断是哪个单词", "is_correct": false, "knowledge": "hi", "audio": "https://audio.valavala.com/ce_016.mp3"}, {"exercise_id": "ce_017", "type": "完形填空", "detail": "阅读短文,选择合适的问候语填入空格", "is_correct": true, "knowledge": "hello"}, {"exercise_id": "ce_018", "type": "综合测验", "detail": "完成本课知识的综合测验题", "is_correct": true, "knowledge": "Nice to meet you."}]}, {"lesson_id": 2, "lesson_name": "Lesson 2: Numbers", "entry_time": "2024-01-16T10:00:00Z", "completion_time": "2024-01-16T10:30:15Z", "consolidation_entry_time": "2024-01-16T10:31:00Z", "consolidation_completion_time": "2024-01-16T10:50:00Z", "knowledge_points": {"words": [{"word": "one", "meaning": "一", "pos": "num."}, {"word": "two", "meaning": "二", "pos": "num."}, {"word": "three", "meaning": "三", "pos": "num."}, {"word": "ten", "meaning": "十", "pos": "num."}], "sentence_patterns": [{"pattern": "How old are you? I am [number].", "meaning": "你几岁了?我[数字]岁。", "example": "How old are you? I am five."}, {"pattern": "I have [number] [noun].", "meaning": "我有[数字]个[名词]。", "example": "I have three books."}]}, "interactive_components": [{"component_id": "ic_201", "type": "单词跟读", "detail": "请跟读数字 one", "user_result": "perfect", "knowledge": "one", "audio": "https://audio.valavala.com/ic_201.mp3"}, {"component_id": "ic_202", "type": "单词跟读", "detail": "请跟读数字 two", "user_result": "perfect", "knowledge": "two", "audio": "https://audio.valavala.com/ic_202.mp3"}, {"component_id": "ic_203", "type": "单词听选", "detail": "听录音,选择正确的数字 three", "user_result": "good", "knowledge": "three"}, {"component_id": "ic_204", "type": "单词拼写", "detail": "根据发音,拼写出数字 ten", "user_result": "perfect", "knowledge": "ten"}, {"component_id": "ic_205", "type": "句型跟读", "detail": "请跟读句型:How old are you?", "user_result": "good", "knowledge": "How old are you? I am [number].", "audio": "https://audio.valavala.com/ic_205.mp3"}, {"component_id": "ic_206", "type": "数字排序练习", "detail": "将数字按从小到大排序", "user_result": "perfect", "knowledge": "one"}, {"component_id": "ic_207", "type": "情景对话", "detail": "在情景中询问和回答年龄", "user_result": "good", "knowledge": "How old are you? I am [number].", "audio": "https://audio.valavala.com/ic_207.mp3"}, {"component_id": "ic_208", "type": "听力理解", "detail": "听录音,写出听到的数字", "user_result": "perfect", "knowledge": "three"}, {"component_id": "ic_209", "type": "语音识别", "detail": "请说出数字 three", "user_result": "good", "knowledge": "three", "audio": "https://audio.valavala.com/ic_209.mp3"}, {"component_id": "ic_210", "type": "图文匹配", "detail": "将数字单词与对应的数量匹配", "user_result": "perfect", "knowledge": "ten"}, {"component_id": "ic_211", "type": "数学计算", "detail": "计算并写出英文结果:1+2=?", "user_result": "good", "knowledge": "three"}, {"component_id": "ic_212", "type": "角色扮演", "detail": "扮演角色介绍自己的年龄", "user_result": "perfect", "knowledge": "How old are you? I am [number].", "audio": "https://audio.valavala.com/ic_212.mp3"}, {"component_id": "ic_213", "type": "数字接龙", "detail": "按顺序接出下一个数字单词", "user_result": "oops", "knowledge": "one"}, {"component_id": "ic_214", "type": "听写练习", "detail": "听写数字单词 one 到 ten", "user_result": "good", "knowledge": "ten"}, {"component_id": "ic_215", "type": "句型填空", "detail": "用正确的数字填空:I have ______ books.", "user_result": "perfect", "knowledge": "I have [number] [noun]."}, {"component_id": "ic_216", "type": "快速反应", "detail": "看到数字快速说出英文", "user_result": "good", "knowledge": "two", "audio": "https://audio.valavala.com/ic_216.mp3"}, {"component_id": "ic_217", "type": "综合对话", "detail": "完成关于数字的完整对话", "user_result": "perfect", "knowledge": "How old are you? I am [number].", "audio": "https://audio.valavala.com/ic_217.mp3"}, {"component_id": "ic_218", "type": "复习测验", "detail": "完成数字知识点的综合复习", "user_result": "good", "knowledge": "I have [number] [noun]."}], "consolidation_exercises": [{"exercise_id": "ce_201", "type": "单词听选", "detail": "听录音,选择听到的数字单词", "is_correct": true, "knowledge": "one"}, {"exercise_id": "ce_202", "type": "单词拼写", "detail": "根据中文写出英文数字:三", "is_correct": true, "knowledge": "three"}, {"exercise_id": "ce_203", "type": "图文匹配", "detail": "将数字 ten 与对应的数量图匹配", "is_correct": true, "knowledge": "ten"}, {"exercise_id": "ce_204", "type": "句型填空", "detail": "填空:How old are you? I am ______.", "is_correct": false, "knowledge": "How old are you? I am [number]."}, {"exercise_id": "ce_205", "type": "听力计算", "detail": "听数字,计算并选择正确答案:2+3=?", "is_correct": true, "knowledge": "two"}, {"exercise_id": "ce_206", "type": "句子排序", "detail": "排列句子:you / How / are / old", "is_correct": true, "knowledge": "How old are you? I am [number]."}, {"exercise_id": "ce_207", "type": "听力理解", "detail": "听对话,回答问题:男孩几岁?", "is_correct": true, "knowledge": "How old are you? I am [number]."}, {"exercise_id": "ce_208", "type": "数字排序", "detail": "将下列数字按从小到大排列", "is_correct": true, "knowledge": "one"}, {"exercise_id": "ce_209", "type": "翻译练习", "detail": "翻译:我有三本书。", "is_correct": false, "knowledge": "I have [number] [noun]."}, {"exercise_id": "ce_210", "type": "对话补全", "detail": "补全对话:A: How old are you? B: ______", "is_correct": true, "knowledge": "How old are you? I am [number]."}, {"exercise_id": "ce_211", "type": "数字识别", "detail": "选择正确的数字单词拼写", "is_correct": true, "knowledge": "two"}, {"exercise_id": "ce_212", "type": "数学应用", "detail": "Mary有2个苹果,Tom有3个,共有几个?", "is_correct": true, "knowledge": "I have [number] [noun]."}, {"exercise_id": "ce_213", "type": "连线匹配", "detail": "将数字与英文单词连线", "is_correct": true, "knowledge": "three"}, {"exercise_id": "ce_214", "type": "判断正误", "detail": "判断:one 表示数字 1。", "is_correct": true, "knowledge": "one"}, {"exercise_id": "ce_215", "type": "选词填空", "detail": "选择正确数字填空:I have ______ (one/two/three) pens.", "is_correct": true, "knowledge": "I have [number] [noun]."}, {"exercise_id": "ce_216", "type": "数字书写", "detail": "根据读音写出数字单词", "is_correct": false, "knowledge": "ten"}, {"exercise_id": "ce_217", "type": "完形填空", "detail": "阅读短文,填入正确的数字单词", "is_correct": true, "knowledge": "three"}, {"exercise_id": "ce_218", "type": "综合测验", "detail": "完成数字单元综合测验", "is_correct": true, "knowledge": "How old are you? I am [number]."}]}, {"lesson_id": 3, "lesson_name": "Lesson 3: Colors", "entry_time": "2024-01-17T09:15:00Z", "completion_time": "2024-01-17T09:45:20Z", "consolidation_entry_time": "2024-01-17T09:46:00Z", "consolidation_completion_time": "2024-01-17T10:05:00Z", "knowledge_points": {"words": [{"word": "red", "meaning": "红色", "pos": "n./adj."}, {"word": "blue", "meaning": "蓝色", "pos": "n./adj."}, {"word": "green", "meaning": "绿色", "pos": "n./adj."}, {"word": "yellow", "meaning": "黄色", "pos": "n./adj."}], "sentence_patterns": [{"pattern": "What color is it? It is [color].", "meaning": "这是什么颜色?这是[颜色]。", "example": "What color is it? It is red."}, {"pattern": "I like [color].", "meaning": "我喜欢[颜色]。", "example": "I like blue."}]}, "interactive_components": [{"component_id": "ic_301", "type": "单词跟读", "detail": "请跟读颜色单词 red", "user_result": "perfect", "knowledge": "red", "audio": "https://audio.valavala.com/ic_301.mp3"}, {"component_id": "ic_302", "type": "单词跟读", "detail": "请跟读颜色单词 blue", "user_result": "good", "knowledge": "blue", "audio": "https://audio.valavala.com/ic_302.mp3"}, {"component_id": "ic_303", "type": "单词听选", "detail": "听录音,选择正确的颜色单词", "user_result": "perfect", "knowledge": "green"}, {"component_id": "ic_304", "type": "单词拼写", "detail": "根据发音,拼写出颜色单词 yellow", "user_result": "good", "knowledge": "yellow"}, {"component_id": "ic_305", "type": "句型跟读", "detail": "请跟读句型:What color is it?", "user_result": "perfect", "knowledge": "What color is it? It is [color].", "audio": "https://audio.valavala.com/ic_305.mp3"}, {"component_id": "ic_306", "type": "颜色识别练习", "detail": "看图片,说出颜色名称", "user_result": "perfect", "knowledge": "red", "audio": "https://audio.valavala.com/ic_306.mp3"}, {"component_id": "ic_307", "type": "情景对话", "detail": "在情景中询问物品颜色", "user_result": "good", "knowledge": "What color is it? It is [color].", "audio": "https://audio.valavala.com/ic_307.mp3"}, {"component_id": "ic_308", "type": "听力理解", "detail": "听录音,选择听到的颜色", "user_result": "perfect", "knowledge": "green"}, {"component_id": "ic_309", "type": "语音识别", "detail": "请说出颜色 green", "user_result": "oops", "knowledge": "green", "audio": "https://audio.valavala.com/ic_309.mp3"}, {"component_id": "ic_310", "type": "图文匹配", "detail": "将颜色单词与对应颜色块匹配", "user_result": "perfect", "knowledge": "yellow"}, {"component_id": "ic_311", "type": "颜色混合", "detail": "蓝色加黄色变成什么颜色?", "user_result": "good", "knowledge": "green"}, {"component_id": "ic_312", "type": "角色扮演", "detail": "扮演角色描述周围物品颜色", "user_result": "perfect", "knowledge": "What color is it? It is [color].", "audio": "https://audio.valavala.com/ic_312.mp3"}, {"component_id": "ic_313", "type": "颜色分类", "detail": "将物品按颜色分类", "user_result": "good", "knowledge": "red"}, {"component_id": "ic_314", "type": "涂色游戏", "detail": "听指令给图片涂上正确的颜色", "user_result": "perfect", "knowledge": "blue"}, {"component_id": "ic_315", "type": "句型填空", "detail": "用颜色填空:I like ______.", "user_result": "good", "knowledge": "I like [color]."}, {"component_id": "ic_316", "type": "快速反应", "detail": "看到颜色快速说出英文", "user_result": "perfect", "knowledge": "yellow", "audio": "https://audio.valavala.com/ic_316.mp3"}, {"component_id": "ic_317", "type": "综合对话", "detail": "完成关于颜色的完整对话", "user_result": "good", "knowledge": "What color is it? It is [color].", "audio": "https://audio.valavala.com/ic_317.mp3"}, {"component_id": "ic_318", "type": "复习测验", "detail": "完成颜色知识点的综合复习", "user_result": "perfect", "knowledge": "I like [color]."}], "consolidation_exercises": [{"exercise_id": "ce_301", "type": "单词听选", "detail": "听录音,选择听到的颜色单词", "is_correct": true, "knowledge": "red"}, {"exercise_id": "ce_302", "type": "单词拼写", "detail": "根据中文写出颜色英文:红色", "is_correct": true, "knowledge": "red"}, {"exercise_id": "ce_303", "type": "图文匹配", "detail": "将 green 与绿色图片匹配", "is_correct": true, "knowledge": "green"}, {"exercise_id": "ce_304", "type": "句型填空", "detail": "填空:What color is it? It is ______.", "is_correct": true, "knowledge": "What color is it? It is [color]."}, {"exercise_id": "ce_305", "type": "颜色识别", "detail": "选择天空的颜色:A. blue B. red C. green", "is_correct": true, "knowledge": "blue"}, {"exercise_id": "ce_306", "type": "句子排序", "detail": "排列句子:is / it / What / color", "is_correct": true, "knowledge": "What color is it? It is [color]."}, {"exercise_id": "ce_307", "type": "听力理解", "detail": "听描述,选择正确的物品颜色", "is_correct": false, "knowledge": "yellow"}, {"exercise_id": "ce_308", "type": "颜色混合", "detail": "红色加黄色变成什么颜色?", "is_correct": true, "knowledge": "red"}, {"exercise_id": "ce_309", "type": "翻译练习", "detail": "翻译:我喜欢蓝色。", "is_correct": true, "knowledge": "I like [color]."}, {"exercise_id": "ce_310", "type": "对话补全", "detail": "补全对话:A: What color is it? B: ______", "is_correct": true, "knowledge": "What color is it? It is [color]."}, {"exercise_id": "ce_311", "type": "物品分类", "detail": "将红色物品圈出来", "is_correct": true, "knowledge": "red"}, {"exercise_id": "ce_312", "type": "颜色联想", "detail": "苹果通常是什么颜色?", "is_correct": true, "knowledge": "red"}, {"exercise_id": "ce_313", "type": "连线匹配", "detail": "将颜色与对应物品连线", "is_correct": true, "knowledge": "green"}, {"exercise_id": "ce_314", "type": "判断正误", "detail": "判断:yellow 是黄色。", "is_correct": true, "knowledge": "yellow"}, {"exercise_id": "ce_315", "type": "选词填空", "detail": "The sky is ______ (red/blue/green).", "is_correct": true, "knowledge": "blue"}, {"exercise_id": "ce_316", "type": "颜色书写", "detail": "根据读音写出颜色单词", "is_correct": false, "knowledge": "yellow"}, {"exercise_id": "ce_317", "type": "完形填空", "detail": "阅读短文,填入正确的颜色单词", "is_correct": true, "knowledge": "green"}, {"exercise_id": "ce_318", "type": "综合测验", "detail": "完成颜色单元综合测验", "is_correct": true, "knowledge": "I like [color]."}]}, {"lesson_id": 4, "lesson_name": "Lesson 4: Family", "entry_time": "2024-01-18T14:00:00Z", "completion_time": "2024-01-18T14:35:10Z", "consolidation_entry_time": "2024-01-18T14:36:00Z", "consolidation_completion_time": "2024-01-18T14:55:00Z", "knowledge_points": {"words": [{"word": "father", "meaning": "爸爸", "pos": "n."}, {"word": "mother", "meaning": "妈妈", "pos": "n."}, {"word": "brother", "meaning": "兄弟", "pos": "n."}, {"word": "sister", "meaning": "姐妹", "pos": "n."}], "sentence_patterns": [{"pattern": "This is my [family member].", "meaning": "这是我的[家庭成员]。", "example": "This is my father."}, {"pattern": "Who is he/she? He/She is my [family member].", "meaning": "他/她是谁?他/她是我的[家庭成员]。", "example": "Who is he? He is my brother."}]}, "interactive_components": [{"component_id": "ic_401", "type": "单词跟读", "detail": "请跟读家庭成员单词 father", "user_result": "perfect", "knowledge": "father", "audio": "https://audio.valavala.com/ic_401.mp3"}, {"component_id": "ic_402", "type": "单词跟读", "detail": "请跟读家庭成员单词 mother", "user_result": "perfect", "knowledge": "mother", "audio": "https://audio.valavala.com/ic_402.mp3"}, {"component_id": "ic_403", "type": "单词听选", "detail": "听录音,选择正确的家庭成员单词", "user_result": "good", "knowledge": "brother"}, {"component_id": "ic_404", "type": "单词拼写", "detail": "根据发音,拼写出 sister", "user_result": "perfect", "knowledge": "sister"}, {"component_id": "ic_405", "type": "句型跟读", "detail": "请跟读句型:This is my father.", "user_result": "good", "knowledge": "This is my [family member].", "audio": "https://audio.valavala.com/ic_405.mp3"}, {"component_id": "ic_406", "type": "家庭成员配对", "detail": "将单词与对应的家庭成员图片配对", "user_result": "perfect", "knowledge": "father"}, {"component_id": "ic_407", "type": "情景对话", "detail": "在情景中介绍自己的家庭成员", "user_result": "good", "knowledge": "This is my [family member].", "audio": "https://audio.valavala.com/ic_407.mp3"}, {"component_id": "ic_408", "type": "听力理解", "detail": "听录音,指出说话者在说谁", "user_result": "perfect", "knowledge": "Who is he/she? He/She is my [family member]."}, {"component_id": "ic_409", "type": "语音识别", "detail": "请说出家庭成员 mother", "user_result": "good", "knowledge": "mother", "audio": "https://audio.valavala.com/ic_409.mp3"}, {"component_id": "ic_410", "type": "家庭树绘制", "detail": "根据描述绘制家庭树", "user_result": "oops", "knowledge": "father"}, {"component_id": "ic_411", "type": "问答练习", "detail": "练习问句:Who is he/she?", "user_result": "good", "knowledge": "Who is he/she? He/She is my [family member].", "audio": "https://audio.valavala.com/ic_411.mp3"}, {"component_id": "ic_412", "type": "角色扮演", "detail": "扮演角色向朋友介绍家人", "user_result": "perfect", "knowledge": "This is my [family member].", "audio": "https://audio.valavala.com/ic_412.mp3"}, {"component_id": "ic_413", "type": "家庭成员关系", "detail": "理解家庭成员之间的关系", "user_result": "good", "knowledge": "brother"}, {"component_id": "ic_414", "type": "听指令指认", "detail": "听指令指出对应的家人图片", "user_result": "perfect", "knowledge": "sister"}, {"component_id": "ic_415", "type": "句型填空", "detail": "填空:Who is she? ______ is my mother.", "user_result": "perfect", "knowledge": "Who is he/she? He/She is my [family member]."}, {"component_id": "ic_416", "type": "家庭相册描述", "detail": "看家庭相册照片,描述家人", "user_result": "good", "knowledge": "This is my [family member].", "audio": "https://audio.valavala.com/ic_416.mp3"}, {"component_id": "ic_417", "type": "综合对话", "detail": "完成关于家庭的完整对话", "user_result": "perfect", "knowledge": "This is my [family member].", "audio": "https://audio.valavala.com/ic_417.mp3"}, {"component_id": "ic_418", "type": "复习测验", "detail": "完成家庭知识点的综合复习", "user_result": "good", "knowledge": "Who is he/she? He/She is my [family member]."}], "consolidation_exercises": [{"exercise_id": "ce_401", "type": "单词听选", "detail": "听录音,选择听到的家庭成员单词", "is_correct": true, "knowledge": "father"}, {"exercise_id": "ce_402", "type": "单词拼写", "detail": "根据中文写出英文:爸爸", "is_correct": true, "knowledge": "father"}, {"exercise_id": "ce_403", "type": "图文匹配", "detail": "将 mother 与妈妈图片匹配", "is_correct": true, "knowledge": "mother"}, {"exercise_id": "ce_404", "type": "句型填空", "detail": "填空:This is my ______ (father/mother/brother).", "is_correct": true, "knowledge": "This is my [family member]."}, {"exercise_id": "ce_405", "type": "关系识别", "detail": "Tom是爸爸的son,Tom是爸爸的什么人?", "is_correct": false, "knowledge": "brother"}, {"exercise_id": "ce_406", "type": "句子排序", "detail": "排列句子:is / This / my / mother", "is_correct": true, "knowledge": "This is my [family member]."}, {"exercise_id": "ce_407", "type": "听力理解", "detail": "听对话,回答问题:他们是什么关系?", "is_correct": true, "knowledge": "Who is he/she? He/She is my [family member]."}, {"exercise_id": "ce_408", "type": "家庭关系", "detail": "爸爸的爸爸叫什么?", "is_correct": true, "knowledge": "father"}, {"exercise_id": "ce_409", "type": "翻译练习", "detail": "翻译:这是我的姐姐。", "is_correct": true, "knowledge": "sister"}, {"exercise_id": "ce_410", "type": "对话补全", "detail": "补全对话:A: Who is he? B: ______", "is_correct": true, "knowledge": "Who is he/she? He/She is my [family member]."}, {"exercise_id": "ce_411", "type": "家庭识别", "detail": "根据描述选择正确的家庭成员", "is_correct": true, "knowledge": "brother"}, {"exercise_id": "ce_412", "type": "角色配对", "detail": "将人物与正确的称呼配对", "is_correct": true, "knowledge": "sister"}, {"exercise_id": "ce_413", "type": "连线匹配", "detail": "将家庭成员与中文意思连线", "is_correct": true, "knowledge": "mother"}, {"exercise_id": "ce_414", "type": "判断正误", "detail": "判断:brother 可以是哥哥也可以是弟弟。", "is_correct": true, "knowledge": "brother"}, {"exercise_id": "ce_415", "type": "选词填空", "detail": "She is my ______ (father/mother/sister).", "is_correct": true, "knowledge": "sister"}, {"exercise_id": "ce_416", "type": "单词书写", "detail": "根据读音写出家庭成员单词", "is_correct": false, "knowledge": "mother"}, {"exercise_id": "ce_417", "type": "完形填空", "detail": "阅读短文,填入正确的家庭成员单词", "is_correct": true, "knowledge": "father"}, {"exercise_id": "ce_418", "type": "综合测验", "detail": "完成家庭单元综合测验", "is_correct": true, "knowledge": "This is my [family member]."}]}, {"lesson_id": 5, "lesson_name": "Lesson 5: Animals", "entry_time": "2024-01-19T09:30:00Z", "completion_time": "2024-01-19T10:05:45Z", "consolidation_entry_time": "2024-01-19T10:06:00Z", "consolidation_completion_time": "2024-01-19T10:25:00Z", "knowledge_points": {"words": [{"word": "cat", "meaning": "猫", "pos": "n."}, {"word": "dog", "meaning": "狗", "pos": "n."}, {"word": "bird", "meaning": "鸟", "pos": "n."}, {"word": "fish", "meaning": "鱼", "pos": "n."}], "sentence_patterns": [{"pattern": "It is a [animal].", "meaning": "这是一只[动物]。", "example": "It is a cat."}, {"pattern": "I like [animal]s.", "meaning": "我喜欢[动物]。", "example": "I like dogs."}]}, "interactive_components": [{"component_id": "ic_501", "type": "单词跟读", "detail": "请跟读动物单词 cat,注意短元音", "user_result": "perfect", "knowledge": "cat", "audio": "https://audio.valavala.com/ic_501.mp3"}, {"component_id": "ic_502", "type": "单词跟读", "detail": "请跟读动物单词 dog", "user_result": "good", "knowledge": "dog", "audio": "https://audio.valavala.com/ic_502.mp3"}, {"component_id": "ic_503", "type": "单词听选", "detail": "听录音,选择正确的动物单词", "user_result": "perfect", "knowledge": "bird"}, {"component_id": "ic_504", "type": "单词拼写", "detail": "根据发音,拼写出 fish", "user_result": "good", "knowledge": "fish"}, {"component_id": "ic_505", "type": "句型跟读", "detail": "请跟读句型:It is a cat.", "user_result": "perfect", "knowledge": "It is a [animal].", "audio": "https://audio.valavala.com/ic_505.mp3"}, {"component_id": "ic_506", "type": "动物声音辨识", "detail": "听动物叫声,选择正确的动物", "user_result": "good", "knowledge": "cat"}, {"component_id": "ic_507", "type": "情景对话", "detail": "在情景中谈论自己喜欢的动物", "user_result": "oops", "knowledge": "I like [animal]s.", "audio": "https://audio.valavala.com/ic_507.mp3"}, {"component_id": "ic_508", "type": "听力理解", "detail": "听录音,描述动物特征", "user_result": "perfect", "knowledge": "It is a [animal]."}, {"component_id": "ic_509", "type": "语音识别", "detail": "请说出动物 bird", "user_result": "good", "knowledge": "bird", "audio": "https://audio.valavala.com/ic_509.mp3"}, {"component_id": "ic_510", "type": "图文匹配", "detail": "将动物单词与对应图片匹配", "user_result": "perfect", "knowledge": "dog"}, {"component_id": "ic_511", "type": "动物分类", "detail": "将动物分为天上飞的和地上跑的", "user_result": "good", "knowledge": "bird"}, {"component_id": "ic_512", "type": "角色扮演", "detail": "扮演角色在动物园谈论动物", "user_result": "perfect", "knowledge": "It is a [animal].", "audio": "https://audio.valavala.com/ic_512.mp3"}, {"component_id": "ic_513", "type": "动物习性配对", "detail": "将动物与其习性特点配对", "user_result": "good", "knowledge": "fish"}, {"component_id": "ic_514", "type": "听指令模仿", "detail": "听指令模仿动物的叫声和动作", "user_result": "perfect", "knowledge": "cat", "audio": "https://audio.valavala.com/ic_514.mp3"}, {"component_id": "ic_515", "type": "句型填空", "detail": "用动物填空:I like ______.", "user_result": "good", "knowledge": "I like [animal]s."}, {"component_id": "ic_516", "type": "快速反应", "detail": "看到动物图片快速说出英文", "user_result": "perfect", "knowledge": "dog", "audio": "https://audio.valavala.com/ic_516.mp3"}, {"component_id": "ic_517", "type": "综合对话", "detail": "完成关于动物的完整对话", "user_result": "good", "knowledge": "I like [animal]s.", "audio": "https://audio.valavala.com/ic_517.mp3"}, {"component_id": "ic_518", "type": "复习测验", "detail": "完成动物知识点的综合复习", "user_result": "perfect", "knowledge": "It is a [animal]."}], "consolidation_exercises": [{"exercise_id": "ce_501", "type": "单词听选", "detail": "听录音,选择听到的动物单词", "is_correct": true, "knowledge": "cat"}, {"exercise_id": "ce_502", "type": "单词拼写", "detail": "根据中文写出英文:猫", "is_correct": true, "knowledge": "cat"}, {"exercise_id": "ce_503", "type": "图文匹配", "detail": "将 dog 与狗的图片匹配", "is_correct": true, "knowledge": "dog"}, {"exercise_id": "ce_504", "type": "句型填空", "detail": "填空:It is a ______ (cat/dog/bird).", "is_correct": true, "knowledge": "It is a [animal]."}, {"exercise_id": "ce_505", "type": "动物识别", "detail": "看局部图,猜是什么动物?", "is_correct": false, "knowledge": "bird"}, {"exercise_id": "ce_506", "type": "句子排序", "detail": "排列句子:is / It / a / cat", "is_correct": true, "knowledge": "It is a [animal]."}, {"exercise_id": "ce_507", "type": "听力理解", "detail": "听描述,选择正确的动物", "is_correct": true, "knowledge": "dog"}, {"exercise_id": "ce_508", "type": "动物分类", "detail": "选出会飞的动物", "is_correct": true, "knowledge": "bird"}, {"exercise_id": "ce_509", "type": "翻译练习", "detail": "翻译:我喜欢狗。", "is_correct": true, "knowledge": "I like [animal]s."}, {"exercise_id": "ce_510", "type": "对话补全", "detail": "补全对话:A: What's this? B: ______", "is_correct": true, "knowledge": "It is a [animal]."}, {"exercise_id": "ce_511", "type": "动物习性", "detail": "鱼生活在哪里?", "is_correct": true, "knowledge": "fish"}, {"exercise_id": "ce_512", "type": "声音辨识", "detail": "听叫声,选择动物", "is_correct": true, "knowledge": "cat", "audio": "https://audio.valavala.com/ce_512.mp3"}, {"exercise_id": "ce_513", "type": "连线匹配", "detail": "将动物与中文意思连线", "is_correct": true, "knowledge": "fish"}, {"exercise_id": "ce_514", "type": "判断正误", "detail": "判断:bird 会飞。", "is_correct": true, "knowledge": "bird"}, {"exercise_id": "ce_515", "type": "选词填空", "detail": "I like ______ (cat/cats/fishs).", "is_correct": false, "knowledge": "I like [animal]s."}, {"exercise_id": "ce_516", "type": "单词书写", "detail": "根据读音写出动物单词", "is_correct": true, "knowledge": "dog"}, {"exercise_id": "ce_517", "type": "完形填空", "detail": "阅读短文,填入正确的动物单词", "is_correct": true, "knowledge": "cat"}, {"exercise_id": "ce_518", "type": "综合测验", "detail": "完成动物单元综合测验", "is_correct": true, "knowledge": "I like [animal]s."}]}], "ability_training": [{"question_id": "at_001", "source": "Lesson 1", "type": "听力", "title": "听力理解 - 日常对话", "detail": "听一段关于问候的日常对话,回答5个相关问题", "sub_question_count": 5, "sub_question_correct": 5, "result": "perfect"}, {"question_id": "at_002", "source": "Lesson 2", "type": "阅读", "title": "阅读理解 - 数字故事", "detail": "阅读一篇关于数字的小故事,回答6个理解性问题", "sub_question_count": 6, "sub_question_correct": 5, "result": "good"}, {"question_id": "at_003", "source": "Lesson 3", "type": "口语", "title": "口语表达 - 描述颜色", "detail": "根据图片提示,用英文描述物品的颜色,共4道小题", "sub_question_count": 4, "sub_question_correct": 3, "result": "good", "audio": "https://audio.valavala.com/at_003.mp3"}, {"question_id": "at_004", "source": "Lesson 4", "type": "写作", "title": "写作练习 - 我的家庭", "detail": "根据提示写一篇关于家庭的短文,包含8个要点", "sub_question_count": 8, "sub_question_correct": 6, "result": "oops"}, {"question_id": "at_005", "source": "Lesson 5", "type": "听力", "title": "听力理解 - 动物声音", "detail": "听各种动物的声音,辨识并写出对应的英文单词", "sub_question_count": 5, "sub_question_correct": 4, "result": "good"}, {"question_id": "at_006", "source": "单元挑战", "type": "阅读", "title": "综合阅读 - Hello World", "detail": "阅读单元主题文章,回答7个综合性理解问题", "sub_question_count": 7, "sub_question_correct": 7, "result": "perfect"}, {"question_id": "at_007", "source": "单元挑战", "type": "口语", "title": "口语表达 - 自我介绍", "detail": "进行完整的自我介绍,包含问候、姓名、年龄、喜欢的颜色、家庭成员、宠物等8个要点", "sub_question_count": 8, "sub_question_correct": 5, "result": "oops", "audio": "https://audio.valavala.com/at_007.mp3"}, {"question_id": "at_008", "source": "单元挑战", "type": "写作", "title": "写作练习 - 我的教室", "detail": "根据图片提示,写一篇关于教室的短文,描述颜色、数字、物品等", "sub_question_count": 6, "sub_question_correct": 5, "result": "good"}, {"question_id": "at_009", "source": "单元挑战", "type": "听力", "title": "综合听力 - 单元回顾", "detail": "听综合对话,涵盖本单元所有知识点,回答5个问题", "sub_question_count": 5, "sub_question_correct": 4, "result": "good"}], "summary": {"total_lessons": 5, "completed_lessons": 1, "total_interactive_components": 18, "total_consolidation_exercises": 18, "mastery_rate": 0.85, "study_duration_minutes": 25}};
|
||
|
||
// 兼容:data可能直接就是lessons数组,也可能有外层包装
|
||
const lessons = data.lessons || data.data?.lessons || (Array.isArray(data) ? data : []);
|
||
const summary = data.summary || data.data?.summary || null;
|
||
|
||
// ==================== 总览统计 ====================
|
||
const statsGrid = document.getElementById('stats-grid');
|
||
const totalLessons = lessons.length;
|
||
let totalInteractive = 0, totalExercises = 0;
|
||
let totalStudyDuration = 0; // 单元学习时长(分钟)
|
||
let unitStartTime = null, unitEndTime = null;
|
||
|
||
lessons.forEach(lesson => {
|
||
const ics = lesson.interactive_components || lesson.interactiveComponents || [];
|
||
const ces = lesson.consolidation_exercises || lesson.consolidationExercises || [];
|
||
totalInteractive += ics.length;
|
||
totalExercises += ces.length;
|
||
|
||
// 计算每个lesson的学习时长
|
||
const entryTime = lesson.entry_time || lesson.entryTime;
|
||
const completionTime = lesson.completion_time || lesson.completionTime;
|
||
const consolidationEntry = lesson.consolidation_entry_time || lesson.consolidationEntryTime;
|
||
const consolidationCompletion = lesson.consolidation_completion_time || lesson.consolidationCompletionTime;
|
||
|
||
if (entryTime && completionTime) {
|
||
const lessonDuration = (new Date(completionTime) - new Date(entryTime)) / (1000 * 60);
|
||
if (lessonDuration > 0) totalStudyDuration += lessonDuration;
|
||
}
|
||
if (consolidationEntry && consolidationCompletion) {
|
||
const consolidationDuration = (new Date(consolidationCompletion) - new Date(consolidationEntry)) / (1000 * 60);
|
||
if (consolidationDuration > 0) totalStudyDuration += consolidationDuration;
|
||
}
|
||
|
||
// 记录单元开始和结束时间
|
||
if (entryTime) {
|
||
const entryDate = new Date(entryTime);
|
||
if (!unitStartTime || entryDate < unitStartTime) unitStartTime = entryDate;
|
||
}
|
||
if (consolidationCompletion) {
|
||
const completionDate = new Date(consolidationCompletion);
|
||
if (!unitEndTime || completionDate > unitEndTime) unitEndTime = completionDate;
|
||
}
|
||
});
|
||
|
||
// 计算单元长度(从第1个lesson进入到第5个lesson巩固完成)
|
||
let unitLengthStr = '-';
|
||
if (unitStartTime && unitEndTime) {
|
||
const unitLengthMs = unitEndTime - unitStartTime;
|
||
const unitLengthMinutes = Math.round(unitLengthMs / (1000 * 60));
|
||
const days = Math.floor(unitLengthMinutes / (24 * 60));
|
||
const hours = Math.floor((unitLengthMinutes % (24 * 60)) / 60);
|
||
const minutes = unitLengthMinutes % 60;
|
||
if (days > 0) {
|
||
unitLengthStr = `${days}天${hours}小时${minutes}分钟`;
|
||
} else if (hours > 0) {
|
||
unitLengthStr = `${hours}小时${minutes}分钟`;
|
||
} else {
|
||
unitLengthStr = `${minutes}分钟`;
|
||
}
|
||
}
|
||
|
||
// 格式化学习时长
|
||
let studyDurationStr = '-';
|
||
if (totalStudyDuration > 0) {
|
||
const studyHours = Math.floor(totalStudyDuration / 60);
|
||
const studyMinutes = Math.round(totalStudyDuration % 60);
|
||
if (studyHours > 0) {
|
||
studyDurationStr = `${studyHours}小时${studyMinutes}分钟`;
|
||
} else {
|
||
studyDurationStr = `${studyMinutes}分钟`;
|
||
}
|
||
}
|
||
|
||
const statsItems = [
|
||
{ label: '单元学习时长', value: studyDurationStr, color: 'text-accent' },
|
||
{ label: '总互动次数', value: totalInteractive, color: 'text-blue-500' },
|
||
{ label: '总练习题数', value: totalExercises, color: 'text-emerald-500' },
|
||
{ label: '单元长度', value: unitLengthStr, color: 'text-amber-500' }
|
||
];
|
||
statsItems.forEach(item => {
|
||
const div = document.createElement('div');
|
||
div.className = 'bg-gray-50 rounded-xl p-5 text-center';
|
||
div.innerHTML = `<div class="text-xs text-gray-400 mb-1">${item.label}</div><div class="text-2xl font-bold ${item.color}">${item.value}</div>`;
|
||
statsGrid.appendChild(div);
|
||
});
|
||
|
||
// ==================== 互动组件柱状图(按课程,三段堆叠) ====================
|
||
const interactiveChart = echarts.init(document.getElementById('interactive-chart'));
|
||
const lessonLabels = lessons.map((l, i) => l.lesson_name || l.lessonName || `Lesson ${i + 1}`);
|
||
const perfectCounts = [];
|
||
const goodCounts = [];
|
||
const oopsCounts = [];
|
||
|
||
lessons.forEach(lesson => {
|
||
const ics = lesson.interactive_components || lesson.interactiveComponents || [];
|
||
let perfect = 0, good = 0, oops = 0;
|
||
ics.forEach(ic => {
|
||
const r = (ic.user_result || ic.userResult || '').toLowerCase();
|
||
if (r === 'perfect') perfect++;
|
||
else if (r === 'good') good++;
|
||
else if (r === 'oops') oops++;
|
||
});
|
||
perfectCounts.push(perfect);
|
||
goodCounts.push(good);
|
||
oopsCounts.push(oops);
|
||
});
|
||
|
||
interactiveChart.setOption({
|
||
tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } },
|
||
legend: { bottom: 10, data: ['Perfect', 'Good', 'Oops'], textStyle: { color: '#9ca3af' } },
|
||
grid: { left: '3%', right: '4%', bottom: '15%', top: '5%', containLabel: true },
|
||
xAxis: { type: 'category', data: lessonLabels, axisLabel: { rotate: 20, fontSize: 11, color: '#9ca3af' }, axisLine: { lineStyle: { color: '#e5e7eb' } } },
|
||
yAxis: { type: 'value', axisLabel: { color: '#9ca3af' }, splitLine: { lineStyle: { color: '#f3f4f6' } } },
|
||
color: ['#10b981', '#7A5ADB', '#f97316'],
|
||
series: [
|
||
{ name: 'Perfect', type: 'bar', stack: 'total', data: perfectCounts, itemStyle: { borderRadius: [0, 0, 4, 4] } },
|
||
{ name: 'Good', type: 'bar', stack: 'total', data: goodCounts, itemStyle: { borderRadius: [0, 0, 0, 0] } },
|
||
{ name: 'Oops', type: 'bar', stack: 'total', data: oopsCounts, itemStyle: { borderRadius: [4, 4, 0, 0] } }
|
||
]
|
||
});
|
||
|
||
// ==================== 巩固练习柱状图(按课程,两段堆叠) ====================
|
||
const exerciseChart = echarts.init(document.getElementById('exercise-chart'));
|
||
const correctCounts = [];
|
||
const wrongCounts = [];
|
||
|
||
lessons.forEach(lesson => {
|
||
const ces = lesson.consolidation_exercises || lesson.consolidationExercises || [];
|
||
let correct = 0, wrong = 0;
|
||
ces.forEach(ce => {
|
||
if (ce.is_correct === true || ce.isCorrect === true) correct++;
|
||
else wrong++;
|
||
});
|
||
correctCounts.push(correct);
|
||
wrongCounts.push(wrong);
|
||
});
|
||
|
||
exerciseChart.setOption({
|
||
tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } },
|
||
legend: { bottom: 10, data: ['正确', '错误'], textStyle: { color: '#9ca3af' } },
|
||
grid: { left: '3%', right: '4%', bottom: '15%', top: '5%', containLabel: true },
|
||
xAxis: { type: 'category', data: lessonLabels, axisLabel: { rotate: 20, fontSize: 11, color: '#9ca3af' }, axisLine: { lineStyle: { color: '#e5e7eb' } } },
|
||
yAxis: { type: 'value', axisLabel: { color: '#9ca3af' }, splitLine: { lineStyle: { color: '#f3f4f6' } } },
|
||
color: ['#10b981', '#ef4444'],
|
||
series: [
|
||
{ name: '正确', type: 'bar', stack: 'total', data: correctCounts, itemStyle: { borderRadius: [0, 0, 4, 4] } },
|
||
{ name: '错误', type: 'bar', stack: 'total', data: wrongCounts, itemStyle: { borderRadius: [4, 4, 0, 0] } }
|
||
]
|
||
});
|
||
|
||
// ==================== 能力训练饼图 ====================
|
||
const abilityTraining = data.ability_training || data.abilityTraining || [];
|
||
let perfectCount = 0, goodCount = 0, oopsCount = 0;
|
||
abilityTraining.forEach(at => {
|
||
const result = (at.result || '').toLowerCase();
|
||
if (result === 'perfect') perfectCount++;
|
||
else if (result === 'good') goodCount++;
|
||
else if (result === 'oops') oopsCount++;
|
||
});
|
||
|
||
const abilityChart = echarts.init(document.getElementById('ability-chart'));
|
||
abilityChart.setOption({
|
||
tooltip: { trigger: 'item', formatter: '{b}: {c} ({d}%)' },
|
||
legend: { bottom: 10, data: ['Perfect', 'Good', 'Oops'], textStyle: { color: '#9ca3af' } },
|
||
color: ['#10b981', '#7A5ADB', '#f97316'],
|
||
series: [{
|
||
name: '能力训练结果',
|
||
type: 'pie',
|
||
radius: ['40%', '70%'],
|
||
center: ['50%', '45%'],
|
||
avoidLabelOverlap: false,
|
||
itemStyle: { borderRadius: 8, borderColor: '#fff', borderWidth: 2 },
|
||
label: { show: true, formatter: '{b}: {c}' },
|
||
data: [
|
||
{ value: perfectCount, name: 'Perfect' },
|
||
{ value: goodCount, name: 'Good' },
|
||
{ value: oopsCount, name: 'Oops' }
|
||
]
|
||
}]
|
||
});
|
||
const navContainer = document.getElementById('lesson-nav');
|
||
const detailContainer = document.getElementById('lesson-details');
|
||
|
||
lessons.forEach((lesson, idx) => {
|
||
const card = document.createElement('div');
|
||
card.className = 'lesson-card border-2 border-gray-100 rounded-xl p-4 cursor-pointer text-center shadow-sm' + (idx === 0 ? ' active' : '');
|
||
card.onclick = () => switchTab(idx);
|
||
|
||
const entryTime = lesson.entry_time || lesson.entryTime || '-';
|
||
const completionTime = lesson.completion_time || lesson.completionTime || '-';
|
||
const lessonName = lesson.lesson_name || lesson.lessonName || `Lesson ${idx + 1}`;
|
||
|
||
const icsForStats = lesson.interactive_components || lesson.interactiveComponents || [];
|
||
const cesForStats = lesson.consolidation_exercises || lesson.consolidationExercises || [];
|
||
let oopsCount = 0;
|
||
icsForStats.forEach(ic => {
|
||
const r = (ic.user_result || ic.userResult || '').toLowerCase();
|
||
if (r === 'oops') oopsCount++;
|
||
});
|
||
const oopsRate = icsForStats.length > 0 ? Math.round(oopsCount / icsForStats.length * 100) : 0;
|
||
|
||
let wrongCount = 0;
|
||
cesForStats.forEach(ce => {
|
||
if (ce.is_correct !== true && ce.isCorrect !== true) wrongCount++;
|
||
});
|
||
const wrongRate = cesForStats.length > 0 ? Math.round(wrongCount / cesForStats.length * 100) : 0;
|
||
|
||
card.innerHTML = `
|
||
<div class="text-base font-semibold mb-2">${lessonName}</div>
|
||
<div class="text-xs opacity-80 leading-relaxed">
|
||
<div><span class="time-label-dim opacity-60">进入:</span>${formatTime(entryTime)}</div>
|
||
<div><span class="time-label-dim opacity-60">完成:</span>${formatTime(completionTime)}</div>
|
||
</div>
|
||
<div class="flex justify-center gap-4 mt-3 pt-3 border-t border-accent-light border-gray-100 text-xs">
|
||
<div class="flex flex-col items-center">
|
||
<span class="opacity-60 mb-0.5">Oops率</span>
|
||
<span class="font-semibold text-sm stat-value-oops text-orange-500">${oopsRate}%</span>
|
||
</div>
|
||
<div class="flex flex-col items-center">
|
||
<span class="opacity-60 mb-0.5">错误率</span>
|
||
<span class="font-semibold text-sm stat-value-wrong text-red-500">${wrongRate}%</span>
|
||
</div>
|
||
</div>
|
||
`;
|
||
navContainer.appendChild(card);
|
||
|
||
// 详情区域
|
||
const detail = document.createElement('div');
|
||
detail.className = 'lesson-detail' + (idx === 0 ? ' active' : '');
|
||
detail.id = `lesson-${idx}`;
|
||
|
||
const kp = lesson.knowledge_points || lesson.knowledgePoints || {};
|
||
const words = kp.words || [];
|
||
const patterns = kp.sentence_patterns || kp.sentencePatterns || [];
|
||
const ics = lesson.interactive_components || lesson.interactiveComponents || [];
|
||
const ces = lesson.consolidation_exercises || lesson.consolidationExercises || [];
|
||
|
||
let html = `
|
||
<div class="mb-5">
|
||
<h3 class="text-sm font-semibold text-gray-500 mb-3">📗 单词 (${words.length}个)</h3>
|
||
<div class="flex flex-wrap gap-2">
|
||
${words.map(w => `<span class="inline-flex items-center gap-1.5 bg-accent-light text-sm rounded-lg px-3 py-1.5"><span class="font-semibold text-accent">${w.word}</span><span class="text-gray-500">${w.meaning}</span><span class="text-gray-400 text-xs">${w.pos || ''}</span></span>`).join('')}
|
||
</div>
|
||
</div>
|
||
<div class="mb-5">
|
||
<h3 class="text-sm font-semibold text-gray-500 mb-3">📘 句型 (${patterns.length}个)</h3>
|
||
<div class="grid sm:grid-cols-2 gap-2">
|
||
${patterns.map(p => `<div class="bg-amber-50 border border-amber-200 rounded-lg px-4 py-2.5 text-sm"><span class="font-semibold text-amber-600">${p.pattern}</span><span class="block text-gray-500 text-xs mt-1">${p.meaning}</span></div>`).join('')}
|
||
</div>
|
||
</div>
|
||
<div class="mb-5">
|
||
<h3 class="text-sm font-semibold text-gray-500 mb-3">🎯 互动组件 (${ics.length}个)</h3>
|
||
<div class="overflow-x-auto">
|
||
<table class="w-full text-sm">
|
||
<thead><tr class="border-b-2 border-gray-100">
|
||
<th class="text-left py-2.5 px-3 font-semibold text-gray-400 bg-gray-50/60 text-xs">#</th>
|
||
<th class="text-left py-2.5 px-3 font-semibold text-gray-400 bg-gray-50/60 text-xs">题型</th>
|
||
<th class="text-left py-2.5 px-3 font-semibold text-gray-400 bg-gray-50/60 text-xs">知识点</th>
|
||
<th class="text-left py-2.5 px-3 font-semibold text-gray-400 bg-gray-50/60 text-xs hidden sm:table-cell">详情</th>
|
||
<th class="text-left py-2.5 px-3 font-semibold text-gray-400 bg-gray-50/60 text-xs">结果</th>
|
||
</tr></thead>
|
||
<tbody>
|
||
${ics.map((ic, i) => {
|
||
const result = (ic.user_result || ic.userResult || '').toLowerCase();
|
||
const badgeColor = result === 'perfect' ? 'bg-emerald-50 text-emerald-600 border-emerald-200' : result === 'good' ? 'bg-blue-50 text-blue-600 border-blue-200' : 'bg-orange-50 text-orange-600 border-orange-200';
|
||
const kpText = ic.knowledge || '-';
|
||
const audioBtn = ic.audio ? `<span class="audio-btn opacity-60 ml-1.5 text-base" onclick="playAudio('${ic.audio}', this)" title="播放录音">🔊</span>` : '';
|
||
return `<tr class="border-b border-gray-50 hover:bg-gray-50/50"><td class="py-2 px-3 text-gray-400">${i + 1}</td><td class="py-2 px-3">${ic.type}</td><td class="py-2 px-3 text-gray-500">${kpText}</td><td class="py-2 px-3 text-gray-500 hidden sm:table-cell">${ic.detail}</td><td class="py-2 px-3"><span class="inline-block text-xs font-semibold px-2.5 py-0.5 rounded-full border ${badgeColor}">${result}</span>${audioBtn}</td></tr>`;
|
||
}).join('')}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
<div class="mb-5">
|
||
<h3 class="text-sm font-semibold text-gray-500 mb-3">📝 学习巩固 (${ces.length}题)</h3>
|
||
<div class="overflow-x-auto">
|
||
<table class="w-full text-sm">
|
||
<thead><tr class="border-b-2 border-gray-100">
|
||
<th class="text-left py-2.5 px-3 font-semibold text-gray-400 bg-gray-50/60 text-xs">#</th>
|
||
<th class="text-left py-2.5 px-3 font-semibold text-gray-400 bg-gray-50/60 text-xs">题型</th>
|
||
<th class="text-left py-2.5 px-3 font-semibold text-gray-400 bg-gray-50/60 text-xs">知识点</th>
|
||
<th class="text-left py-2.5 px-3 font-semibold text-gray-400 bg-gray-50/60 text-xs hidden sm:table-cell">详情</th>
|
||
<th class="text-left py-2.5 px-3 font-semibold text-gray-400 bg-gray-50/60 text-xs">结果</th>
|
||
</tr></thead>
|
||
<tbody>
|
||
${ces.map((ce, i) => {
|
||
const correct = ce.is_correct === true || ce.isCorrect === true;
|
||
const badgeColor = correct ? 'bg-emerald-50 text-emerald-600 border-emerald-200' : 'bg-red-50 text-red-500 border-red-200';
|
||
const kpText = ce.knowledge || '-';
|
||
const audioBtn = ce.audio ? `<span class="audio-btn opacity-60 ml-1.5 text-base" onclick="playAudio('${ce.audio}', this)" title="播放录音">🔊</span>` : '';
|
||
return `<tr class="border-b border-gray-50 hover:bg-gray-50/50"><td class="py-2 px-3 text-gray-400">${i + 1}</td><td class="py-2 px-3">${ce.type}</td><td class="py-2 px-3 text-gray-500">${kpText}</td><td class="py-2 px-3 text-gray-500 hidden sm:table-cell">${ce.detail}</td><td class="py-2 px-3"><span class="inline-block text-xs font-semibold px-2.5 py-0.5 rounded-full border ${badgeColor}">${correct ? '✓ 正确' : '✗ 错误'}</span>${audioBtn}</td></tr>`;
|
||
}).join('')}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
`;
|
||
detail.innerHTML = html;
|
||
detailContainer.appendChild(detail);
|
||
});
|
||
|
||
let currentAudio = null;
|
||
function playAudio(url, el) {
|
||
if (currentAudio) {
|
||
currentAudio.pause();
|
||
currentAudio = null;
|
||
document.querySelectorAll('.audio-btn.playing').forEach(b => b.classList.remove('playing'));
|
||
}
|
||
const audio = new Audio(url);
|
||
currentAudio = audio;
|
||
el.classList.add('playing');
|
||
audio.play().catch(() => {});
|
||
audio.onended = () => { el.classList.remove('playing'); currentAudio = null; };
|
||
audio.onerror = () => { el.classList.remove('playing'); currentAudio = null; };
|
||
}
|
||
|
||
function switchTab(idx) {
|
||
document.querySelectorAll('.lesson-card').forEach((c, i) => c.classList.toggle('active', i === idx));
|
||
document.querySelectorAll('.lesson-detail').forEach((d, i) => d.classList.toggle('active', i === idx));
|
||
}
|
||
|
||
function formatTime(t) {
|
||
if (!t || t === '-') return '-';
|
||
try {
|
||
const d = new Date(t);
|
||
return d.toLocaleString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', second: '2-digit' });
|
||
} catch { return t; }
|
||
}
|
||
|
||
// ==================== 能力训练展示 ====================
|
||
const abilityTbody = document.getElementById('ability-training-tbody');
|
||
|
||
abilityTraining.forEach((at, idx) => {
|
||
const tr = document.createElement('tr');
|
||
tr.className = 'border-b border-gray-50 hover:bg-gray-50/50';
|
||
const result = (at.result || '').toLowerCase();
|
||
const badgeColor = result === 'perfect' ? 'bg-emerald-50 text-emerald-600 border-emerald-200' : result === 'good' ? 'bg-blue-50 text-blue-600 border-blue-200' : 'bg-orange-50 text-orange-600 border-orange-200';
|
||
const subQuestionInfo = `${at.sub_question_correct || 0}/${at.sub_question_count || 0}`;
|
||
|
||
const atAudioBtn = at.audio ? `<span class="audio-btn opacity-60 ml-1.5 text-base" onclick="playAudio('${at.audio}', this)" title="播放录音">🔊</span>` : '';
|
||
|
||
tr.innerHTML = `
|
||
<td class="py-2.5 px-3 text-gray-400">${idx + 1}</td>
|
||
<td class="py-2.5 px-3">${at.source || '-'}</td>
|
||
<td class="py-2.5 px-3">${at.type || '-'}</td>
|
||
<td class="py-2.5 px-3">${at.title || '-'}</td>
|
||
<td class="py-2.5 px-3 text-gray-500 hidden sm:table-cell">${at.detail || '-'}</td>
|
||
<td class="py-2.5 px-3">${subQuestionInfo}</td>
|
||
<td class="py-2.5 px-3"><span class="inline-block text-xs font-semibold px-2.5 py-0.5 rounded-full border ${badgeColor}">${result}</span>${atAudioBtn}</td>
|
||
`;
|
||
abilityTbody.appendChild(tr);
|
||
});
|
||
|
||
// 响应式
|
||
window.addEventListener('resize', () => {
|
||
interactiveChart.resize();
|
||
exerciseChart.resize();
|
||
abilityChart.resize();
|
||
});
|
||
</script>
|
||
</body>
|
||
</html>
|