index.tsx 81 KB

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