|
@@ -24,37 +24,14 @@ function checkDownloadStatus(status) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-function getLocalResourceUrl(absoluteUrl) {
|
|
|
|
- if (!absoluteUrl) return;
|
|
|
|
- const segments = absoluteUrl.split('/') || [];
|
|
|
|
- return `${Consts.NODE_SERVER}/lesson/readFile?n=${segments.slice(3).join('*')}`;
|
|
|
|
|
|
+function getLocalResourceUrl(onlineURL) {
|
|
|
|
+ if (!onlineURL) return;
|
|
|
|
+ const segments = onlineURL.split('/') || [];
|
|
|
|
+ const localURL = `${Consts.NODE_SERVER}/lesson/readFile?n=${segments.slice(3).join('*')}`;
|
|
|
|
+ return localURL;
|
|
}
|
|
}
|
|
|
|
|
|
class LessonScene extends scene {
|
|
class LessonScene extends scene {
|
|
-<<<<<<< HEAD
|
|
|
|
- constructor(scope) {
|
|
|
|
- super(scope);
|
|
|
|
- this.timer = null; //记录定时器
|
|
|
|
- this.isBack = false; //是否返回上个场景
|
|
|
|
- this.videoPlayer = null; //视频播放器
|
|
|
|
- this.courseId = null; //记录课程ID
|
|
|
|
- this.lessonId = null; //记录课ID
|
|
|
|
- this.wareList = null; //记录课件列表
|
|
|
|
- this.curWareId = null; //当前课件的id
|
|
|
|
- this.curWareType = null; //当前课件的类型
|
|
|
|
- this.curWareIndex = 0; //当前课件在课件列表中的索引
|
|
|
|
- this.curImageList = null; //当前图片课件的图片列表
|
|
|
|
- this.curImageIndex = null;//当前图片在列表中的索引
|
|
|
|
- this.curAudioList = null; //当前音频课件的音频列表
|
|
|
|
- this.curAudioIndex = 0; //当前音频在列表中的索引
|
|
|
|
- this.videoPosition = {
|
|
|
|
- top: 270,
|
|
|
|
- left: 790,
|
|
|
|
- width: 1072,
|
|
|
|
- height: 603,
|
|
|
|
- };
|
|
|
|
- }
|
|
|
|
-=======
|
|
|
|
constructor(scope) {
|
|
constructor(scope) {
|
|
super(scope);
|
|
super(scope);
|
|
this.timer = null; //记录定时器
|
|
this.timer = null; //记录定时器
|
|
@@ -69,6 +46,8 @@ class LessonScene extends scene {
|
|
this.curWareIndex = 0; //当前课件在课件列表中的索引
|
|
this.curWareIndex = 0; //当前课件在课件列表中的索引
|
|
this.curImageList = null; //当前图片课件的图片列表
|
|
this.curImageList = null; //当前图片课件的图片列表
|
|
this.curImageIndex = null;//当前图片在列表中的索引
|
|
this.curImageIndex = null;//当前图片在列表中的索引
|
|
|
|
+ this.curAudioList = null; //当前音频课件的音频列表
|
|
|
|
+ this.curAudioIndex = 0; //当前音频在列表中的索引
|
|
this.videoPosition = {
|
|
this.videoPosition = {
|
|
top: 270,
|
|
top: 270,
|
|
left: 790,
|
|
left: 790,
|
|
@@ -76,7 +55,6 @@ class LessonScene extends scene {
|
|
height: 603,
|
|
height: 603,
|
|
};
|
|
};
|
|
}
|
|
}
|
|
->>>>>>> remotes/origin/dev_winpc_touch
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* 根据课程id及课id请求课件列表
|
|
* 根据课程id及课id请求课件列表
|
|
@@ -129,40 +107,12 @@ class LessonScene extends scene {
|
|
this.curWareIndex = parseInt(e.target.id.split('-')[3]);
|
|
this.curWareIndex = parseInt(e.target.id.split('-')[3]);
|
|
let curWare = matchWare(this.wareList, this.curWareId);
|
|
let curWare = matchWare(this.wareList, this.curWareId);
|
|
if (curWare) {
|
|
if (curWare) {
|
|
- this.createRightView(curWare);
|
|
|
|
|
|
+ this.createRightView(curWare);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
this.moye.root.reRender();
|
|
this.moye.root.reRender();
|
|
}
|
|
}
|
|
|
|
|
|
-<<<<<<< HEAD
|
|
|
|
- /**
|
|
|
|
- * 创建左侧列表项内容
|
|
|
|
- */
|
|
|
|
- createHTMLString(data) {
|
|
|
|
- let item = {
|
|
|
|
- text: data.category || '',
|
|
|
|
- icon: '',
|
|
|
|
- }
|
|
|
|
- switch (data.type) {
|
|
|
|
- case Consts.TYPE_IMAGE:
|
|
|
|
- item.icon = 'assets/img/LessonScene/img.png';
|
|
|
|
- break;
|
|
|
|
- case Consts.TYPE_VIDEO:
|
|
|
|
- item.icon = 'assets/img/LessonScene/video.png';
|
|
|
|
- break;
|
|
|
|
- case Consts.TYPE_AUDIOBOOK:
|
|
|
|
- item.icon = 'assets/img/LessonScene/audio.png';
|
|
|
|
- }
|
|
|
|
- return `<div class="ware-item-frame">
|
|
|
|
- <div class="ware-type">${item.text}</div>
|
|
|
|
- <div class="ware-desc">
|
|
|
|
- <div class="ware-names">${data.title}</div>
|
|
|
|
- <div class="ware-icon">
|
|
|
|
- <img class="ware-icon-content" src="${item.icon}">
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
-=======
|
|
|
|
/**
|
|
/**
|
|
* 创建左侧列表项内容
|
|
* 创建左侧列表项内容
|
|
*/
|
|
*/
|
|
@@ -178,6 +128,9 @@ class LessonScene extends scene {
|
|
case Consts.TYPE_VIDEO:
|
|
case Consts.TYPE_VIDEO:
|
|
item.icon = 'assets/img/LessonScene/video.png';
|
|
item.icon = 'assets/img/LessonScene/video.png';
|
|
break;
|
|
break;
|
|
|
|
+ case Consts.TYPE_AUDIOBOOK:
|
|
|
|
+ item.icon = 'assets/img/LessonScene/audio.png';
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
return `
|
|
return `
|
|
<div class="ware-item-frame">
|
|
<div class="ware-item-frame">
|
|
@@ -203,27 +156,12 @@ class LessonScene extends scene {
|
|
const { title, type, list } = item;
|
|
const { title, type, list } = item;
|
|
//设定视窗的标题
|
|
//设定视窗的标题
|
|
document.getElementById('view-top').innerHTML = title;
|
|
document.getElementById('view-top').innerHTML = title;
|
|
- //关闭安卓播放器
|
|
|
|
- if (window.efunbox) {
|
|
|
|
- window.efunbox.closePlayer();
|
|
|
|
- }
|
|
|
|
switch (type) {
|
|
switch (type) {
|
|
case Consts.TYPE_VIDEO:
|
|
case Consts.TYPE_VIDEO:
|
|
let playUrl = '';
|
|
let playUrl = '';
|
|
if (list && list.length >= 1) {
|
|
if (list && list.length >= 1) {
|
|
playUrl = Utils.videoUrlFormat(list[0].url);
|
|
playUrl = Utils.videoUrlFormat(list[0].url);
|
|
}
|
|
}
|
|
- /*
|
|
|
|
- let videoViewDom =
|
|
|
|
- `
|
|
|
|
- <div id="view-full-screen" fe-role="Widget" class="view-full-screen-video">
|
|
|
|
- </div>
|
|
|
|
- <div id="view-video-start" fe-role="Widget">
|
|
|
|
- <div class="transparent-btn">播放</div>
|
|
|
|
->>>>>>> remotes/origin/dev_winpc_touch
|
|
|
|
- </div>
|
|
|
|
- `;
|
|
|
|
- */
|
|
|
|
let videoViewDom = '';
|
|
let videoViewDom = '';
|
|
document.getElementById('view-bottom').innerHTML = videoViewDom;
|
|
document.getElementById('view-bottom').innerHTML = videoViewDom;
|
|
this.moye.root.reRender();
|
|
this.moye.root.reRender();
|
|
@@ -248,134 +186,59 @@ class LessonScene extends scene {
|
|
this.curImageIndex = 0;
|
|
this.curImageIndex = 0;
|
|
this.renderImageView();
|
|
this.renderImageView();
|
|
}
|
|
}
|
|
- break;
|
|
|
|
- default:
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-<<<<<<< HEAD
|
|
|
|
- const { title, type, list } = item;
|
|
|
|
- //设定视窗的标题
|
|
|
|
- document.getElementById('view-top').innerHTML = title;
|
|
|
|
- //关闭安卓播放器
|
|
|
|
- if (window.efunbox) {
|
|
|
|
- window.efunbox.closePlayer();
|
|
|
|
- }
|
|
|
|
- switch (type) {
|
|
|
|
- case Consts.TYPE_VIDEO:
|
|
|
|
- let playUrl = '';
|
|
|
|
- if (list && list.length >= 1) {
|
|
|
|
- playUrl = Utils.videoUrlFormat(list[0].url);
|
|
|
|
- }
|
|
|
|
- let videoViewDom =
|
|
|
|
- `
|
|
|
|
- <div id="view-full-screen" fe-role="Widget" class="view-full-screen-video">
|
|
|
|
- </div>
|
|
|
|
- <div id="view-video-start" fe-role="Widget">
|
|
|
|
- <div class="transparent-btn">暂停</div>
|
|
|
|
- </div>
|
|
|
|
- `;
|
|
|
|
- document.getElementById('view-bottom').innerHTML = videoViewDom;
|
|
|
|
- this.moye.root.reRender();
|
|
|
|
- this.renderVideoView(title, playUrl, type);
|
|
|
|
- break;
|
|
|
|
- case Consts.TYPE_IMAGE:
|
|
|
|
- let imageViewDom =
|
|
|
|
- `
|
|
|
|
- <div id="view-full-screen" fe-role="Widget" class="view-full-screen-img"></div>
|
|
|
|
- <div id="view-previous" fe-role="Widget">
|
|
|
|
- <div class="transparent-btn">上一页</div>
|
|
|
|
- </div>
|
|
|
|
- <div id="view-page">1/1</div>
|
|
|
|
- <div id="view-next" fe-role="Widget">
|
|
|
|
- <div class="transparent-btn">下一页</div>
|
|
|
|
- </div>
|
|
|
|
- `;
|
|
|
|
- document.getElementById('view-bottom').innerHTML = imageViewDom;
|
|
|
|
- this.moye.root.reRender();
|
|
|
|
- this.curImageList = list;
|
|
|
|
- if (this.curImageList.length > 0) {
|
|
|
|
- this.curImageIndex = 0;
|
|
|
|
- this.renderImageView();
|
|
|
|
- }
|
|
|
|
- break;
|
|
|
|
- case Consts.TYPE_AUDIOBOOK:
|
|
|
|
- let audioViewDom =
|
|
|
|
|
|
+ break;
|
|
|
|
+ case Consts.TYPE_AUDIOBOOK:
|
|
|
|
+ let audioViewDom =
|
|
`
|
|
`
|
|
<div id="view-full-screen" fe-role="Widget" class="view-full-screen-img"></div>
|
|
<div id="view-full-screen" fe-role="Widget" class="view-full-screen-img"></div>
|
|
<div id="view-previous" fe-role="Widget">
|
|
<div id="view-previous" fe-role="Widget">
|
|
- <div class="transparent-btn">上一页</div>
|
|
|
|
- </div>
|
|
|
|
|
|
+ <div class="transparent-btn">上一页</div>
|
|
|
|
+ </div>
|
|
<div id="view-page">1/1</div>
|
|
<div id="view-page">1/1</div>
|
|
- <div id="view-next" fe-role="Widget">
|
|
|
|
- <div class="transparent-btn">下一页</div>
|
|
|
|
- </div>
|
|
|
|
|
|
+ <div id="view-next" fe-role="Widget">
|
|
|
|
+ <div class="transparent-btn">下一页</div>
|
|
|
|
+ </div>
|
|
`;
|
|
`;
|
|
- document.getElementById('view-bottom').innerHTML = audioViewDom;
|
|
|
|
- this.moye.root.reRender();
|
|
|
|
- this.curAudioList = list;
|
|
|
|
- if (this.curAudioList.length > 0) {
|
|
|
|
- this.curAudioIndex = 0;
|
|
|
|
- this.renderAudioView();
|
|
|
|
- }
|
|
|
|
- break;
|
|
|
|
- default:
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
-=======
|
|
|
|
|
|
+ document.getElementById('view-bottom').innerHTML = audioViewDom;
|
|
|
|
+ this.moye.root.reRender();
|
|
|
|
+ this.curAudioList = list;
|
|
|
|
+ if (this.curAudioList.length > 0) {
|
|
|
|
+ this.curAudioIndex = 0;
|
|
|
|
+ this.renderAudioView();
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 渲染图片视图
|
|
* 渲染图片视图
|
|
*/
|
|
*/
|
|
renderImageView() {
|
|
renderImageView() {
|
|
const curImage = this.curImageList[this.curImageIndex];
|
|
const curImage = this.curImageList[this.curImageIndex];
|
|
document.getElementById('view-page').innerHTML = (this.curImageIndex + 1) + '/' + this.curImageList.length;
|
|
document.getElementById('view-page').innerHTML = (this.curImageIndex + 1) + '/' + this.curImageList.length;
|
|
- let imageDom = `<img src=${curImage.url} />`
|
|
|
|
|
|
+ let imageDom = `<img src="${curImage.url}" />`
|
|
if (this.isDownload) {
|
|
if (this.isDownload) {
|
|
- imageDom = `<img src=${getLocalResourceUrl(curImage.url)} />`
|
|
|
|
->>>>>>> remotes/origin/dev_winpc_touch
|
|
|
|
|
|
+ imageDom = `<img src="${getLocalResourceUrl(curImage.url)}" />`
|
|
}
|
|
}
|
|
document.getElementById('view-content').innerHTML = imageDom;
|
|
document.getElementById('view-content').innerHTML = imageDom;
|
|
}
|
|
}
|
|
|
|
|
|
-<<<<<<< HEAD
|
|
|
|
- /**
|
|
|
|
- * 渲染图片视图
|
|
|
|
- */
|
|
|
|
- renderImageView() {
|
|
|
|
- const curImage = this.curImageList[this.curImageIndex];
|
|
|
|
- document.getElementById('view-page').innerHTML = (this.curImageIndex + 1) + '/' + this.curImageList.length;
|
|
|
|
- const imageDom = `<img src=${curImage.url} />`
|
|
|
|
- document.getElementById('view-content').innerHTML = imageDom;
|
|
|
|
-=======
|
|
|
|
/**
|
|
/**
|
|
* 渲染视频视图
|
|
* 渲染视频视图
|
|
*/
|
|
*/
|
|
renderVideoView(name, url, type) {
|
|
renderVideoView(name, url, type) {
|
|
|
|
+ // 处理视频链接,是读本地还是读线上
|
|
let localUrl = url;
|
|
let localUrl = url;
|
|
if (this.isDownload) {
|
|
if (this.isDownload) {
|
|
localUrl = getLocalResourceUrl(url)
|
|
localUrl = getLocalResourceUrl(url)
|
|
->>>>>>> remotes/origin/dev_winpc_touch
|
|
|
|
- }
|
|
|
|
- if (window.efunbox) {
|
|
|
|
- window.efunbox.initAndroidPlayer(
|
|
|
|
- name,
|
|
|
|
- localUrl,
|
|
|
|
- 1, //与android里的音视频类型定义有关,这里写死为type=1
|
|
|
|
- this.videoPosition.top,
|
|
|
|
- this.videoPosition.left,
|
|
|
|
- this.videoPosition.width,
|
|
|
|
- this.videoPosition.height,
|
|
|
|
- false
|
|
|
|
- );
|
|
|
|
- window.efunbox.start();
|
|
|
|
- this.videoPlayer = window.efunbox;
|
|
|
|
- } else {
|
|
|
|
- const videoDom = `<div id="hls-video"></div>`;
|
|
|
|
- document.getElementById('view-content').innerHTML = videoDom;
|
|
|
|
- this.videoPlayer = new EfunVideoPlayer();
|
|
|
|
- this.videoPlayer.initPlayer(localUrl, 'hls-video');
|
|
|
|
}
|
|
}
|
|
|
|
+ // 初始化视频播放器
|
|
|
|
+ const videoDom = `<div id="hls-video"></div>`;
|
|
|
|
+ document.getElementById('view-content').innerHTML = videoDom;
|
|
|
|
+ this.videoPlayer = new EfunVideoPlayer();
|
|
|
|
+ this.videoPlayer.initPlayer(url, 'hls-video');
|
|
// 监控到初始化视频成功后暂停画面
|
|
// 监控到初始化视频成功后暂停画面
|
|
this.timer = window.setInterval(() => {
|
|
this.timer = window.setInterval(() => {
|
|
if (this.videoPlayer.playStatus()) {
|
|
if (this.videoPlayer.playStatus()) {
|
|
@@ -389,66 +252,105 @@ class LessonScene extends scene {
|
|
}, 500);
|
|
}, 500);
|
|
}
|
|
}
|
|
|
|
|
|
-<<<<<<< HEAD
|
|
|
|
- /**
|
|
|
|
- * 渲染音频视图
|
|
|
|
- */
|
|
|
|
- renderAudioView(focusTarget) {
|
|
|
|
- const curAudio = this.curAudioList[this.curAudioIndex];
|
|
|
|
- const { img, audio, type } = curAudio;
|
|
|
|
- let imgPath = (img || {}).path || '';
|
|
|
|
- let audioUrl = (audio || {}).url;
|
|
|
|
- let footer = document.getElementById('view-page');
|
|
|
|
- if (footer) {
|
|
|
|
- footer.innerHTML = (this.curAudioIndex + 1) + '/' + this.curAudioList.length;
|
|
|
|
- }
|
|
|
|
- let content = document.getElementById('view-content');
|
|
|
|
- // 1.更换背景图片
|
|
|
|
- let imgHTML = `<img src="${Consts.IMG_PATH}/${imgPath}" />`;
|
|
|
|
- content.innerHTML = imgHTML;
|
|
|
|
- // 2.根据是否有无audioURL来控制面板及audio的展现
|
|
|
|
- if (type === Consts.TYPE_AUDIOBOOK && audioUrl) {
|
|
|
|
- let audioElement = document.createElement('audio');
|
|
|
|
- audioElement.setAttribute('id', 'courseware-audio');
|
|
|
|
- audioElement.setAttribute('src', audioUrl);
|
|
|
|
- audioElement.setAttribute('autoplay', 'autoplay');
|
|
|
|
- let controlsElement = document.createElement('div');
|
|
|
|
- controlsElement.setAttribute('class', 'audio-controls');
|
|
|
|
- let controlsBtns = `
|
|
|
|
- <!-- 播放/暂停 -->
|
|
|
|
- <div id="audio-play" class="audio-controls-item btn-play" fe-role="Widget"></div>
|
|
|
|
- <!-- 有声/静音 -->
|
|
|
|
- <div id="audio-mute" class="audio-controls-item btn-mute" fe-role="Widget"></div>
|
|
|
|
- <!-- 下一个音频 -->
|
|
|
|
- <div id="audio-next" class="audio-controls-item btn-next" fe-role="Widget"></div>
|
|
|
|
- <!-- 上一个音频 -->
|
|
|
|
- <div id="audio-last" class="audio-controls-item btn-last" fe-role="Widget"></div>
|
|
|
|
- `;
|
|
|
|
- controlsElement.innerHTML = controlsBtns;
|
|
|
|
- content.appendChild(audioElement);
|
|
|
|
- content.appendChild(controlsElement);
|
|
|
|
- this.moye.root.reRender();
|
|
|
|
- // 监听onended事件
|
|
|
|
- let audioDom = document.getElementById('courseware-audio');
|
|
|
|
- if (audioDom) {
|
|
|
|
- audioDom.addEventListener('ended', function () {
|
|
|
|
- TVUtil.Toast.show('播放结束', 1500);
|
|
|
|
- document.getElementById('audio-play').classList.add('paused');
|
|
|
|
- audioDom.currentTime = 0;
|
|
|
|
- }, false);
|
|
|
|
- }
|
|
|
|
- // 指定光标位置
|
|
|
|
- if (focusTarget && this.moye.root.getWidgetById(focusTarget)) {
|
|
|
|
- this.moye.root.getWidgetById(focusTarget).focus();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 渲染音频视图
|
|
|
|
+ */
|
|
|
|
+ renderAudioView(focusTarget) {
|
|
|
|
+ const curAudio = this.curAudioList[this.curAudioIndex];
|
|
|
|
+ const { img, audio, type } = curAudio;
|
|
|
|
+ let imgPath = (img || {}).path || '';
|
|
|
|
+ let audioUrl = (audio || {}).url;
|
|
|
|
+ let footer = document.getElementById('view-page');
|
|
|
|
+ if (footer) {
|
|
|
|
+ footer.innerHTML = (this.curAudioIndex + 1) + '/' + this.curAudioList.length;
|
|
|
|
+ }
|
|
|
|
+ let content = document.getElementById('view-content');
|
|
|
|
+ // 1.更换背景图片
|
|
|
|
+ const imgUrl = `${Consts.IMG_PATH}/${imgPath}`;
|
|
|
|
+ let imgHTML = `<img src="${imgUrl}" />`;
|
|
|
|
+ if (this.isDownload) {
|
|
|
|
+ imgHTML = `<img src="${getLocalResourceUrl(imgUrl)}" />`
|
|
|
|
+ }
|
|
|
|
+ content.innerHTML = imgHTML;
|
|
|
|
+ // 2.根据是否有无audioURL来控制面板及audio的展现
|
|
|
|
+ if (type === Consts.TYPE_AUDIOBOOK && audioUrl) {
|
|
|
|
+ let audioElement = document.createElement('audio');
|
|
|
|
+ audioElement.setAttribute('id', 'courseware-audio');
|
|
|
|
+ audioElement.setAttribute('src', this.isDownload ? getLocalResourceUrl(audioUrl) : audioUrl);
|
|
|
|
+ audioElement.setAttribute('autoplay', 'autoplay');
|
|
|
|
+ let controlsElement = document.createElement('div');
|
|
|
|
+ controlsElement.setAttribute('class', 'audio-controls');
|
|
|
|
+ let controlsBtns = `
|
|
|
|
+ <!-- 播放/暂停 -->
|
|
|
|
+ <div id="audio-play" class="audio-controls-item btn-play" fe-role="Widget"></div>
|
|
|
|
+ <!-- 有声/静音 -->
|
|
|
|
+ <div id="audio-mute" class="audio-controls-item btn-mute" fe-role="Widget"></div>
|
|
|
|
+ <!-- 下一个音频 -->
|
|
|
|
+ <div id="audio-next" class="audio-controls-item btn-next" fe-role="Widget"></div>
|
|
|
|
+ <!-- 上一个音频 -->
|
|
|
|
+ <div id="audio-last" class="audio-controls-item btn-last" fe-role="Widget"></div>
|
|
|
|
+ `;
|
|
|
|
+ controlsElement.innerHTML = controlsBtns;
|
|
|
|
+ content.appendChild(audioElement);
|
|
|
|
+ content.appendChild(controlsElement);
|
|
|
|
+ this.moye.root.reRender();
|
|
|
|
+ // 监听onended事件
|
|
|
|
+ let audioDom = document.getElementById('courseware-audio');
|
|
|
|
+ if (audioDom) {
|
|
|
|
+ audioDom.addEventListener('ended', function () {
|
|
|
|
+ document.getElementById('audio-play').classList.add('paused');
|
|
|
|
+ audioDom.currentTime = 0;
|
|
|
|
+ }, false);
|
|
|
|
+ }
|
|
|
|
+ // 指定光标位置
|
|
|
|
+ if (focusTarget && this.moye.root.getWidgetById(focusTarget)) {
|
|
|
|
+ this.moye.root.getWidgetById(focusTarget).focus();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /* 音频播放控制 */
|
|
|
|
+ audioPlayControl(eventId) {
|
|
|
|
+ let targetAudio = document.getElementById('courseware-audio');
|
|
|
|
+ if (!targetAudio) { return; }
|
|
|
|
+ switch (eventId) {
|
|
|
|
+ case 'audio-play':
|
|
|
|
+ let playBtn = document.querySelector('#audio-play');
|
|
|
|
+ if (targetAudio.paused) {
|
|
|
|
+ targetAudio.play();
|
|
|
|
+ playBtn.classList.remove('paused');
|
|
|
|
+ } else {
|
|
|
|
+ targetAudio.pause();
|
|
|
|
+ playBtn.classList.add('paused');
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case 'audio-mute':
|
|
|
|
+ let muteBtn = document.querySelector('#audio-mute');
|
|
|
|
+ if (targetAudio.muted) {
|
|
|
|
+ targetAudio.muted = false;
|
|
|
|
+ muteBtn.classList.remove('muted');
|
|
|
|
+ } else {
|
|
|
|
+ targetAudio.muted = true;
|
|
|
|
+ muteBtn.classList.add('muted');
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case 'audio-next':
|
|
|
|
+ if (this.curAudioIndex < this.curAudioList.length -1) {
|
|
|
|
+ this.curAudioIndex += 1;
|
|
|
|
+ this.renderAudioView('audio-next');
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case 'audio-last':
|
|
|
|
+ if (this.curAudioIndex > 0) {
|
|
|
|
+ this.curAudioIndex -= 1;
|
|
|
|
+ this.renderAudioView('audio-last');
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- /**
|
|
|
|
- * 渲染视频视图
|
|
|
|
- */
|
|
|
|
- renderVideoView(name, url, type) {
|
|
|
|
-=======
|
|
|
|
updateRightView(item) {
|
|
updateRightView(item) {
|
|
const { title, type, list } = item;
|
|
const { title, type, list } = item;
|
|
document.getElementById('view-top').innerHTML = title;
|
|
document.getElementById('view-top').innerHTML = title;
|
|
@@ -458,31 +360,16 @@ class LessonScene extends scene {
|
|
if (list && list.length >= 1) {
|
|
if (list && list.length >= 1) {
|
|
playUrl = Utils.videoUrlFormat(list[0].url);
|
|
playUrl = Utils.videoUrlFormat(list[0].url);
|
|
}
|
|
}
|
|
- /*
|
|
|
|
- let playText = '播放';
|
|
|
|
- if (this.videoPlayer && this.videoPlayer.playStatus()) {
|
|
|
|
- playText = '暂停';
|
|
|
|
- }
|
|
|
|
- let videoViewDom =
|
|
|
|
- `
|
|
|
|
- <div id="view-full-screen" fe-role="Widget" class="view-full-screen-video">
|
|
|
|
- </div>
|
|
|
|
- <div id="view-video-start" fe-role="Widget">
|
|
|
|
- <div class="transparent-btn">${playText}</div>
|
|
|
|
- </div>
|
|
|
|
- `;
|
|
|
|
- */
|
|
|
|
document.getElementById('view-bottom').innerHTML = '';
|
|
document.getElementById('view-bottom').innerHTML = '';
|
|
this.moye.root.reRender();
|
|
this.moye.root.reRender();
|
|
//如果是H5播放器,则重新创建video标签
|
|
//如果是H5播放器,则重新创建video标签
|
|
->>>>>>> remotes/origin/dev_winpc_touch
|
|
|
|
if (window.efunbox) {
|
|
if (window.efunbox) {
|
|
window.efunbox.customScreen(270, 790, 1072, 603);
|
|
window.efunbox.customScreen(270, 790, 1072, 603);
|
|
} else {
|
|
} else {
|
|
const videoDom = `<div id="hls-video"></div>`;
|
|
const videoDom = `<div id="hls-video"></div>`;
|
|
document.getElementById('view-content').innerHTML = videoDom;
|
|
document.getElementById('view-content').innerHTML = videoDom;
|
|
this.videoPlayer = new EfunVideoPlayer();
|
|
this.videoPlayer = new EfunVideoPlayer();
|
|
- this.videoPlayer.initPlayer(playUrl, 'hls-video');
|
|
|
|
|
|
+ this.videoPlayer.initPlayer(playUrl, 'hls-video', url);
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
case Consts.TYPE_IMAGE:
|
|
case Consts.TYPE_IMAGE:
|
|
@@ -490,120 +377,12 @@ class LessonScene extends scene {
|
|
`
|
|
`
|
|
<div id="view-full-screen" fe-role="Widget" class="view-full-screen-img"></div>
|
|
<div id="view-full-screen" fe-role="Widget" class="view-full-screen-img"></div>
|
|
<div id="view-previous" fe-role="Widget">
|
|
<div id="view-previous" fe-role="Widget">
|
|
- <div class="transparent-btn">上一页</div>
|
|
|
|
- </div>
|
|
|
|
|
|
+ <div class="transparent-btn">上一页</div>
|
|
|
|
+ </div>
|
|
<div id="view-page">1/1</div>
|
|
<div id="view-page">1/1</div>
|
|
<div id="view-next" fe-role="Widget">
|
|
<div id="view-next" fe-role="Widget">
|
|
- <div class="transparent-btn">下一页</div>
|
|
|
|
- </div>
|
|
|
|
-<<<<<<< HEAD
|
|
|
|
- `;
|
|
|
|
- document.getElementById('view-bottom').innerHTML = videoViewDom;
|
|
|
|
- this.moye.root.reRender();
|
|
|
|
- //如果是H5播放器,则重新创建video标签
|
|
|
|
- if (window.efunbox) {
|
|
|
|
- window.efunbox.customScreen(270, 790, 1072, 603);
|
|
|
|
- } else {
|
|
|
|
- const videoDom = `<video id="hls-video" controls>你的浏览器不支持视频播放</video>`;
|
|
|
|
- document.getElementById('view-content').innerHTML = videoDom;
|
|
|
|
- this.videoPlayer = new HlsVideoPlugin();
|
|
|
|
- this.videoPlayer.initH5Player(playUrl, 'hls-video');
|
|
|
|
- }
|
|
|
|
- break;
|
|
|
|
- case Consts.TYPE_IMAGE:
|
|
|
|
- let imageViewDom =
|
|
|
|
- `
|
|
|
|
- <div id="view-full-screen" fe-role="Widget" class="view-full-screen-img"></div>
|
|
|
|
- <div id="view-previous" fe-role="Widget">
|
|
|
|
- <div class="transparent-btn">上一页</div>
|
|
|
|
- </div>
|
|
|
|
- <div id="view-page">1/1</div>
|
|
|
|
- <div id="view-next" fe-role="Widget">
|
|
|
|
- <div class="transparent-btn">下一页</div>
|
|
|
|
- </div>
|
|
|
|
- `;
|
|
|
|
- document.getElementById('view-bottom').innerHTML = imageViewDom;
|
|
|
|
- this.moye.root.reRender();
|
|
|
|
- this.renderImageView();
|
|
|
|
- break;
|
|
|
|
- case Consts.TYPE_AUDIOBOOK:
|
|
|
|
- let audioViewDom =
|
|
|
|
- `
|
|
|
|
- <div id="view-full-screen" fe-role="Widget" class="view-full-screen-img"></div>
|
|
|
|
- <div id="view-previous" fe-role="Widget">
|
|
|
|
- <div class="transparent-btn">上一页</div>
|
|
|
|
- </div>
|
|
|
|
- <div id="view-page">1/1</div>
|
|
|
|
- <div id="view-next" fe-role="Widget">
|
|
|
|
- <div class="transparent-btn">下一页</div>
|
|
|
|
- </div>
|
|
|
|
- `;
|
|
|
|
- document.getElementById('view-bottom').innerHTML = audioViewDom;
|
|
|
|
- this.moye.root.reRender();
|
|
|
|
- this.renderAudioView();
|
|
|
|
- break;
|
|
|
|
- default:
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 音频播放控制
|
|
|
|
- */
|
|
|
|
- audioPlayControl(eventId) {
|
|
|
|
- let targetAudio = document.getElementById('courseware-audio');
|
|
|
|
- if (!targetAudio) { return; }
|
|
|
|
- switch (eventId) {
|
|
|
|
- case 'audio-play':
|
|
|
|
- let playBtn = document.querySelector('#audio-play');
|
|
|
|
- if (targetAudio.paused) {
|
|
|
|
- targetAudio.play();
|
|
|
|
- playBtn.classList.remove('paused');
|
|
|
|
- } else {
|
|
|
|
- targetAudio.pause();
|
|
|
|
- playBtn.classList.add('paused');
|
|
|
|
- }
|
|
|
|
- break;
|
|
|
|
- case 'audio-mute':
|
|
|
|
- let muteBtn = document.querySelector('#audio-mute');
|
|
|
|
- if (targetAudio.muted) {
|
|
|
|
- targetAudio.muted = false;
|
|
|
|
- muteBtn.classList.remove('muted');
|
|
|
|
- } else {
|
|
|
|
- targetAudio.muted = true;
|
|
|
|
- muteBtn.classList.add('muted');
|
|
|
|
- }
|
|
|
|
- break;
|
|
|
|
- case 'audio-next':
|
|
|
|
- if (this.curAudioIndex < this.curAudioList.length -1) {
|
|
|
|
- this.curAudioIndex += 1;
|
|
|
|
- this.renderAudioView('audio-next');
|
|
|
|
- }
|
|
|
|
- break;
|
|
|
|
- case 'audio-last':
|
|
|
|
- if (this.curAudioIndex > 0) {
|
|
|
|
- this.curAudioIndex -= 1;
|
|
|
|
- this.renderAudioView('audio-last');
|
|
|
|
- }
|
|
|
|
- break;
|
|
|
|
- default:
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 记录播放行为事件
|
|
|
|
- */
|
|
|
|
- postPlayRecord(lessonId, courseId, playStopTime=1){
|
|
|
|
- APIClient.putUserAction(
|
|
|
|
- Consts.USER_ACTION_WATCH,
|
|
|
|
- Consts.USER_ACTION_WATCH_NAME,
|
|
|
|
- `${courseId}_${lessonId}`,
|
|
|
|
- playStopTime,
|
|
|
|
- (isTrue, res) => {},
|
|
|
|
- );
|
|
|
|
- }
|
|
|
|
-=======
|
|
|
|
|
|
+ <div class="transparent-btn">下一页</div>
|
|
|
|
+ </div>
|
|
`;
|
|
`;
|
|
document.getElementById('view-bottom').innerHTML = imageViewDom;
|
|
document.getElementById('view-bottom').innerHTML = imageViewDom;
|
|
this.moye.root.reRender();
|
|
this.moye.root.reRender();
|
|
@@ -626,7 +405,6 @@ class LessonScene extends scene {
|
|
(isTrue, res) => {},
|
|
(isTrue, res) => {},
|
|
);
|
|
);
|
|
}
|
|
}
|
|
->>>>>>> remotes/origin/dev_winpc_touch
|
|
|
|
|
|
|
|
onCreate(data) {
|
|
onCreate(data) {
|
|
//是否已下载
|
|
//是否已下载
|
|
@@ -639,45 +417,24 @@ class LessonScene extends scene {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
-<<<<<<< HEAD
|
|
|
|
- onResume(data) {
|
|
|
|
- if (!data) { return; }
|
|
|
|
- //更新下当前的课件信息
|
|
|
|
- const { curWareIndex, curImageList, curImageIndex, curAudioList, curAudioIndex } = data;
|
|
|
|
- this.curWareIndex = curWareIndex;
|
|
|
|
- this.curWareId = this.wareList[curWareIndex].id;
|
|
|
|
- this.curWareType = this.wareList[curWareIndex].type;
|
|
|
|
- if (curImageList) {
|
|
|
|
- this.curImageList = curImageList;
|
|
|
|
- }
|
|
|
|
- if (curImageIndex) {
|
|
|
|
- this.curImageIndex = curImageIndex;
|
|
|
|
- }
|
|
|
|
- if (curAudioList) {
|
|
|
|
- this.curAudioList = curAudioList;
|
|
|
|
- }
|
|
|
|
- if (curAudioIndex) {
|
|
|
|
- this.curAudioIndex = curAudioIndex;
|
|
|
|
- }
|
|
|
|
- //更新左侧焦点位置
|
|
|
|
- this.moye.root.getWidgetById(`item-${this.curWareType}-${this.curWareId}-${this.curWareIndex}`).focus();
|
|
|
|
- //更新右侧视图
|
|
|
|
- this.updateRightView(this.wareList[curWareIndex]);
|
|
|
|
- this.isBack = true;
|
|
|
|
-=======
|
|
|
|
onResume(data) {
|
|
onResume(data) {
|
|
if (!data) { return; }
|
|
if (!data) { return; }
|
|
//更新下当前的课件信息
|
|
//更新下当前的课件信息
|
|
- const { curWareIndex, curImageList, curImageIndex } = data;
|
|
|
|
|
|
+ const { curWareIndex, curImageList, curImageIndex, curAudioList, curAudioIndex } = data;
|
|
this.curWareIndex = curWareIndex;
|
|
this.curWareIndex = curWareIndex;
|
|
this.curWareId = this.wareList[curWareIndex].id;
|
|
this.curWareId = this.wareList[curWareIndex].id;
|
|
this.curWareType = this.wareList[curWareIndex].type;
|
|
this.curWareType = this.wareList[curWareIndex].type;
|
|
if (curImageList) {
|
|
if (curImageList) {
|
|
- this.curImageList = curImageList;
|
|
|
|
|
|
+ this.curImageList = curImageList;
|
|
}
|
|
}
|
|
if (curImageIndex) {
|
|
if (curImageIndex) {
|
|
- this.curImageIndex = curImageIndex;
|
|
|
|
->>>>>>> remotes/origin/dev_winpc_touch
|
|
|
|
|
|
+ this.curImageIndex = curImageIndex;
|
|
|
|
+ }
|
|
|
|
+ if (curAudioList) {
|
|
|
|
+ this.curAudioList = curAudioList;
|
|
|
|
+ }
|
|
|
|
+ if (curAudioIndex) {
|
|
|
|
+ this.curAudioIndex = curAudioIndex;
|
|
}
|
|
}
|
|
//更新左侧焦点位置
|
|
//更新左侧焦点位置
|
|
this.moye.root.getWidgetById(`item-${this.curWareType}-${this.curWareId}-${this.curWareIndex}`).focus();
|
|
this.moye.root.getWidgetById(`item-${this.curWareType}-${this.curWareId}-${this.curWareIndex}`).focus();
|
|
@@ -686,139 +443,96 @@ class LessonScene extends scene {
|
|
this.isBack = true;
|
|
this.isBack = true;
|
|
}
|
|
}
|
|
|
|
|
|
-<<<<<<< HEAD
|
|
|
|
- onOK() {
|
|
|
|
- const leaf = FocusEngine.getFocusedLeaf();
|
|
|
|
- // 拦截音频控制相关事件单独处理
|
|
|
|
- if (leaf.id && leaf.id.startsWith('audio')) {
|
|
|
|
- this.audioPlayControl(leaf.id);
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- switch (leaf.id) {
|
|
|
|
- case 'view-video-start':
|
|
|
|
- if (this.curWareType == Consts.TYPE_VIDEO) {
|
|
|
|
- if (this.videoPlayer.playStatus()) {
|
|
|
|
- this.videoPlayer.pause();
|
|
|
|
- document.getElementById('view-video-start').innerHTML = '播放';
|
|
|
|
- } else {
|
|
|
|
- this.videoPlayer.start();
|
|
|
|
- document.getElementById('view-video-start').innerHTML = '暂停';
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //添加播放记录
|
|
|
|
- this.postPlayRecord(this.curWareId, this.courseId);
|
|
|
|
- break;
|
|
|
|
- case 'view-full-screen':
|
|
|
|
- if (this.curWareType === Consts.TYPE_IMAGE) {
|
|
|
|
- this.showScene(require('./ImageWareFullScreenScene.js'), {
|
|
|
|
- wareList: this.wareList,
|
|
|
|
- curWareIndex: this.curWareIndex,
|
|
|
|
- curImageList: this.curImageList,
|
|
|
|
- curImageIndex: this.curImageIndex,
|
|
|
|
- });
|
|
|
|
- } else if (this.curWareType === Consts.TYPE_VIDEO) {
|
|
|
|
- let video = document.getElementById('hls-video');
|
|
|
|
- if (video) {
|
|
|
|
- document.getElementById('view-content').removeChild(video);
|
|
|
|
- }
|
|
|
|
- this.showScene(require('./VideoWareFullScreenScene.js'), {
|
|
|
|
- isFull: true,
|
|
|
|
- wareList: this.wareList,
|
|
|
|
- curWareIndex: this.curWareIndex,
|
|
|
|
- });
|
|
|
|
- } else if (this.curWareType === Consts.TYPE_AUDIOBOOK) {
|
|
|
|
- // 全屏前移除audio标签
|
|
|
|
- let audio = document.getElementById('courseware-audio');
|
|
|
|
- let controls = document.querySelector('.audio-controls');
|
|
|
|
- if (audio) {
|
|
|
|
- document.getElementById('view-content').removeChild(audio);
|
|
|
|
- }
|
|
|
|
- if (controls) {
|
|
|
|
- document.getElementById('view-content').removeChild(controls);
|
|
|
|
- }
|
|
|
|
- this.showScene(require('./AudioWareFullScreenScene.js'), {
|
|
|
|
- wareList: this.wareList,
|
|
|
|
- curWareIndex: this.curWareIndex,
|
|
|
|
- curAudioList: this.curAudioList,
|
|
|
|
- curAudioIndex: this.curAudioIndex,
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- this.postPlayRecord(this.cur_item_id, this.courseId);
|
|
|
|
- break;
|
|
|
|
- case 'view-previous':
|
|
|
|
- if (this.curWareType === Consts.TYPE_IMAGE && this.curImageIndex - 1 >= 0) {
|
|
|
|
- this.curImageIndex -= 1;
|
|
|
|
- this.renderImageView();
|
|
|
|
- }
|
|
|
|
- if (this.curWareType === Consts.TYPE_AUDIOBOOK && this.curAudioIndex - 1 >= 0) {
|
|
|
|
- this.curAudioIndex -= 1;
|
|
|
|
- this.renderAudioView();
|
|
|
|
- }
|
|
|
|
- this.postPlayRecord(this.curWareId, this.courseId);
|
|
|
|
- break;
|
|
|
|
- case 'view-next':
|
|
|
|
- if (this.curWareType === Consts.TYPE_IMAGE && this.curImageIndex + 1 < this.curImageList.length) {
|
|
|
|
- this.curImageIndex += 1;
|
|
|
|
- this.renderImageView();
|
|
|
|
- }
|
|
|
|
- if (this.curWareType === Consts.TYPE_AUDIOBOOK && this.curAudioIndex + 1 < this.curAudioList.length) {
|
|
|
|
- this.curAudioIndex += 1;
|
|
|
|
- this.renderAudioView();
|
|
|
|
- }
|
|
|
|
- this.postPlayRecord(this.curWareId, this.courseId);
|
|
|
|
- break;
|
|
|
|
- default:
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
-=======
|
|
|
|
onOK(e) {
|
|
onOK(e) {
|
|
- // 后退
|
|
|
|
|
|
+ // 点击后退按钮
|
|
if (e.target.con.classList.contains('goback')) {
|
|
if (e.target.con.classList.contains('goback')) {
|
|
- this.hideScene({id: this.courseId}, 'CourseScene');
|
|
|
|
- return;
|
|
|
|
->>>>>>> remotes/origin/dev_winpc_touch
|
|
|
|
|
|
+ if ( -1 != this.moye.focusList.indexOf('CourseScene')) {
|
|
|
|
+ this.hideScene({id: this.courseId}, 'CourseScene');
|
|
|
|
+ return;
|
|
|
|
+ } else {
|
|
|
|
+ this.hideScene();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ // 拦截音频控制相关事件单独处理
|
|
const leaf = FocusEngine.getFocusedLeaf();
|
|
const leaf = FocusEngine.getFocusedLeaf();
|
|
- switch (leaf.id) {
|
|
|
|
- case 'view-video-start':
|
|
|
|
- if (this.curWareType == Consts.TYPE_VIDEO) {
|
|
|
|
- if (this.videoPlayer.playStatus()) {
|
|
|
|
- this.videoPlayer.pause();
|
|
|
|
- document.getElementById('view-video-start').innerHTML = '播放';
|
|
|
|
- } else {
|
|
|
|
- this.videoPlayer.start();
|
|
|
|
- document.getElementById('view-video-start').innerHTML = '暂停';
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //添加播放记录
|
|
|
|
- this.postPlayRecord(this.curWareId, this.courseId);
|
|
|
|
- break;
|
|
|
|
- case 'view-full-screen':
|
|
|
|
|
|
+ if (leaf.id && leaf.id.startsWith('audio')) {
|
|
|
|
+ this.audioPlayControl(leaf.id);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ switch (leaf.id) {
|
|
|
|
+ case 'view-video-start':
|
|
|
|
+ if (this.curWareType == Consts.TYPE_VIDEO) {
|
|
|
|
+ if (this.videoPlayer.playStatus()) {
|
|
|
|
+ this.videoPlayer.pause();
|
|
|
|
+ document.getElementById('view-video-start').innerHTML = '播放';
|
|
|
|
+ } else {
|
|
|
|
+ this.videoPlayer.start();
|
|
|
|
+ document.getElementById('view-video-start').innerHTML = '暂停';
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //添加播放记录
|
|
|
|
+ this.postPlayRecord(this.curWareId, this.courseId);
|
|
|
|
+ break;
|
|
|
|
+ case 'view-full-screen':
|
|
if (this.curWareType === Consts.TYPE_IMAGE) {
|
|
if (this.curWareType === Consts.TYPE_IMAGE) {
|
|
- this.showScene(require('./ImageWareFullScreenScene.js'), {
|
|
|
|
- wareList: this.wareList,
|
|
|
|
- curWareIndex: this.curWareIndex,
|
|
|
|
- curImageList: this.curImageList,
|
|
|
|
- curImageIndex: this.curImageIndex,
|
|
|
|
|
|
+ this.showScene(require('./ImageWareFullScreenScene.js'), {
|
|
|
|
+ wareList: this.wareList,
|
|
|
|
+ curWareIndex: this.curWareIndex,
|
|
|
|
+ curImageList: this.curImageList,
|
|
|
|
+ curImageIndex: this.curImageIndex,
|
|
|
|
+ });
|
|
|
|
+ } else if (this.curWareType === Consts.TYPE_VIDEO) {
|
|
|
|
+ let video = document.getElementById('hls-video');
|
|
|
|
+ if (video) {
|
|
|
|
+ document.getElementById('view-content').removeChild(video);
|
|
|
|
+ }
|
|
|
|
+ this.showScene(require('./VideoWareFullScreenScene.js'), {
|
|
|
|
+ isFull: true,
|
|
|
|
+ wareList: this.wareList,
|
|
|
|
+ curWareIndex: this.curWareIndex,
|
|
|
|
+ });
|
|
|
|
+ } else if (this.curWareType === Consts.TYPE_AUDIOBOOK) {
|
|
|
|
+ // 全屏前移除audio标签
|
|
|
|
+ let audio = document.getElementById('courseware-audio');
|
|
|
|
+ let controls = document.querySelector('.audio-controls');
|
|
|
|
+ if (audio) {
|
|
|
|
+ document.getElementById('view-content').removeChild(audio);
|
|
|
|
+ }
|
|
|
|
+ if (controls) {
|
|
|
|
+ document.getElementById('view-content').removeChild(controls);
|
|
|
|
+ }
|
|
|
|
+ this.showScene(require('./AudioWareFullScreenScene.js'), {
|
|
|
|
+ wareList: this.wareList,
|
|
|
|
+ curWareIndex: this.curWareIndex,
|
|
|
|
+ curAudioList: this.curAudioList,
|
|
|
|
+ curAudioIndex: this.curAudioIndex,
|
|
isDownload: this.isDownload,
|
|
isDownload: this.isDownload,
|
|
- });
|
|
|
|
|
|
+ });
|
|
}
|
|
}
|
|
- this.postPlayRecord(this.cur_item_id, this.courseId);
|
|
|
|
- break;
|
|
|
|
- case 'view-previous':
|
|
|
|
- if (this.curWareType === Consts.TYPE_IMAGE && this.curImageIndex - 1 >= 0) {
|
|
|
|
- this.curImageIndex -= 1;
|
|
|
|
- this.renderImageView();
|
|
|
|
- }
|
|
|
|
- this.postPlayRecord(this.curWareId, this.courseId);
|
|
|
|
- break;
|
|
|
|
- case 'view-next':
|
|
|
|
- if (this.curWareType === Consts.TYPE_IMAGE && this.curImageIndex + 1 < this.curImageList.length) {
|
|
|
|
- this.curImageIndex += 1;
|
|
|
|
- this.renderImageView();
|
|
|
|
- }
|
|
|
|
- this.postPlayRecord(this.curWareId, this.courseId);
|
|
|
|
- break;
|
|
|
|
|
|
+ this.postPlayRecord(this.cur_item_id, this.courseId);
|
|
|
|
+ break;
|
|
|
|
+ case 'view-previous':
|
|
|
|
+ if (this.curWareType === Consts.TYPE_IMAGE && this.curImageIndex - 1 >= 0) {
|
|
|
|
+ this.curImageIndex -= 1;
|
|
|
|
+ this.renderImageView();
|
|
|
|
+ }
|
|
|
|
+ if (this.curWareType === Consts.TYPE_AUDIOBOOK && this.curAudioIndex - 1 >= 0) {
|
|
|
|
+ this.curAudioIndex -= 1;
|
|
|
|
+ this.renderAudioView();
|
|
|
|
+ }
|
|
|
|
+ this.postPlayRecord(this.curWareId, this.courseId);
|
|
|
|
+ break;
|
|
|
|
+ case 'view-next':
|
|
|
|
+ if (this.curWareType === Consts.TYPE_IMAGE && this.curImageIndex + 1 < this.curImageList.length) {
|
|
|
|
+ this.curImageIndex += 1;
|
|
|
|
+ this.renderImageView();
|
|
|
|
+ }
|
|
|
|
+ if (this.curWareType === Consts.TYPE_AUDIOBOOK && this.curAudioIndex + 1 < this.curAudioList.length) {
|
|
|
|
+ this.curAudioIndex += 1;
|
|
|
|
+ this.renderAudioView();
|
|
|
|
+ }
|
|
|
|
+ this.postPlayRecord(this.curWareId, this.courseId);
|
|
|
|
+ break;
|
|
default:
|
|
default:
|
|
break;
|
|
break;
|
|
}
|
|
}
|