|
@@ -327,10 +327,14 @@ export default defineComponent({
|
|
|
setModalOpen();
|
|
|
handlePreAndNext('down');
|
|
|
}
|
|
|
+
|
|
|
+ if (ev.data?.code === 'Tab') {
|
|
|
+ onTabClick();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- // 点名返回
|
|
|
if (ev.data?.api === 'callBack') {
|
|
|
+ // 点名返回
|
|
|
closeStudyTool();
|
|
|
studyData.callShow = false;
|
|
|
}
|
|
@@ -349,6 +353,50 @@ export default defineComponent({
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ const onTabClick = () => {
|
|
|
+ const activeItem = data.itemList[popupData.activeIndex];
|
|
|
+ // console.log(activeItem, activeItem.videoEle);
|
|
|
+ // 暂停视频和曲谱的播放
|
|
|
+ if (activeItem.type === 'VIDEO' && activeItem.videoEle) {
|
|
|
+ if (activeItem.videoEle?.paused()) {
|
|
|
+ activeItem.videoEle?.play();
|
|
|
+ } else {
|
|
|
+ activeItem.videoEle?.pause();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (activeItem.type === 'SONG' && activeItem.audioEle) {
|
|
|
+ data.audioRefs[popupData.activeIndex]?.onToggleAudio();
|
|
|
+ }
|
|
|
+ if (activeItem.type === 'MUSIC') {
|
|
|
+ activeItem.iframeRef?.contentWindow?.postMessage(
|
|
|
+ { api: 'startPlayState' },
|
|
|
+ '*'
|
|
|
+ );
|
|
|
+ }
|
|
|
+ if (activeItem.type === 'LISTEN') {
|
|
|
+ console.log(activeItem.type, 'listening');
|
|
|
+ activeItem.iframeRef?.contentWindow?.postMessage(
|
|
|
+ { api: 'startPlayState' },
|
|
|
+ '*'
|
|
|
+ );
|
|
|
+ }
|
|
|
+ if (activeItem.type === 'RHYTHM') {
|
|
|
+ activeItem.iframeRef?.contentWindow?.postMessage(
|
|
|
+ { api: 'setPlayState', data: true },
|
|
|
+ '*'
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ if (activeItem.type === 'PPT') {
|
|
|
+ console.log(activeItem.iframeRef, 'activeItem.iframeRef;');
|
|
|
+ activeItem.iframeRef?.focus();
|
|
|
+
|
|
|
+ // 将焦点传递给 iframe 内部内容
|
|
|
+ const iframeWindow = activeItem.iframeRef?.contentWindow;
|
|
|
+ iframeWindow.postMessage({ type: 'focus' }, '*');
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
onMounted(async () => {
|
|
|
// initMoveable();
|
|
|
const query = route.query;
|
|
@@ -412,6 +460,7 @@ export default defineComponent({
|
|
|
popupData.open
|
|
|
)
|
|
|
return;
|
|
|
+ console.log(e.code, 'code');
|
|
|
if (e.code === 'ArrowUp' || e.code === 'PageUp') {
|
|
|
// if (popupData.activeIndex === 0) return;
|
|
|
setModalOpen();
|
|
@@ -423,43 +472,7 @@ export default defineComponent({
|
|
|
} else if (e.code === 'Tab') {
|
|
|
console.log('Space clicked');
|
|
|
|
|
|
- const activeItem = data.itemList[popupData.activeIndex];
|
|
|
- // console.log(activeItem, activeItem.videoEle);
|
|
|
- // 暂停视频和曲谱的播放
|
|
|
- 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: 'startPlayState' },
|
|
|
- '*'
|
|
|
- );
|
|
|
- }
|
|
|
- if (activeItem.type === 'LISTEN') {
|
|
|
- console.log(activeItem.type, 'listening');
|
|
|
- activeItem.iframeRef?.contentWindow?.postMessage(
|
|
|
- { api: 'startPlayState' },
|
|
|
- '*'
|
|
|
- );
|
|
|
- }
|
|
|
- if (activeItem.type === 'RHYTHM') {
|
|
|
- activeItem.iframeRef?.contentWindow?.postMessage(
|
|
|
- { api: 'setPlayState', data: true },
|
|
|
- '*'
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
- if (activeItem.type === 'PPT') {
|
|
|
- console.log(activeItem.iframeRef, 'activeItem.iframeRef;');
|
|
|
- activeItem.iframeRef?.focus();
|
|
|
-
|
|
|
- // 将焦点传递给 iframe 内部内容
|
|
|
- const iframeWindow = activeItem.iframeRef?.contentWindow;
|
|
|
- iframeWindow.postMessage({ type: 'focus' }, '*');
|
|
|
- }
|
|
|
+ onTabClick();
|
|
|
}
|
|
|
});
|
|
|
});
|