index.tsx 26 KB

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