Browse Source

贝尔安亲合并修改

sophieChenyx 6 years ago
parent
commit
8805ffe519
46 changed files with 2309 additions and 613 deletions
  1. 2 2
      config/gulpfile.js
  2. 3 0
      src/res/tpl/AudioWareFullScreen.tpl
  3. 1 1
      src/res/tpl/CourseScene.tpl
  4. 109 0
      src/res/tpl/DownloadScene.tpl
  5. 8 0
      src/res/tpl/DownloadTipScene.tpl
  6. 2 2
      src/res/tpl/LoginScene.tpl
  7. 6 2
      src/res/values/api.json
  8. BIN
      src/stage/index/assets/img/Audio/audio_last.png
  9. BIN
      src/stage/index/assets/img/Audio/audio_mute.png
  10. BIN
      src/stage/index/assets/img/Audio/audio_next.png
  11. BIN
      src/stage/index/assets/img/Audio/audio_play.png
  12. BIN
      src/stage/index/assets/img/Audio/audio_stop.png
  13. BIN
      src/stage/index/assets/img/Audio/audio_voice.png
  14. BIN
      src/stage/index/assets/img/CourseScene/download_btn_list_failed.png
  15. BIN
      src/stage/index/assets/img/DownloadScene/download_del_disable_btn.png
  16. BIN
      src/stage/index/assets/img/IndexScene/background.png
  17. BIN
      src/stage/index/assets/img/IndexScene/index_bg.png
  18. BIN
      src/stage/index/assets/img/IndexScene/logo.png
  19. 2 1
      src/stage/index/index.html
  20. 2 0
      src/stage/index/index.less
  21. 296 0
      src/stage/index/scene/AudioWareFullScreenScene.js
  22. 0 0
      src/stage/index/scene/CourseList.js
  23. 48 66
      src/stage/index/scene/CourseScene.js
  24. 15 10
      src/stage/index/scene/DelConfirmScene.js
  25. 229 0
      src/stage/index/scene/DownloadManagerScene.js
  26. 59 0
      src/stage/index/scene/DownloadTipScene.js
  27. 27 1
      src/stage/index/scene/ImageWareFullScreenScene.js
  28. 183 0
      src/stage/index/scene/IndexScene.js
  29. 495 359
      src/stage/index/scene/LessonScene.js
  30. 73 75
      src/stage/index/scene/LoginScene.js
  31. 0 2
      src/stage/index/scene/RepeatLoginScene.js
  32. 21 2
      src/stage/index/scene/VideoWareFullScreenScene.js
  33. 65 0
      src/stage/index/style/AudioWareFullScreen.less
  34. 2 2
      src/stage/index/style/CLScene.less
  35. 10 1
      src/stage/index/style/CourseScene.less
  36. 198 0
      src/stage/index/style/DownloadScene.less
  37. 74 0
      src/stage/index/style/DownloadTipScene.less
  38. 187 0
      src/stage/index/style/IndexScene.less
  39. 47 0
      src/stage/index/style/LessonScene.less
  40. 1 8
      src/stage/index/style/LoginScene.less
  41. 5 3
      src/util/API/AJAXHelper.js
  42. 53 6
      src/util/API/APIClient.js
  43. 7 2
      src/util/Consts.js
  44. 0 7
      src/util/EfunVideoPlayer.js
  45. 69 0
      src/util/WinBoxAPI.js
  46. 10 61
      src/util/course.js

+ 2 - 2
config/gulpfile.js

@@ -19,8 +19,8 @@ var es2015 = require('babel-preset-es2015');
 var gulpif = require('gulp-if');
 
 var basePath = process.env.PJ_PATH;
-//var absPath = 'http://127.0.0.1:8080/efunbox-to-b/1.0.0';
-var absPath = 'http://lj-web.api.ai160.com/build';
+var absPath = 'http://127.0.0.1:8080/efunbox-to-b/1.0.0';
+//var absPath = 'http://lj-web.api.ai160.com/build';
 
 //var absPath = 'http://2blj.api.ai160.com/build';
 //var absPath = 'http://114.215.119.26:80/efunbox-to-b/1.0.0';

+ 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 - 1
src/res/tpl/CourseScene.tpl

@@ -5,7 +5,7 @@
 	<div class="header">
 		<div class="course-name" id="course-name"></div>
 		<div class="nav" fe-role="Switch" id="course-nav">
-			<div fe-role="Widget" id="course-tab-list" class="nav-item list"></div>
+			<div fe-role="Widget" id="course-tab-list" class="nav-item list selected"></div>
 			<div fe-role="Widget" id="course-tab-detail" class="nav-item detail"></div>
 			<div fe-role="Widget" id="course-tab-periphery" class="nav-item periphery"></div>
 			<div fe-role="Widget" id="course-tab-collect" class="nav-item collect"></div>

+ 109 - 0
src/res/tpl/DownloadScene.tpl

@@ -0,0 +1,109 @@
+<div id="DownloadManagerScene" fe-role="Switch">
+
+  	<div class="local-download-icon">
+    	<img src="assets/img/DownloadScene/download.png" alt="" />
+    	<div>本地下载列表</div>
+  	</div>
+
+  	<div class="background-wrapper">
+		<div class="background-header">
+    		<div class="header">
+				<div class="row row-header">
+					<div class="one right-border">下载日期</div>
+					<div class="two right-border">课程名称</div>
+					<div class="three right-border">课名称</div>
+					<div class="four right-border">下载状态</div>
+					<div class="five">操作</div>
+	    		</div>
+			</div>
+
+			<div class="horizon-line first-line"></div>
+			<div class="horizon-line"></div>
+			<div class="horizon-line"></div>
+			<div class="horizon-line"></div>
+			<div class="horizon-line"></div>
+			<div class="horizon-line"></div>
+			<div class="horizon-line"></div>
+			<div class="horizon-line"></div>
+			<div class="horizon-line"></div>
+    	</div>
+
+
+		<div class="back-row">
+			<div class="one"></div>
+			<div class="two"></div>
+			<div class="three"></div>
+			<div class="four"></div>
+			<div class="five"></div>
+    	</div>
+
+		<div class="back-row">
+			<div class="one"></div>
+			<div class="two"></div>
+			<div class="three"></div>
+			<div class="four"></div>
+			<div class="five"></div>
+	    </div>
+
+		<div class="back-row">
+			<div class="one"></div>
+			<div class="two"></div>
+			<div class="three"></div>
+			<div class="four"></div>
+			<div class="five"></div>
+	    </div>
+
+		<div class="back-row">
+			<div class="one"></div>
+			<div class="two"></div>
+			<div class="three"></div>
+			<div class="four"></div>
+			<div class="five"></div>
+		</div>
+
+		<div class="back-row">
+			<div class="one"></div>
+			<div class="two"></div>
+			<div class="three"></div>
+			<div class="four"></div>
+			<div class="five"></div>
+	  	</div>
+
+		<div class="back-row">
+			<div class="one"></div>
+			<div class="two"></div>
+			<div class="three"></div>
+			<div class="four"></div>
+			<div class="five"></div>
+    	</div>
+		<div class="back-row">
+			<div class="one"></div>
+			<div class="two"></div>
+			<div class="three"></div>
+			<div class="four"></div>
+			<div class="five"></div>
+    	</div>
+		<div class="back-row">
+			<div class="one"></div>
+			<div class="two"></div>
+			<div class="three"></div>
+			<div class="four"></div>
+			<div class="five"></div>
+	  	</div>
+		<div class="back-row">
+			<div class="one"></div>
+			<div class="two"></div>
+			<div class="three"></div>
+			<div class="four"></div>
+			<div class="five"></div>
+    	</div>
+
+    	<div fe-role="Scroll" fe-cfg="scroll_dir:v,scroll_center:con,scroll_duration:0.2,scroll_easing:linear" class="content-wrapper" >
+			<div class="scroll-list scroll-lines-wrapper clearfix" id="download-status-table-wrapper"></div>
+		</div>
+	</div>
+
+	<div class="goback" fe-role="Widget">
+		<img src="assets/img/goback.png" />
+	</div>
+</div>

+ 8 - 0
src/res/tpl/DownloadTipScene.tpl

@@ -0,0 +1,8 @@
+<div id="DownloadTipScene" class="course-download-wrapper" fe-role="Switch">
+    <div class="toast">
+        <img src="./../../stage/index/assets/img/CourseScene/download_btn_list_undownload.png" alt="">
+        <p>已下载<span id="downloadProcess"></span>个文件</p>
+        <p>请等待下载结束</p>
+        <div class="ok-btn" fe-role="Widget" id="ok-btn">确认</div>
+    </div>
+</div>

+ 2 - 2
src/res/tpl/LoginScene.tpl

@@ -5,7 +5,7 @@
 
 		<div class="form-sid">
 			<div class="form-sid-label">
-				学&nbsp;&nbsp;号
+				学&nbsp;&nbsp;号:
 			</div>
 			<div class="form-sid-input">
 				<input id="sid-input" class="form-item" name="sid" type="text" readonly fe-role="Widget"/>
@@ -14,7 +14,7 @@
 
 		<div class="form-password">
 			<div class="form-password-label">
-				密&nbsp;&nbsp;码
+				密&nbsp;&nbsp;码:
 			</div>
 			<div class="form-password-input">
 				<input id="password-input" class="form-item" name="password" type="text" readonly fe-role="Widget"/>

+ 6 - 2
src/res/values/api.json

@@ -1,4 +1,8 @@
 {
-    "api_url": "https://web-winapp.lingjiao.cn",
-    "api_url_": "http://tt-web.api.ai160.com"
+    "api_url__": "https://web-winapp.lingjiao.cn",
+    "api_url_kid": "http://kid-app.lingjiao.cn",
+    "api_url_": "https://21st-winapp.lingjiao.cn",
+    "api_url": "http://tt-web.api.ai160.com",
+    "api_url_test": "https://efunimgs.ai160.com/"
+
 }

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


BIN
src/stage/index/assets/img/CourseScene/download_btn_list_failed.png


BIN
src/stage/index/assets/img/DownloadScene/download_del_disable_btn.png


BIN
src/stage/index/assets/img/IndexScene/background.png


BIN
src/stage/index/assets/img/IndexScene/index_bg.png


BIN
src/stage/index/assets/img/IndexScene/logo.png


+ 2 - 1
src/stage/index/index.html

@@ -5,7 +5,7 @@
 	<meta charset="UTF-8">
 	<meta name="viewport" content="width=1920,user-scalable=0">
 	<title>双师教学标准平台</title>
-	<link rel="stylesheet" href="../../lib/css/base.css" />
+	<link  type="text/css" rel="stylesheet" href="../../lib/css/base.css" />
 </head>
 
 <body>
@@ -63,6 +63,7 @@
 
 		var appCss = document.createElement('link');
 		appCss.rel = 'stylesheet';
+		appCss.type = 'text/css';
 		appCss.href = './index.css?t=' + ts;
 		document.head.appendChild(appCss);
 

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

@@ -19,6 +19,7 @@ body {
 @import './style/WaterfallIndexScene.less';
 @import './style/TerminalScene.less';
 @import './style/DownloadCollection.less';
+@import './style/DownloadTipScene.less';
 @import './style/RepeatLoginScene.less';
 @import './style/RelatedPKGScene.less';
 @import './style/RenewAlertScene.less';
@@ -34,3 +35,4 @@ body {
 @import './style/GlobalGoodDetail.less';
 @import './style/ImageWareFullScreen.less';
 @import './style/VideoWareFullScreen.less';
+@import './style/AudioWareFullScreen.less';

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

@@ -0,0 +1,296 @@
+import Consts from '../../../util/Consts';
+
+function getLocalResourceUrl(absoluteUrl) {
+  if (!absoluteUrl) return;
+  const segments = absoluteUrl.split('/') || [];
+  return `${Consts.NODE_SERVER}/lesson/readFile?n=${segments.slice(3).join('*')}`;
+}
+
+class AudioWareFullScreenScene extends scene {
+	constructor(scope) {
+		super(scope);
+		this.isDownload = false;
+		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('audio-next');
+            } else {
+                this.keyRightHandler();
+            }
+            break;
+        case 'audio-last':
+            if (this.curAudioIndex > 0) {
+                this.curAudioIndex -= 1;
+                this.renderAudioView('audio-last');
+            } else {
+                this.keyLeftHandler();
+            }
+            break;
+        default:
+            break;
+      }
+  }
+
+  /**
+   * 音频渲染
+   */
+	renderAudioView(focusTarget) {
+    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 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) {
+      if (this.isDownload) {
+        audioUrl = getLocalResourceUrl(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('autoplay', 'autoplay');
+      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();
+      }
+    }
+	}
+
+	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) {
+			return;
+			// const nextWareIndex = this.curWareIndex + 1;
+			// this.dynamicChangeWare(nextWareIndex, 'NEXT')
+		//当前图片是该图片课件最后一张图片,且后边没有课件,给出提示
+		} else if (this.curAudioIndex === this.curAudioList.length - 1 && !hasNextWare) {
+			return;
+			// TVUtil.Toast.show('已经是最后一个课件了', 2000);
+		//当前图片不是该图片课件的最后一张图片
+    } else {
+			this.curAudioIndex += 1;
+			this.renderAudioView();
+    }
+	}
+
+	keyLeftHandler() {
+		const hasPreviousWare = this.curWareIndex === 0 ? false : true;
+		//当前图片是该图片课件的第一张图片,且前边还有课件
+	  if (this.curAudioIndex == 0 && hasPreviousWare) {
+			return;
+			// const previousWareIndex = this.curWareIndex - 1;
+			// this.dynamicChangeWare(previousWareIndex, 'BACK');
+		//当前图片是该图片课件的第一张图片,且前边没有课件,则给出提示
+		} else if (this.curAudioIndex === 0 && !hasPreviousWare) {
+			return;
+			// TVUtil.Toast.show('已经是第一个课件了', 2000);
+		//当前图片不是该图片课件的第一张图片
+		} else {
+			this.curAudioIndex -= 1;
+			this.renderAudioView();
+		}
+	}
+
+	onCreate(data) {
+	    this.wareList = data.wareList;
+	    this.curWareIndex = data.curWareIndex;
+			this.isDownload = data.isDownload;
+	    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 || !curFocusedLeaf.id.startsWith('audio')) {
+          this.keyLeftHandler();
+        }
+				break;
+			//右键
+			case 39:
+        if (!curFocusedLeaf || !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;

+ 0 - 0
src/stage/index/scene/CourseList.js


+ 48 - 66
src/stage/index/scene/CourseScene.js

@@ -5,6 +5,7 @@ import efMarquee from '../../../component/EFMarquee';
 import ShopCartState from '../../../util/ShopCartState';
 import NotificationCenter from '../../../util/NotificationCenter';
 import {CommandBus, CMD_TYPE} from '../../../util/CommandBus';
+import WinBoxAPI from '../../../util/WinBoxAPI';
 import Consts from '../../../util/Consts';
 
 class CourseScene extends scene {
@@ -263,31 +264,25 @@ class CourseScene extends scene {
 	/**
 	 * 添加课程下载任务
 	 */
-	addLessonDownloadTask({resData, courseID, courseName, lessonID, lessonName}){
-		let { images, videos } = this.getDownloadTargetFromLessonData(resData);
-		let lessonDownloadData = {
-			courseID,
-			courseName,
-			lessonID,
-			lessonName,
-			images,
-			videos,
-		}
-		console.log('下载数据...', lessonDownloadData);
-	    //send to download
-	    let {status} = CommandBus.execute({type:CMD_TYPE.DOWNLOAD_LESSON_POST, payload:lessonDownloadData});
-	    //统计下载行为
-	    CommandBus.execute({type:CMD_TYPE.APP_BHV_POST, payload:{
-			eventName: "downloadLesson",
-			eventPage: "courseScene",
-			eventAttr: {
-				courseId:courseID,
-				courseName:courseName,
-				lessonId:lessonID,
-				lessonName:lessonName
+	addLessonDownloadTask({lessonID, courseID, event}){
+		WinBoxAPI.postDownloadRequest(lessonID, courseID, (isTrue, res) => {
+			if (!isTrue) {
+				TVUtil.Toast.show('本地服务请求失败...', 3000);
+				return;
 			}
-		}});
-		return true;
+			if (event.target.con.classList.contains('download-btn-lesson-list-failed')) {
+				event.target.con.classList.add('download-btn-lesson-list-ongoing');
+				event.target.con.classList.remove('download-btn-lesson-list-failed');
+				return;
+			}
+			if (event.target.con.classList.contains('download-btn-lesson-list-ready')) {
+  			event.target.con.classList.add('download-btn-lesson-list-ongoing');
+  			event.target.con.classList.remove('download-btn-lesson-list-ready');
+			} else {
+  			event.target.con.classList.add('download-btn-lesson-icon-ongoing');
+  			event.target.con.classList.remove('download-btn-lesson-icon-ready');
+			}
+		});
 	}
 
 	onCreate(data) {
@@ -299,22 +294,21 @@ class CourseScene extends scene {
 			// check course is blank
 			this.renderCourse(this.id);
 		});
-	    CommandBus.execute({type:CMD_TYPE.APP_BHV_POST, payload:{
-			eventName: "enter_courseScene",
-			eventPage: "courseScene",
-			eventAttr: { courseID: data.id },
-	    }});
 	}
 
 	onResume(data) {
 		if (!data) { return }
 		if ('BuyConfirmScene' === data.backScene) {
+
 			if ('goBuy' === data.mode) {
 				this.loadRelatedPackage(this.id, this.title);
 				return;
 			} else {
 				return;
 			}
+
+		} else if ('DownloadTipScene' === data.backScene) {
+				return;
 		} else {
 			this.renderCourse(this.id);
 		}
@@ -369,25 +363,36 @@ class CourseScene extends scene {
             this.hideScene({});
             return;
         }
-		
-		// 点击某一课
+
+		// 点击正在下载的某一课
+		if (e.target.con.classList.contains('download-btn-lesson-list-ongoing') || e.target.con.classList.contains('download-btn-lesson-icon-ready')) {
+      	let id = (e.target.id).split("download-btn-")[1];
+      	APIClient.getDownloadProcess( id, ( isTrue, res)=> {
+        	let storageUsageStr = res.data.resSize + '/' + res.data.resTotal;
+        	let downloadProcess = document.getElementById('downloadProcess');
+        	downloadProcess.innerText = storageUsageStr;
+      	})
+      	this.showScene(require('./DownloadTipScene.js'), {});
+      	return;
+		}
+
 		if (e.target.con.classList.contains('img-wrapper') || e.target.con.classList.contains('text-wrapper')) {
 			// 课件模版 COURSE_WARE_VIDEO(课视频模版)  COURSE_WARE_LIST(课列表)
-			let id = e.target.con.dataset.id;
-
-			//检查课的权限
+      		let id = e.target.con.dataset.id;
+      //检查课的权限
 			//首先获取课的序号
 			let lessonSeq = parseInt(e.target.con.dataset.seq);
 			if (!this.isAuthorized(lessonSeq)) {
-				//新添需求,如果该课程未购买,出现确认购买弹框
 				this.showScene(require('./BuyConfirmScene.js'), {});
 				return;
 			}
 			let title = e.target.con.dataset.name;
-			this.showScene(require('./LessonScene.js'), { id, title, courseId: this.id });
+			let downloadStatus = parseInt(e.target.con.dataset.dload);
+			this.showScene(require('./LessonScene.js'), { id, title, downloadStatus, courseId: this.id });
 			return;
 		}
 
+
     	//点击课程配套列表中的某个配套
 		if (e.target.con.classList.contains('periphery-wrapper')) {
 			document.querySelector('.periphery-container').style.opacity = '0';
@@ -401,13 +406,13 @@ class CourseScene extends scene {
 			this.navSwitch(e);
 			return;
 		}
-
 		//点击课的下载按钮
 		if (e.target.con.classList.contains('download-btn-lesson-list-ready')
-			|| e.target.con.classList.contains('download-btn-lesson-icon-ready')) {
+			|| e.target.con.classList.contains('download-btn-lesson-icon-ready') 
+			|| e.target.con.classList.contains('download-btn-lesson-icon-failed')
+			|| e.target.con.classList.contains('download-btn-lesson-list-failed')) {
 				let courseID = this.id;
 				let courseName = this.title;
-
 				let lessonID = e.target.con.dataset.id;
 				let lessonName = e.target.con.dataset.name;
 
@@ -417,39 +422,16 @@ class CourseScene extends scene {
 					return;
 				}
 
+				/* windows不提供此方法
 				if (this.getAvailableBlocks() < 200*1024){
 					//剩余空间小于200M
 					TVUtil.Toast.show('存储空间不足! 请到下载管理界面删除不需要的课以释放存储空间!', 3000);
 					return;
 				}
-
-				//get courseware via Lesson
-				console.error('DEBUG, download cmd begin');
-				APIClient.getWareList(lessonID, courseID, (isTrue, res) => {
-				if (!isTrue) { return; }
-				if (!res.success) {
-					TVUtil.Toast.show('获取课件列表失败!', 1500);
-					return;
-				}
-				let resData = res.data.list;
-				if (!resData){
-					console.log('Cannot Get coursewares, lessonID=%s', lessonID);
-					return;
-				}
-
-				if (this.addLessonDownloadTask({resData, courseID, courseName, lessonID, lessonName})){
-					//set download-btn to ongoing
-					if (e.target.con.classList.contains('download-btn-lesson-list-ready')) {
-						e.target.con.classList.add('download-btn-lesson-list-ongoing')
-						e.target.con.classList.remove('download-btn-lesson-list-ready')
-					} else {
-						e.target.con.classList.add('download-btn-lesson-icon-ongoing')
-						e.target.con.classList.remove('download-btn-lesson-icon-ready')
-					}
-				}
-			});//APIClient Over
+				*/
+				this.addLessonDownloadTask({ lessonID, courseID, event: e });
+			}
 		}
-	}
 
 	onBack() {
 		let peripheryDetail = document.querySelector('#periphery-detail-content');

+ 15 - 10
src/stage/index/scene/DelConfirmScene.js

@@ -9,6 +9,7 @@ class DelConfirmScene extends scene {
 			'isParentShow': true
 		}, () => {
 			let delName = document.querySelector('#del-name');
+
 			if ('ShopCartScene' == data.parentScene) {
 				delName.innerHTML = `确认删除“${data.title}”吗?`;
 				this.moye.root.reRender();
@@ -21,15 +22,19 @@ class DelConfirmScene extends scene {
 				};
 				return;
 			}
-			delName.innerHTML = `确认删除“${data.title}”吗?`;
-			this.moye.root.reRender();
-			// 默认光标指向取消按钮
-			this.moye.root.getWidgetById('cancle-btn').focus();
-			// 记录下课id
-			this.store = {
-				lessonID: data.lessonID,
-				parentScene: data.parentScene,
-			};
+			if ('DownloadManagerScene' == data.parentScene) {
+        delName.innerHTML = `确认删除“${data.title}”吗?`;
+        this.moye.root.reRender();
+        // 默认光标指向取消按钮
+        this.moye.root.getWidgetById('cancle-btn').focus();
+        // 记录下课id
+        this.store = {
+          lessonId: data.lessonId,
+          parentScene: data.parentScene,
+        };
+        return;
+			}
+
 		});
 	}
 
@@ -56,7 +61,7 @@ class DelConfirmScene extends scene {
 	// 在使用Atv时Id对应:e.target.id
 	// 非使用Atv是Id对应:e.target.id
 	onOK(e) {
-		let parentScene = this.store['parentScene'];
+    let parentScene = this.store['parentScene'];
 		delete this.store.parentScene;
 		if (e.target.con.id == 'del-btn') {
 			this.store.isDelete = true;

+ 229 - 0
src/stage/index/scene/DownloadManagerScene.js

@@ -0,0 +1,229 @@
+import Consts from '../../../util/Consts';
+import APIClient from '../../../util/API/APIClient';
+import WinBoxAPI from '../../../util/WinBoxAPI';
+import Utils from '../../../util/Utils';
+
+class DownloadManagerScene extends scene {
+    constructor(scope) {
+        super(scope);
+        this.lessonIds = [];
+        this.lessonItems = {};
+    }
+
+    fetchDownloadList() {
+      APIClient.getUserDownloadList((isTrue, res) => {
+        // 判断响应内容
+        if (!isTrue || !res || !res.success) {
+          TVUtil.Toast.show('获取下载内容失败', 2000);
+          return;
+        };
+        // 遍历下载列表数据
+        const downloadedList = res.data || [];
+        let recs = [];
+        for (let i in downloadedList) {
+          recs.push(downloadedList[i]);
+          let item = downloadedList[i];
+          // 记录lessonId
+          this.lessonIds = [];
+          this.lessonIds.push(item['lessonId']);
+          // make a map of lessonId to courseId
+          this.lessonItems[item['lessonId']] = {
+              'lessonName':item['lessonName'],
+              'courseId':item['courseId'],
+              'downloadStatus':item['downloadStatus'],
+          }
+        }
+        let downloadStatusTableHtml = this.generateDownloadStatusTable({recs});
+        let downloadStatusTableWrapper = document.getElementById('download-status-table-wrapper');
+        downloadStatusTableWrapper.innerHTML = downloadStatusTableHtml;
+        this.moye.root.reRender();
+      })
+    }
+
+    deleteDownloadFile(lessonId, courseId) {
+      WinBoxAPI.deleteDownloadFile(lessonId, courseId, (isTrue, res) => {
+        if (!isTrue || !res || !res.success) {
+          TVUtil.Toast.show('本地文件删除失败', 2000);
+          return;
+        }
+        //删除dom节点
+        let curNode = document.getElementById('lesson-download-record-'+lessonId);
+        curNode.parentNode.removeChild(curNode);
+        this.moye.root.reRender();
+        //找兄弟结点
+        let findIdx = this.lessonIds.indexOf(lessonId);
+        if(-1 == findIdx){
+            return;
+        }
+        this.lessonIds.splice(findIdx, 1);
+        if(findIdx >= this.lessonIds.length){
+            findIdx = this.lessonIds.length - 1;
+        }
+        let nextFocusLessonId = null;
+        if(findIdx >= 0){
+            nextFocusLessonId = this.lessonIds[findIdx];
+        }
+        if(nextFocusLessonId){
+          this.moye.root.getWidgetById('del-btn-lesson-'+nextFocusLessonId).focus();
+        }
+      });
+    }
+
+    generateDownloadStatusTable({recs}) {
+        let trAcc = '';
+        let count = 0;
+        for (let idx in recs) {
+            let rec = recs[idx];
+            let feCfg = "";
+            if (0 == count){
+                feCfg = "default_focus:yes";
+            }
+            count += 1;
+
+            //downloadDate
+            let downloadDateStr = '2017-09-10';
+             if (rec.gmtModified) {
+                let createDate = new Date();
+                createDate.setTime(rec.gmtModified);
+                downloadDateStr = Utils.dateFormat(createDate, 'yyyy-MM-dd');
+            }
+            let downloadStatus = rec['downloadStatus'];
+            let downloadDesc = '';
+
+            //storageUsage
+            let storageUsageStr =  rec['resSize'] + '/' + rec['resTotal'];
+            // if (rec.storageUsage || 0){
+            //     storageUsageStr = '' + parseInt((rec.storageUsage || 0)/1000) + 'M';
+            // }
+
+            //downloadStatus
+            switch (downloadStatus) {
+            case Consts.DOWNLOAD_STATUS_UNDOWNLOAD:
+                downloadDesc = '未下载';
+                break;
+            case Consts.DOWNLOAD_STATUS_ONGOING:
+                downloadDesc = '正在下载';
+                break;
+            case Consts.DOWNLOAD_STATUS_SUCCESS:
+                downloadDesc = '下载完成';
+                break;
+            case Consts.DOWNLOAD_STATUS_FAILED:
+                downloadDesc = '下载失败';
+                break;
+            default:
+                downloadDesc = '未下载';
+            }
+            // 删除按钮是否可点击
+            let delDisable = downloadStatus === Consts.DOWNLOAD_STATUS_ONGOING ? true : false;
+            let feRole = delDisable ? '' : 'fe-role="Widget"';
+            let delImg = delDisable ? '<img src="./assets/img/DownloadScene/download_del_disable_btn.png" class="img-btn"/> '
+                          : '<img src="./assets/img/DownloadScene/download_del_btn.png" class="img-btn"/>'
+
+            if (!rec['lessonName']) {
+                rec['lessonName'] = rec['courseName'];
+            }
+
+            trAcc += `<div id='lesson-download-record-${rec['lessonId']}' class="row" lesson_id="${rec['lessonId']}">
+            <div class="one">${downloadDateStr}</div>
+            <div class="two">${rec['courseName']}</div>
+            <div class="three">${rec['lessonName']}</div>
+            <div class="four">${downloadDesc}(${storageUsageStr})</div>
+            <div class="five" >
+              <div id="download-btn-wrapper" fe-fole="Switch">
+                <div id="enter-btn-lesson-${rec['lessonId']}" class="download-enter-btn" fe-role="Widget" data-id="${rec['lessonId']}">
+                  <img src="./assets/img/DownloadScene/download_enter_btn.png" class="img-btn"/>
+                </div>
+                <div id="del-btn-lesson-${rec['lessonId']}" class="download-del-btn" ${feRole} data-id="${rec['lessonId']}" >${delImg}</div>
+              </div>
+            </div>
+            </div>`
+        }
+        let header = `<div class="row header">
+          <div class="one">下载日期</div>
+          <div class="two">课程名称</div>
+          <div class="three">课名称</div>
+          <div class="four">下载状态</div>
+          <div class="five">操作</div>
+          </div>`
+        return `${trAcc}`;
+    }
+
+    onCreate() {
+        /*
+          let recs = []
+          for(let i=1; i < 15; i++){
+            recs.push({
+              'date':'2017-09-01',
+              'courseName':'同步辅导语文一年级上'+i,
+              'courseId':'course-'+i,
+              'lessonName':'悯农',
+              'lessonId':'lesson-'+i,
+              'downloadStatus':'下载完成',
+              'createTime':1505187194,
+              'storageUsage':150211,
+            });
+          }
+          */
+        this.setContentView(require('../../../res/tpl/DownloadScene.tpl'), {}, 'DownloadManagerScene', {}, () => {
+          this.fetchDownloadList();
+        });
+    }
+
+    onResume(retData) {
+      if (!retData || !retData.isDelete) return;
+      //send delete cmd
+      let lessonId = retData.lessonId;
+      let courseId = this.lessonItems[lessonId]['courseId']
+      this.deleteDownloadFile(lessonId, courseId)
+    }
+
+    onPause() {
+
+    }
+
+    onDestroy() {
+
+    }
+
+    onActive() {
+
+    }
+
+    onInactive() {
+
+    }
+
+    onOK(e) {
+        // 后退
+        if (e.target.con.classList.contains('goback')) {
+            this.hideScene({});
+            return;
+        }
+        if(e.target.con.classList.contains('download-del-btn')){
+            let lessonId = e.target.con.dataset.id;
+            let title = this.lessonItems[lessonId].lessonName;
+            let parentScene = 'DownloadManagerScene';
+            this.showScene(require('./DelConfirmScene.js'), { parentScene, lessonId, title });
+        } else if (e.target.con.classList.contains('download-enter-btn')) {
+            let lessonId = e.target.con.dataset.id;
+            let courseId = this.lessonItems[lessonId].courseId;
+            let lessonName = this.lessonItems[lessonId].lessonName;
+            let downloadStatus = this.lessonItems[lessonId].downloadStatus;
+            this.showScene(require('./LessonScene.js'), {courseId, downloadStatus, id:lessonId, title:lessonName});
+        }
+    }
+
+    onBack() {
+
+    }
+
+    onKeydown() {
+
+    }
+
+    onKeyup() {
+
+    }
+}
+
+module.exports = DownloadManagerScene;

+ 59 - 0
src/stage/index/scene/DownloadTipScene.js

@@ -0,0 +1,59 @@
+class DownloadTipScene extends scene {
+  constructor(scope) {
+    super(scope);
+  }
+
+  onCreate() {
+    this.setContentView(require('../../../res/tpl/DownloadTipScene.tpl'), {}, 'DownloadTipScene', {
+      'isParentShow': true
+    }, () => {
+      this.moye.root.getWidgetById('ok-btn').focus();
+    });
+  }
+
+  onResume() {
+
+  }
+
+  onPause() {
+
+  }
+
+  onDestroy() {
+
+  }
+
+  onActive() {
+
+  }
+
+  onInactive() {
+
+  }
+
+  // 所有事件类函数默认触发时会传递过来一个Event,其中包含着事件响应节点以及其他相关信息
+  // 查看信息:console.log(e)
+  // 获取Event节点Id的方法(前提是触发事件的节点存在Id)
+  // 在使用Atv时Id对应:e.target.id
+  // 非使用Atv是Id对应:e.target.id
+  onOK(e) {
+    let backScene = 'DownloadTipScene';
+    if (e.target.con.id == 'ok-btn') {
+      this.hideScene( { backScene } , 'CourseScene');
+    }
+  }
+
+  onBack() {
+
+  }
+
+  onKeydown() {
+
+  }
+
+  onKeyup() {
+
+  }
+}
+
+module.exports = DownloadTipScene;

+ 27 - 1
src/stage/index/scene/ImageWareFullScreenScene.js

@@ -1,8 +1,15 @@
 import Consts from '../../../util/Consts';
 
+function getLocalResourceUrl(absoluteUrl) {
+  if (!absoluteUrl) return;
+  const segments = absoluteUrl.split('/') || [];
+  return `${Consts.NODE_SERVER}/lesson/readFile?n=${segments.slice(3).join('*')}`;
+}
+
 class ImageWareFullScreenScene extends scene {
 	constructor(scope) {
 		super(scope);
+		this.isDownload = false;
 		this.wareList = [];
 		this.curWareIndex = 0;
 		this.curWareType = null;
@@ -12,7 +19,11 @@ class ImageWareFullScreenScene extends scene {
 
 	renderImageView() {
 		const curImage = this.curImageList[this.curImageIndex];
-		document.getElementById('wareImg').setAttribute('src', curImage.url);
+		if (this.isDownload) {
+			document.getElementById('wareImg').setAttribute('src', getLocalResourceUrl(curImage.url));
+		} else {
+			document.getElementById('wareImg').setAttribute('src', curImage.url);
+		}
 	}
 
 	dynamicChangeWare(wareIndex, type) {
@@ -31,6 +42,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;
@@ -94,6 +119,7 @@ class ImageWareFullScreenScene extends scene {
 	}
 
 	onCreate(data) {
+		this.isDownload = data.isDownload;
     this.wareList = data.wareList;
     this.curWareIndex = data.curWareIndex;
     if (data.curImageList) {

+ 183 - 0
src/stage/index/scene/IndexScene.js

@@ -0,0 +1,183 @@
+import CourseItem from '../../../component/CourseItem';
+import APIClient from '../../../util/API/APIClient';
+import ShopCartState from '../../../util/ShopCartState';
+import userDataStorage from '../../../util/userDataStorage';
+import Consts from '../../../util/Consts';
+import Utils from '../../../util/Utils';
+import { CommandBus, CMD_TYPE } from '../../../util/CommandBus';
+
+class IndexScene extends scene {
+	constructor(scope) {
+		super(scope);
+		this.subjectList = [];
+		this.scrollLock = true;
+	}
+
+	loadUserInfo() {
+		//判断deviceCode是否存在,不存在跳登录页面
+		if (!localStorage.getItem('deviceCode')) {
+			if ( -1 != this.moye.focusList.indexOf('LoginScene')) {
+				this.hideScene({}, 'LoginScene');
+			} else {
+				this.showScene(require('./LoginScene.js'), {});
+			}
+			return;
+		}
+		//deviceCode存在,刷新token
+		APIClient.refreshTokenByDeviceCode((isTrue, res) => {
+			if (!isTrue) { return; }
+			if (res.success) {
+				userDataStorage.setData(res.data);
+
+        //必须获取Token后才可以正常调用以下接口
+        this.loadHistoryList();
+        this.loadTerminal();
+        this.loadDownloadList();
+				ShopCartState.updateCount();
+				//记录用户登录行为
+				let {status, data} = CommandBus.execute({
+					type: CMD_TYPE.APP_BHV_USER_LOGIN,
+					payload: {
+						"eid": userDataStorage.getData().eid,
+						"uid": userDataStorage.getData().uid.toString(),
+					},
+				});
+			} else {
+				if ( -1 != this.moye.focusList.indexOf('LoginScene')) {
+					this.hideScene({}, 'LoginScene');
+				} else {
+					this.showScene(require('./LoginScene.js'), {});
+				}
+			}
+		});
+	}
+
+	renderHistoryList(dataset) {
+		let list = document.getElementById('history');
+		list.innerHTML = '';
+		let listHtml = '';
+
+		let firstCourseItemId = null;
+		for (let i in dataset) {
+			const { id, title, subTitle, coverUrl } = dataset[i];
+			let subject = title;
+			let subjectSub = subTitle;
+			let img = Consts.IMG_PATH + '/' + coverUrl;
+
+			let itemDataset = { img, subject, subjectSub, buyed: false };
+			if (0 == i) {
+				firstCourseItemId = `history-item-${id}`;
+			}
+			listHtml += `<div class="history-item" fe-role="Widget" id="history-item-${id}">${CourseItem.createHTMLString(itemDataset)}</div>`;
+		}
+		list.innerHTML = listHtml;
+		this.moye.root.reRender();
+
+		//默认焦点设置
+		if(firstCourseItemId){
+			this.moye.root.getWidgetById(firstCourseItemId).focus();
+		}
+	}
+
+	loadHistoryList() {
+		APIClient.getRecommendList((isTrue, res) => {
+			if (!isTrue) { return; }
+			if (!res.success) {
+				TVUtil.Toast.show('获取推荐列表失败!', 1500);
+			}
+			if (res.data) {
+				this.renderHistoryList(res.data);
+			} else {
+				this.renderHistoryList([]);
+			}
+		});
+	}
+
+	loadTerminal() {
+		let userData = userDataStorage.getData();
+		let terminal_name = document.querySelector('#terminal-name');
+		let terminal_id = document.querySelector('#terminal-id');
+		terminal_name.innerHTML = userData.name;
+		terminal_id.innerHTML = 'ID:' + userData.eid.replace(/(\d{4})/g, '$1 ');
+	}
+
+  loadDownloadList() {
+    APIClient.getDownloadList( ( isTrue,res) => {})
+	}
+
+	onCreate() {
+		this.setContentView(require('../../../res/tpl/IndexScene.tpl'), {
+			'title': '2B双师教学标准平台'
+		}, 'IndexScene', {}, () => {
+			setAndroidEvent('keydown', 40);
+			if (!localStorage.getItem('deviceCode')) {
+				localStorage.setItem('deviceCode', window.efunbox ? window.efunbox.getUuidForDevice() : Utils.getUuidForWeb());
+			}
+			this.loadUserInfo();
+		});
+	}
+
+	onResume(data) {
+		if (data && data.success) {
+			// 必须获取Token后才可以正常调用以下接口,应该加入判断是否从登录页面恢复的过滤
+			this.loadUserInfo();
+		}
+	}
+
+	onPause() {
+
+	}
+
+	onDestroy() {
+
+	}
+
+	onActive() {
+
+	}
+
+	onInactive() {
+
+	}
+
+	// 所有事件类函数默认触发时会传递过来一个Event,其中包含着事件响应节点以及其他相关信息
+	// 查看信息:console.log(e)
+	// 获取Event节点Id的方法(前提是触发事件的节点存在Id)
+	// 在使用Atv时Id对应:e.target.id
+	// 非使用Atv是Id对应:e.target.id
+	onOK(e) {
+		// 点击终端信息、推荐列表、底部五个入口的处理逻辑
+		if (e.target.con.classList.contains('fun-item')) {
+			let type = e.target.id.replace('fun-', '');
+			if (type == 'download') {
+				this.showScene(require('./DownloadManagerScene.js'), {});
+			} else {
+				//点击CLScene 是否为师训
+				this.showScene(require('./CLScene.js'), { type });
+			}
+		} else if (e.target.con.classList.contains('user-info')) {
+			this.showScene(require('./TerminalScene.js'), {});
+		} else if (e.target.con.classList.contains('history-item')) {
+			let id = e.target.id.split('-')[2];
+			this.showScene(require('./CourseScene.js'), { id });
+		}
+	}
+
+	onBack() {
+		return true;
+	}
+
+	onKeydown(e) {
+		if(Consts.KEYCODE_UP == e.keyCode){
+			if(e.target.con.classList.contains('history-item')){
+				this.moye.root.getWidgetById('user-info').focus();
+			}
+		}
+	}
+
+	onKeyup() {
+
+	}
+}
+
+module.exports = IndexScene;

+ 495 - 359
src/stage/index/scene/LessonScene.js

@@ -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 EfunVideoPlayer from '../../../util/EfunVideoPlayer';
-import {CommandBus, CMD_TYPE} from '../../../util/CommandBus';
 
 function matchWare(wareList, wareId) {
     const matchedWareList = wareList.filter((ware) => {
@@ -16,12 +16,28 @@ function matchWare(wareList, wareId) {
     return false;
 }
 
+function checkDownloadStatus(status) {
+  if (status === Consts.DOWNLOAD_STATUS_SUCCESS) {
+    return true;
+  } else {
+    return false;
+  }
+}
+
+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 {
-    constructor(scope) {
+  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;     //记录课件列表
@@ -30,137 +46,148 @@ class LessonScene extends scene {
     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,
     };
-    }
-
-    /**
-    * 根据课程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;
+  /**
+  * 根据课程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'), {});
+    	}
+    });
+  }
 
-    		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));
+  /**
+  * 把课件列表进行渲染
+  */
+  renderWareList(dataset) {
+  	let listDom = document.getElementById('list-content');
+  	dataset.forEach(function(item, index) {
+  		const { id, type } = item;
 
-    	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();
-    }
+  		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));
 
-    /**
-    * 创建左侧列表项内容
-    */
-    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>
-          `;
-    }
+  	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();
+  }
 
-    /**
-    * 创建右侧视窗
-    */
-    createRightView(item) {
-      // 清一下定时器
-      window.clearInterval(this.timer);
-      this.timer = null;
+  /**
+  * 创建左侧列表项内容
+  */
+  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';
+        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>
-                  </div>
-                `;
-    			document.getElementById('view-bottom').innerHTML = videoViewDom;
-          */
-    			document.getElementById('view-bottom').innerHTML = '';
-    			this.moye.root.reRender();
-    			this.renderVideoView(title, playUrl, type);
-    			break;
-    		case Consts.TYPE_IMAGE:
-    			let imageViewDom =
+    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 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;
+      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">
@@ -171,269 +198,378 @@ class LessonScene extends scene {
               <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;
-    	}
+  			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() {
+  	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)}" />`
     }
+  	document.getElementById('view-content').innerHTML = imageDom;
+  }
 
-    /**
-    * 渲染图片视图
-    */
-    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) {
+    // 处理视频链接,是读本地还是读线上
+    let localUrl = url;
+    if (this.isDownload) {
+      localUrl = getLocalResourceUrl(url)
     }
+    // 初始化视频播放器
+    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(() => {
+  		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);
+  }
 
-    /**
-    * 渲染视频视图
-    */
-    renderVideoView(name, url, type) {
-      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;
-      } else {
+  /**
+   * 渲染音频视图
+   */
+  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;
+      }
+  }
+
+  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);
+  			}
+  			document.getElementById('view-bottom').innerHTML = '';
+  			this.moye.root.reRender();
+        //如果是H5播放器,则重新创建video标签
+        if (window.efunbox) {
+            window.efunbox.customScreen(270, 790, 1072, 603);
+        } else {
           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(() => {
-    		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);
-    }
+          this.videoPlayer.initPlayer(playUrl, 'hls-video', url);
+        }
+  			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;
+      default:
+        break;
+  	}
+  }
 
-    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标签
-          if (window.efunbox) {
-              window.efunbox.customScreen(270, 790, 1072, 603);
-          } else {
-            const videoDom = `<div id="hls-video"></div>`;
-            document.getElementById('view-content').innerHTML = videoDom;
-            this.videoPlayer = new EfunVideoPlayer();
-            this.videoPlayer.initPlayer(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;
-        default:
-          break;
-    	}
-    }
+  /**
+  * 记录播放行为事件
+  */
+  postPlayRecord(lessonId, courseId, playStopTime=1){
+  	APIClient.putUserAction(
+  		Consts.USER_ACTION_WATCH,
+  		Consts.USER_ACTION_WATCH_NAME,
+  		`${courseId}_${lessonId}`,
+  		playStopTime,
+  		(isTrue, res) => {},
+  	);
+  }
 
-    /**
-    * 记录播放行为事件
-    */
-    postPlayRecord(lessonId, courseId, playStopTime=1){
-    	APIClient.putUserAction(
-    		Consts.USER_ACTION_WATCH,
-    		Consts.USER_ACTION_WATCH_NAME,
-    		`${courseId}_${lessonId}`,
-    		playStopTime,
-    		(isTrue, res) => {},
-    	);
-    }
+  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();
+    });
+  }
 
-    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,
-    				}
-                },
-    		});
-          }
-        );
+  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) {
-        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;
+  onOK(e) {
+    // 点击后退按钮
+    if (e.target.con.classList.contains('goback')) {
+			if ( -1 != this.moye.focusList.indexOf('CourseScene')) {
+        this.hideScene({id: this.courseId}, 'CourseScene');
+        return;
+      } else {
+        this.hideScene();
+      }
+    }
+    // 拦截音频控制相关事件单独处理
+  	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 = '暂停';
+          }
         }
-        if (curImageIndex) {
-            this.curImageIndex = curImageIndex;
+        //添加播放记录
+        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,
+            isDownload: this.isDownload,
+          });
         }
-        //更新左侧焦点位置
-        this.moye.root.getWidgetById(`item-${this.curWareType}-${this.curWareId}-${this.curWareIndex}`).focus();
-        //更新右侧视图
-        this.updateRightView(this.wareList[curWareIndex]);
-        this.isBack = true;
-    }
-
-    onOK(e) {
-        // 后退
-        if (e.target.con.classList.contains('goback')) {
-            this.hideScene({id: this.courseId}, 'CourseScene');
-            return;
+        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();
         }
-    	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,
-            		});
-                } else if (this.curWareType === Consts.TYPE_VIDEO) {
-                    let video = document.getElementById('hls-video');
-                    if (video) {
-                        video.webkitEnterFullScreen();
-                        // document.getElementById('view-content').removeChild(video);
-                    }
-                    // this.showScene(require('./VideoWareFullScreenScene.js'), {
-                    //     isFull: true,
-                    //     wareList: this.wareList,
-                    //     curWareIndex: this.curWareIndex,
-                    // });
-                }
-    			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;
-    	}
-    }
+        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;
+  	}
+  }
 
-    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;

+ 73 - 75
src/stage/index/scene/LoginScene.js

@@ -15,6 +15,9 @@ class LoginScene extends scene {
 	 * @desc 将登录逻辑抽象为此函数,方便多处调用
 	 */
 	loginLogic() {
+		//触发登录逻辑后输入框置灰
+		document.querySelector('.form-sid').style.borderColor = '#d3d3d3';
+		document.querySelector('.form-password').style.borderColor = '#d3d3d3';
 		let stu_no = this.sidInput.value.replace(/\s|\|/g, '');
 		let password = this.passwordInput.value.replace(/\s|\|/g, '');
 		APIClient.userLoginAndBindDevice({
@@ -33,13 +36,15 @@ class LoginScene extends scene {
       				this.showScene(require('./WaterfallIndexScene.js'), {});
 				}
 			} else if (Consts.API_CODE_ISBOUND == res.code) {
+				//账号被登陆
 				this.showScene(require('./RepeatLoginScene.js'), {});
+        this.sidInput.value = '|';
+        this.passwordInput.value = '';
+        this.moye.root.getWidgetById('sid-input').focus();
+        this.onKeydown();
+
 			} else {
 				TVUtil.Toast.show('帐号或密码错误!', 3000);
-				this.sidInput.value = '|';
-				this.passwordInput.value = '';
-				this.moye.root.getWidgetById('sid-input').focus();
-				this.onKeydown();
 			}
 		});
 	}
@@ -51,12 +56,11 @@ class LoginScene extends scene {
 			this.submitInput = document.getElementById('submit-input');
 			this.sidInput.value = '|';
 			this.passwordInput.value = '';
-			this.moye.root.getWidgetById('key-5').focus();
 		});
 		document.querySelector('.form-sid').style.borderColor = '#4682B4';
 	}
 
-	onResume(data) { }
+	onResume() { }
 
 	onPause() { }
 
@@ -70,7 +74,43 @@ class LoginScene extends scene {
 
 	onKeyup(e) { }
 
+	onKeydown(e) { }
+
 	onOK(e) {
+		if (e.target.id !== this.currFocus) {
+			if (this.currFocus === 'sid-input' || this.currFocus === 'password-input') {
+				const currInput = document.getElementById(this.currFocus);
+				currInput.value = currInput.value.replace(/\|/g, '');
+				if (e.target.id !== 'submit-input') {
+					const nextInput = document.getElementById(e.target.id);
+					nextInput.value = nextInput.value + '|';
+				}
+			}
+		}
+		//左侧input控件切换逻辑
+		switch(e.target.id) {
+			case 'sid-input':
+				document.querySelector('.form-sid').style.borderColor = '#4682B4';
+				document.querySelector('.form-password').style.borderColor = '#d3d3d3';
+				this.currFocus = e.target.id;
+				return;
+			case 'password-input':
+				document.querySelector('.form-password').style.borderColor = '#4682B4';
+				document.querySelector('.form-sid').style.borderColor = '#d3d3d3';
+				this.currFocus = e.target.id;
+				return;
+			case 'submit-input':
+				const account = this.sidInput.value.replace(/\s|\|/g, '');
+				const password = this.passwordInput.value.replace(/\s|\|/g, '');
+				if (account && password) {
+					this.loginLogic();
+				}
+				return;
+			default:
+				break;
+		}
+
+		//右侧键盘点击处理逻辑
 		let key = null;
 		switch (e.target.id) {
 			case 'key-1':
@@ -111,80 +151,38 @@ class LoginScene extends scene {
 				break;
 		}
 
-		let currInput = document.getElementById(this.currFocus);
-		if (this.currFocus !== 'submit-input') {
-			if (typeof key === 'number') {
-				if (this.currFocus === 'sid-input') {
-					currInput.value = (currInput.value.replace(/\s|\|/g, '') + key.toString()).replace(/(\d{4})/g, '$1 ').trim() + '|';
-				}
-				if (this.currFocus === 'password-input') {
-					currInput.value = (currInput.value.replace(/\s|\|/g, '') + key.toString()).replace(/(\d{4})/g, '$1 ').trim() + '|';
-				}
-			} else if (key === 'backspace') {
-				currInput.value = currInput.value.indexOf('|') === -1 ? currInput.value.slice(0, -1) : currInput.value.slice(0, -2) + '|';
-			} else if (key === 'enter') {
-				if (this.currFocus === 'password-input') {
-					this.loginLogic();
-				}
-				let focusArr = ['sid-input', 'password-input', 'submit-input', 'submit-input'];
-				let nextInputIndex = focusArr.indexOf(this.currFocus);
-				// console.log(focusArr[nextInputIndex + 1]);
-				let nextInput = this.moye.root.getWidgetById(focusArr[nextInputIndex + 1]);
-				nextInput.focus();
-				this.onKeydown();
+		/* 动态改变input内的值 */
+		const currInput = document.getElementById(this.currFocus);
+		if (typeof key === 'number') {
+			if (this.currFocus === 'sid-input') {
+				currInput.value = (currInput.value.replace(/\s|\|/g, '') + key.toString()).replace(/(\d{4})/g, '$1 ').trim() + '|';
 			}
-		} else {
-			if (key !== null) {
-				this.moye.root.getWidgetById('submit-input').focus();
-			} else {
+			if (this.currFocus === 'password-input') {
+				currInput.value = (currInput.value.replace(/\s|\|/g, '') + key.toString()).replace(/(\d{4})/g, '$1 ').trim() + '|';
+			}
+		} else if (key === 'backspace') {
+			currInput.value = currInput.value.indexOf('|') === -1 ? currInput.value.slice(0, -1) : currInput.value.slice(0, -2) + '|';
+		} else if (key === 'enter') {
+			const account = this.sidInput.value.replace(/\s|\|/g, '');
+			const password = this.passwordInput.value.replace(/\s|\|/g, '');
+			if (this.currFocus === 'sid-input' && account) {
+				document.querySelector('.form-password').style.borderColor = '#4682B4';
+				document.querySelector('.form-sid').style.borderColor = '#d3d3d3';
+				document.querySelector('#submit-input').style.background = '#ccc';
+				this.currFocus = 'password-input';
+			}
+			else if (this.currFocus === 'password-input' && password) {
 				this.loginLogic();
 			}
 		}
-	}
 
-	onKeydown(e) {
-		const leaf = FocusEngine.getFocusedLeaf();
-		switch (leaf.id) {
-			case 'sid-input':
-				document.querySelector('.form-sid').style.borderColor = '#ff5a00';
-				document.querySelector('.form-password').style.borderColor = '#d3d3d3';
-				this.passwordInput.value = this.passwordInput.value.replace(/\|/g, '');
-				this.sidInput.value = this.sidInput.value.indexOf('|') === -1 ? this.sidInput.value + '|' : this.sidInput.value;
-				if (this.currFocus !== 'sid-input') {
-					this.moye.root.getWidgetById('key-5').focus();
-					this.currFocus = 'sid-input';
-					// 焦点离开 - 颜色变为输入状态颜色
-					document.querySelector('.form-sid').style.borderColor = '#4682B4';
-				}
-				break;
-			case 'password-input':
-				document.querySelector('.form-sid').style.borderColor = '#d3d3d3';
-				document.querySelector('.form-password').style.borderColor = '#ff5a00';
-				this.sidInput.value = this.sidInput.value.replace(/\|/g, '');
-				this.passwordInput.value = this.passwordInput.value.indexOf('|') === -1 ? this.passwordInput.value + '|' : this.passwordInput.value;
-				if (this.currFocus !== 'password-input') {
-					this.moye.root.getWidgetById('key-5').focus();
-					this.currFocus = 'password-input';
-					// 焦点离开 - 颜色变为输入状态颜色
-					document.querySelector('.form-password').style.borderColor = '#4682B4';
-				}
-				break;
-			case 'submit-input':
-				document.querySelector('.form-sid').style.borderColor = '#d3d3d3';
-				document.querySelector('.form-password').style.borderColor = '#d3d3d3';
-				this.passwordInput.value = this.passwordInput.value.replace(/\|/g, '');
-				this.sidInput.value = this.sidInput.value.replace(/\|/g, '');
-				this.currFocus = 'submit-input';
-				break;
-			default:
-				if (this.currFocus == 'sid-input') {
-					document.querySelector('.form-sid').style.borderColor = '#4682B4';
-					document.querySelector('.form-password').style.borderColor = '#d3d3d3';
-				} else if (this.currFocus == 'password-input') {
-					document.querySelector('.form-sid').style.borderColor = '#d3d3d3';
-					document.querySelector('.form-password').style.borderColor = '#4682B4';
-				}
-				break;
+		/* 根据sid-input与password-input是否有值动态更换submit-input颜色 */
+		const account = this.sidInput.value.replace(/\s|\|/g, '');
+		const password = this.passwordInput.value.replace(/\s|\|/g, '');
+		if (account && password) {
+			document.querySelector('#submit-input').style.background = '#2973d7';
+		} else {
+			document.querySelector('#submit-input').style.background = '#ccc';
 		}
 	}
 }

+ 0 - 2
src/stage/index/scene/RepeatLoginScene.js

@@ -5,7 +5,6 @@ class RepeatLoginScene extends scene {
 
 	onCreate() {
 		this.setContentView(require('../../../res/tpl/RepeatLoginScene.tpl'), {}, 'RepeatLoginScene', {'isParentShow': true}, () => {
-			// 默认光标指向"知道了"按钮
 			this.moye.root.getWidgetById('iknow-btn').focus();
 		});
 	}
@@ -40,7 +39,6 @@ class RepeatLoginScene extends scene {
 			this.hideScene({});
 		}
 	}
-
 	onBack() {
 
 	}

+ 21 - 2
src/stage/index/scene/VideoWareFullScreenScene.js

@@ -36,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);

+ 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_voice.png);
+				&.muted {
+					background-image: url(assets/img/Audio/audio_mute.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));
+			}
+		}
+	}
+}

+ 2 - 2
src/stage/index/style/CLScene.less

@@ -32,7 +32,7 @@
         }
         #cl-left-tab-scroll{
             position: relative;
-            overflow: hidden;
+            overflow: auto;
             height: 8.55rem;
         }
         .item {
@@ -60,7 +60,7 @@
 
     #cl-right-panel {
         float: right;
-        width: 15.3rem;
+        width: 15.1rem;
         height: 100%;
     }
 

+ 10 - 1
src/stage/index/style/CourseScene.less

@@ -234,6 +234,11 @@
 					.download-btn-lesson-list-ready;
 					background-image:url('assets/img/CourseScene/download_btn_list_success.png');
 				}
+				.download-btn-lesson-list-failed {
+					.download-btn-lesson-list-ready;
+					background-image:url('assets/img/CourseScene/download_btn_list_failed.png');
+				}
+
 			}
 		}
 
@@ -298,7 +303,11 @@
 							.download-btn-lesson-icon-ready;
 							background-image:url('assets/img/CourseScene/download_btn_icon_success.png');
 					}
-				}//lesson-wrapper
+					.download-btn-lesson-icon-failed {
+						.download-btn-lesson-icon-ready;
+						background-image:url('assets/img/CourseScene/download_btn_icon_success.png');
+					}
+		        }//lesson-wrapper
 			}
 		}
 

+ 198 - 0
src/stage/index/style/DownloadScene.less

@@ -0,0 +1,198 @@
+@import "./Mixins.less";
+
+#DownloadManagerScene {
+	position: absolute;
+	top: 0;
+	left: 0;
+	width: 100%;
+	height: 10.9rem;
+	overflow: hidden;
+	text-align: center;
+	background-image: url('assets/img/IndexScene/index_bg.png');
+	background-size: 100% 100%;
+	background-repeat: no-repeat;
+
+	.local-download-icon{
+		float: left;
+		position: relative;
+		left:0.5rem;
+		top:0.3rem;
+		img {
+			display: inline-block;
+			width: 1rem;
+		}
+		div{
+			display: inline-block;
+			font-size: 0.3rem;
+			color: white;
+			margin-top: 0.3rem;
+			margin-left: 0.2rem;
+		}
+	}
+
+	.background-wrapper{
+		z-index: 0;
+		position: absolute;
+		left: 0.4rem;
+		margin: 1.55rem 1.25rem;
+		width: 16rem;
+		height: 8.29rem;
+		border-radius: 0.3rem 0.3rem 0.3rem 0.3rem;
+		background-color: #244b7e;
+		text-align: center;
+
+		.background-header{
+			z-index: 0;
+			background-color:#5a70d6;
+			border-radius: 0.3rem 0.3rem 0rem 0rem;
+			height:0.9rem;
+		}
+
+		.horizon-line {
+			z-index: 0;
+			height:0.82rem;
+			width: 15.6rem;
+      		border-bottom: 0.02rem solid #053864;
+			margin: 0 auto;
+			&.first-line{
+				height: 0.9rem;
+				border-bottom: none;
+			}
+		}
+
+		.back-row {
+			z-index: 2;
+			height: 0.82rem;
+			text-align: center;
+			position:relative;
+			float: left;
+			line-height: 0.82rem;
+			font-size: 0.3rem;
+			color: white;
+			display:table-row;
+			margin-left: 0.38rem;
+			div {
+				display:table-cell;
+      			vertical-align:middle;
+			}
+			.right-border {
+				height: 0.82rem;
+				border-right: 0.02rem solid #053864;
+			}
+			.one {
+				width:2rem;
+				.right-border;
+				text-align: center;
+			}
+			.two {
+				width:2.87rem;
+				.right-border;
+			}
+			.three {
+				width:4.37rem;
+				.right-border;
+			}
+			.four {
+				width:2.6rem;
+				.right-border;
+			}
+			.five {
+				width:2.9rem;
+				text-align: center;
+			}
+		}
+	}
+
+	.content-wrapper {
+		z-index: 2;
+		position: absolute;
+		width: 100%;
+		margin-left: 0.38rem;
+		display:block;
+		height: 7.39rem;
+    	overflow: auto;
+		.scroll-lines-wrapper{
+			z-index: 1;
+			position: absolute;
+			margin-top: 0;
+		}
+		&::-webkit-scrollbar {
+			display: none;
+		}
+	}//content-wrapper
+
+	.row {
+		z-index: 1;
+		height: 0.82rem;
+		text-align: center;
+		position:relative;
+		font-size: 0.3rem;
+		color: white;
+		display:table-row;
+		margin: 0 auto;
+		div {
+			display:table-cell;
+  			vertical-align:middle;
+		}
+		.right-border {
+			border-right: 0.02rem solid #053864;
+		}
+		.one {
+			width:2rem;
+			text-align: center;
+		}
+		.two {
+			width:2.87rem;
+		}
+		.three {
+			width:4.37rem;
+		}
+		.four {
+			width:2.6rem;
+		}
+		.five {
+			width:3.5rem;
+			text-align: center;
+			#download-btn-wrapper {
+				display: inline-block;
+				.download-enter-btn {
+					display: inline-block;
+					width: 1.7rem;
+					height: .6rem;
+					border: .05rem solid transparent;
+					.img-btn {
+						height: 100%;
+						width: 100%;
+					}
+					&.fe-focus {
+				//		border: .05rem solid #ffe100;
+				//		border-radius: .25rem;
+					}
+				}
+				.download-del-btn {
+					display: inline-block;
+					width: 1rem;
+					height: .6rem;
+					border: .05rem solid transparent;
+					.img-btn{
+						height: 100%;
+						width: 100%;
+					}
+				}
+			}
+
+
+		}
+		&.row-header{
+			height: 0.9rem;
+		}
+	}//row
+
+	.header {
+		height: 0.9rem;
+		text-align: center;
+		position: absolute;
+		margin-top: 0;
+		padding-left: 0.38rem;
+	}
+}

+ 74 - 0
src/stage/index/style/DownloadTipScene.less

@@ -0,0 +1,74 @@
+.course-download-wrapper {
+  position: absolute;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  background-color: rgba(0, 0, 0, .5);
+  z-index: 2;
+
+  .toast {
+    position: absolute;
+    width: 8.52rem;
+    height: 5.04rem;
+    top: 50%;
+    left: 50%;
+    transform: translate3d(-50%, -50%, 0);
+    -webkit-transform: translate3d(-50%, -50%, 0);
+    overflow: hidden;
+    padding: 0.33rem;
+    line-height: 1;
+    background-color: #ffffff;
+    text-align: center;
+    border-radius: 0.6rem;
+    font-size: 0.48rem;
+
+    img {
+      width: 1.3rem;
+      height: 1.3rem;
+      border-radius: 0.65rem;
+    }
+
+    p {
+      color: #515151;
+      font-size: 0.48rem;
+      margin: 0.4rem;
+    }
+
+    .ok-btn {
+      position: absolute;
+      bottom: .34rem;
+      left: 2.5rem;
+      width: 3.6rem;
+      height: 1.2rem;
+      padding: 0.3rem 0;
+      border-radius: .5rem;
+      color: #fff;
+      background-color: #fe84b2;
+      font-size: 0.48rem;
+
+      &.fe-focus {
+        //.after-focus(@borderSize; #ff5050);
+      }
+    }
+
+    /*
+    .cancle {
+        position: absolute;
+        bottom: .34rem;
+        right: .34rem;
+        width: 3.6rem;
+        height: 1.2rem;
+        line-height: 1.2rem;
+        border-radius: .5rem;
+        color: #fff;
+        background-color: #fe84b2;
+        font-size: 0.48rem;
+
+        &.fe-focus {
+            .after-focus(@borderSize; #ff5050);
+        }
+    }
+    */
+  }
+}

+ 187 - 0
src/stage/index/style/IndexScene.less

@@ -0,0 +1,187 @@
+@import './component/CourseItem.less';
+
+@keyframes circle-opacity{
+	0% {
+		background: -webkit-radial-gradient(rgba(207,209,209,.3) 10%, rgba(207,209,209,.35) 20%,rgba(0,0,0,0) 20%); /* Safari 5.1 - 6.0 */
+		//background: radial-gradient(rgba(0,0,0,0), rgba(0,0,0,.1), rgba(0,0,0,.2),rgba(0,0,0,.3),rgba(0,0,0,.4),rgba(0,0,0,.5)); /* 标准的语法(必须放在最后) */
+	}
+	25% {
+		background: -webkit-radial-gradient(rgba(207,209,209,.4) 20%, rgba(207,209,209,.45) 40%,rgba(0,0,0,0) 40%); /* Safari 5.1 - 6.0 */
+		//background: radial-gradient(rgba(0,0,0,0), rgba(0,0,0,.1), rgba(0,0,0,.2),rgba(0,0,0,.3),rgba(0,0,0,.4),rgba(0,0,0,.5)); /* 标准的语法(必须放在最后) */
+	}
+	50% {
+		background: -webkit-radial-gradient(rgba(207,209,209,.4) 30%, rgba(207,209,209,.4) 60%,rgba(0,0,0,0) 60%); /* Safari 5.1 - 6.0 */
+		//background: radial-gradient(rgba(0,0,0,0), rgba(0,0,0,.1), rgba(0,0,0,.2),rgba(0,0,0,.3),rgba(0,0,0,.4),rgba(0,0,0,.5)); /* 标准的语法(必须放在最后) */
+	}
+	70% {
+		background: -webkit-radial-gradient(rgba(186,188,188,.3) 60%, rgba(186,188,188,.35) 70%,rgba(0,0,0,0) 70%); /* Safari 5.1 - 6.0 */
+		//background: radial-gradient(rgba(0,0,0,0), rgba(0,0,0,.1), rgba(0,0,0,.2),rgba(0,0,0,.3),rgba(0,0,0,.4),rgba(0,0,0,.5)); /* 标准的语法(必须放在最后) */
+	}
+	100% {
+		background: -webkit-radial-gradient(rgba(186,188,188,.3) 70%, rgba(186,188,188,.35) 100%,rgba(0,0,0,0) 100%); /* Safari 5.1 - 6.0 */
+		//background: radial-gradient(rgba(0,0,0,0), rgba(0,0,0,.1), rgba(0,0,0,.2),rgba(0,0,0,.3),rgba(0,0,0,.4),rgba(0,0,0,.5)); /* 标准的语法(必须放在最后) */
+	}
+}
+
+@keyframes circle-opacity-fun{
+	0% {
+		background: -webkit-radial-gradient(rgba(0,0,0,.3) 10%, rgba(0,0,0,.35) 20%,rgba(0,0,0,0) 20%); /* Safari 5.1 - 6.0 */
+		//background: radial-gradient(rgba(0,0,0,0), rgba(0,0,0,.1), rgba(0,0,0,.2),rgba(0,0,0,.3),rgba(0,0,0,.4),rgba(0,0,0,.5)); /* 标准的语法(必须放在最后) */
+	}
+	25% {
+		background: -webkit-radial-gradient(rgba(0,0,0,.4) 20%, rgba(0,0,0,.45) 40%,rgba(0,0,0,0) 40%); /* Safari 5.1 - 6.0 */
+		//background: radial-gradient(rgba(0,0,0,0), rgba(0,0,0,.1), rgba(0,0,0,.2),rgba(0,0,0,.3),rgba(0,0,0,.4),rgba(0,0,0,.5)); /* 标准的语法(必须放在最后) */
+	}
+	50% {
+		background: -webkit-radial-gradient(rgba(0,0,0,.4) 30%, rgba(0,0,0,.4) 60%,rgba(0,0,0,0) 60%); /* Safari 5.1 - 6.0 */
+		//background: radial-gradient(rgba(0,0,0,0), rgba(0,0,0,.1), rgba(0,0,0,.2),rgba(0,0,0,.3),rgba(0,0,0,.4),rgba(0,0,0,.5)); /* 标准的语法(必须放在最后) */
+	}
+	70% {
+		background: -webkit-radial-gradient(rgba(0,0,0,.3) 60%, rgba(0,0,0,.35) 70%,rgba(0,0,0,0) 70%); /* Safari 5.1 - 6.0 */
+		//background: radial-gradient(rgba(0,0,0,0), rgba(0,0,0,.1), rgba(0,0,0,.2),rgba(0,0,0,.3),rgba(0,0,0,.4),rgba(0,0,0,.5)); /* 标准的语法(必须放在最后) */
+	}
+	100% {
+		background: -webkit-radial-gradient(rgba(0,0,0,.3) 70%, rgba(0,0,0,.35) 100%,rgba(0,0,0,0) 100%); /* Safari 5.1 - 6.0 */
+		//background: radial-gradient(rgba(0,0,0,0), rgba(0,0,0,.1), rgba(0,0,0,.2),rgba(0,0,0,.3),rgba(0,0,0,.4),rgba(0,0,0,.5)); /* 标准的语法(必须放在最后) */
+	}
+}
+
+#IndexScene {
+	position: absolute;
+	width: unit(@designWidth, rem);
+	height: unit(@designHeight, rem);
+	padding: 0.05rem 1.2rem .5rem;
+	background-image: url('assets/img/IndexScene/background.png');
+	background-size: cover;
+	background-repeat: no-repeat;
+
+	.m-logo{
+		position: absolute;
+		top: 1rem;
+		width: 5.64rem;
+		height: 1.2rem;
+		background-image: url('assets/img/IndexScene/logo.png');
+		background-size: 100% 100%;
+		background-repeat: no-repeat;
+	}
+	.m-header-user{
+		height: 0.96rem;
+		margin-top: 1rem;
+		.user-info {
+			float: right;
+			width: auto;
+			height: auto;
+			margin-left: 0.2rem;
+			border-radius: 0.55rem;
+			padding-left: 0.2rem;
+			padding-right: 0.3rem;
+			padding-top: 0.1rem;
+			padding-bottom: 0.1rem;
+			margin-right: -0.3rem;
+			text-align: right;
+
+			.user-info-text {
+				float: left;
+				width: auto;
+				height: 100%;
+				color: #ffffff;
+				padding-top: 0.01rem;
+				filter:alpha(Opacity=60);-moz-opacity:0.6;opacity: 0.6;
+
+				.terminal-name {
+					width: 100%;
+					height: .4rem;
+					line-height: .4rem;
+					font-size: 0.48rem;
+				}
+
+				.terminal-id {
+					width: 100%;
+					height: .3rem;
+					margin-top: .1rem;
+					line-height: .3rem;
+					font-size: 0.36rem;
+				}
+			}
+		}
+	}
+	.m-main {
+		width: 100%;
+		height: 7.8rem;
+		margin-top: 0.3rem;
+		padding: .2rem 0rem 0rem 0rem;
+		overflow-y: hidden;
+		.scroll-list {
+			width: 100%;
+			padding-bottom: 0.3rem;
+
+			.history-wrapper {
+				font-size: 0;
+				width: 100%;
+				height: 4.98rem;
+				padding: 0.2rem 0.09rem 0.2rem;
+				overflow: hidden;
+
+				.history-item {
+					position: relative;
+					display: inline-block;
+					width: 20%;
+					height: 100%;
+					padding: 0 .06rem;
+					.course-item-frame {
+						color: #303030;
+						.course-item-frame;
+					}
+				}
+			}
+			.fun-wrapper {
+				width: 100%;
+				height: 1.8rem;
+				padding: 0 0.09rem;
+				margin-top: .02rem;
+				margin-bottom: .65rem;
+				font-size: 0;
+				.fun-item {
+					position: relative;
+					display: inline-block;
+					width: 20%;
+					height: 1.8rem + 2 * unit(@borderSize, rem);
+					padding: 0 0.11rem - unit(@borderSize, rem);
+					overflow: hidden;
+					img {
+						margin-left: .22rem;
+						height: 1.8rem;
+						width: 3.1rem;
+						border: solid unit(@borderSize, rem) transparent;
+						border-radius: 0.24rem;
+						&:first-child {
+							margin-left: 0;
+						}
+					}
+					//点击触摸反馈样式 响应
+					&::after {
+						content: " ";
+						display: block;
+						position: absolute;
+						left: 0;
+						top: -100%;
+						margin-left: .11rem;
+						width: 3.1rem;
+						height: 300%;
+						background-color: transparent;
+					}
+					&:active::after {
+						animation: circle-opacity .3s;
+					}
+
+				}
+			}
+		}
+	}
+	.index_msg {
+		font-family: -webkit-pictograph;
+		text-align: center;
+		color: rgba(255,255,255,.4);
+		font-size: .32rem;
+	}
+}

+ 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_voice.png);
+						&.muted {
+							background-image: url(assets/img/Audio/audio_mute.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 - 8
src/stage/index/style/LoginScene.less

@@ -112,11 +112,7 @@
 				font-size: 0.45rem;
 				color: #fff;
 				background: #ccc;
-
-				&.fe-focus {
-					background: #2973d7;
-				//	.after-focus(@outLineSize; #ff5a00; 0; #ff5a00);
-				}
+				outline: none;
 			}
 		}
 	}
@@ -190,9 +186,6 @@
 					background-image: url('assets/img/LoginScene/enter.png');
 				}
 			}
-			&.fe-focus .key-icon {
-			//	.after-focus(@outLineSize; #ff5a00; 0; #ff5a00);
-			}
 		}
 	}
 }

+ 5 - 3
src/util/API/AJAXHelper.js

@@ -52,9 +52,10 @@ class AJAXHelper {
 		let platform = 'tv';
 		if (!window.efunbox) {
 			platform = 'web';
-		}
-		let url = AJAXHelper.genAPIUrl(path, method, { eid, uid, terminal: platform, ...data });
-
+    }
+    //添加时间戳
+    let timestamp = new Date().getTime();
+    let url = AJAXHelper.genAPIUrl(path, method, { eid, uid, t:timestamp, terminal: platform, ...data });
 		let xmlHttpReq = new XMLHttpRequest();
 		xmlHttpReq.open(method, url, true);
 		//构造请求头(每个请求都带的公共参数)
@@ -62,6 +63,7 @@ class AJAXHelper {
 		xmlHttpReq.setRequestHeader('uid', uid);
 		xmlHttpReq.setRequestHeader('sign', sign);
 		xmlHttpReq.setRequestHeader('terminal', platform);
+		xmlHttpReq.setRequestHeader('X-Content-Type-Options', 'nosniff');
 		xmlHttpReq.setRequestHeader('merchant', 'angelbell');
 		xmlHttpReq.setRequestHeader('requestId', requestId);
 		xmlHttpReq.setRequestHeader('Authentication', sign); //header中增加Authentication以兼容老版本

+ 53 - 6
src/util/API/APIClient.js

@@ -1,10 +1,11 @@
 import Consts from '../Consts';
 import AJAXHelper from './AJAXHelper';
 import userDataStorage from '../userDataStorage';
+import WinBoxAPI from '../WinBoxAPI';
 import Utils from '../Utils';
 
 class APIClient {
-	constructor() { }
+	constructor() {}
 
 	// 添加缓存参数,安卓截获带有此参数的请求
 	static addCacheParam(params, cacheKeySrc=null, cacheKey=null){
@@ -24,19 +25,28 @@ class APIClient {
 
 	// 账户登录,获取token,绑定设备
 	static userLoginAndBindDevice(data, callback) {
+		let deviceModel,deviceMfrs,deviceBrand = '';
 		let deviceCode = localStorage.getItem('deviceCode');
+    if(window.efunbox) {
+      deviceModel = window.efunbox.getModelForDevice();
+      deviceMfrs = window.efunbox.getMfrsForDevice();
+      deviceBrand = window.efunbox.getBrandForDevice();
+		}
 		if (!deviceCode) {
 			if (window.efunbox) {
-				deviceCode = window.efunbox.getUuidForDevice();
+        deviceCode = window.efunbox.getUuidForDevice();
 			} else {
-				deviceCode = Utils.getUuidForWeb();
+        deviceCode = Utils.getUuidForWeb();
 			}
 			localStorage.setItem('deviceCode', deviceCode);
 		}
 		let params = {
-			deviceCode,
+      deviceCode,
 			eid: data.usercode,
 			password: data.password,
+      deviceModel: deviceModel,
+      deviceMfrs: deviceMfrs,
+      deviceBrand: deviceBrand
 		};
 		AJAXHelper.post('/token', params, callback);
 	}
@@ -118,8 +128,14 @@ class APIClient {
 
 	// 根据课程获取课列表
 	static getLessonList(courseId, callback) {
-		let params = APIClient.addCacheParam({});
-		AJAXHelper.get(`/course/${courseId}/lessons`, params, callback);
+    APIClient.getUserMacUrl( ( mac ) => {
+      let params = APIClient.addCacheParam({});
+      params.mac = mac;
+      AJAXHelper.get(`/course/${courseId}/lessons`, params , callback);
+    });
+    // let params = APIClient.addCacheParam({});
+    // console.log('params',params)
+    // AJAXHelper.get(`/course/${courseId}/lessons`, { params }, callback);
 	}
 
 	// 获取课程详情
@@ -134,6 +150,13 @@ class APIClient {
 		params = APIClient.addCacheParam(params);
 		AJAXHelper.get(`/lesson/${lessonId}`, params, callback);
 	}
+  //在课件里面获取 具体课的下载进度
+  static getDownloadProcess( lessonId, callback) {
+    APIClient.getUserMacUrl( ( mac ) => {
+      let params = { lessonId, mac }
+      AJAXHelper.get(`/callback/download/find`, params, callback);
+    });
+  }
 
 	// 获取该课程相关配套列表
 	static getCourseAboutSupport(courseId, callback) {
@@ -197,6 +220,30 @@ class APIClient {
 	  let params = { eventType, tarName, tarId, value };
 	  AJAXHelper.post('/callback/event', params, callback);
 	}
+
+	// 获取用户的mac地址
+	static getUserMacUrl(callback) {
+		let mac = '';
+		WinBoxAPI.getMacUrl((isTrue, res) => {
+			mac = res.data;
+			callback( mac );
+		})
+	}
+
+	// 获取用户的下载记录
+	static getUserDownloadList(callback) {
+		APIClient.getUserMacUrl( ( mac ) => {
+			AJAXHelper.get('/callback/download/list', { mac: mac }, callback);
+		});
+	}
+
+	//refresh 处的查询下载记录
+	static getDownloadList(callback) {
+    APIClient.getUserMacUrl( ( mac ) => {
+		let params =  { mac: mac };
+      	AJAXHelper.get('/callback/download/fail', params, callback);
+    });
+  }
 }
 
 module.exports = APIClient;

+ 7 - 2
src/util/Consts.js

@@ -10,6 +10,9 @@ class Consts {
     }
 }
 
+//node服务接口地址
+Consts.NODE_SERVER = 'http://127.0.0.1:8089';
+
 //图片/视频资源域名
 Consts.IMG_PATH = 'https://efunimgs.ai160.com';
 Consts.VIDEO_PATH = 'https://efunvideo.ai160.com';
@@ -19,7 +22,9 @@ Consts.DATA_BUILDING = 'http://ljimgs.ai160.com/2b/app_resource/data_building.jp
 
 //图片/视频资源类型代号
 Consts.TYPE_VIDEO = 0;
+Consts.TYPE_AUDIO = 1;
 Consts.TYPE_IMAGE = 3;
+Consts.TYPE_AUDIOBOOK = 4;
 
 //产品类型
 Consts.TYPE_COURSE = 'COURSE';
@@ -40,8 +45,8 @@ Consts.DOM_ID_LOCAL_DOWNLOAD_BUTTON = 'local-download-btn'
 Consts.EVENT_TYPE_OK = 'ok';
 
 Consts.DOWNLOAD_STATUS_UNDOWNLOAD = 0;
-Consts.DOWNLOAD_STATUS_ONGOING = 1;
-Consts.DOWNLOAD_STATUS_SUCCESS = 2;
+Consts.DOWNLOAD_STATUS_SUCCESS = 1;
+Consts.DOWNLOAD_STATUS_ONGOING = 2;
 Consts.DOWNLOAD_STATUS_FAILED = 3;
 
 Consts.ANDROID_FORCE_VERSION = '3.3.0';

+ 0 - 7
src/util/EfunVideoPlayer.js

@@ -4,12 +4,6 @@ class EfunVideoPlayer {
     this.metadata = null;
   }
 
-  loadedHandler() {
-    this.efunplayer.addListener('loadedmetadata', () => {
-      this.metadata = this.efunplayer.getMetaDate();
-    });
-  }
-
   initPlayer(url, domId) {
     let videoObject = {
       autoplay: true,
@@ -30,7 +24,6 @@ class EfunVideoPlayer {
   }
 
   pause() {
-    console.log('click pause btn...');
     this.efunplayer.videoPause();
   }
 

+ 69 - 0
src/util/WinBoxAPI.js

@@ -0,0 +1,69 @@
+import userDataStorage from './userDataStorage';
+import Consts from './Consts';
+
+class WinBoxAPI {
+  constructor() {}
+
+  static whenAjaxResponse(httpRequest, callback) {
+    if (httpRequest.readyState != 4) {
+			return;
+		}
+    try {
+		  let res = JSON.parse(httpRequest.responseText);
+		  callback(httpRequest.status == 200, res);
+    }
+    catch(err) {
+      callback(false, {});
+    }
+  }
+
+  static baseRequest(method, path, params, callback) {
+		let xmlHttpReq = new XMLHttpRequest();
+
+		let sendBody = null;
+    let url = `${Consts.NODE_SERVER}${path}?`;
+    if (method === 'GET') {
+      for (let key in params) {
+        url += `${key}=${params[key]}&`;
+      }
+    }
+		if (params && (method == 'POST' || method == 'PUT')) {
+			sendBody = JSON.stringify({...params});
+		}
+		xmlHttpReq.open(method, url, true);
+		xmlHttpReq.onreadystatechange = function () {
+			WinBoxAPI.whenAjaxResponse(xmlHttpReq, callback);
+		};
+		xmlHttpReq.send(sendBody);
+  }
+
+  static get(path, params, callback) {
+    WinBoxAPI.baseRequest('GET', path, params, callback);
+  }
+
+  static post(path, params) {
+    WinBoxAPI.baseRequest('POST', path, params, callback);
+  }
+
+  static postDownloadRequest(lessonId, courseId, callback) {
+		const { token = '', uid = '', eid = '' } = userDataStorage.getData() || {};
+    let path = '/lesson/downloadFile';
+    let params = { lessonId, courseId, uid, eid, token };
+    WinBoxAPI.get(path, params, callback);
+  }
+
+  //获取mac地址
+  static getMacUrl(callback) {
+    let path = '/lesson/getMac';
+    WinBoxAPI.get(path, {}, callback);
+  }
+
+  static deleteDownloadFile(lessonId, courseId, callback) {
+		const { token = '', uid = '', eid = '' } = userDataStorage.getData() || {};
+    let path = '/lesson/delFile';
+    let params = { lessonId, courseId, uid, eid, token };
+    WinBoxAPI.get(path, params, callback);
+  }
+}
+
+module.exports = WinBoxAPI;

+ 10 - 61
src/util/course.js

@@ -15,71 +15,25 @@ class Course {
 		let item = data[idx];
 			recs.push(item.id);
 		}
-
-    	let cmdResult = CommandBus.execute({type:CMD_TYPE.DOWNLOAD_LESSON_STATUS_GET, payload:{recs}});
-		let lessonDownloadStatus = {};
-		if (!cmdResult.status){
-			for(let idx in cmdResult.data.recs){
-        		let rec = cmdResult.data.recs[idx];
-				lessonDownloadStatus[rec.lessonID.toString()] = parseInt(rec.downloadStatus);
-			}
-		}
-
 		// 现在只按文字模板进行渲染
-		main.innerHTML = this.textList(data, lessonDownloadStatus, auth);
-	}
-
-	//废弃
-	static imgList(data, lessonDownloadStatus) {
-		let content = '';
-		function listItem(data, seq, downloadStatus) {
-
-      	//根据不同的下载状态,设置不同的Button状态
-		let btnClass = 'download-btn-lesson-icon-ready';
-		if (downloadStatus == Consts.DOWNLOAD_STATUS_ONGOING){
-			btnClass = 'download-btn-lesson-icon-ongoing';
-		}
-		else if (downloadStatus == Consts.DOWNLOAD_STATUS_SUCCESS) {
-			btnClass = 'download-btn-lesson-icon-success';
-		}
-
-		let url = data.picUrl ? `${Consts.IMG_PATH}/${data.picUrl}` : `http://via.placeholder.com/350x150?text=NO PIC ${data.id}`
-		return `<div data-seq="${seq}" class="lesson-icon-wrapper">
-		        <div id="lesson-btn-${seq}" data-id="${data.id}" data-template="${data.templateCode}" data-name="${data.itemTitle}" fe-role="Widget" class="img-wrapper" data-seq="${seq}">
-		  				<img src="${url}" alt="${data.itemTitle}">
-		  			</div>
-		        <div id="download-btn-${data.id}" fe-role="Widget" class="${btnClass}" data-id="${data.id}" data-name="${data.itemTitle}" data-seq="${seq}" ></div>
-			</div>`;
-		}
-
-		for (let i in data) {
-			let downloadStatus = Consts.DOWNLOAD_STATUS_UNDOWNLOAD;
-			let lessonId = data[i].id.toString();
-			if (lessonDownloadStatus[lessonId]){
-				downloadStatus = lessonDownloadStatus[lessonId];
-			}
-
-			content += listItem(data[i], i, downloadStatus);
-		}
-
-		return `<div class="list-pic-container" fe-role="Scroll" fe-cfg="scroll_dir:v,scroll_center:con,scroll_duration:0.2,scroll_easing:linear">
-		<div class="scroll-list clearfix" id="course-main-list">${content}</div>
-		</div>`;
+		main.innerHTML = this.textList(data, auth);
 	}
 
-	static textList(data, lessonDownloadStatus, auth) {
+	static textList(data, auth) {
 		let content = '';
-		function listItem(data, seq, downloadStatus, isFree) {
+		function listItem(data, seq, isFree) {
 			let btnClass = 'download-btn-lesson-list-ready';
-			if (downloadStatus == Consts.DOWNLOAD_STATUS_ONGOING){
+			if (data.downloadStatus == Consts.DOWNLOAD_STATUS_ONGOING){
 				btnClass = 'download-btn-lesson-list-ongoing';
 			}
-			else if (downloadStatus == Consts.DOWNLOAD_STATUS_SUCCESS) {
+			else if (data.downloadStatus == Consts.DOWNLOAD_STATUS_SUCCESS) {
 				btnClass = 'download-btn-lesson-list-success';
+			} if ( data.downloadStatus == Consts.DOWNLOAD_STATUS_FAILED ) {
+				btnClass = 'download-btn-lesson-list-failed';
 			}
 			return `
 				<div data-seq="${seq}">
-		        	<div id="lesson-btn-${seq}" data-id="${data.id}" data-name="${data.title}" data-seq="${seq}" fe-role="Widget" class="text-wrapper">
+		        	<div id="lesson-btn-${seq}" data-id="${data.id}" data-name="${data.title}" data-dload="${data.downloadStatus}" data-seq="${seq}" fe-role="Widget" class="text-wrapper">
 						${Utils.fixOverflowStr(data.title, 32, '...')}
 						<div class="free-flag" style="display: ${isFree ? "block" : "none"}"></div>
 					</div>
@@ -89,16 +43,11 @@ class Course {
 			`;
 		}
 		for (let i in data) {
-			let downloadStatus = Consts.DOWNLOAD_STATUS_UNDOWNLOAD;
-			let lessonId = data[i].id.toString();
-			if (lessonDownloadStatus[lessonId]){
-				downloadStatus = lessonDownloadStatus[lessonId];
-			}
 			// 课程未购买的第一课加入free标记
 			if (i == 0 && !auth) {
-				content += listItem(data[i], i, downloadStatus, true);
+				content += listItem(data[i], i, true);
 			} else {
-				content += listItem(data[i], i, downloadStatus, false);
+				content += listItem(data[i], i, false);
 			}
 		}
 		return `<div id="list-text-container" class="list-text-container" fe-role="Scroll" fe-cfg="scroll_dir:v,scroll_center:con,scroll_duration:0.2,scroll_easing:linear"><div class="scroll-list clearfix" id="course-main-list">${content}</div></div> `;