trainChapter.vue 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240
  1. <template>
  2. <div class="chapter-container">
  3. <div v-if="!state.hasRead" class="chapter-describe">
  4. <div class="describe-cnt" v-html="state.readHtml"></div>
  5. <div class="describe-readed">
  6. <a class="readed-btn" :class="{ reading: state.readingTime > 0 }" @click="hasReadClick">知道了{{ state.readingTime > 0 ? ` (${state.readingTime}s)` : '' }}</a>
  7. </div>
  8. </div>
  9. <div v-if="state.hasRead && state.showCnt" class="chapter-box">
  10. <NavMenus :back-confirm="state.lastChapterNum != maxChapterNum"></NavMenus>
  11. <div class="chapter-content">
  12. <!-- 原本的左侧菜单 -->
  13. <!-- <div class="menu-box" :class="{ fold: state.menuFold }">
  14. <div class="menu-title">{{ state.chapterTree[state.currentStep]?.name ?? '' }}</div>
  15. <div class="menu-list">
  16. <el-scrollbar :max-height="state.menuListHeight">
  17. <el-steps direction="vertical" space="3rem" :active="state.currentStep">
  18. <el-step v-for="(item, idx) in state.chapterTree" :title="item.name" @click="menuClick($event, idx)">
  19. <template #icon>
  20. <div class="step-icon">
  21. <div class="step-icon-inner"></div>
  22. </div>
  23. </template>
  24. <template #description v-if="item.children?.length > 0">
  25. <el-steps
  26. direction="vertical"
  27. space="1.8rem"
  28. :active="idx < state.currentStep ? item.children.length : idx > state.currentStep ? -1 : state.activeSecondMenu"
  29. >
  30. <el-step v-for="item1 in item.children" :title="item1.name" @click="menuClick($event, idx, item1.id)">
  31. <template #icon><div class="step-icon-second"></div></template>
  32. </el-step>
  33. </el-steps>
  34. </template>
  35. </el-step>
  36. </el-steps>
  37. </el-scrollbar>
  38. <div class="menu-switch" @click="menuSwitch"></div>
  39. </div>
  40. </div> -->
  41. <!-- 新的左侧菜单 -->
  42. <div :class="'menuLeft ' + (menuLeftLook == true ? 'menuLeftOpenEvent' : 'menuLeftExitEvent')" >
  43. <div class="menuTitle" >
  44. <div class="logoLeft"></div>
  45. <div class="txtRight">知识学习</div>
  46. </div>
  47. <div class="menuList commonsScrollbarNew" >
  48. <div class="menuListMain" v-for="(item, index) of state.chapterTree" :key="index" >
  49. <div class="menuListpParent" >
  50. <div class="menuListpParentLeft">
  51. <div class="logoMenu" ></div>
  52. <!-- <div class="logoTime" ></div> -->
  53. <!-- <div class="logoNo" ></div> -->
  54. </div>
  55. <div class="menuListpParentCenter">{{ item.name }} {{ item.name }} {{ item.name }}</div>
  56. <div class="menuListpParentRight" v-if="item.children != null && item.children != undefined && item.children.length > 0" >
  57. +
  58. </div>
  59. </div>
  60. <div class="menuListpChildren"
  61. v-if="item.children?.length > 0" v-for="(item_1, index_1) of item.children" :key="index_1" >
  62. <div class="menuListpChildrenKong" ></div>
  63. <div class="menuListpChildrenLeft" >
  64. <!-- <div class="logoMenu" ></div>
  65. <div class="logoTime" ></div> -->
  66. <div class="logoNo" ></div>
  67. </div>
  68. <div class="menuListpChildrenRight">
  69. {{ item_1.name }} {{ item_1.name }}
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. <div :class="'menuLook ' + (menuLeftLook == true ? 'menuLookOpenEvent ' : 'menuLookExit menuLookExitEvent')"
  76. @click="(menuLeftLook = menuLeftLook == true ? false : true)" ></div>
  77. <div v-if="state.currentChapter.type != 30" class="chapter-detail">
  78. <div class="detail-title">{{ state.currentChapter.name }}</div>
  79. <div class="detail-cnt" v-html="htmlContent"></div>
  80. </div>
  81. <!-- <div v-else class="chapter-3d">
  82. <CourseChapter3d :config="state.chapterTree[state.currentStep]?.threeDimensionalConfig ?? ''"></CourseChapter3d>
  83. <CourseChapter3dView></CourseChapter3dView>
  84. </div> -->
  85. </div>
  86. <!-- 后台交互,显示,上一步下一步逻辑UI -->
  87. <StepTips
  88. v-if="
  89. stepTipsLook == true
  90. && (
  91. (
  92. courseChapter3dShow().show.showToastViewBool == false
  93. && courseChapter3dShow().show.showLinkOkNextBool == false
  94. )
  95. || (
  96. courseChapter3dShow().show.showToastViewBool == true
  97. && courseChapter3dShow().show.showToastState == ''
  98. && courseChapter3dShow().show.showLinkOkNextBool == false
  99. )
  100. )
  101. "
  102. :msg="state.tipsMsg"
  103. :btns="state.tipsBtns"
  104. :countdown="tipsCountdown"
  105. :key="state.tipsKey"
  106. ></StepTips>
  107. </div>
  108. <!-- 3d组件放在这里,让它可以隐藏起来,提前加载好场景。要不然后续切换3d场景每次要重新加载,比较麻烦 -->
  109. <!-- <div v-show="state.hasRead && state.showCnt && state.currentChapter.type == 30" class="chapter-3d"> -->
  110. <div v-if="courseChapter3dViewBool == true" class="chapter-3d">
  111. <div v-show="state.hasRead && state.showCnt && state.currentChapter.type == 30">
  112. <!-- 老版本的三维逻辑了,用不到了 -->
  113. <!-- <CourseChapter3d
  114. :config="state?.currentChapter ?? ''"
  115. :studentTaskIdList="studentTaskIdList"
  116. @tipsBtnsUpOpen="tipsBtnsUpOpenEvent"
  117. @tipsBtnsDownOpen="tipsBtnsDownOpenEvent"
  118. ></CourseChapter3d>
  119. <CourseChapter3dView
  120. @showOperationHelpExitEvent="showOperationHelpExitEvent"
  121. @carCameraScreenshot="carCameraScreenshotEvent"
  122. @carShutDown="carShutDownEvent"
  123. ></CourseChapter3dView> -->
  124. <QingXiCheAndQvMain :initTime="initTimeQingXiCarAndQv" :processUiOpen="(stepTipsLook == true ? false : true)"
  125. @callbackProgress="callbackProgressQingXiCheAndQv" ></QingXiCheAndQvMain>
  126. </div>
  127. </div>
  128. </div>
  129. </template>
  130. <script setup lang="ts">
  131. import { onMounted, reactive, computed, watch, onUnmounted, nextTick, ref } from 'vue';
  132. import NavMenus from '../components/navMenus.vue';
  133. import StepTips from '../components/stepTips.vue';
  134. import { useRoute } from 'vue-router';
  135. import { getCourseInfo, getCourseChapterTree, studyReport, getCurrentChapter, updateProgress } from '@/api/student/trainChapter';
  136. import { studentTaskOptionPipDefectListByStudentId } from '@/api/student/studentTaskOptionPipDefect';
  137. import CourseChapter3d from '@/components/student/CourseChapter3d.vue';
  138. import CourseChapter3dView from '@/components/student/courseChapter3d/view.vue';
  139. import QingXiCheAndQvMain from '@/components/ThreeWorldEventQingXiCheAndQv/QingXiCheAndQvMain.vue';
  140. import { getTrainDetail } from '@/api/student/trainList';
  141. import router from '@/router/index';
  142. import { courseChapter3dShow } from '@/stores/courseChapter3dShow.ts';
  143. import { threeWorld } from '@/stores/threeWorld.ts';
  144. import { uploadFileOss, getLiteMeta } from '../../../util/fileUtils';
  145. import { ElMessage, ElMessageBox, ElNotification } from 'element-plus';
  146. import { studentTaskPhoto } from '@/api/techer/taskStudentScore';
  147. import { ModelHtml5Audio } from "../../../components/student/event/ModelHtml5Audio.ts";
  148. const route = useRoute();
  149. const taskId = route.params.taskId as string;
  150. const studentTaskId = route.params.studentTaskId as string;
  151. const state: anyObj = reactive({
  152. hasRead: true,
  153. readingTime: 10,
  154. readHtml: '',
  155. showCnt: false,
  156. menuFold: false,
  157. menuListHeight: ``,
  158. tipsKey: 0,
  159. tipsMsg: '',
  160. tipsBtns: [],
  161. chapterTree: [],
  162. currentStep: 0,
  163. currentNode: 0,
  164. currentChapter: { type: 10 },
  165. activeSecondMenu: -1,
  166. lastChapterNum: -1,
  167. });
  168. // 控制左侧菜单是否展示
  169. let menuLeftLook = ref(true)
  170. // 播放声音
  171. let objAudio = new ModelHtml5Audio();
  172. let chapterQueue: Array<Array<anyObj>> = [];
  173. let maxChapterNum = 0;
  174. // 获取当前学生任务ID缺陷列表
  175. let studentTaskIdList: any = ref([]);
  176. // 用于控制3d场景什么时候加载显示
  177. let courseChapter3dViewBool = ref(false);
  178. /**
  179. * 因为引入了其他三维场景
  180. * 三维场景里,自带了上一步,下一步的逻辑UI
  181. * 所以控制,原先前端UI的 上一步,下一步的UI逻辑是否显示还是隐藏
  182. */
  183. let stepTipsLook = ref(true);
  184. // 控制清洗车回到第一个流程逻辑
  185. let initTimeQingXiCarAndQv = ref("0");
  186. const buildChapterQueue = (data: anyObj[], optionChapters: anyObj[], root = true): anyObj[] => {
  187. let chapters: anyObj[] = [];
  188. data?.forEach((item, idx) => {
  189. const children = item.children;
  190. //delete item.children;
  191. const opt = optionChapters.find((x) => x.chapterId == item.id);
  192. if (opt) item.durationStudyMin = opt.durationStudyMin;
  193. chapters.push(item);
  194. if (children && children.length > 0) {
  195. const childs = buildChapterQueue(children, optionChapters, false);
  196. chapters = chapters.concat(childs);
  197. }
  198. if (root) {
  199. chapterQueue[idx] = [...chapters];
  200. chapters = [];
  201. }
  202. });
  203. if (root) maxChapterNum = (chapterQueue.length - 1) * 100 + chapterQueue[chapterQueue.length - 1].length - 1;
  204. return chapters;
  205. };
  206. const menuSwitch = () => {
  207. state.menuFold = !state.menuFold;
  208. };
  209. const menuClick = (evt: Event, step: number, nodeId?: string) => {
  210. if ((evt.target as HTMLElement).classList.contains('el-step__title')) {
  211. let chapterNum = step * 100,
  212. node = 0;
  213. if (nodeId) {
  214. node = chapterQueue[step].findIndex((x) => x.id == nodeId);
  215. if (node > -1) chapterNum += node;
  216. }
  217. if (chapterNum <= state.lastChapterNum) {
  218. state.currentStep = step;
  219. state.currentNode = node;
  220. state.currentChapter = chapterQueue[step][node];
  221. } else {
  222. ElMessage({
  223. message: '该章节还未完成学习,请先按顺序完成学习!',
  224. type: 'warning',
  225. });
  226. }
  227. }
  228. evt.stopPropagation();
  229. };
  230. const hasReadClick = () => {
  231. state.hasRead = true;
  232. state.showCnt = true;
  233. setMenuListHeight();
  234. };
  235. const setMenuListHeight = () => {
  236. nextTick(() => {
  237. let height = document.querySelector('.menu-box')?.clientHeight ?? 0;
  238. if (height) state.menuListHeight = `calc(${height}px - 12rem)`;
  239. });
  240. };
  241. const countdown = (name: string, callback?: Function) => {
  242. if (state[name]) {
  243. const interval = setInterval(() => {
  244. state[name]--;
  245. if (state[name] == 0) {
  246. clearInterval(interval);
  247. if (callback) callback();
  248. }
  249. }, 1000);
  250. }
  251. };
  252. const tipsCountdown = computed(() => {
  253. let countdown = state.currentChapter.durationStudyMin ?? 0;
  254. const chapterNum = state.currentStep * 100 + state.currentNode;
  255. if (chapterNum <= state.lastChapterNum) countdown = 0;
  256. return countdown;
  257. });
  258. const htmlContent = computed(() => {
  259. if (state.currentChapter.type == 10) {
  260. return state.currentChapter.richText;
  261. } else if (state.currentChapter.type == 20) {
  262. return `<iframe src='${state.currentChapter.videoUrl}' width='100%' height='99%' scrolling='no' frameborder='0'><iframe>`;
  263. } else return '';
  264. });
  265. const prevStep = () => {
  266. if (state.currentNode == 0) {
  267. state.currentStep--;
  268. state.currentNode = chapterQueue[state.currentStep].length - 1;
  269. } else state.currentNode--;
  270. state.currentChapter = chapterQueue[state.currentStep][state.currentNode];
  271. };
  272. const nextStep = () => {
  273. updateStudyProgress();
  274. state.currentNode++;
  275. if (state.currentNode >= chapterQueue[state.currentStep].length) {
  276. state.currentStep++;
  277. state.currentNode = 0;
  278. }
  279. state.currentChapter = chapterQueue[state.currentStep][state.currentNode];
  280. };
  281. const completeStudy = () => {
  282. updateStudyProgress();
  283. router.push({ path: `/train/main/${taskId}` });
  284. };
  285. const updateStudyProgress = () => {
  286. //更新学习进度
  287. const num = state.currentStep * 100 + state.currentNode;
  288. if (num > state.lastChapterNum) {
  289. state.lastChapterNum = num;
  290. updateProgress(studentTaskId, state.currentChapter.id);
  291. }
  292. };
  293. const initTips = () => {
  294. state.tipsKey++;
  295. state.tipsMsg = state.currentChapter.tips;
  296. // 得到三维的参数
  297. let threeDimensionalConfig = state.currentChapter.threeDimensionalConfig;
  298. console.log("获取课程树 ---", state.chapterTree)
  299. console.log(
  300. "initTips ===> 每次进入不同流程后,进行处理的逻辑",
  301. state.tipsMsg, state.currentChapter, threeDimensionalConfig
  302. );
  303. // /**
  304. // * 因为加入了其他三维场景
  305. // * 他们有自带的上一步,下一步的UI控制
  306. // * 所以这里进行特殊处理
  307. // */
  308. // if (typeof threeDimensionalConfig == "string" && threeDimensionalConfig == "仿真模拟_清洗车") {
  309. // var thisTime = new Date().getTime();
  310. // initTimeQingXiCarAndQv.value = "" + thisTime;
  311. // // 此时进入三维场景,就默认进入到最后一个步骤
  312. // state.tipsBtns = [
  313. // {
  314. // name: '上一步',
  315. // click: prevStep,
  316. // attr: { type: 'primary', plain: 'plain' },
  317. // },
  318. // {
  319. // name: '完成并前往编制报告',
  320. // click: completeStudy,
  321. // attr: { type: 'primary' },
  322. // },
  323. // ];
  324. // // 同时先隐藏UI
  325. // stepTipsLook.value = false;
  326. // return;
  327. // }
  328. // 显示UI
  329. stepTipsLook.value = true;
  330. if (state.currentStep == 0 && state.currentNode == 0) {
  331. state.tipsBtns = [
  332. {
  333. name: '下一步',
  334. click: nextStep,
  335. attr: { type: 'primary' },
  336. },
  337. ];
  338. } else if (state.currentStep == chapterQueue.length - 1 && state.currentNode == chapterQueue[state.currentStep].length - 1) {
  339. state.tipsBtns = [
  340. {
  341. name: '上一步',
  342. click: prevStep,
  343. attr: { type: 'primary', plain: 'plain' },
  344. },
  345. {
  346. name: '完成并前往编制报告',
  347. click: completeStudy,
  348. attr: { type: 'primary' },
  349. },
  350. ];
  351. } else {
  352. state.tipsBtns = [
  353. {
  354. name: '上一步',
  355. click: prevStep,
  356. attr: { type: 'primary', plain: 'plain' },
  357. },
  358. {
  359. name: '下一步',
  360. click: nextStep,
  361. attr: { type: 'primary' },
  362. },
  363. ];
  364. }
  365. /**
  366. * 因为加入了其他三维场景
  367. * 他们有自带的上一步,下一步的UI控制
  368. * 所以这里进行特殊处理
  369. */
  370. if (typeof threeDimensionalConfig == "string" && threeDimensionalConfig == "仿真模拟_清洗车") {
  371. var thisTime = new Date().getTime();
  372. initTimeQingXiCarAndQv.value = "" + thisTime;
  373. // 隐藏 上一步,下一步 UI
  374. stepTipsLook.value = false;
  375. }
  376. };
  377. let studyInterval: NodeJS.Timeout;
  378. // 开场音乐
  379. let musicIndex = new URL("./../../../assets/music/index.mp3", import.meta.url).href;
  380. onMounted(() => {
  381. // // 第一次进来播放指定的声音基本上
  382. // objAudio.pause();
  383. // // 设置播放音乐的文件,或者地址
  384. // objAudio.setUrl(musicIndex);
  385. // // 不需要循环播放
  386. // objAudio.loopClose();
  387. // // 继续播放音乐
  388. // objAudio.start();
  389. threeWorld().loadSuccess = false;
  390. courseChapter3dViewBool.value = false;
  391. //学习时间上报
  392. studyInterval = setInterval(() => {
  393. const type = state.currentChapter.type != 30 ? 1 : 2;
  394. studyReport(studentTaskId, type);
  395. }, 1000 * 100);
  396. //获取任务信息
  397. getTrainDetail(taskId).then((res) => {
  398. //获取课程信息
  399. getCourseInfo(res.data.data.courseId).then((res1) => {
  400. if (res1.data.data.description) {
  401. state.hasRead = false;
  402. state.readHtml = res1.data.data.description;
  403. countdown('readingTime');
  404. } else {
  405. state.hasRead = true;
  406. state.showCnt = true;
  407. setMenuListHeight();
  408. }
  409. window.addEventListener('resize', () => {
  410. setMenuListHeight();
  411. });
  412. });
  413. //获取课程树
  414. getCourseChapterTree(res.data.data.courseId).then((res2) => {
  415. state.chapterTree = res2.data.data;
  416. buildChapterQueue(res2.data.data, res.data.data.optionChapters);
  417. //需先根据学习进度确定开始章节:currentStep和currentNode,默认第一章第一节
  418. //获取学习到的章节
  419. getCurrentChapter(studentTaskId).then((res3) => {
  420. const chapterId = res3.data.data;
  421. if (chapterId) {
  422. for (let i = 0; i < chapterQueue.length; i++) {
  423. const idx = chapterQueue[i].findIndex((x) => x.id == chapterId);
  424. if (idx > -1) {
  425. state.currentStep = i;
  426. state.currentNode = idx;
  427. break;
  428. }
  429. }
  430. state.lastChapterNum = state.currentStep * 100 + state.currentNode;
  431. }
  432. state.currentChapter = chapterQueue[state.currentStep][state.currentNode];
  433. initTips();
  434. });
  435. });
  436. // 根据学生id任务获取缺陷数据
  437. studentTaskOptionPipDefectListByStudentId(studentTaskId)
  438. .then((studentTaskOptionPipDefectListByStudentIdRes) => {
  439. studentTaskIdList.value = studentTaskOptionPipDefectListByStudentIdRes?.data?.data;
  440. courseChapter3dViewBool.value = true;
  441. // console.log(
  442. // "根据学生id任务获取缺陷数据",
  443. // studentTaskIdList.value,
  444. // studentTaskId
  445. // );
  446. })
  447. .catch((error) => {
  448. courseChapter3dViewBool.value = true;
  449. });
  450. });
  451. });
  452. onUnmounted(() => {
  453. if (studyInterval) clearInterval(studyInterval);
  454. });
  455. watch(
  456. () => state.currentChapter,
  457. (newVal) => {
  458. initTips();
  459. //滚动当前课程菜单至可视区域
  460. nextTick(() => {
  461. const target = document.querySelector('.el-step__description .is-process') as HTMLElement;
  462. target?.scrollIntoView({ behavior: 'smooth', block: 'center' });
  463. });
  464. //课程菜单默认显示二级,兼容课程树层级大于二级的情况
  465. if (state.currentNode == 0) state.activeSecondMenu = -1;
  466. else {
  467. const idx = (state.chapterTree[state.currentStep].children as anyObj[])?.findIndex((x) => x.id == newVal.id);
  468. if (idx > -1) state.activeSecondMenu = idx;
  469. }
  470. }
  471. );
  472. /**
  473. * 检测实训注意事项 知道了点击回调
  474. */
  475. courseChapter3dShow().show.showMatterGotItCallback = function () {
  476. // console.log(
  477. // "检测实训注意事项 知道了点击回调", res
  478. // );
  479. // 触发下一步逻辑
  480. nextStep();
  481. };
  482. /**
  483. * 监听弹出提示隐藏后来触发不同的逻辑
  484. */
  485. watch(
  486. () => courseChapter3dShow().show.showToastViewBool,
  487. (newVal, oldVal) => {
  488. if (courseChapter3dShow().show.showToastViewBool == true) {
  489. return;
  490. }
  491. // console.log(
  492. // " () => courseChapter3dShow().show.showToastState 1111111111 ",
  493. // courseChapter3dShow().show.showToastState
  494. // );
  495. switch (courseChapter3dShow().show.showToastState) {
  496. case '立即穿戴':
  497. // // 触发下一步逻辑
  498. // nextStep();
  499. break;
  500. }
  501. }
  502. );
  503. // 记录 tipsBtnsUpOpenEvent 事件是否显示上一步按钮
  504. let tipsBtnsUpOpenEventBool: Boolean = true;
  505. /**
  506. * 上一步是否显示
  507. * open true - 显示, false - 隐藏
  508. */
  509. const tipsBtnsUpOpenEvent = (open: Boolean) => {
  510. // console.log("上一步是否显示", open);
  511. tipsBtnsUpOpenEventBool = open;
  512. tipsBtnsUpAndDownOpenEvent();
  513. };
  514. // 记录 tipsBtnsUpOpenEvent 事件是否显示下一步按钮
  515. let tipsBtnsDownOpenEventBool: Boolean = true;
  516. /**
  517. * 下一步是否显示
  518. * open true - 显示, false - 隐藏
  519. */
  520. const tipsBtnsDownOpenEvent = (open: Boolean) => {
  521. // console.log("下一步是否显示", open);
  522. tipsBtnsDownOpenEventBool = open;
  523. tipsBtnsUpAndDownOpenEvent();
  524. };
  525. /**
  526. * 通过3d传来的事件来控制上一步下一步是否显示逻辑
  527. */
  528. const tipsBtnsUpAndDownOpenEvent = () => {
  529. let newArray = [];
  530. if (tipsBtnsUpOpenEventBool == true) {
  531. // newArray.push({
  532. // name: '上一步',
  533. // click: prevStep,
  534. // attr: { type: 'primary', plain: 'plain' },
  535. // });
  536. }
  537. if (tipsBtnsDownOpenEventBool == true) {
  538. newArray.push({
  539. name: '下一步',
  540. click: nextStep,
  541. attr: { type: 'primary' },
  542. });
  543. }
  544. // console.log(
  545. // " ========= state.tipsBtns ========= ",
  546. // state.tipsBtns
  547. // );
  548. // 如果出现 完成并前往编制报告 则不替换
  549. try {
  550. for (let i = 0; i < state.tipsBtns.length; i++) {
  551. let thisTipsBtns = state.tipsBtns[i];
  552. if (thisTipsBtns.name.indexOf('完成') >= 0) {
  553. return;
  554. }
  555. }
  556. } catch (e) {}
  557. state.tipsBtns = newArray;
  558. };
  559. // 操作帮助点击退出
  560. const showOperationHelpExitEvent = () => {
  561. // 触发下一步逻辑
  562. nextStep();
  563. };
  564. /**
  565. * 车的完成下井实验
  566. */
  567. const carShutDownEvent = () => {
  568. // 触发下一步逻辑
  569. nextStep();
  570. };
  571. /**
  572. * 车的相机截图
  573. * img base64位图片
  574. */
  575. const carCameraScreenshotEvent = (img: any) => {
  576. // console.log(
  577. // "车的相机截图", img
  578. // );
  579. // 将 base64为转换成,Blob格式
  580. let objBlob = dataURLtoBlob(img);
  581. // blob 转换成 file对象
  582. const file = new File([objBlob], 'example.png', { type: 'text/plain' });
  583. // 优先上传文件
  584. // @ts-ignore
  585. uploadFileOss(file, 'course/cover', null)
  586. .then(function (e: any) {
  587. // console.log(
  588. // "上传文件", e
  589. // );
  590. studentTaskPhoto({
  591. studentTaskId: studentTaskId,
  592. imageUrl: e,
  593. remark: '',
  594. })
  595. .then(function (studentTaskPhotoRes: any) {
  596. // console.log(
  597. // "上传文件成功", studentTaskPhotoRes
  598. // );
  599. // ElMessage({
  600. // message: '截图上传完成',
  601. // type: 'success',
  602. // });
  603. courseChapter3dShow().show.showToastViewBool = false;
  604. courseChapter3dShow().show.showPromptEvent('截图上传完成', null, function (res: any) {
  605. // console.log("yes", res);
  606. });
  607. })
  608. .catch(function (studentTaskPhotoResError: any) {
  609. // ElMessage({
  610. // message: '上传失败',
  611. // type: 'warning',
  612. // });
  613. courseChapter3dShow().show.showToastViewBool = false;
  614. courseChapter3dShow().show.showPromptEvent('上传失败', null, function (res: any) {
  615. // console.log("yes", res);
  616. });
  617. });
  618. })
  619. .catch(function (e: any) {
  620. // ElMessage({
  621. // message: e || '上传失败',
  622. // type: 'warning',
  623. // });
  624. courseChapter3dShow().show.showToastViewBool = false;
  625. courseChapter3dShow().show.showPromptEvent('上传失败', null, function (res: any) {
  626. // console.log("yes", res);
  627. });
  628. });
  629. };
  630. /**
  631. * 将base64转换为blob
  632. * @param dataurl base64位图片
  633. */
  634. const dataURLtoBlob = (dataurl: any) => {
  635. let arr = dataurl.split(','),
  636. mime = arr[0].match(/:(.*?);/)[1],
  637. bstr = atob(arr[1]),
  638. n = bstr.length,
  639. u8arr = new Uint8Array(n);
  640. while (n--) {
  641. u8arr[n] = bstr.charCodeAt(n);
  642. }
  643. return new Blob([u8arr], { type: mime });
  644. };
  645. /**
  646. * 清洗车自定义回调步骤
  647. */
  648. const callbackProgressQingXiCheAndQv = (json : any) => {
  649. console.log("callbackProgressQingXiCheAndQv ===>", json);
  650. // 完成所有步骤
  651. if (json.name == "equipmentRepositioningWork") {
  652. stepTipsLook.value = true;
  653. }
  654. }
  655. </script>
  656. <style lang="scss" scoped>
  657. @use './css/animationEvent.scss';
  658. @use './css/commonsScrollbarNew.scss';
  659. .chapter-container {
  660. position: absolute;
  661. width: 100%;
  662. height: 100%;
  663. display: flex;
  664. justify-content: center;
  665. align-items: center;
  666. z-index: 1;
  667. .chapter-describe {
  668. position: relative;
  669. width: 70%;
  670. height: 90%;
  671. background-image: url(/src/assets/student/bg_describe.png);
  672. background-size: 100% 100%;
  673. &:before {
  674. content: '';
  675. position: absolute;
  676. top: 3%;
  677. left: 28%;
  678. height: 6%;
  679. width: 70%;
  680. background-image: url(/src/assets/student/training.png);
  681. background-size: auto 100%;
  682. background-repeat: no-repeat;
  683. }
  684. .describe-cnt {
  685. overflow: auto;
  686. box-sizing: border-box;
  687. position: absolute;
  688. inset: 10rem 0 10rem 6rem;
  689. padding-right: 4rem;
  690. }
  691. .describe-readed {
  692. position: absolute;
  693. bottom: 3rem;
  694. width: 100%;
  695. display: flex;
  696. justify-content: center;
  697. .readed-btn {
  698. width: 20rem;
  699. height: 5.4rem;
  700. line-height: 5.4rem;
  701. text-align: center;
  702. color: white;
  703. font-size: 2rem;
  704. border-radius: 0.8rem;
  705. background: linear-gradient(90deg, #6cd9e9 0%, #4b90dd 100%);
  706. cursor: pointer;
  707. &.reading {
  708. pointer-events: none;
  709. }
  710. }
  711. }
  712. }
  713. .chapter-box {
  714. width: 100%;
  715. height: 100%;
  716. }
  717. .chapter-content {
  718. position: absolute;
  719. width: 100%;
  720. height: 100%;
  721. .menu-box {
  722. position: absolute;
  723. top: 3.2rem;
  724. left: 2rem;
  725. width: 20rem;
  726. height: calc(100% - 18rem);
  727. transition-property: left;
  728. transition-duration: 0.6s;
  729. z-index: 2;
  730. &.fold {
  731. left: -20rem;
  732. .menu-switch {
  733. background-image: url(/src/assets/student/training/menu_switch1.png);
  734. }
  735. }
  736. .menu-switch {
  737. position: absolute;
  738. width: 2rem;
  739. height: 5rem;
  740. background-image: url(/src/assets/student/training/menu_switch.png);
  741. background-size: 100% 100%;
  742. right: -2rem;
  743. top: 50%;
  744. margin-top: -2.5rem;
  745. cursor: pointer;
  746. }
  747. .menu-title {
  748. height: 5rem;
  749. background-image: url(/src/assets/student/training/menu_title.png);
  750. background-size: 100% 100%;
  751. color: white;
  752. // font-size: 2rem;
  753. font-size: 1.8rem;
  754. overflow: hidden;
  755. &:before {
  756. content: '';
  757. display: inline-block;
  758. vertical-align: middle;
  759. height: 5rem;
  760. width: 8rem;
  761. background-image: url(/src/assets/student/training/menu_icon.png);
  762. background-size: auto 50%;
  763. background-repeat: no-repeat;
  764. background-position: center center;
  765. }
  766. }
  767. .menu-list {
  768. position: relative;
  769. min-height: 20rem;
  770. max-height: calc(100% - 6rem);
  771. margin-top: 1rem;
  772. padding: 3rem 0 3rem 2rem;
  773. background-image: url(/src/assets/student/training/menu_list.png);
  774. background-size: 100% 100%;
  775. box-sizing: border-box;
  776. --step-item-size: 2rem;
  777. --step-icon-size: 1.2rem;
  778. --step-line-left: 0.9rem;
  779. --step-border-width: 0.2rem;
  780. .step-icon {
  781. width: var(--step-item-size);
  782. height: var(--step-item-size);
  783. border-radius: 50%;
  784. border: var(--step-border-width) solid #5faaf4;
  785. box-sizing: border-box;
  786. transition: 0.15s ease-out;
  787. display: flex;
  788. justify-content: center;
  789. align-items: center;
  790. .step-icon-inner {
  791. width: var(--step-icon-size);
  792. height: var(--step-icon-size);
  793. background-size: 100% 100%;
  794. }
  795. }
  796. :deep(.el-step__head) {
  797. width: var(--step-item-size);
  798. .el-step__line {
  799. width: var(--step-border-width);
  800. top: var(--step-item-size);
  801. left: var(--step-line-left);
  802. background-color: #5faaf4;
  803. }
  804. .el-step__icon {
  805. width: unset;
  806. height: unset;
  807. background: transparent;
  808. display: flex;
  809. }
  810. &.is-process .step-icon-inner {
  811. background-image: url(/src/assets/student/training/step_process.png);
  812. }
  813. &.is-finish .step-icon-inner {
  814. background-image: url(/src/assets/student/training/step_finish.png);
  815. }
  816. }
  817. :deep(.el-step__main) {
  818. padding-left: 2rem;
  819. padding-right: 2rem;
  820. .el-step__title {
  821. // font-size: var(--step-item-size);
  822. font-size: 1.5rem;
  823. color: white;
  824. font-weight: unset;
  825. line-height: var(--step-item-size);
  826. cursor: pointer;
  827. &.is-process,
  828. &.is-finish {
  829. text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.2);
  830. background: linear-gradient(180deg, #82ccdd 0%, #589cf2 100%);
  831. background-clip: text;
  832. -webkit-background-clip: text;
  833. -webkit-text-fill-color: transparent;
  834. }
  835. }
  836. .el-step__description {
  837. margin-left: -1.1rem;
  838. // --step-item-size: 0.9rem;
  839. --step-item-size: 1.1rem;
  840. --step-icon-size: 0.6rem;
  841. .el-steps {
  842. margin: 0.8rem 0;
  843. }
  844. .el-step__head {
  845. width: var(--step-icon-size);
  846. &.is-process .step-icon-second {
  847. background-color: #5ff49b;
  848. }
  849. &.is-finish .step-icon-second {
  850. background-color: #5fa9f4;
  851. }
  852. }
  853. .el-step__icon {
  854. height: var(--step-item-size);
  855. line-height: var(--step-item-size);
  856. }
  857. .step-icon-second {
  858. width: var(--step-icon-size);
  859. height: var(--step-icon-size);
  860. border-radius: 50%;
  861. box-sizing: border-box;
  862. background-color: #ccc;
  863. }
  864. .el-step__line {
  865. width: 0.1rem;
  866. left: 0.25rem;
  867. top: 0.6rem;
  868. bottom: -0.4rem;
  869. margin-bottom: unset !important;
  870. &:after {
  871. display: none;
  872. }
  873. }
  874. .el-step:last-of-type .el-step__line {
  875. display: none;
  876. }
  877. .el-step__main {
  878. padding-left: 0.6rem;
  879. }
  880. .el-step__title {
  881. font-size: var(--step-item-size);
  882. &.is-process {
  883. color: #5ff49b;
  884. -webkit-text-fill-color: unset;
  885. }
  886. &.is-finish {
  887. color: #5fa9f4;
  888. -webkit-text-fill-color: unset;
  889. }
  890. }
  891. }
  892. }
  893. :deep(.el-step:last-of-type) {
  894. .el-step__line {
  895. display: block;
  896. margin-bottom: 1rem;
  897. &:after {
  898. content: '';
  899. position: absolute;
  900. border: 0.8rem solid transparent;
  901. border-top-color: #5faaf4;
  902. bottom: -1rem;
  903. left: -0.7rem;
  904. }
  905. .el-step__line-inner {
  906. transition-delay: 150ms;
  907. border-width: 0px;
  908. height: 0%;
  909. }
  910. }
  911. }
  912. }
  913. }
  914. .chapter-detail {
  915. position: absolute;
  916. top: 3.2rem;
  917. left: 28rem;
  918. width: 88rem;
  919. height: 56rem;
  920. max-height: calc(100% - 12rem);
  921. background-image: url(/src/assets/student/training/window_bg.png);
  922. background-size: 100% 100%;
  923. .detail-title {
  924. height: 18%;
  925. font-size: 3rem;
  926. text-align: center;
  927. color: white;
  928. display: flex;
  929. justify-content: center;
  930. align-items: center;
  931. }
  932. .detail-cnt {
  933. height: 76%;
  934. padding: 0 5rem;
  935. box-sizing: border-box;
  936. overflow: auto;
  937. :deep(img) {
  938. max-width: 100%;
  939. }
  940. }
  941. }
  942. // 左侧菜单
  943. .menuLeft {
  944. position: fixed;
  945. top: 10.92rem;
  946. bottom: 18rem;
  947. left: 2.28rem;
  948. width: 21.64rem;
  949. z-index: 2;
  950. .menuTitle {
  951. position: absolute;
  952. width: 100%;
  953. top: 0px;
  954. left: 0px;
  955. height: 5.71rem;
  956. background-image: url(/src/assets/menuLeft/title.webp);
  957. background-size: 100% 100%;
  958. .logoLeft, .txtRight {
  959. position: absolute;
  960. }
  961. .logoLeft {
  962. width: 2.28rem;
  963. height: 2.92rem;
  964. background-image: url(/src/assets/menuLeft/gps.webp);
  965. background-size: 100% 100%;
  966. top: 1.6rem;
  967. left: 2.07rem;
  968. }
  969. .txtRight {
  970. top: 0px;
  971. height: 5.71rem;
  972. line-height: 5.71rem;
  973. left: 5.64rem;
  974. right: 3rem;
  975. font-weight: 400;
  976. font-size: 2.5rem;
  977. color: #FFFFFF;
  978. white-space: nowrap; /* 不换行 */
  979. overflow: hidden; /* 隐藏超出部分 */
  980. text-overflow: ellipsis; /* 显示省略号 */
  981. }
  982. }
  983. .menuList {
  984. position: absolute;
  985. width: 100%;
  986. top: 7rem;
  987. bottom: 0px;
  988. background-image: url(/src/assets/menuLeft/menuBottom.webp);
  989. background-size: 100% 100%;
  990. padding: 1rem 0.5rem 1rem 0.5rem;
  991. .menuListMain {
  992. position: relative;
  993. width: 100%;
  994. height: auto;
  995. .menuListpParent, .menuListpChildren {
  996. position: relative;
  997. width: 90%;
  998. left: 5%;
  999. margin: 0.35rem 0rem 0.35rem 0rem;
  1000. padding: 0.35rem 0rem 0.35rem 0rem;
  1001. // 手势
  1002. cursor:pointer;
  1003. }
  1004. .logoMenu {
  1005. width: 1rem;
  1006. height: 1rem;
  1007. background-image: url(/src/assets/menuLeft/yes.webp);
  1008. background-size: 100% 100%;
  1009. }
  1010. .logoTime {
  1011. width: 1rem;
  1012. height: 1rem;
  1013. background-image: url(/src/assets/menuLeft/time.webp);
  1014. background-size: 100% 100%;
  1015. }
  1016. .logoNo {
  1017. width: 1rem;
  1018. height: 1rem;
  1019. background-image: url(/src/assets/menuLeft/no.webp);
  1020. background-size: 100% 100%;
  1021. }
  1022. .menuListpParent {
  1023. font-weight: 400;
  1024. font-size: 1.28rem;
  1025. color: #C8C8C8;
  1026. background: #386064;
  1027. height: 2.5rem;
  1028. .menuListpParentLeft, .menuListpParentCenter, .menuListpParentRight {
  1029. position: absolute;
  1030. height: 100%;
  1031. top: 0px;
  1032. }
  1033. .menuListpParentLeft {
  1034. left: 0px;
  1035. width: 2.5rem;
  1036. /* 水平垂直居中,支持文字自动换行 */
  1037. display: flex;
  1038. flex-direction: column;
  1039. justify-content: center;
  1040. align-items: center;
  1041. }
  1042. .menuListpParentCenter {
  1043. left: 2.5rem;
  1044. right: 2.5rem;
  1045. line-height: 2.5rem;
  1046. white-space: nowrap; /* 不换行 */
  1047. overflow: hidden; /* 隐藏超出部分 */
  1048. text-overflow: ellipsis; /* 显示省略号 */
  1049. }
  1050. .menuListpParentRight {
  1051. width: 2.5rem;
  1052. right: 0px;
  1053. background: #2BA987;
  1054. color: #FFFFFF;
  1055. font-size: 2rem;
  1056. /* 水平垂直居中,支持文字自动换行 */
  1057. display: flex;
  1058. flex-direction: column;
  1059. justify-content: center;
  1060. align-items: center;
  1061. }
  1062. }
  1063. .menuListpParentYes {
  1064. color: #ffffff;
  1065. }
  1066. .menuListpParentSelect {
  1067. color: #ffffff;
  1068. }
  1069. .menuListpChildren {
  1070. font-weight: 400;
  1071. font-size: 1.14rem;
  1072. color: #C8C8C8;
  1073. .menuListpChildrenKong, .menuListpChildrenLeft, .menuListpChildrenRight {
  1074. display: inline-flex;
  1075. }
  1076. .menuListpChildrenKong {
  1077. width: 1%;
  1078. }
  1079. .menuListpChildrenLeft {
  1080. width: 16%;
  1081. /* 水平垂直居中,支持文字自动换行 */
  1082. flex-direction: column;
  1083. justify-content: center;
  1084. align-items: center;
  1085. }
  1086. .menuListpChildrenRight {
  1087. width: 83%;
  1088. }
  1089. }
  1090. .menuListpChildrenYes {
  1091. color: #2CD36B;
  1092. }
  1093. .menuListpChildrenSelect {
  1094. color: #FFFFFF;
  1095. background: linear-gradient( 90deg, rgba(39,171,151,0.6) 0%, rgba(39,171,151,0.2) 100%);
  1096. }
  1097. }
  1098. }
  1099. }
  1100. .menuLook {
  1101. position: fixed;
  1102. width: 2rem;
  1103. height: 5.71rem;
  1104. left: 23.5rem;
  1105. top: 50%;
  1106. margin: -2.855rem 0px 0px 0px;
  1107. z-index: 2;
  1108. background-image: url(/src/assets/menuLeft/menuOpen.webp);
  1109. background-size: 100% 100%;
  1110. // 手势
  1111. cursor:pointer;
  1112. }
  1113. .menuLookExit {
  1114. background-image: url(/src/assets/menuLeft/menuExit.webp);
  1115. background-size: 100% 100%;
  1116. }
  1117. }
  1118. }
  1119. </style>