123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053 |
- <template>
- <div class="chapter-container">
- <div v-if="!state.hasRead" class="chapter-describe">
- <div class="describe-cnt" v-html="state.readHtml"></div>
- <div class="describe-readed">
- <a class="readed-btn" :class="{ reading: state.readingTime > 0 }" @click="hasReadClick">知道了{{ state.readingTime > 0 ? ` (${state.readingTime}s)` : '' }}</a>
- </div>
- </div>
- <div v-if="state.hasRead && state.showCnt" class="chapter-box">
- <NavMenus :back-confirm="state.lastChapterNum != maxChapterNum"></NavMenus>
- <div class="chapter-content">
- <div class="menu-box" :class="{ fold: state.menuFold }">
- <div class="menu-title">{{ state.chapterTree[state.currentStep]?.name ?? '' }}</div>
- <div class="menu-list">
- <el-scrollbar :max-height="state.menuListHeight">
- <el-steps direction="vertical" space="7rem" :active="state.currentStep">
- <el-step v-for="(item, idx) in state.chapterTree" :title="item.name" @click="menuClick($event, idx)">
- <template #icon>
- <div class="step-icon">
- <div class="step-icon-inner"></div>
- </div>
- </template>
- <template #description v-if="item.children?.length > 0">
- <el-steps
- direction="vertical"
- space="1.8rem"
- :active="idx < state.currentStep ? item.children.length : idx > state.currentStep ? -1 : state.activeSecondMenu"
- >
- <el-step v-for="item1 in item.children" :title="item1.name" @click="menuClick($event, idx, item1.id)">
- <template #icon><div class="step-icon-second"></div></template>
- </el-step>
- </el-steps>
- </template>
- </el-step>
- </el-steps>
- </el-scrollbar>
- <div class="menu-switch" @click="menuSwitch"></div>
- </div>
- </div>
- <div v-if="state.currentChapter.type != 30" class="chapter-detail">
- <div class="detail-title">{{ state.currentChapter.name }}</div>
- <div class="detail-cnt" v-html="htmlContent"></div>
- </div>
- <!-- <div v-else class="chapter-3d">
- <CourseChapter3d :config="state.chapterTree[state.currentStep]?.threeDimensionalConfig ?? ''"></CourseChapter3d>
- <CourseChapter3dView></CourseChapter3dView>
- </div> -->
- </div>
- <!-- 上一步,下一步 -->
- <!-- <StepTips
- v-if="
- (courseChapter3dShow().show.showToastViewBool == false && courseChapter3dShow().show.showLinkOkNextBool == false)
- ||
- (courseChapter3dShow().show.showToastViewBool == true &&
- courseChapter3dShow().show.showToastState == '' &&
- courseChapter3dShow().show.showLinkOkNextBool == false)
- "
- :msg="state.tipsMsg"
- :btns="state.tipsBtns"
- :countdown="tipsCountdown"
- :key="state.tipsKey"
- ></StepTips> -->
- <StepTips
- v-if="
- (
- (
- (
- courseChapter3dShow().show.showToastViewBool == false
- && courseChapter3dShow().show.showLinkOkNextBool == false
- )
- ||
- (
- courseChapter3dShow().show.showToastViewBool == true &&
- courseChapter3dShow().show.showToastState == '' &&
- courseChapter3dShow().show.showLinkOkNextBool == false
- )
- ) && threeWorldLoadType == 'cctv'
- )
- || (
- (
- threeWorldLoadType == 'qv'
- || threeWorldLoadType == 'sonar'
- ) && stepTipsBool == true
- )
- "
- :msg="state.tipsMsg"
- :btns="state.tipsBtns"
- :countdown="tipsCountdown"
- :key="state.tipsKey"
- ></StepTips>
- </div>
- <!-- 3d组件放在这里,让它可以隐藏起来,提前加载好场景。要不然后续切换3d场景每次要重新加载,比较麻烦 -->
- <!-- <div v-show="state.hasRead && state.showCnt && state.currentChapter.type == 30" class="chapter-3d"> -->
- <div v-if="courseChapter3dViewBool == true" class="chapter-3d">
-
- <!-- type == 30 是当前流程是三维流程 -->
- <div v-show="state.hasRead && state.showCnt && state.currentChapter.type == 30">
- <!-- CCTV实训检测三维场景逻辑 -->
- <div v-if="threeWorldLoadType == 'cctv'">
- <CourseChapter3d
- :config="state?.currentChapter ?? ''"
- :studentTaskIdList="studentTaskIdList"
- @tipsBtnsUpOpen="tipsBtnsUpOpenEvent"
- @tipsBtnsDownOpen="tipsBtnsDownOpenEvent"
- ></CourseChapter3d>
- <CourseChapter3dView
- @showOperationHelpExitEvent="showOperationHelpExitEvent"
- @carCameraScreenshot="carCameraScreenshotEvent"
- @carShutDown="carShutDownEvent"
- ></CourseChapter3dView>
- </div>
- <!-- QV实训检测 -->
- <div v-if="threeWorldLoadType == 'qv'">
- <QvSimulationMain
- v-show="QvSimulationMainLook == true"
- ></QvSimulationMain>
- <CarSimulationMain
- v-show="CarSimulationMainLook == true"
- @callbackChuanGongZuoFu="callbackChuanGongZuoFuQvEvent"
- ></CarSimulationMain>
- </div>
- <!-- 声纳实训检测 -->
- <div v-if="threeWorldLoadType == 'sonar'">
-
- </div>
-
- </div>
- </div>
- </div>
- </template>
- <script setup lang="ts">
- import { onMounted, reactive, computed, watch, onUnmounted, nextTick, ref } from 'vue';
- import NavMenus from '../components/navMenus.vue';
- import StepTips from '../components/stepTips.vue';
- import { useRoute } from 'vue-router';
- import { getCourseInfo, getCourseChapterTree, studyReport, getCurrentChapter, updateProgress } from '@/api/student/trainChapter';
- import { studentTaskOptionPipDefectListByStudentId } from '@/api/student/studentTaskOptionPipDefect';
- import CourseChapter3d from '@/components/student/CourseChapter3d.vue';
- import CourseChapter3dView from '@/components/student/courseChapter3d/view.vue';
- import { getTrainDetail } from '@/api/student/trainList';
- import router from '@/router/index';
- import { courseChapter3dShow } from '@/stores/courseChapter3dShow.ts';
- import { threeWorld } from '@/stores/threeWorld.ts';
- import { uploadFileOss, getLiteMeta } from '../../../util/fileUtils';
- import { ElMessage, ElMessageBox, ElNotification } from 'element-plus';
- import { studentTaskPhoto } from '@/api/techer/taskStudentScore';
- import QvSimulationMain from "../../../components/QvSimulation/QvSimulationMain.vue";
- import CarSimulationMain from "../../../components/CarSimulation/CarSimulationMain.vue";
- import SonarSimulationMain from "../../../components/SonarSimulation/SonarSimulationMain.vue";
- const route = useRoute();
- const taskId = route.params.taskId as string;
- const studentTaskId = route.params.studentTaskId as string;
- const state: anyObj = reactive({
- hasRead: true,
- readingTime: 10,
- readHtml: '',
- showCnt: false,
- menuFold: false,
- menuListHeight: ``,
- tipsKey: 0,
- tipsMsg: '',
- tipsBtns: [],
- chapterTree: [],
- currentStep: 0,
- currentNode: 0,
- currentChapter: { type: 10 },
- activeSecondMenu: -1,
- lastChapterNum: -1,
- });
- // 地下车是否可以展示
- let CarSimulationMainLook = ref(true);
- // QV检测是否可以展示
- let QvSimulationMainLook = ref(false);
- // 声纳车是否可以展示
- let SonarSimulationMainLook = ref(false);
- /**
- * 之前CCTV的逻辑是固定了,这里是新增的
- * 用于控制 QV 检测 和 声纳车 以及后续可能新增的分类
- * 因为后面新增的,有自己的上一步,下一步UI了
- * 此时进入三维的上一步下一步再三维UI控制
- *
- * 所以外部流程控制的先隐藏,直到三维流程走完才显示
- */
- let stepTipsBool = ref(true);
- /**
- * 用于控制应该加载哪个三维场景
- * cctv cctv实训检测
- * qv qv实训检测
- * sonar 声纳实训检测
- *
- * 默认null ,则先不触发加载
- */
- let threeWorldLoadType : any = ref(null);
- let chapterQueue: Array<Array<anyObj>> = [];
- let maxChapterNum = 0;
- // 获取当前学生任务ID缺陷列表
- let studentTaskIdList: any = ref([]);
- // 用于控制3d场景什么时候加载显示
- let courseChapter3dViewBool = ref(false);
- const buildChapterQueue = (data: anyObj[], optionChapters: anyObj[], root = true): anyObj[] => {
- let chapters: anyObj[] = [];
- data?.forEach((item, idx) => {
- const children = item.children;
- //delete item.children;
- const opt = optionChapters.find((x) => x.chapterId == item.id);
- if (opt) item.durationStudyMin = opt.durationStudyMin;
- chapters.push(item);
- if (children && children.length > 0) {
- const childs = buildChapterQueue(children, optionChapters, false);
- chapters = chapters.concat(childs);
- }
- if (root) {
- chapterQueue[idx] = [...chapters];
- chapters = [];
- }
- });
- if (root) maxChapterNum = (chapterQueue.length - 1) * 100 + chapterQueue[chapterQueue.length - 1].length - 1;
- return chapters;
- };
- const menuSwitch = () => {
- state.menuFold = !state.menuFold;
- };
- const menuClick = (evt: Event, step: number, nodeId?: string) => {
- if ((evt.target as HTMLElement).classList.contains('el-step__title')) {
- let chapterNum = step * 100,
- node = 0;
- if (nodeId) {
- node = chapterQueue[step].findIndex((x) => x.id == nodeId);
- if (node > -1) chapterNum += node;
- }
- if (chapterNum <= state.lastChapterNum) {
- state.currentStep = step;
- state.currentNode = node;
- state.currentChapter = chapterQueue[step][node];
- } else {
- ElMessage({
- message: '该章节还未完成学习,请先按顺序完成学习!',
- type: 'warning',
- });
- }
- }
- evt.stopPropagation();
- };
- const hasReadClick = () => {
- state.hasRead = true;
- state.showCnt = true;
- setMenuListHeight();
- };
- const setMenuListHeight = () => {
- nextTick(() => {
- let height = document.querySelector('.menu-box')?.clientHeight ?? 0;
- if (height) state.menuListHeight = `calc(${height}px - 12rem)`;
- });
- };
- const countdown = (name: string, callback?: Function) => {
- if (state[name]) {
- const interval = setInterval(() => {
- state[name]--;
- if (state[name] == 0) {
- clearInterval(interval);
- if (callback) callback();
- }
- }, 1000);
- }
- };
- const tipsCountdown = computed(() => {
- let countdown = state.currentChapter.durationStudyMin ?? 0;
- const chapterNum = state.currentStep * 100 + state.currentNode;
- if (chapterNum <= state.lastChapterNum) countdown = 0;
- return countdown;
- });
- const htmlContent = computed(() => {
- if (state.currentChapter.type == 10) {
- return state.currentChapter.richText;
- } else if (state.currentChapter.type == 20) {
- return `<iframe src='${state.currentChapter.videoUrl}' width='100%' height='99%' scrolling='no' frameborder='0'><iframe>`;
- } else return '';
- });
- const prevStep = () => {
- if (state.currentNode == 0) {
- state.currentStep--;
- state.currentNode = chapterQueue[state.currentStep].length - 1;
- } else state.currentNode--;
- state.currentChapter = chapterQueue[state.currentStep][state.currentNode];
- };
- const nextStep = () => {
- updateStudyProgress();
- state.currentNode++;
- if (state.currentNode >= chapterQueue[state.currentStep].length) {
- state.currentStep++;
- state.currentNode = 0;
- }
- state.currentChapter = chapterQueue[state.currentStep][state.currentNode];
- };
- const completeStudy = () => {
- updateStudyProgress();
- router.push({ path: `/train/main/${taskId}` });
- };
- const updateStudyProgress = () => {
- //更新学习进度
- const num = state.currentStep * 100 + state.currentNode;
- if (num > state.lastChapterNum) {
- state.lastChapterNum = num;
- updateProgress(studentTaskId, state.currentChapter.id);
- }
- };
- const initTips = () => {
- state.tipsKey++;
- state.tipsMsg = state.currentChapter.tips;
- if (state.currentStep == 0 && state.currentNode == 0) {
- state.tipsBtns = [
- {
- name: '下一步',
- click: nextStep,
- attr: { type: 'primary' },
- },
- ];
- } else if (state.currentStep == chapterQueue.length - 1 && state.currentNode == chapterQueue[state.currentStep].length - 1) {
- state.tipsBtns = [
- {
- name: '上一步',
- click: prevStep,
- attr: { type: 'primary', plain: 'plain' },
- },
- {
- name: '完成并前往编制报告',
- click: completeStudy,
- attr: { type: 'primary' },
- },
- ];
- } else {
- state.tipsBtns = [
- {
- name: '上一步',
- click: prevStep,
- attr: { type: 'primary', plain: 'plain' },
- },
- {
- name: '下一步',
- click: nextStep,
- attr: { type: 'primary' },
- },
- ];
- }
- };
- let studyInterval: NodeJS.Timeout;
- onMounted(() => {
-
- threeWorld().loadSuccess = false;// CCTV实训检测三维场景逻辑
- courseChapter3dViewBool.value = false;
- //学习时间上报
- studyInterval = setInterval(() => {
- const type = state.currentChapter.type != 30 ? 1 : 2;
- studyReport(studentTaskId, type);
- }, 1000 * 100);
- //获取任务信息
- getTrainDetail(taskId).then((res) => {
- //获取课程信息
- getCourseInfo(res.data.data.courseId).then((res1) => {
- if (res1.data.data.description) {
- state.hasRead = false;
- state.readHtml = res1.data.data.description;
- countdown('readingTime');
- } else {
- state.hasRead = true;
- state.showCnt = true;
- setMenuListHeight();
- }
- window.addEventListener('resize', () => {
- setMenuListHeight();
- });
- });
- //获取课程树
- getCourseChapterTree(res.data.data.courseId).then((res2) => {
- state.chapterTree = res2.data.data;
- threeWorldLoadTypeEvent();
- buildChapterQueue(res2.data.data, res.data.data.optionChapters);
- //需先根据学习进度确定开始章节:currentStep和currentNode,默认第一章第一节
- //获取学习到的章节
- getCurrentChapter(studentTaskId).then((res3) => {
- const chapterId = res3.data.data;
- if (chapterId) {
- for (let i = 0; i < chapterQueue.length; i++) {
- const idx = chapterQueue[i].findIndex((x) => x.id == chapterId);
- if (idx > -1) {
- state.currentStep = i;
- state.currentNode = idx;
- break;
- }
- }
- state.lastChapterNum = state.currentStep * 100 + state.currentNode;
- }
- state.currentChapter = chapterQueue[state.currentStep][state.currentNode];
- initTips();
- });
- });
- // 根据学生id任务获取缺陷数据
- studentTaskOptionPipDefectListByStudentId(studentTaskId)
- .then((studentTaskOptionPipDefectListByStudentIdRes) => {
- studentTaskIdList.value = studentTaskOptionPipDefectListByStudentIdRes?.data?.data;
- courseChapter3dViewBool.value = true;
- // console.log(
- // "根据学生id任务获取缺陷数据",
- // studentTaskIdList.value,
- // studentTaskId
- // );
- })
- .catch((error) => {
- courseChapter3dViewBool.value = true;
- });
- });
- });
- onUnmounted(() => {
- if (studyInterval) clearInterval(studyInterval);
- });
- watch(
- () => state.currentChapter,
- (newVal) => {
-
- initTips();
- //滚动当前课程菜单至可视区域
- nextTick(() => {
- const target = document.querySelector('.el-step__description .is-process') as HTMLElement;
- target?.scrollIntoView({ behavior: 'smooth', block: 'center' });
- });
- //课程菜单默认显示二级,兼容课程树层级大于二级的情况
- if (state.currentNode == 0) state.activeSecondMenu = -1;
- else {
- const idx = (state.chapterTree[state.currentStep].children as anyObj[])?.findIndex((x) => x.id == newVal.id);
- if (idx > -1) state.activeSecondMenu = idx;
- }
- console.log(
- "更新到新的流程 state.currentChapter ===>",
- state.currentChapter,
- state.currentChapter.type,
- state.currentChapter.threeDimensionalConfig
- );
- /**
- * 后面新增其他三维逻辑进行控制展示
- */
- if (
- threeWorldLoadType.value == 'qv'
- || threeWorldLoadType.value == 'sonar'
- ) {
-
- }
-
- }
- );
- /**
- * // CCTV实训检测三维场景逻辑
- * 检测实训注意事项 知道了点击回调
- */
- courseChapter3dShow().show.showMatterGotItCallback = function () {
- // console.log(
- // "检测实训注意事项 知道了点击回调", res
- // );
- // 触发下一步逻辑
- nextStep();
- };
- /**
- * // CCTV实训检测三维场景逻辑
- * 监听弹出提示隐藏后来触发不同的逻辑
- */
- watch(
- () => courseChapter3dShow().show.showToastViewBool,
- (newVal, oldVal) => {
- if (courseChapter3dShow().show.showToastViewBool == true) {
- return;
- }
- // console.log(
- // " () => courseChapter3dShow().show.showToastState 1111111111 ",
- // courseChapter3dShow().show.showToastState
- // );
- switch (courseChapter3dShow().show.showToastState) {
- case '立即穿戴':
- // // 触发下一步逻辑
- // nextStep();
- break;
- }
- }
- );
- // 记录 tipsBtnsUpOpenEvent 事件是否显示上一步按钮
- let tipsBtnsUpOpenEventBool: Boolean = true;// CCTV实训检测三维场景逻辑
- /**
- * // CCTV实训检测三维场景逻辑
- * 上一步是否显示
- * open true - 显示, false - 隐藏
- */
- const tipsBtnsUpOpenEvent = (open: Boolean) => {
- // console.log("上一步是否显示", open);
- tipsBtnsUpOpenEventBool = open;
- tipsBtnsUpAndDownOpenEvent();
- };
- // 记录 tipsBtnsUpOpenEvent 事件是否显示下一步按钮
- let tipsBtnsDownOpenEventBool: Boolean = true;// CCTV实训检测三维场景逻辑
- /**
- * // CCTV实训检测三维场景逻辑
- * 下一步是否显示
- * open true - 显示, false - 隐藏
- */
- const tipsBtnsDownOpenEvent = (open: Boolean) => {
- // console.log("下一步是否显示", open);
- tipsBtnsDownOpenEventBool = open;
- tipsBtnsUpAndDownOpenEvent();
- };
- /**
- * // CCTV实训检测三维场景逻辑
- * 通过3d传来的事件来控制上一步下一步是否显示逻辑
- */
- const tipsBtnsUpAndDownOpenEvent = () => {
- let newArray = [];
- if (tipsBtnsUpOpenEventBool == true) {
- // newArray.push({
- // name: '上一步',
- // click: prevStep,
- // attr: { type: 'primary', plain: 'plain' },
- // });
- }
- if (tipsBtnsDownOpenEventBool == true) {
- newArray.push({
- name: '下一步',
- click: nextStep,
- attr: { type: 'primary' },
- });
- }
- // console.log(
- // " ========= state.tipsBtns ========= ",
- // state.tipsBtns
- // );
- // 如果出现 完成并前往编制报告 则不替换
- try {
- for (let i = 0; i < state.tipsBtns.length; i++) {
- let thisTipsBtns = state.tipsBtns[i];
- if (thisTipsBtns.name.indexOf('完成') >= 0) {
- return;
- }
- }
- } catch (e) {}
- state.tipsBtns = newArray;
- };
- // 操作帮助点击退出
- const showOperationHelpExitEvent = () => {// CCTV实训检测三维场景逻辑
- // 触发下一步逻辑
- nextStep();
- };
- /**
- * 车的完成下井实验
- */
- const carShutDownEvent = () => {// CCTV实训检测三维场景逻辑
- // 触发下一步逻辑
- nextStep();
- };
- /**
- * 车的相机截图
- * img base64位图片
- */
- const carCameraScreenshotEvent = (img: any) => {// CCTV实训检测三维场景逻辑
- // console.log(
- // "车的相机截图", img
- // );
- // 将 base64为转换成,Blob格式
- let objBlob = dataURLtoBlob(img);
- // blob 转换成 file对象
- const file = new File([objBlob], 'example.png', { type: 'text/plain' });
- // 优先上传文件
- // @ts-ignore
- uploadFileOss(file, 'course/cover', null)
- .then(function (e: any) {
- // console.log(
- // "上传文件", e
- // );
- studentTaskPhoto({
- studentTaskId: studentTaskId,
- imageUrl: e,
- remark: '',
- })
- .then(function (studentTaskPhotoRes: any) {
- // console.log(
- // "上传文件成功", studentTaskPhotoRes
- // );
- // ElMessage({
- // message: '截图上传完成',
- // type: 'success',
- // });
- courseChapter3dShow().show.showToastViewBool = false;
- courseChapter3dShow().show.showPromptEvent('截图上传完成', null, function (res: any) {
- // console.log("yes", res);
- });
- })
- .catch(function (studentTaskPhotoResError: any) {
- // ElMessage({
- // message: '上传失败',
- // type: 'warning',
- // });
- courseChapter3dShow().show.showToastViewBool = false;
- courseChapter3dShow().show.showPromptEvent('上传失败', null, function (res: any) {
- // console.log("yes", res);
- });
- });
- })
- .catch(function (e: any) {
- // ElMessage({
- // message: e || '上传失败',
- // type: 'warning',
- // });
- courseChapter3dShow().show.showToastViewBool = false;
- courseChapter3dShow().show.showPromptEvent('上传失败', null, function (res: any) {
- // console.log("yes", res);
- });
- });
- };
- /**
- * 将base64转换为blob
- * @param dataurl base64位图片
- */
- const dataURLtoBlob = (dataurl: any) => {
- let arr = dataurl.split(','),
- mime = arr[0].match(/:(.*?);/)[1],
- bstr = atob(arr[1]),
- n = bstr.length,
- u8arr = new Uint8Array(n);
- while (n--) {
- u8arr[n] = bstr.charCodeAt(n);
- }
- return new Blob([u8arr], { type: mime });
- };
- /**
- * 控制三维场景类型,决定加载哪个
- */
- const threeWorldLoadTypeEvent = () => {
- // console.log(
- // "threeWorldLoadTypeEvent state.chapterTree ===>", state.chapterTree
- // );
- let newArray = getChapterTreeArray(state.chapterTree);
- // console.log("newArray ===>", newArray);
- for (let i = 0; i < newArray.length; i++) {
- let objNewArray = newArray[i];
- let threeDimensionalConfig = objNewArray["threeDimensionalConfig"];
- // console.log("objNewArray", objNewArray);
- // console.log("threeDimensionalConfig", threeDimensionalConfig);
- if (threeDimensionalConfig == "QV仿真实验") {
- threeWorldLoadType.value = "qv";
- return;
- }
- if (threeDimensionalConfig == "将检测机器人6寸右侧轮子安装到正确位置") {
- threeWorldLoadType.value = "cctv";
- return;
- }
- if (threeDimensionalConfig == "声纳仿真实验") {
- threeWorldLoadType.value = "sonar";
- return;
- }
-
- }
-
- }
- /**
- * 将 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;
- }
- /**
- * QV穿完工作服回调
- * bool
- */
- const callbackChuanGongZuoFuQvEvent = (bool : any) => {
- // console.log( "穿完工作服回调 callbackChuanGongZuoFuQvEvent ===> ", bool );
- if (bool == true) {
- QvSimulationMainLook.value = true;
- CarSimulationMainLook.value = false;
- return;
- }
- QvSimulationMainLook.value = false;
- CarSimulationMainLook.value = true;
- }
- </script>
- <style lang="scss" scoped>
- .chapter-container {
- position: absolute;
- width: 100%;
- height: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
- z-index: 1;
- .chapter-describe {
- position: relative;
- width: 70%;
- height: 90%;
- background-image: url(/src/assets/student/bg_describe.png);
- background-size: 100% 100%;
- &:before {
- content: '';
- position: absolute;
- top: 3%;
- left: 28%;
- height: 6%;
- width: 70%;
- background-image: url(/src/assets/student/training.png);
- background-size: auto 100%;
- background-repeat: no-repeat;
- }
- .describe-cnt {
- overflow: auto;
- box-sizing: border-box;
- position: absolute;
- inset: 10rem 0 10rem 6rem;
- padding-right: 4rem;
- }
- .describe-readed {
- position: absolute;
- bottom: 3rem;
- width: 100%;
- display: flex;
- justify-content: center;
- .readed-btn {
- width: 20rem;
- height: 5.4rem;
- line-height: 5.4rem;
- text-align: center;
- color: white;
- font-size: 2rem;
- border-radius: 0.8rem;
- background: linear-gradient(90deg, #6cd9e9 0%, #4b90dd 100%);
- cursor: pointer;
- &.reading {
- pointer-events: none;
- }
- }
- }
- }
- .chapter-box {
- width: 100%;
- height: 100%;
- }
- .chapter-content {
- position: absolute;
- width: 100%;
- height: 100%;
- .menu-box {
- position: absolute;
- top: 3.2rem;
- left: 2rem;
- width: 20rem;
- height: calc(100% - 18rem);
- transition-property: left;
- transition-duration: 0.6s;
- z-index: 2;
- &.fold {
- left: -20rem;
- .menu-switch {
- background-image: url(/src/assets/student/training/menu_switch1.png);
- }
- }
- .menu-switch {
- position: absolute;
- width: 2rem;
- height: 5rem;
- background-image: url(/src/assets/student/training/menu_switch.png);
- background-size: 100% 100%;
- right: -2rem;
- top: 50%;
- margin-top: -2.5rem;
- cursor: pointer;
- }
- .menu-title {
- height: 5rem;
- background-image: url(/src/assets/student/training/menu_title.png);
- background-size: 100% 100%;
- color: white;
- font-size: 2rem;
- &:before {
- content: '';
- display: inline-block;
- vertical-align: middle;
- height: 5rem;
- width: 8rem;
- background-image: url(/src/assets/student/training/menu_icon.png);
- background-size: auto 50%;
- background-repeat: no-repeat;
- background-position: center center;
- }
- }
- .menu-list {
- position: relative;
- min-height: 20rem;
- max-height: calc(100% - 6rem);
- margin-top: 1rem;
- padding: 3rem 0 3rem 2rem;
- background-image: url(/src/assets/student/training/menu_list.png);
- background-size: 100% 100%;
- box-sizing: border-box;
- --step-item-size: 2rem;
- --step-icon-size: 1.2rem;
- --step-line-left: 0.9rem;
- --step-border-width: 0.2rem;
- .step-icon {
- width: var(--step-item-size);
- height: var(--step-item-size);
- border-radius: 50%;
- border: var(--step-border-width) solid #5faaf4;
- box-sizing: border-box;
- transition: 0.15s ease-out;
- display: flex;
- justify-content: center;
- align-items: center;
- .step-icon-inner {
- width: var(--step-icon-size);
- height: var(--step-icon-size);
- background-size: 100% 100%;
- }
- }
- :deep(.el-step__head) {
- width: var(--step-item-size);
- .el-step__line {
- width: var(--step-border-width);
- top: var(--step-item-size);
- left: var(--step-line-left);
- background-color: #5faaf4;
- }
- .el-step__icon {
- width: unset;
- height: unset;
- background: transparent;
- display: flex;
- }
- &.is-process .step-icon-inner {
- background-image: url(/src/assets/student/training/step_process.png);
- }
- &.is-finish .step-icon-inner {
- background-image: url(/src/assets/student/training/step_finish.png);
- }
- }
- :deep(.el-step__main) {
- padding-left: 2rem;
- .el-step__title {
- font-size: var(--step-item-size);
- color: white;
- font-weight: unset;
- line-height: var(--step-item-size);
- cursor: pointer;
- &.is-process,
- &.is-finish {
- text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.2);
- background: linear-gradient(180deg, #82ccdd 0%, #589cf2 100%);
- background-clip: text;
- -webkit-background-clip: text;
- -webkit-text-fill-color: transparent;
- }
- }
- .el-step__description {
- margin-left: -1.1rem;
- --step-item-size: 0.9rem;
- --step-icon-size: 0.6rem;
- .el-steps {
- margin: 0.8rem 0;
- }
- .el-step__head {
- width: var(--step-icon-size);
- &.is-process .step-icon-second {
- background-color: #5ff49b;
- }
- &.is-finish .step-icon-second {
- background-color: #5fa9f4;
- }
- }
- .el-step__icon {
- height: var(--step-item-size);
- line-height: var(--step-item-size);
- }
- .step-icon-second {
- width: var(--step-icon-size);
- height: var(--step-icon-size);
- border-radius: 50%;
- box-sizing: border-box;
- background-color: #ccc;
- }
- .el-step__line {
- width: 0.1rem;
- left: 0.25rem;
- top: 0.6rem;
- bottom: -0.4rem;
- margin-bottom: unset !important;
- &:after {
- display: none;
- }
- }
- .el-step:last-of-type .el-step__line {
- display: none;
- }
- .el-step__main {
- padding-left: 0.6rem;
- }
- .el-step__title {
- font-size: var(--step-item-size);
- &.is-process {
- color: #5ff49b;
- -webkit-text-fill-color: unset;
- }
- &.is-finish {
- color: #5fa9f4;
- -webkit-text-fill-color: unset;
- }
- }
- }
- }
- :deep(.el-step:last-of-type) {
- .el-step__line {
- display: block;
- margin-bottom: 1rem;
- &:after {
- content: '';
- position: absolute;
- border: 0.8rem solid transparent;
- border-top-color: #5faaf4;
- bottom: -1rem;
- left: -0.7rem;
- }
- .el-step__line-inner {
- transition-delay: 150ms;
- border-width: 0px;
- height: 0%;
- }
- }
- }
- }
- }
- .chapter-detail {
- position: absolute;
- top: 3.2rem;
- left: 28rem;
- width: 88rem;
- height: 56rem;
- max-height: calc(100% - 12rem);
- background-image: url(/src/assets/student/training/window_bg.png);
- background-size: 100% 100%;
- .detail-title {
- height: 18%;
- font-size: 3rem;
- text-align: center;
- color: white;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .detail-cnt {
- height: 76%;
- padding: 0 5rem;
- box-sizing: border-box;
- overflow: auto;
- :deep(img) {
- max-width: 100%;
- }
- }
- }
- }
- }
- </style>
|