index.tsx 66 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081
  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 { 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. const tempRows = res.data.chapterKnowledgeList || [];
  224. const temp: any = [];
  225. const allItem: any = [];
  226. tempRows.forEach((row: any, index: number) => {
  227. if (!Array.isArray(row.chapterKnowledgeMaterialList)) {
  228. return;
  229. }
  230. const childList: any[] = [];
  231. row.chapterKnowledgeMaterialList.forEach((child: any) => {
  232. if (!child.removeFlag) {
  233. childList.push({
  234. id: child.id,
  235. materialId: child.bizId,
  236. coverImg: child.bizInfo.coverImg,
  237. type: child.type,
  238. title: child.bizInfo.name,
  239. dataJson: child.dataJson,
  240. isCollect: !!child.favoriteFlag,
  241. isSelected: child.source === 'PLATFORM' ? true : false,
  242. content: child.bizInfo.content,
  243. parentIndex: index
  244. });
  245. }
  246. });
  247. temp.push({
  248. title: row.name,
  249. list: childList
  250. });
  251. allItem.push(...childList);
  252. });
  253. console.log(temp, 'temp', tempRows);
  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: 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. ref={(v: any) => (data.audioRefs[mIndex] = v)}
  1498. onLoadedmetadata={(audioItem: any) => {
  1499. m.audioEle = audioItem;
  1500. m.isprepare = true;
  1501. }}
  1502. onTogglePlay={(paused: boolean) => {
  1503. m.autoPlay = false;
  1504. if (paused || popupData.open) {
  1505. clearTimeout(activeData.timer);
  1506. } else {
  1507. setModelOpen();
  1508. }
  1509. }}
  1510. onEnded={() => {
  1511. const _index = popupData.activeIndex + 1;
  1512. if (_index < data.itemList.length) {
  1513. handleSwipeChange(_index);
  1514. }
  1515. }}
  1516. onReset={() => {
  1517. if (!m.audioEle?.paused) {
  1518. setModelOpen();
  1519. }
  1520. }}
  1521. />
  1522. ) : // : m.type === 'PPT' ? <div class={styles.iframePpt}>
  1523. // <div class={styles.pptBox}></div>
  1524. // <iframe src={`https://view.officeapps.live.com/op/embed.aspx?src=${encodeURIComponent(m.content)}`} width='100%' height='100%' frameborder='1'></iframe>
  1525. // </div>
  1526. m.type === 'PPT' ? (
  1527. <iframe
  1528. src={`https://view.officeapps.live.com/op/embed.aspx?src=${encodeURIComponent(
  1529. m.content
  1530. )}`}
  1531. width="100%"
  1532. height="100%"
  1533. frameborder="1"></iframe>
  1534. ) : m.type === 'RHYTHM' ? (
  1535. <RhythmModal
  1536. item={m}
  1537. activeStatus={popupData.activeIndex === mIndex}
  1538. onSetIframe={(el: any) => {
  1539. m.iframeRef = el;
  1540. }}
  1541. />
  1542. ) : m.type === 'LISTEN' ? (
  1543. <ListenModal
  1544. item={m}
  1545. data-vid={m.id}
  1546. activeStatus={popupData.activeIndex === mIndex}
  1547. onSetIframe={(el: any) => {
  1548. m.iframeRef = el;
  1549. }}
  1550. />
  1551. ) : m.type === 'INSTRUMENT' || m.type === 'MUSICIAN' ? (
  1552. <InstruemntDetail
  1553. type="preview"
  1554. id={m.content}
  1555. contentType={m.type}
  1556. activeStatus={popupData.activeIndex === mIndex}
  1557. ref={(el: any) => (m.iframeRef = el)}
  1558. />
  1559. ) : m.type === 'MUSIC_WIKI' ? (
  1560. <MusicDetail
  1561. type="preview"
  1562. id={m.content}
  1563. contentType={m.type}
  1564. activeStatus={popupData.activeIndex === mIndex}
  1565. ref={(el: any) => (m.iframeRef = el)}
  1566. />
  1567. ) : m.type === 'THEORY' ? (
  1568. <TheotyDetail
  1569. type="preview"
  1570. id={m.content}
  1571. activeStatus={popupData.activeIndex === mIndex}
  1572. ref={(el: any) => (m.iframeRef = el)}
  1573. />
  1574. ) : (
  1575. <MusicScore
  1576. activeModel={activeData.model}
  1577. activeStatus={popupData.activeIndex === mIndex}
  1578. data-vid={m.id}
  1579. music={m}
  1580. onSetIframe={(el: any) => {
  1581. m.iframeRef = el;
  1582. }}
  1583. />
  1584. )}
  1585. </div>
  1586. ) : null;
  1587. })}
  1588. </div>
  1589. ) : (
  1590. ''
  1591. )}
  1592. </div>
  1593. </div>
  1594. {/* 右边操作栏 */}
  1595. <div
  1596. class={[
  1597. styles.rightColumn,
  1598. !rightColumnShow.value ? styles.rightColumnHide : '',
  1599. studyData.type !== 'init' &&
  1600. (studyData.penShow || studyData.whiteboardShow)
  1601. ? styles.rightColumnZ
  1602. : ''
  1603. ]}>
  1604. {rightList.map((item: any, index: number) => (
  1605. <div
  1606. class={[
  1607. styles.rightItem,
  1608. (item.id === 2 && data.preStudentNum <= 0) ||
  1609. (item.id === 10 && studyData.callStudentList.length <= 0)
  1610. ? styles.itemDisabled
  1611. : '',
  1612. item.id === 10 && !data.classId ? styles.itemHide : ''
  1613. ]}
  1614. onClick={() => operateRightBtn(item.id)}>
  1615. <NTooltip showArrow={false} placement="left">
  1616. {{
  1617. trigger: () => <img src={item.icon} />,
  1618. default: (
  1619. <>
  1620. {index === rightList.length - 2 && data.type === 'preview'
  1621. ? item.name2
  1622. : item.name}
  1623. </>
  1624. )
  1625. }}
  1626. </NTooltip>
  1627. </div>
  1628. ))}
  1629. </div>
  1630. {!rightColumnShow.value && (
  1631. <img
  1632. class={[
  1633. styles.rightHideIcon,
  1634. !rightColumnShow.value ? styles.rightIconShow : ''
  1635. ]}
  1636. src={rightHideIcon}
  1637. onClick={() => (rightColumnShow.value = true)}
  1638. />
  1639. )}
  1640. {/* 右下角悬浮按钮 */}
  1641. <div class={styles.bottomColumn}>
  1642. {bottomList.map((item: any, index: number) => (
  1643. <div
  1644. class={[
  1645. styles.bottomItem,
  1646. (item.id === 3 && !isUpArrow.value) ||
  1647. (item.id === 4 && !isDownArrow.value)
  1648. ? styles.itemDisabled
  1649. : ''
  1650. ]}
  1651. onClick={() => operateBottomBtn(item.id)}>
  1652. <NTooltip showArrow={false} placement="top">
  1653. {{
  1654. trigger: () => <img src={item.icon} />,
  1655. default: <>{item.name}</>
  1656. }}
  1657. </NTooltip>
  1658. {/* <img src={item.icon} />
  1659. <div class={styles.bottomTips}>{item.name}</div> */}
  1660. </div>
  1661. ))}
  1662. </div>
  1663. {/* 显示列表 */}
  1664. <NDrawer
  1665. v-model:show={popupData.open}
  1666. class={[styles.drawerContainer, styles.drawerContainerSource]}
  1667. onAfterLeave={handleClosePopup}
  1668. showMask={false}
  1669. blockScroll={false}
  1670. trapFocus={false}>
  1671. <NDrawerContent closable>
  1672. {{
  1673. header: () => (
  1674. <TheNoticeBar text={activeName.value || '资源列表'} />
  1675. ),
  1676. default: () => (
  1677. <SourceList
  1678. teacherChapterName={data.teacherChapterName}
  1679. knowledgePointList={data.knowledgePointList}
  1680. courseActiveIndex={popupData.courseActiveIndex}
  1681. activeItem={data.itemList[popupData.activeIndex]}
  1682. onConfirm={(item: any) => {
  1683. popupData.open = false;
  1684. toggleMaterial(item.id);
  1685. }}
  1686. />
  1687. )
  1688. }}
  1689. </NDrawerContent>
  1690. </NDrawer>
  1691. {/* 显示列表 */}
  1692. <NDrawer
  1693. v-model:show={popupData.chapterOpen}
  1694. class={styles.drawerContainer}
  1695. onAfterLeave={handleClosePopup}
  1696. showMask={false}
  1697. maskClosable={data.selectClassStatus ? false : true}
  1698. blockScroll={false}
  1699. trapFocus={false}>
  1700. <NDrawerContent title="切换章节" closable>
  1701. <Chapter
  1702. treeList={popupData.chapterDetails}
  1703. itemActive={data.detailId as any}
  1704. onHandleSelect={async (val: any) => {
  1705. // itemActive: child.id,
  1706. // itemName: child.name
  1707. popupData.courseId = val.itemActive;
  1708. data.selectClassStatus = true;
  1709. }}
  1710. />
  1711. </NDrawerContent>
  1712. </NDrawer>
  1713. {/* 批注 */}
  1714. {studyData.penShow && (
  1715. <Pen
  1716. show={studyData.type === 'pen'}
  1717. type={studyData.type}
  1718. close={() => closeStudyTool()}
  1719. />
  1720. )}
  1721. {studyData.whiteboardShow && (
  1722. <Pen
  1723. show={studyData.type === 'whiteboard'}
  1724. type={studyData.type}
  1725. close={() => closeStudyTool()}
  1726. />
  1727. )}
  1728. {studyData.callShow && (
  1729. <Pen
  1730. callStudents={studyData.callStudentList}
  1731. show={studyData.type === 'call'}
  1732. type={studyData.type}
  1733. close={() => closeStudyTool()}
  1734. />
  1735. )}
  1736. {/* 选择课件 */}
  1737. <NModal
  1738. transformOrigin="center"
  1739. v-model:show={data.selectClassStatus}
  1740. preset="card"
  1741. class={[
  1742. 'modalTitle background',
  1743. // styles.attendClassModal,
  1744. styles.selectClassModal
  1745. ]}
  1746. title={'选择课件'}>
  1747. <SelectClass
  1748. classId={data.classId}
  1749. courseId={popupData.courseId}
  1750. subjectId={data.subjectId}
  1751. lessonCoursewareSubjectList={data.lessonCoursewareSubjectList}
  1752. onConfirm={async (val: any) => {
  1753. popupData.chapterLoading = true;
  1754. try {
  1755. data.selectClassStatus = false;
  1756. data.detailId = val.itemActive;
  1757. data.courseId = val.chapterId;
  1758. const ids = formatParentId(
  1759. val.itemActive,
  1760. popupData.chapterDetails
  1761. );
  1762. data.lessonCoursewareDetailId = ids[0];
  1763. // 更新上课记录 上课的时候才更新
  1764. if (data.type !== 'preview') {
  1765. await classCourseScheduleUpdate();
  1766. }
  1767. await getDetail();
  1768. popupData.activeIndex = 0;
  1769. popupData.chapterOpen = false;
  1770. } catch {
  1771. //
  1772. }
  1773. popupData.chapterLoading = false;
  1774. }}
  1775. />
  1776. </NModal>
  1777. {/* 布置作业 */}
  1778. <NModal
  1779. transformOrigin="center"
  1780. v-model:show={data.modelAttendStatus}
  1781. preset="card"
  1782. title={'课后作业'}
  1783. class={['modalTitle', styles.removeVisiable]}>
  1784. <div class={styles.studentRemove}>
  1785. <p>{data.modalAttendMessage}</p>
  1786. <NSpace class={styles.btnGroupModal} justify="center">
  1787. <NButton
  1788. type="default"
  1789. round
  1790. onClick={() => {
  1791. data.modelTrainStatus = true;
  1792. nextTick(() => {
  1793. getModalHeight();
  1794. });
  1795. data.modelAttendStatus = false;
  1796. }}>
  1797. 布置作业
  1798. </NButton>
  1799. <NButton
  1800. type="primary"
  1801. round
  1802. onClick={() => {
  1803. handleStop();
  1804. data.modelAttendStatus = false;
  1805. }}>
  1806. 取消
  1807. </NButton>
  1808. </NSpace>
  1809. </div>
  1810. </NModal>
  1811. {/* 训练设置 */}
  1812. {/* <NModal
  1813. transformOrigin="center"
  1814. v-model:show={data.modelTrainStatus}
  1815. preset="card"
  1816. class={[styles.attendClassModal, styles.trainClassModal]}
  1817. title={'作业设置'}>
  1818. <ClassWork
  1819. detailId={data.detailId}
  1820. subjectId={data.subjectId}
  1821. courseScheduleId={data.classId}
  1822. activeName={activeName.value}
  1823. classGroupId={data.classGroupId}
  1824. onClose={() => (data.modelTrainStatus = false)}
  1825. />
  1826. </NModal> */}
  1827. <NModal
  1828. v-model:show={data.modelTrainStatus}
  1829. preset="card"
  1830. class={['modalTitle background', styles.workVisiable]}
  1831. title={'布置作业'}>
  1832. <div id="model-homework-height" class={styles.workContainer}>
  1833. <div class={styles.workTrain}>
  1834. <Train
  1835. cardType="homeworkRecord"
  1836. lessonPreTraining={{
  1837. title: data.lessonPreTrainingId
  1838. ? ''
  1839. : data.teacherChapterName + '-课后作业',
  1840. chapterId: data.courseId, // 课件编号
  1841. id: data.lessonPreTrainingId // 作业编号
  1842. }}
  1843. classGroupId={data.classGroupId}
  1844. courseScheduleId={data.classId}
  1845. onChange={(val: any) => {
  1846. data.modelTrainStatus = val.status;
  1847. // getCoursewareList();
  1848. }}
  1849. />
  1850. </div>
  1851. <div class={styles.resourceMain}>
  1852. <ResourceMain cardType="homerowk-record" />
  1853. </div>
  1854. </div>
  1855. </NModal>
  1856. <NModal
  1857. transformOrigin="center"
  1858. class={['modalTitle background']}
  1859. title={'节拍器'}
  1860. preset="card"
  1861. v-model:show={showModalBeat.value}
  1862. style={{ width: '687px' }}>
  1863. <div class={styles.modeWrap}>
  1864. <iframe
  1865. src={`${vaildUrl()}/metronome/?id=${new Date().getTime()}`}
  1866. scrolling="no"
  1867. frameborder="0"
  1868. width="100%"
  1869. height={'650px'}></iframe>
  1870. </div>
  1871. </NModal>
  1872. <NModal
  1873. transformOrigin="center"
  1874. class={['background']}
  1875. v-model:show={showModalTone.value}>
  1876. <div>
  1877. <PlaceholderTone
  1878. onClose={() => {
  1879. showModalTone.value = false;
  1880. }}></PlaceholderTone>
  1881. </div>
  1882. </NModal>
  1883. <NModal
  1884. transformOrigin="center"
  1885. v-model:show={showModalTime.value}
  1886. class={['modalTitle background']}
  1887. title={'计时器'}
  1888. preset="card"
  1889. style={{ width: px2vw(772) }}>
  1890. <div>
  1891. <TimerMeter></TimerMeter>
  1892. </div>
  1893. </NModal>
  1894. <NModal
  1895. v-model:show={data.selectResourceStatus}
  1896. class={['modalTitle', styles.selectMusicModal]}
  1897. preset="card"
  1898. title={'选择资源'}>
  1899. <SelectResources from="class" />
  1900. </NModal>
  1901. <NModal
  1902. transformOrigin="center"
  1903. v-model:show={data.removeVisiable}
  1904. preset="card"
  1905. class={['modalTitle', styles.removeVisiable]}
  1906. title={data.removeTitle}>
  1907. <div class={styles.studentRemove}>
  1908. <p>{data.removeContent}</p>
  1909. <NSpace class={styles.btnGroupModal} justify="center">
  1910. <NButton
  1911. round
  1912. onClick={() => {
  1913. if (data.removeCourseStatus) {
  1914. if (globalState.application) {
  1915. document.exitFullscreen
  1916. ? document.exitFullscreen()
  1917. : document.mozCancelFullScreen
  1918. ? document.mozCancelFullScreen()
  1919. : document.webkitExitFullscreen
  1920. ? document.webkitExitFullscreen()
  1921. : '';
  1922. emit('close');
  1923. } else {
  1924. window.close();
  1925. }
  1926. } else {
  1927. data.removeVisiable = false;
  1928. }
  1929. }}>
  1930. {data.removeCourseStatus ? '结束课程' : '取消'}
  1931. </NButton>
  1932. <NButton
  1933. round
  1934. type="primary"
  1935. onClick={() => {
  1936. //
  1937. if (data.removeCourseStatus) {
  1938. data.modelTrainStatus = true;
  1939. data.removeVisiable = false;
  1940. nextTick(() => {
  1941. getModalHeight();
  1942. });
  1943. } else {
  1944. if (globalState.application) {
  1945. document.exitFullscreen
  1946. ? document.exitFullscreen()
  1947. : document.mozCancelFullScreen
  1948. ? document.mozCancelFullScreen()
  1949. : document.webkitExitFullscreen
  1950. ? document.webkitExitFullscreen()
  1951. : '';
  1952. emit('close');
  1953. } else {
  1954. window.close();
  1955. if (route.query.source === 'admin') {
  1956. storage.remove(ACCESS_TOKEN_ADMIN);
  1957. window.parent.postMessage(
  1958. {
  1959. api: 'iframe_exit'
  1960. },
  1961. '*'
  1962. );
  1963. }
  1964. }
  1965. }
  1966. }}>
  1967. {data.removeCourseStatus ? '布置作业' : '确定'}
  1968. </NButton>
  1969. </NSpace>
  1970. </div>
  1971. </NModal>
  1972. </div>
  1973. );
  1974. }
  1975. });