index.tsx 71 KB

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