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,6 +84,11 @@ class GradeDetailPage extends Page {
* 滑动事件处理
*/
dataZoomEvent() {
if (this.timer) {
clearTimeout(this.timer);
}
this.timer = setTimeout(() => {
let optionData = this.eGradeGraph.getOption();
let endIndex = optionData.dataZoom[0].endValue;
... ... @@ -105,6 +113,7 @@ class GradeDetailPage extends Page {
})
}, 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;
}
... ...