123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290 |
- $(function () {
- function initaveragescoreEcharts (list) {
- var itemStyle = {
- normal: {
- label: {
- show: true, //开启显示数值
- position: "top" //数值在上方显示
- }
- }
- };
- var avgscore = [],xAxis_data=[],totalScore = 0;
- var curlegend = [ "平均分"];
- $.each(list.pjf, function (idx, item) {
- totalScore += item.classavgscore;
- avgscore.push(item.classavgscore);
- xAxis_data.push(item.classname)
- })
- var gradeAvgScore = Math.floor(totalScore / xAxis_data.length);
- var curseries = [
- {
- name: "平均分",
- type: "bar",
- barWidth: $.UnitUtil.mm2px(5),
- // 柱状图最小高度
- barMinHeight: $.UnitUtil.mm2px(2),
- barGap: 0,
- data: avgscore,
- itemStyle: itemStyle,
- markLine: {
- precision: 0,
- data: [{ type: "average", name: "平均值" }],
- itemStyle: {
- normal: {
- lineStyle: {
- color: "#ff001e",
- type: "dotted"
- },
- label: {
- show: true,
- color: "#ff001e",
- position: "insideEndTop",
- formatter: function () {
- return "年级平均分:" + gradeAvgScore;
- }
- }
- }
- },
- large: true
- },
- z: 10
- }
- ];
- var option = {
- animation: false,
- color: ["#5C99FF", "#FF5F56", "#5EC5C8", "#f1982b"],
- title: {
- text: "分",
- x: "left",
- y: "top",
- textStyle: {
- color: "#5F6E82",
- fontSize: $.UnitUtil.mm2px(3),
- fontWeight: 500
- }
- },
- legend: {
- itemWidth: $.UnitUtil.mm2px(2),
- itemHeight: $.UnitUtil.mm2px(2),
- top: "bottom",
- data: curlegend
- },
- grid: {
- top: $.UnitUtil.mm2px(10),
- left: 0,
- right: 0,
- bottom: $.UnitUtil.mm2px(8),
- containLabel: true
- },
- xAxis: [
- {
- type: "category",
- data: xAxis_data,
- axisLabel: {
- color: "#5F6E82" //更改坐标轴文字颜色
- },
- axisTick: {
- alignWithLabel: true
- },
- boundaryGap: true,
- triggerEvent: true,
- axisLine: {
- show: true, //是否显示轴线
- lineStyle: {
- color: "#DADADA" //刻度线的颜色
- }
- }
- }
- ],
- yAxis: [
- {
- type: "value",
- axisTick: {
- show: false //刻度
- },
- axisLine: {
- show: false, //是否显示轴线
- lineStyle: {
- color: "#DADADA" //刻度线的颜色
- }
- },
- splitLine: {
- //网格线
- lineStyle: {
- type: "dotted" //设置网格线类型 dotted:虚线 solid:实线
- },
- show: true //隐藏或显示
- },
- axisLabel: {
- color: "#5F6E82" //更改坐标轴文字颜色
- }
- }
- ],
- series: curseries
- };
- var myEcharts = echarts.init(
- document.querySelector(".section2 #averagescoreEcharts")
- );
- myEcharts.clear();
- myEcharts.setOption(option);
- }
- function achievementdistributiontable (list) {
- var table = "", goodTableHeadTr1Html = '<th class="dj">等级</th><th class="pm">排名(年级/名)</th><th class="dj">人数</th><th class="comm">详情</th>',
- trHtml = "";
- $.each(list.djtj, function (idx, item) {
- var stujson = JSON.parse(item.stujson),stuarr = "";
- $.each(stujson, function (index, items) {
- stuarr+=items.studentname+"("+items.schoolrank+"名)、"
- })
- stuarr = stuarr.substr(0, stuarr.length - 1);
- trHtml += '<tr><td>' + item.rankname + "类</td><td>" + item.rankrange + "</td><td>" +
- item.stunum+"</td><td>"+stuarr+"</td></tr>";
- })
-
- table = '<table border="1" class="my_table"><thead><tr class="goodTableHeadTr1">' +
- goodTableHeadTr1Html + '</tr></thead><tbody class="goodTableTbody">' +
- trHtml + '</tbody></table>'
- $(".section2 .achievementdistribution").html(table)
- }
- function progresstable (list) {
- var table = "", trHtml={1:"",2:""};
- var cjdjheight = $(".section2_1 .cjdjheight").height() - 454;
- var surplus = pageheight - cjdjheight; //本页剩余高度
- var height = 0,page = {1:"",2:""},ispage = false;
- $.each(list.dfjb, function (idx, item) {
- if (idx % 2 == 0) {
- height += 27.5;
- if (height > surplus && surplus - height < 27.5) {
- ispage = true;
- }
- if (ispage) {
- trHtml[2] += '<tr><td>' + (idx+1) + '</td><td>' + item.username + '</td><td>' + item.score + '分</td><td>第' +
- item.classrank + '名</td><td class="green">进步' + item.classrankpre + '名</td>';
- } else {
- trHtml[1] += '<tr><td>' + (idx+1) + '</td><td>' + item.username + '</td><td>' + item.score + '分</td><td>第' +
- item.classrank + '名</td><td class="green">进步' + item.classrankpre + '名</td>';
- }
- } else {
- if (ispage) {
- trHtml[2]+= '<td>' + (idx+1) + '</td><td>' + item.username + '</td><td>' + item.score + '分</td><td>第' +
- item.classrank + '名</td><td class="green">进步' + item.classrankpre + '名</td>';
- } else {
- trHtml[1] += '<td>' + (idx+1) + '</td><td>' + item.username + '</td><td>' + item.score + '分</td><td>第' +
- item.classrank + '名</td><td class="green">进步' + item.classrankpre + '名</td>';
- }
-
- }
- })
- for (var i = 1; i < 3; i++){
- page[i]='<table border="1" class="my_table"><tbody class="goodTableTbody">' +
- trHtml[i] + '</tbody></table>'
- }
- $(".section2_1 .progress").html(page[1])
- if (ispage) {
- //添加第二页
- $(".section2_1").after(
- '<div class="page_root section2 section2_2"></div>'
- );
- $(".section2_2").html(page[2]);
- }
- }
-
- function retrogression (list) {
- var trHtml = "", table = "";
- $.each(list.dftb, function (idx, item) {
- item.classrankpre = Math.abs(item.classrankpre)
- if (idx % 2 == 0) {
- trHtml += '<tr><td>' + (idx+1) + '</td><td>' + item.username + '</td><td>' + item.score + '分</td><td>第' +
- item.classrank + '名</td><td class="red">退步' + item.classrankpre + '名</td>';
-
- } else {
- trHtml += '<td>' + (idx+1) + '</td><td>' + item.username + '</td><td>' + item.score + '分</td><td>第' +
- item.classrank + '名</td><td class="red">退步' + item.classrankpre + '名</td>';
- }
- })
- var table ='<table border="1" class="my_table"><tbody class="goodTableTbody">' +
- trHtml + '</tbody></table>'
- $(".section2 .retrogression").html(table)
- }
-
- function critical (list) {
- var trHtml = "", table = "";
- $.each(list.ljs, function (idx, item) {
- if (idx % 2 == 0) {
- trHtml += '<tr><td>' + (idx+1) + '</td><td>' + item.username + '</td><td>' + item.score + '分</td><td>第' +
- item.classrank + '分</td><td class="red">' + item.classrankpre + '分</td>';
-
- } else {
- trHtml += '<td>' + (idx+1) + '</td><td>' + item.username + '</td><td>' + item.score + '分</td><td>第' +
- item.classrank + '分</td><td class="red">' + item.classrankpre + '分</td>';
- }
- })
- var table ='<table border="1" class="my_table"><tbody class="goodTableTbody">' +
- trHtml + '</tbody></table>'
- $(".section2 .critical").html(table)
- }
-
- function wave (list) {
- var trHtml = "", table = "";
- $.each(list.bds, function (idx, item) {
- var curdata = {
- class: "red",
- name :"退步"
- }
- if (item.classrankpre > 0) {
- curdata = {
- class: "green",
- name :"进步"
- }
- }
- item.classrankpre = Math.abs(item.classrankpre)
- if (idx % 2 == 0) {
- trHtml += '<tr><td>' + (idx+1) + '</td><td>' + item.username + '</td><td>' + item.score + '分</td><td>' +
- item.classrank + '分</td><td class="'+curdata.class+'">'+curdata.name + item.classrankpre + '名</td>';
-
- } else {
- trHtml += '<td>' + (idx+1) + '</td><td>' + item.username + '</td><td>' + item.score + '分</td><td>' +
- item.classrank + '分</td><td class="'+curdata.class+'">'+curdata.name + item.classrankpre + '名</td>';
- }
- })
- var table ='<table border="1" class="my_table"><tbody class="goodTableTbody">' +
- trHtml + '</tbody></table>'
- $(".section2 .wave").html(table)
- }
-
- function errquestion (list) {
- console.log(list.gpctList);
- var table = "", goodTableHeadTr1Html = '<th>题号</th><th>题型</th><th>知识点</th><th>班级得分率</th><th>与年级差值</th><th>高频错误项</th>',
- trHtml = "";
- $.each(list.gpctList, function (idx, item) {
- item.answer = JSON.parse(item.answer);
- trHtml += '<tr><td>第' + item.qn + "题</td><td>" + item.eptname + "</td><td>" +
- item.pointnames+"</td><td>"+item.classsrate+'%</td><td>'+item.gradesrate+'%</td><td>'+item.answer[0]+"</td></tr>";
- })
-
- table = '<table border="1" class="my_table"><thead><tr class="goodTableHeadTr1">' +
- goodTableHeadTr1Html + '</tr></thead><tbody class="goodTableTbody">' +
- trHtml + '</tbody></table>'
- $(".section2 .errquestion").html(table)
- }
- var parameter = $(".section_2_html_root").data("page-params");
- parameter = JSON.parse(parameter);
- console.log(parameter[0]);
- var curdata = parameter[0];
- $(".section2 .subjectinfo").text(curdata.subjectname + "概况");
- $(".section2 .classavgscore").text(curdata.classavgscore);
- $(".section2 .classavgscorerank").text(curdata.classavgscorerank);
- $(".section2 .yxrate").text(curdata.yxrate);
- $(".section2 .jgrate").text(curdata.jgrate);
- $(".section2 .classmaxscore").text(curdata.classmaxscore);
- $(".section2 .schoolavgscore").text(curdata.schoolavgscore);
- $(".section2 .schoolmaxscore").text(curdata.schoolmaxscore);
- initaveragescoreEcharts(curdata);
- achievementdistributiontable(curdata);
- progresstable(curdata);
- retrogression(curdata);
- critical(curdata);
- wave(curdata);
- errquestion(curdata)
- document.documentElement.scrollTop = 6000;
- });
|