|
@@ -7,11 +7,11 @@ build();
|
|
|
publishReady();
|
|
|
|
|
|
function build() {
|
|
|
- if (dataStatic.code && dataStatic.code === '500') {
|
|
|
+ if (dataStatic.code && dataStatic.code === "500") {
|
|
|
var hTmpl = $("#page-error").html();
|
|
|
var $dom = tmpl(hTmpl, { message: dataStatic.message });
|
|
|
$bodyMain.append(createNewBox($dom));
|
|
|
- return
|
|
|
+ return;
|
|
|
}
|
|
|
var datas = dataParse(dataStatic);
|
|
|
|
|
@@ -34,7 +34,10 @@ function build() {
|
|
|
createBarPointChart(datas.basic_college, 22, "学院成绩分析", "barPointGrade");
|
|
|
createLineChart(datas.basic_main_question);
|
|
|
createLineReverseChart(datas.basic_question); // basic_sub_question
|
|
|
- createDiscriminationDifficultyLevel(datas.discrimination_level, "discrimination");
|
|
|
+ createDiscriminationDifficultyLevel(
|
|
|
+ datas.discrimination_level,
|
|
|
+ "discrimination"
|
|
|
+ );
|
|
|
createDiscriminationDifficultyLevel(datas.difficulty_level, "difficulty");
|
|
|
createBasicQuestion(datas.basic_question);
|
|
|
createBasicMainQuestion(datas.basic_main_question);
|
|
@@ -48,11 +51,11 @@ function build() {
|
|
|
}
|
|
|
|
|
|
function publishReady() {
|
|
|
- var eventEmitInterval = setInterval(function () {
|
|
|
+ var eventEmitInterval = setInterval(function() {
|
|
|
document.body.dispatchEvent(new Event("view-ready"));
|
|
|
}, 25);
|
|
|
|
|
|
- document.body.addEventListener("view-ready-acknowledged", function () {
|
|
|
+ document.body.addEventListener("view-ready-acknowledged", function() {
|
|
|
clearInterval(eventEmitInterval);
|
|
|
});
|
|
|
}
|
|
@@ -66,7 +69,7 @@ function createCover(cover) {
|
|
|
function createBarPointChart(dataList, splitRange, title, chartType) {
|
|
|
var hTmpl = $("#page-chart").html();
|
|
|
var labelHeight = Math.round(1170 / splitRange);
|
|
|
- sectionArr(dataList, splitRange).forEach(function (item) {
|
|
|
+ sectionArr(dataList, splitRange).forEach(function(item) {
|
|
|
var chartId = getEchartId();
|
|
|
var $dom = tmpl(hTmpl, {
|
|
|
title: title,
|
|
@@ -86,7 +89,7 @@ function createBarPointChart(dataList, splitRange, title, chartType) {
|
|
|
function createTeacherScore(dataList) {
|
|
|
var hTmpl = $("#teacher-score").html();
|
|
|
var splitList = sectionArr(dataList, 6);
|
|
|
- splitList.forEach(function (item) {
|
|
|
+ splitList.forEach(function(item) {
|
|
|
var chartId = getEchartId();
|
|
|
var $dom = tmpl(hTmpl, {
|
|
|
chartId: chartId,
|
|
@@ -103,7 +106,7 @@ function createTeacherScore(dataList) {
|
|
|
// 总明细表
|
|
|
if (splitList.length > 1) {
|
|
|
var hTmpl2 = $("#teacher-score-table").html();
|
|
|
- sectionArr(dataList, 26).forEach(function (item) {
|
|
|
+ sectionArr(dataList, 26).forEach(function(item) {
|
|
|
var $dom = tmpl(hTmpl2, {
|
|
|
dataList: item,
|
|
|
pageTableClass: "teacher-table"
|
|
@@ -116,21 +119,21 @@ function createTeacherScore(dataList) {
|
|
|
function createTeacherGrade(dataList) {
|
|
|
var hTmpl = $("#teacher-grade").html();
|
|
|
var sectionDataList = [];
|
|
|
- dataList.map(function (item) {
|
|
|
+ dataList.map(function(item) {
|
|
|
if (item.classes.length <= 8) {
|
|
|
- sectionDataList.push(item)
|
|
|
+ sectionDataList.push(item);
|
|
|
} else {
|
|
|
- sectionArr(item.classes, 7).forEach(function (elem) {
|
|
|
+ sectionArr(item.classes, 7).forEach(function(elem) {
|
|
|
sectionDataList.push({
|
|
|
name: item.name,
|
|
|
classes: elem
|
|
|
- })
|
|
|
+ });
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- sectionArr(sectionDataList, 3).forEach(function (item) {
|
|
|
- var chartList = item.map(function (elem) {
|
|
|
+ sectionArr(sectionDataList, 3).forEach(function(item) {
|
|
|
+ var chartList = item.map(function(elem) {
|
|
|
var chartId = getEchartId();
|
|
|
addEchart({
|
|
|
chartId: chartId,
|
|
@@ -148,9 +151,10 @@ function createTeacherGrade(dataList) {
|
|
|
|
|
|
// 大题难度分析
|
|
|
function createLineChart(dataList) {
|
|
|
+ if (!dataList.length) return;
|
|
|
if (dataList.length > 6) {
|
|
|
- createLineReverseChart(dataList, '大题难度分析');
|
|
|
- return
|
|
|
+ createLineReverseChart(dataList, "大题难度分析");
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
var hTmpl = $("#page-chart").html();
|
|
@@ -170,7 +174,7 @@ function createLineChart(dataList) {
|
|
|
// 小题难度分析
|
|
|
function createLineReverseChart(dataList, tableName) {
|
|
|
var hTmpl = $("#page-chart").html();
|
|
|
- sectionArr(dataList, 46).forEach(function (item) {
|
|
|
+ sectionArr(dataList, 46).forEach(function(item) {
|
|
|
var chartId = getEchartId();
|
|
|
var $dom = tmpl(hTmpl, {
|
|
|
title: tableName || "小题难度分析",
|
|
@@ -188,7 +192,7 @@ function createLineReverseChart(dataList, tableName) {
|
|
|
// 区分度等级分布,难度等级分布
|
|
|
function createDiscriminationDifficultyLevel(dataList, type) {
|
|
|
var hTmpl = $("#" + type + "-level-table").html();
|
|
|
- groupSectionArrDynamic(dataList, 30).forEach(function (item) {
|
|
|
+ groupSectionArrDynamic(dataList, 30).forEach(function(item) {
|
|
|
var $dom = tmpl(hTmpl, {
|
|
|
dataList: item
|
|
|
});
|
|
@@ -198,7 +202,7 @@ function createDiscriminationDifficultyLevel(dataList, type) {
|
|
|
// 题目统计特征
|
|
|
function createBasicQuestion(dataList) {
|
|
|
var hTmpl = $("#basic-question-table").html();
|
|
|
- sectionArr(dataList, 33).forEach(function (item) {
|
|
|
+ sectionArr(dataList, 33).forEach(function(item) {
|
|
|
var $dom = tmpl(hTmpl, {
|
|
|
dataList: item
|
|
|
});
|
|
@@ -208,7 +212,7 @@ function createBasicQuestion(dataList) {
|
|
|
// 大题结构特征
|
|
|
function createBasicMainQuestion(dataList) {
|
|
|
var hTmpl = $("#basic-main-question-table").html();
|
|
|
- sectionArr(dataList, 33).forEach(function (item) {
|
|
|
+ sectionArr(dataList, 33).forEach(function(item) {
|
|
|
var $dom = tmpl(hTmpl, {
|
|
|
dataList: item
|
|
|
});
|
|
@@ -221,8 +225,8 @@ function createBasicQuestionOption(data) {
|
|
|
var hTmpl = $("#basic-question-option-table").html();
|
|
|
// 选项多余7个会分组
|
|
|
var options = sectionArr(data.options, 8);
|
|
|
- sectionArr(data.questions, 32).forEach(function (item) {
|
|
|
- options.map(function (elem) {
|
|
|
+ sectionArr(data.questions, 32).forEach(function(item) {
|
|
|
+ options.map(function(elem) {
|
|
|
var $dom = tmpl(hTmpl, {
|
|
|
options: elem,
|
|
|
questions: item
|
|
@@ -234,7 +238,7 @@ function createBasicQuestionOption(data) {
|
|
|
// 考生分段比例
|
|
|
function createRangeLevel(dataList) {
|
|
|
var hTmpl = $("#range-level-table").html();
|
|
|
- sectionArr(dataList, 31).forEach(function (item) {
|
|
|
+ sectionArr(dataList, 31).forEach(function(item) {
|
|
|
var $dom = tmpl(hTmpl, {
|
|
|
dataList: item
|
|
|
});
|
|
@@ -243,14 +247,15 @@ function createRangeLevel(dataList) {
|
|
|
}
|
|
|
// 总分频率分布
|
|
|
function createRange10TotalScore(datas) {
|
|
|
- var pageList = [
|
|
|
- {
|
|
|
+ var pageList = [];
|
|
|
+ if (datas.total.length) {
|
|
|
+ pageList.push({
|
|
|
title: "总分频率分布分析",
|
|
|
dataList: datas.total
|
|
|
- }
|
|
|
- ];
|
|
|
+ });
|
|
|
+ }
|
|
|
pageList = pageList.concat(
|
|
|
- datas.classes.map(function (item) {
|
|
|
+ datas.classes.map(function(item) {
|
|
|
return {
|
|
|
title: item.name + " 总分频率分布",
|
|
|
dataList: item.ranges
|
|
@@ -258,7 +263,7 @@ function createRange10TotalScore(datas) {
|
|
|
})
|
|
|
);
|
|
|
var hTmpl = $("#range-totalScore").html();
|
|
|
- pageList.forEach(function (item, index) {
|
|
|
+ pageList.forEach(function(item, index) {
|
|
|
var chartId = getEchartId();
|
|
|
addEchart({
|
|
|
chartId: chartId,
|
|
@@ -280,14 +285,16 @@ function createRange10TotalScore(datas) {
|
|
|
}
|
|
|
// 总分一分一段表
|
|
|
function createRangeTotalScore(datas) {
|
|
|
- var pageList = [
|
|
|
- {
|
|
|
+ var pageList = [];
|
|
|
+ if (datas.total.length) {
|
|
|
+ pageList.push({
|
|
|
title: "总分一分一段表",
|
|
|
dataList: datas.total
|
|
|
- }
|
|
|
- ];
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
pageList = pageList.concat(
|
|
|
- datas.classes.map(function (item) {
|
|
|
+ datas.classes.map(function(item) {
|
|
|
return {
|
|
|
title: item.name + " 总分一分一段表",
|
|
|
dataList: item.ranges
|
|
@@ -295,8 +302,8 @@ function createRangeTotalScore(datas) {
|
|
|
})
|
|
|
);
|
|
|
var hTmpl = $("#range-totalScore").html();
|
|
|
- pageList.forEach(function (item, index) {
|
|
|
- sectionArr(item.dataList, 32).forEach(function (elem) {
|
|
|
+ pageList.forEach(function(item, index) {
|
|
|
+ sectionArr(item.dataList, 32).forEach(function(elem) {
|
|
|
var $dom = tmpl(hTmpl, {
|
|
|
title: item.title,
|
|
|
isOneStep: true,
|
|
@@ -311,8 +318,8 @@ function createRangeTotalScore(datas) {
|
|
|
// 六段频率统计
|
|
|
function createRangeSegment(dataList) {
|
|
|
var hTmpl = $("#range-segment-table").html();
|
|
|
- dataList.map(function (item) {
|
|
|
- sectionArrDynamic(item.groups, 30, 'segments').map(function (elem) {
|
|
|
+ dataList.map(function(item) {
|
|
|
+ sectionArrDynamic(item.groups, 30, "segments").map(function(elem) {
|
|
|
var $dom = tmpl(hTmpl, {
|
|
|
title: item.name + " 六段频率统计",
|
|
|
dataList: elem
|
|
@@ -352,7 +359,7 @@ function createNewBox(bodyDom, boxType) {
|
|
|
*
|
|
|
*/
|
|
|
function createEchart() {
|
|
|
- echartList.forEach(function (elem) {
|
|
|
+ echartList.forEach(function(elem) {
|
|
|
var charts = new Charts(
|
|
|
document.getElementById(elem.chartId),
|
|
|
elem.datas,
|
|
@@ -367,7 +374,7 @@ function createEchart() {
|
|
|
*/
|
|
|
function fillCatalogNum() {
|
|
|
var hTmpl = $("#page-foot").html();
|
|
|
- $(".report-box").each(function (index) {
|
|
|
+ $(".report-box").each(function(index) {
|
|
|
var page = index + 1;
|
|
|
var dom = tmpl(hTmpl, {
|
|
|
name: cover.name,
|
|
@@ -423,7 +430,10 @@ function sectionArrDynamic(arrayList, sectionMaxItemLength, childrenName) {
|
|
|
var splitSectionItemLen = 0;
|
|
|
var splitSectionArr = [];
|
|
|
for (var i = 0, len = arrayList.length; i < len; i++) {
|
|
|
- if (splitSectionItemLen + arrayList[i][childrenName].length > sectionMaxItemLength) {
|
|
|
+ if (
|
|
|
+ splitSectionItemLen + arrayList[i][childrenName].length >
|
|
|
+ sectionMaxItemLength
|
|
|
+ ) {
|
|
|
splitArr.push(splitSectionArr);
|
|
|
splitSectionItemLen = 0;
|
|
|
splitSectionArr = [];
|
|
@@ -436,18 +446,18 @@ function sectionArrDynamic(arrayList, sectionMaxItemLength, childrenName) {
|
|
|
}
|
|
|
/**
|
|
|
* 组元素过多,且无规律时,使用此方法更合理
|
|
|
- * @param {*} arrayList
|
|
|
- * @param {*} sectionMaxItemLength
|
|
|
- * @param {*} childrenName
|
|
|
+ * @param {*} arrayList
|
|
|
+ * @param {*} sectionMaxItemLength
|
|
|
+ * @param {*} childrenName
|
|
|
*/
|
|
|
function groupSectionArrDynamic(arrayList, sectionMaxItemLength) {
|
|
|
var splitArr = [];
|
|
|
var splitSectionItemLen = 0;
|
|
|
var splitSectionArr = [];
|
|
|
|
|
|
- arrayList.map(function (item) {
|
|
|
+ arrayList.map(function(item) {
|
|
|
var groupsList = [];
|
|
|
- item.groups.map(function (elem) {
|
|
|
+ item.groups.map(function(elem) {
|
|
|
splitSectionItemLen++;
|
|
|
groupsList.push(elem);
|
|
|
|
|
@@ -459,9 +469,8 @@ function groupSectionArrDynamic(arrayList, sectionMaxItemLength) {
|
|
|
splitArr.push(splitSectionArr);
|
|
|
splitSectionItemLen = 0;
|
|
|
splitSectionArr = [];
|
|
|
- groupsList = []
|
|
|
+ groupsList = [];
|
|
|
}
|
|
|
-
|
|
|
});
|
|
|
|
|
|
if (groupsList.length)
|
|
@@ -469,10 +478,8 @@ function groupSectionArrDynamic(arrayList, sectionMaxItemLength) {
|
|
|
name: item.name,
|
|
|
groups: groupsList
|
|
|
});
|
|
|
-
|
|
|
});
|
|
|
- if (splitSectionArr.length)
|
|
|
- splitArr.push(splitSectionArr);
|
|
|
+ if (splitSectionArr.length) splitArr.push(splitSectionArr);
|
|
|
|
|
|
return splitArr;
|
|
|
}
|