123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365 |
- <link rel="stylesheet" href="/css/assist/successPage.css"/>
- <style>
- .report-setting-main{
- margin-top:130px;
- width: 40%;
- height: 20%;
- position: absolute;
- left: 50%;
- top: 50%;
- transform: translate(-50%,-50%);
- }
- .report-setting-main div{
- margin-bottom:40px;
- }
- .report-setting-radio{
- padding-left: 50px;
- }
- .report-setting-radio input{
- margin-left: 30px;
- }
- .report-setting-title{
- width: 100px;
- display: inline-block;
- }
- .report-setting-tips{
- color:#949494;
- display: block;
- margin-left: 180px;
- }
- .score-setting{
- color:#169BD5;
- margin-left: 180px;
- cursor:pointer;
- }
- .score-levels-box input{text-align: center;}
- .score-levels-box{padding:30px 0;}
- .score-levels{padding:10px 20px 0;}
- .level-box{display: flex;}
- .level-box input{width:100px;margin:0 10px;padding-left: 5px;border:1px solid #aaa;}
- .level-box *{height: 30px;line-height: 30px;}
- .level-remove{font-size: 30px;text-align: center;cursor: pointer;}
- .level-line{position: relative;width: 50px;}
- .level-line:after{content: "";display: block;height:1px;background: #aaa;position: absolute;left:0;top:50%;transform: translateY(-50%);width: 100%;}
- .score-levels p{margin-bottom: 0;padding-left: 10px;line-height: 30px;color: #ccc;}
- .add-level{display: inline-block;padding-left:30px;margin-top:20px; color: blue;}
- .level-precent{position: relative}
- .level-precent span{position:absolute;right:20px;top:50%;transform: translateY(-50%)}
- .filter button{
- border: none;
- background: #009965;
- width: 111px;
- height: 36px;
- border-radius: 3px;
- font-size: 14px;
- color: #fff;
- outline: none;
- cursor: pointer;
- margin-left: 180px;
- }
- </style>
- <!-- 导航栏开始-->
- <?php include(Yii::app()->basePath.'/views/layouts/view_navigation.php');?>
- <!-- 导航栏结束-->
- <div class="hgc_headOPerator fl" style="background: transparent;padding-left: 0;">
- <div class="menuBtn" id="hgc_scanUploadBtn">
- <img src="/images/assist/icon_hgc_menu.svg" />
- <span class="btnText">家长端成绩报告设置</span>
- </div>
- </div>
- <div class="hgc_siderBar" id="hgc_siderBar">
- <div class="menuBtn" id="hgc_hideMenuBtn">
- <img src="/images/assist/icon_hgc_menu.svg" />
- <span class="btnText">家校成绩设置</span>
- </div>
- <ul class="menuList">
- <li>
- <a href="<?php echo $this->createUrl('zhiliao/blackList')?>">不推送成绩设置</a>
- </li>
- <li>
- <a>家长端成绩报告设置</a>
- </li>
- <!-- <li>
- <a>阅卷监控管理</a>
- </li>-->
- <li class="back" id="hgc_menuBack">
- <a href="<?php echo $this->createUrl('zhiliao/index')?>"> <img src="/images/assist/icon_hgc_back.svg" alt=""> 返回</a>
- </li>
- </ul>
- </div>
- <div class="report-setting-main">
- <div class="">
- <span class="report-setting-title">班级平均分</span>
- <span class="report-setting-radio"><input type="radio" name="class_average" value="1">可见<input type="radio" name="class_average" value="0">不可见</span>
- <span class="report-setting-tips">设置家长是否可以看到学生成绩的班级平均分</span>
- </div>
- <div>
- <span class="report-setting-title">年级平均分</span>
- <span class="report-setting-radio"><input type="radio" name="grade_average" value="1">可见<input type="radio" name="grade_average" value="0">不可见</span>
- <span class="report-setting-tips">设置家长是否可以看到学生成绩的年级平均分</span>
- </div>
- <div>
- <span class="report-setting-title">班级排名</span>
- <span class="report-setting-radio"><input type="radio" name="class_rank" value="1">可见<input type="radio" name="class_rank" value="0">不可见</span>
- <span class="report-setting-tips">设置家长是否可以看到学生成绩的班级排名</span>
- </div>
- <div>
- <span class="report-setting-title">年级排名</span>
- <span class="report-setting-radio"><input type="radio" name="grade_rank" value="1">可见<input type="radio" name="grade_rank" value="0">不可见</span>
- <span class="report-setting-tips">设置家长是否可以看到学生成绩的年级排名</span>
- </div>
- <div>
- <span class="report-setting-title">等级代替分数</span>
- <span class="report-setting-radio"><input type="radio" name="level_replace_score" value="1">开启<input type="radio" name="level_replace_score" value="0">关闭</span>
- <span class="report-setting-tips">开启后,家长只能看到看到该学生的成绩等级,看不到具体的分数</span>
- </div>
- <div class="score-setting" style="display:none">分数等级设置</div>
- <div class="filter"><button type="button" class="save-setting">保存设置</button></div>
- </div>
- <div class="score-levels-box" style="display:none">
- <a href="javascript:;" class="add-level">+添加</a>
- </div>
- <script>
- $(function(){
-
- var scanMenuBtn = document.getElementById('hgc_scanUploadBtn');
- var scanMenu = document.getElementById('hgc_siderBar')
- var scanMenuBack = document.getElementById('hgc_menuBack')
- var scanMenuHideBtn = document.getElementById('hgc_hideMenuBtn')
- scanMenuBtn.addEventListener('click',function(){
- var originMeunText = scanMenuBtn.lastElementChild.innerText;
- scanMenu.style.top = $(scanMenuBtn).offset().top - $(window).scrollTop()+'px'
- scanMenu.className = 'hgc_siderBar active'
- scanMenuHideBtn.lastElementChild.innerText = originMeunText
- })
- scanMenuBack.addEventListener('click',function(){
- scanMenu.className = 'hgc_siderBar'
- })
- scanMenuHideBtn.addEventListener('click',function(){
- scanMenu.className = 'hgc_siderBar'
- })
- $(document).click(function(e){
- var e = e || window.event; //浏览器兼容性
- var elem = e.target || e.srcElement;
- while (elem) { //循环判断至跟节点,防止点击的是div子元素
- if (elem.id && (elem.id == 'hgc_scanUploadBtn' || elem.id == 'hgc_scanUploadBtn')) {
- return;
- }
- elem = elem.parentNode;
- }
- $('#hgc_siderBar').removeClass("active"); //点击的不是div或其子元素
- });
- $(".score-setting").click(function(){
- layer.open({
- type: 1,
- title:'分数等级设置',
- content: $('.score-levels-box'),
- btn: ['保存', '取消'],
- area: ['500px', '500px'],
- yes: function(index, layero){
- //按钮【按钮一】的回调
- // layer.close(index);
- save_msg();
- },
- cancel: function(){
- //右上角关闭回调
- //return false 开启该代码可禁止点击该按钮关闭
- }
- });
- });
- $(document).on("click", ".level-remove", function(){
- $(this).parent().parent().remove();
- });
- $(document).on("click", ".add-level", function(){
- var add_html = "";
- add_html += '<div class="score-levels">';
- add_html += ' <div class="level-box">';
- add_html += ' <input type="text" name="level_name" value="" onkeyup="value=value.replace(/[^\\w\.\\/]/ig,\'\')">';
- add_html += ' <div class="level-precent"><input type="text" name="score_name" value="" onkeyup="value=value.replace(/[^\\d]/g,\'\')"><span>%</span></div>';
- add_html += ' <span class="level-line"></span>';
- add_html += ' <div class="level-precent"><input type="text" name="score_name" value="" onkeyup="value=value.replace(/[^\\d]/g,\'\')"><span>%</span></div>';
- add_html += ' <span class="level-remove">×</span>';
- add_html += ' </div>';
- add_html += ' <p>得分率大于%,小于等于%,为级</p>';
- add_html += '</div>';
- $(this).before(add_html);
- });
- $(document).on("change", ".score-levels-box input", function(){
- if($(this).attr("name") == 'score_name'){
- if(parseInt($(this).val()) > 100){
- alert("输入数字有误");
- $(this).val("");
- }
- }
- var level_name = $(this).parent().find("input:eq(0)").val();
- var min_score = $(this).parent().find("input:eq(1)").val();
- var max_score = $(this).parent().find("input:eq(2)").val();
- var add_html = '<p>得分率大于'+min_score+'%,小于等于'+max_score+'%,为'+level_name+'级</p>';
- $(this).parent().parent().find("p").html(add_html);
- });
- $(document).on("change", "input[name='level_replace_score']", function(){
- if($(this).val() == 1){
- $(".score-setting").show();
- }else{
- $(".score-setting").hide();
- }
- });
- $(document).on("click", ".save-setting", function(){
- save_msg();
- });
- //设置信息
- function setting_msg(){
- $.ajax({
- url:'<?php echo $this->createUrl('zhiliao/ajaxGetReportSetting')?>',
- type:'POST',
- dataType:'json',
- data:{},
- success:function(res){
- if(res.status==1){
- if(res.data){
- $(".report-setting-main input").prop("checked",false);
- if(res.data.class_average == 1){
- $("input[name='class_average'][value=1]").prop("checked",true);
- }else{
- $("input[name='class_average'][value=0]").prop("checked",true);
- }
- if(res.data.grade_average == 1){
- $("input[name='grade_average'][value=1]").prop("checked",true);
- }else{
- $("input[name='grade_average'][value=0]").prop("checked",true);
- }
- if(res.data.class_rank == 1){
- $("input[name='class_rank'][value=1]").prop("checked",true);
- }else{
- $("input[name='class_rank'][value=0]").prop("checked",true);
- }
- if(res.data.grade_rank == 1){
- $("input[name='grade_rank'][value=1]").prop("checked",true);
- }else{
- $("input[name='grade_rank'][value=0]").prop("checked",true);
- }
- if(res.data.level_replace_score == 1){
- $("input[name='level_replace_score'][value=1]").prop("checked",true);
- $(".score-setting").show();
- }else{
- $("input[name='level_replace_score'][value=0]").prop("checked",true);
- $(".score-setting").hide();
- }
- if(res.data.score_level_setting){
- var score_html = "";
- for(var i in res.data.score_level_setting){
- score_html += '<div class="score-levels">';
- score_html += ' <div class="level-box">';
- score_html += ' <input type="text" name="level_name" value="'+i+'" onkeyup="value=value.replace(/[^\\w\.\\/]/ig,\'\')">';
- score_html += ' <div class="level-precent"><input type="text" name="score_name" value="'+res.data.score_level_setting[i].min_score+'" onkeyup = "value=value.replace(/[^\\d]/g,\'\')"><span>%</span></div>';
- score_html += ' <span class="level-line"></span>';
- score_html += ' <div class="level-precent"><input type="text" name="score_name" value="'+res.data.score_level_setting[i].max_score+'" onkeyup = "value=value.replace(/[^\\d]/g,\'\')"><span>%</span></div>';
- score_html += ' <span class="level-remove">×</span>';
- score_html += ' </div>';
- score_html += ' <p>得分率大于'+res.data.score_level_setting[i].min_score+'%,小于等于'+res.data.score_level_setting[i].max_score+'%,为'+i+'级</p>';
- score_html += '</div>';
- }
- score_html += '<a href="javascript:;" class="add-level">+添加</a>';
- $(".score-levels-box").html(score_html);
- }
- }
- }else{
- layer.msg(res.error);
- }
- },
- error: function () {
- layer.msg("获取信息失败!");
- }
- });
- }
-
- //保存信息
- function save_msg(){
- var error = [];
- var _This = $(this);
- var setting_data = {};
- var level_count = $(".score-levels").length;
- var class_average = parseInt($("input[name='class_average']:checked").val());
- var grade_average = parseInt($("input[name='grade_average']:checked").val());
- var class_rank = parseInt($("input[name='class_rank']:checked").val());
- var grade_rank = parseInt($("input[name='grade_rank']:checked").val());
- var level_replace_score = parseInt($("input[name='level_replace_score']:checked").val());
- if(level_replace_score == 1) {
- if (level_count > 0) {
- var sum_100 = 0;//验证总和是否为100
- var range_score_arr = [];//区间分数集合
- sum_100 += level_count - 1;
- $(".score-levels").each(function () {
- if (isNaN(parseInt($(this).find("input:eq(1)").val())) || isNaN(parseInt($(this).find("input:eq(2)").val()))) {
- error.push("分数设置有误");
- return false;
- }
- var min_score = isNaN(parseInt($(this).find("input:eq(1)").val())) ? 0 : parseInt($(this).find("input:eq(1)").val());
- var max_score = isNaN(parseInt($(this).find("input:eq(2)").val())) ? 0 : parseInt($(this).find("input:eq(2)").val());
- var level_name = $(this).find("input:eq(0)").val();
- if (min_score >= max_score) {
- error.push("最小区间不得大于最大区间");
- return false;
- }
- console.log(max_score);
- sum_100 += max_score - min_score;
- for (var a = min_score; a <= max_score; a++) {
- if ($.inArray(a, range_score_arr) >= 0) {
- error.push("各等级的范围不能重叠和交叉,请重新填写");
- return false;
- } else {
- range_score_arr.push(a);
- }
- }
- if (setting_data[level_name] == undefined) {
- setting_data[level_name] = {};
- }else{
- error.push("该级别已存在,不能重名");
- }
- setting_data[level_name]['min_score'] = min_score;
- setting_data[level_name]['max_score'] = max_score;
- });
- if (sum_100 != 100) {
- error.push("所有等级区间之和不是100%,请重新设置");
- }
- setting_data = JSON.stringify(setting_data);
- }else{
- error.push("请设置分数区间");
- }
- }else{
- setting_data = "";
- }
- if(error.length > 0){
- layer.msg(error.join("<br>"));
- }else{
- $.ajax({
- url:'<?php echo $this->createUrl('zhiliao/ajaxSaveReportSetting')?>',
- type:'POST',
- dataType:'json',
- data:{class_average:class_average,grade_average:grade_average,class_rank:class_rank,grade_rank:grade_rank,level_replace_score:level_replace_score,setting_data:setting_data},
- success:function(res){
- if(res.status==1){
- window.location.reload();
- }else{
- layer.msg(res.error);
- }
- },
- error: function () {
- layer.msg("请重新设置!");
- }
- });
- }
- }
- setting_msg();
-
- });
- </script>
|