12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024 |
- <script src="/js/jquery.datetimepicker.js"></script>
- <link rel="stylesheet" href="/fonts/fpdf/iconfont.css" />
- <link rel="stylesheet" href="/css/modelCreatePaper.css" />
- <link rel="stylesheet" href="/css/jquery.datetimepicker.css" />
- <link rel="stylesheet" href="/css/third/paperCard.css" />
- <link type="text/css" rel="stylesheet" href="/js/select/select2.min.css" />
- <link rel="stylesheet" href="/css/alert.css"/>
- <script src="/js/select/select2.min.js"></script>
- <style>
- .class-box{
- width: 500px;
- }
- .class-box>p{
- margin-bottom: 10px;
- }
- .class-box>ul{
- width: 500px;
- height: 200px;
- padding: 10px 20px;
- background-color: #FAFAFA;
- box-sizing: border-box;
- border:1px solid #ddd;
- }
- .class-box>ul>li{
- float: left;
- margin-right: 15px;
- margin-bottom: 10px;
- cursor: pointer;
- }
- .class-box>ul>li>img{
- vertical-align: middle;
- margin-left: 3px;
- }
- .class-modal-body{margin-bottom:15px;}
- #gradeTxt{display:inline-block;border-left:2px solid #2977ff;padding-left:10px;}
- .class_right{
- width:650px;
- }
- .class_area li{
- width:185px;
- height:30px;
- line-height: 30px;
- text-align: center;
- border:1px solid #ccc;
- margin:5px;
- border-radius: 3px;
- cursor:pointer
- }
- .class_area li.active{
- color:#fff;
- background: #2977ff;
- cursor:pointer
- }
- .selected-box{overflow:auto}
- </style>
- <div class="main-content-inner">
- <!-- 导航栏开始-->
- <?php include(Yii::app()->basePath.'/views/layouts/view_navigation.php');?>
- <!-- 导航栏结束-->
- <div class="test-data">
- <div class="page-content">
- <div class="mcp-title">
- <span class="active">第1步、考试基本信息</span>
- <span><i class="horizontal-line"></i></span>
- <span>第2步、关联在线答题卡</span>
- </div>
- <div class="">
- <div class="mcp-main-con">
- <div class="mcp-form-list clearfix">
- <div class="mcp-form-menu fl">试卷名称</div>
- <div class="mcp-form-detail fl">
- <input type="text" placeholder="必填" class="test-paper-name" name="examName">
- </div>
- <div id="examName-error"></div>
- </div>
- <div class="mcp-form-list clearfix">
- <div class="mcp-form-menu fl">试卷类型</div>
- <div class="mcp-form-detail fl">
- <div class="inp-text pointer">选择试卷类型</div>
- <ul class="select-con tac">
- <?php
- if(!in_array(Yii::app()->session['session_duoxueke_subject_id'],array(18,19)) && Yii::app()->params['section']!=3){
- $paperType = array('1050'=> '其他','0'=> '全国','1'=> '江苏','2'=> '浙江');
- }elseif(Yii::app()->params['section']==3){
- $paperType = array('1050'=> '其他');
- }else{
- $paperType = array('1050'=> '其他');
- }
- ?>
- <?php foreach($paperType as $key => $t):?>
- <li class="sel-paper-type pointer" id="<?php echo $key?>"><?php echo $t?></li>
- <?php endforeach;?>
- </ul>
- </div>
- <div id="paperType-error"></div>
- </div>
- <div class="mcp-form-list clearfix" style="width:1000px">
- <div class="mcp-form-menu fl">考试类型</div>
- <div class="mcp-form-detail fl clearfix">
- <div class="mcp-radio-sel fl examType">
- <span class="sel-btn select" value="1"></span>
- <span>周考</span>
- </div>
- <div class="mcp-radio-sel fl examType">
- <span class="sel-btn" value="2"></span>
- <span>单元考</span>
- </div>
- <div class="mcp-radio-sel fl examType">
- <span class="sel-btn" value="3"></span>
- <span>月考</span>
- </div>
- <div class="mcp-radio-sel fl examType">
- <span class="sel-btn" value="4"></span>
- <span>联考</span>
- </div>
- <div class="mcp-radio-sel fl examType">
- <span class="sel-btn" value="5"></span>
- <span>期中考试</span>
- </div>
- <div class="mcp-radio-sel fl examType">
- <span class="sel-btn" value="6"></span>
- <span>期末考试</span>
- </div>
- <div class="mcp-radio-sel fl examType">
- <span class="sel-btn" value="7"></span>
- <span>模拟考</span>
- </div>
- <div class="mcp-radio-sel fl examType">
- <span class="sel-btn" value="8"></span>
- <span>冲刺考</span>
- </div>
- <div class="clear"></div>
- <div class="mcp-radio-sel fl examType">
- <span class="sel-btn examType" value="9"></span>
- <span>测验(适用于非正式考试)</span>
- </div>
- </div>
- <div id="type-error"></div>
- </div>
- <div class="mcp-form-list clearfix">
- <div class="mcp-form-menu fl">主阅卷员</div>
- <div class="mcp-form-detail fl">
- <select class="sel-option projSelect" style="width: 150px">
- <option value="0">选择阅卷员</option>
- <?php foreach($teacher_arr as $t):?>
- <option class="pointer" value="<?php echo $t['teacher_id']?>"><?php echo $t['teacher_name']?></option>
- <?php endforeach;?>
- </select>
- </div>
- <div id="choose-error"></div>
- </div>
- <div class="mcp-form-list clearfix">
- <div class="mcp-form-menu fl">选择年级</div>
- <div class="mcp-form-detail fl">
- <select class="select-grade" isthird="1" name="select-grade" style="width: 150px">
- <option value="0">请选择</option>
- <?php
- if(isset(Yii::app()->params['grade_config'])){
- foreach (Yii::app()->params['grade_config'] as $id => $item){
- echo '<option value="'.$id.'">'.$item['grade_name'].'</option>';
- }
- }
- ?>
- </select>
- </div>
- <div id="choose-error"></div>
- </div>
- <div class="mcp-form-list clearfix">
- <div class="mcp-form-menu fl">选择班级</div>
- <div class="mcp-form-detail fl">
- <a class="btn btn-success btn-sm select-class">添加班级</a>
- <div class="select-class-list">
- <div class="class-box fl">
- <ul class="selected-box">
- </ul>
- </div>
- </div>
- </div>
- <div id="choose-error"></div>
- </div>
- <div class="mcp-form-list clearfix">
- <div class="mcp-form-menu fl">阅卷方式</div>
- <div class="mcp-form-detail fl clearfix" id ="markType">
- <div class="mcp-radio-sel fl">
- <span class="sel-btn select markType" value="3"></span>
- <span class ="markType" value="3">班级混合阅卷</span>
- </div>
- <div class="<?php if(!in_array(Yii::app()->session['session_duoxueke_subject_id'],array(18,19))){echo 'mcp-radio-sel';}else{echo 'mcp-radio-sel-no';}?> fl">
- <span class="sel-btn markType" value="4" ></span>
- <span class="markType" value="4">班级单独阅卷 <?php if(in_array(Yii::app()->session['session_duoxueke_subject_id'],array(18,19))){echo ' (文理综暂不支持)';}?></span>
- </div>
- <div class="mcp-radio-sel fl">
- <span class="sel-btn markType" value="0"></span>
- <span class="markType" value="0">线下阅卷(暂只支持在线答题卡)</span>
- </div>
- <div id="markType-error"></div>
- </div>
- </div>
- <div class="mcp-form-list clearfix">
- <div class="mcp-form-menu fl">考试时间</div>
- <div class="mcp-form-detail fl clearfix">
- <input type="text" class='core datetimepicker8' style="width: 140px;line-height: 27px;padding-left: 5px;" name="examDate" id="trial_begin_time_test" readonly/>
- </div>
- <div id="examDate"></div>
- </div>
- </div>
- <!-- <div class="template-flag-box"> -->
- <!-- <a href="javascript:;" id="createThird" active="true">保存试卷</a> -->
- <!--<a href="javascript:;" class="template-flag">创建答题卡</a>-->
- <!-- </div> -->
- <div class="template-flag-box">
- <a href="javascript:;" id="createThird" active="true">保存并返回</a>
- <!-- <a href="javascript:;" id="goNext" active="true">保存并下一步</a> -->
- <a href="javascript:;" id="goNextNew" active="true">保存并下一步</a>
- <a href="javascript:;" id="goBack" class="gray" active="true">放弃并返回</a>
- <!--<a href="javascript:;" class="template-flag">创建答题卡</a>-->
- </div>
- <input type="hidden" name="subjectId" value="<?php echo Yii::app()->session['session_duoxueke_subject_id'];?>">
- <input type="hidden" name="textbookId" value="0">
- <input type="hidden" name="tpl_index" value="1050">
- <input type="hidden" name="paperType" value="1050">
- <input name="type" value="1" type="hidden"/>
- <input name="teacherId" value="0" type="hidden"/>
- <input name="markType" value="3" type="hidden"/>
- <input name="classIds" value="0" type="hidden"/>
- <input name="topic" value="0" type="hidden"/>
- <input name="is_update" value="0" type="hidden"/>
- <input name="isQxk" value="<?php echo $is_qxk?>" type="hidden"/>
- <!-- <input name="third_tpl_id" value="<?php echo isset($thisTpls[0]['third_tpl_id'])?$thisTpls[0]['third_tpl_id']:0 ?>" type="hidden"/> -->
- </div>
- </div>
- </div>
- <div class="relation-answer-card">
- <div class="page-content">
- <div class="mcp-title">
- <span >第1步、考试基本信息</span>
- <span><i class="horizontal-line"></i></span>
- <span class="active">第2步、关联在线答题卡</span>
- </div>
- <!-- 新版本右侧答题卡 -->
- <div class="hgc_leftContent">
- <div class="module">
- <h2>
- <span>当前答题卡</span>
- <span class="theme notice">新版本,无需切割模板,可通过扫描入口直接扫描</span>
- </h2>
- <div class="contentInfo">
- <div class="opratorBnts">
- <span class="theme" id="saveMyTpl">保存为我的模版</span>
- <span class="theme" id="downLoadPdfBtn">下载答题卡</span>
- <span class="theme" id="editMyTpl">修改答题卡>></span>
- </div>
- <div class="subjectInfo">
- <div class="infoItem">
- <em>基本信息:</em>
- <div class="info">
- <p>
- <span>板式:A3-横版-三栏</span>
- <span>考号:填涂(10位)</span>
- <span>装订线:有</span>
- <span>总分:150分</span>
- <span>题量:50</span>
- </p>
- </div>
- </div>
- <div class="infoItem">
- <em>题目信息:</em>
- <div class="info">
- <p>
- <span>一、单项填空</span>
- <span>单选</span>
- <span>20题</span>
- <span>共20分</span>
- </p>
- </div>
- </div>
- </div>
- </div>
- <div class="contentNoInfo">
- <!-- <img src="" alt=""> -->
- <span>未创建答题卡</span>
- <div class="hbtn">创建在线答题卡</div>
- </div>
- </div>
- <div class="module">
- <h2>
- <span>我的模版(<em id="tplLength">0</em>)</span>
- </h2>
- <div class="tplBox">
- <div class="leftBtn btnItem"></div>
- <div class="tplCut">
- <div class="tplList">
- </div>
- <p id="tplListMsg" style="text-align: center;">暂未保存模板</p>
- </div>
- <div class="rightBtn btnItem"></div>
- </div>
- </div>
- </div>
- <div class="template-flag-box">
- <a href="javascript:;" id="createThirdCard" active="true">保存并返回</a>
- <a href="javascript:;" id="goBack" class="gray" active="true">放弃并返回</a>
- </div>
- </div>
- </div>
- </div>
- <!-- 弹窗 -->
- <div class="confirmbox-mask" style="display: none;" id="fieldModal">
- <div class="class-modal" style="padding: 0px;">
- <div class="class-modal-head" style="background-color: #2977ff;color: white;height: 30px;font-size: 16px;font-weight: initial;"><span style="float: left;padding: 5px;">选择考试班级</span><span class=" add-class-close" style="float: right;padding: 5px;cursor: pointer;">X</span></div>
- <form id="examSelect">
- <div class="class-modal-body">
- <p class="title">
- <input type="hidden" id="grade_id" name="grade_id" value="0">
- <span style="float: left;" id="gradeTxt">
- </span>
- <span style="margin-left: 300px;">
- <input type="checkbox" id="global_check_all" class="add_class_input"> 全选
- <input type="checkbox" id="global_check_arts" class="add_class_input"> 全部文科班
- <input type="checkbox" id="global_check_science" class="add_class_input"> 全部理科班
- </span>
- </p>
- <div class="class_area" id="class_area">
- <ul class="class_right area_1">
- </ul>
- </div>
- </div>
- <p class="class_btn" style="text-align: center;">
- <input type="hidden" name="exam_gruop_id" value="0">
- <button type="button" class="setting_sumbit" style="margin-right: 10px;">确定</button>
- <button type="button" class="cancel-btn">取消</button>
- </p>
- </form>
- </div>
- </div>
- <script>
- function isReturn(){
- // var isCardReturn = localStorage.getItem('isCardReturn');
- // var isCardReturn = ~document.referrer.indexOf('online/third');
- var locationUrl = window.location.href;
- let isCardReturn = locationUrl.indexOf('isCardReturn')
- if(isCardReturn>-1){
- $('.test-data').hide();
- $('.relation-answer-card').show();
- // saveFormData = JSON.parse(localStorage.getItem('testFormData'));
- }else {
- var locationUrl = window.location.href;
- localStorage.setItem('referrerUrl',JSON.stringify(locationUrl));
- }
- }
- isReturn();
- var TopicType=new Array(5);
- TopicType[0]=[];
- TopicType[1]=[];
- TopicType[2]=[];
- TopicType[3]=[];
- TopicType[4]=[];
- $(document).ready(function(){
- $('.projSelect').select2();
- var showmsg = $("._tpl.active").attr("showmsg");
- if(showmsg>0){
- $("#btnCover").removeClass('dn');
- $(".bnt_width").addClass('c_bnt_width');
- }else {
- $(".bnt_width").removeClass('c_bnt_width');
- $("#btnCover").addClass('dn');
- $("input[name=tpl_title]").val('');
- }
- //选择试卷类型
- $('.sel-paper-type').click(function() {
- var paper_type = $(this).attr('id');
- if (paper_type) {
- $('#paperType-error').html("");
- }
- $('input[name="paperType"]').val(paper_type);
- });
- $('.datetimepicker8').datetimepicker({
- onGenerate:function( ct ){
- $(this).find('.xdsoft_date').toggleClass('xdsoft_disabled');
- $(this).find('.xdsoft_today').removeClass('xdsoft_disabled');
- },
- format:'Y-m-d',
- formatDate:'Y-m-d',
- minDate:'-1970/01/2',
- maxDate:'+1970/01/2',
- todayBtn : true,
- // minDate: '-<?php echo date('Y-m-d', strtotime('Yesterday')); ?>',
- timepicker:false
- });
- //选择考试时间
- //选择教材题源
- var subjects = <?php echo json_encode($teacherSubjectNames); ?>;
- var textbooks = <?php echo json_encode($teacherSubjectMaterialNames); ?>;
- for(var key in subjects){
- $(".choose-grade").append('<option value="'+ key +'">'+ subjects[key] +'</option>');
- }
- $(".choose-grade").change(function(){
- var obj = $(this);
- var val = obj.val();
- var child = $('.choose-book');
- child.html('<option value="0">选择教材</option>');
- for (var key in textbooks) {
- if (key == val) {
- child.html('');
- for (var name in textbooks[key]) {
- child.append('<option value="'+ [name] +'">'+ textbooks[key][name] +'</option>');
- }
- }
- }
- });
- //返回
- $('.mcp-back-btn').click(function(){
- location.href="<?php echo Yii::app()->createUrl('third/index')?>";
- });
- $('input[name="examName"]').keydown(function(event){
- $('#examName-error').html("");
- });
- //阅卷方式
- $('.markType').click(function(){
- var markType = $(this).attr('value');
- if(markType){
- $('#markType-error').html("");
- }
- $('input[name="markType"]').val(markType);
- });
- //考试类型
- $('.examType').click(function(){
- var type = $(this).find("span:eq(0)").attr('value');
- if(type){
- $('#type-error').html("");
- }
- $('input[name="type"]').val(type);
- });
- //选择教师
- $('.sel-option').change(function(){
- var teacher_id = $(this).val();
- if(teacher_id){
- $('#choose-error').html("");
- }
- $('input[name="teacherId"]').val(teacher_id);
- });
- if ($('.sel-classes > span').length > 0){
- for (var i = 0;i < $('.sel-classes > span').length; i++){
- for (var k = 0;k < $('.bjs-lis').length; k++){
- if ($('.bjs-lis').eq(k).text().trim()==$('.sel-classes > span').eq(i).text().trim()) {
- $('.bjs-lis').eq(k).find('.judge-sel').addClass('active');
- }
- }
- }
- }
- $('.mcp-radio-sel').click(function(){
- if (!$(this).find('.sel-btn').hasClass('select')) {
- $(this).find('.sel-btn').addClass('select');
- $(this).siblings().find('.sel-btn').removeClass('select');
- }
- });
- $('.grade-sel ul li').click(function(){
- $(this).addClass('active').siblings().removeClass('active');
- });
- // $('.judge-sel').on('click',function(){
- // alert(1);
- // if (!$(this).hasClass('active')) {
- // $(this).addClass('active');
- // $('.sel-classes').append('<span>'+$(this).closest('.bjs-lis').text()+'</span>');
- // } else {
- // $(this).removeClass('active');
- // for (var i = 0;i < $('.sel-classes > span').length; i++) {
- // console.log($('.sel-classes > span').eq(i).text());
- // if ($('.sel-classes > span').eq(i).text().trim() == $(this).closest('.bjs-lis').text().trim()){
- // $('.sel-classes > span').eq(i).remove();
- // }
- // }
- // }
- // });
- $('.sel-classes > span').click(function(){
- $(this).remove();
- for (var i = 0;i < $('.bjs-lis').length; i++) {
- if ($('.bjs-lis').eq(i).text().trim()==$(this).text().trim()){
- $('.bjs-lis').eq(i).find('.judge-sel').removeClass('active');
- }
- }
- });
- // 下拉列表模拟
- $('.inp-text').click(function(){
- if ($(this).next().is(':hidden')){
- $(this).next().show();
- } else {
- $(this).next().hide();
- }
- });
- // 点下拉列表选项
- $('.select-con li').click(function(){
- $(this).closest('.select-con').hide();
- $(this).closest('.mcp-form-detail').find('.inp-text').text($(this).text());
- });
- // 点击空白处下拉列表消失
- $(document).click(function(e){
- var targetNode = $(e.target).closest(".inp-text");
- if (targetNode.length>0){
- return;
- }else{
- $(".select-con").hide();
- }
- });
- function saveThirdForm(e,btnType){
- var classIds='';
- $(".selected-box").find('li').each(function(index,el){
- classIds += $(el).attr('value')+",";
- });
- $('input[name="classIds"]').val(classIds);
- var error = new Array();
- var classIds = $('input[name="classIds"]').val();
- var examName = $('input[name="examName"]').val();
- var is_update = $('input[name="is_update"]').val();
- var type = $('input[name="type"]').val();
- var teacherId = $('input[name="teacherId"]').val();
- // var markType = $('input[name="markType"]').val();
- var markType = $("#markType").find(".select").attr("value");
- var subjectId = $('input[name=subjectId]').val();
- var examDate = $("input[name='examDate']").val();
- var paperType = $("input[name='paperType']").val();
- if(subjectId == 0 || subjectId == null){
- $('#subject-error').html('请指定题源');
- error.push('没有指定题源');
- }else{
- $('#subject-error').html('');
- }
- if(examName == "" || examName == null){
- $('#examName-error').html('请指定考试名称');
- error.push('没有指定考试名称');
- }else{
- $('#examName-error').html('');
- }
- if(type == "" || type == null){
- $('#type-error').html('请指定考试类型');
- error.push('没有指定考试类型');
- }else{
- $('#type-error').html('');
- }
- if(paperType == 0 || paperType == 1 || paperType == 2 || paperType == 1050){
- $('#paperType-error').html('');
- }else{
- $('#paperType-error').html('请指定正确的试卷类型');
- error.push('请指定正确的试卷类型');
- }
- if(teacherId == '0' || teacherId == null){
- $('#choose-error').html('请指定阅卷老师');
- error.push('没有指定阅卷老师');
- }else{
- $('#choose-error').html('');
- if(classIds == "" || classIds == null){
- $('#classIds-error').html('请指定考试班级');
- error.push('没有指定考试班级');
- }else{
- $('#classIds-error').html('');
- }
- }
- if(!markType){
- $('#markType-error').html('请指定阅卷方式');
- error.push('没有指定阅卷方式');
- }else{
- $('#markType-error').html('');
- }
- if (examDate == '') {
- $('#examDate').html('请设置考试日期');
- error.push('请设置考试日期');
- } else if (examDate < '<?php echo date('Y-m-d'); ?>') {
- // $('#examDate').html('考试日期设置错误');
- // error.push('考试日期设置错误');
- }else{
- $('#examDate').html('');
- }
- if(error.length == 0){
- $("#createThird").attr('active','false');
- var saveFormData={
- examName:examName,
- teacherId:teacherId,
- type:type,
- classIds:classIds,
- markType:markType,
- paperType:paperType,
- subjectId:subjectId,
- textbookId:0,
- examDate:examDate,
- // tpl_index:1050,
- tpl_index:paperType,
- is_update:is_update,
- // topic:JSON.stringify(TopicType),
- layout:$("input[name=layout]:checked").val(),
- select_card_type:$("input[name=select_card_type]:checked").val(),
- third_tpl_id:$("input[name='third_tpl_id']").val(),
- tpl_save_type:$("input[name='tpl_save_type']:checked").val(),
- isQxk:$('input[name="isQxk"]').val()
- };
- $.post("<?php echo Yii::app()->createUrl('third/quanCreatethird')?>",saveFormData,function (data) {
- var m = JSON.parse(data);
- if(m.status==1){
- $('input[name="is_update"]').val(m.exam_group_id);
- saveFormData.examGroupId = m.exam_group_id;
- saveFormData.referrerUrl = window.location.href;
- var addGrade = 0;
- $('.grade-sel ul li').each(function(){
- if($(this).hasClass('active')){
- addGrade = $(this).attr('grade')
- }
- })
- saveFormData.grade = addGrade;
- // var grade = $("input[name='grade']").val();
- // saveFormData.examGroupId = m.exam_group_id;
- localStorage.setItem('testFormData',JSON.stringify(saveFormData));
- if(btnType===1){
- goBack()
- }else if(btnType===2){
- $('.test-data').hide();
- $('.relation-answer-card').show();
- }else if(btnType===3){
- location.href = '/index.php/online/answersheetList/examGroupId/'+saveFormData.examGroupId+'?isThird=1&examGroupId='+saveFormData.examGroupId
- // location.href = '/index.php/third/thirdCardSecond'
- }
- }else{
- layer.msg(m.msg);
- $("#createThird").attr('active','true');
- return false;
- }
- // if(m.status==0)
- // {
- // layer.msg(m.msg);
- // $("#createThird").attr('active','true');
- // return false;
- // }else{
- // $('input[name="is_update"]').val(m.exam_group_id);
- // if(btnType===1){
- // location.href = m.result;
- // }
- // }
- });
- }else{
- layer.msg(error.join(','));
- $("#createThird").attr('active','true');
- }
- }
- function goBack(){
- // location.href = '/index.php/third/index'
- window.history.back();
- }
- $("body").delegate("#createThird[active='true']", "click", function(e) {
- $('#createThird').attr('active',false);
- $('#goNext').attr('active',false);
- $('#goNextNew').attr('active',false);
- saveThirdForm(e,1)
- });
- //保存并关联答题卡
- $("body").delegate("#goNext[active='true']", "click", function(e) {
- $('#createThird').attr('active',false);
- $('#goNext').attr('active',false);
- $('#goNextNew').attr('active',false);
- saveThirdForm(e,2);
- });
- //保存并关联答题卡新版
- $("body").delegate("#goNextNew[active='true']", "click", function(e) {
- $('#createThird').attr('active',false);
- $('#goNext').attr('active',false);
- $('#goNextNew').attr('active',false);
- saveThirdForm(e,3);
- });
- //取消并返回
- $("body").delegate("#goBack[active='true']", "click", function(e) {
- goBack();
- //window.history.back();
- });
- $("#PrintThird").click(function(){
- if (!$(".ques-type-control label input").is(':checked')) {
- layer.msg('请选择题型!');return false;
- }
- if($(".ques-topic-num .ques-topic-item-edit").length > 0){
- layer.msg('请先保存题型!');return false;
- }
- var flag = 0;
- for(i = 0 ; i<TopicType.length;i++)
- {
- if(TopicType[i].length>0){
- flag = 1;
- if( i==4 &&!TopicType[4][0][0]){
- layer.msg('选做题设置有误,题型不能为空!');
- return false;
- }
- for (j = 0;j<TopicType[i].length;j++){
- if(TopicType[i][j][1]=='' || TopicType[i][j][1]==0)
- {
- layer.msg('题号不能为空!');
- return false;
- }
- }
- }
- }
- if(flag == 0){
- layer.msg('题号不能为空!');
- return false;
- }
- $('input[name="topic"]').val(JSON.stringify(TopicType)); //题型选择数据赋值
- var classIds='';
- $(".sel-classes[status=1]").children("span").each(function(){
- classIds += $(this).attr('classid')+",";
- });
- $('input[name="classIds"]').val(classIds);
- var examName = $('input[name="examName"]').val();
- var classIds = $('input[name="classIds"]').val();
- var data = {
- examName:examName,
- classIds:classIds,
- layout:$("input[name=layout]:checked").val(),
- select_card_type:$("input[name=select_card_type]:checked").val(),
- topic:JSON.stringify(TopicType)
- };
- $.post("<?php echo Yii::app()->createUrl('third/create_sheet')?>",data,function (rs) {
- var m = JSON.parse(rs);
- if(m.status==0)
- {
- layer.msg(m.msg);
- return false;
- }else{
- evaluationClient.CreateDiSanFang(JSON.stringify(m.result));
- }
- });
- });
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- $("body").delegate("#btnSubmit[active='true']", "click", function(e) {
- var classIds='';
- $(".sel-classes[status=1]").children("span").each(function(){
- classIds += $(this).attr('classid')+",";
- });
- $('input[name="classIds"]').val(classIds);
- var classIds = $('input[name=classIds]').val();
- var teacherId = $('input[name="teacherId"]').val();
- var subjectId = $('input[name=subjectId]').val();
- var tpl_title = $('input[name=tpl_title]').val();
- if(tpl_title == "" || tpl_title == null){
- layer.msg('没有指定模板名称!');return false;
- }
- if(subjectId == 0 || subjectId == null){
- layer.msg('没有指定题源!');return false;
- }
- if(teacherId == '0' || teacherId == null){
- $('#choose-error').html('请指定阅卷老师');
- layer.msg('没有指定阅卷老师!');return false;
- }else{
- $('#choose-error').html('');
- if(classIds == "" || classIds == null){
- $('#classIds-error').html('请指定考试班级');
- layer.msg('没有指定考试班级!');return false;
- }else{
- $('#classIds-error').html('');
- }
- }
- if (!$(".ques-type-control label input").is(':checked')) {
- layer.msg('请选择题型!');return false;
- }
- var flag = 0;
- for(i = 0 ; i<TopicType.length;i++)
- {
- if(TopicType[i].length>0){
- flag = 1;
- if( i==4 &&!TopicType[4][0][0]){
- layer.msg('选做题设置有误,题型不能为空!');
- return false;
- }
- for (j = 0;j<TopicType[i].length;j++){
- if(TopicType[i][j][1]=='' || TopicType[i][j][1]==0)
- {
- layer.msg('题号不能为空!');
- return false;
- }
- }
- }
- }
- if(flag == 0){
- layer.msg('题号不能为空!');
- return false;
- }
- var data={
- tpl_title:tpl_title,
- teacherId:teacherId,
- classIds:classIds,
- subjectId:subjectId,
- textbookId:0,
- topic:JSON.stringify(TopicType),
- layout:$("input[name=layout]:checked").val(),
- select_card_type:$("input[name=select_card_type]:checked").val()
- };
- $.post("<?php echo Yii::app()->createUrl('third/createThirdTpl')?>",data,function (data) {
- var m = JSON.parse(data);
- if(m.status==1)
- { //$('#btnSubmit').attr('active','false');
- // layer.msg(m.msg);
- $(".template-box").prepend('<li class="_tpl" showmsg="1" third_tpl_id="'+m.result.third_tpl_id+'"><a href="#"><div class="card-type"><span class="size">'+m.result.layout+'</span><span class="type">'+m.result.select_card_type+'</span><i class="icon-delete"></i></div> <p class="card-name">'+m.result.title+'</p></a></li>');
- $("input[name=third_tpl_id]").val(m.result.third_tpl_id);
- $("._tpl.active").removeClass('active');
- $("._tpl").eq(0).addClass('active');
- $("#btnCover").removeClass('dn');
- layer.msg('保存成功!',{
- icon: 1
- });
- $(".ttd").hide();
- $(".bnt_width").addClass('c_bnt_width');
- return false;
- }else{
- layer.msg('保存失败',{
- icon: 5
- }, function(){
- $(".ttd").fadeOut();
- });
- return false;
- }
- });
- });
- $("body").delegate("#btnCover[active='true']", "click", function(e) {
- var classIds='';
- $(".sel-classes[status=1]").children("span").each(function(){
- classIds += $(this).attr('classid')+",";
- });
- $('input[name="classIds"]').val(classIds);
- // var classIds = $('input[name=classIds]').val();
- var teacherId = $('input[name="teacherId"]').val();
- var subjectId = $('input[name=subjectId]').val();
- var tpl_title = $('input[name=tpl_title]').val();
- if(tpl_title == "" || tpl_title == null){
- layer.msg('没有指定模板名称!');return false;
- }
- if(subjectId == 0 || subjectId == null){
- layer.msg('没有指定题源!');return false;
- }
- if(teacherId == '0' || teacherId == null){
- $('#choose-error').html('请指定阅卷老师');
- layer.msg('没有指定阅卷老师!');return false;
- }else{
- $('#choose-error').html('');
- if(classIds == "" || classIds == null){
- $('#classIds-error').html('请指定考试班级');
- layer.msg('没有指定考试班级!');return false;
- }else{
- $('#classIds-error').html('');
- }
- }
- if (!$(".ques-type-control label input").is(':checked')) {
- layer.msg('请选择题型!');return false;
- }
- var flag = 0;
- for(i = 0 ; i<TopicType.length;i++)
- {
- if(TopicType[i].length>0){
- flag = 1;
- if( i==4 &&!TopicType[4][0][0]){
- layer.msg('选做题设置有误,题型不能为空!');
- return false;
- }
- for (j = 0;j<TopicType[i].length;j++){
- if(TopicType[i][j][1]=='' || TopicType[i][j][1]==0)
- {
- layer.msg('题号不能为空!');
- return false;
- }
- }
- }
- }
- if(flag == 0){
- layer.msg('题号不能为空!');
- return false;
- }
- var data={
- tpl_title:tpl_title,
- third_tpl_id:$("._tpl.active").attr('third_tpl_id'),
- teacherId:teacherId,
- classIds:classIds,
- subjectId:subjectId,
- textbookId:0,
- topic:JSON.stringify(TopicType),
- layout:$("input[name=layout]:checked").val(),
- select_card_type:$("input[name=select_card_type]:checked").val()
- };
- $.post("<?php echo Yii::app()->createUrl('third/updateThirdTpl')?>",data,function (data) {
- var m = JSON.parse(data);
- if(m.status==1)
- {
- $("._tpl.active").children().find('.size').html(m.result.layout);
- $("._tpl.active").children().find('.type').html(m.result.select_card_type);
- $("._tpl.active").children().find('.card-name').html(m.result.title);
- $("._tpl.active").removeClass('active');
- $("._tpl").eq(0).addClass('active');
- layer.msg('保存成功!',{
- icon: 1
- });
- $(".ttd").fadeOut();
- $("#btnCover").removeClass('dn');
- $(".bnt_width").addClass('c_bnt_width');
- return false;
- }else{
- layer.msg('保存失败',{
- icon: 5
- }, function(){
- $(".ttd").fadeOut();
- });
- return false;
- }
- });
- });
- $("#btnClose").click(function(){
- $(this).parents(".ttd").fadeOut();
- });
- $(".shut").click(function(){
- $("body").css({height :"100%",overflow:"auto"});
- });
- });
- </script>
- <script>
- var subjects = [];
- $(function(){
- //console.log(firstCartTpl);
- // if(firstCartTpl!='null'){
- // TopicType=firstCartTpl;
- // }
- // $(".template-flag").click(function(){
- // FillCard();
- // $(".teamplate-list-box").toggle();
- // });
- // 点击显示隐藏
- $(".ques-type-control label input").click(function(e){
- var index=$(this).parent().index();
- var tempTopic = $(".ques-topic-num .ques-topic").eq(index);
- delTopicType(tempTopic);
- if($(this).is(":checked")){
- $(this).parent("label").addClass("active");
- tempTopic.find(".include-text").val("");
- tempTopic.find(".include-count").val("");
- tempTopic.show();
- if(index==0 || index==1){
- TopicType[index].push([4,'',0]); //对应数据初始化对应题型,题号,样式三种数据
- }else if(index==2){
- TopicType[index].push([1,'',1]); //对应数据初始化对应题型,题号,样式三种数据
- }else if(index==3){
- TopicType[index].push([1,'',0]); //对应数据初始化对应题型,题号,样式三种数据
- }else if(index==4){
- TopicType[index].push([0,'',0]); //对应数据初始化对应题型,题号,样式三种数据
- }
- //console.log(TopicType);
- }else{
- $(this).parent("label").removeClass("active")
- tempTopic.hide();
- if(index==0 || index==1){
- tempTopic.find(".ques-topic-list").eq(0).find("input").val("");
- tempTopic.find(".ques-topic-list").find('.topic-num input').val('');
- tempTopic.find(".ques-topic-list").eq(0).find(".ques-topic-item").removeClass("ques-topic-item-edit").find("a").html("选项编辑");
- }else if(index==2){
- // console.log(tempTopic.find(".ques-topic-list").find('.topic-num').find('input').val());
- tempTopic.find(".ques-topic-list").find('.topic-num').find('input').val('');
- tempTopic.find(".ques-topic-list").find('.line-control').find('input').val(1);
- tempTopic.find(".ques-topic-list").eq(0).find(".ques-topic-item").find('label input').eq(0).click();
- tempTopic.find(".line-type label:first input").prop("checked",true);
- }else if(index==3){
- tempTopic.find(".ques-topic-list").find('.topic-num input').val('');
- tempTopic.find(".ques-topic-list").eq(0).find("input").val("");
- tempTopic.find(".ques-topic-list").find('.line-control').find('input').val(1);
- tempTopic.find(".ques-topic-list").eq(0).find(".ques-topic-item").find('label input').eq(0).click();
- tempTopic.find(".line-type label:first input").prop("checked",true);
- tempTopic.find(".line-type label").eq(0).find("input").prop("checked",true);
- }
- tempTopic.find(".ques-topic-list").eq(0).find("em").remove();
- for(var i=0;i<4;i++){
- tempTopic.find(".ques-topic-list").eq(0).find("s").before("<em>【"+arr[i]+"】<b></b></em>");
- }
- for(var i=tempTopic.find(".ques-topic-list").length;i>1;i--){
- tempTopic.find(".ques-topic-list:last").remove();
- }
- TopicType[index]=[]; //清空对应数据
- // console.log(TopicType);
- }
- $("input[name=bixuan]").val(1);
- totalTopicCount();
- });
- // 答题卡类型选择
- $(".card-style a").click(function(){
- $(this).addClass("active").siblings().removeClass("active");
- $(".card-select").eq($(this).index()).addClass("cur").siblings().removeClass("cur");
- $(".card-select").eq($(this).index()).find("input:eq(0)").prop("checked",true).siblings().prop("checked",false);
- })
- // 选项编辑
- $("body").delegate(".ques-topic-item a","click",function(){
- if($(this).closest(".ques-topic-item").hasClass("ques-topic-item-edit")){
- $(this).closest(".ques-topic-item").removeClass("ques-topic-item-edit");
- $(this).html("选项编辑");
- $(this).closest(".ques-topic-item").find("s").hide();
- //装入修改后数据
- var index=$(this).closest('.ques-topic').index(); //第几个大类型
- var topic_index=$(this).closest('.ques-topic-list').index()-1; //该题型下第几个子题型
- TopicType[index][topic_index][0]=$(this).parent().find('em').length;
- // console.log(TopicType);
- }else{
- $(this).closest(".ques-topic-item").addClass("ques-topic-item-edit");
- $(this).siblings("s").show();
- if($(this).closest(".ques-topic").hasClass("ques-topic-one")){
- // console.log($(this).closest(".ques-topic-item").find("em").length)
- if($(this).closest(".ques-topic-item").find("em").length >3){
- $(this).siblings("s").hide();
- }else{
- $(this).siblings("s").show();
- }
- }else{
- // console.log($(this).closest(".ques-topic-item").find("em").length)
- if($(this).closest(".ques-topic-item").find("em").length >6){
- $(this).siblings("s").hide();
- }else{
- $(this).siblings("s").show();
- }
- }
- $(this).html("保存");
- }
- });
- // 删除选项
- $("body").delegate(".ques-topic-item-edit b","click",function(){
- if($(this).closest(".ques-topic-item-edit").find("em").length <= 10){
- $(this).closest(".ques-topic-item-edit").find("s").show();
- }
- var tempParent = $(this).closest(".ques-topic-item-edit");
- $(this).closest("em").remove();
- orderABC(tempParent.find("em"))
- hideDel(tempParent.find("b"))
- });
- function orderABC(obj){
- for(var i=0;i<obj.length;i++){
- obj.eq(i).html("【"+arr[i]+"】<b></b>")
- }
- }
- // 增加选项
- var arr = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N'];
- $("body").delegate(".ques-topic-item-edit s","click",function(){
- if($(this).closest(".ques-topic").hasClass("ques-topic-one")){
- addAbc($(this),4)
- }else{
- addAbc($(this),7)
- }
- });
- function addAbc(obj,count){
- var idx = obj.closest(".ques-topic-item-edit").find("em").length;
- obj.before("<em>【"+arr[idx]+"】<b></b></em>");
- hideDel(obj.closest(".ques-topic-item-edit").find("b"))
- if(obj.closest(".ques-topic-item-edit").find("em").length >= count){
- obj.hide();
- }
- }
- // 增加题型
- $(".add-type a").click(function(){
- var temp = $(this).closest(".add-type").prev().clone(true);
- temp.find(".topic-point-num").html($(this).closest(".add-type").prev().index()+1);
- temp.find(".ques-topic-item").removeClass("ques-topic-item-edit").find("a").html("选项编辑");
- temp.find("em").remove();
- for(var i=0;i<temp.find("input[type='text']").length;i++){
- if(!temp.find("input[type='text']").eq(i).hasClass("choose-count")){
- temp.find("input[type='text']").eq(i).val("")
- }
- }
- for(var i=0;i<4;i++){
- temp.find("s").before("<em>【"+arr[i]+"】<b></b></em>");
- }
- //主观题
- if($(this).hasClass("main-topic")){
- temp.find("input[name^='topicType']").attr("name","topicType_"+($(this).closest(".ques-topic").find(".ques-topic-list").length));
- temp.find(".line-control input").val(1)
- }
- //填空题
- if($(this).hasClass("tian_main-topic")){
- temp.find("input[name^='tianketi_Type']").attr("name","tianketi_Type_"+($(this).closest(".ques-topic").find(".ques-topic-list").length));
- temp.find(".line-control input").val(1)
- }
- //选做题
- if($(this).hasClass("xuan-main-topic")){
- temp.find("input[name^='chooseType']").attr("name","chooseType_"+($(this).closest(".ques-topic").find(".ques-topic-list").length));
- }
- temp.find('input:radio').each(function(i){
- temp.find('input:radio').eq(i).attr('checked',false);
- });
- var index=$(this).closest('.ques-topic').index(); //第几个大类型
- //判断数量
- if(index==4 && $(this).closest(".ques-topic").find(".ques-topic-list").length>2){
- return false;
- }
- $(this).closest(".add-type").before(temp);
- if(index==0 || index==1){
- TopicType[index].push([4,'',0]); //对应数据初始化对应题型,题号,样式三种数据
- }else if(index==2){
- $style=$('.line-type input:radio:checked').parent().index()+1;
- temp.find('.line-control').css("display","inline-block");
- TopicType[index].push([1,'',$style]); //对应数据初始化对应题型,题号,样式三种数据
- }else if(index==3){
- var topicTypeIndex=$(this).closest(".ques-topic").find(".ques-topic-list").length;
- temp.find("input[name='topicType_"+topicTypeIndex+"']").eq(0).click();
- $style=$('input[name=lineType]:checked').val();
- temp.find('.line-control').hide();
- TopicType[index].push([1,'',$style]); //对应数据初始化对应题型,题号,样式三种数据
- }else if(index==4){
- $("input[name=bixuan]").val(1);
- var topicTypeIndex=$(this).closest(".ques-topic").find(".ques-topic-list").length;
- TopicType[index].push([0,'',1]); //对应数据初始化对应题型,题号,样式三种数据
- $(this).closest(".ques-topic").last().find("input[name='chooseType_"+(topicTypeIndex-1)+"']").eq(0).click();
- }
- delTopicType($(this).closest(".add-type").siblings(".ques-topic-list"));
- // console.log(TopicType);
- })
- // 显示隐藏主观题横线行数
- initTopicType($(".ques-topic-item input[type='radio']"))
- function initTopicType(obj){
- if(obj.val() == 2){
- obj.closest("label").siblings(".line-control").css("display","inline-block");
- }else{
- obj.closest("label").siblings(".line-control").hide();
- }
- }
- // 删除题型
- function delTopicType(obj){
- obj.find(".ques-item-del").show();
- obj.eq(0).find(".ques-item-del").hide();
- }
- $("body").delegate(".ques-item-del","click",function(){
- var index=$(this).closest('.ques-topic').index(); //大题型索引
- var topic_index=$(this).closest('.ques-topic-list').index()-1;//子题型索引
- if(topic_index!=0){
- TopicType[index].splice(topic_index,1);
- // console.log(TopicType[index]);
- var pBox = $(this).closest(".ques-topic");
- $(this).closest(".ques-topic-list").remove();
- pBox.find(".item-count").html(topicCount(pBox));
- pBox.find('.topic-point-num').each(function(index,val){
- if(index != 0){
- $(this).html(index+1)
- }
- })
- totalTopicCount();
- }
- })
- // 主观题样式切换
- $("body").delegate(".ques-topic-item input[type='radio']","click",function(){
- initTopicType($(this));
- var index=$(this).closest('.ques-topic').index(); //大题型索引
- var topic_index=$(this).closest('.ques-topic-list').index()-1;//子题型索引
- if($(this).val()==2 && index!=2){
- $(this).closest('.ques-topic-item').find('.line-control').css("display","inline-block");
- TopicType[index][topic_index][0]=$(this).val()+'///'+$(this).closest('.ques-topic-item').find('.line-control input').val();
- }else{
- TopicType[index][topic_index][0]=$(this).val();
- if($(this).val()==2){
- $(this).closest('.ques-topic-item').find('.line-control').css("display","inline-block");
- }else{
- $(this).closest('.ques-topic-item').find('.line-control').hide();
- }
- }
- console.log(TopicType);
- });
- // 主观题样式图片显示隐藏
- $("body").delegate(".ques-topic-item .ques-style","mouseenter",function(){
- $(this).find("img").show();
- });
- $("body").delegate(".ques-topic-item .ques-style","mouseleave",function(){
- $(this).find("img").hide();
- });
- // 主观题横线行数加减
- $("body").delegate(".line-control .add","click",function(){
- $(this).siblings("input").val(Number($(this).siblings("input").val())+1);
- var index=$(this).closest('.ques-topic').index(); //大题型索引
- var topic_index=$(this).closest('.ques-topic-list').index()-1;//子题型索引
- if(TopicType[index][topic_index][0]){
- if(index!=2){
- TopicType[index][topic_index][0]='2///'+$(this).siblings("input").val();
- }else{
- TopicType[index][topic_index][0]=$(this).siblings("input").val();
- }
- }
- });
- $("body").delegate(".line-control .del","click",function(){
- if(Number($(this).siblings("input").val()) > 1){
- $(this).siblings("input").val(Number($(this).siblings("input").val())-1);
- var index=$(this).closest('.ques-topic').index(); //大题型索引
- var topic_index=$(this).closest('.ques-topic-list').index()-1;//子题型索引
- if(index!=2){
- TopicType[index][topic_index][0]='2///'+$(this).siblings("input").val();
- }else{
- TopicType[index][topic_index][0]=$(this).siblings("input").val();
- }
- }
- });
- // 校验文本框输入
- $("body").delegate(".topic-num input,.topic-num-choose input","keyup",function(){
- $(this).val($(this).val().replace(/[^\d-,]+/g,""));
- });
- $("body").delegate(".choose-topic-num input,.include-list input","keyup",function(){
- $(this).val($(this).val().replace(/[^\d]+/g,""));
- })
- // 小题校验
- $("body").delegate(".include-list .include-text","blur",function(){
- var tNo = trimArr($(this).closest(".include-list").siblings(".topic-num").find("input").val());
- var sibIpt = $(this).closest(".ques-topic").find(".include-text");
- var count = 0;
- for(var i=0;i<sibIpt.length;i++){
- if($(this).val() == sibIpt.eq(i).val()){
- count++;
- if(count > 1){
- layer.msg('小题题号不能重复!');
- $(this).val("");
- break;
- }
- }
- }
- if($(this).val()){
- console.log($(this).val())
- console.log(tNo)
- if(tNo.indexOf($(this).val()) == -1){
- layer.msg('请输入有效题号!');
- $(this).val("");
- }
- }
- if($(this).val() != "" && $(this).next().val() != ""){
- var bigTopic = $(this).val();
- var smallTopic = $(this).next().val();
- var index=$(this).closest('.ques-topic').index(); //大题型索引
- var topic_index=$(this).closest('.ques-topic-list').index()-1;//子题型索引
- if(TopicType[index][topic_index][3]){
- var tp3Arr = TopicType[index][topic_index][3].split(",");
- var tp3StrNext = '';
- var isHave = 0;
- for(var i=0;i<tp3Arr.length;i++){
- var tp3ArrNext = tp3Arr[i].split("///");
- console.log(tp3ArrNext);
- if(tp3ArrNext[0] == bigTopic){
- tp3ArrNext[1] == smallTopic;
- isHave = 1;
- }
- if(tp3StrNext == ""){
- tp3StrNext = tp3ArrNext.join("///");
- }else{
- tp3StrNext += ","+tp3ArrNext.join("///");
- }
- }
- if(isHave == 0){
- TopicType[index][topic_index][3] += ','+bigTopic+"///"+smallTopic;
- }else{
- TopicType[index][topic_index][3] = tp3StrNext;
- }
- }else{
- TopicType[index][topic_index][3] = bigTopic+"///"+smallTopic;
- }
- }
- })
- $("body").delegate(".include-list .include-count","blur",function(){
- if($(this).val() != "" && $(this).prev().val() != ""){
- var bigTopic = $(this).prev().val();
- var smallTopic = $(this).val();
- var index=$(this).closest('.ques-topic').index(); //大题型索引
- var topic_index=$(this).closest('.ques-topic-list').index()-1;//子题型索引
- if(TopicType[index][topic_index][3]){
- var tp3Arr = TopicType[index][topic_index][3].split(",");
- var tp3StrNext = '';
- var isHave = 0;
- for(var i=0;i<tp3Arr.length;i++){
- var tp3ArrNext = tp3Arr[i].split("///");
- if(tp3ArrNext[0] == bigTopic){
- tp3ArrNext[1] = smallTopic;
- isHave = 1;
- }
- if(tp3StrNext == ""){
- tp3StrNext = tp3ArrNext.join("///");
- }else{
- tp3StrNext += ","+tp3ArrNext.join("///");
- }
- }
- if(isHave == 0){
- TopicType[index][topic_index][3] += ','+bigTopic+"///"+smallTopic;
- }else{
- TopicType[index][topic_index][3] = tp3StrNext;
- }
- }else{
- TopicType[index][topic_index][3] = bigTopic+"///"+smallTopic;
- }
- console.log(TopicType);
- }
- })
- // 选做题校验
- $("body").delegate(".choose-all-count","blur",function(){
- // if(parseInt($(this).val()) > parseInt($(this).siblings(".choose-all-count").val())){
- // layer.msg('sorry,选题数不能大于总题数!');
- // $(this).val("");
- // }
- $(this).closest(".ques-topic").find(".item-count").html(topicCount($(this).closest(".ques-topic")))
- totalTopicCount();
- })
- // choose-count
- //题号计算,10-20
- function trimArr(str){
- if(!str) return [];
- var arr1 = str.split(",");
- var arrNo = [];
- for(var i=0;i<arr1.length;i++){
- var arr2 = arr1[i].split("-");
- for(var j=0;j<arr2.length;j++){
- if(arr2[j] == "" || typeof(arr2[j]) == "undefined"){
- arr2.splice(j,1);
- j= j-1;
- }
- }
- if(arr2.length > 1){
- for(var j = parseInt(arr2[0]);j<=parseInt(arr2[1]);j++){
- arrNo.push(j+'')
- }
- }else{
- if(arr2[0]){
- arrNo.push(arr2[0]+'')
- }
- }
- }
- // console.log(repArr(arrNo))
- return repArr(arrNo);
- }
- //数组去重
- function repArr(arr) {
- for (var i = 0; i < arr.length; i++) {
- if (arr.indexOf(arr[i]) != i) {
- arr.splice(i,1);//删除数组元素后数组长度减1后面的元素前移
- i--;//数组下标回退
- }
- }
- return arr;
- }
- // 题量计算 item-count
- function topicCount(obj){
- var tType = obj.find(".topic-num input");
- var tCountObj = obj.find(".include-count");
- var tChooseObj = obj.find(".choose-count")
- var tempNoStr = "";
- var count = 0;
- for(var i=0;i<tType.length;i++){
- tempNoStr += (','+tType.eq(i).val());
- }
- count = trimArr(tempNoStr).length;
- for(var i=0;i<tCountObj.length;i++){
- if(tCountObj.eq(i).val()){
- count += (tCountObj.eq(i).val()-1)
- }
- }
- for(var i=0;i<tChooseObj.length;i++){
- if(tChooseObj.eq(i).val()){
- count += parseInt(tChooseObj.eq(i).val())
- }
- }
- return count
- }
- function totalTopicCount(){
- var totalCount = 0;
- // for(var i=0;i<$(".item-count").length;i++){z
- // totalCount += parseInt($('.item-count').eq(i).html())
- // }
- for(var i=0;i<$(".ques-topic").length;i++){
- if($(".ques-topic").eq(i).css("display") == "block"){
- totalCount += topicCount($(".ques-topic").eq(i));
- }
- }
- $(".total-count").html(totalCount)
- }
- $("body").delegate(".include-count","blur",function(){
- if($(this).val() == "") return;
- // console.log("sb")
- if($(this).val() > 1){
- $(this).closest(".ques-topic").find(".item-count").html(topicCount($(this).closest(".ques-topic")))
- }else{
- layer.msg('小题数量最小为2!');
- $(this).val('')
- $(this).closest(".ques-topic").find(".item-count").html(topicCount($(this).closest(".ques-topic"))+1)
- }
- totalTopicCount();
- })
- $("body").delegate(".topic-num input","blur",function(){
- $(this).closest(".ques-topic").find(".item-count").html(topicCount($(this).closest(".ques-topic")));
- totalTopicCount();
- });
- // 试题内包含小题
- $("body").delegate(".include-topic a","click",function(){
- var tNo = trimArr($(this).parent().siblings(".topic-num").find("input").val());
- var ulList = $(this).parent().siblings().find('ul');
- if(tNo.length == 0){
- layer.msg('sorry,空题不能添加小题!');
- return;
- }else if(tNo.length <= ulList.children().length){
- layer.msg('请先添加题号,谢谢!');
- return;
- }
- ulList.append('<li>第 <input type="text" class="include-text"> 题有 <input type="text" class="include-count"> 个小题 <img src="/images/u434.png" class="del-include"></li>');
- })
- // 删除小题
- $("body").delegate(".del-include","click",function(){
- var This = $(this);
- var pBox = $(this).closest(".ques-topic");
- var index=This.closest('.ques-topic').index(); //大题型索引
- var topic_index=This.closest('.ques-topic-list').index()-1;//子题型索引
- var text = '';
- var textArr = [];
- $($(this).parent().parent().find("li")).each(function(k,v){
- if(k < $(this).parent().parent().find("li").length - 1){
- var include_text = $(this).find(".include-text").val();
- var include_count = $(this).find(".include-count").val();
- if(include_text > 0 && include_count > 0){
- var textArrNext = include_text+'///'+include_count;
- textArr.push(textArrNext);
- }
- }
- });
- if(textArr.length>0){
- text = textArr.join(',');
- }
- TopicType[index][topic_index][3] = text;
- This.closest("li").remove();
- pBox.find(".item-count").html(topicCount(pBox))
- totalTopicCount();
- layer.msg('删除成功!');
- })
- //题号变化,修改数据
- $('.ques-topic-num').on('change','.topic-num input',function(){
- var index=$(this).closest('.ques-topic').index(); //大题型索引
- var topic_index=$(this).closest('.ques-topic-list').index()-1;//子题型索引
- var text=0;
- if($(this).val()!='' && $(this).val()!=undefined){
- text=$(this).val();
- }
- TopicType[index][topic_index][1]=text;
- // console.log(TopicType);
- });
- $('.ques-topic-num').on('change','.topic-num-choose input',function(){
- var index=$(this).closest('.ques-topic').index(); //大题型索引
- var topic_index=$(this).closest('.ques-topic-list').index()-1;//子题型索引
- var text=0;
- if($(this).val()!='' && $(this).val()!=undefined){
- text=$(this).val();
- }
- TopicType[index][topic_index][1]=text;
- // console.log(TopicType);
- });
- //主观题样式变化,修改数据
- $('.line-type label').click(function(){
- //alert($(this).index());
- var idx = $(this).closest(".ques-topic").index();
- if(!(idx==2||idx==3)) return;
- for(var i=0;i<TopicType[idx].length;i++){
- TopicType[idx][i][2]=$(this).index()+1;
- }
- // console.log(TopicType);
- });
- //选做题
- //题号
- $('.ques-topic').on('change','.choose-topic-num input',function(){
- //alert($(this).index());
- var text='';
- if($(this).index()==0){
- text=$(this).val()+'///'+$(this).next().val();
- }else{
- text=$(this).prev().val()+'///'+$(this).val();
- }
- var index=$(this).closest('.ques-topic').index(); //大题型索引
- var topic_index=$(this).closest('.ques-topic-list').index()-1;//子题型索引
- TopicType[index][topic_index][0]=text;
- // console.log(TopicType);
- });
- //样式
- $('.ques-topic').on('click','.choose-topic input:radio',function(){
- var index=$(this).closest('.ques-topic').index(); //大题型索引
- var topic_index=$(this).closest('.ques-topic-list').index()-1;//子题型索引
- TopicType[index][topic_index][2]=$(this).val();
- });
- function hideDel(obj){
- if(obj.length > 2){
- obj.closest(".ques-topic-item-edit").find("b").css("display","inline");
- }else{
- obj.closest(".ques-topic-item-edit").find("b").hide()
- }
- }
- $("body").on("click","._tpl",function(){
- var showmsg = $(this).attr("showmsg");
- if(showmsg>0){
- $("#btnCover").removeClass('dn');
- $(".bnt_width").addClass('c_bnt_width');
- $("input[name=tpl_title]").val($(this).find(".card-name").html());
- }else {
- $("input[name=layout]").eq(0).prop("checked",true);
- $("input[name=select_card_type]").eq(0).prop("checked",true);
- $(".bnt_width").removeClass('c_bnt_width');
- $("#btnCover").addClass('dn');
- $("input[name=tpl_title]").val('');
- }
- $("._tpl.active").removeClass('active');
- $(this).addClass("active");
- var data = {
- third_tpl_id:$(this).attr("third_tpl_id")
- };
- if(showmsg>0){
- $.post("<?php echo Yii::app()->createUrl('third/getThirdTpl')?>",data,function (res) {
- /**
- * 处理处理
- * */
- if(res.result.tpl_data){
- TopicType=$.parseJSON(res.result.tpl_data);
- FillCard();
- // $("input[name=layout][value="+res.result.layout+"]").prop("checked",true);
- // $("input[name=select_card_type][value="+res.result.select_card_type+"]").prop("checked",true);
- $('input[name="third_tpl_id"]').val(res.result.third_tpl_id);
- if(res.result.layout == 10 || res.result.layout == 11){
- $(".card-select").eq(1).addClass("cur").siblings().removeClass("cur");
- $(".card-style a").eq(1).addClass("active").siblings().removeClass("active");
- $("input[name=layout][value="+res.result.layout+"]").prop("checked",true);
- }else if(res.result.layout == 21 || res.result.layout == 31){
- $(".card-select").eq(0).addClass("cur").siblings().removeClass("cur");
- $(".card-style a").eq(0).addClass("active").siblings().removeClass("active");
- $("input[name=layout][value="+res.result.layout+"]").prop("checked",true);
- }else if(res.result.layout == 40 || res.result.layout == 41){
- $(".card-select").eq(2).addClass("cur").siblings().removeClass("cur");
- $(".card-style a").eq(2).addClass("active").siblings().removeClass("active");
- $("input[name=layout][value="+res.result.layout+"]").prop("checked",true);
- }else if(res.result.layout == 50 || res.result.layout == 51){
- $(".card-select").eq(3).addClass("cur").siblings().removeClass("cur");
- $(".card-style a").eq(3).addClass("active").siblings().removeClass("active");
- $("input[name=layout][value="+res.result.layout+"]").prop("checked",true);
- }
- // console.log(TopicType[0].length);
- }
- console.log(TopicType);
- },'json');
- }else{
- //创建新的答题卡
- TopicType[0]=[];
- TopicType[1]=[];
- TopicType[2]=[];
- TopicType[3]=[];
- TopicType[4]=[];
- $('input[name="third_tpl_id"]').val(0);
- FillCard();
- console.log(TopicType);
- }
- //获取模板数据
- });
- $("body").delegate(".icon-delete","click",function(){
- var obj = $(this);
- layer.msg("确定要永久删除此模板吗?", {
- time: 0,
- btn: ['确定', '取消'],
- yes: function(index){
- layer.close(index);
- $.ajax({
- url: "<?php echo Yii::app()->createUrl('third/delThirdTpl')?>",
- type: "POST",
- dataType: "json",
- data:{
- third_tpl_id:$("._tpl.active").attr('third_tpl_id')
- },
- success: function (m){
- if(m.status){
- layer.msg('删除成功',{
- icon: 1
- }, function(){
- layer.closeAll();
- $("input[name=layout]").eq(0).prop("checked",true);
- $("input[name=select_card_type]").eq(0).prop("checked",true);
- $(".bnt_width").removeClass('c_bnt_width');
- $("#btnCover").addClass('dn');
- $("input[name=tpl_title]").val('');
- $("._tpl.active").removeClass('active');
- $("._tpl:last").addClass("active");
- obj.closest('._tpl').remove();
- //创建新的答题卡
- TopicType[0]=[];
- TopicType[1]=[];
- TopicType[2]=[];
- TopicType[3]=[];
- TopicType[4]=[];
- $('input[name="third_tpl_id"]').val(0);
- FillCard();
- });
- }
- },
- error: function (data, status, e){ //服务器响应失败处理函数
- layer.msg('返回失败!',{
- icon: 5
- }, function(){
- layer.closeAll();
- });
- }
- });
- }
- });
- });
- //saveCard
- $("#saveCard").click(function(){
- var classIds='';
- $(".sel-classes[status=1]").children("span").each(function(){
- classIds += $(this).attr('classid')+",";
- });
- $('input[name="classIds"]').val(classIds);
- var classIds = $('input[name="classIds"]').val();
- var teacherId = $('input[name="teacherId"]').val();
- var subjectId = $('input[name=subjectId]').val();
- if(subjectId == 0 || subjectId == null){
- layer.msg('没有指定题源!');return false;
- }else{
- $('#subject-error').html('');
- }
- if(teacherId == '0' || teacherId == null){
- $('#choose-error').html('请指定阅卷老师');
- layer.msg('没有指定阅卷老师!');return false;
- }else{
- $('#choose-error').html('');
- if(classIds == "" || classIds == null){
- $('#classIds-error').html('请指定考试班级');
- layer.msg('没有指定考试班级!');return false;
- }else{
- $('#classIds-error').html('');
- }
- }
- if (!$(".ques-type-control label input").is(':checked')) {
- layer.msg('请选择题型!');return false;
- }
- var flag = 0;
- for(i = 0 ; i<TopicType.length;i++)
- {
- if(TopicType[i].length>0){
- flag = 1;
- for (j = 0;j<TopicType[i].length;j++){
- if(i==4 && TopicType[i][j][0]==0){
- layer.msg('选做题设置有误,题型不能为空!');
- return false;
- }
- if(TopicType[i][j][1]=='' || TopicType[i][j][1]==0)
- {
- layer.msg('题号不能为空!');
- return false;
- }
- }
- }
- }
- if(flag == 0){
- layer.msg('题号不能为空!');
- return false;
- }
- $(".ttd").fadeIn();
- });
- //根据数据重置答题卡
- function FillCard(){
- //所有选项卡重置
- var tempBox=$(".ques-topic-num .ques-topic");
- for(var i=0;i<tempBox.length;i++){
- tempBox.eq(i).hide();
- if(tempBox.eq(i).find('.ques-topic-list').length>0){
- for(var j=tempBox.eq(i).find('.ques-topic-list').length;j>1;j--){
- tempBox.eq(i).find('.ques-topic-list:last').remove();
- }
- if(i==0 || i==1){
- tempBox.eq(i).find(".ques-topic-list").eq(0).find("input").val("");
- tempBox.eq(i).find(".ques-topic-list").find('.topic-num input').val('');
- tempBox.eq(i).find(".ques-topic-list").eq(0).find(".ques-topic-item").removeClass("ques-topic-item-edit").find("a").html("选项编辑");
- }else if(i==2){
- tempBox.eq(i).find(".ques-topic-list").find('.topic-num').find('input').val('');
- tempBox.eq(i).find(".ques-topic-list").find('.line-control').find('input').val(1);
- }else if(i==3){
- tempBox.eq(i).find('.ques-topic-list').find(".line-control").hide().find('input').val(1);
- //tempBox.eq(i).find('.ques-topic-list').find(".line-control")
- tempBox.eq(i).find(".ques-topic-list").find('.topic-num input').val('');
- for(var k=0;k<tempBox.eq(i).find(".ques-topic-list").find('input[name="topicType"]').length;k++){
- if(k==0){
- tempBox.eq(i).find(".ques-topic-list").find('input[name="topicType"]').eq(k).prop('checked',true);
- }else{
- tempBox.eq(i).find(".ques-topic-list").find('input[name="topicType"]').eq(k).prop('checked',false);
- }
- }
- }else if(i==4){
- tempBox.eq(i).find('.choose-topic-num input').eq(0).val('');
- tempBox.eq(i).find(".ques-topic-list").find('.topic-num input').val('');
- for(var k=0;k<tempBox.eq(i).find(".ques-topic-list").find('input[name="chooseType"]').length;k++){
- if(k==0){
- tempBox.eq(i).find(".ques-topic-list").find('input[name="chooseType"]').eq(k).prop('checked',true);
- }else{
- tempBox.eq(i).find(".ques-topic-list").find('input[name="chooseType"]').eq(k).prop('checked',false);
- }
- }
- }
- tempBox.eq(i).find(".ques-topic-list").eq(0).find("em").remove();
- for(var k=0;k<4;k++){
- tempBox.eq(i).find(".ques-topic-list").eq(0).find("s").before("<em>【"+arr[k]+"】<b></b></em>");
- }
- }
- }
- $(".ques-type-control label input").prop('checked',false).parent("label").removeClass("active");
- /////////////////////
- for(var l=0;l<TopicType.length;l++){
- initType(l)
- $(".ques-topic").eq(l).find(".item-count").html(topicCount($(".ques-topic").eq(l)));
- totalTopicCount();
- }
- function initType(num){
- if(TopicType[num] && TopicType[num].length>0){
- //0单选题 1不定项选题 2填空题 3主观题 4选做题
- var tempTopic = tempBox.eq(num);
- var input_obj=$(".ques-type-control label input").eq(num);
- input_obj.prop('checked',true).parent("label").addClass("active");
- for(var i=0;i<TopicType[num].length;i++){
- if(i==0){
- tempTopic.show();
- tempTopic.find('.ques-item-del').hide();
- if(num == 0 || num == 1){
- //处理题型
- tempTopic.find('.ques-topic-item').find("em").remove();
- for(var j=0;j<TopicType[num][i][0];j++){
- tempTopic.find('.ques-topic-list').eq(0).find('.ques-topic-item').find("s").before("<em>【"+arr[j]+"】<b></b></em>");
- }
- }else if(num == 2){
- //处理题型
- tempTopic.find('.ques-topic-list').eq(0).find('.line-control').css("display","inline-block");
- tempTopic.find('.ques-topic-list').eq(0).find('.line-control input').val(TopicType[2][i][0]);
- var html = "";
- if(TopicType[2][i][3]){
- var smallTopics = TopicType[2][i][3];
- var smallTopicsArr = smallTopics.split(",");
- for(var a=0;a<smallTopicsArr.length;a++){
- var smallTopicsStr = smallTopicsArr[a];
- var nextArr = smallTopicsStr.split("///");
- var bigNum = nextArr[0];
- var smallNum = nextArr[1];
- html += '<li>第 <input type="text" class="include-text" value="'+bigNum+'"> 题有 <input type="text" class="include-count" value="'+smallNum+'"> 个小题 <img src="/images/u434.png" class="del-include"></li>';
- }
- }
- tempTopic.find('.ques-topic-list').eq(0).find('.include-list ul').html(html);
- //处理样式
- tempTopic.find('.line-type label').eq(TopicType[num][i][2]-1).find('input:radio').attr('checked',true);
- }else if(num == 3){
- //处理题型
- if(String(TopicType[num][i][0]).indexOf('///')>-1){
- var NumberArr=TopicType[num][i][0].split('///');
- tempTopic.find('.ques-topic-list').eq(0).find('input[name="topicType"][value="'+NumberArr[0]+'"]').prop("checked",true);
- tempTopic.find('.ques-topic-list').eq(0).find(".line-control input").val(NumberArr[1]);
- tempTopic.find('.ques-topic-list').eq(0).find(".line-control").css("display","inline-block");
- }else{
- tempTopic.find('.ques-topic-list').eq(0).find('input[name="topicType"]').eq(TopicType[num][i][0]-1).prop("checked",true);
- tempTopic.find('.ques-topic-list').eq(0).find(".line-control").hide();
- }
- var html = "";
- if(TopicType[3][i][3]){
- var smallTopics = TopicType[3][i][3];
- var smallTopicsArr = smallTopics.split(",");
- for(var a=0;a<smallTopicsArr.length;a++){
- var smallTopicsStr = smallTopicsArr[a];
- var nextArr = smallTopicsStr.split("///");
- var bigNum = nextArr[0];
- var smallNum = nextArr[1];
- html += '<li>第 <input type="text" class="include-text" value="'+bigNum+'"> 题有 <input type="text" class="include-count" value="'+smallNum+'"> 个小题 <img src="/images/u434.png" class="del-include"></li>';
- }
- }
- tempTopic.find('.ques-topic-list').eq(0).find('.include-list ul').html(html);
- //处理样式
- if(TopicType[num][i][2]==0){
- tempTopic.find('.line-type label').eq(TopicType[num][i][2]).find('input:radio').prop('checked',true);
- }else{
- tempTopic.find('.line-type label').eq(TopicType[num][i][2]-1).find('input:radio').prop('checked',true);
- }
- }else if(num == 4){
- //处理题型
- if(TopicType[num][i][0]){
- var NumberArr=TopicType[num][i][0].split('///');
- tempTopic.find('.choose-topic-num').find('input').eq(0).val(NumberArr[0]);
- tempTopic.find('.choose-topic-num').find('input').eq(1).val(NumberArr[1]);
- }
- //处理样式
- tempTopic.find('input[name="chooseType"]').eq(TopicType[num][i][2]-1).attr('checked',true);
- }
- //处理题号
- tempTopic.find('.ques-topic-list').eq(0).find('.topic-num input').val(TopicType[num][i][1]);
- }else{
- var temp= tempTopic.find(".add-type").prev().clone(true);
- if(num == 0 || num == 1){
- temp.find('.ques-topic-item').find("em").remove();
- for(var j=0;j<TopicType[num][i][0];j++){
- temp.find('.ques-topic-item').find("s").before("<em>【"+arr[j]+"】<b></b></em>");
- }
- }else if(num == 2){
- temp.find('.line-control input').val(TopicType[num][i][0]);
- var html = "";
- if(TopicType[2][i][3]){
- var smallTopics = TopicType[2][i][3];
- var smallTopicsArr = smallTopics.split(",");
- for(var a=0;a<smallTopicsArr.length;a++){
- var smallTopicsStr = smallTopicsArr[a];
- var nextArr = smallTopicsStr.split("///");
- var bigNum = nextArr[0];
- var smallNum = nextArr[1];
- html += '<li>第 <input type="text" class="include-text" value="'+bigNum+'"> 题有 <input type="text" class="include-count" value="'+smallNum+'"> 个小题 <img src="/images/u434.png" class="del-include"></li>';
- }
- }
- temp.find('.include-list ul').html(html);
- }else if(num == 3){
- temp.find("input[name^='topicType']").prop("checked",'');
- temp.find("input[name^='topicType']").attr("name","topicType_"+i);
- //判断题型是否包括横线
- if(String(TopicType[num][i][0]).indexOf('///')>-1){
- var NumberArr=TopicType[num][i][0].split('///');
- temp.find('input[name="topicType_'+i+'"]').eq(NumberArr[0]-1).prop("checked",true);
- temp.find(".line-control input").val(NumberArr[1]);
- temp.eq(0).find(".line-control").show();
- }else{
- temp.find('input[name="topicType_'+i+'"][value="'+TopicType[num][i][0]+'"]').prop("checked",true);
- temp.find(".line-control").hide();
- }
- // temp.find('.line-control input').val(TopicType[num][i][0]);
- var html = "";
- if(TopicType[3][i][3]){
- var smallTopics = TopicType[3][i][3];
- var smallTopicsArr = smallTopics.split(",");
- for(var a=0;a<smallTopicsArr.length;a++){
- var smallTopicsStr = smallTopicsArr[a];
- var nextArr = smallTopicsStr.split("///");
- var bigNum = nextArr[0];
- var smallNum = nextArr[1];
- html += '<li>第 <input type="text" class="include-text" value="'+bigNum+'"> 题有 <input type="text" class="include-count" value="'+smallNum+'"> 个小题 <img src="/images/u434.png" class="del-include"></li>';
- }
- }
- temp.find('.include-list ul').html(html);
- }else if(num == 4){
- if(i==1){
- temp.find("input[name='chooseType']").attr("name","chooseType_"+i);
- }else{
- temp.find("input[name='chooseType_"+(i-1)+"']").attr("name","chooseType_"+i);
- }
- //处理题型
- if(TopicType[num][i][0]){
- var NumberArr=TopicType[num][i][0].split('///');
- temp.find('.choose-topic-num').find('input').eq(0).val(NumberArr[0]);
- temp.find('.choose-topic-num').find('input').eq(1).val(NumberArr[1]);
- }
- temp.find('input[name="chooseType_'+i+'"]').eq(TopicType[num][i][2]-1).attr('checked',true);
- }
- temp.find('.topic-num input').val(TopicType[num][i][1]);
- temp.find('.ques-item-del').show();
- tempTopic.find(".add-type").before(temp);
- }
- }
- }
- }
- }
- });
- function show_version() {
- layer.msg('你的客户端版本太低,请升最新版本');
- }
- </script>
- <script src="/js/third/submit.js"></script>
- <script src="/js/third/select-class.js"></script>
|