$(function() { function getGradeName (gradeid) { var gradename = ""; if (gradeid == 1) { gradename = "一年级"; } else if (gradeid == 2) { gradename = "二年级"; } else if (gradeid == 3) { gradename = "三年级"; } else if (gradeid == 4) { gradename = "四年级"; } else if (gradeid == 5) { gradename = "五年级"; } else if (gradeid == 6) { gradename = "六年级"; } else if (gradeid == 7) { gradename = "七年级"; } else if (gradeid == 8) { gradename = "八年级"; } else if (gradeid == 9) { gradename = "九年级"; } else if (gradeid == 10) { gradename = "高一"; } else if (gradeid == 11) { gradename = "高二"; } else if (gradeid == 12) { gradename = "高三"; } return gradename; }; // 考试类型 10期末20期中30月考40周考 function getExamTypeName (examtype) { var examname = ""; if (examtype == 10) { examname = "期末"; } else if (examtype == 20) { examname = "期中"; } else if (examtype == 30) { examname = "月考"; } else if (examtype == 40) { examname = "周考"; } return examname; }; // outerHeight(true) 高度为 height+margin+padding+border var parameter =JSON.parse($(".preface_html_root").data("page-params")); console.log("preface:parameter", parameter); var gradename = getGradeName(parameter.ksgk.gradeid); var examname = getExamTypeName(parameter.ksgk.examtype); $(".preface .gradename").text(gradename); $(".preface .examtype").text(examname); $(".preface .classnum").text(parameter.ksgk.classnum); $(".preface .subjectnum").text(parameter.ksgk.subjectnum); $(".preface .allscore").text(parameter.ksgk.allscore); $(".preface .stunum").text(parameter.ksgk.stunum); $(".preface .qkunum").text(parameter.ksgk.missnum); $(".preface .sjnum").text(parameter.ksgk.stunum); $(".preface .maxscore").text(parameter.ksgk.maxscore); $(".preface .avgscore").text(parameter.ksgk.avgscore); });