var url="";
function slide(obj){ //查看详情
obj.closest(".star_box").siblings(".resolve").slideToggle(function(){
if($(".resolve").css("display") == "none")
obj.text("查看详情");
else
obj.text("收起详情");
});
}
function bar(index,data1,data2,answer,color,sum){ //柱状图
var myChart = echarts.init(document.getElementById('main'+index));
myChart.setOption({
color: ['#3398DB'],
tooltip : {
trigger: 'axis',
axisPointer : { // 坐标轴指示器,坐标轴触发有效
type : 'line' // 默认为直线,可选为:'line' | 'shadow'
},
formatter: function(params){
return params[0].name+"
占比:"+((params[0].value/sum)*100).toFixed(2)+"%
人数:"+params[0].value;
}
},
grid: {
top: 15,
left: '0%',
right: '0%',
bottom: '0%',
containLabel: true
},
xAxis : [
{
type : 'category',
data : data2,
axisTick: {
alignWithLabel: true
},
axisLabel: {
show:true,
textStyle:{
color: function (value){
console.log(value);
return value == answer ? '#75b3ff' : '#fcb35b';
}
}
}
}
],
yAxis : [
{
type : 'value',
max: function(value) {
return sum;
}
}
],
series : [
{
name:'选项人数',
type:'bar',
barWidth: '60%',
data:data1,
itemStyle: {
//通常情况下:
normal:{
//每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
color: function (params){
var colorList = color;
return colorList[params.dataIndex];
},
label : {show: true,position:'top',distance:-4}
}
}
}
]
});
}
function getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]); return null;
}
var testpaperId=getQueryString("testpaperId");
var _html="";
$(document).ready(function(){
window.top.loading.remove();
$.ajax({
url:url+"/SunvoteEducation/api/v1/testpaperinfo",
async:false,
type:"post",
data:{ID:testpaperId},
success:function(data){
console.log(data);
$("#paper_title").html(data.data.NAME);
$("#time").html(data.data.CREATE_DATE);
if(data.data.QUESTIONS.length>0){
for(var i=0;i【答案】 '+data.data.QUESTIONS[i].ANSWER+'
【解析】'+data.data.QUESTIONS[i].ANALYSIS+'
';
}
console.log(_html);
$(".analysis ul").html(_html);
for(var j=0;j'+(j+1)+'、'+data.data.QUESTIONS[j].CONTENT);
var arry_option=data.data.QUESTIONS[j].OPTION_CONTENT;
var answerinfo=data.data.QUESTIONS[j].ANSWERINFO;
for(var x=0;x'+String.fromCharCode(64 + parseInt(x+1))+'.'+arry_option[x]+'';
}
for(k=0;k抽');
}
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
// 错误信息
alert("状态码:"+XMLHttpRequest.status+"状态:"+XMLHttpRequest.readyState+"错误信息:"+textStatus+"");
window.top.loading.remove();
}
})
})
function star(index,num){ //难度星级
$(".star").eq(index).append('');
var li_html="";
for(var i=1;i<=num;i++){
li_html +='';
}
for(var j=num;j<5;j++){
li_html += '';
}
$(".star").eq(index).find("ul").html(li_html);
}
$(document).on("click",".round_n_orange",function(){ //显示错误学生名单
var question_id = $(this).closest("li").attr("data-id");
var student_html="";
$.ajax({
url:url+"/SunvoteEducation/api/v1/qstudentinfo",
async:false,
type:"post",
data:{question_id:question_id,test_id:testpaperId},
success:function(data){
console.log(data);
for(var i=0;i'+(i+1)+' | '+data.data[i].NAME+' | '+data.data[i].ANSWER+' | '+data.data[i].PRESS_TIME+'秒 | ';
}
$(".student_list").html(student_html);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
// 错误信息
alert("状态码:"+XMLHttpRequest.status+"状态:"+XMLHttpRequest.readyState+"错误信息:"+textStatus+"");
window.top.loading.remove();
}
});
$('#myModal').modal('show');
})