12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- $(function () {
- var parameter = $(".section_2_html_root").data("page-params");
- parameter = JSON.parse(parameter);
- var sectionsHtmlArr = [
- "section_2_class_all", //全科成绩对比
- "section_2_class_single", //单科成绩对比
- "section_2_level", //分数等级
- "section_2_part",
- "section_2_lin",
- "section_2_excellent"
- ];
- $(".section_2.score_analysis_root").html(sectionsHtmlArr.map(function (htmlName) {
- return "<div class='" + htmlName + "_html_root'></div>";
- }).join(""));
- var cjfx = parameter.cjfx;
- // 班级成绩分析
- var class_all_arr = [];
- var class_single_arr = [];
- var cjfx_s_index = 2;
- for (var s_key in cjfx) {
- var s_item = cjfx[s_key];
- if (s_key === "总分") {
- class_all_arr = s_item;
- } else {
- class_single_arr.push({
- subjectname: s_key,
- s_index: cjfx_s_index,
- arr: s_item
- });
- cjfx_s_index += 1;
- }
- }
- // ranktype 类型1等级2分数段3临界分4临界名次5优困生
- var djfx = parameter.djfx;
- var djfx_data = {};
- for (var djfx_s_index = 0; djfx_s_index < djfx.length; djfx_s_index++) {
- var djfx_item = djfx[djfx_s_index];
- if (!djfx_data[djfx_item.ranktype]) {
- djfx_data[djfx_item.ranktype] = {};
- }
- if (djfx_item.ranktype === 5) {
- $.each(djfx_item.ranks, function(rankIndex, rankItem) {
- rankItem.stujson = JSON.parse(rankItem.stujson);
- });
- }
- if (djfx_item.subjectid === "zf") {
- djfx_item.subjectname = "全科";
- }
- djfx_data[djfx_item.ranktype][djfx_item.subjectid] = djfx_item;
- }
- sectionsHtmlArr.forEach(function (htmlName) {
- if (htmlName === "section_2_class_all") {
- $(".section_2.score_analysis_root ." + htmlName + "_html_root").data("page-params", JSON.stringify({
- subjectname: "全科",
- arr: class_all_arr
- }));
- } else if (htmlName === "section_2_class_single") {
- $(".section_2.score_analysis_root ." + htmlName + "_html_root").data("page-params", JSON.stringify(class_single_arr));
- } else if (htmlName === "section_2_level") {
- $(".section_2.score_analysis_root ." + htmlName + "_html_root").data("page-params", JSON.stringify(djfx_data[1]));
- } else if (htmlName === "section_2_part") {
- $(".section_2.score_analysis_root ." + htmlName + "_html_root").data("page-params", JSON.stringify(djfx_data[2]));
- } else if (htmlName === "section_2_lin") {
- $(".section_2.score_analysis_root ." + htmlName + "_html_root").data("page-params", JSON.stringify({
- 3: djfx_data[3],
- 4: djfx_data[4]
- }));
- } else if (htmlName === "section_2_excellent") {
- $(".section_2.score_analysis_root ." + htmlName + "_html_root").data("page-params", JSON.stringify(djfx_data[5]));
- }
- $(".section_2.score_analysis_root ." + htmlName + "_html_root").load("./sections/scoreAnalysis/" + htmlName + ".html");
- });
- });
|