|
@@ -120,6 +120,16 @@ const state: anyObj = reactive({
|
|
lastChapterNum: -1,
|
|
lastChapterNum: -1,
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * 用于控制应该加载哪个三维场景
|
|
|
|
+ * cctv cctv实训检测
|
|
|
|
+ * qv qv实训检测
|
|
|
|
+ * sonar 声纳实训检测
|
|
|
|
+ *
|
|
|
|
+ * 默认null ,则先不触发加载
|
|
|
|
+ */
|
|
|
|
+let threeWorldLoadType = ref(null);
|
|
|
|
+
|
|
let chapterQueue: Array<Array<anyObj>> = [];
|
|
let chapterQueue: Array<Array<anyObj>> = [];
|
|
let maxChapterNum = 0;
|
|
let maxChapterNum = 0;
|
|
// 获取当前学生任务ID缺陷列表
|
|
// 获取当前学生任务ID缺陷列表
|
|
@@ -307,6 +317,7 @@ onMounted(() => {
|
|
//获取课程树
|
|
//获取课程树
|
|
getCourseChapterTree(res.data.data.courseId).then((res2) => {
|
|
getCourseChapterTree(res.data.data.courseId).then((res2) => {
|
|
state.chapterTree = res2.data.data;
|
|
state.chapterTree = res2.data.data;
|
|
|
|
+ threeWorldLoadTypeEvent();
|
|
buildChapterQueue(res2.data.data, res.data.data.optionChapters);
|
|
buildChapterQueue(res2.data.data, res.data.data.optionChapters);
|
|
//需先根据学习进度确定开始章节:currentStep和currentNode,默认第一章第一节
|
|
//需先根据学习进度确定开始章节:currentStep和currentNode,默认第一章第一节
|
|
//获取学习到的章节
|
|
//获取学习到的章节
|
|
@@ -574,6 +585,53 @@ const dataURLtoBlob = (dataurl: any) => {
|
|
return new Blob([u8arr], { type: mime });
|
|
return new Blob([u8arr], { type: mime });
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * 控制三维场景类型,决定加载哪个
|
|
|
|
+ */
|
|
|
|
+const threeWorldLoadTypeEvent = () => {
|
|
|
|
+
|
|
|
|
+ // console.log(
|
|
|
|
+ // "threeWorldLoadTypeEvent state.chapterTree ===>", state.chapterTree
|
|
|
|
+ // );
|
|
|
|
+
|
|
|
|
+ let newArray = getChapterTreeArray(state.chapterTree);
|
|
|
|
+ console.log("newArray ===>", newArray);
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 将 state.chapterTree 树形结构,转换成数组列表
|
|
|
|
+ * array 当前遍历的数组,一开始传 state.chapterTree
|
|
|
|
+ */
|
|
|
|
+const getChapterTreeArray = (array : any) => {
|
|
|
|
+
|
|
|
|
+ if (array == null || array == undefined) {
|
|
|
|
+ return [];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let retArray : any = [];
|
|
|
|
+
|
|
|
|
+ for (let i = 0; i < array.length; i++) {
|
|
|
|
+
|
|
|
|
+ let objArray = array[i];
|
|
|
|
+ // console.log("objArray ===>", objArray);
|
|
|
|
+ retArray.push(objArray);
|
|
|
|
+
|
|
|
|
+ if (objArray['children'] != null && objArray['children'] != undefined) {
|
|
|
|
+ let children = objArray['children'];
|
|
|
|
+ let newArray = getChapterTreeArray(children);
|
|
|
|
+ for (let newArrayI = 0; newArrayI < newArray.length; newArrayI++) {
|
|
|
|
+ let objNewArray = newArray[newArrayI];
|
|
|
|
+ retArray.push(objNewArray);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return retArray;
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
</script>
|
|
</script>
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
.chapter-container {
|
|
.chapter-container {
|