Authored by 郭成尧

throttling

... ... @@ -54,6 +54,9 @@ class GradeDetailPage extends Page {
this.noListData = false;
this.graphData = {};
this.timer = null;
this.cacheMouthDetailResult = [];
this.graphRender();
this.monthDetailRender(true);
... ... @@ -81,30 +84,36 @@ class GradeDetailPage extends Page {
* 滑动事件处理
*/
dataZoomEvent() {
let optionData = this.eGradeGraph.getOption();
let endIndex = optionData.dataZoom[0].endValue;
if (this.timer) {
clearTimeout(this.timer);
}
let tapData = this.graphData.seriesData[endIndex];
this.timer = setTimeout(() => {
let optionData = this.eGradeGraph.getOption();
let endIndex = optionData.dataZoom[0].endValue;
this.year = tapData.year;
this.month = tapData.month;
this.page = 0;
let tapData = this.graphData.seriesData[endIndex];
this.refreshEchart(endIndex);
this.monthDetailRender(true);
this.year = tapData.year;
this.month = tapData.month;
this.page = 0;
if (window._yas && window._yas.sendCustomInfo) {
// 埋点
let C_ID = window._ChannelVary[window.cookie('_Channel')];
window._yas.sendCustomInfo({
op: 'YB_GRADE_DETAIL_GRAPH_DATAZOOM',
appop: 'YB_H5_GRADE_DETAIL_GRAPH_DATAZOOM',
param: JSON.stringify({
C_ID: C_ID
})
}, true);
}
this.refreshEchart(endIndex);
this.monthDetailRender(true);
if (window._yas && window._yas.sendCustomInfo) {
// 埋点
let C_ID = window._ChannelVary[window.cookie('_Channel')];
window._yas.sendCustomInfo({
op: 'YB_GRADE_DETAIL_GRAPH_DATAZOOM',
appop: 'YB_H5_GRADE_DETAIL_GRAPH_DATAZOOM',
param: JSON.stringify({
C_ID: C_ID
})
}, true);
}
}, 200);
}
/**
... ... @@ -208,6 +217,19 @@ class GradeDetailPage extends Page {
this.page++;
this.requesting = true;
let cacheResult = this.cacheMouthDetailResult[`${this.year}:${this.month}:${this.page}`];
if (cacheResult) {
if (isInit) {
this.view.gradeBillList.html(cacheResult);
} else {
this.view.gradeBillList.append(cacheResult);
}
this.requesting = false;
return;
}
this.ajax({
url: '/activity/grade/monthDetail',
data: {
... ... @@ -225,6 +247,7 @@ class GradeDetailPage extends Page {
this.view.gradeBillList.append(monthDetailPage);
}
this.cacheMouthDetailResult[`${this.year}:${this.month}:${this.page}`] = monthDetailPage;
return;
}
... ...