|
@@ -1,8 +1,8 @@
|
|
|
import APIClient from '../../../util/API/APIClient';
|
|
|
+import WinBoxAPI from '../../../util/WinBoxAPI';
|
|
|
import Consts from '../../../util/Consts';
|
|
|
import Utils from '../../../util/Utils';
|
|
|
-import HlsVideoPlugin from '../../../util/HlsVideoPlugin';
|
|
|
-import {CommandBus, CMD_TYPE} from '../../../util/CommandBus';
|
|
|
+import EfunVideoPlayer from '../../../util/EfunVideoPlayer';
|
|
|
|
|
|
function matchWare(wareList, wareId) {
|
|
|
const matchedWareList = wareList.filter((ware) => {
|
|
@@ -16,7 +16,22 @@ function matchWare(wareList, wareId) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+function checkDownloadStatus(status) {
|
|
|
+ if (status === Consts.DOWNLOAD_STATUS_SUCCESS) {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function getLocalResourceUrl(absoluteUrl) {
|
|
|
+ if (!absoluteUrl) return;
|
|
|
+ const segments = absoluteUrl.split('/') || [];
|
|
|
+ return `${Consts.NODE_SERVER}/lesson/readFile?n=${segments.slice(3).join('*')}`;
|
|
|
+}
|
|
|
+
|
|
|
class LessonScene extends scene {
|
|
|
+<<<<<<< HEAD
|
|
|
constructor(scope) {
|
|
|
super(scope);
|
|
|
this.timer = null; //记录定时器
|
|
@@ -39,64 +54,88 @@ class LessonScene extends scene {
|
|
|
height: 603,
|
|
|
};
|
|
|
}
|
|
|
+=======
|
|
|
+ constructor(scope) {
|
|
|
+ super(scope);
|
|
|
+ this.timer = null; //记录定时器
|
|
|
+ this.isBack = false; //是否返回上个场景
|
|
|
+ this.videoPlayer = null; //视频播放器
|
|
|
+ this.isDownload = false; //是否已下载
|
|
|
+ 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.videoPosition = {
|
|
|
+ top: 270,
|
|
|
+ left: 790,
|
|
|
+ width: 1072,
|
|
|
+ height: 603,
|
|
|
+ };
|
|
|
+ }
|
|
|
+>>>>>>> remotes/origin/dev_winpc_touch
|
|
|
|
|
|
- /**
|
|
|
- * 根据课程id及课id请求课件列表
|
|
|
- */
|
|
|
- loadWareList() {
|
|
|
- APIClient.getWareList(this.lessonId, this.courseId, (isTrue, response) => {
|
|
|
- if (!isTrue) { return; }
|
|
|
- if (!response.success) {
|
|
|
- TVUtil.Toast.show('获取课件列表失败!', 1500);
|
|
|
- return;
|
|
|
- }
|
|
|
- if (response.data && response.data.list && response.data.list.length > 0) {
|
|
|
- this.renderWareList(response.data.list);
|
|
|
- this.wareList = response.data.list;
|
|
|
- } else {
|
|
|
- this.hideScene();
|
|
|
- this.showScene(require('./DataBuildingScene'), {});
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 根据课程id及课id请求课件列表
|
|
|
+ */
|
|
|
+ loadWareList() {
|
|
|
+ APIClient.getWareList(this.lessonId, this.courseId, (isTrue, response) => {
|
|
|
+ if (!isTrue) { return; }
|
|
|
+ if (!response.success) {
|
|
|
+ TVUtil.Toast.show('获取课件列表失败!', 1500);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (response.data && response.data.list && response.data.list.length > 0) {
|
|
|
+ this.renderWareList(response.data.list);
|
|
|
+ this.wareList = response.data.list;
|
|
|
+ } else {
|
|
|
+ this.hideScene();
|
|
|
+ this.showScene(require('./DataBuildingScene'), {});
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- /**
|
|
|
- * 把课件列表进行渲染
|
|
|
- */
|
|
|
- renderWareList(dataset) {
|
|
|
- let listDom = document.getElementById('list-content');
|
|
|
- dataset.forEach(function(item, index) {
|
|
|
- const { id, type } = item;
|
|
|
-
|
|
|
- let itemDom = document.createElement('div');
|
|
|
- itemDom.setAttribute('id', `item-${type}-${id}-${index}`);
|
|
|
- itemDom.setAttribute('class', 'ware-item');
|
|
|
- itemDom.setAttribute('fe-role', 'Widget');
|
|
|
- itemDom.innerHTML = this.createHTMLString(item);
|
|
|
- listDom.appendChild(itemDom);
|
|
|
- if (index === 0) {
|
|
|
- this.curWareType = parseInt(type);
|
|
|
- this.curWareId = id;
|
|
|
- this.createRightView(item);
|
|
|
- }
|
|
|
- }.bind(this));
|
|
|
-
|
|
|
- let listScroll = this.moye.root.getWidgetById('list');
|
|
|
- listScroll.on('focus', e => {
|
|
|
- if (this.curWareId === e.target.id.split('-')[2]) {
|
|
|
- return;
|
|
|
- }
|
|
|
- this.curWareId = e.target.id.split('-')[2]
|
|
|
- this.curWareType = parseInt(e.target.id.split('-')[1]);
|
|
|
- this.curWareIndex = parseInt(e.target.id.split('-')[3]);
|
|
|
- let curWare = matchWare(this.wareList, this.curWareId);
|
|
|
- if (curWare) {
|
|
|
- this.createRightView(curWare);
|
|
|
- }
|
|
|
- });
|
|
|
- this.moye.root.reRender();
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 把课件列表进行渲染
|
|
|
+ */
|
|
|
+ renderWareList(dataset) {
|
|
|
+ let listDom = document.getElementById('list-content');
|
|
|
+ dataset.forEach(function(item, index) {
|
|
|
+ const { id, type } = item;
|
|
|
|
|
|
+ let itemDom = document.createElement('div');
|
|
|
+ itemDom.setAttribute('id', `item-${type}-${id}-${index}`);
|
|
|
+ itemDom.setAttribute('class', 'ware-item');
|
|
|
+ itemDom.setAttribute('fe-role', 'Widget');
|
|
|
+ itemDom.innerHTML = this.createHTMLString(item);
|
|
|
+ listDom.appendChild(itemDom);
|
|
|
+ if (index === 0) {
|
|
|
+ this.curWareType = parseInt(type);
|
|
|
+ this.curWareId = id;
|
|
|
+ this.createRightView(item);
|
|
|
+ }
|
|
|
+ }.bind(this));
|
|
|
+
|
|
|
+ let listScroll = this.moye.root.getWidgetById('list');
|
|
|
+ listScroll.on('focus', e => {
|
|
|
+ if (this.curWareId === e.target.id.split('-')[2]) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.curWareId = e.target.id.split('-')[2]
|
|
|
+ this.curWareType = parseInt(e.target.id.split('-')[1]);
|
|
|
+ this.curWareIndex = parseInt(e.target.id.split('-')[3]);
|
|
|
+ let curWare = matchWare(this.wareList, this.curWareId);
|
|
|
+ if (curWare) {
|
|
|
+ this.createRightView(curWare);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.moye.root.reRender();
|
|
|
+ }
|
|
|
+
|
|
|
+<<<<<<< HEAD
|
|
|
/**
|
|
|
* 创建左侧列表项内容
|
|
|
*/
|
|
@@ -123,18 +162,99 @@ class LessonScene extends scene {
|
|
|
<img class="ware-icon-content" src="${item.icon}">
|
|
|
</div>
|
|
|
</div>
|
|
|
+=======
|
|
|
+ /**
|
|
|
+ * 创建左侧列表项内容
|
|
|
+ */
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ 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>
|
|
|
+ </div>
|
|
|
+ `;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 创建右侧视窗
|
|
|
+ */
|
|
|
+ createRightView(item) {
|
|
|
+ // 清一下定时器
|
|
|
+ window.clearInterval(this.timer);
|
|
|
+ this.timer = null;
|
|
|
+
|
|
|
+ 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>
|
|
|
+>>>>>>> remotes/origin/dev_winpc_touch
|
|
|
</div>
|
|
|
`;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 创建右侧视窗
|
|
|
- */
|
|
|
- createRightView(item) {
|
|
|
- // 清一下定时器
|
|
|
- window.clearInterval(this.timer);
|
|
|
- this.timer = null;
|
|
|
+ */
|
|
|
+ let videoViewDom = '';
|
|
|
+ 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;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+<<<<<<< HEAD
|
|
|
const { title, type, list } = item;
|
|
|
//设定视窗的标题
|
|
|
document.getElementById('view-top').innerHTML = title;
|
|
@@ -203,8 +323,22 @@ class LessonScene extends scene {
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
+=======
|
|
|
+ /**
|
|
|
+ * 渲染图片视图
|
|
|
+ */
|
|
|
+ renderImageView() {
|
|
|
+ const curImage = this.curImageList[this.curImageIndex];
|
|
|
+ document.getElementById('view-page').innerHTML = (this.curImageIndex + 1) + '/' + this.curImageList.length;
|
|
|
+ let imageDom = `<img src=${curImage.url} />`
|
|
|
+ if (this.isDownload) {
|
|
|
+ imageDom = `<img src=${getLocalResourceUrl(curImage.url)} />`
|
|
|
+>>>>>>> remotes/origin/dev_winpc_touch
|
|
|
}
|
|
|
+ document.getElementById('view-content').innerHTML = imageDom;
|
|
|
+ }
|
|
|
|
|
|
+<<<<<<< HEAD
|
|
|
/**
|
|
|
* 渲染图片视图
|
|
|
*/
|
|
@@ -213,8 +347,49 @@ class LessonScene extends scene {
|
|
|
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) {
|
|
|
+ let localUrl = url;
|
|
|
+ if (this.isDownload) {
|
|
|
+ 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');
|
|
|
}
|
|
|
+ // 监控到初始化视频成功后暂停画面
|
|
|
+ this.timer = window.setInterval(() => {
|
|
|
+ if (this.videoPlayer.playStatus()) {
|
|
|
+ if(this.videoPlayer.getCurtime() > 1000){
|
|
|
+ this.videoPlayer.pause();
|
|
|
+ document.getElementById('view-video-start').innerHTML = '播放';
|
|
|
+ window.clearInterval(this.timer);
|
|
|
+ this.timer = null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, 500);
|
|
|
+ }
|
|
|
|
|
|
+<<<<<<< HEAD
|
|
|
/**
|
|
|
* 渲染音频视图
|
|
|
*/
|
|
@@ -273,58 +448,55 @@ class LessonScene extends scene {
|
|
|
* 渲染视频视图
|
|
|
*/
|
|
|
renderVideoView(name, url, type) {
|
|
|
+=======
|
|
|
+ updateRightView(item) {
|
|
|
+ const { title, type, list } = item;
|
|
|
+ document.getElementById('view-top').innerHTML = title;
|
|
|
+ switch (type) {
|
|
|
+ case Consts.TYPE_VIDEO:
|
|
|
+ let playUrl = '';
|
|
|
+ if (list && list.length >= 1) {
|
|
|
+ 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 = '';
|
|
|
+ this.moye.root.reRender();
|
|
|
+ //如果是H5播放器,则重新创建video标签
|
|
|
+>>>>>>> remotes/origin/dev_winpc_touch
|
|
|
if (window.efunbox) {
|
|
|
- window.efunbox.initAndroidPlayer(
|
|
|
- name,
|
|
|
- url,
|
|
|
- 1, //与android里的音视频类型定义有关,这里写死为type=1
|
|
|
- this.videoPosition.top,
|
|
|
- this.videoPosition.left,
|
|
|
- this.videoPosition.width,
|
|
|
- this.videoPosition.height,
|
|
|
- false
|
|
|
- );
|
|
|
- window.efunbox.start();
|
|
|
- this.videoPlayer = window.efunbox;
|
|
|
+ window.efunbox.customScreen(270, 790, 1072, 603);
|
|
|
} else {
|
|
|
- const videoDom = `<video id="hls-video" controls autoplay>你的浏览器不支持视频播放</video>`;
|
|
|
- document.getElementById('view-content').innerHTML = videoDom;
|
|
|
- this.videoPlayer = new HlsVideoPlugin();
|
|
|
- this.videoPlayer.initH5Player(url, 'hls-video');
|
|
|
+ const videoDom = `<div id="hls-video"></div>`;
|
|
|
+ document.getElementById('view-content').innerHTML = videoDom;
|
|
|
+ this.videoPlayer = new EfunVideoPlayer();
|
|
|
+ this.videoPlayer.initPlayer(playUrl, 'hls-video');
|
|
|
}
|
|
|
- // 监控到初始化视频成功后暂停画面
|
|
|
- this.timer = window.setInterval(() => {
|
|
|
- if (this.videoPlayer.playStatus()) {
|
|
|
- if(this.videoPlayer.getCurtime() > 1000){
|
|
|
- this.videoPlayer.pause();
|
|
|
- document.getElementById('view-video-start').innerHTML = '播放';
|
|
|
- window.clearInterval(this.timer);
|
|
|
- this.timer = null;
|
|
|
- }
|
|
|
- }
|
|
|
- }, 500);
|
|
|
- }
|
|
|
-
|
|
|
- updateRightView(item) {
|
|
|
- const { title, type, list } = item;
|
|
|
- document.getElementById('view-top').innerHTML = title;
|
|
|
- switch (type) {
|
|
|
- case Consts.TYPE_VIDEO:
|
|
|
- let playUrl = '';
|
|
|
- if (list && list.length >= 1) {
|
|
|
- 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">
|
|
|
+ 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-video-start" fe-role="Widget">
|
|
|
- <div class="transparent-btn">${playText}</div>
|
|
|
+ <div id="view-page">1/1</div>
|
|
|
+ <div id="view-next" fe-role="Widget">
|
|
|
+ <div class="transparent-btn">下一页</div>
|
|
|
</div>
|
|
|
+<<<<<<< HEAD
|
|
|
`;
|
|
|
document.getElementById('view-bottom').innerHTML = videoViewDom;
|
|
|
this.moye.root.reRender();
|
|
@@ -431,28 +603,43 @@ class LessonScene extends scene {
|
|
|
(isTrue, res) => {},
|
|
|
);
|
|
|
}
|
|
|
+=======
|
|
|
+ `;
|
|
|
+ document.getElementById('view-bottom').innerHTML = imageViewDom;
|
|
|
+ this.moye.root.reRender();
|
|
|
+ this.renderImageView();
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- onCreate(data) {
|
|
|
- this.lessonId = data.id;
|
|
|
- this.courseId = data.courseId;
|
|
|
- this.setContentView(require('../../../res/tpl/LessonScene.tpl'), {}, 'LessonScene', {}, () => {
|
|
|
- document.getElementById('title').appendChild(document.createTextNode(data.title));
|
|
|
- this.loadWareList();
|
|
|
- CommandBus.execute({
|
|
|
- type: CMD_TYPE.APP_BHV_POST,
|
|
|
- payload: {
|
|
|
- eventName: "enter_wareScene",
|
|
|
- eventPage: "wareScene",
|
|
|
- eventAttr: {
|
|
|
- courseId: data.courseId,
|
|
|
- lessonId: data.id,
|
|
|
- }
|
|
|
- },
|
|
|
- });
|
|
|
- }
|
|
|
- );
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 记录播放行为事件
|
|
|
+ */
|
|
|
+ postPlayRecord(lessonId, courseId, playStopTime=1){
|
|
|
+ APIClient.putUserAction(
|
|
|
+ Consts.USER_ACTION_WATCH,
|
|
|
+ Consts.USER_ACTION_WATCH_NAME,
|
|
|
+ `${courseId}_${lessonId}`,
|
|
|
+ playStopTime,
|
|
|
+ (isTrue, res) => {},
|
|
|
+ );
|
|
|
+ }
|
|
|
+>>>>>>> remotes/origin/dev_winpc_touch
|
|
|
|
|
|
+ onCreate(data) {
|
|
|
+ //是否已下载
|
|
|
+ this.isDownload = checkDownloadStatus(data.downloadStatus);
|
|
|
+ this.lessonId = data.id;
|
|
|
+ this.courseId = data.courseId;
|
|
|
+ this.setContentView(require('../../../res/tpl/LessonScene.tpl'), {}, 'LessonScene', {}, () => {
|
|
|
+ document.getElementById('title').appendChild(document.createTextNode(data.title));
|
|
|
+ this.loadWareList();
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+<<<<<<< HEAD
|
|
|
onResume(data) {
|
|
|
if (!data) { return; }
|
|
|
//更新下当前的课件信息
|
|
@@ -477,8 +664,29 @@ class LessonScene extends scene {
|
|
|
//更新右侧视图
|
|
|
this.updateRightView(this.wareList[curWareIndex]);
|
|
|
this.isBack = true;
|
|
|
+=======
|
|
|
+ onResume(data) {
|
|
|
+ if (!data) { return; }
|
|
|
+ //更新下当前的课件信息
|
|
|
+ const { curWareIndex, curImageList, curImageIndex } = 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;
|
|
|
+>>>>>>> remotes/origin/dev_winpc_touch
|
|
|
+ }
|
|
|
+ //更新左侧焦点位置
|
|
|
+ this.moye.root.getWidgetById(`item-${this.curWareType}-${this.curWareId}-${this.curWareIndex}`).focus();
|
|
|
+ //更新右侧视图
|
|
|
+ this.updateRightView(this.wareList[curWareIndex]);
|
|
|
+ this.isBack = true;
|
|
|
+ }
|
|
|
|
|
|
+<<<<<<< HEAD
|
|
|
onOK() {
|
|
|
const leaf = FocusEngine.getFocusedLeaf();
|
|
|
// 拦截音频控制相关事件单独处理
|
|
@@ -562,41 +770,93 @@ class LessonScene extends scene {
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
+=======
|
|
|
+ onOK(e) {
|
|
|
+ // 后退
|
|
|
+ if (e.target.con.classList.contains('goback')) {
|
|
|
+ this.hideScene({id: this.courseId}, 'CourseScene');
|
|
|
+ return;
|
|
|
+>>>>>>> remotes/origin/dev_winpc_touch
|
|
|
}
|
|
|
+ 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 (this.curWareType === Consts.TYPE_IMAGE) {
|
|
|
+ this.showScene(require('./ImageWareFullScreenScene.js'), {
|
|
|
+ wareList: this.wareList,
|
|
|
+ curWareIndex: this.curWareIndex,
|
|
|
+ curImageList: this.curImageList,
|
|
|
+ curImageIndex: this.curImageIndex,
|
|
|
+ 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;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- onPause() {
|
|
|
+ onPause() {
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- onDestroy() {
|
|
|
+ onDestroy() {
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- onActive() {
|
|
|
+ onActive() {
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- onInactive() {
|
|
|
+ onInactive() {
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- onBack() {
|
|
|
- if (this.isBack) {
|
|
|
- return true;
|
|
|
- } else if (window.efunbox) {
|
|
|
- window.efunbox.closePlayer();
|
|
|
- }
|
|
|
- }
|
|
|
+ onBack() {
|
|
|
+ if (this.isBack) {
|
|
|
+ return true;
|
|
|
+ } else if (window.efunbox) {
|
|
|
+ window.efunbox.closePlayer();
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- onKeydown(e) {
|
|
|
- switch (e.keyCode) {
|
|
|
- case Consts.KEYCODE_EXIT:
|
|
|
- this.isBack = false;
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
+ onKeydown(e) {
|
|
|
+ switch (e.keyCode) {
|
|
|
+ case Consts.KEYCODE_EXIT:
|
|
|
+ this.isBack = false;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
module.exports = LessonScene;
|