|
@@ -1,6 +1,7 @@
|
|
import APIClient from '../../../util/API/APIClient';
|
|
import APIClient from '../../../util/API/APIClient';
|
|
import Consts from '../../../util/Consts';
|
|
import Consts from '../../../util/Consts';
|
|
import CourseItem from '../../../component/CourseItem';
|
|
import CourseItem from '../../../component/CourseItem';
|
|
|
|
+import TrainingItem from '../../../component/TrainingItem';
|
|
import GoodsItem from '../../../component/GoodsItem';
|
|
import GoodsItem from '../../../component/GoodsItem';
|
|
import ScrollEventPlugin from '../../../util/ScrollEventPlugin';
|
|
import ScrollEventPlugin from '../../../util/ScrollEventPlugin';
|
|
import NotificationCenter from '../../../util/NotificationCenter';
|
|
import NotificationCenter from '../../../util/NotificationCenter';
|
|
@@ -14,6 +15,7 @@ class CLScene extends scene {
|
|
this.hasNextPage = false;
|
|
this.hasNextPage = false;
|
|
this.currentIndex = 1;
|
|
this.currentIndex = 1;
|
|
this.noContent = false;
|
|
this.noContent = false;
|
|
|
|
+ this.trainingMap = {};
|
|
}
|
|
}
|
|
|
|
|
|
renderLeftTagList(dataset) {
|
|
renderLeftTagList(dataset) {
|
|
@@ -45,21 +47,35 @@ class CLScene extends scene {
|
|
document.getElementById('no-content-message').style.display = this.noContent ? '' : 'none';
|
|
document.getElementById('no-content-message').style.display = this.noContent ? '' : 'none';
|
|
|
|
|
|
for (let i in dataset) {
|
|
for (let i in dataset) {
|
|
- const { id, title, subTitle, coverUrl, auth, goods, redDot, openTime, closeTime, dateDesc } = dataset[i];
|
|
|
|
|
|
+ const { id, title, subTitle, coverUrl, auth, goods, redDot, imgList, openTime, closeTime, dateDesc } = dataset[i];
|
|
|
|
|
|
// 提取价格
|
|
// 提取价格
|
|
let price = '';
|
|
let price = '';
|
|
if (goods && goods.length >= 1) {
|
|
if (goods && goods.length >= 1) {
|
|
price = goods[0].terminalPrice;
|
|
price = goods[0].terminalPrice;
|
|
}
|
|
}
|
|
|
|
+ //师训详情图片的加载
|
|
|
|
+ this.trainingMap[id] = imgList;
|
|
|
|
+ if (imgList) {
|
|
|
|
+ for (let index in imgList) {
|
|
|
|
+ let imgSrc = Consts.IMG_PATH + '/' + imgList[index];
|
|
|
|
+ let image = new Image();
|
|
|
|
+ image.src = imgSrc;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
let item = document.createElement('li');
|
|
let item = document.createElement('li');
|
|
|
|
+ // 为training item 添加不同样式
|
|
|
|
+ if (this.sceneType == 'guidance') {
|
|
|
|
+ item.setAttribute('class', 'training-item');
|
|
|
|
+ } else {
|
|
|
|
+ item.setAttribute('class', 'item');
|
|
|
|
+ }
|
|
item.setAttribute('id', `item-${id}`);
|
|
item.setAttribute('id', `item-${id}`);
|
|
-
|
|
|
|
- item.setAttribute('class', 'item');
|
|
|
|
item.setAttribute('fe-role', 'Widget');
|
|
item.setAttribute('fe-role', 'Widget');
|
|
|
|
|
|
- if (0 == i) {
|
|
|
|
|
|
+
|
|
|
|
+ if (0 == i) {
|
|
//第一个课程设为默认父组件的默认焦点子组件
|
|
//第一个课程设为默认父组件的默认焦点子组件
|
|
item.setAttribute('fe-cfg', 'default_focus:yes');
|
|
item.setAttribute('fe-cfg', 'default_focus:yes');
|
|
}
|
|
}
|
|
@@ -72,6 +88,13 @@ class CLScene extends scene {
|
|
correlative: subTitle,
|
|
correlative: subTitle,
|
|
img: Consts.IMG_PATH + '/' + coverUrl
|
|
img: Consts.IMG_PATH + '/' + coverUrl
|
|
}
|
|
}
|
|
|
|
+ } else if (this.sceneType == 'guidance') {
|
|
|
|
+ itemDataset = {
|
|
|
|
+ subject: title || '',
|
|
|
|
+ subjectSub: subTitle || '',
|
|
|
|
+ isNew: redDot ? true : false,
|
|
|
|
+ img: Consts.IMG_PATH + '/' + coverUrl,
|
|
|
|
+ };
|
|
} else {
|
|
} else {
|
|
itemDataset = {
|
|
itemDataset = {
|
|
subject: title,
|
|
subject: title,
|
|
@@ -87,6 +110,18 @@ class CLScene extends scene {
|
|
this.moye.root.reRender();
|
|
this.moye.root.reRender();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ loadTrainingList(tagId, index) {
|
|
|
|
+ APIClient.getProductListByTagId(tagId, index, (isTrue, res) => {
|
|
|
|
+ if (!isTrue) { return; }
|
|
|
|
+ if (!res.success) { return; }
|
|
|
|
+ const { pageNo, pageSize, totalSize, list } = res.data || {};
|
|
|
|
+ this.hasNextPage = pageNo * pageSize < totalSize ? true : false;
|
|
|
|
+ this.currentIndex = pageNo;
|
|
|
|
+ this.renderRightContentList(list, TrainingItem, index > 1);
|
|
|
|
+ this.rightScrollEvent.releaseEventLock();
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
initLeftTabOnFocus() {
|
|
initLeftTabOnFocus() {
|
|
let leftScroll = this.moye.root.getWidgetById('cl-left-tab-scroll');
|
|
let leftScroll = this.moye.root.getWidgetById('cl-left-tab-scroll');
|
|
leftScroll.on('focus', e => {
|
|
leftScroll.on('focus', e => {
|
|
@@ -99,6 +134,10 @@ class CLScene extends scene {
|
|
this.loadPeripheryList(this.selectedTagId, 1);
|
|
this.loadPeripheryList(this.selectedTagId, 1);
|
|
} else if (this.sceneType == 'collection') {
|
|
} else if (this.sceneType == 'collection') {
|
|
this.loadCollectionList(this.selectedTagId, 1);
|
|
this.loadCollectionList(this.selectedTagId, 1);
|
|
|
|
+ } else if (this.sceneType == 'training') {
|
|
|
|
+ this.loadTrainingList(this.selectedTagId, 1);
|
|
|
|
+ } else if (this.sceneType == 'guidance') {
|
|
|
|
+ this.loadGuidanceList(this.selectedTagId, 1);
|
|
} else {
|
|
} else {
|
|
this.loadCourseList(this.selectedTagId, 1);
|
|
this.loadCourseList(this.selectedTagId, 1);
|
|
}
|
|
}
|
|
@@ -108,7 +147,6 @@ class CLScene extends scene {
|
|
initRightScrollReachEndEvent() {
|
|
initRightScrollReachEndEvent() {
|
|
this.rightScrollEvent.onScrollToBottom(() => {
|
|
this.rightScrollEvent.onScrollToBottom(() => {
|
|
if (!this.hasNextPage) { return; }//如果没有下一页了,则不继续下面的程序
|
|
if (!this.hasNextPage) { return; }//如果没有下一页了,则不继续下面的程序
|
|
-
|
|
|
|
if (this.sceneType == 'support') {
|
|
if (this.sceneType == 'support') {
|
|
this.loadPeripheryList(this.selectedTagId, this.currentIndex + 1);
|
|
this.loadPeripheryList(this.selectedTagId, this.currentIndex + 1);
|
|
} else if (this.sceneType == 'collection') {
|
|
} else if (this.sceneType == 'collection') {
|
|
@@ -159,11 +197,24 @@ class CLScene extends scene {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ loadGuidanceList(tagId, index) {
|
|
|
|
+ APIClient.getProductListByTagId(tagId, index, (isTrue, res) => {
|
|
|
|
+ if (!isTrue) { return; }
|
|
|
|
+ if (!res.success) { return; }
|
|
|
|
+ const { pageNo, pageSize, totalSize, list } = res.data || {};
|
|
|
|
+ this.hasNextPage = pageNo * pageSize < totalSize ? true : false;
|
|
|
|
+ this.currentIndex = pageNo;
|
|
|
|
+ this.renderRightContentList(list, TrainingItem, index > 1);
|
|
|
|
+ this.rightScrollEvent.releaseEventLock();
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
loadTagList() {
|
|
loadTagList() {
|
|
let type = {
|
|
let type = {
|
|
support: 'PERIPHERY',
|
|
support: 'PERIPHERY',
|
|
resource: 'RESOURCE',
|
|
resource: 'RESOURCE',
|
|
training: 'TRAINING',
|
|
training: 'TRAINING',
|
|
|
|
+ guidance: 'GUIDANCE',
|
|
}[this.sceneType] || 'RESOURCE';
|
|
}[this.sceneType] || 'RESOURCE';
|
|
|
|
|
|
APIClient.getTagListByGroupCode(type, (isTrue, res) => {
|
|
APIClient.getTagListByGroupCode(type, (isTrue, res) => {
|
|
@@ -189,6 +240,10 @@ class CLScene extends scene {
|
|
this.loadPeripheryList(this.selectedTagId, 1);
|
|
this.loadPeripheryList(this.selectedTagId, 1);
|
|
} else if (this.sceneType == 'collection') {
|
|
} else if (this.sceneType == 'collection') {
|
|
this.loadCollectionList(this.selectedTagId, 1);
|
|
this.loadCollectionList(this.selectedTagId, 1);
|
|
|
|
+ } else if (this.sceneType == 'training') {
|
|
|
|
+ this.loadTrainingList(this.selectedTagId, 1);
|
|
|
|
+ } else if (this.sceneType == 'guidance') {
|
|
|
|
+ this.loadGuidanceList(this.selectedTagId, 1);
|
|
} else {
|
|
} else {
|
|
this.loadCourseList(this.selectedTagId, 1);
|
|
this.loadCourseList(this.selectedTagId, 1);
|
|
}
|
|
}
|
|
@@ -259,13 +314,25 @@ class CLScene extends scene {
|
|
}
|
|
}
|
|
|
|
|
|
onKeydown(e) {
|
|
onKeydown(e) {
|
|
- if(e.keyCode == Consts.KEYCODE_RIGHT && e.target.con.classList.contains('item')){
|
|
|
|
- if(this.noContent){
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- //有内容
|
|
|
|
- FocusEngine.getWidgetById('cl-right-content-scroll').focus();
|
|
|
|
|
|
+ if (e.keyCode == Consts.KEYCODE_LEFT && e.target.id == 'cl-shopping-cart-btn') {
|
|
|
|
+ //无内容,直接返回
|
|
|
|
+ if (this.noContent) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ //有内容,禁用向左按钮
|
|
|
|
+ e.preventDefault();
|
|
|
|
+ e.stopPropagation();
|
|
|
|
+ //单独的Widget不能阻止焦点变换,只能强行重新获取焦点来实现禁用向左
|
|
|
|
+ FocusEngine.getWidgetById('cl-shopping-cart-btn').focus();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(e.keyCode == Consts.KEYCODE_RIGHT && e.target.con.classList.contains('item')){
|
|
|
|
+ if(this.noContent){
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
|
|
+ //有内容
|
|
|
|
+ FocusEngine.getWidgetById('cl-right-content-scroll').focus();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
onKeyup() {
|
|
onKeyup() {
|