Files
RGKT/rg-09112127/js/courseConfig.js
2025-10-10 19:44:14 +08:00

928 lines
32 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(function (win) {
// 配置全局数据
let classObject = {
// 生活
live: {
l1s01: {
title: "旭日生活 第一章 第一节",
courseVideo: {
id: "courseVideo",
src: "../video/生活-捡垃圾/乱扔垃圾.mp4",
title: "爱护环境",
},
task: {
videos: {
v01: {
id: "v01",
src: "../video/生活-捡垃圾/乱扔垃圾.mp4",
alt: "这是捡垃圾视频的讲解内容,请修改该字符串完善内容",
nextId: "b01"
},
v02: {
id: "v02",
src: "../video/生活-捡垃圾/捡垃圾.mp4",
alt: "这是捡垃圾视频的讲解内容,请修改该字符串完善内容",
nextId: "n01"
},
v03: {
id: "v03",
src: "../video/生活-捡垃圾/不捡垃圾.mp4",
alt: "这是不捡垃圾视频的讲解内容,请修改该字符串完善内容",
nextId: "b01"
},
},
videosList: [
{
videosId: "v01",
title: "捡垃圾",
},
],
buttons: {
b01: {
id: "b01",
question: "小朋友,你觉得需要捡垃圾吗?",
btn: [
{
id: "b01-1",
text: "捡垃圾",
nextId: "v02"
},
{
id: "b01-2",
text: "不捡垃圾",
nextId: "v03"
}
]
}
},
notices: {
n01: {
id: "n01",
text: "太好了!让我们继续下一节课吧!",
nextId: "thank"
}
}
},
thank: {
id: "t01",
name: "融光小学三年级二班 小明同学"
},
play: [
{
title: "垃圾分类",
url: "",
},
],
},
l1s02: {
title: "旭日生活 第一章 第二节",
courseVideo: {
id: "courseVideo",
src: "../video/生活-比大小/比大小.mp4",
title: "比大小",
},
task: {
videos: {
v01: {
id: "v01",
src: "../video/生活-比大小/比大小.mp4",
alt: "",
nextId: "b01"
},
},
videosList: [
{
videosId: "v01",
title: "谁更大",
},
],
buttons: {
b01: {
id: "b01",
question: "小朋友,你觉得那边大?",
btn: [
{
id: "b01-1",
text: "左边",
nextId: "v01"
},
{
id: "b01-2",
text: "右边",
nextId: "v01"
}
]
}
},
notices: {
n01: {
id: "n01",
text: "太好了!让我们继续下一节课吧!",
nextId: "thank"
}
}
},
thank: {
id: "t01",
name: "融光小学三年级二班 小明同学"
},
play: [
{
title: "比大小",
url: "./play/比大小1.html",
},
{
title: "认识数字",
url: "./play/认识数字3.html",
},
{
title: "数字探险馆",
url: "./play/数字探险馆.html",
},
],
},
l1s03: {
title: "旭日生活 第一章 第三节",
courseVideo: {
id: "courseVideo",
src: "../video/生活-什么是情绪/happy.mp4",
title: "什么是情绪",
},
task: {
videos: {
v01: {
id: "v01",
src: "../video/生活-什么是情绪/angry.mp4",
alt: "",
nextId: "b01"
},
},
videosList: [
{
videosId: "v01",
title: "开心或生气",
},
],
buttons: {
b01: {
id: "b01",
question: "小朋友,你觉得那这是开心还是生气?",
btn: [
{
id: "b01-1",
text: "开心",
nextId: "v01"
},
{
id: "b01-2",
text: "生气",
nextId: "n01"
}
]
}
},
notices: {
n01: {
id: "n01",
text: "太好了!让我们继续下一节课吧!",
nextId: "thank"
}
}
},
thank: {
id: "t01",
name: "融光小学三年级二班 小明同学"
},
play: [
],
},
},
// 语文
language: {
c3s09: {
title: "皓月语文 三年级 上册 第九节 静夜思",
courseVideo: {
id: "courseVideo", // 每个视频的主课程都是这个id
src: "../video/数学-2下-视频--饮品和是4的加法/教学片段.mp4",
title: "静夜思", // 列表中第一个名字
},
task: {
videos: {
v01: {
id: "v01",
src: "../video/数学-2下-视频--饮品和是4的加法/交互11+3.mp4",
alt: "静夜思",
nextId: "b01"
},
},
videosList: [
{
videosId: "v01",
title: "静夜思的作者",
},
{
videosId: "v01",
title: "静夜思的含义",
},
],
buttons: {
b01: {
id: "b01",
question: "小朋友,你觉得静夜思的作者是谁?",
btn: [
{
id: "b01-1",
text: "李白",
nextId: "v01"
},
{
id: "b01-2",
text: "杜普",
nextId: "v01"
}
]
},
},
notices: {
n01: {
id: "n01",
text: "太好了!让我们继续下一节课吧!",
nextId: "thank"
}
}
},
thank: {
id: "t01",
name: "人工智能24级窦文俊、冯宇乐、汪一凡、迟龙同学",
},
play: [
{
title: "《静夜思》智能朗读",
url: "./play/静夜思古诗.html",
},
],
},
},
// 数学
math: {
m2x00: {
title: "流星数学 二年级 下册 预习 认识数字",
courseVideo: {
id: "courseVideo", // 每个视频的主课程都是这个id
src: "../video/数学-2下-视频--认识数字/认识数字课.mp4",
title: "认识数字", // 列表中第一个名字
},
task: {
videos: {
},
videosList: [
],
buttons: {
},
notices: {
}
},
thank: {
id: "t01",
name: "软件技术24级同学",
},
play: [
{
title: "识数小精灵",
url: "./play/识数小精灵.html",
},
],
},
m2x01:{
title: "流星数学 二年级 下册 第一节 多彩的生活",
courseVideo: {
id: "courseVideo", // 每个视频的主课程都是这个id
src: "../video/数学-2下-视频--认识时钟/认识时钟.mp4",
title: "认识时钟", // 列表中第一个名字
},
task: {
videos: {
v01: {
id: "v01",
src: "../video/数学-2下-视频--认识时钟/认识时钟.mp4",
alt: "认识时钟",
nextId: "b01"
},
},
videosList: [
{
videosId: "v01",
title: "认识时钟",
},
],
buttons: {
b01: {
id: "b01",
question: "小朋友,你觉得现在是几点种了?",
btn: [
{
id: "b01-1",
text: "十二点",
nextId: "v01"
},
{
id: "b01-2",
text: "六点",
nextId: "v01"
}
]
},
},
notices: {
n01: {
id: "n01",
text: "太好了!让我们继续下一节课吧!",
nextId: "thank"
}
}
},
thank: {
id: "t01",
name: "人工智能24级窦文俊、冯宇乐、汪一凡、迟龙同学",
},
play: [
{
title: "美味餐桌",
url: "./play/美味餐桌014以内加法.html",
},
{
title: "美食点餐",
url: "./play/美味餐桌024以内加法.html",
},
],
},
m2x04: {
title: "流星数学 二年级 下册 第四节 常见的饮品",
courseVideo: {
id: "courseVideo", // 每个视频的主课程都是这个id
src: "../video/数学-2下-视频--饮品和是4的加法/教学片段.mp4",
title: "4以内的加法", // 列表中第一个名字
},
task: {
videos: {
v01: {
id: "v01",
src: "../video/数学-2下-视频--饮品和是4的加法/交互11+3.mp4",
alt: "这是计算1+3的方式",
nextId: "b01"
},
v02: {
id: "v02",
src: "../video/数学-2下-视频--饮品和是4的加法/交互11+3正确答案.mp4",
alt: "1+3等于4您的回答正确",
nextId: "v01"
},
v03: {
id: "v03",
src: "../video/数学-2下-视频--饮品和是4的加法/交互11+3错误答案.mp4",
alt: "1+3等于4您的回答错误",
nextId: "b01"
},
v04: {
id: "v04",
src: "../video/数学-2下-视频--饮品和是4的加法/交互22+2.mp4",
alt: "2+2等于4",
nextId: "b02"
},
v05: {
id: "v05",
src: "../video/数学-2下-视频--饮品和是4的加法/交互22+2回答正确.mp4",
alt: "2+2等于4您的回答正确",
nextId: "v04"
},
v06: {
id: "v06",
src: "../video/数学-2下-视频--饮品和是4的加法/交互22+2错误答案.mp4",
alt: "2+2等于4您的回答错误",
nextId: "b02"
},
v07: {
id: "v07",
src: "../video/数学-2下-视频--饮品和是4的加法/交互33+1.mp4",
alt: "2+2等于4",
nextId: "b03"
},
v08: {
id: "v08",
src: "../video/数学-2下-视频--饮品和是4的加法/交互33+1正确答案.mp4",
alt: "2+2等于4您的回答正确",
nextId: "n07"
},
v09: {
id: "v09",
src: "../video/数学-2下-视频--饮品和是4的加法/交互33+1错误答案.mp4",
alt: "2+2等于4您的回答错误",
nextId: "b03"
},
},
videosList: [
{
videosId: "v01",
title: "1 + 3 等于 4",
},
{
videosId: "v04",
title: "2 + 2 等于 4",
},
{
videosId: "v07",
title: "3 + 1 等于 4",
},
],
buttons: {
b01: {
id: "b01",
question: "小朋友你觉得1+3等于4吗",
btn: [
{
id: "b01-1",
text: "等于",
nextId: "v02"
},
{
id: "b01-2",
text: "不等于",
nextId: "v03"
}
]
},
b02: {
id: "b02",
question: "小朋友你觉得2+2等于4吗",
btn: [
{
id: "b02-1",
text: "等于",
nextId: "v05"
},
{
id: "b02-2",
text: "不等于",
nextId: "v06"
}
]
},
b03: {
id: "b03",
question: "小朋友你觉得3+1等于4吗",
btn: [
{
id: "b03-1",
text: "等于",
nextId: "v08"
},
{
id: "b03-2",
text: "不等于",
nextId: "v09"
}
]
},
},
notices: {
n01: {
id: "n01",
text: "太好了!让我们继续下一节课吧!",
nextId: "thank"
}
}
},
thank: {
id: "t01",
name: "人工智能24级窦文俊、冯宇乐、汪一凡、迟龙同学",
},
play: [
{
title: "美味餐桌",
url: "./play/美味餐桌014以内加法.html",
},
{
title: "美食点餐",
url: "./play/美味餐桌024以内加法.html",
},
],
},
}
};
let courseList = {
live: [
[
[
{
id: "l1s01",
name: "爱护环境",
des: "",
},
{
id: "l1s02",
name: "比大小",
des: "",
},
{
id: "l1s03",
name: "什么是情绪",
des: "",
},
], // 上
[], // 下
], // 一年级
[
[], // 上
[], // 下
], // 二年级
[
[], // 上
[], // 下
], // 三年级
[
[], // 上
[], // 下
], // 四年级
[
[], // 上
[], // 下
], // 五年级
[
[], // 上
[], // 下
], // 六年级
],
language: [
[
[], // 上
[], // 下
], // 一年级
[
[], // 上
[], // 下
], // 二年级
[
[
{
id: "c3s01",
name: "教师节",
des: "",
},
{
id: "c3s02",
name: "课外活动真丰富",
des: "",
},
{
id: "c3s03",
name: "课间安全",
des: "",
},
{
id: "c3s04",
name: "鞋",
des: "",
},
{
id: "c3s05",
name: "爱护牙齿",
des: "",
},
{
id: "c3s06",
name: "小台灯",
des: "",
},
{
id: "c3s07",
name: "我生活的小区",
des: "",
},
{
id: "c3s08",
name: "我的奶奶",
des: "",
},
{
id: "c3s09",
name: "静夜思",
des: "",
},
{
id: "c3s10",
name: "对韵歌",
des: "",
},
{
id: "c3s11",
name: "小小的船",
des: "",
},
{
id: "c3s12",
name: "过年了",
des: "",
},
], // 上
[], // 下
], // 三年级
[
[], // 上
[], // 下
], // 四年级
[
[], // 上
[], // 下
], // 五年级
[
[], // 上
[], // 下
], // 六年级
],
math: [
[
[], // 上
[], // 下
], // 一年级
[
[], // 上
[
{
id: "m2x00", // 数学-2年级下-第一节
name: "认识数字", //
des: "认识5以内的数字",
},
{
id: "m2x01", // 数学-2年级下-第一节
name: "多彩的生活", //
des: "早晨、上午、中午、下午",
},
{
id: "m2x02", // 数学-2年级下-第二节
name: "今天我值日", //
des: "得数是2的加法",
},
{
id: "m2x03", // 数学-2年级下-第三节
name: "整洁的校园", //
des: "得数是3的加法",
},
{
id: "m2x04", // 数学-2年级下-第四节
name: "常见的饮品", //
des: "得数是4的加法",
},
{
id: "m2x05", // 数学-2年级下-第五节
name: "我的三餐", //
des: "得数是5的加法",
},
{
id: "m2x06", // 数学-2年级下-第六节
name: "整理餐具", //
des: "2减几",
},
{
id: "m2x07", // 数学-2年级下-第七节
name: "爸妈真辛苦", //
des: "3减几",
},
{
id: "m2x08", // 数学-2年级下-第八节
name: "我爱我家", //
des: "4减几",
},
{
id: "m2x09", // 数学-2年级下-第九节
name: "社区设施", //
des: "5减几",
},
{
id: "m2x010", // 数学-2年级下-第十节
name: "劳动真快乐", //
des: "0的加减",
},
], // 下
], // 二年级
[
[], // 上
[], // 下
], // 三年级
[
[], // 上
[], // 下
], // 四年级
[
[], // 上
[], // 下
], // 五年级
[
[], // 上
[], // 下
], // 六年级
],
};
// 所有的游戏列表
let playList = {
live: [
{
title: "系鞋带",
url: "",
},
{
title: "擦桌子",
url: "",
},
{
title: "吃面条",
url: "",
},
{
title: "整理餐具",
url: "",
},
{
title: "过马路",
url: "",
},
],
language: [
{
title: "元宵节",
url: "",
},
{
title: "小小的船",
url: "",
},
{
title: "我的小区",
url: "",
},
],
math: [
{
title: "比大小",
url: "./play/比大小.html",
},
{
title: "认识时钟",
url: "",
},
],
};
// grade课程列表 type课程类型
function setKeyPoints(array, type) {
if (array.length == 0) {
return
}
let arr = array;
let object = classObject[type];
arr.map((v, i) => {
if (
v.id &&
object[v.id] &&
object[v.id].courseVideo &&
object[v.id].courseVideo.id &&
object[v.id].courseVideo.title &&
object[v.id].task &&
object[v.id].task.videosList &&
object[v.id].play
) {
let video = object[v.id].task.videosList;
video.map(val => (val.type = "video"));
let play = object[v.id].play;
play.map(val => (val.type = "play"));
v.list = [
{
videosId: object[v.id].courseVideo.id,
title: object[v.id].courseVideo.title,
type: "course",
},
...video,
...play,
];
v.list.map(val => (val.classId = v.id));
playList[type] = [
...playList[type],
...play,
];
}
})
// console.log("setKeyPoints", array, type, object);
return arr;
};
Object.entries(courseList).map((courseValue, courseIndex) => {
console.log("Object.entries courseList", courseValue, courseIndex);
courseValue[1].map((grade, gradeI) => {
grade[0] = setKeyPoints(grade[0], courseValue[0]);
grade[1] = setKeyPoints(grade[1], courseValue[0]);
});
});
console.log("GLOBAL_CONFIG", classObject, courseList, playList);
// 存入全局数据
win.GLOBAL_CONFIG = {
classObject: classObject,
courseList: courseList,
playList: playList,
};
// 添加访问跟踪功能
win.trackCourseAccess = function(courseId) {
if (window.accessTracker) {
window.accessTracker.startCourseAccess(courseId);
}
};
win.trackGameAccess = function(gameId) {
if (window.accessTracker) {
window.accessTracker.startGameAccess(gameId);
}
};
win.trackVideoAccess = function(courseId, videoId) {
if (window.accessTracker) {
window.accessTracker.startVideoAccess(courseId, videoId);
}
};
win.endAccess = function() {
if (window.accessTracker) {
window.accessTracker.endAccess();
}
};
// 添加游戏跟踪功能
win.startGame = function(gameId, gameData) {
if (window.gameTracker) {
window.gameTracker.startGame(gameId, gameData);
}
};
win.recordGameWin = function(score, gameData) {
if (window.gameTracker) {
window.gameTracker.recordWin(score, gameData);
}
};
win.recordGameLose = function(score, gameData) {
if (window.gameTracker) {
window.gameTracker.recordLose(score, gameData);
}
};
win.recordGameCorrect = function(score, gameData) {
if (window.gameTracker) {
window.gameTracker.recordCorrect(score, gameData);
}
};
win.recordGameIncorrect = function(score, gameData) {
if (window.gameTracker) {
window.gameTracker.recordIncorrect(score, gameData);
}
};
win.recordGameAttempt = function() {
if (window.gameTracker) {
window.gameTracker.recordAttempt();
}
};
})(window);
// 网页间相互通信
function htmlPostMessage(message) {
const mainPlay = document.getElementById('mainPlay');
if (mainPlay && mainPlay.style.display !== "none" && mainPlay.contentWindow) {
mainPlay.contentWindow.postMessage(message, 'http://localhost'); // 替换为目标域名
}
}
// 监听来自B网页的消息
window.addEventListener('message', function (event) {
// 检查消息来源是否可信
if (event.origin !== 'http://localhost') return;
const message = event.data;
console.log('主页面 接收到的数据:', message);
if (message.type == "语音识别") {
showSpeech()
}
else if (message.type == "体感识别") {
showBody()
}
});