|
@@ -3,91 +3,91 @@ import Consts from '../../../util/Consts';
|
|
|
class ImageWareFullScreenScene extends scene {
|
|
|
constructor(scope) {
|
|
|
super(scope);
|
|
|
- this.wareList = [];
|
|
|
- this.curWareIndex = 0;
|
|
|
- this.curWareType = null;
|
|
|
+ this.wareList = [];
|
|
|
+ this.curWareIndex = 0;
|
|
|
+ this.curWareType = null;
|
|
|
this.curImageList = [];
|
|
|
this.curImageIndex = 0;
|
|
|
}
|
|
|
|
|
|
- renderImageView() {
|
|
|
+ renderImageView() {
|
|
|
const curImage = this.curImageList[this.curImageIndex];
|
|
|
document.getElementById('wareImg').setAttribute('src', curImage.url);
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- dynamicChangeWare(wareIndex, type) {
|
|
|
+ dynamicChangeWare(wareIndex, type) {
|
|
|
if (type === 'BACK') {
|
|
|
TVUtil.Toast.show('即将播放上个课件...', 1500);
|
|
|
} else if (type === 'NEXT') {
|
|
|
TVUtil.Toast.show('即将播放下个课件...', 1500);
|
|
|
}
|
|
|
setTimeout(() => {
|
|
|
- this.curWareIndex = wareIndex;
|
|
|
- this.curWareType = this.wareList[wareIndex].type;
|
|
|
- //下一个或前一个课件是视频课件
|
|
|
- if (this.curWareType === Consts.TYPE_VIDEO) {
|
|
|
+ this.curWareIndex = wareIndex;
|
|
|
+ this.curWareType = this.wareList[wareIndex].type;
|
|
|
+ //下一个或前一个课件是视频课件
|
|
|
+ if (this.curWareType === Consts.TYPE_VIDEO) {
|
|
|
this.hideScene();
|
|
|
- this.showScene(require('./VideoWareFullScreenScene.js'), {
|
|
|
+ this.showScene(require('./VideoWareFullScreenScene.js'), {
|
|
|
wareList: this.wareList,
|
|
|
- curWareIndex: this.curWareIndex,
|
|
|
- });
|
|
|
- //下一个或前一个课件是图片课件
|
|
|
- } else {
|
|
|
- this.curImageList = this.wareList[wareIndex].list;
|
|
|
- if (type === 'BACK') {
|
|
|
- this.curImageIndex = this.wareList[wareIndex].list.length - 1;
|
|
|
- }
|
|
|
- if (type === 'NEXT') {
|
|
|
- this.curImageIndex = 0;
|
|
|
- }
|
|
|
- this.renderImageView();
|
|
|
- }
|
|
|
+ curWareIndex: this.curWareIndex,
|
|
|
+ });
|
|
|
+ //下一个或前一个课件是图片课件
|
|
|
+ } else {
|
|
|
+ this.curImageList = this.wareList[wareIndex].list;
|
|
|
+ if (type === 'BACK') {
|
|
|
+ this.curImageIndex = this.wareList[wareIndex].list.length - 1;
|
|
|
+ }
|
|
|
+ if (type === 'NEXT') {
|
|
|
+ this.curImageIndex = 0;
|
|
|
+ }
|
|
|
+ this.renderImageView();
|
|
|
+ }
|
|
|
}, 1500);
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
keyRightHandler() {
|
|
|
const hasNextWare = this.curWareIndex < this.wareList.length - 1 ? true : false;
|
|
|
- //当前图片是该图片课件最后一张图片,且后边还有课件则切换课件
|
|
|
+ //当前图片是该图片课件最后一张图片,且后边还有课件则切换课件
|
|
|
if (this.curImageIndex === this.curImageList.length - 1 && hasNextWare) {
|
|
|
- const nextWareIndex = this.curWareIndex + 1;
|
|
|
- this.dynamicChangeWare(nextWareIndex, 'NEXT')
|
|
|
+ const nextWareIndex = this.curWareIndex + 1;
|
|
|
+ this.dynamicChangeWare(nextWareIndex, 'NEXT')
|
|
|
//当前图片是该图片课件最后一张图片,且后边没有课件,给出提示
|
|
|
- } else if (this.curImageIndex === this.curImageList.length - 1 && !hasNextWare) {
|
|
|
+ } else if (this.curImageIndex === this.curImageList.length - 1 && !hasNextWare) {
|
|
|
TVUtil.Toast.show('已经是最后一个课件了', 2000);
|
|
|
//当前图片不是该图片课件的最后一张图片
|
|
|
- } else {
|
|
|
+ } else {
|
|
|
this.curImageIndex += 1;
|
|
|
this.renderImageView();
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
keyLeftHandler() {
|
|
|
const hasPreviousWare = this.curWareIndex === 0 ? false : true;
|
|
|
//当前图片是该图片课件的第一张图片,且前边还有课件
|
|
|
- if (this.curImageIndex == 0 && hasPreviousWare) {
|
|
|
- const previousWareIndex = this.curWareIndex - 1;
|
|
|
- this.dynamicChangeWare(previousWareIndex, 'BACK');
|
|
|
+ if (this.curImageIndex == 0 && hasPreviousWare) {
|
|
|
+ const previousWareIndex = this.curWareIndex - 1;
|
|
|
+ this.dynamicChangeWare(previousWareIndex, 'BACK');
|
|
|
//当前图片是该图片课件的第一张图片,且前边没有课件,则给出提示
|
|
|
} else if (this.curImageIndex === 0 && !hasPreviousWare) {
|
|
|
TVUtil.Toast.show('已经是第一个课件了', 2000);
|
|
|
//当前图片不是该图片课件的第一张图片
|
|
|
- } else {
|
|
|
+ } else {
|
|
|
this.curImageIndex -= 1;
|
|
|
this.renderImageView();
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
onCreate(data) {
|
|
|
- this.wareList = data.wareList;
|
|
|
- this.curWareIndex = data.curWareIndex;
|
|
|
- if (data.curImageList) {
|
|
|
- this.curImageList = data.curImageList;
|
|
|
- }
|
|
|
- if (data.curImageIndex) {
|
|
|
- this.curImageIndex = data.curImageIndex;
|
|
|
- }
|
|
|
- this.curWareType = this.wareList[this.curWareIndex].type;
|
|
|
- this.setContentView(require('../../../res/tpl/ImageWareFullScreen.tpl'), {}, 'imageWareFullScreen', {}, () => {
|
|
|
+ this.wareList = data.wareList;
|
|
|
+ this.curWareIndex = data.curWareIndex;
|
|
|
+ if (data.curImageList) {
|
|
|
+ this.curImageList = data.curImageList;
|
|
|
+ }
|
|
|
+ if (data.curImageIndex) {
|
|
|
+ this.curImageIndex = data.curImageIndex;
|
|
|
+ }
|
|
|
+ this.curWareType = this.wareList[this.curWareIndex].type;
|
|
|
+ this.setContentView(require('../../../res/tpl/ImageWareFullScreen.tpl'), {}, 'ImageWareFullScreen', {}, () => {
|
|
|
this.renderImageView();
|
|
|
});
|
|
|
}
|
|
@@ -126,32 +126,33 @@ class ImageWareFullScreenScene extends scene {
|
|
|
|
|
|
onKeydown(e) {
|
|
|
switch (e.keyCode) {
|
|
|
- //左键
|
|
|
+ //左键
|
|
|
case 37:
|
|
|
this.keyLeftHandler();
|
|
|
- break;
|
|
|
- //右键
|
|
|
+ break;
|
|
|
+ //右键
|
|
|
case 39:
|
|
|
this.keyRightHandler();
|
|
|
break;
|
|
|
- //触屏设备向左滑动
|
|
|
+ //触屏设备向左滑动
|
|
|
case Consts.KEYCODE_CLICK_LEFT_SCREEN:
|
|
|
this.keyLeftHandler();
|
|
|
break;
|
|
|
- //触屏设备向右滑动
|
|
|
+ //触屏设备向右滑动
|
|
|
case Consts.KEYCODE_CLICK_RIGHT_SCREEN:
|
|
|
this.keyRightHandler();
|
|
|
break;
|
|
|
- //ESC键退出图片全屏
|
|
|
+ //ESC键退出图片全屏
|
|
|
case 27:
|
|
|
- this.hideScene({
|
|
|
- curWareIndex: this.curWareIndex,
|
|
|
- curImageList: this.curImageList,
|
|
|
- curImageIndex: this.curImageIndex,
|
|
|
- }, 'ware');
|
|
|
+ this.hideScene({
|
|
|
+ curWareIndex: this.curWareIndex,
|
|
|
+ curImageList: this.curImageList,
|
|
|
+ curImageIndex: this.curImageIndex,
|
|
|
+ }, 'LessonScene');
|
|
|
+ break;
|
|
|
+ default:
|
|
|
break;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|