12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031 |
- <style>
- .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:#2977ff;color:#fff}
- .new_half_score{width:50px;}
- </style>
- <!-- 修改分数弹窗 -->
- <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">分<br>
- <div class="question_scores">
- </div>
- <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">
- <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="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>
- <?php if($subject==9): ?>
- <label><input type="radio" name="rule" value="4" >规则D
- <br>全选对为全对;答对一个1分;答对两个2分;错选0分。
- </label>
- <label><input type="radio" name="rule" value="5" >规则E
- <br>全选对为全对;答对一个1分;答对两个2分;错选不扣分但全选错0分;超出答案个数0分。
- </label>
- <label class="c-red">注:规则D和规则E适用于语文新题型,请谨慎使用!</label>
- <?php endif;?>
- </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="modal2">
- <div class="modal-shadow"></div>
- <div class="modal-content">
- <div class="modal-title clearfix">
- 修改校本题库题的答案<em class="fr close2">×</em>
- </div>
- <div class="model-score2">
- 正确答案(<span id="topic_order2"></span>):<input type="text" name="answer1">
- <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="sumbit2">确定</a>
- <a href="javascript:;" class="close2">取消</a>
- </div>
- </div>
- </div>
- <div class="modal_student">
- <div class="modal-shadow"></div>
- <div class="modal-content">
- <div class="modal-title clearfix">
- 更改学生答案(<span id="topic_order_student"></span>)<em class="fr close_student">×</em>
- </div>
- <div class="model-score2">
- 原答案:<input type="text" name="old_answer_student">
- </div>
- <div class="model-score2">
- 正确答案:<input type="text" name="answer_student">
- <input type="hidden" name="exam_id_student" value="<?php echo $exam_id?>">
- <input type="hidden" name="topic_id_student" value="">
- <input type="hidden" name="type" value="">
- <input type="hidden" name="topic_answer" 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="sumbit_student">确定</a>
- <a href="javascript:;" class="close_student">取消</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 $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="'.$item['order'].'" value="'.$item['score'].'" />分</p>';
- }
- }
- ?>
- </div>
- <div class="class_btn">
- <div class="avg_result c-red"></div>
- <input type="hidden" name="topic_type_index" 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 >请选择需要送分的选项,学生选择以下任意选项均得分</td>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td >
- <table width="100%" border="0" cellspacing="1" cellpadding="1" class="answerShow" id="sendPointAnswer" 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>
- <script>
- $('.update_answer_batch').click(function(){
- let type=parseInt($(this).attr('type'));
- html="";
- $('input[name=topicType]').val(type);
- 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==1){
- <?php
- if(isset($type[1])){
- foreach ($type[1] as $item){
- $topicNo=0;
- $right='';
- if(isset($alias[$item['order']])){
- $topicNo =$alias[$item['order']] ;
- }else{
- $topicNo= $item['order'];
- }
- $arr = array(0=>'A',1=>'B',2=>'C',3=>'D',4=>'E',5=>'F',6=>'G',7=>'H',8=>'I',9=>'J',10=>'K',11=>'L',12=>'M');
- $ruleAnswer='';
- $optionCount=4;
- if (isset($topic[$item['topic_id']]) && !empty($topic[$item['topic_id']]) && isset($topic[$item['topic_id']]['items'][0]['options'])) {
- $optionCount=count($topic[$item['topic_id']]['items'][0]['options']);
- }
- if(isset($update_answer[$item['order']])){
- $ruleAnswer=$update_answer[$item['order']]['update_answer'];
- }
- if(!$ruleAnswer){
- if($subject==8 && isset($topic[$item['topic_id']]['answer'])){
- $right=$topic[$item['topic_id']]['answer'];
- }else {
- if (isset($topic[$item['topic_id']]) && !empty($topic[$item['topic_id']]) && isset($topic[$item['topic_id']]['items'][0]['options'])) {
- foreach ($topic[$item['topic_id']]['items'][0]['options'] as $ok => $opt) {
- if ($opt['option_correct'] == 1) {
- if (!$right) {
- //$right = isset($arr[$ok]) ? $arr[$ok] : '';
- $right=numToLetter($ok+1);
- } else{
- // $right = $right . ',' . $arr[$ok];
- $right=$right.','.numToLetter($ok+1);
- }
- }
- }
- }
- }
- }else{
- $right=$ruleAnswer;
- }
- echo "html+='<tr>';";
- echo "html+='<td>".$topicNo."</td>';";
- echo "html+='<td><table align=\"center\" width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\" class=\"answerShow\">';";
- echo "html+='<tr>';";
- for($i=0;$i<$optionCount;$i++){
- if($right==numToLetter($i+1)){
- echo "html+='<td class=\"active answer\" >".numToLetter($i+1)."</td>';";
- }else{
- echo "html+='<td class=\"answer\">".numToLetter($i+1)."</td>';";
- }
- }
- echo "html+='</tr>';";
- echo "html+='</table>';";
- echo "html+='</td>';";
- echo "html+='<td width=\"30%\" class=\"operateLog\" right=\"{$right}\" nowAnswer=\"{$right}\" topic_id=\"{$item['topic_id']}\">无更新</td>';";
- echo "html+='</tr>';";
- }
- }
- ?>
- $('.answerList tbody').html(html);
- }else if(type==2){
- <?php
- if(isset($type[2])){
- foreach ($type[2] as $item){
- $topicNo=0;
- $right='';
- if(isset($alias[$item['order']])){
- $topicNo =$alias[$item['order']] ;
- }else{
- $topicNo= $item['order'];
- }
- $arr = array(0=>'A',1=>'B',2=>'C',3=>'D',4=>'E',5=>'F',6=>'G',7=>'H',8=>'I',9=>'J',10=>'K',11=>'L',12=>'M');
- $ruleAnswer='';
- $ruleType=2;
- $ruleScoreHalf=0;
- if(isset($new_rules[$item['order']])){
- $ruleAnswer=$new_rules[$item['order']]['rule_answer'];
- $ruleType=$new_rules[$item['order']]['rule_type'];
- $ruleScoreHalf=$new_rules[$item['order']]['rule_score_half'];
- }
- $optionCount=4;
- if (isset($topic[$item['topic_id']]) && !empty($topic[$item['topic_id']]) && isset($topic[$item['topic_id']]['items'][0]['options'])) {
- $optionCount=count($topic[$item['topic_id']]['items'][0]['options']);
- }
- if(!$ruleAnswer){
- if($subject==8 && isset($topic[$item['topic_id']]['answer'])){
- $right=$topic[$item['topic_id']]['answer'];
- }else {
- if (isset($topic[$item['topic_id']]) && !empty($topic[$item['topic_id']]) && isset($topic[$item['topic_id']]['items'][0]['options'])) {
- foreach ($topic[$item['topic_id']]['items'][0]['options'] as $ok => $opt) {
- if ($opt['option_correct'] == 1) {
- if (!$right) {
- $right = numToLetter($ok+1);
- } else {
- $right = $right . ',' . numToLetter($ok+1);
- }
- }
- }
- }
- }
- }else{
- $right=$ruleAnswer;
- }
- $rightArr=explode(',',$right);
- echo "html+='<tr>';";
- echo "html+='<td>".$topicNo."</td>';";
- echo "html+='<td><table align=\"center\" width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\" class=\"answerShow\">';";
- echo "html+='<tr>';";
- for($i=0;$i<$optionCount;$i++){
- if(in_array(numToLetter($i+1),$rightArr)){
- echo "html+='<td class=\"active answer_2\" >".numToLetter($i+1)."</td>';";
- }else{
- echo "html+='<td class=\"answer_2\">".numToLetter($i+1)."</td>';";
- }
- }
- echo "html+='</tr>';";
- echo "html+='</table>';";
- echo "html+='</td>';";
- echo "html+='<td width=\"30%\" class=\"operateLog\" rule=\"{$ruleType}\" right=\"{$right}\" half_score=\"{$ruleScoreHalf}\" nowAnswer=\"{$right}\" topic_id=\"{$item['topic_id']}\">无更新</td>';";
- echo "html+='</tr>';";
- }
- }
- ?>
- $('.answerList tbody').html(html);
- }else if(type==11){
- <?php
- if(isset($type[11])){
- foreach ($type[11] as $item){
- $topicNo=0;
- $right='';
- if(isset($alias[$item['order']])){
- $topicNo =$alias[$item['order']] ;
- }else{
- $topicNo= $item['order'];
- }
- $arr = array(0=>'A',1=>'B',2=>'C',3=>'D',4=>'E',5=>'F',6=>'G',7=>'H',8=>'I',9=>'J',10=>'K',11=>'L',12=>'M');
- $ruleAnswer='';
- $ruleType=2;
- $ruleScoreHalf=0;
- if(isset($new_rules[$item['order']])){
- $ruleAnswer=$new_rules[$item['order']]['rule_answer'];
- $ruleType=$new_rules[$item['order']]['rule_type'];
- $ruleScoreHalf=$new_rules[$item['order']]['rule_score_half'];
- }
- $optionCount=4;
- if (isset($topic[$item['topic_id']]) && !empty($topic[$item['topic_id']]) && isset($topic[$item['topic_id']]['type']) && $topic[$item['topic_id']]['type']==5) {
- $optionCount=7;
- }else{
- if (isset($topic[$item['topic_id']]) && !empty($topic[$item['topic_id']]) && isset($topic[$item['topic_id']]['items'][0]['options'])) {
- $optionCount=count($topic[$item['topic_id']]['items'][0]['options']);
- }
- }
- if(!$ruleAnswer){
- if($subject==8 && isset($topic[$item['topic_id']]['answer'])){
- $right=$topic[$item['topic_id']]['answer'];
- }else {
- if (isset($topic[$item['topic_id']]) && !empty($topic[$item['topic_id']]) && isset($topic[$item['topic_id']]['items'][0]['options'])) {
- foreach ($topic[$item['topic_id']]['items'][0]['options'] as $ok => $opt) {
- if ($opt['option_correct'] == 1) {
- if (!$right) {
- $right = numToLetter($ok+1);
- } else {
- $right = $right . ',' . numToLetter($ok+1);
- }
- }
- }
- }
- }
- }else{
- $right=$ruleAnswer;
- }
- $rightArr=explode(',',$right);
- echo "html+='<tr>';";
- echo "html+='<td>".$topicNo."</td>';";
- echo "html+='<td><table align=\"center\" width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\" class=\"answerShow\">';";
- echo "html+='<tr>';";
- // $optionCount=26;
- for($i=0;$i<$optionCount;$i++){
- if(in_array(numToLetter($i+1),$rightArr)){
- echo "html+='<td class=\"active answer_2\" >".numToLetter($i+1)."</td>';";
- }else{
- echo "html+='<td class=\"answer_2\">".numToLetter($i+1)."</td>';";
- }
- }
- echo "html+='</tr>';";
- echo "html+='</table>';";
- echo "html+='</td>';";
- echo "html+='<td width=\"30%\" class=\"operateLog\" rule=\"{$ruleType}\" right=\"{$right}\" half_score=\"{$ruleScoreHalf}\" nowAnswer=\"{$right}\" topic_id=\"{$item['topic_id']}\">无更新</td>';";
- echo "html+='</tr>';";
- }
- }
- ?>
- $('.answerList tbody').html(html);
- //读取答案
- 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_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);
- }
- }
- }
- $('input[name=topicHalfScore]').val(scoreHalf.join('///'));
- }
- $('#updateAnswerBatch').show();
- });
- $('.update_score_batch').click(function(){
- let type=parseInt($(this).attr('type'));
- let html='',titleHtml='';
- //读取答案
- var topicAnswer=[];
- var topicId=[];
- var rule=[];
- 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==2){
- <?php
- if(isset($type[2])){
- $totalScore=0;
- foreach ($type[2] as $item){
- $topicNo=0;
- $right='';
- if(isset($alias[$item['order']])){
- $topicNo =$alias[$item['order']] ;
- }else{
- $topicNo= $item['order'];
- }
- $ruleAnswer='';
- $ruleType=0;
- $ruleScoreHalf=0;
- if(isset($new_rules[$item['order']])){
- $ruleScoreHalf=$new_rules[$item['order']]['rule_score_half'];
- if($new_rules[$item['order']]['rule_score']){
- $item['score']=$new_rules[$item['order']]['rule_score'];
- }
- }
- $totalScore+=$item['score'];
- echo 'html+="<p><span>第'.$topicNo.'题:</span><input type=\"text\" class=\"topic_multi_score\" name=\"topic_multi_score'.$topicNo.'\" value=\"'.intval($item['score']).'\" />分 半对<input type=\"text\" class=\"new_half_score\" name=\"half_score_'.$topicNo.'\" value=\"'.$ruleScoreHalf.'\" />分</p>";';
- }
- echo '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);
- }else if(type==11){
- <?php
- if(isset($type[11])){
- $totalScore=0;
- foreach ($type[11] as $item){
- $topicNo=0;
- $right='';
- if(isset($alias[$item['order']])){
- $topicNo =$alias[$item['order']] ;
- }else{
- $topicNo= $item['order'];
- }
- $ruleAnswer='';
- $ruleType=0;
- $ruleScoreHalf=0;
- if(isset($new_rules[$item['order']])){
- $ruleScoreHalf=$new_rules[$item['order']]['rule_score_half'];
- if($new_rules[$item['order']]['rule_score']){
- $item['score']=$new_rules[$item['order']]['rule_score'];
- }
- }
- $totalScore+=$item['score'];
- echo 'html+="<p><span>第'.$topicNo.'题:</span><input type=\"text\" class=\"topic_multi_score\" name=\"topic_multi_score'.$topicNo.'\" value=\"'.intval($item['score']).'\" />分 半对<input type=\"text\" class=\"new_half_score\" name=\"half_score_'.$topicNo.'\" value=\"'.$ruleScoreHalf.'\" />分</p>";';
- }
- echo 'titleHtml+="<p><span>总分:</span><input type=\"text\" class=\"\" name=\"total_multi_score\" value=\"'.$totalScore.'\" /><button class=\"avg_multi\">平均分配</button></p>";';
- }
- ?>
- html=titleHtml+html;
- $('.multiSelectScore').html(html);
- }
- $('#classModalMulti').show();
- });
- $('.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');
- if($(this).html()==$oldAnswer){
- showLogObj.html("无更新");
- showLogObj.removeClass('red-tig');
- }else{
- showLogObj.html(showLogObj.attr('right')+"改为"+$(this).html());
- showLogObj.addClass('red-tig');
- }
- showLogObj.attr('nowAnswer',$(this).html());
- }
- })
- .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);
- }
- }
- }
- })
- $('.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_m]").val(),
- paper_id:$("input[name=paper_id]").val(),
- update_answers:updateAnswerArr,
- score_half_m:score_half_m,
- change_obj:'answer'
- };
- $(this).attr('disabled',true);
- var alertIndex=layer.msg('正在更新,请稍候。。。。。。',{time:0});
- if(topicType==1){
- 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{
- layer.msg(res.msg);
- }
- }
- });
- });
- $('.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_m]").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);
- }
- }
- });
- });
- $('.sendPoints').click(function(){
- let topicId=$(this).attr('topic');
- let paperId=$(this).attr('paper_id');
- let actionType=$(this).attr('action_type');
- let optionCount=$(this).attr('option_count');
- msg='';
- if(actionType==1){
- $('input[name=paperId]').val(paperId);
- $('input[name=topicId]').val(topicId);
- html='<tr>';
- var letter=['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'];
- for(i=0;i<optionCount;i++){
- html+='<td class="answer_3">'+letter[i]+'</td>';
- }
- html+='</tr>';
- $('#sendPointAnswer').html(html);
- $('#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('更新失败');
- }
- }
- }
- });
- })
- });
- $(".modal")
- .on('keyup','.question_score',function(){
- $(this).val($(this).val().replace(/[^0-9|\.]/g,""));
- })
- .on("change",'.question_score',function(){
- var sum=0;
- $('.question_score').each(function(i,v){
- score=$(v).val();
- if(score=='' || score==0){
- score=1;
- layer.msg('分数不能为空');
- $(v).val(1);
- }
- sum+=parseFloat(score);
- })
- $('input[name=score]').val(sum);
- })
- </script>
|