index.tsx 67 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085
  1. import {
  2. defineComponent,
  3. onMounted,
  4. reactive,
  5. onUnmounted,
  6. ref,
  7. Transition,
  8. computed,
  9. nextTick,
  10. watch
  11. } from 'vue';
  12. import styles from './index.module.less';
  13. import 'plyr/dist/plyr.css';
  14. import MusicScore from './component/musicScore';
  15. // import iconChange from './image/icon-change.png';
  16. // import iconMenu from './image/icon-menu.png';
  17. // import iconUp from './image/icon-up.png';
  18. // import iconDown from './image/icon-down.png';
  19. // import iconNote from './image/icon-note.png';
  20. // import iconWhiteboard from './image/icon-whiteboard.png';
  21. // import iconAssignHomework from './image/icon-assignHomework.png';
  22. // import iconClose from './image/icon-close.png';
  23. // import iconOverPreivew from './image/icon-over-preview.png';
  24. import { Vue3Lottie } from 'vue3-lottie';
  25. import playLoadData from './datas/data.json';
  26. // import Moveable from 'moveable';
  27. import VideoPlay from './component/video-play';
  28. import {
  29. useMessage,
  30. NDrawer,
  31. NDrawerContent,
  32. NModal,
  33. NSpace,
  34. NButton,
  35. NCollapse,
  36. NCollapseItem,
  37. NTooltip
  38. } from 'naive-ui';
  39. import CardType from '@/components/card-type';
  40. import Pen from './component/tools/pen';
  41. import AudioPay from './component/audio-pay';
  42. import TrainSettings from './model/train-settings';
  43. import { useRoute } from 'vue-router';
  44. import {
  45. api_teacherChapterLessonCoursewareDetail,
  46. courseScheduleUpdate,
  47. lessonCoursewareDetail,
  48. lessonPreTrainingPage,
  49. queryCourseware
  50. } from '../prepare-lessons/api';
  51. import { vaildUrl } from '/src/utils/urlUtils';
  52. import TimerMeter from '/src/components/timerMeter';
  53. import { iframeDislableKeyboard, px2vw } from '/src/utils';
  54. import PlaceholderTone from '/src/components/layout/modals/placeholderTone';
  55. import { state as globalState } from '/src/state';
  56. import Chapter from './model/chapter';
  57. import { useRouter } from 'vue-router';
  58. import { useUserStore } from '@/store/modules/users';
  59. import iconNote from './new-image/icon-note.png';
  60. import iconWhite from './new-image/icon-white.png';
  61. import rightIconEnd from './image/right_icon1.png';
  62. import rightIconArrange from './image/right_icon2.png';
  63. import rightIconPostil from './image/right_icon3.png';
  64. import rightIconWhiteboard from './image/right_icon4.png';
  65. import rightIconMetronome from './image/right_icon5.png';
  66. import rightIconTuner from './image/right_icon6.png';
  67. import rightIconTimer from './image/right_icon7.png';
  68. import rightIconCall from './image/right_icon10.png';
  69. import rightIconPackUp from './image/right_icon8.png';
  70. import rightIconMusic from './image/right_icon9.png';
  71. import bottomIconSwitch from './image/bottom_icon1.png';
  72. import bottomIconResource from './image/bottom_icon2.png';
  73. import bottomIconPre from './image/bottom_icon3.png';
  74. import bottomIconNext from './image/bottom_icon4.png';
  75. import rightHideIcon from './image/right_hide_icon.png';
  76. import SelectResources from '../prepare-lessons/model/select-resources';
  77. import { getStudentAfterWork, getStudentList } from '../studentList/api';
  78. import TheNoticeBar from '/src/components/TheNoticeBar';
  79. import ClassWork from './model/class-work';
  80. import SelectClass from './model/select-class';
  81. import SourceList from './model/source-list';
  82. import RhythmModal from './component/rhythm-modal';
  83. import InstruemntDetail from '/src/views/prepare-lessons/model/source-instrument/detail';
  84. import TheotyDetail from '/src/views/prepare-lessons/model/source-knowledge/detail';
  85. import MusicDetail from '/src/views/prepare-lessons/model/source-music/detail';
  86. import ListenModal from '/src/components/card-preview/listen-modal';
  87. import Train from '../prepare-lessons/components/lesson-main/train';
  88. import ResourceMain from '../prepare-lessons/components/resource-main';
  89. import { useResizeObserver } from '@vueuse/core';
  90. import { storage } from '/src/utils/storage';
  91. import { ACCESS_TOKEN_ADMIN } from '/src/store/mutation-types';
  92. export type ToolType = 'init' | 'pen' | 'whiteboard' | 'call';
  93. export type ToolItem = {
  94. type: ToolType;
  95. name: string;
  96. icon: string;
  97. };
  98. export default defineComponent({
  99. name: 'CoursewarePlay',
  100. props: {
  101. type: {
  102. type: String,
  103. default: ''
  104. },
  105. courseId: {
  106. type: String,
  107. default: ''
  108. },
  109. subjectId: {
  110. type: [String, Number],
  111. default: ''
  112. },
  113. // 教材编号
  114. lessonCourseId: {
  115. type: [String, Number],
  116. default: ''
  117. },
  118. detailId: {
  119. type: String,
  120. default: ''
  121. },
  122. // 班级编号
  123. classGroupId: {
  124. type: String,
  125. default: ''
  126. },
  127. // 上课记录编号
  128. classId: {
  129. type: String,
  130. defaault: ''
  131. },
  132. preStudentNum: {
  133. type: [String, Number],
  134. default: ''
  135. }
  136. },
  137. emits: ['close'],
  138. setup(props, { emit }) {
  139. const message = useMessage();
  140. const route = useRoute();
  141. const router = useRouter();
  142. const users = useUserStore();
  143. /** 设置播放容器 16:9 */
  144. const parentContainer = reactive({
  145. width: '100vw'
  146. });
  147. // const NPopoverRef = ref();
  148. // const setContainer = () => {
  149. // const min = Math.min(screen.width, screen.height);
  150. // const max = Math.max(screen.width, screen.height);
  151. // const width = min * (16 / 9);
  152. // if (width > max) {
  153. // parentContainer.width = '100vw';
  154. // return;
  155. // } else {
  156. // parentContainer.width = width + 'px';
  157. // }
  158. // };
  159. const handleInit = (type = 0) => {
  160. //设置容器16:9
  161. // setContainer();
  162. };
  163. handleInit();
  164. onUnmounted(() => {
  165. handleInit(1);
  166. });
  167. const data = reactive({
  168. type: 'class' as '' | 'preview' | 'class', // 预览类型
  169. courseId: '' as any, // 课件编号
  170. subjectId: '' as any, // 声部编号
  171. lessonCourseId: '' as any, // 教材编号
  172. lessonCoursewareDetailId: '' as any, // 章节
  173. lessonCoursewareSubjectList: [] as any, // 教材上的声部
  174. detailId: '' as any, // 编号 - 课程编号
  175. classGroupId: '' as any, // 上课时需要 班级编号
  176. classId: '' as any, // 上课编号
  177. preStudentNum: '' as any, // 班上学生
  178. // detail: null,
  179. knowledgePointList: [] as any,
  180. itemList: [] as any,
  181. // showHead: true,
  182. // isCourse: false,
  183. // isRecordPlay: false,
  184. videoRefs: {} as any[],
  185. audioRefs: {} as any[],
  186. modelAttendStatus: false, // 布置作业提示弹窗
  187. modalAttendMessage: '本节课未设置课后作业,是否继续?',
  188. modelTrainStatus: false, // 训练设置
  189. selectClassStatus: false, // 选择课件
  190. homeworkStatus: true, // 布置作业完成时
  191. removeVisiable: false,
  192. removeTitle: '',
  193. removeContent: '',
  194. removeCourseStatus: false, // 是否布置作业
  195. teacherChapterName: '',
  196. lessonPreTrainingId: null,
  197. selectResourceStatus: false,
  198. videoState: 'init' as 'init' | 'play',
  199. videoItemRef: null as any,
  200. animationState: 'start' as 'start' | 'end'
  201. });
  202. const activeData = reactive({
  203. isAutoPlay: false, // 是否自动播放
  204. nowTime: 0,
  205. model: true, // 遮罩
  206. isAnimation: true, // 是否动画
  207. // videoBtns: true, // 视频
  208. // currentTime: 0,
  209. // duration: 0,
  210. timer: null as any,
  211. item: null as any
  212. });
  213. // 键盘事件监听状态
  214. const listenerKeyUpState = ref(false);
  215. const getDetail = async () => {
  216. try {
  217. const res = await api_teacherChapterLessonCoursewareDetail(
  218. data.courseId
  219. );
  220. data.teacherChapterName = res.data.name || '';
  221. // 布置的作业编号
  222. data.lessonPreTrainingId = res.data.lessonPreTrainingId;
  223. // activeData.isAutoPlay = res.data.autoPlay || false; // 自动播放
  224. const tempRows = res.data.chapterKnowledgeList || [];
  225. const temp: any = [];
  226. const allItem: any = [];
  227. tempRows.forEach((row: any, index: number) => {
  228. if (!Array.isArray(row.chapterKnowledgeMaterialList)) {
  229. return;
  230. }
  231. const childList: any[] = [];
  232. row.chapterKnowledgeMaterialList.forEach((child: any) => {
  233. if (!child.removeFlag) {
  234. childList.push({
  235. id: child.id,
  236. materialId: child.bizId,
  237. coverImg: child.bizInfo.coverImg,
  238. type: child.type,
  239. title: child.bizInfo.name,
  240. dataJson: child.dataJson,
  241. isCollect: !!child.favoriteFlag,
  242. isSelected: child.source === 'PLATFORM' ? true : false,
  243. content: child.bizInfo.content,
  244. parentIndex: index
  245. });
  246. }
  247. });
  248. temp.push({
  249. title: row.name,
  250. list: childList
  251. });
  252. allItem.push(...childList);
  253. });
  254. data.knowledgePointList = temp;
  255. data.itemList = allItem?.map((m: any) => {
  256. return {
  257. ...m,
  258. iframeRef: null,
  259. videoEle: null,
  260. audioEle: null,
  261. autoPlay: res.data.autoPlay || false, //加载完成是否自动播放
  262. isprepare: false, // 视频是否加载完成
  263. isRender: false // 是否渲染了
  264. };
  265. });
  266. setTimeout(() => {
  267. data.animationState = 'end';
  268. }, 500);
  269. } catch (e) {
  270. //
  271. console.log(e);
  272. }
  273. };
  274. const showModalBeat = ref(false);
  275. const showModalTone = ref(false);
  276. const showModalTime = ref(false);
  277. // ifram事件处理
  278. const iframeHandle = (ev: MessageEvent) => {
  279. // console.log(ev.data?.api, ev.data, 'ev.data');
  280. if (ev.data?.api === 'headerTogge') {
  281. activeData.model =
  282. ev.data.show || (ev.data.playState == 'play' ? false : true);
  283. }
  284. //
  285. if (ev.data?.api === 'onAttendToggleMenu') {
  286. activeData.model = !activeData.model;
  287. }
  288. if (ev.data?.api === 'api_fingerPreView') {
  289. clearInterval(activeData.timer);
  290. activeData.model = !ev.data.state;
  291. }
  292. //
  293. if (ev.data?.api === 'documentBodyKeyup') {
  294. if (ev.data?.code === 'ArrowLeft') {
  295. setModalOpen();
  296. handlePreAndNext('up');
  297. }
  298. if (ev.data?.code === 'ArrowRight') {
  299. setModalOpen();
  300. handlePreAndNext('down');
  301. }
  302. }
  303. // 点名返回
  304. if (ev.data?.api === 'callBack') {
  305. closeStudyTool();
  306. }
  307. if (ev.data?.api === 'onLogin') {
  308. const documentDom: any = document;
  309. documentDom.exitFullscreen
  310. ? documentDom.exitFullscreen()
  311. : documentDom.mozCancelFullScreen
  312. ? documentDom.mozCancelFullScreen()
  313. : documentDom.webkitExitFullscreen
  314. ? documentDom.webkitExitFullscreen()
  315. : '';
  316. users.logout();
  317. router.replace('/login');
  318. }
  319. };
  320. onMounted(() => {
  321. // initMoveable();
  322. const query = route.query;
  323. // console.log(query, props.preStudentNum, '学生人数');
  324. // 先取参数,
  325. data.type = props.type || (query.type as any);
  326. data.courseId = props.courseId || query.courseId;
  327. data.subjectId = props.subjectId || query.subjectId;
  328. data.detailId = props.detailId || query.detailId;
  329. data.lessonCourseId = props.lessonCourseId || query.lessonCourseId;
  330. data.classGroupId = props.classGroupId || query.classGroupId;
  331. data.classId = props.classId || query.classId;
  332. data.preStudentNum = props.preStudentNum || query.preStudentNum;
  333. window.addEventListener('message', iframeHandle);
  334. getDetail();
  335. getLessonCoursewareDetail();
  336. if (data.type === 'preview') {
  337. rightList.splice(6, 1);
  338. }
  339. rollCallStudentList();
  340. });
  341. // const onFullScreen = () => {
  342. // if (data.type === 'preview') {
  343. // const el: any = document.querySelector('#app');
  344. // if (el.mozRequestFullScreen) {
  345. // el.mozRequestFullScreen();
  346. // } else if (el.webkitRequestFullscreen) {
  347. // el.webkitRequestFullscreen();
  348. // } else if (el.requestFullScreen) {
  349. // el.requestFullscreen();
  350. // }
  351. // }
  352. // };
  353. const popupData = reactive({
  354. open: false,
  355. activeIndex: 0,
  356. courseActiveIndex: 0, // 课件选择的第几个
  357. toolOpen: false, // 工具弹窗控制
  358. chapterOpen: false, // 切换章节
  359. chapterDetails: [] as any,
  360. courseId: null as any, // 章节编号
  361. chapterLoading: false // 加载数据
  362. });
  363. watch(
  364. () => [popupData.open, popupData.chapterOpen],
  365. val => {
  366. // 为了处理window电脑滑动时的问题 - pointr-events
  367. setTimeout(() => {
  368. const drawers = document.querySelectorAll('.n-drawer-container');
  369. if (val[0] || val[1]) {
  370. drawers?.forEach(drawer => {
  371. drawer.classList.remove('n-drawer-container-relative');
  372. });
  373. } else {
  374. drawers?.forEach(drawer => {
  375. drawer.classList.add('n-drawer-container-relative');
  376. });
  377. }
  378. }, 200);
  379. }
  380. );
  381. const formatParentId = (id: any, list: any, ids = [] as any) => {
  382. for (const item of list) {
  383. if (item.knowledgeList && item.knowledgeList.length > 0) {
  384. const cIds: any = formatParentId(id, item.knowledgeList, [
  385. ...ids,
  386. item.id
  387. ]);
  388. if (cIds.includes(id)) {
  389. return cIds;
  390. }
  391. }
  392. if (item.id === id) {
  393. return [...ids, id];
  394. }
  395. }
  396. return ids;
  397. };
  398. /** 获取章节 */
  399. const getLessonCoursewareDetail = async () => {
  400. try {
  401. const res = await lessonCoursewareDetail({
  402. id: data.lessonCourseId,
  403. subjectId: data.subjectId
  404. });
  405. popupData.chapterDetails = res.data.lessonList || [];
  406. const ids = formatParentId(data.detailId, popupData.chapterDetails);
  407. data.lessonCoursewareDetailId = ids[0];
  408. data.lessonCoursewareSubjectList = res.data.subjectList || [];
  409. } catch {
  410. //
  411. }
  412. };
  413. /** 更新上课记录 */
  414. const classCourseScheduleUpdate = async () => {
  415. try {
  416. if (!data.classId) return;
  417. await courseScheduleUpdate({
  418. lessonCoursewareKnowledgeDetailId: data.detailId,
  419. id: data.classId
  420. });
  421. } catch {
  422. //
  423. }
  424. };
  425. const activeName = computed(() => {
  426. let name = '';
  427. popupData.chapterDetails.forEach((chapter: any) => {
  428. if (chapter.id === data.lessonCoursewareDetailId) {
  429. // name = chapter.name;
  430. chapter.knowledgeList?.forEach((know: any) => {
  431. if (know.id === data.detailId) {
  432. name = know.name;
  433. }
  434. });
  435. }
  436. });
  437. return name;
  438. });
  439. /**停止所有的播放 */
  440. const handleStop = (isStop = true) => {
  441. // console.log(isStop, 'stop');
  442. for (let i = 0; i < data.itemList.length; i++) {
  443. const activeItem = data.itemList[i];
  444. if (activeItem.type === 'VIDEO' && activeItem.videoEle) {
  445. try {
  446. if (isStop) {
  447. activeItem.videoEle?.currentTime(0);
  448. }
  449. activeItem.videoEle?.pause();
  450. } catch (e: any) {
  451. // console.log(e, 'e');
  452. }
  453. }
  454. if (activeItem.type === 'SONG' && activeItem.audioEle) {
  455. activeItem.audioEle?.stop();
  456. }
  457. // console.log('🚀 ~ activeItem:', activeItem)
  458. // 停止曲谱的播放
  459. if (activeItem.type === 'MUSIC') {
  460. activeItem.iframeRef?.contentWindow?.postMessage(
  461. { api: 'setPlayState' },
  462. '*'
  463. );
  464. }
  465. if (
  466. activeItem.type === 'INSTRUMENT' ||
  467. activeItem.type === 'MUSICIAN' ||
  468. activeItem.type === 'MUSIC_WIKI'
  469. ) {
  470. activeItem.iframeRef?.handleChangeAudio('pause');
  471. }
  472. // console.log(activeItem.type, 'activeItem.type');
  473. if (activeItem.type === 'RHYTHM') {
  474. activeItem.iframeRef?.contentWindow?.postMessage(
  475. { api: 'setPlayState', data: false },
  476. '*'
  477. );
  478. }
  479. if (activeItem.type === 'LISTEN') {
  480. activeItem.iframeRef?.contentWindow?.postMessage(
  481. { api: 'setPlayState' },
  482. '*'
  483. );
  484. }
  485. }
  486. };
  487. // 切换素材
  488. const toggleMaterial = (itemActive: any) => {
  489. const index = data.itemList.findIndex((n: any) => n.id == itemActive);
  490. if (index > -1) {
  491. handleSwipeChange(index);
  492. }
  493. };
  494. /** 延迟收起模态框 */
  495. const setModelOpen = () => {
  496. clearTimeout(activeData.timer);
  497. message.destroyAll();
  498. activeData.timer = setTimeout(() => {
  499. activeData.model = false;
  500. Object.values(data.videoRefs).map((n: any) =>
  501. n?.toggleHideControl(false)
  502. );
  503. Object.values(data.audioRefs).map((n: any) =>
  504. n?.toggleHideControl(false)
  505. );
  506. }, 4000);
  507. };
  508. /** 立即收起所有的模态框 */
  509. const clearModel = () => {
  510. clearTimeout(activeData.timer);
  511. message.destroyAll();
  512. activeData.model = false;
  513. Object.values(data.videoRefs).map((n: any) =>
  514. n?.toggleHideControl(false)
  515. );
  516. Object.values(data.audioRefs).map((n: any) =>
  517. n?.toggleHideControl(false)
  518. );
  519. };
  520. const toggleModel = (type = true) => {
  521. activeData.model = type;
  522. Object.values(data.videoRefs).map((n: any) => n?.toggleHideControl(type));
  523. Object.values(data.audioRefs).map((n: any) => n?.toggleHideControl(type));
  524. };
  525. // 双击
  526. const handleDbClick = (item: any) => {
  527. if (item && item.type === 'VIDEO') {
  528. const videoEle: HTMLVideoElement = item.videoEle;
  529. if (videoEle) {
  530. if (videoEle.paused) {
  531. message.destroyAll();
  532. videoEle.play();
  533. } else {
  534. message.warning('已暂停');
  535. videoEle.pause();
  536. }
  537. }
  538. }
  539. };
  540. // ppt iframe 点击事件
  541. // const iframeClick = () => {
  542. // if(document.all) {
  543. // document.getElementById("iframe-ppt")?.attachEvent("click", () => {
  544. // activeData.model = !activeData.model
  545. // });
  546. // } else {
  547. // document.getElementById("iframe-ppt")?.contentWindow?.postMessage({
  548. // api: 'onAttendToggleMenu'
  549. // }, '*');
  550. // }
  551. // }
  552. // 切换播放
  553. // const togglePlay = (m: any, isPlay: boolean) => {
  554. // if (isPlay) {
  555. // m.videoEle?.play();
  556. // } else {
  557. // m.videoEle?.pause();
  558. // }
  559. // };
  560. // const showIndex = ref(-4);
  561. const effectIndex = ref(3);
  562. const effects = [
  563. {
  564. prev: {
  565. transform: 'translate3d(0, 0, -800px) rotateX(180deg)'
  566. },
  567. next: {
  568. transform: 'translate3d(0, 0, -800px) rotateX(-180deg)'
  569. }
  570. },
  571. {
  572. prev: {
  573. transform: 'translate3d(-100%, 0, -800px)'
  574. },
  575. next: {
  576. transform: 'translate3d(100%, 0, -800px)'
  577. }
  578. },
  579. {
  580. prev: {
  581. transform: 'translate3d(-50%, 0, -800px) rotateY(80deg)'
  582. },
  583. next: {
  584. transform: 'translate3d(50%, 0, -800px) rotateY(-80deg)'
  585. }
  586. },
  587. {
  588. prev: {
  589. transform: 'translate3d(-100%, 0, -800px) rotateY(-120deg)'
  590. },
  591. next: {
  592. transform: 'translate3d(100%, 0, -800px) rotateY(120deg)'
  593. }
  594. },
  595. // 风车4
  596. {
  597. prev: {
  598. transform: 'translate3d(-50%, 50%, -800px) rotateZ(-14deg)',
  599. opacity: 0
  600. },
  601. next: {
  602. transform: 'translate3d(50%, 50%, -800px) rotateZ(14deg)',
  603. opacity: 0
  604. }
  605. },
  606. // 翻页5
  607. {
  608. prev: {
  609. transform: 'translateZ(-800px) rotate3d(0, -1, 0, 90deg)',
  610. opacity: 0
  611. },
  612. next: {
  613. transform: 'translateZ(-800px) rotate3d(0, 1, 0, 90deg)',
  614. opacity: 0
  615. },
  616. current: { transitionDelay: '700ms' }
  617. }
  618. ];
  619. const acitveTimer = ref();
  620. // 轮播切换
  621. const handleSwipeChange = (index: number) => {
  622. // 如果是当前正在播放 或者是视频最后一个
  623. if (popupData.activeIndex == index) return;
  624. data.animationState = 'start';
  625. data.videoState = 'init';
  626. handleStop();
  627. clearTimeout(acitveTimer.value);
  628. activeData.model = true;
  629. checkedAnimation(popupData.activeIndex, index);
  630. popupData.activeIndex = index;
  631. // 处理资源列表滚动
  632. nextTick(() => {
  633. scrollResourceSection();
  634. });
  635. acitveTimer.value = setTimeout(
  636. () => {
  637. const item = data.itemList[index];
  638. if (item) {
  639. if (item.type == 'MUSIC') {
  640. activeData.model = true;
  641. }
  642. if (item.type === 'SONG') {
  643. // 自动播放下一个音频
  644. clearTimeout(activeData.timer);
  645. message.destroyAll();
  646. // item.autoPlay = false;
  647. // nextTick(() => {
  648. // item.audioEle?.onPlay();
  649. // });
  650. }
  651. if (item.type === 'VIDEO') {
  652. // 自动播放下一个视频
  653. clearTimeout(activeData.timer);
  654. message.destroyAll();
  655. nextTick(() => {
  656. if (item.error) {
  657. // console.log(item, 'item error');
  658. item.videoEle?.src(item.content);
  659. item.error = false;
  660. // item.videoEle?.onPlay();
  661. }
  662. data.animationState = 'end';
  663. });
  664. }
  665. if (item.type === 'PPT') {
  666. //
  667. }
  668. }
  669. },
  670. activeData.isAnimation ? 800 : 0
  671. );
  672. };
  673. /** 是否有转场动画 */
  674. const checkedAnimation = (index: number, nextIndex?: number) => {
  675. const item = data.itemList[index];
  676. const nextItem = data.itemList[nextIndex!];
  677. if (nextItem) {
  678. if (nextItem.knowledgePointId != item.knowledgePointId) {
  679. activeData.isAnimation = true;
  680. return;
  681. }
  682. const videoEle = item.videoEle;
  683. const nextVideo = nextItem.videoEle;
  684. if (videoEle && videoEle.duration < 8 && index < nextIndex!) {
  685. activeData.isAnimation = false;
  686. } else if (nextVideo && nextVideo.duration < 8 && index > nextIndex!) {
  687. activeData.isAnimation = false;
  688. } else {
  689. activeData.isAnimation = true;
  690. }
  691. } else {
  692. activeData.isAnimation = item?.adviseStudyTimeSecond < 8 ? false : true;
  693. }
  694. };
  695. // 上一个知识点, 下一个知识点
  696. const handlePreAndNext = async (type: string) => {
  697. if (type === 'up') {
  698. // 判断上面是否还有章节
  699. if (popupData.activeIndex > 0) {
  700. handleSwipeChange(popupData.activeIndex - 1);
  701. return;
  702. }
  703. // 获取当前是哪个章节
  704. let detailIndex = popupData.chapterDetails.findIndex(
  705. (item: any) => item.id == data.lessonCoursewareDetailId
  706. );
  707. const detailItem =
  708. popupData.chapterDetails[detailIndex]?.knowledgeList || [];
  709. let lessonIndex = detailItem.findIndex(
  710. (item: any) => item.id == data.detailId
  711. );
  712. let lessonStatus = false; // 当前章节上面是否有内容
  713. let lessonCoursewareDetailId = '';
  714. let coursewareDetailKnowledgeId = '';
  715. while (lessonIndex >= 0) {
  716. lessonIndex--;
  717. if (lessonIndex >= 0) {
  718. if (detailItem[lessonIndex].coursewareNum > 0) {
  719. lessonStatus = true;
  720. lessonCoursewareDetailId =
  721. detailItem[lessonIndex].lessonCoursewareDetailId;
  722. coursewareDetailKnowledgeId = detailItem[lessonIndex].id;
  723. }
  724. }
  725. if (lessonStatus) {
  726. break;
  727. }
  728. }
  729. // 判断当前章节下面课程是否有内容,否则往上一个章节走
  730. if (lessonStatus) {
  731. popupData.courseId = coursewareDetailKnowledgeId;
  732. data.selectClassStatus = true;
  733. return;
  734. }
  735. let prevLessonStatus = false;
  736. while (detailIndex >= 0) {
  737. detailIndex--;
  738. const tempDetail =
  739. popupData.chapterDetails[detailIndex]?.knowledgeList || [];
  740. let tempLessonLength = tempDetail.length;
  741. while (tempLessonLength > 0) {
  742. if (tempDetail[tempLessonLength - 1].coursewareNum > 0) {
  743. prevLessonStatus = true;
  744. lessonCoursewareDetailId =
  745. tempDetail[tempLessonLength - 1].lessonCoursewareDetailId;
  746. coursewareDetailKnowledgeId = tempDetail[tempLessonLength - 1].id;
  747. }
  748. tempLessonLength--;
  749. if (prevLessonStatus) {
  750. break;
  751. }
  752. }
  753. if (prevLessonStatus) {
  754. break;
  755. }
  756. }
  757. // 判断当前章节下面课程是否有内容,否则往上一个章节走
  758. if (prevLessonStatus) {
  759. popupData.courseId = coursewareDetailKnowledgeId;
  760. data.selectClassStatus = true;
  761. return;
  762. }
  763. } else {
  764. if (popupData.activeIndex < data.itemList.length - 1) {
  765. handleSwipeChange(popupData.activeIndex + 1);
  766. return;
  767. }
  768. // 获取当前是哪个章节
  769. let detailIndex = popupData.chapterDetails.findIndex(
  770. (item: any) => item.id == data.lessonCoursewareDetailId
  771. );
  772. const detailItem =
  773. popupData.chapterDetails[detailIndex]?.knowledgeList || [];
  774. let lessonIndex = detailItem.findIndex(
  775. (item: any) => item.id == data.detailId
  776. );
  777. let lessonStatus = false; // 当前章节下面是否有内容
  778. let lessonCoursewareDetailId = '';
  779. let coursewareDetailKnowledgeId = '';
  780. while (lessonIndex < detailItem.length - 1) {
  781. lessonIndex++;
  782. if (lessonIndex >= 0) {
  783. if (detailItem[lessonIndex].coursewareNum > 0) {
  784. lessonStatus = true;
  785. lessonCoursewareDetailId =
  786. detailItem[lessonIndex].lessonCoursewareDetailId;
  787. coursewareDetailKnowledgeId = detailItem[lessonIndex].id;
  788. }
  789. }
  790. if (lessonStatus) {
  791. break;
  792. }
  793. }
  794. // 判断当前章节下面课程是否有内容,否则往下一个章节走
  795. if (lessonStatus) {
  796. popupData.courseId = coursewareDetailKnowledgeId;
  797. data.selectClassStatus = true;
  798. return;
  799. }
  800. let nextLessonStatus = false;
  801. while (detailIndex <= popupData.chapterDetails.length - 1) {
  802. detailIndex++;
  803. const tempDetail =
  804. popupData.chapterDetails[detailIndex]?.knowledgeList || [];
  805. let tempLessonLength = 0;
  806. while (tempLessonLength <= tempDetail.length - 1) {
  807. if (tempDetail[tempLessonLength].coursewareNum > 0) {
  808. nextLessonStatus = true;
  809. lessonCoursewareDetailId =
  810. tempDetail[tempLessonLength].lessonCoursewareDetailId;
  811. coursewareDetailKnowledgeId = tempDetail[tempLessonLength].id;
  812. }
  813. tempLessonLength++;
  814. if (nextLessonStatus) {
  815. break;
  816. }
  817. }
  818. if (nextLessonStatus) {
  819. break;
  820. }
  821. }
  822. // 判断当前章节下面课程是否有内容,否则往上一个章节走
  823. if (nextLessonStatus) {
  824. popupData.courseId = coursewareDetailKnowledgeId;
  825. data.selectClassStatus = true;
  826. return;
  827. }
  828. }
  829. };
  830. /** 弹窗关闭 */
  831. const handleClosePopup = () => {
  832. const item = data.itemList[popupData.activeIndex];
  833. if (item?.type == 'VIDEO' && !item.videoEle?.paused) {
  834. setModelOpen();
  835. }
  836. if (item?.type == 'SONG' && !item.audioEle?.paused) {
  837. setModelOpen();
  838. }
  839. };
  840. document.body.addEventListener('keyup', (e: KeyboardEvent) => {
  841. if (e.code === 'ArrowLeft') {
  842. // if (popupData.activeIndex === 0) return;
  843. setModalOpen();
  844. handlePreAndNext('up');
  845. } else if (e.code === 'ArrowRight') {
  846. // if (popupData.activeIndex === data.itemList.length - 1) return;
  847. setModalOpen();
  848. handlePreAndNext('down');
  849. } else if (e.code === 'Space') {
  850. // const activeItem = data.itemList[popupData.activeIndex];
  851. // console.log(activeItem, activeItem.videoEle);
  852. // // 暂停视频和曲谱的播放
  853. // if (activeItem.type === 'VIDEO' && activeItem.videoEle) {
  854. // activeItem.videoEle?.play();
  855. // }
  856. // if (activeItem.type === 'SONG' && activeItem.audioEle) {
  857. // activeItem.audioEle?.play();
  858. // }
  859. // if (activeItem.type === 'MUSIC') {
  860. // activeItem.iframeRef?.contentWindow?.postMessage(
  861. // { api: 'setPlayState' },
  862. // '*'
  863. // );
  864. // }
  865. }
  866. });
  867. // const toggleListenerKeyUp = (type: string) => {
  868. // if (type === 'remove') {
  869. // document.body.removeEventListener('keyup', () => {
  870. // listenerKeyUpState.value = false;
  871. // });
  872. // } else {
  873. // // 监听页面键盘事件 - 上下切换
  874. // document.body.addEventListener('keyup', (e: KeyboardEvent) => {
  875. // // console.log(e, 'e');
  876. // if (e.code === 'ArrowLeft') {
  877. // // if (popupData.activeIndex === 0) return;
  878. // setModalOpen();
  879. // handlePreAndNext('up');
  880. // } else if (e.code === 'ArrowRight') {
  881. // // if (popupData.activeIndex === data.itemList.length - 1) return;
  882. // setModalOpen();
  883. // handlePreAndNext('down');
  884. // }
  885. // });
  886. // listenerKeyUpState.value = true;
  887. // }
  888. // };
  889. // 监听切换到ppt课件时,手动移除键盘监听器
  890. // watch(() => popupData.activeIndex, () => {
  891. // const activeItem = data.itemList[popupData.activeIndex];
  892. // if (activeItem?.type === 'PPT') {
  893. // toggleListenerKeyUp('remove')
  894. // } else {
  895. // !listenerKeyUpState.value && toggleListenerKeyUp('add')
  896. // }
  897. // })
  898. watch(
  899. () => popupData.activeIndex,
  900. () => {
  901. const item = data.itemList[popupData.activeIndex];
  902. popupData.courseActiveIndex = item.parentIndex;
  903. }
  904. );
  905. const setModalOpen = (status = true) => {
  906. clearTimeout(activeData.timer);
  907. activeData.model = status;
  908. Object.values(data.videoRefs).map((n: any) =>
  909. n?.toggleHideControl(status)
  910. );
  911. Object.values(data.audioRefs).map((n: any) =>
  912. n?.toggleHideControl(status)
  913. );
  914. };
  915. /** 教学数据 */
  916. const studyData = reactive({
  917. type: '' as ToolType,
  918. penShow: false,
  919. whiteboardShow: false,
  920. callShow: false,
  921. callStudentList: [] as any // 学生列表
  922. });
  923. /** 打开教学工具 */
  924. const openStudyTool = (item: ToolItem) => {
  925. handleStop(false);
  926. clearModel();
  927. popupData.toolOpen = false;
  928. studyData.type = item.type;
  929. switch (item.type) {
  930. case 'pen':
  931. studyData.penShow = true;
  932. break;
  933. case 'whiteboard':
  934. studyData.whiteboardShow = true;
  935. break;
  936. case 'call':
  937. studyData.callShow = true;
  938. break;
  939. }
  940. };
  941. /** 关闭教学工具 */
  942. const closeStudyTool = () => {
  943. studyData.type = 'init';
  944. toggleModel();
  945. setModelOpen();
  946. };
  947. const startShowModal = (
  948. val: 'setTimeIcon' | 'beatIcon' | 'toneIcon' | 'iconNote2'
  949. ) => {
  950. if (val == 'setTimeIcon') {
  951. showModalTime.value = true;
  952. }
  953. if (val == 'beatIcon') {
  954. showModalBeat.value = true;
  955. }
  956. if (val == 'toneIcon') {
  957. showModalTone.value = true;
  958. }
  959. };
  960. // 是否允许上一页
  961. const isUpArrow = computed(() => {
  962. /**
  963. * 1,判断当前课程中是否处在第一个资源;
  964. * 2,判断当前课程是否在当前章节的第一个;
  965. * 3,判断当前章节,当前课程上面还没有其它课程,是否有资源;
  966. * 4,判断当前章节上面还没有其它章节;
  967. * 5,判断上面章节里面课程是否有资源;
  968. */
  969. if (popupData.activeIndex > 0) {
  970. return true;
  971. }
  972. // 获取当前是哪个章节
  973. let detailIndex = popupData.chapterDetails.findIndex(
  974. (item: any) => item.id == data.lessonCoursewareDetailId
  975. );
  976. const detailItem =
  977. popupData.chapterDetails[detailIndex]?.knowledgeList || [];
  978. let lessonIndex = detailItem.findIndex(
  979. (item: any) => item.id == data.detailId
  980. );
  981. // 说明已经是第一单元,第一课
  982. if (detailIndex <= 0 && lessonIndex <= 0) {
  983. return false;
  984. }
  985. let lessonStatus = false; // 当前章节上面是否有内容
  986. while (lessonIndex >= 0) {
  987. lessonIndex--;
  988. if (lessonIndex >= 0) {
  989. if (detailItem[lessonIndex].coursewareNum > 0) {
  990. lessonStatus = true;
  991. }
  992. }
  993. }
  994. // 判断当前章节下面课程是否有内容,否则往上一个章节走
  995. if (lessonStatus) {
  996. return true;
  997. }
  998. // 已经是第一个章节了
  999. if (detailIndex <= 0) {
  1000. return false;
  1001. }
  1002. let prevLessonStatus = false;
  1003. while (detailIndex >= 0) {
  1004. detailIndex--;
  1005. const tempDetail =
  1006. popupData.chapterDetails[detailIndex]?.knowledgeList || [];
  1007. let tempLessonLength = tempDetail.length;
  1008. while (tempLessonLength > 0) {
  1009. if (tempDetail[tempLessonLength - 1].coursewareNum > 0) {
  1010. prevLessonStatus = true;
  1011. }
  1012. tempLessonLength--;
  1013. }
  1014. if (prevLessonStatus) {
  1015. return true;
  1016. }
  1017. }
  1018. return false;
  1019. });
  1020. // 是否允许下一页
  1021. const isDownArrow = computed(() => {
  1022. if (popupData.activeIndex < data.itemList.length - 1) {
  1023. return true;
  1024. }
  1025. // 获取当前是哪个章节
  1026. let detailIndex = popupData.chapterDetails.findIndex(
  1027. (item: any) => item.id == data.lessonCoursewareDetailId
  1028. );
  1029. const detailItem =
  1030. popupData.chapterDetails[detailIndex]?.knowledgeList || [];
  1031. let lessonIndex = detailItem.findIndex(
  1032. (item: any) => item.id == data.detailId
  1033. );
  1034. // 说明已经是最后-单元,最后一课
  1035. if (
  1036. detailIndex >= popupData.chapterDetails.length - 1 &&
  1037. lessonIndex >= detailItem.length - 1
  1038. ) {
  1039. return false;
  1040. }
  1041. let lessonStatus = false; // 当前章节下面是否有内容
  1042. while (lessonIndex < detailItem.length - 1) {
  1043. lessonIndex++;
  1044. if (lessonIndex >= 0) {
  1045. if (detailItem[lessonIndex].coursewareNum > 0) {
  1046. lessonStatus = true;
  1047. }
  1048. }
  1049. }
  1050. // 判断当前章节下面课程是否有内容,否则往下一个章节走
  1051. if (lessonStatus) {
  1052. return true;
  1053. }
  1054. // 已经是最后一个章节了
  1055. if (detailIndex >= popupData.chapterDetails.length - 1) {
  1056. return false;
  1057. }
  1058. let nextLessonStatus = false;
  1059. while (detailIndex < popupData.chapterDetails.length - 1) {
  1060. detailIndex++;
  1061. const tempDetail =
  1062. popupData.chapterDetails[detailIndex]?.knowledgeList || [];
  1063. let tempLessonLength = 0;
  1064. while (tempLessonLength <= tempDetail.length - 1) {
  1065. if (tempDetail[tempLessonLength].coursewareNum > 0) {
  1066. nextLessonStatus = true;
  1067. }
  1068. tempLessonLength++;
  1069. }
  1070. if (nextLessonStatus) {
  1071. return true;
  1072. }
  1073. }
  1074. return false;
  1075. });
  1076. const activeVideoItem = computed(() => {
  1077. const item = data.itemList[popupData.activeIndex];
  1078. if (item && item.type && item.type.toLocaleUpperCase() === 'VIDEO') {
  1079. return item;
  1080. }
  1081. return {};
  1082. });
  1083. // 右侧菜单栏
  1084. const rightList = reactive([
  1085. {
  1086. name: '曲目资源',
  1087. name2: '曲目资源',
  1088. icon: rightIconMusic,
  1089. id: 9
  1090. },
  1091. {
  1092. name: '批注',
  1093. icon: rightIconPostil,
  1094. id: 3
  1095. },
  1096. {
  1097. name: '白板',
  1098. icon: rightIconWhiteboard,
  1099. id: 4
  1100. },
  1101. {
  1102. name: '节拍器',
  1103. icon: rightIconMetronome,
  1104. id: 5
  1105. },
  1106. {
  1107. name: '计时器',
  1108. icon: rightIconTimer,
  1109. id: 7
  1110. },
  1111. // {
  1112. // name: '调音器',
  1113. // icon: rightIconTuner,
  1114. // id: 6
  1115. // },
  1116. {
  1117. name: '点名',
  1118. icon: rightIconCall,
  1119. id: 10
  1120. },
  1121. {
  1122. name: '布置作业',
  1123. icon: rightIconArrange,
  1124. id: 2
  1125. },
  1126. {
  1127. name: '结束课程',
  1128. name2: '结束预览',
  1129. icon: rightIconEnd,
  1130. id: 1
  1131. },
  1132. {
  1133. name: '收起',
  1134. icon: rightIconPackUp,
  1135. id: 8
  1136. }
  1137. ]);
  1138. // 底部菜单栏
  1139. const bottomList = reactive([
  1140. {
  1141. name: '切换章节',
  1142. icon: bottomIconSwitch,
  1143. id: 1
  1144. },
  1145. {
  1146. name: '资源列表',
  1147. icon: bottomIconResource,
  1148. id: 2
  1149. },
  1150. {
  1151. name: '上一张',
  1152. icon: bottomIconPre,
  1153. id: 3
  1154. },
  1155. {
  1156. name: '下一张',
  1157. icon: bottomIconNext,
  1158. id: 4
  1159. }
  1160. ]);
  1161. // 默认收起菜单
  1162. const rightColumnShow = ref(false);
  1163. // 右边栏操作
  1164. const operateRightBtn = async (id: number) => {
  1165. if (id !== 8) {
  1166. handleStop(false);
  1167. }
  1168. switch (id) {
  1169. case 1:
  1170. if (data.type === 'preview') {
  1171. data.removeVisiable = true;
  1172. data.removeTitle = '结束预览';
  1173. data.removeContent = '请确认是否结束预览?';
  1174. } else {
  1175. const res = await getStudentAfterWork({
  1176. courseScheduleId: data.classId,
  1177. page: 1,
  1178. rows: 99
  1179. });
  1180. if (res.data.rows && res.data.rows.length) {
  1181. data.removeContent = '请确认是否结束课程?';
  1182. data.removeCourseStatus = false;
  1183. } else {
  1184. data.removeContent = '本次课堂尚未布置作业,是否结束课程?';
  1185. data.removeCourseStatus = true;
  1186. }
  1187. data.removeVisiable = true;
  1188. data.removeTitle = '结束课程';
  1189. }
  1190. break;
  1191. case 2:
  1192. // 学生人数必须大于0,才可以布置作业
  1193. if (data.preStudentNum <= 0) return;
  1194. // const res = await lessonPreTrainingPage({
  1195. // coursewareKnowledgeDetailId: data.detailId,
  1196. // subjectId: data.subjectId,
  1197. // page: 1,
  1198. // rows: 99
  1199. // });
  1200. // if (res.data.rows && res.data.rows.length) {
  1201. // data.modalAttendMessage = '本节课已设置课后作业,是否布置?';
  1202. // }
  1203. // data.modelAttendStatus = true;
  1204. const res = await getStudentAfterWork({
  1205. courseScheduleId: data.classId,
  1206. page: 1,
  1207. rows: 99
  1208. });
  1209. if (res.data.rows && res.data.rows.length) {
  1210. // data.modalAttendMessage = '请确认是否结束课程?';
  1211. data.modalAttendMessage = '本次课程已布置作业,是否继续?';
  1212. data.modelAttendStatus = true;
  1213. } else {
  1214. data.modelTrainStatus = true;
  1215. nextTick(() => {
  1216. getModalHeight();
  1217. });
  1218. data.modelAttendStatus = false;
  1219. }
  1220. break;
  1221. case 3:
  1222. openStudyTool({
  1223. type: 'pen',
  1224. icon: iconNote,
  1225. name: '批注'
  1226. });
  1227. break;
  1228. case 4:
  1229. openStudyTool({
  1230. type: 'whiteboard',
  1231. icon: iconWhite,
  1232. name: '白板'
  1233. });
  1234. break;
  1235. case 5:
  1236. startShowModal('beatIcon');
  1237. break;
  1238. case 6:
  1239. startShowModal('toneIcon');
  1240. break;
  1241. case 7:
  1242. startShowModal('setTimeIcon');
  1243. break;
  1244. case 8:
  1245. rightColumnShow.value = false;
  1246. break;
  1247. case 9:
  1248. // 选择曲目时需要暂停所有播放
  1249. handleStop(false);
  1250. data.selectResourceStatus = true;
  1251. break;
  1252. case 10:
  1253. // 点名
  1254. // await rollCallStudentList();
  1255. if (studyData.callStudentList.length > 0) {
  1256. openStudyTool({
  1257. type: 'call',
  1258. icon: iconWhite,
  1259. name: '点名'
  1260. });
  1261. return;
  1262. }
  1263. break;
  1264. default:
  1265. break;
  1266. }
  1267. };
  1268. // 点名学生列表
  1269. const rollCallStudentList = async () => {
  1270. //
  1271. if (!data.classId) return;
  1272. try {
  1273. const res = await getStudentList({
  1274. classGroupId: data.classGroupId,
  1275. page: 1,
  1276. rows: 999
  1277. });
  1278. const result = res.data || {};
  1279. if (Array.isArray(result.rows) && result.rows.length > 0) {
  1280. const tempStudents: any = [];
  1281. result.rows.forEach((row: any) => {
  1282. tempStudents.push({
  1283. name: row.nickname,
  1284. img: row.avatar
  1285. });
  1286. });
  1287. studyData.callStudentList = [...tempStudents];
  1288. }
  1289. } catch {
  1290. //
  1291. }
  1292. };
  1293. // 底部悬浮按钮操作
  1294. const operateBottomBtn = (id: number) => {
  1295. switch (id) {
  1296. case 1:
  1297. popupData.chapterOpen = true;
  1298. break;
  1299. case 2:
  1300. popupData.open = true;
  1301. nextTick(() => {
  1302. scrollResourceSection();
  1303. });
  1304. break;
  1305. case 3:
  1306. if (!isUpArrow.value) return;
  1307. handlePreAndNext('up');
  1308. break;
  1309. case 4:
  1310. if (!isDownArrow.value) return;
  1311. handlePreAndNext('down');
  1312. break;
  1313. default:
  1314. break;
  1315. }
  1316. };
  1317. // 滚动到某个元素的位置
  1318. const scrollResourceSection = () => {
  1319. const drawerCardItemRefs =
  1320. document.querySelectorAll('.drawerCardItemRef');
  1321. if (
  1322. popupData.activeIndex >= 0 &&
  1323. drawerCardItemRefs[popupData.activeIndex]
  1324. ) {
  1325. drawerCardItemRefs[popupData.activeIndex].scrollIntoView();
  1326. }
  1327. };
  1328. const getModalHeight = () => {
  1329. const dom: any = document.querySelector('#model-homework-height');
  1330. if (dom) {
  1331. useResizeObserver(dom as HTMLElement, (entries: any) => {
  1332. const entry = entries[0];
  1333. const { height } = entry.contentRect;
  1334. dom.style.setProperty('--window-page-lesson-height', height + 'px');
  1335. });
  1336. }
  1337. };
  1338. return () => (
  1339. <div id="playContent" class={[styles.playContent, 'wrap']}>
  1340. <div
  1341. onClick={() => {
  1342. clearTimeout(activeData.timer);
  1343. activeData.model = !activeData.model;
  1344. Object.values(data.videoRefs).map((n: any) =>
  1345. n?.toggleHideControl(activeData.model)
  1346. );
  1347. Object.values(data.audioRefs).map((n: any) =>
  1348. n?.toggleHideControl(activeData.model)
  1349. );
  1350. }}>
  1351. <div
  1352. class={styles.coursewarePlay}
  1353. style={{ width: parentContainer.width }}>
  1354. {!popupData.chapterLoading ? (
  1355. <div class={styles.wraps}>
  1356. <div
  1357. style={
  1358. activeVideoItem.value.type &&
  1359. data.animationState === 'end' &&
  1360. data.videoState === 'play'
  1361. ? {
  1362. zIndex: 15,
  1363. opacity: 1
  1364. }
  1365. : { opacity: 0, zIndex: -1 }
  1366. }
  1367. class={styles.itemDiv}>
  1368. <VideoPlay
  1369. ref={(el: any) => (data.videoItemRef = el)}
  1370. item={activeVideoItem.value}
  1371. showModel={activeData.model}
  1372. onClose={setModelOpen}
  1373. onLoadedmetadata={(videoItem: any) => {
  1374. if (data.itemList[popupData.activeIndex]) {
  1375. data.itemList[popupData.activeIndex].videoEle =
  1376. videoItem;
  1377. }
  1378. }}
  1379. onCanplay={() => {
  1380. data.videoState = 'play';
  1381. // activeVideoItem.value.videoEle = videoItem;
  1382. }}
  1383. onPause={() => {
  1384. clearTimeout(activeData.timer);
  1385. activeData.model = true;
  1386. }}
  1387. onEnded={() => {
  1388. // const _index = popupData.activeIndex + 1;
  1389. // if (_index < data.itemList.length) {
  1390. // handleSwipeChange(_index);
  1391. // }
  1392. }}
  1393. />
  1394. </div>
  1395. {data.itemList.map((m: any, mIndex: number) => {
  1396. const isRender = Math.abs(popupData.activeIndex - mIndex) < 2;
  1397. const isEmtry = Math.abs(popupData.activeIndex - mIndex) > 4;
  1398. // if (isRender && m.type === 'PPT') {
  1399. // setTimeout(() => iframeClick() ,500)
  1400. // }
  1401. // if (isRender) {
  1402. // m.isRender = true;
  1403. // }
  1404. // const isRender =
  1405. // m.isRender || Math.abs(popupData.activeIndex - mIndex) < 2;
  1406. // const isEmtry = Math.abs(popupData.activeIndex - mIndex) > 4;
  1407. // if (isRender) {
  1408. // m.isRender = true;
  1409. // }
  1410. return isRender ? (
  1411. <div
  1412. key={'index' + mIndex}
  1413. class={[
  1414. styles.itemDiv,
  1415. popupData.activeIndex === mIndex && styles.itemActive,
  1416. activeData.isAnimation && styles.acitveAnimation,
  1417. Math.abs(popupData.activeIndex - mIndex) < 2
  1418. ? styles.show
  1419. : styles.hide
  1420. ]}
  1421. style={
  1422. mIndex < popupData.activeIndex
  1423. ? effects[effectIndex.value].prev
  1424. : mIndex > popupData.activeIndex
  1425. ? effects[effectIndex.value].next
  1426. : {}
  1427. }
  1428. onClick={(e: Event) => {
  1429. e.stopPropagation();
  1430. clearTimeout(activeData.timer);
  1431. if (Date.now() - activeData.nowTime < 300) {
  1432. handleDbClick(m);
  1433. return;
  1434. }
  1435. activeData.nowTime = Date.now();
  1436. activeData.timer = setTimeout(() => {
  1437. activeData.model = !activeData.model;
  1438. Object.values(data.videoRefs).map((n: any) =>
  1439. n?.toggleHideControl(activeData.model)
  1440. );
  1441. Object.values(data.audioRefs).map((n: any) =>
  1442. n?.toggleHideControl(activeData.model)
  1443. );
  1444. if (activeData.model) {
  1445. setModelOpen();
  1446. }
  1447. }, 300);
  1448. }}>
  1449. {m.type === 'VIDEO' ? (
  1450. <>
  1451. <img
  1452. src={m.coverImg}
  1453. onLoad={() => {
  1454. m.isprepare = true;
  1455. }}
  1456. />
  1457. {/* <VideoPlay
  1458. ref={(v: any) => (data.videoRefs[mIndex] = v)}
  1459. item={m}
  1460. isEmtry={isEmtry}
  1461. onLoadedmetadata={(videoItem: any) => {
  1462. m.videoEle = videoItem;
  1463. m.isprepare = true;
  1464. }}
  1465. onTogglePlay={(paused: boolean) => {
  1466. m.autoPlay = false;
  1467. if (paused || popupData.open) {
  1468. clearTimeout(activeData.timer);
  1469. } else {
  1470. setModelOpen();
  1471. }
  1472. }}
  1473. onReset={() => {
  1474. if (!m.videoEle?.paused) {
  1475. setModelOpen();
  1476. }
  1477. }}
  1478. onError={() => {
  1479. console.log('video error');
  1480. m.error = true;
  1481. }}
  1482. /> */}
  1483. <Transition name="van-fade">
  1484. {
  1485. <div class={styles.loadWrap}>
  1486. <Vue3Lottie
  1487. animationData={playLoadData}></Vue3Lottie>
  1488. </div>
  1489. }
  1490. </Transition>
  1491. </>
  1492. ) : m.type === 'IMG' ? (
  1493. <img src={m.content} />
  1494. ) : m.type === 'SONG' ? (
  1495. <AudioPay
  1496. item={m}
  1497. activeStatus={popupData.activeIndex === mIndex}
  1498. ref={(v: any) => (data.audioRefs[mIndex] = v)}
  1499. onLoadedmetadata={(audioItem: any) => {
  1500. m.audioEle = audioItem;
  1501. m.isprepare = true;
  1502. }}
  1503. onTogglePlay={(paused: boolean) => {
  1504. // m.autoPlay = false;
  1505. if (paused || popupData.open) {
  1506. clearTimeout(activeData.timer);
  1507. } else {
  1508. setModelOpen();
  1509. }
  1510. }}
  1511. onEnded={() => {
  1512. // const _index = popupData.activeIndex + 1;
  1513. // if (_index < data.itemList.length) {
  1514. // handleSwipeChange(_index);
  1515. // }
  1516. }}
  1517. onReset={() => {
  1518. if (!m.audioEle?.paused) {
  1519. setModelOpen();
  1520. }
  1521. }}
  1522. />
  1523. ) : // : m.type === 'PPT' ? <div class={styles.iframePpt}>
  1524. // <div class={styles.pptBox}></div>
  1525. // <iframe src={`https://view.officeapps.live.com/op/embed.aspx?src=${encodeURIComponent(m.content)}`} width='100%' height='100%' frameborder='1'></iframe>
  1526. // </div>
  1527. m.type === 'PPT' ? (
  1528. <iframe
  1529. src={`https://view.officeapps.live.com/op/embed.aspx?src=${encodeURIComponent(
  1530. m.content
  1531. )}`}
  1532. width="100%"
  1533. height="100%"
  1534. frameborder="1"></iframe>
  1535. ) : m.type === 'RHYTHM' ? (
  1536. <RhythmModal
  1537. item={m}
  1538. activeStatus={popupData.activeIndex === mIndex}
  1539. onSetIframe={(el: any) => {
  1540. m.iframeRef = el;
  1541. }}
  1542. />
  1543. ) : m.type === 'LISTEN' ? (
  1544. <ListenModal
  1545. item={m}
  1546. data-vid={m.id}
  1547. activeStatus={popupData.activeIndex === mIndex}
  1548. onSetIframe={(el: any) => {
  1549. m.iframeRef = el;
  1550. }}
  1551. />
  1552. ) : m.type === 'INSTRUMENT' || m.type === 'MUSICIAN' ? (
  1553. <InstruemntDetail
  1554. type="preview"
  1555. id={m.content}
  1556. contentType={m.type}
  1557. activeStatus={popupData.activeIndex === mIndex}
  1558. ref={(el: any) => (m.iframeRef = el)}
  1559. />
  1560. ) : m.type === 'MUSIC_WIKI' ? (
  1561. <MusicDetail
  1562. type="preview"
  1563. id={m.content}
  1564. contentType={m.type}
  1565. activeStatus={popupData.activeIndex === mIndex}
  1566. ref={(el: any) => (m.iframeRef = el)}
  1567. />
  1568. ) : m.type === 'THEORY' ? (
  1569. <TheotyDetail
  1570. type="preview"
  1571. id={m.content}
  1572. activeStatus={popupData.activeIndex === mIndex}
  1573. ref={(el: any) => (m.iframeRef = el)}
  1574. />
  1575. ) : (
  1576. <MusicScore
  1577. activeModel={activeData.model}
  1578. activeStatus={popupData.activeIndex === mIndex}
  1579. data-vid={m.id}
  1580. music={m}
  1581. onSetIframe={(el: any) => {
  1582. m.iframeRef = el;
  1583. }}
  1584. />
  1585. )}
  1586. </div>
  1587. ) : null;
  1588. })}
  1589. </div>
  1590. ) : (
  1591. ''
  1592. )}
  1593. </div>
  1594. </div>
  1595. {/* 右边操作栏 */}
  1596. <div
  1597. class={[
  1598. styles.rightColumn,
  1599. !rightColumnShow.value ? styles.rightColumnHide : '',
  1600. studyData.type !== 'init' &&
  1601. (studyData.penShow || studyData.whiteboardShow)
  1602. ? styles.rightColumnZ
  1603. : ''
  1604. ]}>
  1605. {rightList.map((item: any, index: number) => (
  1606. <div
  1607. class={[
  1608. styles.rightItem,
  1609. (item.id === 2 && data.preStudentNum <= 0) ||
  1610. (item.id === 10 && studyData.callStudentList.length <= 0)
  1611. ? styles.itemDisabled
  1612. : '',
  1613. item.id === 10 && !data.classId ? styles.itemHide : ''
  1614. ]}
  1615. onClick={() => operateRightBtn(item.id)}>
  1616. <NTooltip showArrow={false} placement="left">
  1617. {{
  1618. trigger: () => <img src={item.icon} />,
  1619. default: (
  1620. <>
  1621. {index === rightList.length - 2 && data.type === 'preview'
  1622. ? item.name2
  1623. : item.name}
  1624. </>
  1625. )
  1626. }}
  1627. </NTooltip>
  1628. </div>
  1629. ))}
  1630. </div>
  1631. {!rightColumnShow.value && (
  1632. <img
  1633. class={[
  1634. styles.rightHideIcon,
  1635. !rightColumnShow.value ? styles.rightIconShow : ''
  1636. ]}
  1637. src={rightHideIcon}
  1638. onClick={() => (rightColumnShow.value = true)}
  1639. />
  1640. )}
  1641. {/* 右下角悬浮按钮 */}
  1642. <div class={styles.bottomColumn}>
  1643. {bottomList.map((item: any, index: number) => (
  1644. <div
  1645. class={[
  1646. styles.bottomItem,
  1647. (item.id === 3 && !isUpArrow.value) ||
  1648. (item.id === 4 && !isDownArrow.value)
  1649. ? styles.itemDisabled
  1650. : ''
  1651. ]}
  1652. onClick={() => operateBottomBtn(item.id)}>
  1653. <NTooltip showArrow={false} placement="top">
  1654. {{
  1655. trigger: () => <img src={item.icon} />,
  1656. default: <>{item.name}</>
  1657. }}
  1658. </NTooltip>
  1659. {/* <img src={item.icon} />
  1660. <div class={styles.bottomTips}>{item.name}</div> */}
  1661. </div>
  1662. ))}
  1663. </div>
  1664. {/* 显示列表 */}
  1665. <NDrawer
  1666. v-model:show={popupData.open}
  1667. class={[styles.drawerContainer, styles.drawerContainerSource]}
  1668. onAfterLeave={handleClosePopup}
  1669. showMask={false}
  1670. blockScroll={false}
  1671. trapFocus={false}>
  1672. <NDrawerContent closable>
  1673. {{
  1674. header: () => (
  1675. <TheNoticeBar text={activeName.value || '资源列表'} />
  1676. ),
  1677. default: () => (
  1678. <SourceList
  1679. teacherChapterName={data.teacherChapterName}
  1680. knowledgePointList={data.knowledgePointList}
  1681. courseActiveIndex={popupData.courseActiveIndex}
  1682. activeItem={data.itemList[popupData.activeIndex]}
  1683. onConfirm={(item: any) => {
  1684. popupData.open = false;
  1685. toggleMaterial(item.id);
  1686. }}
  1687. />
  1688. )
  1689. }}
  1690. </NDrawerContent>
  1691. </NDrawer>
  1692. {/* 显示列表 */}
  1693. <NDrawer
  1694. v-model:show={popupData.chapterOpen}
  1695. class={styles.drawerContainer}
  1696. onAfterLeave={handleClosePopup}
  1697. showMask={false}
  1698. maskClosable={data.selectClassStatus ? false : true}
  1699. blockScroll={false}
  1700. trapFocus={false}>
  1701. <NDrawerContent title="切换章节" closable>
  1702. <Chapter
  1703. treeList={popupData.chapterDetails}
  1704. itemActive={data.detailId as any}
  1705. onHandleSelect={async (val: any) => {
  1706. // itemActive: child.id,
  1707. // itemName: child.name
  1708. popupData.courseId = val.itemActive;
  1709. data.selectClassStatus = true;
  1710. }}
  1711. />
  1712. </NDrawerContent>
  1713. </NDrawer>
  1714. {/* 批注 */}
  1715. {studyData.penShow && (
  1716. <Pen
  1717. show={studyData.type === 'pen'}
  1718. type={studyData.type}
  1719. close={() => closeStudyTool()}
  1720. />
  1721. )}
  1722. {studyData.whiteboardShow && (
  1723. <Pen
  1724. show={studyData.type === 'whiteboard'}
  1725. type={studyData.type}
  1726. close={() => closeStudyTool()}
  1727. />
  1728. )}
  1729. {studyData.callShow && (
  1730. <Pen
  1731. callStudents={studyData.callStudentList}
  1732. show={studyData.type === 'call'}
  1733. type={studyData.type}
  1734. close={() => closeStudyTool()}
  1735. />
  1736. )}
  1737. {/* 选择课件 */}
  1738. <NModal
  1739. transformOrigin="center"
  1740. v-model:show={data.selectClassStatus}
  1741. preset="card"
  1742. class={[
  1743. 'modalTitle background',
  1744. // styles.attendClassModal,
  1745. styles.selectClassModal
  1746. ]}
  1747. title={'选择课件'}>
  1748. <SelectClass
  1749. classId={data.classId}
  1750. courseId={popupData.courseId}
  1751. subjectId={data.subjectId}
  1752. lessonCoursewareSubjectList={data.lessonCoursewareSubjectList}
  1753. onConfirm={async (val: any) => {
  1754. popupData.chapterLoading = true;
  1755. try {
  1756. data.selectClassStatus = false;
  1757. data.detailId = val.itemActive;
  1758. data.courseId = val.chapterId;
  1759. const ids = formatParentId(
  1760. val.itemActive,
  1761. popupData.chapterDetails
  1762. );
  1763. data.lessonCoursewareDetailId = ids[0];
  1764. // 更新上课记录 上课的时候才更新
  1765. if (data.type !== 'preview') {
  1766. await classCourseScheduleUpdate();
  1767. }
  1768. await getDetail();
  1769. popupData.activeIndex = 0;
  1770. popupData.chapterOpen = false;
  1771. } catch {
  1772. //
  1773. }
  1774. popupData.chapterLoading = false;
  1775. }}
  1776. />
  1777. </NModal>
  1778. {/* 布置作业 */}
  1779. <NModal
  1780. transformOrigin="center"
  1781. v-model:show={data.modelAttendStatus}
  1782. preset="card"
  1783. title={'课后作业'}
  1784. class={['modalTitle', styles.removeVisiable]}>
  1785. <div class={styles.studentRemove}>
  1786. <p>{data.modalAttendMessage}</p>
  1787. <NSpace class={styles.btnGroupModal} justify="center">
  1788. <NButton
  1789. type="default"
  1790. round
  1791. onClick={() => {
  1792. data.modelTrainStatus = true;
  1793. nextTick(() => {
  1794. getModalHeight();
  1795. });
  1796. data.modelAttendStatus = false;
  1797. }}>
  1798. 布置作业
  1799. </NButton>
  1800. <NButton
  1801. type="primary"
  1802. round
  1803. onClick={() => {
  1804. handleStop();
  1805. data.modelAttendStatus = false;
  1806. }}>
  1807. 取消
  1808. </NButton>
  1809. </NSpace>
  1810. </div>
  1811. </NModal>
  1812. {/* 训练设置 */}
  1813. {/* <NModal
  1814. transformOrigin="center"
  1815. v-model:show={data.modelTrainStatus}
  1816. preset="card"
  1817. class={[styles.attendClassModal, styles.trainClassModal]}
  1818. title={'作业设置'}>
  1819. <ClassWork
  1820. detailId={data.detailId}
  1821. subjectId={data.subjectId}
  1822. courseScheduleId={data.classId}
  1823. activeName={activeName.value}
  1824. classGroupId={data.classGroupId}
  1825. onClose={() => (data.modelTrainStatus = false)}
  1826. />
  1827. </NModal> */}
  1828. <NModal
  1829. v-model:show={data.modelTrainStatus}
  1830. preset="card"
  1831. class={['modalTitle background', styles.workVisiable]}
  1832. title={'布置作业'}>
  1833. <div id="model-homework-height" class={styles.workContainer}>
  1834. <div class={styles.workTrain}>
  1835. <Train
  1836. cardType="homeworkRecord"
  1837. lessonPreTraining={{
  1838. title: data.lessonPreTrainingId
  1839. ? ''
  1840. : data.teacherChapterName + '-课后作业',
  1841. chapterId: data.courseId, // 课件编号
  1842. id: data.lessonPreTrainingId // 作业编号
  1843. }}
  1844. classGroupId={data.classGroupId}
  1845. courseScheduleId={data.classId}
  1846. onChange={(val: any) => {
  1847. data.modelTrainStatus = val.status;
  1848. // getCoursewareList();
  1849. }}
  1850. />
  1851. </div>
  1852. <div class={styles.resourceMain}>
  1853. <ResourceMain cardType="homerowk-record" />
  1854. </div>
  1855. </div>
  1856. </NModal>
  1857. <NModal
  1858. transformOrigin="center"
  1859. class={['modalTitle background']}
  1860. title={'节拍器'}
  1861. preset="card"
  1862. v-model:show={showModalBeat.value}
  1863. style={{ width: '687px' }}>
  1864. <div class={styles.modeWrap}>
  1865. <iframe
  1866. src={`${vaildUrl()}/metronome/?id=${new Date().getTime()}`}
  1867. scrolling="no"
  1868. frameborder="0"
  1869. width="100%"
  1870. onLoad={(val: any) => {
  1871. iframeDislableKeyboard(val.target);
  1872. }}
  1873. height={'650px'}></iframe>
  1874. </div>
  1875. </NModal>
  1876. <NModal
  1877. transformOrigin="center"
  1878. class={['background']}
  1879. v-model:show={showModalTone.value}>
  1880. <div>
  1881. <PlaceholderTone
  1882. onClose={() => {
  1883. showModalTone.value = false;
  1884. }}></PlaceholderTone>
  1885. </div>
  1886. </NModal>
  1887. <NModal
  1888. transformOrigin="center"
  1889. v-model:show={showModalTime.value}
  1890. class={['modalTitle background']}
  1891. title={'计时器'}
  1892. preset="card"
  1893. style={{ width: px2vw(772) }}>
  1894. <div>
  1895. <TimerMeter></TimerMeter>
  1896. </div>
  1897. </NModal>
  1898. <NModal
  1899. v-model:show={data.selectResourceStatus}
  1900. class={['modalTitle', styles.selectMusicModal]}
  1901. preset="card"
  1902. title={'选择资源'}>
  1903. <SelectResources from="class" />
  1904. </NModal>
  1905. <NModal
  1906. transformOrigin="center"
  1907. v-model:show={data.removeVisiable}
  1908. preset="card"
  1909. class={['modalTitle', styles.removeVisiable]}
  1910. title={data.removeTitle}>
  1911. <div class={styles.studentRemove}>
  1912. <p>{data.removeContent}</p>
  1913. <NSpace class={styles.btnGroupModal} justify="center">
  1914. <NButton
  1915. round
  1916. onClick={() => {
  1917. if (data.removeCourseStatus) {
  1918. if (globalState.application) {
  1919. document.exitFullscreen
  1920. ? document.exitFullscreen()
  1921. : document.mozCancelFullScreen
  1922. ? document.mozCancelFullScreen()
  1923. : document.webkitExitFullscreen
  1924. ? document.webkitExitFullscreen()
  1925. : '';
  1926. emit('close');
  1927. } else {
  1928. window.close();
  1929. }
  1930. } else {
  1931. data.removeVisiable = false;
  1932. }
  1933. }}>
  1934. {data.removeCourseStatus ? '结束课程' : '取消'}
  1935. </NButton>
  1936. <NButton
  1937. round
  1938. type="primary"
  1939. onClick={() => {
  1940. //
  1941. if (data.removeCourseStatus) {
  1942. data.modelTrainStatus = true;
  1943. data.removeVisiable = false;
  1944. nextTick(() => {
  1945. getModalHeight();
  1946. });
  1947. } else {
  1948. if (globalState.application) {
  1949. document.exitFullscreen
  1950. ? document.exitFullscreen()
  1951. : document.mozCancelFullScreen
  1952. ? document.mozCancelFullScreen()
  1953. : document.webkitExitFullscreen
  1954. ? document.webkitExitFullscreen()
  1955. : '';
  1956. emit('close');
  1957. } else {
  1958. window.close();
  1959. if (route.query.source === 'admin') {
  1960. storage.remove(ACCESS_TOKEN_ADMIN);
  1961. window.parent.postMessage(
  1962. {
  1963. api: 'iframe_exit'
  1964. },
  1965. '*'
  1966. );
  1967. }
  1968. }
  1969. }
  1970. }}>
  1971. {data.removeCourseStatus ? '布置作业' : '确定'}
  1972. </NButton>
  1973. </NSpace>
  1974. </div>
  1975. </NModal>
  1976. </div>
  1977. );
  1978. }
  1979. });