|
@@ -54,6 +54,7 @@ export default defineComponent({
|
|
|
if (activeItem.type != 'VIDEO') return;
|
|
|
if (value == 'hidden') {
|
|
|
isPlay.value = !activeItem.videoEle?.paused;
|
|
|
+ isPlay.value = !activeItem.audioEle?.paused;
|
|
|
togglePlay(activeItem, false);
|
|
|
} else {
|
|
|
// 页面显示,并且
|
|
@@ -95,6 +96,7 @@ export default defineComponent({
|
|
|
isCourse: false,
|
|
|
isRecordPlay: false,
|
|
|
videoRefs: {} as any[],
|
|
|
+ audioRefs: {} as any[],
|
|
|
modelAttendStatus: false, // 布置作业提示弹窗
|
|
|
modelTrainStatus: false // 训练设置
|
|
|
});
|
|
@@ -129,26 +131,26 @@ export default defineComponent({
|
|
|
// };
|
|
|
const getDetail = async () => {
|
|
|
data.knowledgePointList = [
|
|
|
- // {
|
|
|
- // id: '5',
|
|
|
- // name: '歌曲表演 大鹿',
|
|
|
- // title: '歌曲表演 大鹿',
|
|
|
- // type: 'AUDIO',
|
|
|
- // content:
|
|
|
- // 'https://cloud-coach.ks3-cn-beijing.ksyuncs.com/1686819360752.mp3',
|
|
|
- // url: 'https://lanhu-dds-backend.oss-cn-beijing.aliyuncs.com/merge_image/imgs/23cc71b5d7874dcf8752cd257483e687_mergeImage.png'
|
|
|
- // },
|
|
|
{
|
|
|
- id: '1',
|
|
|
- name: '其多列',
|
|
|
- title: '其多列',
|
|
|
- type: 'VIDEO',
|
|
|
+ id: '5',
|
|
|
+ name: '歌曲表演 大鹿',
|
|
|
+ title: '歌曲表演 大鹿',
|
|
|
+ type: 'AUDIO',
|
|
|
content:
|
|
|
- 'https://gyt.ks3-cn-beijing.ksyuncs.com/courseware/1687844560120.mp4',
|
|
|
- url: 'https://gyt.ks3-cn-beijing.ksyuncs.com/courseware/1687844640957.png'
|
|
|
+ 'https://cloud-coach.ks3-cn-beijing.ksyuncs.com/1686819360752.mp3',
|
|
|
+ url: 'https://lanhu-dds-backend.oss-cn-beijing.aliyuncs.com/merge_image/imgs/23cc71b5d7874dcf8752cd257483e687_mergeImage.png'
|
|
|
},
|
|
|
// {
|
|
|
// id: '1',
|
|
|
+ // name: '其多列',
|
|
|
+ // title: '其多列',
|
|
|
+ // type: 'VIDEO',
|
|
|
+ // content:
|
|
|
+ // 'https://gyt.ks3-cn-beijing.ksyuncs.com/courseware/1687844560120.mp4',
|
|
|
+ // url: 'https://gyt.ks3-cn-beijing.ksyuncs.com/courseware/1687844640957.png'
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // id: '1',
|
|
|
// name: '歌曲表演 大鹿',
|
|
|
// title: '歌曲表演 大鹿',
|
|
|
// type: 'VIDEO',
|
|
@@ -186,6 +188,7 @@ export default defineComponent({
|
|
|
...m,
|
|
|
iframeRef: null,
|
|
|
videoEle: null,
|
|
|
+ audioEle: null,
|
|
|
autoPlay: false, //加载完成是否自动播放
|
|
|
isprepare: false, // 视频是否加载完成
|
|
|
isRender: false // 是否渲染了
|
|
@@ -231,9 +234,14 @@ export default defineComponent({
|
|
|
const handleStop = () => {
|
|
|
for (let i = 0; i < data.itemList.length; i++) {
|
|
|
const activeItem = data.itemList[i];
|
|
|
+ console.log(activeItem, 'activeItem');
|
|
|
if (activeItem.type === 'VIDEO' && activeItem.videoEle) {
|
|
|
activeItem.videoEle.stop();
|
|
|
}
|
|
|
+
|
|
|
+ if (activeItem.type === 'AUDIO' && activeItem.audioEle) {
|
|
|
+ activeItem.audioEle.stop();
|
|
|
+ }
|
|
|
// console.log('🚀 ~ activeItem:', activeItem)
|
|
|
// 停止曲谱的播放
|
|
|
if (activeItem.type === 'SONG') {
|
|
@@ -260,6 +268,10 @@ export default defineComponent({
|
|
|
Object.values(data.videoRefs).map((n: any) =>
|
|
|
n.toggleHideControl(false)
|
|
|
);
|
|
|
+
|
|
|
+ Object.values(data.audioRefs).map((n: any) =>
|
|
|
+ n.toggleHideControl(false)
|
|
|
+ );
|
|
|
}, 4000);
|
|
|
};
|
|
|
|
|
@@ -269,10 +281,12 @@ export default defineComponent({
|
|
|
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));
|
|
|
};
|
|
|
|
|
|
// 双击
|
|
@@ -381,6 +395,15 @@ export default defineComponent({
|
|
|
if (item.type == 'SONG') {
|
|
|
activeData.model = true;
|
|
|
}
|
|
|
+ if (item.type === 'AUDIO') {
|
|
|
+ // 自动播放下一个音频
|
|
|
+ clearTimeout(activeData.timer);
|
|
|
+ message.destroyAll();
|
|
|
+ item.autoPlay = true;
|
|
|
+ nextTick(() => {
|
|
|
+ item.audioEle?.onPlay();
|
|
|
+ });
|
|
|
+ }
|
|
|
if (item.type === 'VIDEO') {
|
|
|
// 自动播放下一个视频
|
|
|
clearTimeout(activeData.timer);
|
|
@@ -439,11 +462,15 @@ export default defineComponent({
|
|
|
if (item?.type == 'VIDEO' && !item.videoEle?.paused) {
|
|
|
setModelOpen();
|
|
|
}
|
|
|
+
|
|
|
+ if (item?.type == 'AUDIO' && !item.audioEle?.paused) {
|
|
|
+ setModelOpen();
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
// 监听页面键盘事件 - 上下切换
|
|
|
document.body.addEventListener('keyup', (e: KeyboardEvent) => {
|
|
|
- console.log(e, 'e');
|
|
|
+ // console.log(e, 'e');
|
|
|
if (e.code === 'ArrowUp') {
|
|
|
if (popupData.activeIndex === 0) return;
|
|
|
handlePreAndNext('up');
|
|
@@ -469,6 +496,9 @@ export default defineComponent({
|
|
|
if (activeItem.type === 'VIDEO' && activeItem.videoEle) {
|
|
|
activeItem.videoEle.pause();
|
|
|
}
|
|
|
+ if (activeItem.type === 'AUDIO' && activeItem.audioEle) {
|
|
|
+ activeItem.audioEle.stop();
|
|
|
+ }
|
|
|
if (activeItem.type === 'SONG') {
|
|
|
activeItem.iframeRef?.contentWindow?.postMessage(
|
|
|
{ api: 'setPlayState' },
|
|
@@ -513,6 +543,9 @@ export default defineComponent({
|
|
|
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}
|
|
@@ -560,6 +593,9 @@ export default defineComponent({
|
|
|
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();
|
|
|
}
|
|
@@ -607,7 +643,33 @@ export default defineComponent({
|
|
|
) : m.type === 'IMG' ? (
|
|
|
<img src={m.content} />
|
|
|
) : m.type === 'AUDIO' ? (
|
|
|
- <AudioPay item={m} />
|
|
|
+ <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();
|
|
|
+ // }
|
|
|
+ // }}
|
|
|
+ />
|
|
|
) : (
|
|
|
<MusicScore
|
|
|
activeModel={activeData.model}
|