Bläddra i källkod

:twisted_rightwards_arrows: merge branch 'online_kid' into online_weichuang

zhanghe 6 år sedan
förälder
incheckning
468f61435f

+ 3 - 0
src/res/tpl/AudioWareFullScreen.tpl

@@ -0,0 +1,3 @@
+<div id="AudioWareFullScreen" fe-role="Switch">
+    <img id="wareImg" src="assets/img/default_bg.jpg" />
+</div>

+ 1 - 13
src/res/tpl/GlobalGoodDetail.tpl

@@ -1,10 +1,7 @@
 <div id="GlobalGoodDetailScene" fe-role="Switch">
     <div class="control-panel">
-        <!-- <div class="search-btn-frame" fe-role="Widget">
-            <img src="./assets/img/CLScene/search.png" />
-        </div> -->
         <div class="shopping-cart-btn-frame" fe-role="Widget">
-            <img src="./assets/img/CLScene/shopping_cart.png" />
+            <img src="./assets/img/CLScene/icon_shopcart.png" />
         </div>
         <div class="cart-num"></div>
     </div>
@@ -16,12 +13,6 @@
             <p id="ggd-detail-desc" class="desc">...
             </p>
             <div class="detail-control-panel" id="detail-control-panel">
-                <!-- <div id="add-cart-btn" class="add-shop-cart-btn-frame" fe-role="Widget">
-                    <img src="./assets/img/GlobalGoodDetail/add_shop_cart.png" />
-                </div>
-                <div id="goto-course-btn" class="play-btn-frame" fe-role="Widget" >
-                    <img src="./assets/img/GlobalGoodDetail/play_course.png" />
-                </div> -->
             </div>
         </div>
     </div>
@@ -29,9 +20,6 @@
         <p id="ggd-concerned-goods-count" class="concerned-goods-count"></p>
         <div id="ggd-concerned-goods-scroll" fe-role="Scroll" fe-cfg="scroll_dir:h, auto_list_width:yes">
             <ul id="ggd-concerned-goods-list" class="scroll-list" >
-                <!--<li class="item" fe-role="Widget">
-                    <img src="https://placeholdit.imgix.net/~text?txtsize=28&txt=Cover&w=114&h=114" />
-                </li>-->
             </ul>
         </div>
     </div>

BIN
src/stage/index/assets/img/Audio/audio_last.png


BIN
src/stage/index/assets/img/Audio/audio_mute.png


BIN
src/stage/index/assets/img/Audio/audio_next.png


BIN
src/stage/index/assets/img/Audio/audio_play.png


BIN
src/stage/index/assets/img/Audio/audio_stop.png


BIN
src/stage/index/assets/img/Audio/audio_voice.png


+ 1 - 0
src/stage/index/index.less

@@ -30,3 +30,4 @@ body {
 @import './style/GlobalGoodDetail.less';
 @import './style/ImageWareFullScreen.less';
 @import './style/VideoWareFullScreen.less';
+@import './style/AudioWareFullScreen.less';

+ 264 - 0
src/stage/index/scene/AudioWareFullScreenScene.js

@@ -0,0 +1,264 @@
+import Consts from '../../../util/Consts';
+
+class AudioWareFullScreenScene extends scene {
+	constructor(scope) {
+		super(scope);
+		this.wareList = [];
+		this.curWareIndex = 0;
+		this.curWareType = null;
+		this.curAudioList = [];
+		this.curAudioIndex = 0;
+	}
+
+    /**
+     * 音频播放控制
+     */
+    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();
+                } else {
+                    this.keyRightHandler();
+                }
+                break;
+            case 'audio-last':
+                if (this.curAudioIndex > 0) {
+                    this.curAudioIndex -= 1;
+                    this.renderAudioView();
+                } else {
+                    this.keyLeftHandler();
+                }
+                break;
+            default:
+                break;
+        }
+    }
+
+    /**
+     * 音频渲染
+     */
+	renderAudioView() {
+        const curAudio = this.curAudioList[this.curAudioIndex];
+        const { type, img, audio } = curAudio;
+        let imgPath = (img || {}).path || '';
+        let audioUrl = (audio || {}).url || '';
+        let content = document.getElementById('AudioWareFullScreen');
+        // 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);
+            let controlsElement = document.createElement('div');
+            controlsElement.setAttribute('class', 'audio-controls');
+            controlsElement.setAttribute('fe-role', 'Switch');
+            let controlsBtns = `
+                <!-- 播放/暂停 -->
+                <div id="audio-play" class="audio-controls-item btn-play paused" 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();
+            FocusEngine.getWidgetById('audio-play').focus();
+        }
+	}
+
+	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.hideScene();
+				this.showScene(require('./VideoWareFullScreenScene.js'), {
+					wareList: this.wareList,
+					curWareIndex: this.curWareIndex,
+				});
+            //下一个或前一个课件是图片课件
+            } else if (this.curWareType === Consts.TYPE_IMAGE) {
+                let imgList = this.wareList[this.curWareIndex].list;
+                let imgIndex = 0;
+                if (type === 'BACK' && imgList.length) {
+                    imgIndex = imgList.length - 1;
+                }
+                this.hideScene();
+        		this.showScene(require('./ImageWareFullScreenScene.js'), {
+        			wareList: this.wareList,
+        			curWareIndex: this.curWareIndex,
+        			curImageList: imgList,
+        			curImageIndex: imgIndex,
+        		});
+			//下一个或前一个课件是音频课件
+			} else {
+				this.curAudioList = this.wareList[wareIndex].list;
+				if (type === 'BACK') {
+					this.curAudioIndex = this.wareList[wareIndex].list.length - 1;
+				}
+				if (type === 'NEXT') {
+					this.curAudioIndex = 0;
+				}
+				this.renderAudioView();
+			}
+		}, 1500);
+	}
+
+	keyRightHandler() {
+		const hasNextWare = this.curWareIndex < this.wareList.length - 1 ? true : false;
+		//当前图片是该图片课件最后一张图片,且后边还有课件则切换课件
+		if (this.curAudioIndex === this.curAudioList.length - 1 && hasNextWare) {
+			const nextWareIndex = this.curWareIndex + 1;
+			this.dynamicChangeWare(nextWareIndex, 'NEXT')
+		//当前图片是该图片课件最后一张图片,且后边没有课件,给出提示
+		} else if (this.curAudioIndex === this.curAudioList.length - 1 && !hasNextWare) {
+			TVUtil.Toast.show('已经是最后一个课件了', 2000);
+		//当前图片不是该图片课件的最后一张图片
+    	} else {
+			this.curAudioIndex += 1;
+			this.renderAudioView();
+    	}
+	}
+
+	keyLeftHandler() {
+		const hasPreviousWare = this.curWareIndex === 0 ? false : true;
+		//当前图片是该图片课件的第一张图片,且前边还有课件
+	    if (this.curAudioIndex == 0 && hasPreviousWare) {
+			const previousWareIndex = this.curWareIndex - 1;
+			this.dynamicChangeWare(previousWareIndex, 'BACK');
+		//当前图片是该图片课件的第一张图片,且前边没有课件,则给出提示
+		} else if (this.curAudioIndex === 0 && !hasPreviousWare) {
+			TVUtil.Toast.show('已经是第一个课件了', 2000);
+		//当前图片不是该图片课件的第一张图片
+		} else {
+			this.curAudioIndex -= 1;
+			this.renderAudioView();
+		}
+	}
+
+	onCreate(data) {
+	    this.wareList = data.wareList;
+	    this.curWareIndex = data.curWareIndex;
+	    if (data.curAudioList) {
+			this.curAudioList = data.curAudioList;
+	    }
+	    if (data.curAudioIndex) {
+			this.curAudioIndex = data.curAudioIndex;
+	    }
+	    this.curWareType = this.wareList[this.curWareIndex].type;
+		this.setContentView(require('../../../res/tpl/AudioWareFullScreen.tpl'), {}, 'AudioWareFullScreen', {}, () => {
+			this.renderAudioView();
+		});
+	}
+
+	onResume() {
+
+	}
+
+	onPause() {
+
+	}
+
+	onDestroy() {
+
+	}
+
+	onActive() {
+
+	}
+
+	onInactive() {
+
+	}
+
+	onOK() {
+    	const leaf = FocusEngine.getFocusedLeaf();
+        // 拦截音频控制相关事件单独处理
+        if (leaf.id && leaf.id.startsWith('audio')) {
+            this.audioPlayControl(leaf.id);
+            return;
+        }
+	}
+
+	onBack() {
+
+	}
+
+	onKeyup() {
+
+	}
+
+	onKeydown(e) {
+        let curFocusedLeaf = FocusEngine.getFocusedLeaf();
+		switch (e.keyCode) {
+			//左键
+			case 37:
+                if (!curFocusedLeaf.id.startsWith('audio')) {
+                    this.keyLeftHandler();
+                }
+				break;
+			//右键
+			case 39:
+                if (!curFocusedLeaf.id.startsWith('audio')) {
+                    this.keyRightHandler();
+                }
+				break;
+			//触屏设备向左滑动
+			case Consts.KEYCODE_CLICK_LEFT_SCREEN:
+				this.keyLeftHandler();
+				break;
+			//触屏设备向右滑动
+			case Consts.KEYCODE_CLICK_RIGHT_SCREEN:
+				this.keyRightHandler();
+				break;
+			//ESC键退出图片全屏
+			case 27:
+				this.hideScene({
+					curWareIndex: this.curWareIndex,
+					curAudioList: this.curAudioList,
+					curAudioIndex: this.curAudioIndex,
+				}, 'LessonScene');
+				break;
+			default:
+				break;
+		}
+	}
+}
+
+module.exports = AudioWareFullScreenScene;

+ 2 - 2
src/stage/index/scene/GlobalGoodDetailScene.js

@@ -41,7 +41,7 @@ class GlobalGoodDetailScene extends scene {
 
         let btnWrapper = document.getElementById('detail-control-panel');
         let addCartHTML = `<div id="add-cart-btn" data-goodsId="${goodsItem.id}" class="add-shop-cart-btn-frame add-cart" fe-role="Widget"><img src="./assets/img/GlobalGoodDetail/add_shop_cart.png" /></div>`;
-        let addCartBoughtHTML = `<div id="add-cart-btn" class="add-shop-cart-btn-frame" fe-role="Widget"><img src="./assets/img/course/detail/periphery_added.png" /></div>`;
+        let addCartBoughtHTML = `<div id="add-cart-btn" class="add-shop-cart-btn-frame" fe-role="Widget"><img src="./assets/img/CourseScene/detail/periphery_added.png" /></div>`;
 
         if (relatedCourses && relatedCourses.length) {
             //可能会有多个相关的课程,这里只取第一个
@@ -59,7 +59,7 @@ class GlobalGoodDetailScene extends scene {
             let addCartBtn = FocusEngine.getWidgetById('add-cart-btn');
             addCartBtn.con.classList.add('added');
             addCartBtn.con.classList.remove('add-cart');
-            addCartBtn.con.children[0].src = goodsItem.isInCart ? './assets/img/course/detail/periphery_added.png' : './assets/img/GlobalGoodDetail/add_shop_cart.png';
+            addCartBtn.con.children[0].src = goodsItem.isInCart ? './assets/img/CourseScene/detail/periphery_added.png' : './assets/img/GlobalGoodDetail/add_shop_cart.png';
         }
     }
 

+ 14 - 0
src/stage/index/scene/ImageWareFullScreenScene.js

@@ -31,6 +31,20 @@ class ImageWareFullScreenScene extends scene {
 					wareList: this.wareList,
 					curWareIndex: this.curWareIndex,
 				});
+            //下一个或前一个课件是音频课件
+			} else if (this.curWareType === Consts.TYPE_AUDIOBOOK) {
+                let imgList = this.wareList[this.curWareIndex].list;
+                let imgIndex = 0;
+                if (type === 'BACK' && imgList.length) {
+                    imgIndex = imgList.length - 1;
+                }
+                this.hideScene();
+                this.showScene(require('./AudioWareFullScreenScene.js'), {
+                    wareList: this.wareList,
+                    curWareIndex: this.curWareIndex,
+                    curAudioList: imgList,
+                    curAudioIndex: imgIndex,
+                });
 			//下一个或前一个课件是图片课件
 			} else {
 				this.curImageList = this.wareList[wareIndex].list;

+ 192 - 25
src/stage/index/scene/LessonScene.js

@@ -1,5 +1,6 @@
-import APIClient from '../../../util/API/APIClient'
-import Consts from '../../../util/Consts'
+import APIClient from '../../../util/API/APIClient';
+import Consts from '../../../util/Consts';
+import Utils from '../../../util/Utils';
 import HlsVideoPlugin from '../../../util/HlsVideoPlugin';
 import {CommandBus, CMD_TYPE} from '../../../util/CommandBus';
 
@@ -17,24 +18,26 @@ function matchWare(wareList, wareId) {
 
 class LessonScene extends scene {
     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.videoPosition = {
-    	top: 270,
-    	left: 790,
-    	width: 1072,
-    	height: 603,
-    };
+        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,
+        };
     }
 
     /**
@@ -109,6 +112,8 @@ class LessonScene extends scene {
     		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>
@@ -141,7 +146,7 @@ class LessonScene extends scene {
     		case Consts.TYPE_VIDEO:
     			let playUrl = '';
     			if (list && list.length >= 1) {
-    				playUrl = list[0].url;
+    				playUrl = Utils.videoUrlFormat(list[0].url);
     			}
     			let videoViewDom =
                 `
@@ -175,6 +180,26 @@ class LessonScene extends scene {
     				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.curAudioList = list;
+    			if (this.curAudioList.length > 0) {
+    				this.curAudioIndex = 0;
+    				this.renderAudioView();
+    			}
+                break;
             default:
                 break;
     	}
@@ -185,11 +210,54 @@ class LessonScene extends scene {
     */
     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-page').innerHTML = (this.curImageIndex + 1) + '/' + this.curImageList.length;
+        const imageDom = `<img src=${curImage.url} />`
     	document.getElementById('view-content').innerHTML = imageDom;
     }
 
     /**
+     * 渲染音频视图
+     */
+    renderAudioView() {
+        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);
+            let controlsElement = document.createElement('div');
+            controlsElement.setAttribute('class', 'audio-controls');
+            controlsElement.setAttribute('fe-role', 'Switch');
+            let controlsBtns = `
+                <!-- 播放/暂停 -->
+                <div id="audio-play" class="audio-controls-item btn-play paused" 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();
+            //FocusEngine.getWidgetById('audio-play').focus();
+        }
+    }
+
+    /**
     * 渲染视频视图
     */
     renderVideoView(name, url, type) {
@@ -232,14 +300,18 @@ class LessonScene extends scene {
     		case Consts.TYPE_VIDEO:
     			let playUrl = '';
     			if (list && list.length >= 1) {
-    				playUrl = 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">${this.videoPlayer.playStatus() ? "暂停" : "播放"}</div>
+                    <div class="transparent-btn">${playText}</div>
                   </div>
                 `;
     			document.getElementById('view-bottom').innerHTML = videoViewDom;
@@ -270,12 +342,72 @@ class LessonScene extends scene {
     			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();
+                }
+                break;
+            case 'audio-last':
+                if (this.curAudioIndex > 0) {
+                    this.curAudioIndex -= 1;
+                    this.renderAudioView();
+                }
+                break;
+            default:
+                break;
+        }
+    }
+
+    /**
     * 记录播放行为事件
     */
     postPlayRecord(lessonId, courseId, playStopTime=1){
@@ -312,7 +444,7 @@ class LessonScene extends scene {
     onResume(data) {
         if (!data) { return; }
         //更新下当前的课件信息
-        const { curWareIndex, curImageList, curImageIndex } = data;
+        const { curWareIndex, curImageList, curImageIndex, curAudioList, curAudioIndex } = data;
         this.curWareIndex = curWareIndex;
         this.curWareId = this.wareList[curWareIndex].id;
         this.curWareType = this.wareList[curWareIndex].type;
@@ -322,6 +454,12 @@ class LessonScene extends scene {
         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();
         //更新右侧视图
@@ -331,6 +469,11 @@ class LessonScene extends scene {
 
     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) {
@@ -363,6 +506,22 @@ class LessonScene extends scene {
                         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;
@@ -371,6 +530,10 @@ class LessonScene extends scene {
     				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':
@@ -378,6 +541,10 @@ class LessonScene extends scene {
     				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:

+ 23 - 3
src/stage/index/scene/VideoWareFullScreenScene.js

@@ -1,4 +1,5 @@
 import Consts from '../../../util/Consts';
+import Utils from '../../../util/Utils';
 import HlsVideoPlugin from '../../../util/HlsVideoPlugin';
 
 class VideoWareFullScreenScene extends scene {
@@ -35,12 +36,31 @@ class VideoWareFullScreenScene extends scene {
                 this.initVideoPlayer(curWareItem);
             } else if (this.curWareType === Consts.TYPE_IMAGE) {
                 //进入到图片全屏场景
+                let imgList = curWareItem.list;
+                let imgIndex = 0;
+                if (type === 'BACK' && imgList.length) {
+                    imgIndex = imgList.length - 1;
+                }
                 this.hideScene();
                 this.showScene(require('./ImageWareFullScreenScene.js'), {
                     wareList: this.wareList,
                     curWareIndex: this.curWareIndex,
-                    curImageList: curWareItem.list,
-                    curImageIndex: 0,
+                    curImageList: imgList,
+                    curImageIndex: imgIndex,
+                });
+            } else if (this.curWareType === Consts.TYPE_AUDIOBOOK) {
+                //进入到音频全屏场景
+                let imgList = curWareItem.list;
+                let imgIndex = 0;
+                if (type === 'BACK' && imgList.length) {
+                    imgIndex = imgList.length - 1;
+                }
+                this.hideScene();
+                this.showScene(require('./AudioWareFullScreenScene.js'), {
+                    wareList: this.wareList,
+                    curWareIndex: this.curWareIndex,
+                    curAudioList: imgList,
+                    curAudioIndex: imgIndex,
                 });
             }
         }, 1500);
@@ -86,7 +106,7 @@ class VideoWareFullScreenScene extends scene {
         const { list, type, title } = wareItem;
         let playUrl = '';
         if (list.length > 0) {
-          playUrl = list[0].url;
+          playUrl = Utils.videoUrlFormat(list[0].url);
         }
         if (window.efunbox) {
         	window.efunbox.initAndroidPlayer(

+ 65 - 0
src/stage/index/style/AudioWareFullScreen.less

@@ -0,0 +1,65 @@
+#AudioWareFullScreen {
+	position: absolute;
+	left: 0;
+	top: 0;
+	width: 100%;
+	height: 100%;
+	overflow: hidden;
+	background-image: url(assets/img/icon.png);
+	background-size: 100% 100%;
+	background-repeat: no-repeat;
+
+	img {
+		width: 100%;
+		height: 100%;
+	}
+
+	audio {
+		width: 100%;
+		height: 100%;
+	}
+
+	.audio-controls {
+		z-index: 10;
+		position: absolute;
+		left: 0;
+		bottom: .4rem;
+		width: 100%;
+		height: .7rem;
+		.audio-controls-item {
+			width: .6rem;
+			height: .6rem;
+			border: solid unit(@borderSize, rem) transparent;
+			border-radius: 50%;
+			background-size: 100% 100%;
+			background-repeat: no-repeat;
+			&.btn-play {
+				float: left;
+				margin-left: .2rem;
+				background-image: url(assets/img/Audio/audio_stop.png);
+				&.paused {
+					background-image: url(assets/img/Audio/audio_play.png);
+				}
+			}
+			&.btn-mute {
+				float: left;
+				background-image: url(assets/img/Audio/audio_mute.png);
+				&.muted {
+					background-image: url(assets/img/Audio/audio_voice.png);
+				}
+			}
+			&.btn-last {
+				float: right;
+				background-image: url(assets/img/Audio/audio_last.png);
+			}
+			&.btn-next {
+				float: right;
+				margin-right: .2rem;
+				background-image: url(assets/img/Audio/audio_next.png);
+			}
+			&.fe-focus {
+				.after-focus(@borderSize; #ffe100; .1rem; rgba(0,0,0,0.5));
+			}
+		}
+	}
+}

+ 1 - 1
src/stage/index/style/GlobalGoodDetail.less

@@ -4,7 +4,7 @@
     position: absolute;
     width: 100%;
     height: 100%;
-    background: url('./assets/img/GlobalGoodDetail/bg.jpg') center no-repeat;
+    background: url('./assets/img/GlobalGoodDetail/background.jpg') center no-repeat;
     background-size: 100% 100%;
 
     .control-panel {

+ 47 - 0
src/stage/index/style/LessonScene.less

@@ -124,6 +124,53 @@
 				width: 100%;
 				height: 100%;
 			}
+			audio {
+				width: 100%;
+				height: 100%;
+			}
+			.audio-controls {
+				z-index: 10;
+				position: absolute;
+				left: 0;
+				bottom: 1.22rem;
+				width: 10.72rem;
+				height: .6rem;
+				.audio-controls-item {
+					width: .6rem;
+					height: .6rem;
+					border: solid unit(@borderSize, rem) transparent;
+					border-radius: 50%;
+					background-size: 100% 100%;
+					background-repeat: no-repeat;
+					&.btn-play {
+						float: left;
+						margin-left: .2rem;
+						background-image: url(assets/img/Audio/audio_stop.png);
+						&.paused {
+							background-image: url(assets/img/Audio/audio_play.png);
+						}
+					}
+					&.btn-mute {
+						float: left;
+						background-image: url(assets/img/Audio/audio_mute.png);
+						&.muted {
+							background-image: url(assets/img/Audio/audio_voice.png);
+						}
+					}
+					&.btn-last {
+						float: right;
+						background-image: url(assets/img/Audio/audio_last.png);
+					}
+					&.btn-next {
+						float: right;
+						margin-right: .2rem;
+						background-image: url(assets/img/Audio/audio_next.png);
+					}
+					&.fe-focus {
+						.after-focus(@borderSize; #ffe100; .1rem; rgba(0,0,0,0.5));
+					}
+				}
+			}
 		}
 
 		#view-bottom {

+ 1 - 0
src/util/API/AJAXHelper.js

@@ -62,6 +62,7 @@ class AJAXHelper {
 		xmlHttpReq.setRequestHeader('uid', uid);
 		xmlHttpReq.setRequestHeader('sign', sign);
 		xmlHttpReq.setRequestHeader('terminal', platform);
+		xmlHttpReq.setRequestHeader('merchant', 'baby');
 		xmlHttpReq.setRequestHeader('requestId', requestId);
 		xmlHttpReq.setRequestHeader('Authentication', sign); //header中增加Authentication以兼容老版本
 		xmlHttpReq.setRequestHeader('Content-Type', 'application/' + (method == 'POST' || method == 'PUT' ? 'json' : 'text'));

+ 4 - 2
src/util/Consts.js

@@ -11,12 +11,14 @@ class Consts {
 }
 
 //图片/视频资源域名
-Consts.IMG_PATH = 'http://ljimgs.ai160.com';
-Consts.VIDEO_PATH = 'http://ljvideo.ai160.com/vs2m';
+Consts.IMG_PATH = 'https://efunimgs.ai160.com';
+Consts.VIDEO_PATH = 'https://efunvideo.ai160.com';
 
 //图片/视频资源类型代号
 Consts.TYPE_VIDEO = 0;
+Consts.TYPE_AUDIO = 1;
 Consts.TYPE_IMAGE = 3;
+Consts.TYPE_AUDIOBOOK = 4;
 
 //产品类型
 Consts.TYPE_COURSE = 'COURSE';

+ 25 - 14
src/util/Utils.js

@@ -152,13 +152,13 @@ class Utils {
        return format;
     }
 
-  static trimJsonStr(src){
-    //所有"'" 替换为"\""
-    if(typeof(src) == "string"){
-      return src.replace(new RegExp("'","gm"), "\"");
+    static trimJsonStr(src){
+        //所有"'" 替换为"\""
+        if(typeof(src) == "string"){
+            return src.replace(new RegExp("'","gm"), "\"");
+        }
+        return src;
     }
-    return src;
-  }
 
 	/**
 	 * @desc uuid生成器
@@ -187,14 +187,25 @@ class Utils {
 		return uuid.join('');
 	}
 
-  static getUuidForWeb() {
-    const uuid = Utils.uuid(32);
-    const start = uuid.slice(0,8);
-    const next = uuid.slice(8,12);
-    const nextNext = uuid.slice(13,17);
-    const last = uuid.slice(17,32);
-    return `${start}-${next}-${nextNext}-${last}`;
-  }
+    static getUuidForWeb() {
+        const uuid = Utils.uuid(32);
+        const start = uuid.slice(0,8);
+        const next = uuid.slice(8,12);
+        const nextNext = uuid.slice(13,17);
+        const last = uuid.slice(17,32);
+        return `${start}-${next}-${nextNext}-${last}`;
+    }
+
+    static videoUrlFormat(url) {
+        if (!url) { return; }
+        if (url.startsWith('http')) {
+            return url.replace('http://ljvideo.ai160.com', Consts.VIDEO_PATH);
+        } else if (url.startsWith('https')) {
+            return url;
+        } else {
+            return url;
+        }
+    }
 }
 
 export default Utils;