Browse Source

:bug: fixbugs

zhanghe 6 years ago
parent
commit
4c9467d719

+ 1 - 1
src/res/tpl/CourseScene.tpl

@@ -1,6 +1,6 @@
 <div id="CourseScene" class="course clearfix" fe-role="Switch">
 	<div class="course-bg">
-		<img id="course-bg" src="assets/img/course/bg.jpg">
+		<img id="course-bg" src="assets/img/CourseScene/bg.jpg">
 	</div>
 	<div class="header">
 		<div class="course-name" id="course-name"></div>

+ 1 - 1
src/res/tpl/ShopCartScene.tpl

@@ -4,7 +4,7 @@
 	<div id="cart-empty" class="cart-empty">
 		<p class="empty-text">还没有添加商品</p>
 		<div class="back-icon">
-		<img src="assets/img/shopCart/backText.png" alt=""></div>
+		<img src="assets/img/ShopCartScene/backText.png" alt=""></div>
 	</div>
 	<div class="shop-cart-wrapper clearfix" fe-role="Scroll" fe-cfg="scroll_dir:h, auto_list_width:yes, scroll_right_padding: 3rem">
 		<div class="scroll-list" id="shop-cart-wrapper"></div>

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

@@ -18,7 +18,7 @@ body {
 @import './style/DownloadScene.less';
 @import './style/RepeatLoginScene.less';
 @import './style/BuyConfirmScene.less';
-@import './style/DelConfrimScene.less';
+@import './style/DelConfirmScene.less';
 @import './style/QuitConfirmScene.less';
 @import './style/DataBuildingScene.less';
 @import './style/ShopCartScene.less';

+ 15 - 17
src/stage/index/scene/CLScene.js

@@ -49,7 +49,7 @@ class CLScene extends scene {
             const { id, title, subTitle, coverUrl, auth, goods } = dataset[i];
             let price = '';
             if (goods && goods.length >= 1) {
-              price = goods[0].terminalPrice;
+                price = goods[0].terminalPrice;
             }
 
             let item = document.createElement('li');
@@ -58,25 +58,25 @@ class CLScene extends scene {
             item.setAttribute('fe-role', 'Widget');
 
             if (0 == i) {
-              //第一个课程设为默认父组件的默认焦点子组件
-              item.setAttribute('fe-cfg', 'default_focus:yes');
+                //第一个课程设为默认父组件的默认焦点子组件
+                item.setAttribute('fe-cfg', 'default_focus:yes');
             }
 
             let itemDataset = {}
             if (this.sceneType == 'periphery') {
-              itemDataset = {
-                title,
-                price,
-                correlative: subTitle,
-                img: Consts.IMG_PATH + '/' + coverUrl
-              }
+                itemDataset = {
+                    title,
+                    price,
+                    correlative: subTitle,
+                    img: Consts.IMG_PATH + '/' + coverUrl
+                }
             } else {
-              itemDataset = {
-                subject: title,
-                subjectSub: subTitle,
-                buyed: auth,
-                img: Consts.IMG_PATH+ '/' + coverUrl
-              }
+                itemDataset = {
+                    subject: title,
+                    subjectSub: subTitle,
+                    buyed: auth,
+                    img: Consts.IMG_PATH+ '/' + coverUrl
+                }
             }
 
             item.innerHTML = component.createHTMLString(itemDataset);
@@ -264,8 +264,6 @@ class CLScene extends scene {
 
     onKeydown(e) {
         if (e.keyCode == Consts.KEYCODE_LEFT && e.target.id == 'cl-shopping-cart-btn') {
-        //if (e.keyCode == Consts.KEYCODE_LEFT && e.target.con.classList.contains('shopping-cart-btn-frame')) {
-            // console.log(document.getElementById('no-content-message').style.display);
             //无内容,直接返回
             if (this.noContent) {
               return;

+ 10 - 10
src/stage/index/scene/CourseScene.js

@@ -236,7 +236,7 @@ class CourseScene extends scene {
 					}
 				}
 			}
-  	}
+  		}
 		return {images, videos};
 	}
 
@@ -254,18 +254,18 @@ class CourseScene extends scene {
 			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: {
+	    //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
-      }
+			}
 		}});
 		return true;
 	}
@@ -287,7 +287,7 @@ class CourseScene extends scene {
 
 	onResume(data) {
 		if (!data) { return }
-		if ('courseCheckBuyScene' === data.backScene) {
+		if ('BuyConfirmScene' === data.backScene) {
 			if ('goBuy' === data.mode) {
 				//TODO:需降低耦合,统一管理路由,暂时先造个对象
 				this.navSwitch({ target: { id: 'course-tab-detail' } });

+ 3 - 3
src/stage/index/scene/DelConfirmScene.js

@@ -5,11 +5,11 @@ class DelConfirmScene extends scene {
 	}
 
 	onCreate(data) {
-		this.setContentView(require('../../../res/tpl/DelConfrimScene.tpl'), {}, 'DelConfirmScene', {
+		this.setContentView(require('../../../res/tpl/DelConfirmScene.tpl'), {}, 'DelConfirmScene', {
 			'isParentShow': true
 		}, () => {
 			let delName = document.querySelector('#del-name');
-			if ('shop-cart' == data.parentScene) {
+			if ('ShopCartScene' == data.parentScene) {
 				delName.innerHTML = `确认删除“${data.title}”吗?`;
 				this.moye.root.reRender();
 				// 默认光标指向取消按钮
@@ -80,4 +80,4 @@ class DelConfirmScene extends scene {
 	}
 }
 
-module.exports = DelConfrimScene;
+module.exports = DelConfirmScene;

+ 1 - 1
src/stage/index/scene/DownloadManagerScene.js

@@ -187,7 +187,7 @@ class DownloadManagerScene extends scene {
             let lessonID = e.target.con.dataset.id;
             let title = this.lessonItems[lessonID].lessonName;
             let parentScene = 'DownloadManager';
-            this.showScene(require('./ShopCartCheckDelScene.js'), { parentScene, lessonID, title });
+            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;

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

@@ -20,8 +20,8 @@ class GlobalGoodDetailScene extends scene {
         let goodsItem = {};
         let terminalPrice = 0;
         if (goods && goods.length >= 1) {
-          goodsItem = goods[0];
-          terminalPrice = goods[0].terminalPrice || 0;
+            goodsItem = goods[0];
+            terminalPrice = goods[0].terminalPrice || 0;
         }
         let oneRem = (document.documentElement.clientWidth / 1920) * 100;
         document.getElementById('ggd-detail-title').innerHTML = title + ' ' + subTitle;
@@ -44,22 +44,22 @@ class GlobalGoodDetailScene extends scene {
         let addCartBoughtHTML = `<div id="add-cart-btn" class="add-shop-cart-btn-frame" fe-role="Widget"><img src="./assets/img/course/detail/periphery_added.png" /></div>`;
 
         if (relatedCourses && relatedCourses.length) {
-          //可能会有多个相关的课程,这里只取第一个
-          const courseId = relatedCourses[0].id;
-          const gotoCourseHTML= `<div id="goto-course-btn" data-course_id="${courseId}" class="play-btn-frame" fe-role="Widget"><img src="./assets/img/GlobalGoodDetail/play_course.png" /></div>`;
-          btnWrapper.innerHTML = goodsItem.isInCart ? `${addCartBoughtHTML}${gotoCourseHTML}` : `${addCartHTML}${gotoCourseHTML}`;
-          this.moye.root.reRender();
+            //可能会有多个相关的课程,这里只取第一个
+            const courseId = relatedCourses[0].id;
+            const gotoCourseHTML= `<div id="goto-course-btn" data-course_id="${courseId}" class="play-btn-frame" fe-role="Widget"><img src="./assets/img/GlobalGoodDetail/play_course.png" /></div>`;
+            btnWrapper.innerHTML = goodsItem.isInCart ? `${addCartBoughtHTML}${gotoCourseHTML}` : `${addCartHTML}${gotoCourseHTML}`;
+            this.moye.root.reRender();
         } else {
-          btnWrapper.innerHTML = goodsItem.isInCart ? `${addCartBoughtHTML}` : `${addCartHTML}`;
-          this.moye.root.reRender();
+            btnWrapper.innerHTML = goodsItem.isInCart ? `${addCartBoughtHTML}` : `${addCartHTML}`;
+            this.moye.root.reRender();
         }
 
         // 光标处理
         if (goodsItem.isInCart) {
-          let addCartBtn = FocusEngine.getWidgetById('add-cart-btn');
-  				addCartBtn.con.classList.add('added');
-  				addCartBtn.con.classList.remove('add-cart');
-          addCartBtn.con.children[0].src = goodsItem.isInCart ? './assets/img/course/detail/periphery_added.png' : './assets/img/GlobalGoodDetail/add_shop_cart.png';
+            let addCartBtn = FocusEngine.getWidgetById('add-cart-btn');
+            addCartBtn.con.classList.add('added');
+            addCartBtn.con.classList.remove('add-cart');
+            addCartBtn.con.children[0].src = goodsItem.isInCart ? './assets/img/course/detail/periphery_added.png' : './assets/img/GlobalGoodDetail/add_shop_cart.png';
         }
     }
 
@@ -180,8 +180,8 @@ class GlobalGoodDetailScene extends scene {
         }
 
         if (e.target.con.classList.contains('shopping-cart-btn-frame')) {
-          if (-1 !== this.moye.focusList.indexOf('shop-cart')) {
-            this.hideScene({}, 'shop-cart');
+          if (-1 !== this.moye.focusList.indexOf('ShopCartScene')) {
+            this.hideScene({}, 'ShopCartScene');
           } else {
             this.hideScene();
             this.showScene(require('./ShopCartScene.js'), {});
@@ -195,8 +195,8 @@ class GlobalGoodDetailScene extends scene {
           if (courseId) {
             //如果已在moye stack中, 则直接显示已有的
             let passData = { id: courseId };
-            if ( -1 !== this.moye.focusList.indexOf('course')){
-              this.hideScene(passData, 'course');
+            if ( -1 !== this.moye.focusList.indexOf('CourseScene')){
+              this.hideScene(passData, 'CourseScene');
             } else {
               this.showScene(require('./CourseScene.js'), passData);
             }

+ 59 - 58
src/stage/index/scene/ImageWareFullScreenScene.js

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

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

@@ -179,7 +179,7 @@ class ShopCartScene extends scene {
 			let GlobalGoodDetailScene = document.getElementById('GlobalGoodDetailScene')
 			if (e.target.con.dataset.type === Consts.TYPE_COURSE) {
 				if (courseScene) {
-					this.hideScene({ id }, 'course');
+					this.hideScene({ id }, 'CourseScene');
 					return;
 				}
 				this.showScene(require('./CourseScene.js'), { id });
@@ -202,7 +202,7 @@ class ShopCartScene extends scene {
 		if (e.target.con.classList.contains('goods-wrapper')) {
 			this.showDelIcon(e);
 		}
-    if (e.target.con.classList.contains('del')) {
+    	if (e.target.con.classList.contains('del')) {
 			this.showDelIcon(e, true);
 		}
 	}

+ 5 - 5
src/stage/index/scene/VideoWareFullScreenScene.js

@@ -104,17 +104,17 @@ class VideoWareFullScreenScene extends scene {
             this.videoPlayer = window.efunbox;
         } else {
     		const videoDom = `<video id="hls-full-video" controls>你的浏览器不支持视频播放</video>`;
-    		document.getElementById('videoWareFullScreen').innerHTML = videoDom;
+    		document.getElementById('VideoWareFullScreen').innerHTML = videoDom;
     		this.videoPlayer = new HlsVideoPlugin();
     		this.videoPlayer.initH5Player(playUrl, 'hls-full-video');
         }
     }
 
     onCreate(data) {
-    this.wareList = data.wareList;
-    this.curWareIndex = data.curWareIndex;
-    const curWareItem = this.wareList[this.curWareIndex];
-    	this.setContentView(require('../../../res/tpl/VideoWareFullScreen.tpl'), {}, 'videoWareFullScreen', {}, () => {
+        this.wareList = data.wareList;
+        this.curWareIndex = data.curWareIndex;
+        const curWareItem = this.wareList[this.curWareIndex];
+    	this.setContentView(require('../../../res/tpl/VideoWareFullScreen.tpl'), {}, 'VideoWareFullScreen', {}, () => {
             if (data.isFull && window.efunbox) {
                 window.efunbox.fullScreen();
                 this.videoPlayer = window.efunbox;

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

@@ -80,10 +80,10 @@
 				}
 
 				&.list {
-					background-image: url("assets/img/course/list.png");
+					background-image: url("assets/img/CourseScene/list.png");
 
 					&.selected {
-						background-image: url("assets/img/course/list_selected.png");
+						background-image: url("assets/img/CourseScene/list_selected.png");
 					}
 
 					&::after {
@@ -96,10 +96,10 @@
 				}
 
 				&.detail {
-					background-image: url("assets/img/course/course_buy.png");
+					background-image: url("assets/img/CourseScene/course_buy.png");
 
 					&.selected {
-						background-image: url("assets/img/course/course_buyed.png");
+						background-image: url("assets/img/CourseScene/course_buyed.png");
 					}
 
 					&::after {
@@ -112,10 +112,10 @@
 				}
 
 				&.periphery {
-					background-image: url("assets/img/course/periphery.png");
+					background-image: url("assets/img/CourseScene/periphery.png");
 
 					&.selected {
-						background-image: url("assets/img/course/periphery_selected.png");
+						background-image: url("assets/img/CourseScene/periphery_selected.png");
 					}
 
 					&::after {
@@ -128,10 +128,10 @@
 				}
 
 				&.collect {
-					background-image: url("assets/img/course/collect.png");
+					background-image: url("assets/img/CourseScene/collect.png");
 
 					&.selected {
-						background-image: url("assets/img/course/collected.png");
+						background-image: url("assets/img/CourseScene/collected.png");
 					}
 
 					&::after {
@@ -148,7 +148,7 @@
 				}
 
 				&.cart {
-					background-image: url("assets/img/course/cart.png");
+					background-image: url("assets/img/CourseScene/cart.png");
 
 					.cart-num {
 						position: absolute;
@@ -164,7 +164,7 @@
 					}
 
 					&.selected {
-						background-image: url("assets/img/course/cart_selected.png");
+						background-image: url("assets/img/CourseScene/cart_selected.png");
 					}
 
 					&::after {

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

@@ -1,4 +1,5 @@
 @import "./Mixins.less";
+
 #LessonScene {
 	position: absolute;
 	left: 0;

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

@@ -92,7 +92,7 @@
 				margin-right: auto;
 				border-radius: 0.45rem;
 				border: solid unit(0.05, rem) transparent;
-				background: url('assets/img/shopCart/del.png') no-repeat center;
+				background: url('assets/img/ShopCartScene/del.png') no-repeat center;
 				background-size: cover;
 
 				&.fe-focus {
@@ -110,7 +110,7 @@
 		height: 0.9rem;
 		border-radius: 0.43rem;
 		border: solid unit(0.05, rem) transparent;
-		background: url('assets/img/shopCart/send.png') no-repeat center;
+		background: url('assets/img/ShopCartScene/send.png') no-repeat center;
 		background-size: cover;
 
 		&.fe-focus {

+ 3 - 7
src/util/API/APIClient.js

@@ -69,13 +69,9 @@ class APIClient {
 	// 获取标签组下的标签列表
 	static getTagListByGroupCode(type, callback) {
 		const typeToCode = {
-			'RESOURCE': 'RESOURCE',                 //教学资源
-			'TRAINING': 'TRAINING',                 //师训
-			'PERIPHERY': 'PERIPHERY',               //配套
-			'SYNC': 'SYNC',
-			'STYLE': 'STYLE',
-			'INTEREST': 'INTEREST',
-			'DEFAULT': 'DEFAULT',
+			'RESOURCE': 'BABY_RESOURCE',
+			'TRAINING': 'BABY_TRAINING',
+			'PERIPHERY': 'BABY_SUPPORT',
 		};
 		let params = APIClient.addCacheParam({});
 		AJAXHelper.get(`/tagGroup/${typeToCode[type]}`, params, callback);