index.tsx 78 KB

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