index.tsx 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824
  1. import {
  2. defineComponent,
  3. onMounted,
  4. reactive,
  5. onUnmounted,
  6. ref,
  7. Transition
  8. } from 'vue';
  9. import styles from './index.module.less';
  10. import 'plyr/dist/plyr.css';
  11. import MusicScore from './component/musicScore';
  12. import iconMenu from './image/icon-menu.svg';
  13. import iconUp from './image/icon-up.svg';
  14. import iconDown from './image/icon-down.svg';
  15. import iconNote from './image/icon-note.png';
  16. import iconWhiteboard from './image/icon-whiteboard.png';
  17. import iconAssignHomework from './image/icon-assignHomework.svg';
  18. import iconOverPreivew from './image/icon-over-preview.svg';
  19. import { Vue3Lottie } from 'vue3-lottie';
  20. import playLoadData from './datas/data.json';
  21. import VideoPlay from './component/video-play';
  22. import {
  23. useMessage,
  24. NDrawer,
  25. NDrawerContent,
  26. NModal,
  27. NSpace,
  28. NButton,
  29. NTooltip
  30. } from 'naive-ui';
  31. import CardType from '@/components/card-type';
  32. import Pen from './component/tools/pen';
  33. import AudioPay from './component/audio-pay';
  34. import TrainSettings from './model/train-settings';
  35. import { useRoute } from 'vue-router';
  36. import { queryCourseware } from '../prepare-lessons/api';
  37. export type ToolType = 'init' | 'pen' | 'whiteboard';
  38. export type ToolItem = {
  39. type: ToolType;
  40. name: string;
  41. icon: string;
  42. };
  43. export default defineComponent({
  44. name: 'CoursewarePlay',
  45. setup() {
  46. const message = useMessage();
  47. const route = useRoute();
  48. /** 设置播放容器 16:9 */
  49. const parentContainer = reactive({
  50. width: '100vw'
  51. });
  52. const setContainer = () => {
  53. const min = Math.min(screen.width, screen.height);
  54. const max = Math.max(screen.width, screen.height);
  55. const width = min * (16 / 9);
  56. if (width > max) {
  57. parentContainer.width = '100vw';
  58. return;
  59. } else {
  60. parentContainer.width = width + 'px';
  61. }
  62. };
  63. const handleInit = (type = 0) => {
  64. //设置容器16:9
  65. setContainer();
  66. };
  67. handleInit();
  68. onUnmounted(() => {
  69. handleInit(1);
  70. });
  71. const data = reactive({
  72. type: '' as '' | 'preview' | 'class', // 预览类型
  73. subjectId: '' as any, // 声部编号
  74. detailId: '' as any, // 编号 - 章节编号
  75. classGroupId: '' as any, // 上课时需要 班级编号
  76. // detail: null,
  77. knowledgePointList: [] as any,
  78. itemList: [] as any,
  79. // showHead: true,
  80. // isCourse: false,
  81. // isRecordPlay: false,
  82. videoRefs: {} as any[],
  83. audioRefs: {} as any[],
  84. modelAttendStatus: false, // 布置作业提示弹窗
  85. modelTrainStatus: false, // 训练设置
  86. homeworkStatus: true // 布置作业完成时
  87. });
  88. const activeData = reactive({
  89. // isAutoPlay: false, // 是否自动播放
  90. nowTime: 0,
  91. model: true, // 遮罩
  92. isAnimation: true, // 是否动画
  93. // videoBtns: true, // 视频
  94. // currentTime: 0,
  95. // duration: 0,
  96. timer: null as any,
  97. item: null as any
  98. });
  99. const getDetail = async () => {
  100. try {
  101. const res = await queryCourseware({
  102. coursewareDetailKnowledgeId: data.detailId,
  103. subjectId: data.subjectId,
  104. pag: 1,
  105. rows: 99
  106. });
  107. const tempRows = res.data.rows || [];
  108. const temp: any = [];
  109. tempRows.forEach((row: any) => {
  110. temp.push({
  111. id: row.id,
  112. materialId: row.materialId,
  113. coverImg: row.coverImg,
  114. type: row.materialType,
  115. title: row.materialName,
  116. isCollect: !!row.favoriteFlag,
  117. isSelected: row.source === 'PLATFORM' ? true : false,
  118. content: row.content
  119. });
  120. });
  121. console.log(temp);
  122. data.knowledgePointList = temp;
  123. data.itemList = data.knowledgePointList.map((m: any) => {
  124. return {
  125. ...m,
  126. iframeRef: null,
  127. videoEle: null,
  128. audioEle: null,
  129. autoPlay: false, //加载完成是否自动播放
  130. isprepare: false, // 视频是否加载完成
  131. isRender: false // 是否渲染了
  132. };
  133. });
  134. } catch {
  135. //
  136. }
  137. };
  138. // ifram事件处理
  139. const iframeHandle = (ev: MessageEvent) => {
  140. if (ev.data?.api === 'headerTogge') {
  141. activeData.model =
  142. ev.data.show || (ev.data.playState == 'play' ? false : true);
  143. }
  144. };
  145. onMounted(() => {
  146. const query = route.query;
  147. data.type = query.type as any;
  148. data.subjectId = query.subjectId;
  149. data.detailId = query.detailId;
  150. data.classGroupId = query.classGroupId;
  151. window.addEventListener('message', iframeHandle);
  152. getDetail();
  153. });
  154. const popupData = reactive({
  155. open: false,
  156. activeIndex: 0,
  157. toolOpen: false // 工具弹窗控制
  158. });
  159. /**停止所有的播放 */
  160. const handleStop = () => {
  161. for (let i = 0; i < data.itemList.length; i++) {
  162. const activeItem = data.itemList[i];
  163. if (activeItem.type === 'VIDEO' && activeItem.videoEle) {
  164. activeItem.videoEle.stop();
  165. }
  166. if (activeItem.type === 'SONG' && activeItem.audioEle) {
  167. activeItem.audioEle.stop();
  168. }
  169. // console.log('🚀 ~ activeItem:', activeItem)
  170. // 停止曲谱的播放
  171. if (activeItem.type === 'MUSIC') {
  172. activeItem.iframeRef?.contentWindow?.postMessage(
  173. { api: 'setPlayState' },
  174. '*'
  175. );
  176. }
  177. }
  178. };
  179. // 切换素材
  180. const toggleMaterial = (itemActive: any) => {
  181. const index = data.itemList.findIndex((n: any) => n.id == itemActive);
  182. if (index > -1) {
  183. handleSwipeChange(index);
  184. }
  185. };
  186. /** 延迟收起模态框 */
  187. const setModelOpen = () => {
  188. clearTimeout(activeData.timer);
  189. message.destroyAll();
  190. activeData.timer = setTimeout(() => {
  191. activeData.model = false;
  192. Object.values(data.videoRefs).map((n: any) =>
  193. n.toggleHideControl(false)
  194. );
  195. Object.values(data.audioRefs).map((n: any) =>
  196. n.toggleHideControl(false)
  197. );
  198. }, 4000);
  199. };
  200. /** 立即收起所有的模态框 */
  201. const clearModel = () => {
  202. clearTimeout(activeData.timer);
  203. message.destroyAll();
  204. activeData.model = false;
  205. Object.values(data.videoRefs).map((n: any) =>
  206. n?.toggleHideControl(false)
  207. );
  208. Object.values(data.audioRefs).map((n: any) =>
  209. n?.toggleHideControl(false)
  210. );
  211. };
  212. const toggleModel = (type = true) => {
  213. activeData.model = type;
  214. Object.values(data.videoRefs).map((n: any) => n?.toggleHideControl(type));
  215. Object.values(data.audioRefs).map((n: any) => n?.toggleHideControl(type));
  216. };
  217. // 双击
  218. const handleDbClick = (item: any) => {
  219. if (item && item.type === 'VIDEO') {
  220. const videoEle: HTMLVideoElement = item.videoEle;
  221. if (videoEle) {
  222. if (videoEle.paused) {
  223. message.destroyAll();
  224. videoEle.play();
  225. } else {
  226. message.warning('已暂停');
  227. videoEle.pause();
  228. }
  229. }
  230. }
  231. };
  232. // 切换播放
  233. // const togglePlay = (m: any, isPlay: boolean) => {
  234. // if (isPlay) {
  235. // m.videoEle?.play();
  236. // } else {
  237. // m.videoEle?.pause();
  238. // }
  239. // };
  240. // const showIndex = ref(-4);
  241. const effectIndex = ref(3);
  242. const effects = [
  243. {
  244. prev: {
  245. transform: 'translate3d(0, 0, -800px) rotateX(180deg)'
  246. },
  247. next: {
  248. transform: 'translate3d(0, 0, -800px) rotateX(-180deg)'
  249. }
  250. },
  251. {
  252. prev: {
  253. transform: 'translate3d(-100%, 0, -800px)'
  254. },
  255. next: {
  256. transform: 'translate3d(100%, 0, -800px)'
  257. }
  258. },
  259. {
  260. prev: {
  261. transform: 'translate3d(-50%, 0, -800px) rotateY(80deg)'
  262. },
  263. next: {
  264. transform: 'translate3d(50%, 0, -800px) rotateY(-80deg)'
  265. }
  266. },
  267. {
  268. prev: {
  269. transform: 'translate3d(-100%, 0, -800px) rotateY(-120deg)'
  270. },
  271. next: {
  272. transform: 'translate3d(100%, 0, -800px) rotateY(120deg)'
  273. }
  274. },
  275. // 风车4
  276. {
  277. prev: {
  278. transform: 'translate3d(-50%, 50%, -800px) rotateZ(-14deg)',
  279. opacity: 0
  280. },
  281. next: {
  282. transform: 'translate3d(50%, 50%, -800px) rotateZ(14deg)',
  283. opacity: 0
  284. }
  285. },
  286. // 翻页5
  287. {
  288. prev: {
  289. transform: 'translateZ(-800px) rotate3d(0, -1, 0, 90deg)',
  290. opacity: 0
  291. },
  292. next: {
  293. transform: 'translateZ(-800px) rotate3d(0, 1, 0, 90deg)',
  294. opacity: 0
  295. },
  296. current: { transitionDelay: '700ms' }
  297. }
  298. ];
  299. const acitveTimer = ref();
  300. // 轮播切换
  301. const handleSwipeChange = (index: number) => {
  302. // 如果是当前正在播放 或者是视频最后一个
  303. if (popupData.activeIndex == index) return;
  304. handleStop();
  305. clearTimeout(acitveTimer.value);
  306. checkedAnimation(popupData.activeIndex, index);
  307. popupData.activeIndex = index;
  308. acitveTimer.value = setTimeout(
  309. () => {
  310. const item = data.itemList[index];
  311. if (item) {
  312. if (item.type == 'MUSIC') {
  313. activeData.model = true;
  314. }
  315. if (item.type === 'SONG') {
  316. // 自动播放下一个音频
  317. clearTimeout(activeData.timer);
  318. message.destroyAll();
  319. // item.autoPlay = false;
  320. // nextTick(() => {
  321. // item.audioEle?.onPlay();
  322. // });
  323. }
  324. if (item.type === 'VIDEO') {
  325. // 自动播放下一个视频
  326. clearTimeout(activeData.timer);
  327. message.destroyAll();
  328. // item.autoPlay = false;
  329. // nextTick(() => {
  330. // item.videoEle?.play();
  331. // });
  332. }
  333. }
  334. // requestAnimationFrame(() => {
  335. // const _effectIndex = effectIndex.value + 1;
  336. // effectIndex.value =
  337. // _effectIndex >= effects.length - 1 ? 0 : _effectIndex;
  338. // });
  339. },
  340. activeData.isAnimation ? 800 : 0
  341. );
  342. };
  343. /** 是否有转场动画 */
  344. const checkedAnimation = (index: number, nextIndex?: number) => {
  345. const item = data.itemList[index];
  346. const nextItem = data.itemList[nextIndex!];
  347. if (nextItem) {
  348. if (nextItem.knowledgePointId != item.knowledgePointId) {
  349. activeData.isAnimation = true;
  350. return;
  351. }
  352. const videoEle = item.videoEle;
  353. const nextVideo = nextItem.videoEle;
  354. if (videoEle && videoEle.duration < 8 && index < nextIndex!) {
  355. activeData.isAnimation = false;
  356. } else if (nextVideo && nextVideo.duration < 8 && index > nextIndex!) {
  357. activeData.isAnimation = false;
  358. } else {
  359. activeData.isAnimation = true;
  360. }
  361. } else {
  362. activeData.isAnimation = item?.adviseStudyTimeSecond < 8 ? false : true;
  363. }
  364. };
  365. // 上一个知识点, 下一个知识点
  366. const handlePreAndNext = (type: string) => {
  367. if (type === 'up') {
  368. handleSwipeChange(popupData.activeIndex - 1);
  369. } else {
  370. handleSwipeChange(popupData.activeIndex + 1);
  371. }
  372. };
  373. /** 弹窗关闭 */
  374. const handleClosePopup = () => {
  375. const item = data.itemList[popupData.activeIndex];
  376. if (item?.type == 'VIDEO' && !item.videoEle?.paused) {
  377. setModelOpen();
  378. }
  379. if (item?.type == 'SONG' && !item.audioEle?.paused) {
  380. setModelOpen();
  381. }
  382. };
  383. // 监听页面键盘事件 - 上下切换
  384. document.body.addEventListener('keyup', (e: KeyboardEvent) => {
  385. // console.log(e, 'e');
  386. if (e.code === 'ArrowUp') {
  387. if (popupData.activeIndex === 0) return;
  388. handlePreAndNext('up');
  389. } else if (e.code === 'ArrowDown') {
  390. if (popupData.activeIndex === data.itemList.length - 1) return;
  391. handlePreAndNext('down');
  392. }
  393. // else if (e.code === 'Space') {
  394. // handleStop();
  395. // }
  396. });
  397. /** 教学数据 */
  398. const studyData = reactive({
  399. type: '' as ToolType,
  400. penShow: false
  401. });
  402. /** 打开教学工具 */
  403. const openStudyTool = (item: ToolItem) => {
  404. const activeItem = data.itemList[popupData.activeIndex];
  405. // 暂停视频和曲谱的播放
  406. if (activeItem.type === 'VIDEO' && activeItem.videoEle) {
  407. activeItem.videoEle.pause();
  408. }
  409. if (activeItem.type === 'SONG' && activeItem.audioEle) {
  410. activeItem.audioEle.stop();
  411. }
  412. if (activeItem.type === 'MUSIC') {
  413. activeItem.iframeRef?.contentWindow?.postMessage(
  414. { api: 'setPlayState' },
  415. '*'
  416. );
  417. }
  418. clearModel();
  419. popupData.toolOpen = false;
  420. studyData.type = item.type;
  421. switch (item.type) {
  422. case 'pen':
  423. studyData.penShow = true;
  424. break;
  425. case 'whiteboard':
  426. studyData.penShow = true;
  427. }
  428. };
  429. /** 关闭教学工具 */
  430. const closeStudyTool = () => {
  431. studyData.type = 'init';
  432. toggleModel();
  433. };
  434. return () => (
  435. <div id="playContent" class={styles.playContent}>
  436. <div
  437. onClick={() => {
  438. clearTimeout(activeData.timer);
  439. activeData.model = !activeData.model;
  440. Object.values(data.videoRefs).map((n: any) =>
  441. n.toggleHideControl(activeData.model)
  442. );
  443. Object.values(data.audioRefs).map((n: any) =>
  444. n.toggleHideControl(activeData.model)
  445. );
  446. }}>
  447. <div
  448. class={styles.coursewarePlay}
  449. style={{ width: parentContainer.width }}
  450. onClick={(e: Event) => {
  451. e.stopPropagation();
  452. setModelOpen();
  453. }}>
  454. <div class={styles.wraps}>
  455. {data.itemList.map((m: any, mIndex: number) => {
  456. const isRender =
  457. m.isRender || Math.abs(popupData.activeIndex - mIndex) < 2;
  458. const isEmtry = Math.abs(popupData.activeIndex - mIndex) > 4;
  459. if (isRender) {
  460. m.isRender = true;
  461. }
  462. return isRender ? (
  463. <div
  464. key={'index' + mIndex}
  465. class={[
  466. styles.itemDiv,
  467. popupData.activeIndex === mIndex && styles.itemActive,
  468. activeData.isAnimation && styles.acitveAnimation,
  469. Math.abs(popupData.activeIndex - mIndex) < 2
  470. ? styles.show
  471. : styles.hide
  472. ]}
  473. style={
  474. mIndex < popupData.activeIndex
  475. ? effects[effectIndex.value].prev
  476. : mIndex > popupData.activeIndex
  477. ? effects[effectIndex.value].next
  478. : {}
  479. }
  480. onClick={(e: Event) => {
  481. e.stopPropagation();
  482. clearTimeout(activeData.timer);
  483. if (Date.now() - activeData.nowTime < 300) {
  484. handleDbClick(m);
  485. return;
  486. }
  487. activeData.nowTime = Date.now();
  488. activeData.timer = setTimeout(() => {
  489. activeData.model = !activeData.model;
  490. Object.values(data.videoRefs).map((n: any) =>
  491. n.toggleHideControl(activeData.model)
  492. );
  493. Object.values(data.audioRefs).map((n: any) =>
  494. n.toggleHideControl(activeData.model)
  495. );
  496. if (activeData.model) {
  497. setModelOpen();
  498. }
  499. }, 300);
  500. }}>
  501. {m.type === 'VIDEO' ? (
  502. <>
  503. <VideoPlay
  504. ref={(v: any) => (data.videoRefs[mIndex] = v)}
  505. item={m}
  506. isEmtry={isEmtry}
  507. onLoadedmetadata={(videoItem: any) => {
  508. m.videoEle = videoItem;
  509. m.isprepare = true;
  510. }}
  511. onTogglePlay={(paused: boolean) => {
  512. m.autoPlay = false;
  513. if (paused || popupData.open) {
  514. clearTimeout(activeData.timer);
  515. } else {
  516. setModelOpen();
  517. }
  518. }}
  519. onEnded={() => {
  520. const _index = popupData.activeIndex + 1;
  521. if (_index < data.itemList.length) {
  522. handleSwipeChange(_index);
  523. }
  524. }}
  525. onReset={() => {
  526. if (!m.videoEle?.paused) {
  527. setModelOpen();
  528. }
  529. }}
  530. />
  531. <Transition name="van-fade">
  532. {!m.isprepare && (
  533. <div class={styles.loadWrap}>
  534. <Vue3Lottie
  535. animationData={playLoadData}></Vue3Lottie>
  536. </div>
  537. )}
  538. </Transition>
  539. </>
  540. ) : m.type === 'IMG' ? (
  541. <img src={m.content} />
  542. ) : m.type === 'SONG' ? (
  543. <AudioPay
  544. item={m}
  545. ref={(v: any) => (data.audioRefs[mIndex] = v)}
  546. onLoadedmetadata={(audioItem: any) => {
  547. m.audioEle = audioItem;
  548. m.isprepare = true;
  549. }}
  550. onTogglePlay={(paused: boolean) => {
  551. m.autoPlay = false;
  552. if (paused || popupData.open) {
  553. clearTimeout(activeData.timer);
  554. } else {
  555. setModelOpen();
  556. }
  557. }}
  558. onEnded={() => {
  559. const _index = popupData.activeIndex + 1;
  560. if (_index < data.itemList.length) {
  561. handleSwipeChange(_index);
  562. }
  563. }}
  564. onReset={() => {
  565. if (!m.audioEle?.paused) {
  566. setModelOpen();
  567. }
  568. }}
  569. />
  570. ) : (
  571. <MusicScore
  572. activeModel={activeData.model}
  573. data-vid={m.id}
  574. music={m}
  575. onSetIframe={(el: any) => {
  576. m.iframeRef = el;
  577. }}
  578. />
  579. )}
  580. </div>
  581. ) : null;
  582. })}
  583. </div>
  584. <Transition name="right">
  585. {activeData.model && (
  586. <div
  587. class={styles.rightFixedBtns}
  588. onClick={(e: Event) => {
  589. e.stopPropagation();
  590. clearTimeout(activeData.timer);
  591. }}>
  592. <div
  593. class={[
  594. styles.fullBtn,
  595. popupData.activeIndex === 0 ? styles.btnsDisabled : ''
  596. ]}
  597. onClick={() => {
  598. if (popupData.activeIndex === 0) return;
  599. handlePreAndNext('up');
  600. }}>
  601. <img src={iconUp} />
  602. </div>
  603. <div
  604. class={[styles.fullBtn, styles.point]}
  605. onClick={() => (popupData.open = true)}>
  606. <img src={iconMenu} />
  607. </div>
  608. <div
  609. class={[
  610. styles.fullBtn,
  611. popupData.activeIndex === data.itemList.length - 1
  612. ? styles.btnsDisabled
  613. : ''
  614. ]}
  615. onClick={() => {
  616. if (popupData.activeIndex === data.itemList.length - 1)
  617. return;
  618. handlePreAndNext('down');
  619. }}>
  620. <img src={iconDown} />
  621. </div>
  622. </div>
  623. )}
  624. </Transition>
  625. </div>
  626. </div>
  627. {/* <div
  628. style={{ transform: activeData.model ? '' : 'translateY(-100%)' }}
  629. class={styles.headerContainer}
  630. ref={headeRef}>
  631. <div class={styles.backBtn} onClick={() => goback()}>
  632. <Icon name={iconBack} />
  633. 返回
  634. </div>
  635. <div class={styles.menu}>{popupData.itemName}</div>
  636. </div> */}
  637. {/* 布置作业按钮 */}
  638. <div
  639. class={[
  640. styles.assignHomework,
  641. activeData.model ? '' : styles.sectionAnimateUp
  642. ]}
  643. onClick={() => {
  644. if (data.type === 'preview') {
  645. window.close();
  646. } else {
  647. data.modelAttendStatus = true;
  648. }
  649. }}>
  650. <img
  651. src={data.type === 'preview' ? iconOverPreivew : iconAssignHomework}
  652. />
  653. </div>
  654. {/* 白板 批注 */}
  655. <div
  656. class={[
  657. styles.switchDisplaySection,
  658. activeData.model ? '' : styles.sectionAnimate
  659. ]}>
  660. <NTooltip trigger="hover">
  661. {{
  662. trigger: () => (
  663. <div
  664. class={styles.displayBtn}
  665. onClick={() =>
  666. openStudyTool({
  667. type: 'pen',
  668. icon: iconNote,
  669. name: '批注'
  670. })
  671. }>
  672. <img src={iconNote} />
  673. </div>
  674. ),
  675. default: () => '批注'
  676. }}
  677. </NTooltip>
  678. <NTooltip trigger="hover">
  679. {{
  680. trigger: () => (
  681. <div
  682. class={styles.displayBtn}
  683. onClick={() =>
  684. openStudyTool({
  685. type: 'whiteboard',
  686. icon: iconWhiteboard,
  687. name: '白板'
  688. })
  689. }>
  690. <img src={iconWhiteboard} />
  691. </div>
  692. ),
  693. default: () => '白板'
  694. }}
  695. </NTooltip>
  696. </div>
  697. {/* 显示列表 */}
  698. <NDrawer
  699. v-model:show={popupData.open}
  700. class={styles.drawerContainer}
  701. onAfterLeave={handleClosePopup}
  702. showMask={false}>
  703. <NDrawerContent title="资源列表" closable>
  704. {data.knowledgePointList.map((item: any, index: number) => (
  705. <CardType
  706. item={item}
  707. isActive={popupData.activeIndex === index}
  708. isCollect={false}
  709. isShowCollect={false}
  710. onClick={(item: any) => {
  711. popupData.open = false;
  712. toggleMaterial(item.id);
  713. }}
  714. />
  715. ))}
  716. </NDrawerContent>
  717. </NDrawer>
  718. {/* 批注 */}
  719. {studyData.penShow && (
  720. <Pen
  721. show={studyData.type === 'pen' || studyData.type === 'whiteboard'}
  722. type={studyData.type}
  723. close={() => closeStudyTool()}
  724. />
  725. )}
  726. {/* 布置作业 */}
  727. <NModal
  728. v-model:show={data.modelAttendStatus}
  729. preset="card"
  730. class={styles.attendClassModal}
  731. title={'课后训练'}>
  732. <div class={styles.modelAttendContent}>
  733. 本节课已设置课后训练,是否布置?
  734. </div>
  735. <NSpace class={styles.modelAttendBtnGroup}>
  736. <NButton
  737. type="default"
  738. round
  739. onClick={() => {
  740. data.modelAttendStatus = false;
  741. window.close();
  742. }}>
  743. 暂不布置
  744. </NButton>
  745. <NButton
  746. type="primary"
  747. round
  748. onClick={() => {
  749. data.modelTrainStatus = true;
  750. data.modelAttendStatus = false;
  751. }}>
  752. 布置
  753. </NButton>
  754. </NSpace>
  755. </NModal>
  756. {/* 训练设置 */}
  757. <NModal
  758. v-model:show={data.modelTrainStatus}
  759. preset="card"
  760. class={[styles.attendClassModal, styles.trainClassModal]}
  761. title={'训练设置'}>
  762. <TrainSettings
  763. detailId={data.detailId}
  764. subjectId={data.subjectId}
  765. classGroupId={data.classGroupId}
  766. onClose={() => (data.modelTrainStatus = false)}
  767. onConfirm={() => {
  768. // 布置完作业之后直接关闭
  769. setTimeout(() => {
  770. window.close();
  771. }, 1000);
  772. }}
  773. />
  774. </NModal>
  775. {/* <NModal
  776. v-model:show={data.homeworkStatus}
  777. preset="card"
  778. class={[styles.attendClassModal]}
  779. closable={false}
  780. maskClosable={false}
  781. title={' '}>
  782. <div class={styles.workContainer}>
  783. <h2>作业布置成功</h2>
  784. <p>倒</p>
  785. </div>
  786. </NModal> */}
  787. </div>
  788. );
  789. }
  790. });