index.tsx 66 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070
  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. for (let i = 0; i < data.itemList.length; i++) {
  442. const activeItem = data.itemList[i];
  443. if (activeItem.type === 'VIDEO' && activeItem.videoEle) {
  444. try {
  445. if (isStop) {
  446. activeItem.videoEle?.currentTime(0);
  447. }
  448. activeItem.videoEle?.pause();
  449. } catch (e: any) {
  450. // console.log(e, 'e');
  451. }
  452. }
  453. if (activeItem.type === 'SONG' && activeItem.audioEle) {
  454. activeItem.audioEle?.stop();
  455. }
  456. // console.log('🚀 ~ activeItem:', activeItem)
  457. // 停止曲谱的播放
  458. if (activeItem.type === 'MUSIC') {
  459. activeItem.iframeRef?.contentWindow?.postMessage(
  460. { api: 'setPlayState' },
  461. '*'
  462. );
  463. }
  464. if (
  465. activeItem.type === 'INSTRUMENT' ||
  466. activeItem.type === 'MUSICIAN' ||
  467. activeItem.type === 'MUSIC_WIKI'
  468. ) {
  469. activeItem.iframeRef?.handleChangeAudio('pause');
  470. }
  471. if (activeItem.type === 'RHYTHM') {
  472. activeItem.iframeRef?.contentWindow?.postMessage(
  473. { api: 'setPlayState', data: false },
  474. '*'
  475. );
  476. }
  477. }
  478. };
  479. // 切换素材
  480. const toggleMaterial = (itemActive: any) => {
  481. const index = data.itemList.findIndex((n: any) => n.id == itemActive);
  482. if (index > -1) {
  483. handleSwipeChange(index);
  484. }
  485. };
  486. /** 延迟收起模态框 */
  487. const setModelOpen = () => {
  488. clearTimeout(activeData.timer);
  489. message.destroyAll();
  490. activeData.timer = setTimeout(() => {
  491. activeData.model = false;
  492. Object.values(data.videoRefs).map((n: any) =>
  493. n?.toggleHideControl(false)
  494. );
  495. Object.values(data.audioRefs).map((n: any) =>
  496. n?.toggleHideControl(false)
  497. );
  498. }, 4000);
  499. };
  500. /** 立即收起所有的模态框 */
  501. const clearModel = () => {
  502. clearTimeout(activeData.timer);
  503. message.destroyAll();
  504. activeData.model = false;
  505. Object.values(data.videoRefs).map((n: any) =>
  506. n?.toggleHideControl(false)
  507. );
  508. Object.values(data.audioRefs).map((n: any) =>
  509. n?.toggleHideControl(false)
  510. );
  511. };
  512. const toggleModel = (type = true) => {
  513. activeData.model = type;
  514. Object.values(data.videoRefs).map((n: any) => n?.toggleHideControl(type));
  515. Object.values(data.audioRefs).map((n: any) => n?.toggleHideControl(type));
  516. };
  517. // 双击
  518. const handleDbClick = (item: any) => {
  519. if (item && item.type === 'VIDEO') {
  520. const videoEle: HTMLVideoElement = item.videoEle;
  521. if (videoEle) {
  522. if (videoEle.paused) {
  523. message.destroyAll();
  524. videoEle.play();
  525. } else {
  526. message.warning('已暂停');
  527. videoEle.pause();
  528. }
  529. }
  530. }
  531. };
  532. // ppt iframe 点击事件
  533. // const iframeClick = () => {
  534. // if(document.all) {
  535. // document.getElementById("iframe-ppt")?.attachEvent("click", () => {
  536. // activeData.model = !activeData.model
  537. // });
  538. // } else {
  539. // document.getElementById("iframe-ppt")?.contentWindow?.postMessage({
  540. // api: 'onAttendToggleMenu'
  541. // }, '*');
  542. // }
  543. // }
  544. // 切换播放
  545. // const togglePlay = (m: any, isPlay: boolean) => {
  546. // if (isPlay) {
  547. // m.videoEle?.play();
  548. // } else {
  549. // m.videoEle?.pause();
  550. // }
  551. // };
  552. // const showIndex = ref(-4);
  553. const effectIndex = ref(3);
  554. const effects = [
  555. {
  556. prev: {
  557. transform: 'translate3d(0, 0, -800px) rotateX(180deg)'
  558. },
  559. next: {
  560. transform: 'translate3d(0, 0, -800px) rotateX(-180deg)'
  561. }
  562. },
  563. {
  564. prev: {
  565. transform: 'translate3d(-100%, 0, -800px)'
  566. },
  567. next: {
  568. transform: 'translate3d(100%, 0, -800px)'
  569. }
  570. },
  571. {
  572. prev: {
  573. transform: 'translate3d(-50%, 0, -800px) rotateY(80deg)'
  574. },
  575. next: {
  576. transform: 'translate3d(50%, 0, -800px) rotateY(-80deg)'
  577. }
  578. },
  579. {
  580. prev: {
  581. transform: 'translate3d(-100%, 0, -800px) rotateY(-120deg)'
  582. },
  583. next: {
  584. transform: 'translate3d(100%, 0, -800px) rotateY(120deg)'
  585. }
  586. },
  587. // 风车4
  588. {
  589. prev: {
  590. transform: 'translate3d(-50%, 50%, -800px) rotateZ(-14deg)',
  591. opacity: 0
  592. },
  593. next: {
  594. transform: 'translate3d(50%, 50%, -800px) rotateZ(14deg)',
  595. opacity: 0
  596. }
  597. },
  598. // 翻页5
  599. {
  600. prev: {
  601. transform: 'translateZ(-800px) rotate3d(0, -1, 0, 90deg)',
  602. opacity: 0
  603. },
  604. next: {
  605. transform: 'translateZ(-800px) rotate3d(0, 1, 0, 90deg)',
  606. opacity: 0
  607. },
  608. current: { transitionDelay: '700ms' }
  609. }
  610. ];
  611. const acitveTimer = ref();
  612. // 轮播切换
  613. const handleSwipeChange = (index: number) => {
  614. // 如果是当前正在播放 或者是视频最后一个
  615. if (popupData.activeIndex == index) return;
  616. data.animationState = 'start';
  617. data.videoState = 'init';
  618. handleStop();
  619. clearTimeout(acitveTimer.value);
  620. activeData.model = true;
  621. checkedAnimation(popupData.activeIndex, index);
  622. popupData.activeIndex = index;
  623. // 处理资源列表滚动
  624. nextTick(() => {
  625. scrollResourceSection();
  626. });
  627. acitveTimer.value = setTimeout(
  628. () => {
  629. const item = data.itemList[index];
  630. if (item) {
  631. if (item.type == 'MUSIC') {
  632. activeData.model = true;
  633. }
  634. if (item.type === 'SONG') {
  635. // 自动播放下一个音频
  636. clearTimeout(activeData.timer);
  637. message.destroyAll();
  638. // item.autoPlay = false;
  639. // nextTick(() => {
  640. // item.audioEle?.onPlay();
  641. // });
  642. }
  643. if (item.type === 'VIDEO') {
  644. // 自动播放下一个视频
  645. clearTimeout(activeData.timer);
  646. message.destroyAll();
  647. nextTick(() => {
  648. if (item.error) {
  649. // console.log(item, 'item error');
  650. item.videoEle?.src(item.content);
  651. item.error = false;
  652. // item.videoEle?.onPlay();
  653. }
  654. data.animationState = 'end';
  655. });
  656. }
  657. if (item.type === 'PPT') {
  658. //
  659. }
  660. }
  661. },
  662. activeData.isAnimation ? 800 : 0
  663. );
  664. };
  665. /** 是否有转场动画 */
  666. const checkedAnimation = (index: number, nextIndex?: number) => {
  667. const item = data.itemList[index];
  668. const nextItem = data.itemList[nextIndex!];
  669. if (nextItem) {
  670. if (nextItem.knowledgePointId != item.knowledgePointId) {
  671. activeData.isAnimation = true;
  672. return;
  673. }
  674. const videoEle = item.videoEle;
  675. const nextVideo = nextItem.videoEle;
  676. if (videoEle && videoEle.duration < 8 && index < nextIndex!) {
  677. activeData.isAnimation = false;
  678. } else if (nextVideo && nextVideo.duration < 8 && index > nextIndex!) {
  679. activeData.isAnimation = false;
  680. } else {
  681. activeData.isAnimation = true;
  682. }
  683. } else {
  684. activeData.isAnimation = item?.adviseStudyTimeSecond < 8 ? false : true;
  685. }
  686. };
  687. // 上一个知识点, 下一个知识点
  688. const handlePreAndNext = async (type: string) => {
  689. if (type === 'up') {
  690. // 判断上面是否还有章节
  691. if (popupData.activeIndex > 0) {
  692. handleSwipeChange(popupData.activeIndex - 1);
  693. return;
  694. }
  695. // 获取当前是哪个章节
  696. let detailIndex = popupData.chapterDetails.findIndex(
  697. (item: any) => item.id == data.lessonCoursewareDetailId
  698. );
  699. const detailItem =
  700. popupData.chapterDetails[detailIndex]?.knowledgeList || [];
  701. let lessonIndex = detailItem.findIndex(
  702. (item: any) => item.id == data.detailId
  703. );
  704. let lessonStatus = false; // 当前章节上面是否有内容
  705. let lessonCoursewareDetailId = '';
  706. let coursewareDetailKnowledgeId = '';
  707. while (lessonIndex >= 0) {
  708. lessonIndex--;
  709. if (lessonIndex >= 0) {
  710. if (detailItem[lessonIndex].coursewareNum > 0) {
  711. lessonStatus = true;
  712. lessonCoursewareDetailId =
  713. detailItem[lessonIndex].lessonCoursewareDetailId;
  714. coursewareDetailKnowledgeId = detailItem[lessonIndex].id;
  715. }
  716. }
  717. if (lessonStatus) {
  718. break;
  719. }
  720. }
  721. // 判断当前章节下面课程是否有内容,否则往上一个章节走
  722. if (lessonStatus) {
  723. popupData.courseId = coursewareDetailKnowledgeId;
  724. data.selectClassStatus = true;
  725. return;
  726. }
  727. let prevLessonStatus = false;
  728. while (detailIndex >= 0) {
  729. detailIndex--;
  730. const tempDetail =
  731. popupData.chapterDetails[detailIndex]?.knowledgeList || [];
  732. let tempLessonLength = tempDetail.length;
  733. while (tempLessonLength > 0) {
  734. if (tempDetail[tempLessonLength - 1].coursewareNum > 0) {
  735. prevLessonStatus = true;
  736. lessonCoursewareDetailId =
  737. tempDetail[tempLessonLength - 1].lessonCoursewareDetailId;
  738. coursewareDetailKnowledgeId = tempDetail[tempLessonLength - 1].id;
  739. }
  740. tempLessonLength--;
  741. if (prevLessonStatus) {
  742. break;
  743. }
  744. }
  745. if (prevLessonStatus) {
  746. break;
  747. }
  748. }
  749. // 判断当前章节下面课程是否有内容,否则往上一个章节走
  750. if (prevLessonStatus) {
  751. popupData.courseId = coursewareDetailKnowledgeId;
  752. data.selectClassStatus = true;
  753. return;
  754. }
  755. } else {
  756. if (popupData.activeIndex < data.itemList.length - 1) {
  757. handleSwipeChange(popupData.activeIndex + 1);
  758. return;
  759. }
  760. // 获取当前是哪个章节
  761. let detailIndex = popupData.chapterDetails.findIndex(
  762. (item: any) => item.id == data.lessonCoursewareDetailId
  763. );
  764. const detailItem =
  765. popupData.chapterDetails[detailIndex]?.knowledgeList || [];
  766. let lessonIndex = detailItem.findIndex(
  767. (item: any) => item.id == data.detailId
  768. );
  769. let lessonStatus = false; // 当前章节下面是否有内容
  770. let lessonCoursewareDetailId = '';
  771. let coursewareDetailKnowledgeId = '';
  772. while (lessonIndex < detailItem.length - 1) {
  773. lessonIndex++;
  774. if (lessonIndex >= 0) {
  775. if (detailItem[lessonIndex].coursewareNum > 0) {
  776. lessonStatus = true;
  777. lessonCoursewareDetailId =
  778. detailItem[lessonIndex].lessonCoursewareDetailId;
  779. coursewareDetailKnowledgeId = detailItem[lessonIndex].id;
  780. }
  781. }
  782. if (lessonStatus) {
  783. break;
  784. }
  785. }
  786. // 判断当前章节下面课程是否有内容,否则往下一个章节走
  787. if (lessonStatus) {
  788. popupData.courseId = coursewareDetailKnowledgeId;
  789. data.selectClassStatus = true;
  790. return;
  791. }
  792. let nextLessonStatus = false;
  793. while (detailIndex <= popupData.chapterDetails.length - 1) {
  794. detailIndex++;
  795. const tempDetail =
  796. popupData.chapterDetails[detailIndex]?.knowledgeList || [];
  797. let tempLessonLength = 0;
  798. while (tempLessonLength <= tempDetail.length - 1) {
  799. if (tempDetail[tempLessonLength].coursewareNum > 0) {
  800. nextLessonStatus = true;
  801. lessonCoursewareDetailId =
  802. tempDetail[tempLessonLength].lessonCoursewareDetailId;
  803. coursewareDetailKnowledgeId = tempDetail[tempLessonLength].id;
  804. }
  805. tempLessonLength++;
  806. if (nextLessonStatus) {
  807. break;
  808. }
  809. }
  810. if (nextLessonStatus) {
  811. break;
  812. }
  813. }
  814. // 判断当前章节下面课程是否有内容,否则往上一个章节走
  815. if (nextLessonStatus) {
  816. popupData.courseId = coursewareDetailKnowledgeId;
  817. data.selectClassStatus = true;
  818. return;
  819. }
  820. }
  821. };
  822. /** 弹窗关闭 */
  823. const handleClosePopup = () => {
  824. const item = data.itemList[popupData.activeIndex];
  825. if (item?.type == 'VIDEO' && !item.videoEle?.paused) {
  826. setModelOpen();
  827. }
  828. if (item?.type == 'SONG' && !item.audioEle?.paused) {
  829. setModelOpen();
  830. }
  831. };
  832. document.body.addEventListener('keyup', (e: KeyboardEvent) => {
  833. if (e.code === 'ArrowLeft') {
  834. // if (popupData.activeIndex === 0) return;
  835. setModalOpen();
  836. handlePreAndNext('up');
  837. } else if (e.code === 'ArrowRight') {
  838. // if (popupData.activeIndex === data.itemList.length - 1) return;
  839. setModalOpen();
  840. handlePreAndNext('down');
  841. } else if (e.code === 'Space') {
  842. // const activeItem = data.itemList[popupData.activeIndex];
  843. // // // 暂停视频和曲谱的播放
  844. // if (activeItem.type === 'VIDEO' && activeItem.videoEle) {
  845. // activeItem.videoEle?.play();
  846. // }
  847. // if (activeItem.type === 'SONG' && activeItem.audioEle) {
  848. // activeItem.audioEle?.play();
  849. // }
  850. // if (activeItem.type === 'MUSIC') {
  851. // activeItem.iframeRef?.contentWindow?.postMessage(
  852. // { api: 'setPlayState' },
  853. // '*'
  854. // );
  855. // }
  856. }
  857. });
  858. // const toggleListenerKeyUp = (type: string) => {
  859. // if (type === 'remove') {
  860. // document.body.removeEventListener('keyup', () => {
  861. // listenerKeyUpState.value = false;
  862. // });
  863. // } else {
  864. // // 监听页面键盘事件 - 上下切换
  865. // document.body.addEventListener('keyup', (e: KeyboardEvent) => {
  866. // // console.log(e, 'e');
  867. // if (e.code === 'ArrowLeft') {
  868. // // if (popupData.activeIndex === 0) return;
  869. // setModalOpen();
  870. // handlePreAndNext('up');
  871. // } else if (e.code === 'ArrowRight') {
  872. // // if (popupData.activeIndex === data.itemList.length - 1) return;
  873. // setModalOpen();
  874. // handlePreAndNext('down');
  875. // }
  876. // });
  877. // listenerKeyUpState.value = true;
  878. // }
  879. // };
  880. // 监听切换到ppt课件时,手动移除键盘监听器
  881. // watch(() => popupData.activeIndex, () => {
  882. // const activeItem = data.itemList[popupData.activeIndex];
  883. // if (activeItem?.type === 'PPT') {
  884. // toggleListenerKeyUp('remove')
  885. // } else {
  886. // !listenerKeyUpState.value && toggleListenerKeyUp('add')
  887. // }
  888. // })
  889. watch(
  890. () => popupData.activeIndex,
  891. () => {
  892. const item = data.itemList[popupData.activeIndex];
  893. popupData.courseActiveIndex = item.parentIndex;
  894. }
  895. );
  896. const setModalOpen = (status = true) => {
  897. clearTimeout(activeData.timer);
  898. activeData.model = status;
  899. Object.values(data.videoRefs).map((n: any) =>
  900. n?.toggleHideControl(status)
  901. );
  902. Object.values(data.audioRefs).map((n: any) =>
  903. n?.toggleHideControl(status)
  904. );
  905. };
  906. /** 教学数据 */
  907. const studyData = reactive({
  908. type: '' as ToolType,
  909. penShow: false,
  910. whiteboardShow: false,
  911. callShow: false,
  912. callStudentList: [] as any // 学生列表
  913. });
  914. /** 打开教学工具 */
  915. const openStudyTool = (item: ToolItem) => {
  916. handleStop();
  917. clearModel();
  918. popupData.toolOpen = false;
  919. studyData.type = item.type;
  920. switch (item.type) {
  921. case 'pen':
  922. studyData.penShow = true;
  923. break;
  924. case 'whiteboard':
  925. studyData.whiteboardShow = true;
  926. break;
  927. case 'call':
  928. studyData.callShow = true;
  929. break;
  930. }
  931. };
  932. /** 关闭教学工具 */
  933. const closeStudyTool = () => {
  934. studyData.type = 'init';
  935. toggleModel();
  936. setModelOpen();
  937. };
  938. const startShowModal = (
  939. val: 'setTimeIcon' | 'beatIcon' | 'toneIcon' | 'iconNote2'
  940. ) => {
  941. if (val == 'setTimeIcon') {
  942. showModalTime.value = true;
  943. }
  944. if (val == 'beatIcon') {
  945. showModalBeat.value = true;
  946. }
  947. if (val == 'toneIcon') {
  948. showModalTone.value = true;
  949. }
  950. };
  951. // 是否允许上一页
  952. const isUpArrow = computed(() => {
  953. /**
  954. * 1,判断当前课程中是否处在第一个资源;
  955. * 2,判断当前课程是否在当前章节的第一个;
  956. * 3,判断当前章节,当前课程上面还没有其它课程,是否有资源;
  957. * 4,判断当前章节上面还没有其它章节;
  958. * 5,判断上面章节里面课程是否有资源;
  959. */
  960. if (popupData.activeIndex > 0) {
  961. return true;
  962. }
  963. // 获取当前是哪个章节
  964. let detailIndex = popupData.chapterDetails.findIndex(
  965. (item: any) => item.id == data.lessonCoursewareDetailId
  966. );
  967. const detailItem =
  968. popupData.chapterDetails[detailIndex]?.knowledgeList || [];
  969. let lessonIndex = detailItem.findIndex(
  970. (item: any) => item.id == data.detailId
  971. );
  972. // 说明已经是第一单元,第一课
  973. if (detailIndex <= 0 && lessonIndex <= 0) {
  974. return false;
  975. }
  976. let lessonStatus = false; // 当前章节上面是否有内容
  977. while (lessonIndex >= 0) {
  978. lessonIndex--;
  979. if (lessonIndex >= 0) {
  980. if (detailItem[lessonIndex].coursewareNum > 0) {
  981. lessonStatus = true;
  982. }
  983. }
  984. }
  985. // 判断当前章节下面课程是否有内容,否则往上一个章节走
  986. if (lessonStatus) {
  987. return true;
  988. }
  989. // 已经是第一个章节了
  990. if (detailIndex <= 0) {
  991. return false;
  992. }
  993. let prevLessonStatus = false;
  994. while (detailIndex >= 0) {
  995. detailIndex--;
  996. const tempDetail =
  997. popupData.chapterDetails[detailIndex]?.knowledgeList || [];
  998. let tempLessonLength = tempDetail.length;
  999. while (tempLessonLength > 0) {
  1000. if (tempDetail[tempLessonLength - 1].coursewareNum > 0) {
  1001. prevLessonStatus = true;
  1002. }
  1003. tempLessonLength--;
  1004. }
  1005. if (prevLessonStatus) {
  1006. return true;
  1007. }
  1008. }
  1009. return false;
  1010. });
  1011. // 是否允许下一页
  1012. const isDownArrow = computed(() => {
  1013. if (popupData.activeIndex < data.itemList.length - 1) {
  1014. return true;
  1015. }
  1016. // 获取当前是哪个章节
  1017. let detailIndex = popupData.chapterDetails.findIndex(
  1018. (item: any) => item.id == data.lessonCoursewareDetailId
  1019. );
  1020. const detailItem =
  1021. popupData.chapterDetails[detailIndex]?.knowledgeList || [];
  1022. let lessonIndex = detailItem.findIndex(
  1023. (item: any) => item.id == data.detailId
  1024. );
  1025. // 说明已经是最后-单元,最后一课
  1026. if (
  1027. detailIndex >= popupData.chapterDetails.length - 1 &&
  1028. lessonIndex >= detailItem.length - 1
  1029. ) {
  1030. return false;
  1031. }
  1032. let lessonStatus = false; // 当前章节下面是否有内容
  1033. while (lessonIndex < detailItem.length - 1) {
  1034. lessonIndex++;
  1035. if (lessonIndex >= 0) {
  1036. if (detailItem[lessonIndex].coursewareNum > 0) {
  1037. lessonStatus = true;
  1038. }
  1039. }
  1040. }
  1041. // 判断当前章节下面课程是否有内容,否则往下一个章节走
  1042. if (lessonStatus) {
  1043. return true;
  1044. }
  1045. // 已经是最后一个章节了
  1046. if (detailIndex >= popupData.chapterDetails.length - 1) {
  1047. return false;
  1048. }
  1049. let nextLessonStatus = false;
  1050. while (detailIndex < popupData.chapterDetails.length - 1) {
  1051. detailIndex++;
  1052. const tempDetail =
  1053. popupData.chapterDetails[detailIndex]?.knowledgeList || [];
  1054. let tempLessonLength = 0;
  1055. while (tempLessonLength <= tempDetail.length - 1) {
  1056. if (tempDetail[tempLessonLength].coursewareNum > 0) {
  1057. nextLessonStatus = true;
  1058. }
  1059. tempLessonLength++;
  1060. }
  1061. if (nextLessonStatus) {
  1062. return true;
  1063. }
  1064. }
  1065. return false;
  1066. });
  1067. const activeVideoItem = computed(() => {
  1068. const item = data.itemList[popupData.activeIndex];
  1069. if (item && item.type && item.type.toLocaleUpperCase() === 'VIDEO') {
  1070. return item;
  1071. }
  1072. return {};
  1073. });
  1074. // 右侧菜单栏
  1075. const rightList = reactive([
  1076. {
  1077. name: '曲目资源',
  1078. name2: '曲目资源',
  1079. icon: rightIconMusic,
  1080. id: 9
  1081. },
  1082. {
  1083. name: '批注',
  1084. icon: rightIconPostil,
  1085. id: 3
  1086. },
  1087. {
  1088. name: '白板',
  1089. icon: rightIconWhiteboard,
  1090. id: 4
  1091. },
  1092. {
  1093. name: '节拍器',
  1094. icon: rightIconMetronome,
  1095. id: 5
  1096. },
  1097. {
  1098. name: '计时器',
  1099. icon: rightIconTimer,
  1100. id: 7
  1101. },
  1102. // {
  1103. // name: '调音器',
  1104. // icon: rightIconTuner,
  1105. // id: 6
  1106. // },
  1107. {
  1108. name: '点名',
  1109. icon: rightIconCall,
  1110. id: 10
  1111. },
  1112. {
  1113. name: '布置作业',
  1114. icon: rightIconArrange,
  1115. id: 2
  1116. },
  1117. {
  1118. name: '结束课程',
  1119. name2: '结束预览',
  1120. icon: rightIconEnd,
  1121. id: 1
  1122. },
  1123. {
  1124. name: '收起',
  1125. icon: rightIconPackUp,
  1126. id: 8
  1127. }
  1128. ]);
  1129. // 底部菜单栏
  1130. const bottomList = reactive([
  1131. {
  1132. name: '切换章节',
  1133. icon: bottomIconSwitch,
  1134. id: 1
  1135. },
  1136. {
  1137. name: '资源列表',
  1138. icon: bottomIconResource,
  1139. id: 2
  1140. },
  1141. {
  1142. name: '上一张',
  1143. icon: bottomIconPre,
  1144. id: 3
  1145. },
  1146. {
  1147. name: '下一张',
  1148. icon: bottomIconNext,
  1149. id: 4
  1150. }
  1151. ]);
  1152. const rightColumnShow = ref(true);
  1153. // 右边栏操作
  1154. const operateRightBtn = async (id: number) => {
  1155. if (id !== 8) {
  1156. handleStop();
  1157. }
  1158. switch (id) {
  1159. case 1:
  1160. if (data.type === 'preview') {
  1161. data.removeVisiable = true;
  1162. data.removeTitle = '结束预览';
  1163. data.removeContent = '请确认是否结束预览?';
  1164. } else {
  1165. const res = await getStudentAfterWork({
  1166. courseScheduleId: data.classId,
  1167. page: 1,
  1168. rows: 99
  1169. });
  1170. if (res.data.rows && res.data.rows.length) {
  1171. data.removeContent = '请确认是否结束课程?';
  1172. data.removeCourseStatus = false;
  1173. } else {
  1174. data.removeContent = '本次课堂尚未布置作业,是否结束课程?';
  1175. data.removeCourseStatus = true;
  1176. }
  1177. data.removeVisiable = true;
  1178. data.removeTitle = '结束课程';
  1179. }
  1180. break;
  1181. case 2:
  1182. // 学生人数必须大于0,才可以布置作业
  1183. if (data.preStudentNum <= 0) return;
  1184. // const res = await lessonPreTrainingPage({
  1185. // coursewareKnowledgeDetailId: data.detailId,
  1186. // subjectId: data.subjectId,
  1187. // page: 1,
  1188. // rows: 99
  1189. // });
  1190. // if (res.data.rows && res.data.rows.length) {
  1191. // data.modalAttendMessage = '本节课已设置课后作业,是否布置?';
  1192. // }
  1193. // data.modelAttendStatus = true;
  1194. const res = await getStudentAfterWork({
  1195. courseScheduleId: data.classId,
  1196. page: 1,
  1197. rows: 99
  1198. });
  1199. if (res.data.rows && res.data.rows.length) {
  1200. // data.modalAttendMessage = '请确认是否结束课程?';
  1201. data.modalAttendMessage = '本次课程已布置作业,是否继续?';
  1202. data.modelAttendStatus = true;
  1203. } else {
  1204. data.modelTrainStatus = true;
  1205. nextTick(() => {
  1206. getModalHeight();
  1207. });
  1208. data.modelAttendStatus = false;
  1209. }
  1210. break;
  1211. case 3:
  1212. openStudyTool({
  1213. type: 'pen',
  1214. icon: iconNote,
  1215. name: '批注'
  1216. });
  1217. break;
  1218. case 4:
  1219. openStudyTool({
  1220. type: 'whiteboard',
  1221. icon: iconWhite,
  1222. name: '白板'
  1223. });
  1224. break;
  1225. case 5:
  1226. startShowModal('beatIcon');
  1227. break;
  1228. case 6:
  1229. startShowModal('toneIcon');
  1230. break;
  1231. case 7:
  1232. startShowModal('setTimeIcon');
  1233. break;
  1234. case 8:
  1235. rightColumnShow.value = false;
  1236. break;
  1237. case 9:
  1238. // 选择曲目时需要暂停所有播放
  1239. handleStop(false);
  1240. data.selectResourceStatus = true;
  1241. break;
  1242. case 10:
  1243. // 点名
  1244. // await rollCallStudentList();
  1245. if (studyData.callStudentList.length > 0) {
  1246. openStudyTool({
  1247. type: 'call',
  1248. icon: iconWhite,
  1249. name: '点名'
  1250. });
  1251. return;
  1252. }
  1253. break;
  1254. default:
  1255. break;
  1256. }
  1257. };
  1258. // 点名学生列表
  1259. const rollCallStudentList = async () => {
  1260. //
  1261. if (!data.classId) return;
  1262. try {
  1263. const res = await getStudentList({
  1264. classGroupId: data.classGroupId,
  1265. page: 1,
  1266. rows: 999
  1267. });
  1268. const result = res.data || {};
  1269. if (Array.isArray(result.rows) && result.rows.length > 0) {
  1270. const tempStudents: any = [];
  1271. result.rows.forEach((row: any) => {
  1272. tempStudents.push({
  1273. name: row.nickname,
  1274. img: row.avatar
  1275. });
  1276. });
  1277. studyData.callStudentList = [...tempStudents];
  1278. }
  1279. } catch {
  1280. //
  1281. }
  1282. };
  1283. // 底部悬浮按钮操作
  1284. const operateBottomBtn = (id: number) => {
  1285. switch (id) {
  1286. case 1:
  1287. popupData.chapterOpen = true;
  1288. break;
  1289. case 2:
  1290. popupData.open = true;
  1291. nextTick(() => {
  1292. scrollResourceSection();
  1293. });
  1294. break;
  1295. case 3:
  1296. if (!isUpArrow.value) return;
  1297. handlePreAndNext('up');
  1298. break;
  1299. case 4:
  1300. if (!isDownArrow.value) return;
  1301. handlePreAndNext('down');
  1302. break;
  1303. default:
  1304. break;
  1305. }
  1306. };
  1307. // 滚动到某个元素的位置
  1308. const scrollResourceSection = () => {
  1309. const drawerCardItemRefs =
  1310. document.querySelectorAll('.drawerCardItemRef');
  1311. if (
  1312. popupData.activeIndex >= 0 &&
  1313. drawerCardItemRefs[popupData.activeIndex]
  1314. ) {
  1315. drawerCardItemRefs[popupData.activeIndex].scrollIntoView();
  1316. }
  1317. };
  1318. const getModalHeight = () => {
  1319. const dom: any = document.querySelector('#model-homework-height');
  1320. if (dom) {
  1321. useResizeObserver(dom as HTMLElement, (entries: any) => {
  1322. const entry = entries[0];
  1323. const { height } = entry.contentRect;
  1324. dom.style.setProperty('--window-page-lesson-height', height + 'px');
  1325. });
  1326. }
  1327. };
  1328. return () => (
  1329. <div id="playContent" class={[styles.playContent, 'wrap']}>
  1330. <div
  1331. onClick={() => {
  1332. clearTimeout(activeData.timer);
  1333. activeData.model = !activeData.model;
  1334. Object.values(data.videoRefs).map((n: any) =>
  1335. n?.toggleHideControl(activeData.model)
  1336. );
  1337. Object.values(data.audioRefs).map((n: any) =>
  1338. n?.toggleHideControl(activeData.model)
  1339. );
  1340. }}>
  1341. <div
  1342. class={styles.coursewarePlay}
  1343. style={{ width: parentContainer.width }}>
  1344. {!popupData.chapterLoading ? (
  1345. <div class={styles.wraps}>
  1346. <div
  1347. style={
  1348. activeVideoItem.value.type &&
  1349. data.animationState === 'end' &&
  1350. data.videoState === 'play'
  1351. ? {
  1352. zIndex: 15,
  1353. opacity: 1
  1354. }
  1355. : { opacity: 0, zIndex: -1 }
  1356. }
  1357. class={styles.itemDiv}>
  1358. <VideoPlay
  1359. ref={(el: any) => (data.videoItemRef = el)}
  1360. item={activeVideoItem.value}
  1361. showModel={activeData.model}
  1362. onClose={setModelOpen}
  1363. onLoadedmetadata={(videoItem: any) => {
  1364. if (data.itemList[popupData.activeIndex]) {
  1365. data.itemList[popupData.activeIndex].videoEle =
  1366. videoItem;
  1367. }
  1368. }}
  1369. onCanplay={() => {
  1370. data.videoState = 'play';
  1371. // activeVideoItem.value.videoEle = videoItem;
  1372. }}
  1373. onPause={() => {
  1374. clearTimeout(activeData.timer);
  1375. activeData.model = true;
  1376. }}
  1377. onEnded={() => {
  1378. const _index = popupData.activeIndex + 1;
  1379. if (_index < data.itemList.length) {
  1380. handleSwipeChange(_index);
  1381. }
  1382. }}
  1383. />
  1384. </div>
  1385. {data.itemList.map((m: any, mIndex: number) => {
  1386. const isRender = Math.abs(popupData.activeIndex - mIndex) < 2;
  1387. const isEmtry = Math.abs(popupData.activeIndex - mIndex) > 4;
  1388. // if (isRender && m.type === 'PPT') {
  1389. // setTimeout(() => iframeClick() ,500)
  1390. // }
  1391. // if (isRender) {
  1392. // m.isRender = true;
  1393. // }
  1394. // const isRender =
  1395. // m.isRender || Math.abs(popupData.activeIndex - mIndex) < 2;
  1396. // const isEmtry = Math.abs(popupData.activeIndex - mIndex) > 4;
  1397. // if (isRender) {
  1398. // m.isRender = true;
  1399. // }
  1400. return isRender ? (
  1401. <div
  1402. key={'index' + mIndex}
  1403. class={[
  1404. styles.itemDiv,
  1405. popupData.activeIndex === mIndex && styles.itemActive,
  1406. activeData.isAnimation && styles.acitveAnimation,
  1407. Math.abs(popupData.activeIndex - mIndex) < 2
  1408. ? styles.show
  1409. : styles.hide
  1410. ]}
  1411. style={
  1412. mIndex < popupData.activeIndex
  1413. ? effects[effectIndex.value].prev
  1414. : mIndex > popupData.activeIndex
  1415. ? effects[effectIndex.value].next
  1416. : {}
  1417. }
  1418. onClick={(e: Event) => {
  1419. e.stopPropagation();
  1420. clearTimeout(activeData.timer);
  1421. if (Date.now() - activeData.nowTime < 300) {
  1422. handleDbClick(m);
  1423. return;
  1424. }
  1425. activeData.nowTime = Date.now();
  1426. activeData.timer = setTimeout(() => {
  1427. activeData.model = !activeData.model;
  1428. Object.values(data.videoRefs).map((n: any) =>
  1429. n?.toggleHideControl(activeData.model)
  1430. );
  1431. Object.values(data.audioRefs).map((n: any) =>
  1432. n?.toggleHideControl(activeData.model)
  1433. );
  1434. if (activeData.model) {
  1435. setModelOpen();
  1436. }
  1437. }, 300);
  1438. }}>
  1439. {m.type === 'VIDEO' ? (
  1440. <>
  1441. <img
  1442. src={m.coverImg}
  1443. onLoad={() => {
  1444. m.isprepare = true;
  1445. }}
  1446. />
  1447. {/* <VideoPlay
  1448. ref={(v: any) => (data.videoRefs[mIndex] = v)}
  1449. item={m}
  1450. isEmtry={isEmtry}
  1451. onLoadedmetadata={(videoItem: any) => {
  1452. m.videoEle = videoItem;
  1453. m.isprepare = true;
  1454. }}
  1455. onTogglePlay={(paused: boolean) => {
  1456. m.autoPlay = false;
  1457. if (paused || popupData.open) {
  1458. clearTimeout(activeData.timer);
  1459. } else {
  1460. setModelOpen();
  1461. }
  1462. }}
  1463. onReset={() => {
  1464. if (!m.videoEle?.paused) {
  1465. setModelOpen();
  1466. }
  1467. }}
  1468. onError={() => {
  1469. console.log('video error');
  1470. m.error = true;
  1471. }}
  1472. /> */}
  1473. <Transition name="van-fade">
  1474. {
  1475. <div class={styles.loadWrap}>
  1476. <Vue3Lottie
  1477. animationData={playLoadData}></Vue3Lottie>
  1478. </div>
  1479. }
  1480. </Transition>
  1481. </>
  1482. ) : m.type === 'IMG' ? (
  1483. <img src={m.content} />
  1484. ) : m.type === 'SONG' ? (
  1485. <AudioPay
  1486. item={m}
  1487. ref={(v: any) => (data.audioRefs[mIndex] = v)}
  1488. onLoadedmetadata={(audioItem: any) => {
  1489. m.audioEle = audioItem;
  1490. m.isprepare = true;
  1491. }}
  1492. onTogglePlay={(paused: boolean) => {
  1493. m.autoPlay = false;
  1494. if (paused || popupData.open) {
  1495. clearTimeout(activeData.timer);
  1496. } else {
  1497. setModelOpen();
  1498. }
  1499. }}
  1500. onEnded={() => {
  1501. const _index = popupData.activeIndex + 1;
  1502. if (_index < data.itemList.length) {
  1503. handleSwipeChange(_index);
  1504. }
  1505. }}
  1506. onReset={() => {
  1507. if (!m.audioEle?.paused) {
  1508. setModelOpen();
  1509. }
  1510. }}
  1511. />
  1512. ) : // : m.type === 'PPT' ? <div class={styles.iframePpt}>
  1513. // <div class={styles.pptBox}></div>
  1514. // <iframe src={`https://view.officeapps.live.com/op/embed.aspx?src=${encodeURIComponent(m.content)}`} width='100%' height='100%' frameborder='1'></iframe>
  1515. // </div>
  1516. m.type === 'PPT' ? (
  1517. <iframe
  1518. src={`https://view.officeapps.live.com/op/embed.aspx?src=${encodeURIComponent(
  1519. m.content
  1520. )}`}
  1521. width="100%"
  1522. height="100%"
  1523. frameborder="1"></iframe>
  1524. ) : m.type === 'RHYTHM' ? (
  1525. <RhythmModal
  1526. item={m}
  1527. activeStatus={popupData.activeIndex === mIndex}
  1528. onSetIframe={(el: any) => {
  1529. m.iframeRef = el;
  1530. }}
  1531. />
  1532. ) : m.type === 'LISTEN' ? (
  1533. <ListenModal
  1534. item={m}
  1535. data-vid={m.id}
  1536. activeStatus={popupData.activeIndex === mIndex}
  1537. onSetIframe={(el: any) => {
  1538. m.iframeRef = el;
  1539. }}
  1540. />
  1541. ) : m.type === 'INSTRUMENT' || m.type === 'MUSICIAN' ? (
  1542. <InstruemntDetail
  1543. type="preview"
  1544. id={m.content}
  1545. contentType={m.type}
  1546. activeStatus={popupData.activeIndex === mIndex}
  1547. ref={(el: any) => (m.iframeRef = el)}
  1548. />
  1549. ) : m.type === 'MUSIC_WIKI' ? (
  1550. <MusicDetail
  1551. type="preview"
  1552. id={m.content}
  1553. contentType={m.type}
  1554. activeStatus={popupData.activeIndex === mIndex}
  1555. ref={(el: any) => (m.iframeRef = el)}
  1556. />
  1557. ) : m.type === 'THEORY' ? (
  1558. <TheotyDetail
  1559. type="preview"
  1560. id={m.content}
  1561. activeStatus={popupData.activeIndex === mIndex}
  1562. ref={(el: any) => (m.iframeRef = el)}
  1563. />
  1564. ) : (
  1565. <MusicScore
  1566. activeModel={activeData.model}
  1567. activeStatus={popupData.activeIndex === mIndex}
  1568. data-vid={m.id}
  1569. music={m}
  1570. onSetIframe={(el: any) => {
  1571. m.iframeRef = el;
  1572. }}
  1573. />
  1574. )}
  1575. </div>
  1576. ) : null;
  1577. })}
  1578. </div>
  1579. ) : (
  1580. ''
  1581. )}
  1582. </div>
  1583. </div>
  1584. {/* 右边操作栏 */}
  1585. <div
  1586. class={[
  1587. styles.rightColumn,
  1588. !rightColumnShow.value ? styles.rightColumnHide : '',
  1589. studyData.type !== 'init' &&
  1590. (studyData.penShow || studyData.whiteboardShow)
  1591. ? styles.rightColumnZ
  1592. : ''
  1593. ]}>
  1594. {rightList.map((item: any, index: number) => (
  1595. <div
  1596. class={[
  1597. styles.rightItem,
  1598. (item.id === 2 && data.preStudentNum <= 0) ||
  1599. (item.id === 10 && studyData.callStudentList.length <= 0)
  1600. ? styles.itemDisabled
  1601. : '',
  1602. item.id === 10 && !data.classId ? styles.itemHide : ''
  1603. ]}
  1604. onClick={() => operateRightBtn(item.id)}>
  1605. <NTooltip showArrow={false} placement="left">
  1606. {{
  1607. trigger: () => <img src={item.icon} />,
  1608. default: (
  1609. <>
  1610. {index === rightList.length - 2 && data.type === 'preview'
  1611. ? item.name2
  1612. : item.name}
  1613. </>
  1614. )
  1615. }}
  1616. </NTooltip>
  1617. </div>
  1618. ))}
  1619. </div>
  1620. {!rightColumnShow.value && (
  1621. <img
  1622. class={[
  1623. styles.rightHideIcon,
  1624. !rightColumnShow.value ? styles.rightIconShow : ''
  1625. ]}
  1626. src={rightHideIcon}
  1627. onClick={() => (rightColumnShow.value = true)}
  1628. />
  1629. )}
  1630. {/* 右下角悬浮按钮 */}
  1631. <div class={styles.bottomColumn}>
  1632. {bottomList.map((item: any, index: number) => (
  1633. <div
  1634. class={[
  1635. styles.bottomItem,
  1636. (item.id === 3 && !isUpArrow.value) ||
  1637. (item.id === 4 && !isDownArrow.value)
  1638. ? styles.itemDisabled
  1639. : ''
  1640. ]}
  1641. onClick={() => operateBottomBtn(item.id)}>
  1642. <NTooltip showArrow={false} placement="top">
  1643. {{
  1644. trigger: () => <img src={item.icon} />,
  1645. default: <>{item.name}</>
  1646. }}
  1647. </NTooltip>
  1648. {/* <img src={item.icon} />
  1649. <div class={styles.bottomTips}>{item.name}</div> */}
  1650. </div>
  1651. ))}
  1652. </div>
  1653. {/* 显示列表 */}
  1654. <NDrawer
  1655. v-model:show={popupData.open}
  1656. class={[styles.drawerContainer, styles.drawerContainerSource]}
  1657. onAfterLeave={handleClosePopup}
  1658. showMask={false}
  1659. blockScroll={false}
  1660. trapFocus={false}>
  1661. <NDrawerContent closable>
  1662. {{
  1663. header: () => (
  1664. <TheNoticeBar text={activeName.value || '资源列表'} />
  1665. ),
  1666. default: () => (
  1667. <SourceList
  1668. teacherChapterName={data.teacherChapterName}
  1669. knowledgePointList={data.knowledgePointList}
  1670. courseActiveIndex={popupData.courseActiveIndex}
  1671. activeItem={data.itemList[popupData.activeIndex]}
  1672. onConfirm={(item: any) => {
  1673. popupData.open = false;
  1674. toggleMaterial(item.id);
  1675. }}
  1676. />
  1677. )
  1678. }}
  1679. </NDrawerContent>
  1680. </NDrawer>
  1681. {/* 显示列表 */}
  1682. <NDrawer
  1683. v-model:show={popupData.chapterOpen}
  1684. class={styles.drawerContainer}
  1685. onAfterLeave={handleClosePopup}
  1686. showMask={false}
  1687. maskClosable={data.selectClassStatus ? false : true}
  1688. blockScroll={false}
  1689. trapFocus={false}>
  1690. <NDrawerContent title="切换章节" closable>
  1691. <Chapter
  1692. treeList={popupData.chapterDetails}
  1693. itemActive={data.detailId as any}
  1694. onHandleSelect={async (val: any) => {
  1695. // itemActive: child.id,
  1696. // itemName: child.name
  1697. popupData.courseId = val.itemActive;
  1698. data.selectClassStatus = true;
  1699. }}
  1700. />
  1701. </NDrawerContent>
  1702. </NDrawer>
  1703. {/* 批注 */}
  1704. {studyData.penShow && (
  1705. <Pen
  1706. show={studyData.type === 'pen'}
  1707. type={studyData.type}
  1708. close={() => closeStudyTool()}
  1709. />
  1710. )}
  1711. {studyData.whiteboardShow && (
  1712. <Pen
  1713. show={studyData.type === 'whiteboard'}
  1714. type={studyData.type}
  1715. close={() => closeStudyTool()}
  1716. />
  1717. )}
  1718. {studyData.callShow && (
  1719. <Pen
  1720. callStudents={studyData.callStudentList}
  1721. show={studyData.type === 'call'}
  1722. type={studyData.type}
  1723. close={() => closeStudyTool()}
  1724. />
  1725. )}
  1726. {/* 选择课件 */}
  1727. <NModal
  1728. transformOrigin="center"
  1729. v-model:show={data.selectClassStatus}
  1730. preset="card"
  1731. class={[
  1732. 'modalTitle background',
  1733. // styles.attendClassModal,
  1734. styles.selectClassModal
  1735. ]}
  1736. title={'选择课件'}>
  1737. <SelectClass
  1738. classId={data.classId}
  1739. courseId={popupData.courseId}
  1740. subjectId={data.subjectId}
  1741. lessonCoursewareSubjectList={data.lessonCoursewareSubjectList}
  1742. onConfirm={async (val: any) => {
  1743. popupData.chapterLoading = true;
  1744. try {
  1745. data.selectClassStatus = false;
  1746. data.detailId = val.itemActive;
  1747. data.courseId = val.chapterId;
  1748. const ids = formatParentId(
  1749. val.itemActive,
  1750. popupData.chapterDetails
  1751. );
  1752. data.lessonCoursewareDetailId = ids[0];
  1753. // 更新上课记录 上课的时候才更新
  1754. if (data.type !== 'preview') {
  1755. await classCourseScheduleUpdate();
  1756. }
  1757. await getDetail();
  1758. popupData.activeIndex = 0;
  1759. popupData.chapterOpen = false;
  1760. } catch {
  1761. //
  1762. }
  1763. popupData.chapterLoading = false;
  1764. }}
  1765. />
  1766. </NModal>
  1767. {/* 布置作业 */}
  1768. <NModal
  1769. transformOrigin="center"
  1770. v-model:show={data.modelAttendStatus}
  1771. preset="card"
  1772. title={'课后作业'}
  1773. class={['modalTitle', styles.removeVisiable]}>
  1774. <div class={styles.studentRemove}>
  1775. <p>{data.modalAttendMessage}</p>
  1776. <NSpace class={styles.btnGroupModal} justify="center">
  1777. <NButton
  1778. type="default"
  1779. round
  1780. onClick={() => {
  1781. data.modelTrainStatus = true;
  1782. nextTick(() => {
  1783. getModalHeight();
  1784. });
  1785. data.modelAttendStatus = false;
  1786. }}>
  1787. 布置作业
  1788. </NButton>
  1789. <NButton
  1790. type="primary"
  1791. round
  1792. onClick={() => {
  1793. handleStop();
  1794. data.modelAttendStatus = false;
  1795. }}>
  1796. 取消
  1797. </NButton>
  1798. </NSpace>
  1799. </div>
  1800. </NModal>
  1801. {/* 训练设置 */}
  1802. {/* <NModal
  1803. transformOrigin="center"
  1804. v-model:show={data.modelTrainStatus}
  1805. preset="card"
  1806. class={[styles.attendClassModal, styles.trainClassModal]}
  1807. title={'作业设置'}>
  1808. <ClassWork
  1809. detailId={data.detailId}
  1810. subjectId={data.subjectId}
  1811. courseScheduleId={data.classId}
  1812. activeName={activeName.value}
  1813. classGroupId={data.classGroupId}
  1814. onClose={() => (data.modelTrainStatus = false)}
  1815. />
  1816. </NModal> */}
  1817. <NModal
  1818. v-model:show={data.modelTrainStatus}
  1819. preset="card"
  1820. class={['modalTitle background', styles.workVisiable]}
  1821. title={'布置作业'}>
  1822. <div id="model-homework-height" class={styles.workContainer}>
  1823. <div class={styles.workTrain}>
  1824. <Train
  1825. cardType="homeworkRecord"
  1826. lessonPreTraining={{
  1827. title: data.lessonPreTrainingId
  1828. ? ''
  1829. : data.teacherChapterName + '-课后作业',
  1830. chapterId: data.courseId, // 课件编号
  1831. id: data.lessonPreTrainingId // 作业编号
  1832. }}
  1833. classGroupId={data.classGroupId}
  1834. courseScheduleId={data.classId}
  1835. onChange={(val: any) => {
  1836. data.modelTrainStatus = val.status;
  1837. // getCoursewareList();
  1838. }}
  1839. />
  1840. </div>
  1841. <div class={styles.resourceMain}>
  1842. <ResourceMain cardType="homerowk-record" />
  1843. </div>
  1844. </div>
  1845. </NModal>
  1846. <NModal
  1847. transformOrigin="center"
  1848. class={['modalTitle background']}
  1849. title={'节拍器'}
  1850. preset="card"
  1851. v-model:show={showModalBeat.value}
  1852. style={{ width: '687px' }}>
  1853. <div class={styles.modeWrap}>
  1854. <iframe
  1855. src={`${vaildUrl()}/metronome/?id=${new Date().getTime()}`}
  1856. scrolling="no"
  1857. frameborder="0"
  1858. width="100%"
  1859. height={'650px'}></iframe>
  1860. </div>
  1861. </NModal>
  1862. <NModal
  1863. transformOrigin="center"
  1864. class={['background']}
  1865. v-model:show={showModalTone.value}>
  1866. <div>
  1867. <PlaceholderTone
  1868. onClose={() => {
  1869. showModalTone.value = false;
  1870. }}></PlaceholderTone>
  1871. </div>
  1872. </NModal>
  1873. <NModal
  1874. transformOrigin="center"
  1875. v-model:show={showModalTime.value}
  1876. class={['modalTitle background']}
  1877. title={'计时器'}
  1878. preset="card"
  1879. style={{ width: px2vw(772) }}>
  1880. <div>
  1881. <TimerMeter></TimerMeter>
  1882. </div>
  1883. </NModal>
  1884. <NModal
  1885. v-model:show={data.selectResourceStatus}
  1886. class={['modalTitle', styles.selectMusicModal]}
  1887. preset="card"
  1888. title={'选择资源'}>
  1889. <SelectResources from="class" />
  1890. </NModal>
  1891. <NModal
  1892. transformOrigin="center"
  1893. v-model:show={data.removeVisiable}
  1894. preset="card"
  1895. class={['modalTitle', styles.removeVisiable]}
  1896. title={data.removeTitle}>
  1897. <div class={styles.studentRemove}>
  1898. <p>{data.removeContent}</p>
  1899. <NSpace class={styles.btnGroupModal} justify="center">
  1900. <NButton
  1901. round
  1902. onClick={() => {
  1903. if (data.removeCourseStatus) {
  1904. if (globalState.application) {
  1905. document.exitFullscreen
  1906. ? document.exitFullscreen()
  1907. : document.mozCancelFullScreen
  1908. ? document.mozCancelFullScreen()
  1909. : document.webkitExitFullscreen
  1910. ? document.webkitExitFullscreen()
  1911. : '';
  1912. emit('close');
  1913. } else {
  1914. window.close();
  1915. }
  1916. } else {
  1917. data.removeVisiable = false;
  1918. }
  1919. }}>
  1920. {data.removeCourseStatus ? '结束课程' : '取消'}
  1921. </NButton>
  1922. <NButton
  1923. round
  1924. type="primary"
  1925. onClick={() => {
  1926. //
  1927. if (data.removeCourseStatus) {
  1928. data.modelTrainStatus = true;
  1929. data.removeVisiable = false;
  1930. nextTick(() => {
  1931. getModalHeight();
  1932. });
  1933. } else {
  1934. if (globalState.application) {
  1935. document.exitFullscreen
  1936. ? document.exitFullscreen()
  1937. : document.mozCancelFullScreen
  1938. ? document.mozCancelFullScreen()
  1939. : document.webkitExitFullscreen
  1940. ? document.webkitExitFullscreen()
  1941. : '';
  1942. emit('close');
  1943. } else {
  1944. window.close();
  1945. if (route.query.source === 'admin') {
  1946. storage.remove(ACCESS_TOKEN_ADMIN);
  1947. window.parent.postMessage(
  1948. {
  1949. api: 'iframe_exit'
  1950. },
  1951. '*'
  1952. );
  1953. }
  1954. }
  1955. }
  1956. }}>
  1957. {data.removeCourseStatus ? '布置作业' : '确定'}
  1958. </NButton>
  1959. </NSpace>
  1960. </div>
  1961. </NModal>
  1962. </div>
  1963. );
  1964. }
  1965. });