12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934 |
- <style>
- /*弹出层*/
- .modal{position: fixed;top: 0;left: 0;width: 100%;height: 100%;font-size:14px;display: none;}
- .modal{width: 100%;height: 100%;background: rgba(0,0,0,.4)}
- .modal-content{position: absolute;left: 50%;top: 50%;padding-top: 40px; width: 500px;background: #fff; transform: translate(-50%,-50%);}
- .modal-title{position: absolute;top: 0;left: 0;padding-left: 20px; width: 100%;height: 40px;line-height: 40px;background: #50d2c2;box-sizing: border-box;}
- .modal-title em{width: 40px;height: 40px;text-align: center;font-size: 20px;cursor: pointer;}
- .model-score{text-align: center;margin:30px 0;}
- .model-score input{padding-left: 5px; height: 30px;width: 230px;border:1px solid #ccc;outline: none;}
- .model-score input:focus{border-color: #50d2c2;box-shadow: 0 0 5px #50d2c2;}
- .modal-btn{text-align: center;margin:10px 0;}
- .modal-btn a{display: inline-block;margin:0 5px; width: 100px; line-height: 40px;background: #50d2c2;color: #fff;}
- .modal1{position: fixed;top: 0;left: 0;width: 100%;height: 100%;font-size:14px;display: none;}
- .modal1{width: 100%;height: 100%;background: rgba(0,0,0,.4)}
- .modal-content{position: absolute;left: 50%;top: 50%;padding-top: 40px; width: 500px;background: #fff; transform: translate(-50%,-50%);}
- .modal-title{position: absolute;top: 0;left: 0;padding-left: 20px; width: 100%;height: 40px;line-height: 40px;background: #50d2c2;box-sizing: border-box;}
- .modal-title em{width: 40px;height: 40px;text-align: center;font-size: 20px;cursor: pointer;}
- .model-score1{text-align: center;margin:30px 0;}
- .model-score1 input{padding-left: 5px; height: 30px;width: 230px;border:1px solid #ccc;outline: none;}
- .model-score1 input:focus{border-color: #50d2c2;box-shadow: 0 0 5px #50d2c2;}
- .modal-btn{text-align: center;margin:10px 0;}
- .modal-btn a{display: inline-block;margin:0 5px; width: 100px; line-height: 40px;background: #50d2c2;color: #fff;}
- .modal2{position: fixed;top: 0;left: 0;width: 100%;height: 100%;font-size:14px;display: none;}
- .modal2{width: 100%;height: 100%;background: rgba(0,0,0,.4)}
- .modal-content{position: absolute;left: 50%;top: 50%;padding-top: 40px; width: 500px;background: #fff; transform: translate(-50%,-50%);}
- .modal-title{position: absolute;top: 0;left: 0;padding-left: 20px; width: 100%;height: 40px;line-height: 40px;background: #50d2c2;box-sizing: border-box;}
- .modal-title em{width: 40px;height: 40px;text-align: center;font-size: 20px;cursor: pointer;}
- .model-score2{text-align: center;margin:30px 0;}
- .model-score2 input{padding-left: 5px; height: 30px;width: 230px;border:1px solid #ccc;outline: none;}
- .model-score2 input:focus{border-color: #50d2c2;box-shadow: 0 0 5px #50d2c2;}
- .modal-btn{text-align: center;margin:10px 0;}
- .modal-btn a{display: inline-block;margin:0 5px; width: 100px; line-height: 40px;background: #50d2c2;color: #fff;}
- .modal1_multi{position: fixed;top: 0;left: 0;width: 100%;height: 100%;font-size:14px;display: none;background: rgba(0,0,0,.4)}
- .model-rule{width:80%;margin:5px auto;}
- .model-rule label{display: block;margin:10px 0;}
- .modal1_multi .model-score1{width:80%;margin:10px auto;text-align: left}
- .modal1_multi .modal-btn{text-align: center;margin:5px 0;clear:both;}
- .modal1_multi .modal-btn a{display: inline-block;margin:5px 5px; width: 100px; line-height: 40px;background: #50d2c2;color: #fff;}
- .modal1_multi .model-score-m{width:80%;margin:5px auto;}
- #update_msg{color:red}
- .modal1_multi .model-score-m label{display: block;margin:5px 0;}
- .modal1_multi .model-score-m label .score_tag{width:70px;display: inline-block;}
- .modal1_multi .model-score-m label .score_input{padding-left: 5px; height: 20px;width: 200px;border:1px solid #ccc;outline: none; }
- .dn{display: none}
- .modal_student{position: fixed;top: 0;left: 0;width: 100%;height: 100%;font-size:14px;display: none;}
- .modal_student{width: 100%;height: 100%;background: rgba(0,0,0,.4)}
- .modal-content{position: absolute;left: 50%;top: 50%;padding-top: 40px; width: 500px;background: #fff; transform: translate(-50%,-50%);}
- .modal-title{position: absolute;top: 0;left: 0;padding-left: 20px; width: 100%;height: 40px;line-height: 40px;background: #50d2c2;box-sizing: border-box;color: #fff}
- .modal-title em{width: 40px;height: 40px;text-align: center;font-size: 20px;cursor: pointer;}
- .model-score1{text-align: center;margin:30px 0;}
- .model-score1 input{padding-left: 5px; height: 30px;width: 230px;border:1px solid #ccc;outline: none;}
- .model-score1 input:focus{border-color: #50d2c2;box-shadow: 0 0 5px #50d2c2;}
- .modal-btn{text-align: center;margin:10px 0;}
- .modal-btn a{display: inline-block;margin:0 5px; width: 100px; line-height: 40px;background: #50d2c2;color: #fff;}
- .modal_subject{position: fixed;top: 0;left: 0;width: 100%;height: 100%;font-size:14px;display: none;}
- .modal_subject{width: 100%;height: 100%;background: rgba(0,0,0,.4)}
- .batch_topic{padding-left: 30px; font-size:14px;text-align: justify;line-height: 22px;}
- .batch_topic a{margin:0 5px; color: #4395ff}
- .batch_topic p{display: inline;}
- .confirmbox-mask {
- background: rgba(0, 0, 0, .7);
- left: 0;
- right: 0;
- top: 0;
- bottom: 0;
- z-index: 99;
- position: fixed;
- }
- button {
- border: none;
- background: #2977ff;
- width: 80px;
- height: 26px;
- border-radius: 3px;
- font-size: 14px;
- color: #fff;
- outline: none;
- cursor: pointer;
- }
- button.save {
- display: block;
- margin: 40px auto;
- }
- .confirmbox .confirmbox-btns {
- margin-top: 40px;
- }
- .class-modal {
- width: 500px;
- min-height: 400px;
- background: #fff;
- // border-radius: 5px;
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- }
- .class-modal-head {
- font-size: 14px;
- background:#2977ff;
- color:#fff;
- height:35px;
- line-height: 35px;
- padding: 0 0 0 15px;
- }
- .class-modal-body {
- margin-top: 20px;
- max-height: 300px;
- overflow: auto;
- margin-left:50px;
- }
- .class-modal-body .classes {
- margin-bottom: 20px;
- }
- .class-modal-body .classes > div {
- display: inline-block;
- max-width: 640px;
- vertical-align: top;
- }
- .class-modal-body .classes a {
- text-decoration: none;
- display: inline-block;
- margin: 0 5px 5px;
- color: #136bfb;
- font-size: 14px;
- }
- .class-modal-body .classes a.active {
- color: #fc091b
- }
- .class-modal .icon-close{
- position: absolute;
- right: 20px;
- top: 2px;
- color:#fff;
- }
- .c-red {
- color: #CC3300
- }
- .avg{
- margin:0 10px;
- }
- .class_btn{
- text-align: center;
- }
- .confirmbox-mask p{
- word-wrap : break-word ;
- }
- .template-flag-box a{display:inline-block;color:#fff;text-decoration:none;border-radius:3px;width: 100px;text-align: center;background: #1FBF86;height: 30px;margin-right:20px;line-height:30px}
- .class-modal-body p{margin:10px 0;}
- .class-modal-body p span{display: inline-block;width:80px;}
- .icon-close{cursor:pointer;font-size:20px;line-height: 35px;}
- .class_btn{position: fixed;bottom: 2%;text-align: center;width:500px;}
- .red-tig{color:red;}
- .topic a.c-red{ color: #CC3300}
- .answerList td{text-align: center;padding:3px 0;border-bottom: 1px dotted #ccc;}
- .answerShow{border-collapse:separate;background: #666;width:190px;}
- .answerShow td{text-align: center;background:#fff;cursor: pointer}
- .answerShow td.active{background:#50d2c2;color:#000}
- .answerShow td.active_gray{background:#ccc;color:#fff}
- .new_half_score{width:50px;}
- </style>
- <script>
- $(function () {
- $('.choose-topic').hover(function(){
- $(this).css('border',"1px solid #50d2c2")
- },function(){
- $(this).css('border',"none")
- })
- //整理试题数据
- let topicGroup=[];
- let answerArr = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];
- let subjectId='<?php echo $subject?>';
- let answerArrRight=['T','F'];
- <?php
- if($subject==8){
- echo "let answerArrT=['T','F'];";
- }else{
- echo "let answerArrT=['√','×'];";
- }
- ?>
- <?php
- foreach ($topic_group as $id => $item){
- echo "topicGroup['".$id."']=[];";
- foreach ($item as $v){
- echo "var obj=[];";
- if(isset($v['id'])){
- echo "obj.push('".$v['id']."');";
- }elseif(isset($v['topic_slave_id'])){
- echo "obj.push('".$v['topic_slave_id']."');";
- }
- //半对分,更新答案
- $ruleAnswer='';
- $ruleScore=$v['score'];
- $ruleType=2;
- $ruleScoreHalf=0;
- if(isset($update_answer[$v['order']])){
- $ruleAnswer=$update_answer[$v['order']]['update_answer'];
- }elseif(isset($new_rules[$v['order']])){
- $ruleAnswer=$new_rules[$v['order']]['rule_answer'];
- $ruleType=$new_rules[$v['order']]['rule_type'];
- $ruleScoreHalf=$new_rules[$v['order']]['rule_score_half'];
- $ruleScore=$new_rules[$v['order']]['rule_score'];
- }
- if($ruleScore){
- echo "obj.push('".$ruleScore."');";
- }else{
- echo "obj.push('".$v['score']."');";
- }
- echo "obj.push('".$v['order']."');";
- if(isset($v['alias'])){
- echo "obj.push('".$v['alias']."');";
- }else{
- echo "obj.push('".$v['order']."');";
- }
- if($ruleAnswer){
- echo "obj.push('".$ruleAnswer."');";
- }else{
- echo "obj.push('".$v['answer']."');";
- }
- echo "obj.push('".count($v['items'])."');";
- echo "obj.push('".$ruleAnswer."');";
- echo "obj.push('".$ruleType."');";
- echo "obj.push('".$ruleScoreHalf."');";
- if(isset($send_points[$v['order']])){
- echo "obj.push(1);";
- }else{
- echo "obj.push(0);";
- }
- echo "obj.push('');";
- echo "topicGroup['".$id."'].push(obj);";
- echo "obj=null;";
- }
- }
- ?>
- console.log(topicGroup);
- //批量更新判分规则
- $(".change_multi_answer1").click(function () {
- $(".modal1_multi").fadeIn();
- $("#topic_order_m").html('');
- $('.total_score').hide();
- $('.half_score').hide();
- $('.title-txt').html('批量更改判分规则');
- $('.tig-txt').hide();
- //读取答案
- var topicAnswer=[];
- var topicId=[];
- var scoreHalf=[];
- var obj=$(this).closest('.choose-topic').find('.topic');
- if(obj.length>0){
- for(var i=0;i<obj.length;i++){
- if(obj.eq(i).find('.rule_answer').val()!='' && obj.eq(i).find('.rule_answer').val()!=undefined){
- topicAnswer.push(obj.eq(i).find('.rule_answer').val());
- }else{
- console.log(obj.eq(i).find('.right-answer').val());
- topicAnswer.push(obj.eq(i).find('.right-answer').val());
- }
- if(obj.eq(i).find('.rule_score_half').val()!='' && obj.eq(i).find('.rule_score_half').val()!=undefined){
- scoreHalf.push(obj.eq(i).find('.rule_score_half').val());
- }else{
- scoreHalf.push(0);
- }
- topicId.push(obj.eq(i).attr('id'));
- }
- }
- $('.batch').hide();
- $('input[name=score_half_m]').val(0);
- $('input[name=score_m]').val(0);
- $("input[name=type_m]").val($(this).attr('type'));
- $("input[name=topic_id_m]").val(topicId.join('///'));
- $("input[name=answer_m]").val(topicAnswer.join('///'));
- $("input[name=score_half_h]").val(scoreHalf.join('///'));
- $('input[name=is_batch]').val(1);
- $('input[name=step]').val(0);
- });
- $(".change-score").click(function(){
- $(".modal").fadeIn();
- $("#topic_order").html("题号:"+parseInt($(this).parent().prev().find('.order').attr('order_id')));
- $("input[name=topic_id]").val($(this).attr('topic'));
- $("input[name=type]").val($(this).attr('type'));
- $("input[name=score]").val('');
- if($(this).attr('type')==1 || $(this).attr('type')==11 || $(this).attr('type')==2){
- $('.red-tig').hide();
- }else{
- $('.red-tig').show();
- }
- });
- $(".close3").click(function(event) {
- $(".sumbit3").attr('disabled',false);
- layer.closeAll();
- hideMulti($(this));
- });
- $(".sumbit3").click(function(event) {
- if($(this).attr('disabled')=='disabled'){
- return false;
- }
- var obj=$(this);
- var rule=$("input[name=rule]:checked").val();
- var score_m=$("input[name=score_m]").val();
- var score_half_m=$("input[name=score_half_m]").val();
- var answer=$("input[name=answer_m]").val();
- var is_batch=parseInt($('input[name=is_batch]').val());
- var step=parseInt($('input[name=step]').val());
- var type=parseInt($('input[name=type_m]').val());
- if(!answer)
- {
- layer.msg('答案不能为空');return;
- }
- console.log(score_m);
- if(score_m<0 || score_m=='' ){
- layer.msg('分数不能为空');return false;
- }
- if(is_batch==0) {
- if (parseFloat(score_half_m) > parseFloat(score_m)) {
- layer.msg('半对分不能大于满分');
- return;
- }
- }else{
- score_half_m=$("input[name=score_half_h]").val();
- }
- if(rule!=1 && (score_half_m==0 || score_half_m=='')){
- layer.msg('半对分数不能为空');
- return false;
- }
- if(type==1 || type==2 || type==11){
- if(score_m>49){
- layer.msg('最大分值不能超过49分');
- return false;
- }
- }else if(type==5){
- if(score_m>49){
- layer.msg('最大分值不能超过49分');
- return false;
- }
- }else if(type==7){
- if(score_m>60){
- layer.msg('最大分值不能超过60分');
- return false;
- }
- }else if(type==17){
- if(score_m>60){
- layer.msg('最大分值不能超过60分');
- return false;
- }
- }
- var data={
- exam_id:$("input[name=exam_id_m]").val(),
- topic_id:$("input[name=topic_id_m]").val(),
- answer:answer,
- type:$("input[name=type_m]").val(),
- score_m:score_m,
- score_half_m:score_half_m,
- rule:rule,
- step:step
- };
- $(this).attr('disabled',true);
- var alertIndex=layer.msg('正在更新,请稍候。。。。。。',{time:0});
- if(is_batch==1){
- postUrl="<?php echo Yii::app()->createUrl('allSubject/changeMultiRuleBatch')?>";
- }else{
- postUrl="<?php echo Yii::app()->createUrl('paper/changemulti')?>";
- }
- $.ajax({
- url:postUrl,
- data:data,
- dataType:'json',
- type:'POST',
- success:function(res){
- layer.close(alertIndex);
- if(res.status==1){
- layer.msg('更新成功',hideMulti(obj));
- location.reload();
- }else{
- layer.msg(res.msg);
- }
- }
- });
- });
- //批量更新判分规则结束
- $(".sumbit1").click(function(event) {
- if($(this).attr('disabled')=='disabled'){
- return false;
- }
- $(this).closest(".modal").fadeOut();
- if(!$("input[name=answer]").val())
- {
- layer.msg('不能为空');return;
- }
- var data={
- paper_id:$("input[name=paper_id]").val(),
- topic_id:$("input[name=topic_id]").val(),
- answer:$("input[name=answer]").val(),
- type:$("input[name=type]").val()
- };
- $(this).attr('disabled',true);
- var alertIndex=layer.msg('正在更新,请稍候。。。。。。',{time:0});
- $.post("<?php echo Yii::app()->createUrl('paper/answernew')?>",data,function(falgs){
- var m =falgs;
- layer.close(alertIndex);
- if(m==-1)
- {
- layer.msg('无考试');return;
- }else if(m==0)
- {
- layer.msg('提交失败');return;
- }else if(m==-2){
- layer.msg('参数有误');return;
- }else if(m==-3){
- layer.msg('无此题');return;
- }else if(m==-4){
- layer.msg('接口写入有误');return;
- }else if(m==-5){
- layer.msg('接口报错:Trans rollback');return;
- }else if(m==-6){
- layer.msg('校本题库答案修改失败');return;
- }else if(m==-7){
- layer.msg('校本题库答案已修改,报告无内容需要更新');return;
- }else{
- location.reload();
- }
- });
- });
- $(".sumbit").click(function(event) {
- if($(this).attr('disabled')=='disabled'){
- return false;
- }
- var type=$("input[name=type]").val();
- var score_m=$("input[name=score]").val();
- if(score_m==0 || score_m==''){
- layer.msg('分值不能为空');
- return false;
- }
- if(type==1 || type==2 || type==11){
- if(score_m>49){
- layer.msg('最大分值不能超过49分');
- return false;
- }
- }else if(type==5){
- if(score_m>49){
- layer.msg('最大分值不能超过49分');
- return false;
- }
- }else if(type==7){
- if(score_m>60){
- layer.msg('最大分值不能超过60分');
- return false;
- }
- }else if(type==17){
- if(score_m>60){
- layer.msg('最大分值不能超过60分');
- return false;
- }
- }
- $(this).closest(".modal").fadeOut();
- var data={
- paper_id:$("input[name=paper_id]").val(),
- topic_id:$("input[name=topic_id]").val(),
- score:$("input[name=score]").val(),
- type:$("input[name=type]").val()
- };
- $(this).attr('disabled',true);
- var alertIndex=layer.msg('正在更新,请稍候。。。。。。',{time:0});
- $.post("<?php echo Yii::app()->createUrl('paper/score')?>",data,function(falgs){
- var m =JSON.parse(falgs);
- layer.close(alertIndex);
- console.log(m);
- if(m.status==-1)
- {
- layer.msg('分数不能为空');return;
- }else if(m.status==0)
- {
- if(m.msg!=undefined){
- layer.msg(m.msg);
- }else{
- layer.msg('修改分数失败');
- }
- return;
- }else{
- location.reload();
- }
- });
- });
- //批量更新答案
- $('.update_answer_batch').click(function(){
- let type=parseInt($(this).attr('type'));
- html="";
- $('input[name=topicType]').val(type);
- largeId=$(this).attr('topic');
- rule_score_half=[];
- rule=[],topicId=[];
- if(type==2 || type==11){
- var obj=$(this).closest('.choose-topic').find('.topic');
- if(obj.length>0){
- for(var i=0;i<obj.length;i++){
- if(obj.eq(i).find('.rule_score_half').val()!='' && obj.eq(i).find('.rule_score_half').val()!=undefined){
- rule_score_half.push(obj.eq(i).find('.rule_score_half').val());
- }else{
- rule_score_half.push(obj.eq(i).find('.rule_score_half').val());
- }
- if(obj.eq(i).find('.rule_type').val()!='' && obj.eq(i).find('.rule_type').val()!=undefined){
- rule.push(obj.eq(i).find('.rule_type').val());
- }else{
- rule.push(1);
- }
- topicId.push(obj.eq(i).attr('id'));
- }
- }
- $('input[name=topicAnswerRule]').val(rule.join('///'));
- $('input[name=topicIds]').val(topicId.join('///'));
- $('input[name=topicHalfScore]').val(rule_score_half.join('///'));
- }
- if(type==0){
- var obj =$(this).closest('.large_title').next().children('.choose-topic');
- html=''
- for(let i=0;i<obj.length;i++){
- tempLargeId=obj.eq(i).find('.topic').attr('id');
- if(topicGroup[tempLargeId]!=undefined && topicGroup[tempLargeId].length>0){
- for (let i = 0; i < topicGroup[tempLargeId].length; i++) {
- html+='<tr>';
- html+='<td>'+topicGroup[tempLargeId][i][10]+'</td>';
- html+='<td><table align="center" width="100%" border="0" cellspacing="1" cellpadding="1" class="answerShow">';
- html+='<tr>';
- for(var j=0;j<topicGroup[tempLargeId][i][5];j++){
- if(topicGroup[tempLargeId][i][9]==0){
- if(topicGroup[tempLargeId][i][4]==answerArr[j]){
- html+='<td class="active answer" >'+answerArr[j]+'</td>';
- }else{
- html+='<td class=" answer" >'+answerArr[j]+'</td>';
- }
- }else{
- if(topicGroup[tempLargeId][i][4]==answerArr[j]){
- html+='<td class="active_gray " >'+answerArr[j]+'</td>';
- }else{
- html+='<td class=" " >'+answerArr[j]+'</td>';
- }
- }
- }
- html+='</tr>';
- html+='</table>';
- html+='</td>';
- html+='<td width="30%" class="operateLog" right="'+topicGroup[tempLargeId][i][4]+'" nowAnswer="'+topicGroup[tempLargeId][i][4]+'" topic_id="'+topicGroup[tempLargeId][i][0]+'">无更新</td>';
- html+='</tr>';
- }
- }
- }
- $('.answerList tbody').html(html);
- }else if(type==1){
- if(topicGroup[largeId]!=undefined && topicGroup[largeId].length>0){
- for (let i = 0; i < topicGroup[largeId].length; i++) {
- html+='<tr>';
- html+='<td>'+topicGroup[largeId][i][10]+'</td>';
- html+='<td><table align="center" width="100%" border="0" cellspacing="1" cellpadding="1" class="answerShow">';
- html+='<tr>';
- for(var j=0;j<topicGroup[largeId][i][5];j++){
- if(topicGroup[largeId][i][9]==0){
- if(topicGroup[largeId][i][4]==answerArr[j]){
- html+='<td class="active answer" >'+answerArr[j]+'</td>';
- }else{
- html+='<td class=" answer" >'+answerArr[j]+'</td>';
- }
- }else{
- if(topicGroup[largeId][i][4]==answerArr[j]){
- html+='<td class="active_gray" >'+answerArr[j]+'</td>';
- }else{
- html+='<td class=" " >'+answerArr[j]+'</td>';
- }
- }
- }
- html+='</tr>';
- html+='</table>';
- html+='</td>';
- html+='<td width="30%" class="operateLog" right="'+topicGroup[largeId][i][4]+'" nowAnswer="'+topicGroup[largeId][i][4]+'" topic_id="'+topicGroup[largeId][i][0]+'">无更新</td>';
- html+='</tr>';
- }
- }
- $('.answerList tbody').html(html);
- }else if(type==2){
- if(topicGroup[largeId]!=undefined && topicGroup[largeId].length>0){
- for (let i = 0; i < topicGroup[largeId].length; i++) {
- html+='<tr>';
- html+='<td>'+topicGroup[largeId][i][10]+'</td>';
- html+='<td><table align="center" width="100%" border="0" cellspacing="1" cellpadding="1" class="answerShow">';
- html+='<tr>';
- for(var j=0;j<topicGroup[largeId][i][5];j++){
- if(topicGroup[largeId][i][9]==0){
- if(topicGroup[largeId][i][4].indexOf(answerArr[j])==-1){
- html+='<td class=" answer_2" >'+answerArr[j]+'</td>';
- }else{
- html+='<td class="active answer_2" >'+answerArr[j]+'</td>';
- }
- }else{
- if(topicGroup[largeId][i][4].indexOf(answerArr[j])==-1){
- html+='<td class=" " >'+answerArr[j]+'</td>';
- }else{
- html+='<td class="active gray" >'+answerArr[j]+'</td>';
- }
- }
- }
- html+='</tr>';
- html+='</table>';
- html+='</td>';
- html+='<td width="30%" class="operateLog" rule="'+topicGroup[largeId][i][7]+'" right="'+topicGroup[largeId][i][4]+'" half_score="'+topicGroup[largeId][i][8]+'" nowAnswer="'+topicGroup[largeId][i][4]+'" topic_id="'+topicGroup[largeId][i][0]+'">无更新</td>';
- html+='</tr>';
- }
- }
- $('.answerList tbody').html(html);
- }else if(type==22){
- var obj =$(this).closest('.large_title').next().children('.choose-topic');
- html=''
- for(let i=0;i<obj.length;i++){
- tempLargeId=obj.eq(i).find('.topic').attr('id');
- if(topicGroup[tempLargeId]!=undefined && topicGroup[tempLargeId].length>0){
- for (let i = 0; i < topicGroup[tempLargeId].length; i++) {
- html+='<tr>';
- html+='<td>'+topicGroup[tempLargeId][i][10]+'</td>';
- html+='<td><table align="center" width="100%" border="0" cellspacing="1" cellpadding="1" class="answerShow">';
- html+='<tr>';
- for(var j=0;j<topicGroup[tempLargeId][i][5];j++){
- if(topicGroup[tempLargeId][i][4].indexOf(answerArr[j])==-1){
- html+='<td class=" answer_2" >'+answerArr[j]+'</td>';
- }else{
- html+='<td class="active answer_2" >'+answerArr[j]+'</td>';
- }
- }
- html+='</tr>';
- html+='</table>';
- html+='</td>';
- html+='<td width="30%" class="operateLog" rule="'+topicGroup[tempLargeId][i][7]+'" right="'+topicGroup[tempLargeId][i][4]+'" half_score="'+topicGroup[tempLargeId][i][8]+'" nowAnswer="'+topicGroup[tempLargeId][i][4]+'" topic_id="'+topicGroup[tempLargeId][i][0]+'">无更新</td>';
- html+='</tr>';
- }
- }
- }
- $('.answerList tbody').html(html);
- }else if(type==12){
- if(topicGroup[largeId]!=undefined && topicGroup[largeId].length>0){
- for (let i = 0; i < topicGroup[largeId].length; i++) {
- html+='<tr>';
- html+='<td>'+topicGroup[largeId][i][10]+'</td>';
- html+='<td><table align="center" width="100%" border="0" cellspacing="1" cellpadding="1" class="answerShow">';
- html+='<tr>';
- for(var j=0;j<topicGroup[largeId][i][5];j++){
- if(topicGroup[largeId][i][4]==answerArrRight[j]){
- html+='<td class="active answer" >'+answerArrT[j]+'</td>';
- }else{
- html+='<td class=" answer" >'+answerArrT[j]+'</td>';
- }
- }
- html+='</tr>';
- html+='</table>';
- html+='</td>';
- html+='<td width="30%" class="operateLog" right="'+topicGroup[largeId][i][4]+'" nowAnswer="'+topicGroup[largeId][i][4]+'" topic_id="'+topicGroup[largeId][i][0]+'">无更新</td>';
- html+='</tr>';
- }
- }
- $('.answerList tbody').html(html);
- }
- $('#updateAnswerBatch').show();
- });
- //主观题修改分值
- $('.change-score_batch').click(function(){
- let html='',titleHtml='';
- let largeId=$(this).attr('topic');
- if(topicGroup[largeId]!=undefined && topicGroup[largeId].length>0){
- var totalScore=0;
- for (let i = 0; i < topicGroup[largeId].length; i++) {
- html+='<p><span>第'+topicGroup[largeId][i][10]+'题</span><input type="text" class="topic_score" name="'+topicGroup[largeId][i][2]+'" value="'+topicGroup[largeId][i][1]+'">分 ';
- html+='</p>';
- totalScore +=parseInt(topicGroup[largeId][i][1]);
- }
- titleHtml+='<p><span>总分:</span><input type="text" class="total_score" name="total_score" value="'+totalScore+'" /><button class="avg">平均分配</button></p>';
- }
- html=titleHtml+html;
- $('#classModal').find('.class-modal-body').html(html);
- $('input[name=topic_type_action]').val(5);
- $('#classModal').show();
- });
- //批量修改单选题分值
- $('.up_score').click(function(){
- let html='',titleHtml='';
- let largeId=$(this).attr('topic');
- let type=$(this).attr('type');
- if(type==0){
- var obj =$(this).closest('.large_title').next().children('.choose-topic');
- html=''
- var totalScore=0;
- var isSend=false;
- for(let i=0;i<obj.length;i++){
- tempLargeId=obj.eq(i).find('.topic').attr('id');
- if(topicGroup[tempLargeId]!=undefined && topicGroup[tempLargeId].length>0){
-
- for (let i = 0; i < topicGroup[tempLargeId].length; i++) {
- if(topicGroup[tempLargeId][i][9]==0){
- html+='<p><span>第'+topicGroup[tempLargeId][i][10]+'题</span><input type="text" class="topic_score" name="'+topicGroup[tempLargeId][i][2]+'" value="'+topicGroup[tempLargeId][i][1]+'">分 ';
- html+='</p>';
- totalScore +=parseInt(topicGroup[tempLargeId][i][1]);
- }else{
- isSend=true;
- html+='<p><span>第'+topicGroup[tempLargeId][i][10]+'题</span><input type="text" class="topic_score" style="background: #ccc" readonly name="'+topicGroup[tempLargeId][i][2]+'" value="'+topicGroup[tempLargeId][i][1]+'">分 ';
- html+='</p>';
- totalScore +=parseInt(topicGroup[tempLargeId][i][1]);
- }
- }
-
- }
- }
- if(isSend){
- titleHtml+='<p><span>总分:</span><input type="text" class="" name="" value="'+totalScore+'" /><button class="gray">平均分配</button></p>';
- }else{
- titleHtml+='<p><span>总分:</span><input type="text" class="total_score" name="total_score" value="'+totalScore+'" /><button class="avg">平均分配</button></p>';
- }
- }else{
- if(topicGroup[largeId]!=undefined && topicGroup[largeId].length>0){
- var totalScore=0;
- var isSend=false;
- for (let i = 0; i < topicGroup[largeId].length; i++) {
- if(topicGroup[largeId][i][9]==0){
- html+='<p><span>第'+topicGroup[largeId][i][10]+'题</span><input type="text" class="topic_score" name="'+topicGroup[largeId][i][2]+'" value="'+topicGroup[largeId][i][1]+'">分 ';
- html+='</p>';
- totalScore +=parseInt(topicGroup[largeId][i][1]);
- }else{
- isSend=true;
- html+='<p><span>第'+topicGroup[largeId][i][10]+'题</span><input type="text" class="topic_score" style="background: #ccc" readonly name="'+topicGroup[largeId][i][2]+'" value="'+topicGroup[largeId][i][1]+'">分 ';
- html+='</p>';
- totalScore +=parseInt(topicGroup[largeId][i][1]);
- }
- }
- if(isSend){
- titleHtml+='<p><span>总分:</span><input type="text" class="" name="" value="'+totalScore+'" /><button class="gray">平均分配</button></p>';
- }else{
- titleHtml+='<p><span>总分:</span><input type="text" class="total_score" name="total_score" value="'+totalScore+'" /><button class="avg">平均分配</button></p>';
- }
- }
- }
-
-
- html=titleHtml+html;
- $('#classModal').find('.class-modal-body').html(html);
- $('input[name=topic_type_action]').val(1);
- $('#classModal').show();
- });
- //批量更改分值
- $('.update_score_batch').click(function(){
- let type=parseInt($(this).attr('type'));
- let html='',titleHtml='';
- let largeId=$(this).attr('topic');
- //读取答案
- var topicAnswer=[];
- var topicId=[];
- var rule=[];
- if(type==22){
- var obj =$(this).closest('.large_title').next().children('.choose-topic').find('.topic');
- }else{
- var obj=$(this).closest('.choose-topic').find('.topic');
- }
-
- if(obj.length>0){
- for(var i=0;i<obj.length;i++){
- if(obj.eq(i).find('.rule_answer').val()!='' && obj.eq(i).find('.rule_answer').val()!=undefined){
- topicAnswer.push(obj.eq(i).find('.rule_answer').val());
- }else{
- topicAnswer.push(obj.eq(i).find('.right-answer').val());
- }
- if(obj.eq(i).find('.rule_type').val()!='' && obj.eq(i).find('.rule_type').val()!=undefined){
- rule.push(obj.eq(i).find('.rule_type').val());
- }else{
- rule.push(1);
- }
- topicId.push(obj.eq(i).attr('id'));
- }
- }
- $('input[name=topicAnswer]').val(topicAnswer.join('///'));
- $('input[name=topicRule]').val(rule.join('///'));
- $('input[name=topicIds]').val(topicId.join('///'));
- if(type==22){
- var obj =$(this).closest('.large_title').next().children('.choose-topic');
- html=''
- var totalScore=0;
- for(let i=0;i<obj.length;i++){
- tempLargeId=obj.eq(i).find('.topic').attr('id');
- if(topicGroup[tempLargeId]!=undefined && topicGroup[tempLargeId].length>0){
- for (let i = 0; i < topicGroup[tempLargeId].length; i++) {
- html+='<p><span>第'+topicGroup[tempLargeId][i][10]+'题</span><input type="text" class="topic_multi_score" name="topic_multi_score'+topicGroup[tempLargeId][i][2]+'" value="'+topicGroup[tempLargeId][i][1]+'">分 ';
- html+=' 半对<input type="text" class="new_half_score" name="half_score_'+topicGroup[tempLargeId][i][2]+'" value="'+topicGroup[tempLargeId][i][8]+'">分';
- html+='</p>';
- totalScore +=parseInt(topicGroup[tempLargeId][i][1]);
- }
- }
- }
- titleHtml+='<p><span>总分:</span><input type="text" class="total_multi_score" name="total_multi_score" value="'+totalScore+'" /><button class="avg_multi">平均分配</button></p>';
-
- }else{
- if(topicGroup[largeId]!=undefined && topicGroup[largeId].length>0){
- var totalScore=0;
- for (let i = 0; i < topicGroup[largeId].length; i++) {
- html+='<p><span>第'+topicGroup[largeId][i][10]+'题</span><input type="text" class="topic_multi_score" name="topic_multi_score'+topicGroup[largeId][i][2]+'" value="'+topicGroup[largeId][i][1]+'">分 ';
- html+=' 半对<input type="text" class="new_half_score" name="half_score_'+topicGroup[largeId][i][2]+'" value="'+topicGroup[largeId][i][8]+'">分';
- html+='</p>';
- totalScore +=parseInt(topicGroup[largeId][i][1]);
- }
- titleHtml+='<p><span>总分:</span><input type="text" class="total_multi_score" name="total_multi_score" value="'+totalScore+'" /><button class="avg_multi">平均分配</button></p>';
- }
- }
- html=titleHtml+html;
- $('.multiSelectScore').html(html);
- $('#classModalMulti').show();
- });
- //单个更新规则
- $(".change_multi_answer").click(function () {
- var step=$(this).attr('step');
- if(step==1){
- $('.total_score').hide();
- $('.half_score').hide();
- $('.model-score-m').hide();
- $('.tig-txt').hide();
- }else if(step==2){
- $('.model-rule').hide();
- $('.total_score').hide();
- $('.half_score').hide();
- $('.model-score-m').show();
- }else if(step==3){
- $('.model-rule').hide();
- $('.total_score').show();
- $('.half_score').show();
- $('.batch').hide();
- $('.tig-txt').hide();
- }
- obj=$(this).closest('.choose-topic').find('.topic');
- $('.title-txt').html("题号:"+obj.find('.order').attr('order_id'));
- $(".modal1_multi").fadeIn();
- $("#topic_order_m").html("题号:"+obj.find('.order').attr('order_id'));
- $("input[name=topic_id_m]").val($(this).attr('topic'));
- $("input[name=type_m]").val($(this).attr('type'));
- $("input[name=step]").val(step);
- //判断是否修改过规则
- var ruleAnswer=$(this).closest('.choose-topic').find('.rule_answer').val(),
- ruleType=$(this).closest('.choose-topic').find('.rule_type').val(),
- ruleScoreHalf=$(this).closest('.choose-topic').find('.rule_score_half').val();
- var rightAnswer=$(this).closest('.choose-topic').find('.right-answer').val();
- if(ruleType!=0 ){
- if(ruleAnswer!=''){
- $("input[name=answer_m]").val(ruleAnswer);
- // $("input[name=answer_student]").val(ruleAnswer);
- }else{
- $("input[name=answer_m]").val(rightAnswer);
- // $("input[name=answer_student]").val(rightAnswer);
- }
- $("input[name=score_half_m]").val(ruleScoreHalf);
- var index=parseInt(ruleType)-1;
- $('input[name=rule]').eq(index).prop("checked",'checked');
- rightAnswer=ruleAnswer;
- }else{
- $('input[name=score_half_m]').val(0);
- $("input[name=answer_m]").val(rightAnswer);
- $("input[name=answer_student]").val(rightAnswer);
- }
- $("input[name=score_m]").val($(this).attr('score'));
- });
- //更改答案
- $(".change-answer").click(function(){
- $(".modal1").fadeIn();
- obj=$(this).closest('.choose-topic').find('.topic');
- $("#topic_order1").html("题号:"+obj.find('.order').attr('order_id'));
- $("input[name=topic_id]").val(obj.attr('id'));
- $("input[name=type]").val($(this).attr('type'));
- });
- //更改分值
- $(".change-score").click(function(){
- console.log('change-score');
- $(".modal").fadeIn();
- obj=$(this).closest('.choose-topic').find('.topic');
- $("#topic_order").html("题号:"+obj.find('.order').attr('order_id'));
- $("input[name=topic_id]").val(obj.attr('id'));
- $("input[name=type]").val($(this).attr('type'));
- $("input[name=score]").val('');
- if($(this).attr('type')==1 || $(this).attr('type')==11 || $(this).attr('type')==2){
- $('.red-tig').hide();
- }else{
- $('.red-tig').show();
- }
- });
- //修改文理综试题科目
- $(".change-topic-subject").click(function(){
- $(".modal_subject").fadeIn();
- var old_subject=$(this).attr('subject-name');
- var old_subject_id=$(this).attr('subject');
- $('.oldSubjectName').html('原科目:'+old_subject);
- $("input[name=topic_id_subject]").val($(this).attr('topic'));
- $("input[name=old_subject_id]").val(old_subject_id);
- });
- /* 修改分数弹层*/
- $(".close").click(function(event) {
- $(".sumbit").attr('disabled',false);
- layer.closeAll();
- $(this).closest(".modal").fadeOut();
- });
- $(".close1").click(function(event) {
- $(".sumbit1").attr('disabled',false);
- layer.closeAll();
- $(this).closest(".modal1").fadeOut();
- });
- $(".close2").click(function(event) {
- $(".sumbit2").attr('disabled',false);
- layer.closeAll();
- $(this).closest(".modal2").fadeOut();
- });
- $(".close3").click(function(event) {
- $(".sumbit3").attr('disabled',false);
- layer.closeAll();
- hideMulti($(this));
- });
- $(".close_student").click(function(event) {
- $(".sumbit_student").attr('disabled',false);
- layer.closeAll();
- $(this).closest(".modal_student").fadeOut();
- });
- $(".close_subject").click(function(event) {
- $(".sumbit_subject").attr('disabled',false);
- layer.closeAll();
- $(this).closest(".modal_subject").fadeOut();
- });
- $('.icon-close,.exam-close').click(function(){
- $(this).closest('.confirmbox-mask').hide();
- });
- function hideMulti(obj) {
- obj.closest(".modal1_multi").hide();
- $('#update_msg').html('');
- obj.closest(".modal1_multi").find('input[name=rule]').eq(1).prop('checked',true);
- $('input[name=answer_m]').val('');
- $('input[name=score_m]').val(5);
- $('input[name=score_half_m]').val(3);
- $('input[name=is_batch]').val(0);
- $('input[name=score_half_h]').val('');
- $('.total_score').show();
- $('.half_score').show();
- $('.model-rule').show();
- $('.model-score-m').show();
- $('.batch').show();
- $('.tig-txt').show();
- }
- function checkFloat(num){
- num=String(num);
- arr=num.split(".");
- //console.log(arr[1]);
- if(arr[1]==undefined){
- return true;
- }else if(arr[1]==5){
- return true;
- }
- return false;
- }
- function checkFloat1(num){
- num=String(num);
- arr=num.split(".");
- if(arr.length<3){
- return true;
- }
- return false;
- }
- $('.save_multi_score').click(function(){
- if($(this).attr('disabled')=='disabled'){
- return false;
- }
- let topicAnswer=$('input[name=topicAnswer]').val();
- let topicRule=$('input[name=topicRule]').val();
- let topicIds=$('input[name=topicIds]').val();
- let topicScore=[],topicHalfScore=[];
- for(var i=0;i<$('.topic_multi_score').length;i++){
- if($('.topic_multi_score').eq(i).val()==0 || $('.topic_multi_score').eq(i).val()==''){
- layer.msg('请填写题目分数!');
- return false;
- }
- if(parseInt($('.topic_multi_score').eq(i).val())>49){
- layer.msg('选择题分数上限为49分!');
- return false;
- }
- if(parseInt($('.topic_multi_score').eq(i).val())<1){
- layer.msg('选择题分数不能小于1分!');
- return false;
- }
- if( $('.new_half_score').eq(i).val()=='' || parseFloat($('.new_half_score').eq(i).val())<0 || !checkFloat1($('.new_half_score').eq(i).val()) ){
- layer.msg('请填写正确的题目半对分数!');
- return false;
- }
- if( parseFloat($('.new_half_score').eq(i).val())>parseInt($('.topic_multi_score').eq(i).val())){
- layer.msg('半对分不能大于满分!');
- return false;
- }
- topicScore.push($('.topic_multi_score').eq(i).val());
- topicHalfScore.push($('.new_half_score').eq(i).val());
- }
- topicAnswerArr=topicAnswer.split('///');
- topicRuleArr=topicRule.split('///');
- topicIdArr=topicIds.split('///');
- let update_answers=[];
- for(var i=0;i<topicAnswerArr.length;i++){
- update_answers.push({topicId:topicIdArr[i],topicAnswer:topicAnswerArr[i],topicRule:topicRuleArr[i],topicScore:topicScore[i],topicHalfScore:topicHalfScore[i]});
- }
- console.log(update_answers);
- data={
- update_answers:update_answers,
- exam_id:$("input[name=exam_id]").val(),
- change_obj:'score'
- };
- $(this).attr('disabled',true);
- var alertIndex=layer.msg('正在更新,请稍候。。。。。。',{time:0});
- $.ajax({
- url:"<?php echo $this->createUrl('paper/updateMultiAnswerBatch')?>",
- data:data,
- dataType:'json',
- type:'POST',
- success:function(res){
- layer.close(alertIndex);
- if(res.status==1){
- layer.msg('更新成功');
- location.reload();
- }else{
- layer.msg(res.msg);
- }
- }
- });
- });
- $('.saveAnswerBatch').click(function(){
- if($(this).attr('disabled')=='disabled'){
- return false;
- }
- let updateAnswerArr=[];
- let topicType=$('input[name=topicType]').val();
- let score_half_m=$("input[name=topicHalfScore]").val();
- $.each($('.operateLog'),function(i,v){
- let oldAnswer=$(v).attr('right'),
- newAnswer=$(v).attr('nowAnswer'),
- topicRule=$(v).attr('rule'),
- topicHalfScore=$(v).attr('half_score'),
- topicId=$(v).attr('topic_id');
- if(newAnswer==''){
- layer.msg('答案不能为空');
- return false;
- }
- if(oldAnswer!=newAnswer){
- updateAnswerArr.push({topicId,newAnswer,topicRule,topicHalfScore});
- }
- })
- if(updateAnswerArr.length==0){
- layer.msg('答案无更新');
- return false;
- }
- var data={
- exam_id:$("input[name=exam_id]").val(),
- paper_id:$("input[name=paper_id]").val(),
- update_answers:updateAnswerArr,
- score_half_m:score_half_m,
- change_obj:'answer'
- };
- obj=$(this);
- $(this).attr('disabled',true);
- var alertIndex=layer.msg('正在更新,请稍候。。。。。。',{time:0});
- if(topicType==1 || topicType==12 || topicType==0){
- postUrl="<?php echo $this->createUrl('paper/updateAnswerBatch')?>";
- }else{
- postUrl="<?php echo $this->createUrl('paper/updateMultiAnswerBatch')?>";
- }
- $.ajax({
- url:postUrl,
- data:data,
- dataType:'json',
- type:'POST',
- success:function(res){
- layer.close(alertIndex);
- if(res.status==1){
- layer.msg('更新成功');
- location.reload();
- }else{
- obj.attr('disabled',false);
- layer.msg(res.msg);
- }
- }
- });
- });
- //批量更新单选题分数
- $('.save_score').click(function(){
- var topicScore={};
- for(var i=0;i<$('.topic_score').length;i++){
- if($('.topic_score').eq(i).val()==0 || $('.topic_score').eq(i).val()==''){
- layer.msg('请填写题目分数!');
- return false;
- }
- if(parseInt($('.topic_score').eq(i).val())>49){
- layer.msg('选择题分数上限为49分!');
- return false;
- }
- var order=$('.topic_score').eq(i).attr('name');
- var score=$('.topic_score').eq(i).val();
- topicScore[order]=score;
- }
- action=$('input[name=topic_type_action]').val();
- $(this).attr('disabled',true);
- obj=$(this);
- //批量更新分数
- if(action==1){
- $.ajax({
- url:'<?php echo $this->createUrl('allSubject/updateScoreBatch')?>',
- type:'POST',
- dataType:'json',
- data:{scores:topicScore,paper_id:$("input[name=paper_id]").val()},
- success:function(res){
- if(res.status==1){
- layer.msg('修改成功',{icon:1,time:2000},function () {
- window.location.reload();
- });
- }else{
- if(res.msg!=undefined){
- layer.msg(res.msg)
- obj.attr('disabled',false);
- }else{
- layer.msg('修改失败',{icon:1,time:2000},function () {
- window.location.reload();
- });
- }
- }
- }
- });
- }else{
- var data={
- paper_id:$("input[name=paper_id]").val(),
- topic_id:$("input[name=topic_id]").val(),
- score:$("input[name=score]").val(),
- type:$("input[name=type]").val()
- };
- $.post("<?php echo Yii::app()->createUrl('paper/score')?>",data,function(falgs){
- var m =JSON.parse(falgs);
- layer.close(alertIndex);
- console.log(m);
- if(m.status==-1)
- {
- layer.msg('分数不能为空');return;
- }else if(m.status==0)
- {
- if(m.msg!=undefined){
- layer.msg(m.msg);
- }else{
- layer.msg('修改分数失败');
- }
- return;
- }else{
- location.reload();
- }
- });
- }
- });
- $(".sumbit").click(function(event) {
- if($(this).attr('disabled')=='disabled'){
- return false;
- }
- var type=$("input[name=type]").val();
- var score_m=$("input[name=score]").val();
- if(score_m==0 || score_m==''){
- layer.msg('分值不能为空');
- return false;
- }
- if(type==1 || type==2 || type==11){
- if(score_m>49){
- layer.msg('最大分值不能超过49分');
- return false;
- }
- }else if(type==5){
- if(score_m>49){
- layer.msg('最大分值不能超过49分');
- return false;
- }
- }else if(type==7){
- if(score_m>60){
- layer.msg('最大分值不能超过60分');
- return false;
- }
- }else if(type==17){
- if(score_m>60){
- layer.msg('最大分值不能超过60分');
- return false;
- }
- }
- $(this).closest(".modal").fadeOut();
- var data={
- paper_id:$("input[name=paper_id]").val(),
- topic_id:$("input[name=topic_id]").val(),
- score:$("input[name=score]").val(),
- type:$("input[name=type]").val()
- };
- $(this).attr('disabled',true);
- var alertIndex=layer.msg('正在更新,请稍候。。。。。。',{time:0});
- $.post("<?php echo Yii::app()->createUrl('paper/score')?>",data,function(falgs){
- var m =JSON.parse(falgs);
- layer.close(alertIndex);
- console.log(m);
- if(m.status==-1)
- {
- layer.msg('分数不能为空');return;
- }else if(m.status==0)
- {
- if(m.msg!=undefined){
- layer.msg(m.msg);
- }else{
- layer.msg('修改分数失败');
- }
- return;
- }else{
- location.reload();
- }
- });
- });
- /* 上移试题 */
- $("body").delegate('.batch_topic .up', 'click', function(event) {
- var data={
- paper_id:$(this).attr('paper_id'),
- topic_id:$(this).attr('topic'),
- action:'up'
- };
- $.post("<?php echo Yii::app()->createUrl('paper/moveBatch')?>",data,function(falgs){
- var m =JSON.parse(falgs);
- layer.closeAll();
- console.log(m);
- if(m.status==1)
- {
- window.location.reload();
- }else if(m.status==0)
- {
- if(m.msg!=undefined){
- layer.msg(m.msg);
- }else{
- layer.msg('移动失败');
- }
- return;
- }
- });
- });
- /* 下移试题 */
- $("body").delegate('.batch_topic .down', 'click', function(event) {
- var data={
- paper_id:$(this).attr('paper_id'),
- topic_id:$(this).attr('topic'),
- action:'down'
- };
- $.post("<?php echo Yii::app()->createUrl('paper/moveBatch')?>",data,function(falgs){
- var m =JSON.parse(falgs);
- layer.closeAll();
- console.log(m);
- if(m.status==1)
- {
- window.location.reload();
- }else if(m.status==0)
- {
- if(m.msg!=undefined){
- layer.msg(m.msg);
- }else{
- layer.msg('移动失败');
- }
- }
- });
- });
- $('.sendPoints').click(function(){
- let topicId=$(this).attr('topic');
- let paperId=$(this).attr('paper_id');
- let actionType=$(this).attr('action_type');
- msg='';
- if(actionType==1){
- $('input[name=paperId]').val(paperId);
- $('input[name=topicId]').val(topicId);
- $('#sendScore').show();
- }else{
- if($(this).attr('disabled')=='disabled'){
- return false;
- }
- msg='0分题每题只可设置一次,且不可撤销,请谨慎操作';
- indexmsg=layer.confirm(msg, {
- btn: ['确定', '取消'] //按钮
- }, function () {
- $('.sendPoints').attr('disabled',true);
- layer.close(indexmsg);
- layer.msg('更新中请稍候。。。。。。',{time:0});
- $.ajax({
- url:"<?php echo $this->createUrl('paper/sendPoints')?>",
- data:{actype:actionType,paper_id:paperId,topic_id:topicId},
- dataType:'json',
- type:'POST',
- success:function(res){
- if(res.status==1){
- layer.msg('更新成功');
- location.reload();
- }else{
- if(res.msg!=undefined){
- layer.msg(res.msg);
- }else{
- layer.msg('更新失败');
- }
- }
- }
- });
- })
- }
- });
- $('.saveSendScoreBtn').click(function(){
- answer=$('input[name=sendScoreAnswer]').val();
- if(answer==''){
- layer.msg('请选择送分答案');
- }
- let topicId=$('input[name=topicId]').val();
- let paperId=$('input[name=paperId]').val();
- if($(this).attr('disabled')=='disabled'){
- return false;
- }
- msg='送分题每题只可设置一次,且不可撤销,请谨慎操作';
- indexmsg=layer.confirm(msg, {
- btn: ['确定', '取消'] //按钮
- }, function () {
- $('.saveSendScoreBtn').attr('disabled',true);
- layer.close(indexmsg);
- layer.msg('更新中请稍候。。。。。。',{time:0});
- $.ajax({
- url:"<?php echo $this->createUrl('paper/sendScore')?>",
- data:{answer:answer,paper_id:paperId,topic_id:topicId},
- dataType:'json',
- type:'POST',
- success:function(res){
- if(res.status==1){
- layer.msg('更新成功');
- location.reload();
- }else{
- if(res.msg!=undefined){
- layer.msg(res.msg);
- }else{
- layer.msg('更新失败');
- }
- }
- }
- });
- })
- });
- $('.answerList')
- .on('click','.answer',function(){
- if(!$(this).hasClass('active')){
- showLogObj=$(this).closest('table').closest('tr').find('.operateLog');
- $(this).closest('table').find('.answer').removeClass('active');
- $(this).addClass('active');
- $oldAnswer=showLogObj.attr('right');
- clickAnswer=$(this).html();
- if(clickAnswer=='√'){
- clickAnswer='T';
- }
- if(clickAnswer=='×'){
- clickAnswer='F';
- }
- if(clickAnswer==$oldAnswer){
- showLogObj.html("无更新");
- showLogObj.removeClass('red-tig');
- }else{
- if(showLogObj.attr('right')=='T' || showLogObj.attr('right')=='F'){
- if(subjectId!=8){
- if(showLogObj.attr('right')=='T'){
- showLogObj.html("√改为"+$(this).html());
- }else{
- showLogObj.html("×改为"+$(this).html());
- }
- }else{
- showLogObj.html(showLogObj.attr('right')+"改为"+$(this).html());
- }
- }else{
- showLogObj.html(showLogObj.attr('right')+"改为"+$(this).html());
- }
- showLogObj.addClass('red-tig');
- }
- showLogObj.attr('nowAnswer',clickAnswer);
- }
- })
- .on('click','.answer_2',function(){
- showLogObj=$(this).closest('table').closest('tr');
- $oldAnswer=showLogObj.find('.operateLog').attr('right');
- if(!$(this).hasClass('active')){
- $(this).addClass('active');
- }else{
- if(showLogObj.find('.active').length<=1){
- layer.msg('多选题答案不能少于一个');
- return false;
- }
- $(this).removeClass('active');
- }
- console.log(showLogObj.find('.active').length);
- var nowAnswer=[];
- $.each(showLogObj.find('.answer_2'),function(i,v){
- if($(v).hasClass('active')){
- nowAnswer.push($(v).html())
- }
- })
- if($oldAnswer==nowAnswer.join(',')){
- showLogObj.find('.operateLog').html('无更新');
- showLogObj.find('.operateLog').removeClass('red-tig');
- }else{
- showLogObj.find('.operateLog').html($oldAnswer+"改为"+nowAnswer.join(','));
- showLogObj.find('.operateLog').addClass('red-tig');
- }
- showLogObj.find('.operateLog').attr('nowAnswer',nowAnswer.join(','));
- })
- .on('click','.answer_3',function(){
- showLogObj=$(this).closest('table').closest('tr');
- $oldAnswer=showLogObj.find('.operateLog').attr('right');
- if(!$(this).hasClass('active')){
- $(this).addClass('active');
- }else{
- if(showLogObj.find('.active').length<=1){
- layer.msg('送分题答案不能少于一个');
- return false;
- }
- $(this).removeClass('active');
- }
- var nowAnswer=[];
- $.each(showLogObj.find('.answer_3'),function(i,v){
- if($(v).hasClass('active')){
- nowAnswer.push($(v).html())
- }
- })
- $('input[name=sendScoreAnswer]').val(nowAnswer.join(','));
- })
- $('.multiSelectScore')
- .on('click','.avg_multi',function(){
- var total_score=$('input[name=total_multi_score]').val();
- var topic_count=$('.topic_multi_score').length;
- if(total_score==0 || total_score==''){
- layer.msg('请填写题目总分!');
- }else{
- var avg_score=total_score/topic_count;
- if(checkFloat(avg_score)==false){
- $('.avg_multi_result').html('无法平均分配');
- $('.avg_multi_result').addClass('red');
- }else{
- $('.avg_multi_result').html('');
- for(var i=1;i<=topic_count;i++){
- $('.topic_multi_score').val(avg_score);
- }
- }
- }
- })
- $('.class-modal-body')
- .on('click','.avg',function(){
- var total_score=$('input[name=total_score]').val();
- var topic_count=$('.topic_score').length;
- if(total_score==0 || total_score==''){
- layer.msg('请填写题目总分!');
- }else{
- var avg_score=total_score/topic_count;
- if(checkFloat(avg_score)==false){
- $('.avg_result').html('无法平均分配');
- $('.avg_result').addClass('red');
- }else{
- $('.avg_result').html('');
- for(var i=1;i<=topic_count;i++){
- $('.topic_score').val(avg_score);
- }
- }
- }
- })
- .on('change','.total_score',function(){
- $(this).val($(this).val().replace(/[^\d+]/g,""));
- if(checkFloat($(this).val())==false){
- layer.msg('分数设置不正确!');
- $(this).val(0);
- }
- if( $(this).val()!=''){
- $(this).val(parseFloat($(this).val()));
- }
- $('.topic_score').val(0);
- $('#topic_error').html('');
- })
- .on('change','.total_multi_score',function(){
- $(this).val($(this).val().replace(/[^\d+]/g,""));
- if(checkFloat($(this).val())==false){
- layer.msg('分数设置不正确!');
- $(this).val(0);
- }
- if( $(this).val()!=''){
- $(this).val(parseFloat($(this).val()));
- }
- $('.topic_multi_score').val(0);
- $('.new_half_score').val(0);
- $('#topic_error').html('');
- })
- .on('change','.topic_score',function(){
- $(this).val($(this).val().replace(/[^\d+]/g,""));
- if(checkFloat($(this).val())==false){
- layer.msg('分数设置不正确!');
- $(this).val(0);
- }
- if( $(this).val()!=''){
- $(this).val(parseFloat($(this).val()));
- }
- var sum=0;
- for(var i=0;i<$('.topic_score').length;i++){
- if($('.topic_score').eq(i).val()!=''){
- sum+=parseFloat($('.topic_score').eq(i).val());
- }
- }
- $('.total_score').val(sum);
- $('#topic_error').html('');
- });
- })
- </script>
- <!-- 修改分数弹窗 -->
- <div class="modal">
- <div class="modal-shadow"></div>
- <div class="modal-content">
- <div class="modal-title clearfix">
- <span id="topic_order"></span><em class="fr close">×</em>
- </div>
- <span class="red-tig"> 提示:只修改试题分值,已批阅的学生得分不做修改!</span>
- <div class="model-score">
- 分数:<input type="text" name="score">分
- <input type="hidden" name="paper_id" value="<?php echo $paper_id?>">
- <input type="hidden" name="topic_id" value="">
- <input type="hidden" name="type" value="">
- </div>
- <div class="modal-btn">
- <a href="javascript:;" class="sumbit">确定</a>
- <a href="javascript:;" class="close">取消</a>
- </div>
- </div>
- </div>
- <!-- 修改多选题分数弹窗 -->
- <div class="modal1_multi">
- <div class="modal-shadow"></div>
- <div class="modal-content">
- <div class="modal-title clearfix">
- <span class="title-txt">更改试题答案</span><span id="update_msg"></span><em class="fr close3">×</em>
- </div>
- <div class="model-rule">
- 评分规则:
- <label><input type="radio" name="rule" value="1" >规则A
- <br>全选对为全对;错选漏选为0分。
- </label>
- <label><input type="radio" name="rule" value="2" checked >规则B
- <br>全选对为全对;错选为0分;没有全部选对且没有错选为半对。
- </label>
- <label><input type="radio" name="rule" value="3">规则C
- <br>全选对为全对;答案数量不超过正确答案数量情况下,部分选对为半对;
- 答案数量超过正确答案数量或全选错为0分。
- </label>
- </div>
- <div class="model-score-m">
- <label class="batch"> <span class="score_tag ">正确答案:</span><input class="score_input" type="text" name="answer_m"></label>
- <label class="total_score"><span class="score_tag ">满分:</span><input type="text" class="score_input" name="score_m" value="5">分</label>
- <label class="half_score"><span class="score_tag">半对分:</span><input type="text" class="score_input" name="score_half_m" value="3">分</label>
- <input type="hidden" name="exam_id_m" value="<?php echo $exam_id?>">
- <input type="hidden" name="topic_id_m" value="">
- <input type="hidden" name="answer_m" value="">
- <input type="hidden" name="type_m" value="">
- <input type="hidden" name="is_batch" value="0">
- <input type="hidden" name="step" value="0">
- <input type="hidden" name="score_half_h" value="">
- <span class="tig-txt" style="float: left;margin-left: 70px;font-size: 10px;padding-top: 5px;">正确答案 英文半角大写 A.B.C.D</span>
- </div>
- <div class="modal-btn">
- <a href="javascript:;" class="sumbit3">确定</a>
- <a href="javascript:;" class="close3">取消</a>
- </div>
- </div>
- </div>
- <!-- 修改答案弹窗 -->
- <div class="modal1">
- <div class="modal-shadow"></div>
- <div class="modal-content">
- <div class="modal-title clearfix">
- 更改试题答案(<span id="topic_order1"></span>)<em class="fr close1">×</em>
- </div>
- <div class="model-score1">
- 正确答案:<input type="text" name="answer">
- <input type="hidden" name="paper_id" value="<?php echo $paper_id?>">
- <input type="hidden" name="topic_id" value="">
- <input type="hidden" name="type" value="">
- <span style="float: left;margin-left: 70px;font-size: 10px;padding-top: 5px;">正确答案 英文半角大写 A.B.C.D</span>
- </div>
- <div class="modal-btn">
- <a href="javascript:;" class="sumbit1">确定</a>
- <a href="javascript:;" class="close1">取消</a>
- </div>
- </div>
- </div>
- <!-- 更改试题科目 -->
- <div class="modal_subject">
- <div class="modal-shadow"></div>
- <div class="modal-content">
- <div class="modal-title clearfix">
- 更改试题科目<em class="fr close_subject">×</em>
- </div>
- <div class="model-score2 oldSubjectName">原科目:</div>
- <div class="model-score2">
- 正确科目(<span id="topic_order_student"></span>):
- <select name="subject_id" id="subject_id">
- <option value="0">请选择科目</option>
- <?php
- if(isset($subjects)){
- foreach ($subjects as $key =>$val){
- echo '<option value="'.$key.'">'.$val.'</option>';
- }
- }
- ?>
- </select>
- <input type="hidden" name="exam_id_subject" value="<?php echo $exam_id?>">
- <input type="hidden" name="topic_id_subject" value="">
- <input type="hidden" name="old_subject_id" value="">
- <input type="hidden" name="paper_id_subject" value="<?php echo $paper_id?>">
- </div>
- <div class="modal-btn">
- <a href="javascript:;" class="sumbit_subject">确定</a>
- <a href="javascript:;" class="close_subject">取消</a>
- </div>
- </div>
- </div>
- <!--批量修改单选题分值-->
- <div class="confirmbox-mask" style="display: none" id="classModal">
- <div class="class-modal">
- <i class="icon icon-close">×</i>
- <div class="class-modal-head">批量更改分值</div>
- <div class="class-modal-body">
- <p><span>总分:</span><input type="text" class="total_score" name="total_score" value="<?php echo isset($choice_question_score_sum)?$choice_question_score_sum:'';?>" /><button class="avg">平均分配</button></p>
- <?php
- if(isset($type[1])){
- foreach ($type[1] as $item){
- $topicNo=0;
- if(isset($alias[$item['order']])){
- $topicNo =$alias[$item['order']] ;
- }else{
- $topicNo= $item['order'];
- }
- echo '<p><span>第'.$topicNo.'题:</span><input type="text" class="topic_score" name="'.$topicNo.'" value="'.intval($item['score']).'" />分</p>';
- }
- }
- ?>
- </div>
- <div class="class_btn">
- <div class="avg_result c-red"></div>
- <input type="hidden" name="topic_type_action" value="0">
- <button type="button" class="save_score">确定</button>
- </div>
- </div>
- </div>
- <!--批量修改多选题分值-->
- <div class="confirmbox-mask" style="display: none" id="classModalMulti">
- <div class="class-modal">
- <i class="icon icon-close">×</i>
- <div class="class-modal-head">批量更改分值</div>
- <div class="class-modal-body multiSelectScore">
- <p><span>总分:</span><input type="text" class="total_score" name="total_score" value="" /><button class="avg">平均分配</button></p>
- </div>
- <div class="class_btn">
- <div class="avg_multi_result c-red"></div>
- <input type="hidden" name="topicAnswer" value="">
- <input type="hidden" name="topicRule" value="">
- <input type="hidden" name="topic_type_index" value="0">
- <input type="hidden" name="topicIds" value="0">
- <button type="button" class="save_multi_score">确定</button>
- </div>
- </div>
- </div>
- <!--批量客观题答案-->
- <div class="confirmbox-mask" style="display: none" id="updateAnswerBatch">
- <div class="class-modal">
- <i class="icon icon-close">×</i>
- <div class="class-modal-head">批量更改答案</div>
- <div class="class-modal-body">
- <table width="100%" border="0" cellspacing="0" cellpadding="0" class="answerList">
- <thead>
- <tr>
- <td>题号</td>
- <td>答案</td>
- <td>更新标记</td>
- </tr>
- </thead>
- <tbody>
- </tbody>
- </table>
- </div>
- <div class="class_btn">
- <div class="avg_result c-red"></div>
- <input type="hidden" name="topicType" value="">
- <input type="hidden" name="topicHalfScore" value="">
- <input type="hidden" name="topicAnswerRule" value="">
- <button type="button" class="saveAnswerBatch">确定</button>
- </div>
- </div>
- </div>
- <!--送分题选择答案弹窗-->
- <div class="confirmbox-mask" style="display: none" id="sendScore">
- <div class="class-modal">
- <i class="icon icon-close">×</i>
- <div class="class-modal-head">设置送分题</div>
- <div class="class-modal-body">
- <table width="100%" border="0" cellspacing="0" cellpadding="0" class="answerList">
- <thead>
- <tr>
- <td colspan="4">请选择需要送分的选项,学生选择以下任意选项均得分</td>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td >
- <table width="100%" border="0" cellspacing="1" cellpadding="1" class="answerShow" align="center">
- <tr>
- <td class="answer_3">A</td>
- <td class="answer_3">B</td>
- <td class="answer_3">C</td>
- <td class="answer_3">D</td>
- <td class="answer_3">E</td>
- <td class="answer_3">F</td>
- <td class="answer_3">G</td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td >注意:一旦设置,不可取消,且不能再修改试题分值与答案,请谨慎操作!</td>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="class_btn">
- <button type="button" class="saveSendScoreBtn">确定</button>
- <input type="hidden" name="sendScoreAnswer" value="">
- <input type="hidden" name="paperId" value="">
- <input type="hidden" name="topicId" value="">
- </div>
- </div>
- </div>
|