1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837 |
- import {
- defineComponent,
- onMounted,
- reactive,
- onUnmounted,
- ref,
- Transition,
- computed,
- nextTick,
- watch
- } from 'vue';
- import styles from './index.module.less';
- import 'plyr/dist/plyr.css';
- import MusicScore from './component/musicScore';
- // import iconChange from './image/icon-change.png';
- // import iconMenu from './image/icon-menu.png';
- // import iconUp from './image/icon-up.png';
- // import iconDown from './image/icon-down.png';
- // import iconNote from './image/icon-note.png';
- // import iconWhiteboard from './image/icon-whiteboard.png';
- // import iconAssignHomework from './image/icon-assignHomework.png';
- // import iconClose from './image/icon-close.png';
- // import iconOverPreivew from './image/icon-over-preview.png';
- import { Vue3Lottie } from 'vue3-lottie';
- import playLoadData from './datas/data.json';
- // import Moveable from 'moveable';
- import VideoPlay from './component/video-play';
- import {
- useMessage,
- NDrawer,
- NDrawerContent,
- NModal,
- NSpace,
- NButton
- // NTooltip,
- // NPopover,
- // NImage
- } from 'naive-ui';
- import CardType from '@/components/card-type';
- import Pen from './component/tools/pen';
- import AudioPay from './component/audio-pay';
- import TrainSettings from './model/train-settings';
- import { useRoute } from 'vue-router';
- import {
- courseScheduleUpdate,
- lessonCoursewareDetail,
- lessonPreTrainingPage,
- queryCourseware
- } from '../prepare-lessons/api';
- // import Attentguide from '@/custom-plugins/guide-page/attent-guide';
- import { vaildUrl } from '/src/utils/urlUtils';
- import TimerMeter from '/src/components/timerMeter';
- // import toneImage from '/src/components/layout/images/toneImage.png';
- // import toolbox from '/src/components/layout/images/toolbox.png';
- // import setTimeIcon from '/src/components/layout/images/setTimeIcon.png';
- // import beatIcon from '/src/components/layout/images/beatIcon.png';
- // import toneIcon from '/src/components/layout/images/toneIcon.png';
- import { px2vw } from '/src/utils';
- import PlaceholderTone from '/src/components/layout/modals/placeholderTone';
- import { state as globalState } from '/src/state';
- import Chapter from './model/chapter';
- import { useRouter } from 'vue-router';
- import { useUserStore } from '@/store/modules/users';
- // import iconBeatIcon from './new-image/icon-beatIcon.png';
- // import iconChange from './new-image/icon-change.png';
- // import iconDown from './new-image/icon-down.png';
- // import iconMenu from './new-image/icon-menu.png';
- import iconNote from './new-image/icon-note.png';
- // import iconOverClass from './new-image/icon-overclass.png';
- // import iconSetTime from './new-image/icon-setTime.png';
- // import iconToneIcon from './new-image/icon-toneIcon.png';
- // import iconUp from './new-image/icon-up.png';
- import iconWhite from './new-image/icon-white.png';
- // import iconWork from './new-image/icon-work.png';
- import rightIconEnd from './image/right_icon1.png';
- import rightIconArrange from './image/right_icon2.png';
- import rightIconPostil from './image/right_icon3.png';
- import rightIconWhiteboard from './image/right_icon4.png';
- import rightIconMetronome from './image/right_icon5.png';
- import rightIconTuner from './image/right_icon6.png';
- import rightIconTimer from './image/right_icon7.png';
- import rightIconPackUp from './image/right_icon8.png';
- import rightIconMusic from './image/right_icon9.png';
- import bottomIconSwitch from './image/bottom_icon1.png';
- import bottomIconResource from './image/bottom_icon2.png';
- import bottomIconPre from './image/bottom_icon3.png';
- import bottomIconNext from './image/bottom_icon4.png';
- import rightHideIcon from './image/right_hide_icon.png';
- import SelectResources from '../prepare-lessons/model/select-resources';
- import TheNoticeBar from '/src/components/TheNoticeBar';
- import { getStudentAfterWork } from '../studentList/api';
- export type ToolType = 'init' | 'pen' | 'whiteboard';
- export type ToolItem = {
- type: ToolType;
- name: string;
- icon: string;
- };
- export default defineComponent({
- name: 'CoursewarePlay',
- props: {
- type: {
- type: String,
- default: ''
- },
- subjectId: {
- type: [String, Number],
- default: ''
- },
- // 教材编号
- lessonCourseId: {
- type: [String, Number],
- default: ''
- },
- detailId: {
- type: String,
- default: ''
- },
- // 班级编号
- classGroupId: {
- type: String,
- default: ''
- },
- // 上课记录编号
- classId: {
- type: String,
- defaault: ''
- },
- preStudentNum: {
- type: [String, Number],
- default: ''
- }
- },
- emits: ['close'],
- setup(props, { emit }) {
- const message = useMessage();
- const route = useRoute();
- const router = useRouter();
- const users = useUserStore();
- /** 设置播放容器 16:9 */
- const parentContainer = reactive({
- width: '100vw'
- });
- // const NPopoverRef = ref();
- // const setContainer = () => {
- // const min = Math.min(screen.width, screen.height);
- // const max = Math.max(screen.width, screen.height);
- // const width = min * (16 / 9);
- // if (width > max) {
- // parentContainer.width = '100vw';
- // return;
- // } else {
- // parentContainer.width = width + 'px';
- // }
- // };
- const handleInit = (type = 0) => {
- //设置容器16:9
- // setContainer();
- };
- handleInit();
- onUnmounted(() => {
- handleInit(1);
- });
- const drawerCardRef = ref(); // 资源列表对象
- const data = reactive({
- type: 'class' as '' | 'preview' | 'class', // 预览类型
- subjectId: '' as any, // 声部编号
- lessonCourseId: '' as any, // 教材编号
- lessonCoursewareDetailId: '' as any, // 章节
- detailId: '' as any, // 编号 - 课程编号
- classGroupId: '' as any, // 上课时需要 班级编号
- classId: '' as any, // 上课编号
- preStudentNum: '' as any, // 班上学生
- // detail: null,
- knowledgePointList: [] as any,
- itemList: [] as any,
- // showHead: true,
- // isCourse: false,
- // isRecordPlay: false,
- videoRefs: {} as any[],
- audioRefs: {} as any[],
- modelAttendStatus: false, // 布置作业提示弹窗
- modalAttendMessage: '本节课未设置课后作业,是否继续?',
- modelTrainStatus: false, // 训练设置
- homeworkStatus: true, // 布置作业完成时
- removeVisiable: false,
- removeTitle: '',
- removeContent: '',
- removeCourseStatus: false, // 是否布置作业
- selectResourceStatus: false,
- videoState: 'init' as 'init' | 'play',
- videoItemRef: null as any,
- animationState: 'start' as 'start' | 'end'
- });
- const activeData = reactive({
- // isAutoPlay: false, // 是否自动播放
- nowTime: 0,
- model: true, // 遮罩
- isAnimation: true, // 是否动画
- // videoBtns: true, // 视频
- // currentTime: 0,
- // duration: 0,
- timer: null as any,
- item: null as any
- });
- // 键盘事件监听状态
- const listenerKeyUpState = ref(false);
- const getDetail = async () => {
- try {
- const res = await queryCourseware({
- coursewareDetailKnowledgeId: data.detailId,
- subjectId: data.subjectId,
- pag: 1,
- rows: 99
- });
- const tempRows = res.data.rows || [];
- const temp: any = [];
- tempRows.forEach((row: any) => {
- if (!row.removeFlag) {
- temp.push({
- id: row.id,
- materialId: row.materialId,
- coverImg: row.coverImg,
- type: row.materialType,
- title: row.materialName,
- isCollect: !!row.favoriteFlag,
- isSelected: row.source === 'PLATFORM' ? true : false,
- content: row.content
- });
- }
- });
- data.knowledgePointList = temp;
- data.itemList = data.knowledgePointList.map((m: any) => {
- return {
- ...m,
- iframeRef: null,
- videoEle: null,
- audioEle: null,
- autoPlay: false, //加载完成是否自动播放
- isprepare: false, // 视频是否加载完成
- isRender: false // 是否渲染了
- };
- });
- setTimeout(() => {
- data.animationState = 'end';
- }, 500);
- } catch {
- //
- }
- };
- const showModalBeat = ref(false);
- const showModalTone = ref(false);
- const showModalTime = ref(false);
- // ifram事件处理
- const iframeHandle = (ev: MessageEvent) => {
- // console.log(ev.data?.api, ev.data, 'ev.data');
- if (ev.data?.api === 'headerTogge') {
- activeData.model =
- ev.data.show || (ev.data.playState == 'play' ? false : true);
- }
- //
- if (ev.data?.api === 'onAttendToggleMenu') {
- activeData.model = !activeData.model;
- }
- if (ev.data?.api === 'api_fingerPreView') {
- clearInterval(activeData.timer);
- activeData.model = !ev.data.state;
- }
- //
- if (ev.data?.api === 'documentBodyKeyup') {
- if (ev.data?.code === 'ArrowLeft') {
- setModalOpen();
- handlePreAndNext('up');
- }
- if (ev.data?.code === 'ArrowRight') {
- setModalOpen();
- handlePreAndNext('down');
- }
- }
- if (ev.data?.api === 'onLogin') {
- const documentDom: any = document;
- documentDom.exitFullscreen
- ? documentDom.exitFullscreen()
- : documentDom.mozCancelFullScreen
- ? documentDom.mozCancelFullScreen()
- : documentDom.webkitExitFullscreen
- ? documentDom.webkitExitFullscreen()
- : '';
- users.logout();
- router.replace('/login');
- }
- };
- onMounted(() => {
- // initMoveable();
- const query = route.query;
- // console.log(query, props.preStudentNum, '学生人数');
- // 先取参数,
- data.type = props.type || (query.type as any);
- data.subjectId = props.subjectId || query.subjectId;
- data.detailId = props.detailId || query.detailId;
- data.lessonCourseId = props.lessonCourseId || query.lessonCourseId;
- data.classGroupId = props.classGroupId || query.classGroupId;
- data.classId = props.classId || query.classId;
- data.preStudentNum = props.preStudentNum || query.preStudentNum;
- window.addEventListener('message', iframeHandle);
- getDetail();
- getLessonCoursewareDetail();
- if (data.type === 'preview') {
- rightList.splice(1, 1);
- }
- });
- // const onFullScreen = () => {
- // if (data.type === 'preview') {
- // const el: any = document.querySelector('#app');
- // if (el.mozRequestFullScreen) {
- // el.mozRequestFullScreen();
- // } else if (el.webkitRequestFullscreen) {
- // el.webkitRequestFullscreen();
- // } else if (el.requestFullScreen) {
- // el.requestFullscreen();
- // }
- // }
- // };
- const popupData = reactive({
- open: false,
- activeIndex: 0,
- toolOpen: false, // 工具弹窗控制
- chapterOpen: false, // 切换章节
- chapterDetails: [] as any,
- chapterLoading: false // 加载数据
- });
- const formatParentId = (id: any, list: any, ids = [] as any) => {
- for (const item of list) {
- if (item.knowledgeList && item.knowledgeList.length > 0) {
- const cIds: any = formatParentId(id, item.knowledgeList, [
- ...ids,
- item.id
- ]);
- if (cIds.includes(id)) {
- return cIds;
- }
- }
- if (item.id === id) {
- return [...ids, id];
- }
- }
- return ids;
- };
- /** 获取章节 */
- const getLessonCoursewareDetail = async () => {
- try {
- const res = await lessonCoursewareDetail({
- id: data.lessonCourseId,
- subjectId: data.subjectId
- });
- popupData.chapterDetails = res.data.lessonList || [];
- const ids = formatParentId(data.detailId, popupData.chapterDetails);
- data.lessonCoursewareDetailId = ids[0];
- } catch {
- //
- }
- };
- /** 更新上课记录 */
- const classCourseScheduleUpdate = async () => {
- try {
- if (!data.classId) return;
- await courseScheduleUpdate({
- lessonCoursewareKnowledgeDetailId: data.detailId,
- id: data.classId
- });
- } catch {
- //
- }
- };
- const activeName = computed(() => {
- let name = '';
- popupData.chapterDetails.forEach((chapter: any) => {
- if (chapter.id === data.lessonCoursewareDetailId) {
- // name = chapter.name;
- chapter.knowledgeList?.forEach((know: any) => {
- if (know.id === data.detailId) {
- name = know.name;
- }
- });
- }
- });
- return name;
- });
- /**停止所有的播放 */
- const handleStop = () => {
- for (let i = 0; i < data.itemList.length; i++) {
- const activeItem = data.itemList[i];
- if (activeItem.type === 'VIDEO' && activeItem.videoEle) {
- // console.log(activeItem.videoEle, ' activeItem.videoEle');
- try {
- activeItem.videoEle?.currentTime(0);
- activeItem.videoEle?.pause();
- } catch (e: any) {
- // console.log(e, 'e');
- }
- }
- if (activeItem.type === 'SONG' && activeItem.audioEle) {
- activeItem.audioEle?.stop();
- }
- // console.log('🚀 ~ activeItem:', activeItem)
- // 停止曲谱的播放
- if (activeItem.type === 'MUSIC') {
- activeItem.iframeRef?.contentWindow?.postMessage(
- { api: 'setPlayState' },
- '*'
- );
- }
- }
- };
- // 切换素材
- const toggleMaterial = (itemActive: any) => {
- const index = data.itemList.findIndex((n: any) => n.id == itemActive);
- if (index > -1) {
- handleSwipeChange(index);
- }
- };
- /** 延迟收起模态框 */
- const setModelOpen = () => {
- clearTimeout(activeData.timer);
- message.destroyAll();
- activeData.timer = setTimeout(() => {
- activeData.model = false;
- Object.values(data.videoRefs).map((n: any) =>
- n?.toggleHideControl(false)
- );
- Object.values(data.audioRefs).map((n: any) =>
- n?.toggleHideControl(false)
- );
- }, 4000);
- };
- /** 立即收起所有的模态框 */
- const clearModel = () => {
- clearTimeout(activeData.timer);
- message.destroyAll();
- activeData.model = false;
- Object.values(data.videoRefs).map((n: any) =>
- n?.toggleHideControl(false)
- );
- Object.values(data.audioRefs).map((n: any) =>
- n?.toggleHideControl(false)
- );
- };
- const toggleModel = (type = true) => {
- activeData.model = type;
- Object.values(data.videoRefs).map((n: any) => n?.toggleHideControl(type));
- Object.values(data.audioRefs).map((n: any) => n?.toggleHideControl(type));
- };
- // 双击
- const handleDbClick = (item: any) => {
- if (item && item.type === 'VIDEO') {
- const videoEle: HTMLVideoElement = item.videoEle;
- if (videoEle) {
- if (videoEle.paused) {
- message.destroyAll();
- videoEle.play();
- } else {
- message.warning('已暂停');
- videoEle.pause();
- }
- }
- }
- };
- // ppt iframe 点击事件
- // const iframeClick = () => {
- // if(document.all) {
- // document.getElementById("iframe-ppt")?.attachEvent("click", () => {
- // activeData.model = !activeData.model
- // });
- // } else {
- // document.getElementById("iframe-ppt")?.contentWindow?.postMessage({
- // api: 'onAttendToggleMenu'
- // }, '*');
- // }
- // }
- // 切换播放
- // const togglePlay = (m: any, isPlay: boolean) => {
- // if (isPlay) {
- // m.videoEle?.play();
- // } else {
- // m.videoEle?.pause();
- // }
- // };
- // const showIndex = ref(-4);
- const effectIndex = ref(3);
- const effects = [
- {
- prev: {
- transform: 'translate3d(0, 0, -800px) rotateX(180deg)'
- },
- next: {
- transform: 'translate3d(0, 0, -800px) rotateX(-180deg)'
- }
- },
- {
- prev: {
- transform: 'translate3d(-100%, 0, -800px)'
- },
- next: {
- transform: 'translate3d(100%, 0, -800px)'
- }
- },
- {
- prev: {
- transform: 'translate3d(-50%, 0, -800px) rotateY(80deg)'
- },
- next: {
- transform: 'translate3d(50%, 0, -800px) rotateY(-80deg)'
- }
- },
- {
- prev: {
- transform: 'translate3d(-100%, 0, -800px) rotateY(-120deg)'
- },
- next: {
- transform: 'translate3d(100%, 0, -800px) rotateY(120deg)'
- }
- },
- // 风车4
- {
- prev: {
- transform: 'translate3d(-50%, 50%, -800px) rotateZ(-14deg)',
- opacity: 0
- },
- next: {
- transform: 'translate3d(50%, 50%, -800px) rotateZ(14deg)',
- opacity: 0
- }
- },
- // 翻页5
- {
- prev: {
- transform: 'translateZ(-800px) rotate3d(0, -1, 0, 90deg)',
- opacity: 0
- },
- next: {
- transform: 'translateZ(-800px) rotate3d(0, 1, 0, 90deg)',
- opacity: 0
- },
- current: { transitionDelay: '700ms' }
- }
- ];
- const acitveTimer = ref();
- // 轮播切换
- const handleSwipeChange = (index: number) => {
- // 如果是当前正在播放 或者是视频最后一个
- if (popupData.activeIndex == index) return;
- data.animationState = 'start';
- data.videoState = 'init';
- handleStop();
- clearTimeout(acitveTimer.value);
- activeData.model = true;
- checkedAnimation(popupData.activeIndex, index);
- popupData.activeIndex = index;
- // 处理资源列表滚动
- nextTick(() => {
- scrollResourceSection();
- });
- acitveTimer.value = setTimeout(
- () => {
- const item = data.itemList[index];
- if (item) {
- if (item.type == 'MUSIC') {
- activeData.model = true;
- }
- if (item.type === 'SONG') {
- // 自动播放下一个音频
- clearTimeout(activeData.timer);
- message.destroyAll();
- // item.autoPlay = false;
- // nextTick(() => {
- // item.audioEle?.onPlay();
- // });
- }
- if (item.type === 'VIDEO') {
- // 自动播放下一个视频
- clearTimeout(activeData.timer);
- message.destroyAll();
- nextTick(() => {
- if (item.error) {
- // console.log(item, 'item error');
- item.videoEle?.src(item.content);
- item.error = false;
- // item.videoEle?.onPlay();
- }
- data.animationState = 'end';
- });
- }
- if (item.type === 'PPT') {
- //
- }
- }
- },
- activeData.isAnimation ? 800 : 0
- );
- };
- /** 是否有转场动画 */
- const checkedAnimation = (index: number, nextIndex?: number) => {
- const item = data.itemList[index];
- const nextItem = data.itemList[nextIndex!];
- if (nextItem) {
- if (nextItem.knowledgePointId != item.knowledgePointId) {
- activeData.isAnimation = true;
- return;
- }
- const videoEle = item.videoEle;
- const nextVideo = nextItem.videoEle;
- if (videoEle && videoEle.duration < 8 && index < nextIndex!) {
- activeData.isAnimation = false;
- } else if (nextVideo && nextVideo.duration < 8 && index > nextIndex!) {
- activeData.isAnimation = false;
- } else {
- activeData.isAnimation = true;
- }
- } else {
- activeData.isAnimation = item?.adviseStudyTimeSecond < 8 ? false : true;
- }
- };
- // 上一个知识点, 下一个知识点
- const handlePreAndNext = async (type: string) => {
- // if (type === 'up') {
- // handleSwipeChange(popupData.activeIndex - 1);
- // } else {
- // handleSwipeChange(popupData.activeIndex + 1);
- // }
- if (type === 'up') {
- // 判断上面是否还有章节
- if (popupData.activeIndex > 0) {
- handleSwipeChange(popupData.activeIndex - 1);
- return;
- }
- // 获取当前是哪个章节
- let detailIndex = popupData.chapterDetails.findIndex(
- (item: any) => item.id == data.lessonCoursewareDetailId
- );
- const detailItem =
- popupData.chapterDetails[detailIndex]?.knowledgeList || [];
- let lessonIndex = detailItem.findIndex(
- (item: any) => item.id == data.detailId
- );
- let lessonStatus = false; // 当前章节上面是否有内容
- let lessonCoursewareDetailId = '';
- let coursewareDetailKnowledgeId = '';
- while (lessonIndex >= 0) {
- lessonIndex--;
- if (lessonIndex >= 0) {
- if (detailItem[lessonIndex].containMaterial) {
- lessonStatus = true;
- lessonCoursewareDetailId =
- detailItem[lessonIndex].lessonCoursewareDetailId;
- coursewareDetailKnowledgeId = detailItem[lessonIndex].id;
- }
- }
- if (lessonStatus) {
- break;
- }
- }
- // 判断当前章节下面课程是否有内容,否则往上一个章节走
- if (lessonStatus) {
- popupData.chapterLoading = true;
- data.detailId = coursewareDetailKnowledgeId;
- data.lessonCoursewareDetailId = lessonCoursewareDetailId;
- // 更新上课记录 上课的时候才更新
- if (data.type !== 'preview') {
- await classCourseScheduleUpdate();
- }
- await getDetail();
- popupData.activeIndex = data.itemList.length - 1 || 0;
- popupData.chapterOpen = false;
- popupData.chapterLoading = false;
- return;
- }
- let prevLessonStatus = false;
- while (detailIndex >= 0) {
- detailIndex--;
- const tempDetail =
- popupData.chapterDetails[detailIndex]?.knowledgeList || [];
- let tempLessonLength = tempDetail.length;
- while (tempLessonLength > 0) {
- if (tempDetail[tempLessonLength - 1].containMaterial) {
- prevLessonStatus = true;
- lessonCoursewareDetailId =
- tempDetail[tempLessonLength - 1].lessonCoursewareDetailId;
- coursewareDetailKnowledgeId = tempDetail[tempLessonLength - 1].id;
- }
- tempLessonLength--;
- if (prevLessonStatus) {
- break;
- }
- }
- if (prevLessonStatus) {
- break;
- }
- }
- // 判断当前章节下面课程是否有内容,否则往上一个章节走
- if (prevLessonStatus) {
- popupData.chapterLoading = true;
- data.detailId = coursewareDetailKnowledgeId;
- data.lessonCoursewareDetailId = lessonCoursewareDetailId;
- await getDetail();
- popupData.activeIndex = data.itemList.length - 1 || 0;
- popupData.chapterLoading = false;
- return;
- }
- } else {
- if (popupData.activeIndex < data.itemList.length - 1) {
- handleSwipeChange(popupData.activeIndex + 1);
- return;
- }
- // 获取当前是哪个章节
- let detailIndex = popupData.chapterDetails.findIndex(
- (item: any) => item.id == data.lessonCoursewareDetailId
- );
- const detailItem =
- popupData.chapterDetails[detailIndex]?.knowledgeList || [];
- let lessonIndex = detailItem.findIndex(
- (item: any) => item.id == data.detailId
- );
- let lessonStatus = false; // 当前章节下面是否有内容
- let lessonCoursewareDetailId = '';
- let coursewareDetailKnowledgeId = '';
- while (lessonIndex < detailItem.length - 1) {
- lessonIndex++;
- if (lessonIndex >= 0) {
- if (detailItem[lessonIndex].containMaterial) {
- lessonStatus = true;
- lessonCoursewareDetailId =
- detailItem[lessonIndex].lessonCoursewareDetailId;
- coursewareDetailKnowledgeId = detailItem[lessonIndex].id;
- }
- }
- if (lessonStatus) {
- break;
- }
- }
- // 判断当前章节下面课程是否有内容,否则往下一个章节走
- if (lessonStatus) {
- popupData.chapterLoading = true;
- data.detailId = coursewareDetailKnowledgeId;
- data.lessonCoursewareDetailId = lessonCoursewareDetailId;
- // 更新上课记录 上课的时候才更新
- if (data.type !== 'preview') {
- await classCourseScheduleUpdate();
- }
- await getDetail();
- popupData.activeIndex = 0;
- popupData.chapterOpen = false;
- popupData.chapterLoading = false;
- return;
- }
- let nextLessonStatus = false;
- while (detailIndex <= popupData.chapterDetails.length - 1) {
- detailIndex++;
- const tempDetail =
- popupData.chapterDetails[detailIndex]?.knowledgeList || [];
- let tempLessonLength = 0;
- while (tempLessonLength <= tempDetail.length - 1) {
- if (tempDetail[tempLessonLength].containMaterial) {
- nextLessonStatus = true;
- lessonCoursewareDetailId =
- tempDetail[tempLessonLength].lessonCoursewareDetailId;
- coursewareDetailKnowledgeId = tempDetail[tempLessonLength].id;
- }
- tempLessonLength++;
- if (nextLessonStatus) {
- break;
- }
- }
- if (nextLessonStatus) {
- break;
- }
- }
- // 判断当前章节下面课程是否有内容,否则往上一个章节走
- if (nextLessonStatus) {
- popupData.chapterLoading = true;
- data.detailId = coursewareDetailKnowledgeId;
- data.lessonCoursewareDetailId = lessonCoursewareDetailId;
- // 更新上课记录 上课的时候才更新
- if (data.type !== 'preview') {
- await classCourseScheduleUpdate();
- }
- await getDetail();
- popupData.activeIndex = 0;
- popupData.chapterOpen = false;
- popupData.chapterLoading = false;
- return;
- }
- }
- };
- /** 弹窗关闭 */
- const handleClosePopup = () => {
- const item = data.itemList[popupData.activeIndex];
- if (item?.type == 'VIDEO' && !item.videoEle?.paused) {
- setModelOpen();
- }
- if (item?.type == 'SONG' && !item.audioEle?.paused) {
- setModelOpen();
- }
- };
- document.body.addEventListener('keyup', (e: KeyboardEvent) => {
- console.log(e, 'e');
- if (e.code === 'ArrowLeft') {
- // if (popupData.activeIndex === 0) return;
- setModalOpen();
- handlePreAndNext('up');
- } else if (e.code === 'ArrowRight') {
- // if (popupData.activeIndex === data.itemList.length - 1) return;
- setModalOpen();
- handlePreAndNext('down');
- } else if (e.code === 'Space') {
- // const activeItem = data.itemList[popupData.activeIndex];
- // // // 暂停视频和曲谱的播放
- // if (activeItem.type === 'VIDEO' && activeItem.videoEle) {
- // activeItem.videoEle?.play();
- // }
- // if (activeItem.type === 'SONG' && activeItem.audioEle) {
- // activeItem.audioEle?.play();
- // }
- // if (activeItem.type === 'MUSIC') {
- // activeItem.iframeRef?.contentWindow?.postMessage(
- // { api: 'setPlayState' },
- // '*'
- // );
- // }
- }
- });
- // const toggleListenerKeyUp = (type: string) => {
- // if (type === 'remove') {
- // document.body.removeEventListener('keyup', () => {
- // listenerKeyUpState.value = false;
- // });
- // } else {
- // // 监听页面键盘事件 - 上下切换
- // document.body.addEventListener('keyup', (e: KeyboardEvent) => {
- // // console.log(e, 'e');
- // if (e.code === 'ArrowLeft') {
- // // if (popupData.activeIndex === 0) return;
- // setModalOpen();
- // handlePreAndNext('up');
- // } else if (e.code === 'ArrowRight') {
- // // if (popupData.activeIndex === data.itemList.length - 1) return;
- // setModalOpen();
- // handlePreAndNext('down');
- // }
- // });
- // listenerKeyUpState.value = true;
- // }
- // };
- // 监听切换到ppt课件时,手动移除键盘监听器
- // watch(() => popupData.activeIndex, () => {
- // const activeItem = data.itemList[popupData.activeIndex];
- // if (activeItem?.type === 'PPT') {
- // toggleListenerKeyUp('remove')
- // } else {
- // !listenerKeyUpState.value && toggleListenerKeyUp('add')
- // }
- // })
- const setModalOpen = (status = true) => {
- clearTimeout(activeData.timer);
- activeData.model = status;
- Object.values(data.videoRefs).map((n: any) =>
- n?.toggleHideControl(status)
- );
- Object.values(data.audioRefs).map((n: any) =>
- n?.toggleHideControl(status)
- );
- };
- /** 教学数据 */
- const studyData = reactive({
- type: '' as ToolType,
- penShow: false,
- whiteboardShow: false
- });
- /** 打开教学工具 */
- const openStudyTool = (item: ToolItem) => {
- // const activeItem = data.itemList[popupData.activeIndex];
- // // 暂停视频和曲谱的播放
- // if (activeItem.type === 'VIDEO' && activeItem.videoEle) {
- // activeItem.videoEle?.pause();
- // }
- // if (activeItem.type === 'SONG' && activeItem.audioEle) {
- // activeItem.audioEle?.stop();
- // }
- // if (activeItem.type === 'MUSIC') {
- // activeItem.iframeRef?.contentWindow?.postMessage(
- // { api: 'setPlayState' },
- // '*'
- // );
- // }
- handleStop();
- clearModel();
- popupData.toolOpen = false;
- studyData.type = item.type;
- switch (item.type) {
- case 'pen':
- studyData.penShow = true;
- break;
- case 'whiteboard':
- studyData.whiteboardShow = true;
- }
- };
- /** 关闭教学工具 */
- const closeStudyTool = () => {
- studyData.type = 'init';
- toggleModel();
- setModelOpen();
- };
- const startShowModal = (
- val: 'setTimeIcon' | 'beatIcon' | 'toneIcon' | 'iconNote2'
- ) => {
- if (val == 'setTimeIcon') {
- showModalTime.value = true;
- }
- if (val == 'beatIcon') {
- showModalBeat.value = true;
- }
- if (val == 'toneIcon') {
- showModalTone.value = true;
- }
- };
- // 是否允许上一页
- const isUpArrow = computed(() => {
- /**
- * 1,判断当前课程中是否处在第一个资源;
- * 2,判断当前课程是否在当前章节的第一个;
- * 3,判断当前章节,当前课程上面还没有其它课程,是否有资源;
- * 4,判断当前章节上面还没有其它章节;
- * 5,判断上面章节里面课程是否有资源;
- */
- if (popupData.activeIndex > 0) {
- return true;
- }
- // 获取当前是哪个章节
- let detailIndex = popupData.chapterDetails.findIndex(
- (item: any) => item.id == data.lessonCoursewareDetailId
- );
- const detailItem =
- popupData.chapterDetails[detailIndex]?.knowledgeList || [];
- let lessonIndex = detailItem.findIndex(
- (item: any) => item.id == data.detailId
- );
- // 说明已经是第一单元,第一课
- if (detailIndex <= 0 && lessonIndex <= 0) {
- return false;
- }
- let lessonStatus = false; // 当前章节上面是否有内容
- while (lessonIndex >= 0) {
- lessonIndex--;
- if (lessonIndex >= 0) {
- if (detailItem[lessonIndex].containMaterial) {
- lessonStatus = true;
- }
- }
- }
- // 判断当前章节下面课程是否有内容,否则往上一个章节走
- if (lessonStatus) {
- return true;
- }
- // 已经是第一个章节了
- if (detailIndex <= 0) {
- return false;
- }
- let prevLessonStatus = false;
- while (detailIndex >= 0) {
- detailIndex--;
- const tempDetail =
- popupData.chapterDetails[detailIndex]?.knowledgeList || [];
- let tempLessonLength = tempDetail.length;
- while (tempLessonLength > 0) {
- if (tempDetail[tempLessonLength - 1].containMaterial) {
- prevLessonStatus = true;
- }
- tempLessonLength--;
- }
- if (prevLessonStatus) {
- return true;
- }
- }
- return false;
- });
- // 是否允许下一页
- const isDownArrow = computed(() => {
- if (popupData.activeIndex < data.itemList.length - 1) {
- return true;
- }
- // 获取当前是哪个章节
- let detailIndex = popupData.chapterDetails.findIndex(
- (item: any) => item.id == data.lessonCoursewareDetailId
- );
- const detailItem =
- popupData.chapterDetails[detailIndex]?.knowledgeList || [];
- let lessonIndex = detailItem.findIndex(
- (item: any) => item.id == data.detailId
- );
- // 说明已经是最后-单元,最后一课
- if (
- detailIndex >= popupData.chapterDetails.length - 1 &&
- lessonIndex >= detailItem.length - 1
- ) {
- return false;
- }
- let lessonStatus = false; // 当前章节下面是否有内容
- while (lessonIndex < detailItem.length - 1) {
- lessonIndex++;
- if (lessonIndex >= 0) {
- if (detailItem[lessonIndex].containMaterial) {
- lessonStatus = true;
- }
- }
- }
- // 判断当前章节下面课程是否有内容,否则往下一个章节走
- if (lessonStatus) {
- return true;
- }
- // 已经是最后一个章节了
- if (detailIndex >= popupData.chapterDetails.length - 1) {
- return false;
- }
- let nextLessonStatus = false;
- while (detailIndex < popupData.chapterDetails.length - 1) {
- detailIndex++;
- const tempDetail =
- popupData.chapterDetails[detailIndex]?.knowledgeList || [];
- let tempLessonLength = 0;
- while (tempLessonLength <= tempDetail.length - 1) {
- if (tempDetail[tempLessonLength].containMaterial) {
- nextLessonStatus = true;
- }
- tempLessonLength++;
- }
- if (nextLessonStatus) {
- return true;
- }
- }
- return false;
- });
- const activeVideoItem = computed(() => {
- const item = data.itemList[popupData.activeIndex];
- if (item && item.type && item.type.toLocaleUpperCase() === 'VIDEO') {
- return item;
- }
- return {};
- });
- // 右侧菜单栏
- const rightList = reactive([
- {
- name: '结束课程',
- name2: '结束预览',
- icon: rightIconEnd,
- id: 1
- },
- {
- name: '布置作业',
- icon: rightIconArrange,
- id: 2
- },
- {
- name: '曲目资源',
- icon: rightIconMusic,
- id: 9
- },
- {
- name: '批注',
- icon: rightIconPostil,
- id: 3
- },
- {
- name: '白板',
- icon: rightIconWhiteboard,
- id: 4
- },
- {
- name: '节拍器',
- icon: rightIconMetronome,
- id: 5
- },
- {
- name: '调音器',
- icon: rightIconTuner,
- id: 6
- },
- {
- name: '计时器',
- icon: rightIconTimer,
- id: 7
- },
- {
- name: '收起',
- icon: rightIconPackUp,
- id: 8
- }
- ]);
- // 底部菜单栏
- const bottomList = reactive([
- {
- name: '切换章节',
- icon: bottomIconSwitch,
- id: 1
- },
- {
- name: '资源列表',
- icon: bottomIconResource,
- id: 2
- },
- {
- name: '上一张',
- icon: bottomIconPre,
- id: 3
- },
- {
- name: '下一张',
- icon: bottomIconNext,
- id: 4
- }
- ]);
- const rightColumnShow = ref(true);
- // 右边栏操作
- const operateRightBtn = async (id: number) => {
- switch (id) {
- case 1:
- if (data.type === 'preview') {
- handleStop();
- data.removeVisiable = true;
- data.removeTitle = '结束预览';
- data.removeContent = '请确认是否结束预览?';
- } else {
- const res = await getStudentAfterWork({
- courseScheduleId: data.classId,
- page: 1,
- rows: 99
- });
- if (res.data.rows && res.data.rows.length) {
- data.removeContent = '请确认是否结束课程?';
- data.removeCourseStatus = false;
- } else {
- data.removeContent = '本次课堂尚未布置作业,是否结束课程?';
- data.removeCourseStatus = true;
- }
- data.removeVisiable = true;
- data.removeTitle = '结束课程';
- }
- break;
- case 2:
- // 学生人数必须大于0,才可以布置作业
- if (data.preStudentNum <= 0) return;
- const res = await lessonPreTrainingPage({
- coursewareKnowledgeDetailId: data.detailId,
- subjectId: data.subjectId,
- page: 1,
- rows: 99
- });
- if (res.data.rows && res.data.rows.length) {
- data.modalAttendMessage = '本节课已设置课后作业,是否布置?';
- }
- data.modelAttendStatus = true;
- break;
- case 3:
- openStudyTool({
- type: 'pen',
- icon: iconNote,
- name: '批注'
- });
- break;
- case 4:
- openStudyTool({
- type: 'whiteboard',
- icon: iconWhite,
- name: '白板'
- });
- break;
- case 5:
- startShowModal('beatIcon');
- break;
- case 6:
- startShowModal('toneIcon');
- break;
- case 7:
- startShowModal('setTimeIcon');
- break;
- case 8:
- rightColumnShow.value = false;
- break;
- case 9:
- // 选择曲目时需要暂停所有播放
- handleStop();
- data.selectResourceStatus = true;
- break;
- default:
- break;
- }
- };
- // 底部悬浮按钮操作
- const operateBottomBtn = (id: number) => {
- switch (id) {
- case 1:
- popupData.chapterOpen = true;
- break;
- case 2:
- popupData.open = true;
- nextTick(() => {
- scrollResourceSection();
- });
- break;
- case 3:
- if (!isUpArrow.value) return;
- handlePreAndNext('up');
- break;
- case 4:
- if (!isDownArrow.value) return;
- handlePreAndNext('down');
- break;
- default:
- break;
- }
- };
- // 滚动到某个元素的位置
- const scrollResourceSection = () => {
- const drawerCardItemRefs =
- document.querySelectorAll('.drawerCardItemRef');
- if (
- popupData.activeIndex >= 0 &&
- drawerCardItemRefs[popupData.activeIndex]
- ) {
- drawerCardItemRefs[popupData.activeIndex].scrollIntoView();
- }
- };
- return () => (
- <div id="playContent" class={[styles.playContent, 'wrap']}>
- <div
- onClick={() => {
- clearTimeout(activeData.timer);
- activeData.model = !activeData.model;
- Object.values(data.videoRefs).map((n: any) =>
- n?.toggleHideControl(activeData.model)
- );
- Object.values(data.audioRefs).map((n: any) =>
- n?.toggleHideControl(activeData.model)
- );
- }}>
- <div
- class={styles.coursewarePlay}
- style={{ width: parentContainer.width }}>
- {!popupData.chapterLoading ? (
- <div class={styles.wraps}>
- <div
- style={
- activeVideoItem.value.type &&
- data.animationState === 'end' &&
- data.videoState === 'play'
- ? {
- zIndex: 15,
- opacity: 1
- }
- : { opacity: 0, zIndex: -1 }
- }
- class={styles.itemDiv}>
- <VideoPlay
- ref={(el: any) => (data.videoItemRef = el)}
- item={activeVideoItem.value}
- showModel={activeData.model}
- onClose={setModelOpen}
- onCanplay={() => {
- data.videoState = 'play';
- }}
- onPause={() => {
- clearTimeout(activeData.timer);
- activeData.model = true;
- }}
- onEnded={() => {
- const _index = popupData.activeIndex + 1;
- if (_index < data.itemList.length) {
- handleSwipeChange(_index);
- }
- }}
- />
- </div>
- {data.itemList.map((m: any, mIndex: number) => {
- const isRender = Math.abs(popupData.activeIndex - mIndex) < 2;
- const isEmtry = Math.abs(popupData.activeIndex - mIndex) > 4;
- // if (isRender && m.type === 'PPT') {
- // setTimeout(() => iframeClick() ,500)
- // }
- // if (isRender) {
- // m.isRender = true;
- // }
- // console.log(isRender, 'isRender', mIndex);
- return isRender ? (
- <div
- key={'index' + mIndex}
- class={[
- styles.itemDiv,
- popupData.activeIndex === mIndex && styles.itemActive,
- activeData.isAnimation && styles.acitveAnimation,
- Math.abs(popupData.activeIndex - mIndex) < 2
- ? styles.show
- : styles.hide
- ]}
- style={
- mIndex < popupData.activeIndex
- ? effects[effectIndex.value].prev
- : mIndex > popupData.activeIndex
- ? effects[effectIndex.value].next
- : {}
- }
- onClick={(e: Event) => {
- e.stopPropagation();
- clearTimeout(activeData.timer);
- if (Date.now() - activeData.nowTime < 300) {
- handleDbClick(m);
- return;
- }
- activeData.nowTime = Date.now();
- activeData.timer = setTimeout(() => {
- activeData.model = !activeData.model;
- Object.values(data.videoRefs).map((n: any) =>
- n?.toggleHideControl(activeData.model)
- );
- Object.values(data.audioRefs).map((n: any) =>
- n?.toggleHideControl(activeData.model)
- );
- if (activeData.model) {
- setModelOpen();
- }
- }, 300);
- }}>
- {m.type === 'VIDEO' ? (
- <>
- <img
- src={m.coverImg}
- onLoad={() => {
- m.isprepare = true;
- }}
- />
- {/* <VideoPlay
- ref={(v: any) => (data.videoRefs[mIndex] = v)}
- item={m}
- isEmtry={isEmtry}
- onLoadedmetadata={(videoItem: any) => {
- m.videoEle = videoItem;
- m.isprepare = true;
- }}
- onTogglePlay={(paused: boolean) => {
- m.autoPlay = false;
- if (paused || popupData.open) {
- clearTimeout(activeData.timer);
- } else {
- setModelOpen();
- }
- }}
- onReset={() => {
- if (!m.videoEle?.paused) {
- setModelOpen();
- }
- }}
- onError={() => {
- console.log('video error');
- m.error = true;
- }}
- /> */}
- <Transition name="van-fade">
- {
- <div class={styles.loadWrap}>
- <Vue3Lottie
- animationData={playLoadData}></Vue3Lottie>
- </div>
- }
- </Transition>
- </>
- ) : m.type === 'IMG' ? (
- <img src={m.content} />
- ) : m.type === 'SONG' ? (
- <AudioPay
- item={m}
- ref={(v: any) => (data.audioRefs[mIndex] = v)}
- onLoadedmetadata={(audioItem: any) => {
- m.audioEle = audioItem;
- m.isprepare = true;
- }}
- onTogglePlay={(paused: boolean) => {
- m.autoPlay = false;
- if (paused || popupData.open) {
- clearTimeout(activeData.timer);
- } else {
- setModelOpen();
- }
- }}
- onEnded={() => {
- const _index = popupData.activeIndex + 1;
- if (_index < data.itemList.length) {
- handleSwipeChange(_index);
- }
- }}
- onReset={() => {
- if (!m.audioEle?.paused) {
- setModelOpen();
- }
- }}
- />
- ) : // : m.type === 'PPT' ? <div class={styles.iframePpt}>
- // <div class={styles.pptBox}></div>
- // <iframe src={`https://view.officeapps.live.com/op/embed.aspx?src=${encodeURIComponent(m.content)}`} width='100%' height='100%' frameborder='1'></iframe>
- // </div>
- m.type === 'PPT' ? (
- <iframe
- src={`https://view.officeapps.live.com/op/embed.aspx?src=${encodeURIComponent(
- m.content
- )}`}
- width="100%"
- height="100%"
- frameborder="1"></iframe>
- ) : (
- <MusicScore
- activeModel={activeData.model}
- activeStatus={popupData.activeIndex === mIndex}
- data-vid={m.id}
- music={m}
- onSetIframe={(el: any) => {
- m.iframeRef = el;
- }}
- />
- )}
- </div>
- ) : null;
- })}
- </div>
- ) : (
- ''
- )}
- </div>
- </div>
- {/* 右边操作栏 */}
- <div
- class={[
- styles.rightColumn,
- !rightColumnShow.value ? styles.rightColumnHide : '',
- studyData.type !== 'init' &&
- (studyData.penShow || studyData.whiteboardShow)
- ? styles.rightColumnZ
- : ''
- ]}>
- {rightList.map((item: any, index: number) => (
- <div
- class={[
- styles.rightItem,
- item.id === 2 && data.preStudentNum <= 0
- ? styles.itemDisabled
- : ''
- ]}
- onClick={() => operateRightBtn(item.id)}>
- <img src={item.icon} />
- <div class={styles.rightTips}>
- {index === 0 && data.type === 'preview'
- ? item.name2
- : item.name}
- </div>
- </div>
- ))}
- </div>
- {!rightColumnShow.value && (
- <img
- class={[
- styles.rightHideIcon,
- !rightColumnShow.value ? styles.rightIconShow : ''
- ]}
- src={rightHideIcon}
- onClick={() => (rightColumnShow.value = true)}
- />
- )}
- {/* 右下角悬浮按钮 */}
- <div class={styles.bottomColumn}>
- {bottomList.map((item: any, index: number) => (
- <div
- class={[
- styles.bottomItem,
- (item.id === 3 && !isUpArrow.value) ||
- (item.id === 4 && !isDownArrow.value)
- ? styles.itemDisabled
- : ''
- ]}
- onClick={() => operateBottomBtn(item.id)}>
- <img src={item.icon} />
- <div class={styles.bottomTips}>{item.name}</div>
- </div>
- ))}
- </div>
- {/* 显示列表 */}
- <NDrawer
- v-model:show={popupData.open}
- class={styles.drawerContainer}
- onAfterLeave={handleClosePopup}
- showMask={false}>
- <NDrawerContent closable>
- {{
- header: () => (
- <TheNoticeBar text={activeName.value || '资源列表'} />
- ),
- default: () => (
- <div ref={drawerCardRef} id="drawerCardRef">
- {data.knowledgePointList.map((item: any, index: number) => {
- return (
- <div class={[styles.cardContainer, 'drawerCardItemRef']}>
- <CardType
- item={item}
- isActive={popupData.activeIndex === index}
- isCollect={false}
- isShowCollect={false}
- onClick={(item: any) => {
- popupData.open = false;
- toggleMaterial(item.id);
- }}
- />
- </div>
- );
- })}
- </div>
- )
- }}
- </NDrawerContent>
- </NDrawer>
- {/* 显示列表 */}
- <NDrawer
- v-model:show={popupData.chapterOpen}
- class={styles.drawerContainer}
- onAfterLeave={handleClosePopup}
- showMask={false}
- displayDirective="show">
- <NDrawerContent title="切换章节" closable>
- <Chapter
- treeList={popupData.chapterDetails}
- itemActive={data.detailId as any}
- onHandleSelect={async (val: any) => {
- popupData.chapterLoading = true;
- try {
- data.detailId = val.itemActive;
- const ids = formatParentId(
- val.itemActive,
- popupData.chapterDetails
- );
- data.lessonCoursewareDetailId = ids[0];
- // 更新上课记录 上课的时候才更新
- if (data.type !== 'preview') {
- await classCourseScheduleUpdate();
- }
- await getDetail();
- popupData.activeIndex = 0;
- popupData.chapterOpen = false;
- } catch {
- //
- }
- popupData.chapterLoading = false;
- }}
- />
- </NDrawerContent>
- </NDrawer>
- {/* 批注 */}
- {studyData.penShow && (
- <Pen
- show={studyData.type === 'pen'}
- type={studyData.type}
- close={() => closeStudyTool()}
- />
- )}
- {studyData.whiteboardShow && (
- <Pen
- show={studyData.type === 'whiteboard'}
- type={studyData.type}
- close={() => closeStudyTool()}
- />
- )}
- {/* 布置作业 */}
- <NModal
- transformOrigin="center"
- v-model:show={data.modelAttendStatus}
- preset="card"
- // class={styles.attendClassModal}
- title={'课后作业'}
- class={['modalTitle', styles.removeVisiable]}>
- <div class={styles.studentRemove}>
- <p>{data.modalAttendMessage}</p>
- {/* <div class={styles.modelAttendContent}>
- {data.modalAttendMessage}
- </div> */}
- <NSpace class={styles.btnGroupModal} justify="center">
- <NButton
- type="default"
- round
- onClick={() => {
- data.modelAttendStatus = false;
- handleStop();
- data.modelAttendStatus = false;
- }}>
- 暂不布置
- </NButton>
- <NButton
- type="primary"
- round
- onClick={() => {
- data.modelTrainStatus = true;
- data.modelAttendStatus = false;
- }}>
- 布置
- </NButton>
- </NSpace>
- </div>
- </NModal>
- {/* 训练设置 */}
- <NModal
- transformOrigin="center"
- v-model:show={data.modelTrainStatus}
- preset="card"
- class={[styles.attendClassModal, styles.trainClassModal]}
- title={'作业设置'}>
- <TrainSettings
- detailId={data.detailId}
- subjectId={data.subjectId}
- courseScheduleId={data.classId}
- classGroupId={data.classGroupId}
- onClose={() => (data.modelTrainStatus = false)}
- onConfirm={() => {
- // 布置完作业之后直接关闭
- // setTimeout(() => {
- // handleStop();
- // if (state.application) {
- // emit('close');
- // } else {
- // window.close();
- // }
- // }, 1000);
- data.modelTrainStatus = false;
- }}
- />
- </NModal>
- <NModal
- transformOrigin="center"
- class={['modalTitle background']}
- title={'节拍器'}
- preset="card"
- v-model:show={showModalBeat.value}
- style={{ width: '687px' }}>
- <div class={styles.modeWrap}>
- <iframe
- src={`${vaildUrl()}/metronome/?id=${new Date().getTime()}`}
- scrolling="no"
- frameborder="0"
- width="100%"
- height={'650px'}></iframe>
- </div>
- </NModal>
- <NModal
- transformOrigin="center"
- class={['background']}
- v-model:show={showModalTone.value}>
- <div>
- <PlaceholderTone
- onClose={() => {
- showModalTone.value = false;
- }}></PlaceholderTone>
- </div>
- </NModal>
- <NModal
- transformOrigin="center"
- v-model:show={showModalTime.value}
- class={['modalTitle background']}
- title={'计时器'}
- preset="card"
- style={{ width: px2vw(772) }}>
- <div>
- <TimerMeter></TimerMeter>
- </div>
- </NModal>
- <NModal
- v-model:show={data.selectResourceStatus}
- class={['modalTitle', styles.selectMusicModal]}
- preset="card"
- title={'选择资源'}>
- <SelectResources from="class" />
- </NModal>
- <NModal
- transformOrigin="center"
- v-model:show={data.removeVisiable}
- preset="card"
- class={['modalTitle', styles.removeVisiable]}
- title={data.removeTitle}>
- <div class={styles.studentRemove}>
- <p>{data.removeContent}</p>
- <NSpace class={styles.btnGroupModal} justify="center">
- <NButton
- round
- onClick={() => {
- if (data.removeCourseStatus) {
- if (globalState.application) {
- document.exitFullscreen
- ? document.exitFullscreen()
- : document.mozCancelFullScreen
- ? document.mozCancelFullScreen()
- : document.webkitExitFullscreen
- ? document.webkitExitFullscreen()
- : '';
- emit('close');
- } else {
- window.close();
- }
- } else {
- data.removeVisiable = false;
- }
- }}>
- {data.removeCourseStatus ? '结束课程' : '取消'}
- </NButton>
- <NButton
- round
- type="primary"
- onClick={() => {
- //
- if (data.removeCourseStatus) {
- data.modelTrainStatus = true;
- data.removeVisiable = false;
- } else {
- if (globalState.application) {
- document.exitFullscreen
- ? document.exitFullscreen()
- : document.mozCancelFullScreen
- ? document.mozCancelFullScreen()
- : document.webkitExitFullscreen
- ? document.webkitExitFullscreen()
- : '';
- emit('close');
- } else {
- window.close();
- }
- }
- }}>
- {data.removeCourseStatus ? '布置作业' : '确定'}
- </NButton>
- </NSpace>
- </div>
- </NModal>
- </div>
- );
- }
- });
|