123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175 |
- <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/base.css" />
- <link rel="stylesheet" href="/css/third/paperCard.css" />
- <style>
- .show-add-card.page-content{
- min-width:1500px;
- }
- .right-content, .left-content{
- max-width:750px;
- }
- </style>
- <div class="main-content-inner">
- <!-- 导航栏开始-->
- <?php include(Yii::app()->basePath.'/views/layouts/view_navigation.php');?>
- <!-- 导航栏结束-->
- <div class="page-content">
- <div class="mcp-title">模板组卷</div>
- <div class="right-content">
- <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))){
- $paperType = array('1050'=> '其他','0'=> '全国','1'=> '江苏','2'=> '浙江');
- }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">
- <div class="inp-text pointer">选择阅卷老师</div>
- <ul class="select-con tac">
- <!--<li class="sel-option pointer" id="1">高三一班</li>-->
- <?php foreach($teacher_arr as $t):?>
- <li class="sel-option pointer" id="<?php echo $t['teacher_id']?>"><?php echo $t['teacher_name']?></li>
- <?php endforeach;?>
- <!--<li class="sel-option pointer" id="2">高三二班</li>-->
- <!--<li class="sel-option pointer" id="3">高三三班</li>-->
- </ul>
- </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">
- <div class="test-classes-desc">默认已选我执教的班级(<span class="">单击移除</span>)<span id="classIds-error"></span></div>
- <div class="sel-classes g1" status="1">
- </div>
- <div class="sel-classes g2" style="display: none;" status="0">
- </div>
- <div class="sel-classes g3" style="display: none;" status="0">
- </div>
- <div class="clearfix">
- <div class="grade-sel fl">
- <div class="grade-top">年级</div>
- <ul>
- <li class="active" grade="1">高一</li>
- <li class="" grade="2">高二</li>
- <li class="" grade="3">高三</li>
- </ul>
- </div>
- <div class="bj-sel fl" id="grade1">
- <div class="class-top">班级</div>
- <ul>
- </ul>
- </div>
- <div class="bj-sel fl" id="grade2" style="display: none;">
- <div class="class-top">班级</div>
- <ul>
- </ul>
- </div>
- <div class="bj-sel fl" id="grade3" style="display: none;">
- <div class="class-top">班级</div>
- <ul>
- </ul>
- </div>
- </div>
- </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 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" style="margin-top: 15px;font-size: 14px;color: #999999">
- <?php
- $_num= '';
- $use_version = '';
- if(isset(Yii::app()->session['coachInfo']->use_version))
- {
- $use_version = Yii::app()->session['coachInfo']->use_version;
- }else
- {
- $use_version = Yii::app()->session['coachInfo']['use_version'];
- }
- if(!$use_version)
- {
- $use_version = 100;
- }
- $version_number = implode('',explode('.',$use_version));
- if(strlen($version_number)<7)
- {
- for($i=0;$i<7-strlen($version_number);$i++)
- {
- $_num.='0';
- }
- }
- $version_number=(int)$version_number.$_num;
- if($version_number > 1610000)
- {
- ?>
- <span>该试卷是否需要关联答题卡?<a href="javascript:;" class="template-flag" style="color: #006cff;border-radius:unset;border-bottom:2px #006cff solid;background: none;font-size: 14px;font-weight: bold;width: 127px;">关联答题卡</a></span>
- <?php
- }else
- {
- ?>
- <span>该试卷是否需要关联答题卡?<a href="javascript:;" onclick="show_version()" style="color: #006cff;border-radius:unset;border-bottom:2px #006cff solid;background: none;font-size: 14px;font-weight: bold;width: 127px;">关联答题卡</a></span>
- <?php
- }
- ?>
- </div>
- </div>
- <div class="left-content">
- <script>var firstCartTpl='';</script>
- <div class="teamplate-list-box">
- <div class="card">
- <i class="icon-title"></i><h2>试卷答题卡</h2>
- <ul class="template-box">
- <?php
- $Tpls = array();
- if(isset($thisTpls) && !empty($thisTpls)){
- $layout = array(10=>'A4竖版',11=>'A4横版','20'=>'A3竖版','21'=>'A3三栏','31'=>'A3两栏','40'=>'8K(260*370)两栏','41'=>'8K(260*370)三栏','50'=>'8K(270*390)两栏','51'=>'8K(270*390)三栏');
- $select_card_type = array(1=>'准考证号',2=>'条形码');
- foreach ($thisTpls as $k=>$v){
- if($k==0){
- $Tpls = $v;
- echo "<script> firstCartTpl=".$v['tpl_data']."</script>";
- }
- ?>
- <li class="_tpl <?php if($k==0){echo 'active';}?>" showmsg="1" third_tpl_id="<?php echo $v->third_tpl_id?>">
- <a href="#" >
- <div class="card-type"><span class="size"><?php echo $layout[$v->layout]?></span><span class="type"><?php echo $select_card_type[$v->select_card_type]?></span><i class="icon-delete" ></i></div>
- <p class="card-name"><?php echo $v->title?></p>
- </a>
- </li>
- <?php
- }
- }else{
- echo "<script> firstCartTpl='null';</script>";
- }
- ?>
- <li class="_tpl <?php if(!isset($thisTpls) || empty($thisTpls)){echo 'active';}?>" showmsg="0"><a href="#" ><div class="new-card"><span class="icon-add_card">+</span><span>创建新的答题卡</span></div></a></li>
- </ul>
- </div>
- <div class="mcp-form-list clearfix">
- <table class="card-setting">
- <tr>
- <th>答题卡类型</th>
- <td>
- <div class="card-style clearfix">
- <a href="javascript:;" class="fl <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==31 || $Tpls->layout==21){echo 'active';}}else{echo 'active';}?>">A3</a>
- <a href="javascript:;" class="fl <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==11 || $Tpls->layout==10){echo 'active';}}?>">A4</a>
- <a href="javascript:;" class="fl <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==41 || $Tpls->layout==40){echo 'active';}}?>">8k(260*370)</a>
- <a href="javascript:;" class="fl <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==51 || $Tpls->layout==50){echo 'active';}}?>">8k(270*390)</a>
- </div>
- <div class="card-select <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==31 || $Tpls->layout==21){echo 'cur';}}else{echo 'cur';}?>">
- <label><input type="radio" name="layout" <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==31){echo 'checked';}}else{echo 'checked';}?> value="31">两栏</label>
- <label><input type="radio" name="layout" <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==21){echo 'checked';}}?> value="21">三栏</label>
- </div>
- <div class="card-select <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==11 || $Tpls->layout==10){echo 'cur';}}?>">
- <label><input type="radio" name="layout" value="11" <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==11){echo 'checked';}}?>>A4横版</label>
- <label><input type="radio" name="layout" value="10" <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==10){echo 'checked';}}?>>A4竖版</label>
- </div>
- <div class="card-select <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==41 || $Tpls->layout==40){echo 'cur';}}?>">
- <label><input type="radio" name="layout" value="40" <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==40){echo 'checked';}}?>>两栏</label>
- <label><input type="radio" name="layout" value="41" <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==41){echo 'checked';}}?>>三栏</label>
- </div>
- <div class="card-select <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==51 || $Tpls->layout==50){echo 'cur';}}?>">
- <label><input type="radio" name="layout" value="50" <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==50){echo 'checked';}}?>>两栏</label>
- <label><input type="radio" name="layout" value="51" <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==51){echo 'checked';}}?>>三栏</label>
- </div>
- <!-- <label><input type="radio" name="layout" <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==21){echo 'checked';}}else{echo 'checked';}?> value="21">A3</label>
- <label><input type="radio" name="layout" value="11" <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==11){echo 'checked';}}?>>A4横版</label>
- <label><input type="radio" name="layout" value="10" <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==10){echo 'checked';}}?>>A4竖版</label>-->
- </td>
- </tr>
- <tr>
- <th>考号板式</th>
- <td>
- <label><input type="radio" name="select_card_type" value="1" <?php if($Tpls && !empty($Tpls)){if($Tpls->select_card_type==1){echo 'checked';}}else{echo 'checked';}?>>准考证号</label>
- <label><input type="radio" name="select_card_type" value="2" <?php if($Tpls && !empty($Tpls)){if($Tpls->select_card_type==2){echo 'checked';}}?>>条形码</label>
- </td>
- </tr>
- <tr>
- <th>题型(多选)</th>
- <td class="ques-type">
- <div class="ques-type-control">
- <label><input type="checkbox">单选题</label>
- <label class="special-type"><input type="checkbox">不定项选择题</label>
- <label><input type="checkbox">填空题</label>
- <label><input type="checkbox">主观题</label>
- <label ><input type="checkbox">选做题</label>
- </div>
- <div class="ques-topic-num">
- <div class="ques-topic ques-topic-one">
- <h3 class="clearfix">
- <span class="fl">单选题</span>
- <div class="fr">题量:<span class="item-count">0</span></div>
- </h3>
- <div class="clearfix ques-topic-list">
- <img src="/images/del_2.png" class="ques-item-del">
- <div class="ques-topic-item">题型<span class="topic-point-num">1</span>:<em>【A】<b></b></em><em>【B】<b></b></em><em>【C】<b></b></em><em>【D】<b></b></em><s></s><a href="javascript:;">选项编辑</a></div>
- <div class="topic-num">题号:<input type="text" value=""></div>
- <p>*多个题号逗号隔开(如1,2,3,4,5);连续题号可用"-"隔开(如:1-5);</p>
- </div>
- <div class="add-type"><a href="javascript:;"><img src="/css/third/img/add_topic.png" alt="">增加题型</a></div>
- </div>
- <div class="ques-topic">
- <h3 class="clearfix">
- <span class="fl">不定向选择题</span>
- <div class="fr">题量:<span class="item-count">0</span></div>
- </h3>
- <div class="clearfix ques-topic-list">
- <img src="/images/del_2.png" class="ques-item-del">
- <div class="ques-topic-item">题型<span class="topic-point-num">1</span>:<em>【A】<b></b></em><em>【B】<b></b></em><em>【C】<b></b></em><em>【D】<b></b></em><s></s><a href="javascript:;">选项编辑</a></div>
- <div class="topic-num">题号:<input type="text" value=""></div>
- <p>*多个题号逗号隔开(如1,2,3,4,5);连续题号可用"-"隔开(如:1-5);</p>
- </div>
- <div class="add-type"><a href="javascript:;"><img src="/css/third/img/add_topic.png" alt="">增加题型</a></div>
- </div>
- <div class="ques-topic ques-topic3">
- <h3 class="clearfix">
- <span class="fl">填空题</span>
- <div class="fl line-type">
- 边框样式:
- <label><input type="radio" name="filllineType" checked>无边框</label>
- <label><input type="radio" name="filllineType">虚线</label>
- <label><input type="radio" name="filllineType">实线</label>
- </div>
- <div class="fr">题量:<span class="item-count">0</span></div>
- </h3>
- <div class="clearfix ques-topic-list">
- <img src="/images/del_2.png" class="ques-item-del">
- <div class="ques-topic-item">填空题<span class="topic-point-num">1</span>:
- <!-- <span class="ques-style">样式:<img src="/css/third/img/topic_type.png" alt=""></span> -->
- <label>横线</label>
- <div class="line-control" style="display: inline-block;">
- 行数:
- <b class="add">+</b>
- <input type="text" value="1" readonly>
- <b class="del">-</b>
- </div>
- </div>
- <div class="topic-num">题号:<input type="text" value=""></div>
- <p>*多个题号逗号隔开(如1,2,3,4,5);连续题号可用"-"隔开(如:1-5);</p>
- <div class="include-list">
- <ul>
- <!-- <li>第 <input type="text"> 题有 <input type="text"> 个小题 <img src="/images/u434.png" class="del-include"></li> -->
- </ul>
- </div>
- <div class="include-topic">
- <a href="javascript:;">试题内包含小题</a>
- </div>
- </div>
- <div class="add-type"><a href="javascript:;" class="tian_main-topic"><img src="/css/third/img/add_topic.png" alt="">增加题型</a></div>
- </div>
- <div class="ques-topic ques-topic3">
- <h3 class="clearfix">
- <span class="fl">主观题</span>
- <div class="fl line-type">
- 边框样式:
- <label><input type="radio" name="lineType" value="1" checked>无边框</label>
- <label><input type="radio" name="lineType" value="2">虚线</label>
- <label><input type="radio" name="lineType" value="3">实线</label>
- </div>
- <div class="fr">题量:<span class="item-count">0</span></div>
- </h3>
- <div class="clearfix ques-topic-list">
- <img src="/images/del_2.png" class="ques-item-del">
- <div class="ques-topic-item">主观题<span class="topic-point-num">1</span>:
- <span class="ques-style">样式:<img src="/css/third/img/topic_type.png" alt=""></span>
- <label><input type="radio" name="topicType" value="1" checked>空白</label>
- <label><input type="radio" name="topicType" value="2">横线</label>
- <div class="line-control">
- 行数:
- <b class="add">+</b>
- <input type="text" value="2" readonly>
- <b class="del">-</b>
- </div>
- <label><input type="radio" name="topicType" value="3">作文表格</label>
- </div>
- <div class="topic-num">题号:<input type="text" value=""></div>
- <p>*多个题号逗号隔开(如1,2,3,4,5);连续题号可用"-"隔开(如:1-5);</p>
- <div class="include-list">
- <ul>
- <!-- <li>第 <input type="text"> 题有 <input type="text"> 个小题 <img src="/images/u434.png" class="del-include"></li> -->
- </ul>
- </div>
- <div class="include-topic">
- <a href="javascript:;">试题内包含小题</a>
- </div>
- </div>
- <div class="add-type"><a href="javascript:;" class="main-topic"><img src="/css/third/img/add_topic.png" alt="">增加题型</a></div>
- </div>
- <div class="ques-topic">
- <h3 class="clearfix">
- <span class="fl">选做题</span>
- <div class="fr">题量:<span class="item-count">0</span></div>
- </h3>
- <div class="clearfix ques-topic-list choose-topic">
- <img src="/images/del_2.png" class="ques-item-del">
- <div class="ques-topic-item choose-topic-num">题型:<input type="text" class="choose-all-count"> 选 <input type="text" class="choose-count" readonly value="1"></div>
- <div>样式:<label><input type="radio" name="chooseType" value="1" checked>空白</label><label><input type="radio" name="chooseType" value="2">横线</label></div>
- <div class="topic-num-choose">题号:<input type="text" value=""></div>
- <p>*选做题必须为模板最后一题,选做题题型数量与填写的题号要一致,(如题型2选1,则题号:2,3);</p>
- <p>*多个题号逗号隔开(如1,2,3,4,5);连续题号可用"-"隔开(如:1-5);</p>
- </div>
- <div class="add-type"><a href="javascript:;" class="xuan-main-topic"><img src="/css/third/img/add_topic.png" alt="">增加题型</a></div>
- </div>
- </div>
- </td>
- </tr>
- </table>
- </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="third_tpl_id" value="<?php echo isset($thisTpls[0]['third_tpl_id'])?$thisTpls[0]['third_tpl_id']:0 ?>" type="hidden"/>
- <!--<button id="createThird">确定</button>-->
- <div class="mcp-form-list mcp-fl-btns clearfix">
- 共:<span class="total-count">0</span> 题
- <input type="button" value="打印预览" class="mcp-sure-btn" id="PrintThird" active="true">
- <input type="button" value="保存当前答题卡模板" class="save-card" id="saveCard" active="true">
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="ttd" style="display: none;">
- <div class="s-state clearfix posirela">
- <div class="hint_size clearfix">
- <span class="fl ml15">保存答题卡模版</span>
- </div>
- <div class="mistake_character clearfix dialog-content" style="padding-top: 10px; padding-bottom: 0;">
- <label class="ml15 fl" style="line-height:80px">模板名称:<input id="tpl_title" name="tpl_title" type="text" maxlength="15" value="<?php if($Tpls && !empty($Tpls)){echo $Tpls->title;}?>"></label>
- </div>
- <div class="mistake_character clearfix">
- <div class="clearfix bnt_width" >
- <input type="hidden" name="exam_id" value="0">
- <input type="hidden" name="file_type" value="">
- <p class="fl ml10"><button class="roger shut" id="btnSubmit" active="true">创建新模板</button></p>
- <p class="fl ml10"><button class="roger shut" id="btnCover" active="true">覆盖原模板</button></p>
- <p class="fr ml10"><button class="roger shut rogergb" id="btnClose">取消</button></p>
- </div>
- </div>
- </div>
- </div>
- <script>
- var TopicType=new Array(5);
- TopicType[0]=[];
- TopicType[1]=[];
- TopicType[2]=[];
- TopicType[3]=[];
- TopicType[4]=[];
- $(document).ready(function(){
- 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').click(function(){
- var teacher_id = $(this).attr('id');
- if(teacher_id){
- $('#choose-error').html("");
- }
- $('input[name="teacherId"]').val(teacher_id);
- $.post(
- "<?php echo Yii::app()->createUrl('third/ajaxchangeclasses')?>",
- {teacher_id:teacher_id},
- function(result){
- if(result.error){
- $('#choose-error').html(result.error);
- }else{
- var htmlg1 = "";
- var htmlg2 = "";
- var htmlg3 = "";
- $.each(result.class_arr_select,function(k,v){
- if(v.grade == 1){
- htmlg1+="<span grade='"+v.grade+"' classid='"+v.class_id+"'>"+v.class_name+"</span>";
- }
- if(v.grade == 2){
- htmlg2+="<span grade='"+v.grade+"' classid='"+v.class_id+"'>"+v.class_name+"</span>";
- }
- if(v.grade == 3){
- htmlg3+="<span grade='"+v.grade+"' classid='"+v.class_id+"'>"+v.class_name+"</span>";
- }
- });
- $('.g1').html(htmlg1);
- $('.g2').html(htmlg2);
- $('.g3').html(htmlg3);
- var htmlidg1 = "";
- var htmlidg2 = "";
- var htmlidg3 = "";
- $.each(result.class_arr_noselect,function(k,v){
- if(v.grade == 1){
- htmlidg1 += '<li class="bjs-lis ellipsis" grade="'+v.grade+'" classid="'+v.class_id+'" ><span class="judge-sel"></span>'+v.class_name+'</li>';
- }
- if(v.grade == 2){
- htmlidg2 += '<li class="bjs-lis ellipsis" grade="'+v.grade+'" classid="'+v.class_id+'" ><span class="judge-sel"></span>'+v.class_name+'</li>';
- }
- if(v.grade == 3){
- htmlidg3 += '<li class="bjs-lis ellipsis" grade="'+v.grade+'" classid="'+v.class_id+'" ><span class="judge-sel"></span>'+v.class_name+'</li>';
- }
- });
- $('#grade1 ul').html(htmlidg1);
- $('#grade2 ul').html(htmlidg2);
- $('#grade3 ul').html(htmlidg3);
- }
- },
- 'json'
- );
- });
- //切换年级
- $('.a-years,.a-province,.paper-type > span, .grade-sel ul li').click(function(){
- if(!$(this).hasClass('active')){
- $(this).addClass('active').siblings().removeClass('active');
- var gradearr=[1,2,3];
- var grade=$(this).attr("grade");
- for(var i=0;i<=gradearr.length;i++){
- if(gradearr[i]==grade){
- $("#grade"+grade).show();
- $('.g'+grade).show();
- $('.g'+grade).attr('status',1);
- }else{
- $("#grade"+gradearr[i]).hide();
- $(".g"+gradearr[i]).hide();
- $(".g"+gradearr[i]).attr('status',0);
- }
- }
- }
- });
- //添加班级
- $(".bj-sel ul").on("click","li", function(){
- $('#classIds-error').html("");
- $(this).find('.judge-sel').addClass('active');
- $(this).remove();
- var grade = $(this).attr('grade');
- $('.g'+grade).append('<span grade="'+$(this).attr("grade")+'" classid="'+$(this).attr("classid")+'">'+$(this).text()+'</span>');
- });
- //移除班级
- $('.sel-classes').delegate('span','click',function(){
- $(this).remove();
- $("#grade"+$(this).attr("grade")).children("ul").append('<li class="bjs-lis" grade="'+$(this).attr("grade")+'" classid="'+$(this).attr("classid")+'"><span class="judge-sel"></span>'+$(this).html()+'</li>');
- });
- 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();
- }
- });
- $("body").delegate("#createThird[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 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 data={
- 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()
- };
- if (!$(".ques-type-control label input").is(':checked')) {
- $.post("<?php echo Yii::app()->createUrl('third/quanCreatethird')?>",data,function (data) {
- var m = JSON.parse(data);
- if(m.status==0)
- {
- layer.msg(m.msg);
- $("#createThird").attr('active','true');
- return false;
- }else{
- $('input[name="is_update"]').val(m.exam_group_id);
- location.href = m.result;
- }
- });
- }else{
- $.post("<?php echo Yii::app()->createUrl('third/ajaxCreatethird')?>",data,function (data) {
- var m = JSON.parse(data);
- if(m.status==0)
- {
- layer.msg(m.msg);
- $("#createThird").attr('active','true');
- return false;
- }else{
- $('input[name="is_update"]').val(m.exam_group_id);
- // evaluationClient.CreateDiSanFang(JSON.stringify(m.result));
- location.href = m.result;
- }
- });
- }
- }else{
- layer.msg(error.join(','));
- $("#createThird").attr('active','true');
- }
- });
- $("#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>
- $(function(){
- //console.log(firstCartTpl);
- if(firstCartTpl!='null'){
- TopicType=firstCartTpl;
- }
- $(".template-flag").click(function(){
- FillCard();
- $(".teamplate-list-box").toggle();
- $(".page-content").toggleClass('show-add-card')
- });
- // 点击显示隐藏
- $(".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>
|