thirdview_old.php 107 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175
  1. <script src="/js/jquery.datetimepicker.js"></script>
  2. <link rel="stylesheet" href="/fonts/fpdf/iconfont.css" />
  3. <link rel="stylesheet" href="/css/modelCreatePaper.css" />
  4. <link rel="stylesheet" href="/css/jquery.datetimepicker.css" />
  5. <link rel="stylesheet" href="/css/third/base.css" />
  6. <link rel="stylesheet" href="/css/third/paperCard.css" />
  7. <style>
  8. .show-add-card.page-content{
  9. min-width:1500px;
  10. }
  11. .right-content, .left-content{
  12. max-width:750px;
  13. }
  14. </style>
  15. <div class="main-content-inner">
  16. <!-- 导航栏开始-->
  17. <?php include(Yii::app()->basePath.'/views/layouts/view_navigation.php');?>
  18. <!-- 导航栏结束-->
  19. <div class="page-content">
  20. <div class="mcp-title">模板组卷</div>
  21. <div class="right-content">
  22. <div class="mcp-main-con">
  23. <div class="mcp-form-list clearfix">
  24. <div class="mcp-form-menu fl">试卷名称</div>
  25. <div class="mcp-form-detail fl">
  26. <input type="text" placeholder="必填" class="test-paper-name" name="examName">
  27. </div>
  28. <div id="examName-error"></div>
  29. </div>
  30. <div class="mcp-form-list clearfix">
  31. <div class="mcp-form-menu fl">试卷类型</div>
  32. <div class="mcp-form-detail fl">
  33. <div class="inp-text pointer">选择试卷类型</div>
  34. <ul class="select-con tac">
  35. <?php
  36. if(!in_array(Yii::app()->session['session_duoxueke_subject_id'],array(18,19))){
  37. $paperType = array('1050'=> '其他','0'=> '全国','1'=> '江苏','2'=> '浙江');
  38. }else{
  39. $paperType = array('1050'=> '其他');
  40. }
  41. ?>
  42. <?php foreach($paperType as $key => $t):?>
  43. <li class="sel-paper-type pointer" id="<?php echo $key?>"><?php echo $t?></li>
  44. <?php endforeach;?>
  45. </ul>
  46. </div>
  47. <div id="paperType-error"></div>
  48. </div>
  49. <div class="mcp-form-list clearfix" style="width:1000px">
  50. <div class="mcp-form-menu fl">选择考试类型</div>
  51. <div class="mcp-form-detail fl clearfix">
  52. <div class="mcp-radio-sel fl examType">
  53. <span class="sel-btn select" value="1"></span>
  54. <span>周考</span>
  55. </div>
  56. <div class="mcp-radio-sel fl examType">
  57. <span class="sel-btn" value="2"></span>
  58. <span>单元考</span>
  59. </div>
  60. <div class="mcp-radio-sel fl examType">
  61. <span class="sel-btn" value="3"></span>
  62. <span>月考</span>
  63. </div>
  64. <div class="mcp-radio-sel fl examType">
  65. <span class="sel-btn" value="4"></span>
  66. <span>联考</span>
  67. </div>
  68. <div class="mcp-radio-sel fl examType">
  69. <span class="sel-btn" value="5"></span>
  70. <span>期中考试</span>
  71. </div>
  72. <div class="mcp-radio-sel fl examType">
  73. <span class="sel-btn" value="6"></span>
  74. <span>期末考试</span>
  75. </div>
  76. <div class="mcp-radio-sel fl examType">
  77. <span class="sel-btn" value="7"></span>
  78. <span>模拟考</span>
  79. </div>
  80. <div class="mcp-radio-sel fl examType">
  81. <span class="sel-btn" value="8"></span>
  82. <span>冲刺考</span>
  83. </div>
  84. <div class="clear"></div>
  85. <div class="mcp-radio-sel fl examType">
  86. <span class="sel-btn examType" value="9"></span>
  87. <span>测验(适用于非正式考试)</span>
  88. </div>
  89. </div>
  90. <div id="type-error"></div>
  91. </div>
  92. <div class="mcp-form-list clearfix">
  93. <div class="mcp-form-menu fl">主阅卷老师</div>
  94. <div class="mcp-form-detail fl">
  95. <div class="inp-text pointer">选择阅卷老师</div>
  96. <ul class="select-con tac">
  97. <!--<li class="sel-option pointer" id="1">高三一班</li>-->
  98. <?php foreach($teacher_arr as $t):?>
  99. <li class="sel-option pointer" id="<?php echo $t['teacher_id']?>"><?php echo $t['teacher_name']?></li>
  100. <?php endforeach;?>
  101. <!--<li class="sel-option pointer" id="2">高三二班</li>-->
  102. <!--<li class="sel-option pointer" id="3">高三三班</li>-->
  103. </ul>
  104. </div>
  105. <div id="choose-error"></div>
  106. </div>
  107. <div class="mcp-form-list clearfix">
  108. <div class="mcp-form-menu fl">考试班级</div>
  109. <div class="mcp-form-detail fl">
  110. <div class="test-classes-desc">默认已选我执教的班级(<span class="">单击移除</span>)<span id="classIds-error"></span></div>
  111. <div class="sel-classes g1" status="1">
  112. </div>
  113. <div class="sel-classes g2" style="display: none;" status="0">
  114. </div>
  115. <div class="sel-classes g3" style="display: none;" status="0">
  116. </div>
  117. <div class="clearfix">
  118. <div class="grade-sel fl">
  119. <div class="grade-top">年级</div>
  120. <ul>
  121. <li class="active" grade="1">高一</li>
  122. <li class="" grade="2">高二</li>
  123. <li class="" grade="3">高三</li>
  124. </ul>
  125. </div>
  126. <div class="bj-sel fl" id="grade1">
  127. <div class="class-top">班级</div>
  128. <ul>
  129. </ul>
  130. </div>
  131. <div class="bj-sel fl" id="grade2" style="display: none;">
  132. <div class="class-top">班级</div>
  133. <ul>
  134. </ul>
  135. </div>
  136. <div class="bj-sel fl" id="grade3" style="display: none;">
  137. <div class="class-top">班级</div>
  138. <ul>
  139. </ul>
  140. </div>
  141. </div>
  142. </div>
  143. </div>
  144. <div class="mcp-form-list clearfix">
  145. <div class="mcp-form-menu fl">线上阅卷</div>
  146. <div class="mcp-form-detail fl clearfix" id ="markType">
  147. <div class="mcp-radio-sel fl">
  148. <span class="sel-btn select markType" value="3"></span>
  149. <span class ="markType" value="3">班级混合阅卷</span>
  150. </div>
  151. <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">
  152. <span class="sel-btn markType" value="4" ></span>
  153. <span class="markType" value="4">班级单独阅卷 <?php if(in_array(Yii::app()->session['session_duoxueke_subject_id'],array(18,19))){echo ' (文理综暂不支持)';}?></span>
  154. </div>
  155. <div id="markType-error"></div>
  156. </div>
  157. </div>
  158. <div class="mcp-form-list clearfix">
  159. <div class="mcp-form-menu fl">考试时间</div>
  160. <div class="mcp-form-detail fl clearfix">
  161. <input type="text" class='core datetimepicker8' style="width: 140px;line-height: 27px;padding-left: 5px;" name="examDate" id="trial_begin_time_test" readonly/>
  162. </div>
  163. <div id="examDate"></div>
  164. </div>
  165. </div>
  166. <div class="template-flag-box">
  167. <a href="javascript:;" id="createThird" active="true">保存试卷</a>
  168. <!--<a href="javascript:;" class="template-flag">创建答题卡</a>-->
  169. </div>
  170. <div class="template-flag-box" style="margin-top: 15px;font-size: 14px;color: #999999">
  171. <?php
  172. $_num= '';
  173. $use_version = '';
  174. if(isset(Yii::app()->session['coachInfo']->use_version))
  175. {
  176. $use_version = Yii::app()->session['coachInfo']->use_version;
  177. }else
  178. {
  179. $use_version = Yii::app()->session['coachInfo']['use_version'];
  180. }
  181. if(!$use_version)
  182. {
  183. $use_version = 100;
  184. }
  185. $version_number = implode('',explode('.',$use_version));
  186. if(strlen($version_number)<7)
  187. {
  188. for($i=0;$i<7-strlen($version_number);$i++)
  189. {
  190. $_num.='0';
  191. }
  192. }
  193. $version_number=(int)$version_number.$_num;
  194. if($version_number > 1610000)
  195. {
  196. ?>
  197. <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>
  198. <?php
  199. }else
  200. {
  201. ?>
  202. <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>
  203. <?php
  204. }
  205. ?>
  206. </div>
  207. </div>
  208. <div class="left-content">
  209. <script>var firstCartTpl='';</script>
  210. <div class="teamplate-list-box">
  211. <div class="card">
  212. <i class="icon-title"></i><h2>试卷答题卡</h2>
  213. <ul class="template-box">
  214. <?php
  215. $Tpls = array();
  216. if(isset($thisTpls) && !empty($thisTpls)){
  217. $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)三栏');
  218. $select_card_type = array(1=>'准考证号',2=>'条形码');
  219. foreach ($thisTpls as $k=>$v){
  220. if($k==0){
  221. $Tpls = $v;
  222. echo "<script> firstCartTpl=".$v['tpl_data']."</script>";
  223. }
  224. ?>
  225. <li class="_tpl <?php if($k==0){echo 'active';}?>" showmsg="1" third_tpl_id="<?php echo $v->third_tpl_id?>">
  226. <a href="#" >
  227. <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>
  228. <p class="card-name"><?php echo $v->title?></p>
  229. </a>
  230. </li>
  231. <?php
  232. }
  233. }else{
  234. echo "<script> firstCartTpl='null';</script>";
  235. }
  236. ?>
  237. <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>
  238. </ul>
  239. </div>
  240. <div class="mcp-form-list clearfix">
  241. <table class="card-setting">
  242. <tr>
  243. <th>答题卡类型</th>
  244. <td>
  245. <div class="card-style clearfix">
  246. <a href="javascript:;" class="fl <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==31 || $Tpls->layout==21){echo 'active';}}else{echo 'active';}?>">A3</a>
  247. <a href="javascript:;" class="fl <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==11 || $Tpls->layout==10){echo 'active';}}?>">A4</a>
  248. <a href="javascript:;" class="fl <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==41 || $Tpls->layout==40){echo 'active';}}?>">8k(260*370)</a>
  249. <a href="javascript:;" class="fl <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==51 || $Tpls->layout==50){echo 'active';}}?>">8k(270*390)</a>
  250. </div>
  251. <div class="card-select <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==31 || $Tpls->layout==21){echo 'cur';}}else{echo 'cur';}?>">
  252. <label><input type="radio" name="layout" <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==31){echo 'checked';}}else{echo 'checked';}?> value="31">两栏</label>
  253. <label><input type="radio" name="layout" <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==21){echo 'checked';}}?> value="21">三栏</label>
  254. </div>
  255. <div class="card-select <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==11 || $Tpls->layout==10){echo 'cur';}}?>">
  256. <label><input type="radio" name="layout" value="11" <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==11){echo 'checked';}}?>>A4横版</label>
  257. <label><input type="radio" name="layout" value="10" <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==10){echo 'checked';}}?>>A4竖版</label>
  258. </div>
  259. <div class="card-select <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==41 || $Tpls->layout==40){echo 'cur';}}?>">
  260. <label><input type="radio" name="layout" value="40" <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==40){echo 'checked';}}?>>两栏</label>
  261. <label><input type="radio" name="layout" value="41" <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==41){echo 'checked';}}?>>三栏</label>
  262. </div>
  263. <div class="card-select <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==51 || $Tpls->layout==50){echo 'cur';}}?>">
  264. <label><input type="radio" name="layout" value="50" <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==50){echo 'checked';}}?>>两栏</label>
  265. <label><input type="radio" name="layout" value="51" <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==51){echo 'checked';}}?>>三栏</label>
  266. </div>
  267. <!-- <label><input type="radio" name="layout" <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==21){echo 'checked';}}else{echo 'checked';}?> value="21">A3</label>
  268. <label><input type="radio" name="layout" value="11" <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==11){echo 'checked';}}?>>A4横版</label>
  269. <label><input type="radio" name="layout" value="10" <?php if($Tpls && !empty($Tpls)){if($Tpls->layout==10){echo 'checked';}}?>>A4竖版</label>-->
  270. </td>
  271. </tr>
  272. <tr>
  273. <th>考号板式</th>
  274. <td>
  275. <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>
  276. <label><input type="radio" name="select_card_type" value="2" <?php if($Tpls && !empty($Tpls)){if($Tpls->select_card_type==2){echo 'checked';}}?>>条形码</label>
  277. </td>
  278. </tr>
  279. <tr>
  280. <th>题型(多选)</th>
  281. <td class="ques-type">
  282. <div class="ques-type-control">
  283. <label><input type="checkbox">单选题</label>
  284. <label class="special-type"><input type="checkbox">不定项选择题</label>
  285. <label><input type="checkbox">填空题</label>
  286. <label><input type="checkbox">主观题</label>
  287. <label ><input type="checkbox">选做题</label>
  288. </div>
  289. <div class="ques-topic-num">
  290. <div class="ques-topic ques-topic-one">
  291. <h3 class="clearfix">
  292. <span class="fl">单选题</span>
  293. <div class="fr">题量:<span class="item-count">0</span></div>
  294. </h3>
  295. <div class="clearfix ques-topic-list">
  296. <img src="/images/del_2.png" class="ques-item-del">
  297. <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>
  298. <div class="topic-num">题号:<input type="text" value=""></div>
  299. <p>*多个题号逗号隔开(如1,2,3,4,5);连续题号可用"-"隔开(如:1-5);</p>
  300. </div>
  301. <div class="add-type"><a href="javascript:;"><img src="/css/third/img/add_topic.png" alt="">增加题型</a></div>
  302. </div>
  303. <div class="ques-topic">
  304. <h3 class="clearfix">
  305. <span class="fl">不定向选择题</span>
  306. <div class="fr">题量:<span class="item-count">0</span></div>
  307. </h3>
  308. <div class="clearfix ques-topic-list">
  309. <img src="/images/del_2.png" class="ques-item-del">
  310. <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>
  311. <div class="topic-num">题号:<input type="text" value=""></div>
  312. <p>*多个题号逗号隔开(如1,2,3,4,5);连续题号可用"-"隔开(如:1-5);</p>
  313. </div>
  314. <div class="add-type"><a href="javascript:;"><img src="/css/third/img/add_topic.png" alt="">增加题型</a></div>
  315. </div>
  316. <div class="ques-topic ques-topic3">
  317. <h3 class="clearfix">
  318. <span class="fl">填空题</span>
  319. <div class="fl line-type">
  320. 边框样式:
  321. <label><input type="radio" name="filllineType" checked>无边框</label>
  322. <label><input type="radio" name="filllineType">虚线</label>
  323. <label><input type="radio" name="filllineType">实线</label>
  324. </div>
  325. <div class="fr">题量:<span class="item-count">0</span></div>
  326. </h3>
  327. <div class="clearfix ques-topic-list">
  328. <img src="/images/del_2.png" class="ques-item-del">
  329. <div class="ques-topic-item">填空题<span class="topic-point-num">1</span>:
  330. <!-- <span class="ques-style">样式:<img src="/css/third/img/topic_type.png" alt=""></span> -->
  331. <label>横线</label>
  332. <div class="line-control" style="display: inline-block;">
  333. 行数:
  334. <b class="add">+</b>
  335. <input type="text" value="1" readonly>
  336. <b class="del">-</b>
  337. </div>
  338. </div>
  339. <div class="topic-num">题号:<input type="text" value=""></div>
  340. <p>*多个题号逗号隔开(如1,2,3,4,5);连续题号可用"-"隔开(如:1-5);</p>
  341. <div class="include-list">
  342. <ul>
  343. <!-- <li>第 <input type="text"> 题有 <input type="text"> 个小题 <img src="/images/u434.png" class="del-include"></li> -->
  344. </ul>
  345. </div>
  346. <div class="include-topic">
  347. <a href="javascript:;">试题内包含小题</a>
  348. </div>
  349. </div>
  350. <div class="add-type"><a href="javascript:;" class="tian_main-topic"><img src="/css/third/img/add_topic.png" alt="">增加题型</a></div>
  351. </div>
  352. <div class="ques-topic ques-topic3">
  353. <h3 class="clearfix">
  354. <span class="fl">主观题</span>
  355. <div class="fl line-type">
  356. 边框样式:
  357. <label><input type="radio" name="lineType" value="1" checked>无边框</label>
  358. <label><input type="radio" name="lineType" value="2">虚线</label>
  359. <label><input type="radio" name="lineType" value="3">实线</label>
  360. </div>
  361. <div class="fr">题量:<span class="item-count">0</span></div>
  362. </h3>
  363. <div class="clearfix ques-topic-list">
  364. <img src="/images/del_2.png" class="ques-item-del">
  365. <div class="ques-topic-item">主观题<span class="topic-point-num">1</span>:
  366. <span class="ques-style">样式:<img src="/css/third/img/topic_type.png" alt=""></span>
  367. <label><input type="radio" name="topicType" value="1" checked>空白</label>
  368. <label><input type="radio" name="topicType" value="2">横线</label>
  369. <div class="line-control">
  370. 行数:
  371. <b class="add">+</b>
  372. <input type="text" value="2" readonly>
  373. <b class="del">-</b>
  374. </div>
  375. <label><input type="radio" name="topicType" value="3">作文表格</label>
  376. </div>
  377. <div class="topic-num">题号:<input type="text" value=""></div>
  378. <p>*多个题号逗号隔开(如1,2,3,4,5);连续题号可用"-"隔开(如:1-5);</p>
  379. <div class="include-list">
  380. <ul>
  381. <!-- <li>第 <input type="text"> 题有 <input type="text"> 个小题 <img src="/images/u434.png" class="del-include"></li> -->
  382. </ul>
  383. </div>
  384. <div class="include-topic">
  385. <a href="javascript:;">试题内包含小题</a>
  386. </div>
  387. </div>
  388. <div class="add-type"><a href="javascript:;" class="main-topic"><img src="/css/third/img/add_topic.png" alt="">增加题型</a></div>
  389. </div>
  390. <div class="ques-topic">
  391. <h3 class="clearfix">
  392. <span class="fl">选做题</span>
  393. <div class="fr">题量:<span class="item-count">0</span></div>
  394. </h3>
  395. <div class="clearfix ques-topic-list choose-topic">
  396. <img src="/images/del_2.png" class="ques-item-del">
  397. <div class="ques-topic-item choose-topic-num">题型:<input type="text" class="choose-all-count">&nbsp;&nbsp;选&nbsp;&nbsp;<input type="text" class="choose-count" readonly value="1"></div>
  398. <div>样式:<label><input type="radio" name="chooseType" value="1" checked>空白</label><label><input type="radio" name="chooseType" value="2">横线</label></div>
  399. <div class="topic-num-choose">题号:<input type="text" value=""></div>
  400. <p>*选做题必须为模板最后一题,选做题题型数量与填写的题号要一致,(如题型2选1,则题号:2,3);</p>
  401. <p>*多个题号逗号隔开(如1,2,3,4,5);连续题号可用"-"隔开(如:1-5);</p>
  402. </div>
  403. <div class="add-type"><a href="javascript:;" class="xuan-main-topic"><img src="/css/third/img/add_topic.png" alt="">增加题型</a></div>
  404. </div>
  405. </div>
  406. </td>
  407. </tr>
  408. </table>
  409. </div>
  410. <input type="hidden" name="subjectId" value="<?php echo Yii::app()->session['session_duoxueke_subject_id'];?>">
  411. <input type="hidden" name="textbookId" value="0">
  412. <input type="hidden" name="tpl_index" value="1050">
  413. <input type="hidden" name="paperType" value="1050">
  414. <input name="type" value="1" type="hidden"/>
  415. <input name="teacherId" value="0" type="hidden"/>
  416. <input name="markType" value="3" type="hidden"/>
  417. <input name="classIds" value="0" type="hidden"/>
  418. <input name="topic" value="0" type="hidden"/>
  419. <input name="is_update" value="0" type="hidden"/>
  420. <input name="third_tpl_id" value="<?php echo isset($thisTpls[0]['third_tpl_id'])?$thisTpls[0]['third_tpl_id']:0 ?>" type="hidden"/>
  421. <!--<button id="createThird">确定</button>-->
  422. <div class="mcp-form-list mcp-fl-btns clearfix">
  423. 共:<span class="total-count">0</span> 题
  424. <input type="button" value="打印预览" class="mcp-sure-btn" id="PrintThird" active="true">
  425. <input type="button" value="保存当前答题卡模板" class="save-card" id="saveCard" active="true">
  426. </div>
  427. </div>
  428. </div>
  429. </div>
  430. </div>
  431. <div class="ttd" style="display: none;">
  432. <div class="s-state clearfix posirela">
  433. <div class="hint_size clearfix">
  434. <span class="fl ml15">保存答题卡模版</span>
  435. </div>
  436. <div class="mistake_character clearfix dialog-content" style="padding-top: 10px; padding-bottom: 0;">
  437. <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>
  438. </div>
  439. <div class="mistake_character clearfix">
  440. <div class="clearfix bnt_width" >
  441. <input type="hidden" name="exam_id" value="0">
  442. <input type="hidden" name="file_type" value="">
  443. <p class="fl ml10"><button class="roger shut" id="btnSubmit" active="true">创建新模板</button></p>
  444. <p class="fl ml10"><button class="roger shut" id="btnCover" active="true">覆盖原模板</button></p>
  445. <p class="fr ml10"><button class="roger shut rogergb" id="btnClose">取消</button></p>
  446. </div>
  447. </div>
  448. </div>
  449. </div>
  450. <script>
  451. var TopicType=new Array(5);
  452. TopicType[0]=[];
  453. TopicType[1]=[];
  454. TopicType[2]=[];
  455. TopicType[3]=[];
  456. TopicType[4]=[];
  457. $(document).ready(function(){
  458. var showmsg = $("._tpl.active").attr("showmsg");
  459. if(showmsg>0){
  460. $("#btnCover").removeClass('dn');
  461. $(".bnt_width").addClass('c_bnt_width');
  462. }else {
  463. $(".bnt_width").removeClass('c_bnt_width');
  464. $("#btnCover").addClass('dn');
  465. $("input[name=tpl_title]").val('');
  466. }
  467. //选择试卷类型
  468. $('.sel-paper-type').click(function() {
  469. var paper_type = $(this).attr('id');
  470. if (paper_type) {
  471. $('#paperType-error').html("");
  472. }
  473. $('input[name="paperType"]').val(paper_type);
  474. });
  475. $('.datetimepicker8').datetimepicker({
  476. onGenerate:function( ct ){
  477. $(this).find('.xdsoft_date').toggleClass('xdsoft_disabled');
  478. $(this).find('.xdsoft_today').removeClass('xdsoft_disabled');
  479. },
  480. format:'Y-m-d',
  481. formatDate:'Y-m-d',
  482. //minDate:'-1970/01/2',
  483. maxDate:'+1970/01/2',
  484. todayBtn : true,
  485. minDate: '-<?php echo date('Y-m-d', strtotime('Yesterday')); ?>',
  486. timepicker:false
  487. });
  488. //选择考试时间
  489. //选择教材题源
  490. var subjects = <?php echo json_encode($teacherSubjectNames); ?>;
  491. var textbooks = <?php echo json_encode($teacherSubjectMaterialNames); ?>;
  492. for(var key in subjects){
  493. $(".choose-grade").append('<option value="'+ key +'">'+ subjects[key] +'</option>');
  494. }
  495. $(".choose-grade").change(function(){
  496. var obj = $(this);
  497. var val = obj.val();
  498. var child = $('.choose-book');
  499. child.html('<option value="0">选择教材</option>');
  500. for (var key in textbooks) {
  501. if (key == val) {
  502. child.html('');
  503. for (var name in textbooks[key]) {
  504. child.append('<option value="'+ [name] +'">'+ textbooks[key][name] +'</option>');
  505. }
  506. }
  507. }
  508. });
  509. //返回
  510. $('.mcp-back-btn').click(function(){
  511. location.href="<?php echo Yii::app()->createUrl('third/index')?>";
  512. });
  513. $('input[name="examName"]').keydown(function(event){
  514. $('#examName-error').html("");
  515. });
  516. //阅卷方式
  517. $('.markType').click(function(){
  518. var markType = $(this).attr('value');
  519. if(markType){
  520. $('#markType-error').html("");
  521. }
  522. $('input[name="markType"]').val(markType);
  523. });
  524. //考试类型
  525. $('.examType').click(function(){
  526. var type = $(this).find("span:eq(0)").attr('value');
  527. if(type){
  528. $('#type-error').html("");
  529. }
  530. $('input[name="type"]').val(type);
  531. });
  532. //选择教师
  533. $('.sel-option').click(function(){
  534. var teacher_id = $(this).attr('id');
  535. if(teacher_id){
  536. $('#choose-error').html("");
  537. }
  538. $('input[name="teacherId"]').val(teacher_id);
  539. $.post(
  540. "<?php echo Yii::app()->createUrl('third/ajaxchangeclasses')?>",
  541. {teacher_id:teacher_id},
  542. function(result){
  543. if(result.error){
  544. $('#choose-error').html(result.error);
  545. }else{
  546. var htmlg1 = "";
  547. var htmlg2 = "";
  548. var htmlg3 = "";
  549. $.each(result.class_arr_select,function(k,v){
  550. if(v.grade == 1){
  551. htmlg1+="<span grade='"+v.grade+"' classid='"+v.class_id+"'>"+v.class_name+"</span>";
  552. }
  553. if(v.grade == 2){
  554. htmlg2+="<span grade='"+v.grade+"' classid='"+v.class_id+"'>"+v.class_name+"</span>";
  555. }
  556. if(v.grade == 3){
  557. htmlg3+="<span grade='"+v.grade+"' classid='"+v.class_id+"'>"+v.class_name+"</span>";
  558. }
  559. });
  560. $('.g1').html(htmlg1);
  561. $('.g2').html(htmlg2);
  562. $('.g3').html(htmlg3);
  563. var htmlidg1 = "";
  564. var htmlidg2 = "";
  565. var htmlidg3 = "";
  566. $.each(result.class_arr_noselect,function(k,v){
  567. if(v.grade == 1){
  568. htmlidg1 += '<li class="bjs-lis ellipsis" grade="'+v.grade+'" classid="'+v.class_id+'" ><span class="judge-sel"></span>'+v.class_name+'</li>';
  569. }
  570. if(v.grade == 2){
  571. htmlidg2 += '<li class="bjs-lis ellipsis" grade="'+v.grade+'" classid="'+v.class_id+'" ><span class="judge-sel"></span>'+v.class_name+'</li>';
  572. }
  573. if(v.grade == 3){
  574. htmlidg3 += '<li class="bjs-lis ellipsis" grade="'+v.grade+'" classid="'+v.class_id+'" ><span class="judge-sel"></span>'+v.class_name+'</li>';
  575. }
  576. });
  577. $('#grade1 ul').html(htmlidg1);
  578. $('#grade2 ul').html(htmlidg2);
  579. $('#grade3 ul').html(htmlidg3);
  580. }
  581. },
  582. 'json'
  583. );
  584. });
  585. //切换年级
  586. $('.a-years,.a-province,.paper-type > span, .grade-sel ul li').click(function(){
  587. if(!$(this).hasClass('active')){
  588. $(this).addClass('active').siblings().removeClass('active');
  589. var gradearr=[1,2,3];
  590. var grade=$(this).attr("grade");
  591. for(var i=0;i<=gradearr.length;i++){
  592. if(gradearr[i]==grade){
  593. $("#grade"+grade).show();
  594. $('.g'+grade).show();
  595. $('.g'+grade).attr('status',1);
  596. }else{
  597. $("#grade"+gradearr[i]).hide();
  598. $(".g"+gradearr[i]).hide();
  599. $(".g"+gradearr[i]).attr('status',0);
  600. }
  601. }
  602. }
  603. });
  604. //添加班级
  605. $(".bj-sel ul").on("click","li", function(){
  606. $('#classIds-error').html("");
  607. $(this).find('.judge-sel').addClass('active');
  608. $(this).remove();
  609. var grade = $(this).attr('grade');
  610. $('.g'+grade).append('<span grade="'+$(this).attr("grade")+'" classid="'+$(this).attr("classid")+'">'+$(this).text()+'</span>');
  611. });
  612. //移除班级
  613. $('.sel-classes').delegate('span','click',function(){
  614. $(this).remove();
  615. $("#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>');
  616. });
  617. if ($('.sel-classes > span').length > 0){
  618. for (var i = 0;i < $('.sel-classes > span').length; i++){
  619. for (var k = 0;k < $('.bjs-lis').length; k++){
  620. if ($('.bjs-lis').eq(k).text().trim()==$('.sel-classes > span').eq(i).text().trim()) {
  621. $('.bjs-lis').eq(k).find('.judge-sel').addClass('active');
  622. }
  623. }
  624. }
  625. }
  626. $('.mcp-radio-sel').click(function(){
  627. if (!$(this).find('.sel-btn').hasClass('select')) {
  628. $(this).find('.sel-btn').addClass('select');
  629. $(this).siblings().find('.sel-btn').removeClass('select');
  630. }
  631. });
  632. $('.grade-sel ul li').click(function(){
  633. $(this).addClass('active').siblings().removeClass('active');
  634. });
  635. // $('.judge-sel').on('click',function(){
  636. // alert(1);
  637. // if (!$(this).hasClass('active')) {
  638. // $(this).addClass('active');
  639. // $('.sel-classes').append('<span>'+$(this).closest('.bjs-lis').text()+'</span>');
  640. // } else {
  641. // $(this).removeClass('active');
  642. // for (var i = 0;i < $('.sel-classes > span').length; i++) {
  643. // console.log($('.sel-classes > span').eq(i).text());
  644. // if ($('.sel-classes > span').eq(i).text().trim() == $(this).closest('.bjs-lis').text().trim()){
  645. // $('.sel-classes > span').eq(i).remove();
  646. // }
  647. // }
  648. // }
  649. // });
  650. $('.sel-classes > span').click(function(){
  651. $(this).remove();
  652. for (var i = 0;i < $('.bjs-lis').length; i++) {
  653. if ($('.bjs-lis').eq(i).text().trim()==$(this).text().trim()){
  654. $('.bjs-lis').eq(i).find('.judge-sel').removeClass('active');
  655. }
  656. }
  657. });
  658. // 下拉列表模拟
  659. $('.inp-text').click(function(){
  660. if ($(this).next().is(':hidden')){
  661. $(this).next().show();
  662. } else {
  663. $(this).next().hide();
  664. }
  665. });
  666. // 点下拉列表选项
  667. $('.select-con li').click(function(){
  668. $(this).closest('.select-con').hide();
  669. $(this).closest('.mcp-form-detail').find('.inp-text').text($(this).text());
  670. });
  671. // 点击空白处下拉列表消失
  672. $(document).click(function(e){
  673. var targetNode = $(e.target).closest(".inp-text");
  674. if (targetNode.length>0){
  675. return;
  676. }else{
  677. $(".select-con").hide();
  678. }
  679. });
  680. $("body").delegate("#createThird[active='true']", "click", function(e) {
  681. var classIds='';
  682. $(".sel-classes[status=1]").children("span").each(function(){
  683. classIds += $(this).attr('classid')+",";
  684. });
  685. $('input[name="classIds"]').val(classIds);
  686. var error = new Array();
  687. var classIds = $('input[name="classIds"]').val();
  688. var examName = $('input[name="examName"]').val();
  689. var is_update = $('input[name="is_update"]').val();
  690. var type = $('input[name="type"]').val();
  691. var teacherId = $('input[name="teacherId"]').val();
  692. // var markType = $('input[name="markType"]').val();
  693. var markType = $("#markType").find(".select").attr("value");
  694. var subjectId = $('input[name=subjectId]').val();
  695. var examDate = $("input[name='examDate']").val();
  696. var paperType = $("input[name='paperType']").val();
  697. if(subjectId == 0 || subjectId == null){
  698. $('#subject-error').html('请指定题源');
  699. error.push('没有指定题源');
  700. }else{
  701. $('#subject-error').html('');
  702. }
  703. if(examName == "" || examName == null){
  704. $('#examName-error').html('请指定考试名称');
  705. error.push('没有指定考试名称');
  706. }else{
  707. $('#examName-error').html('');
  708. }
  709. if(type == "" || type == null){
  710. $('#type-error').html('请指定考试类型');
  711. error.push('没有指定考试类型');
  712. }else{
  713. $('#type-error').html('');
  714. }
  715. if(paperType == 0 || paperType == 1 || paperType == 2 || paperType == 1050){
  716. $('#paperType-error').html('');
  717. }else{
  718. $('#paperType-error').html('请指定正确的试卷类型');
  719. error.push('请指定正确的试卷类型');
  720. }
  721. if(teacherId == '0' || teacherId == null){
  722. $('#choose-error').html('请指定阅卷老师');
  723. error.push('没有指定阅卷老师');
  724. }else{
  725. $('#choose-error').html('');
  726. if(classIds == "" || classIds == null){
  727. $('#classIds-error').html('请指定考试班级');
  728. error.push('没有指定考试班级');
  729. }else{
  730. $('#classIds-error').html('');
  731. }
  732. }
  733. if(!markType){
  734. $('#markType-error').html('请指定阅卷方式');
  735. error.push('没有指定阅卷方式');
  736. }else{
  737. $('#markType-error').html('');
  738. }
  739. if (examDate == '') {
  740. $('#examDate').html('请设置考试日期');
  741. error.push('请设置考试日期');
  742. } else if (examDate < '<?php echo date('Y-m-d'); ?>') {
  743. $('#examDate').html('考试日期设置错误');
  744. error.push('考试日期设置错误');
  745. }else{
  746. $('#examDate').html('');
  747. }
  748. if(error.length == 0){
  749. $("#createThird").attr('active','false');
  750. var data={
  751. examName:examName,
  752. teacherId:teacherId,
  753. type:type,
  754. classIds:classIds,
  755. markType:markType,
  756. paperType:paperType,
  757. subjectId:subjectId,
  758. textbookId:0,
  759. examDate:examDate,
  760. // tpl_index:1050,
  761. tpl_index:paperType,
  762. is_update:is_update,
  763. topic:JSON.stringify(TopicType),
  764. layout:$("input[name=layout]:checked").val(),
  765. select_card_type:$("input[name=select_card_type]:checked").val(),
  766. third_tpl_id:$("input[name='third_tpl_id']").val(),
  767. tpl_save_type:$("input[name='tpl_save_type']:checked").val()
  768. };
  769. if (!$(".ques-type-control label input").is(':checked')) {
  770. $.post("<?php echo Yii::app()->createUrl('third/quanCreatethird')?>",data,function (data) {
  771. var m = JSON.parse(data);
  772. if(m.status==0)
  773. {
  774. layer.msg(m.msg);
  775. $("#createThird").attr('active','true');
  776. return false;
  777. }else{
  778. $('input[name="is_update"]').val(m.exam_group_id);
  779. location.href = m.result;
  780. }
  781. });
  782. }else{
  783. $.post("<?php echo Yii::app()->createUrl('third/ajaxCreatethird')?>",data,function (data) {
  784. var m = JSON.parse(data);
  785. if(m.status==0)
  786. {
  787. layer.msg(m.msg);
  788. $("#createThird").attr('active','true');
  789. return false;
  790. }else{
  791. $('input[name="is_update"]').val(m.exam_group_id);
  792. // evaluationClient.CreateDiSanFang(JSON.stringify(m.result));
  793. location.href = m.result;
  794. }
  795. });
  796. }
  797. }else{
  798. layer.msg(error.join(','));
  799. $("#createThird").attr('active','true');
  800. }
  801. });
  802. $("#PrintThird").click(function(){
  803. if (!$(".ques-type-control label input").is(':checked')) {
  804. layer.msg('请选择题型!');return false;
  805. }
  806. if($(".ques-topic-num .ques-topic-item-edit").length > 0){
  807. layer.msg('请先保存题型!');return false;
  808. }
  809. var flag = 0;
  810. for(i = 0 ; i<TopicType.length;i++)
  811. {
  812. if(TopicType[i].length>0){
  813. flag = 1;
  814. if( i==4 &&!TopicType[4][0][0]){
  815. layer.msg('选做题设置有误,题型不能为空!');
  816. return false;
  817. }
  818. for (j = 0;j<TopicType[i].length;j++){
  819. if(TopicType[i][j][1]=='' || TopicType[i][j][1]==0)
  820. {
  821. layer.msg('题号不能为空!');
  822. return false;
  823. }
  824. }
  825. }
  826. }
  827. if(flag == 0){
  828. layer.msg('题号不能为空!');
  829. return false;
  830. }
  831. $('input[name="topic"]').val(JSON.stringify(TopicType)); //题型选择数据赋值
  832. var classIds='';
  833. $(".sel-classes[status=1]").children("span").each(function(){
  834. classIds += $(this).attr('classid')+",";
  835. });
  836. $('input[name="classIds"]').val(classIds);
  837. var examName = $('input[name="examName"]').val();
  838. var classIds = $('input[name="classIds"]').val();
  839. var data = {
  840. examName:examName,
  841. classIds:classIds,
  842. layout:$("input[name=layout]:checked").val(),
  843. select_card_type:$("input[name=select_card_type]:checked").val(),
  844. topic:JSON.stringify(TopicType)
  845. };
  846. $.post("<?php echo Yii::app()->createUrl('third/create_sheet')?>",data,function (rs) {
  847. var m = JSON.parse(rs);
  848. if(m.status==0)
  849. {
  850. layer.msg(m.msg);
  851. return false;
  852. }else{
  853. evaluationClient.CreateDiSanFang(JSON.stringify(m.result));
  854. }
  855. });
  856. });
  857. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  858. $("body").delegate("#btnSubmit[active='true']", "click", function(e) {
  859. var classIds='';
  860. $(".sel-classes[status=1]").children("span").each(function(){
  861. classIds += $(this).attr('classid')+",";
  862. });
  863. $('input[name="classIds"]').val(classIds);
  864. var classIds = $('input[name=classIds]').val();
  865. var teacherId = $('input[name="teacherId"]').val();
  866. var subjectId = $('input[name=subjectId]').val();
  867. var tpl_title = $('input[name=tpl_title]').val();
  868. if(tpl_title == "" || tpl_title == null){
  869. layer.msg('没有指定模板名称!');return false;
  870. }
  871. if(subjectId == 0 || subjectId == null){
  872. layer.msg('没有指定题源!');return false;
  873. }
  874. if(teacherId == '0' || teacherId == null){
  875. $('#choose-error').html('请指定阅卷老师');
  876. layer.msg('没有指定阅卷老师!');return false;
  877. }else{
  878. $('#choose-error').html('');
  879. if(classIds == "" || classIds == null){
  880. $('#classIds-error').html('请指定考试班级');
  881. layer.msg('没有指定考试班级!');return false;
  882. }else{
  883. $('#classIds-error').html('');
  884. }
  885. }
  886. if (!$(".ques-type-control label input").is(':checked')) {
  887. layer.msg('请选择题型!');return false;
  888. }
  889. var flag = 0;
  890. for(i = 0 ; i<TopicType.length;i++)
  891. {
  892. if(TopicType[i].length>0){
  893. flag = 1;
  894. if( i==4 &&!TopicType[4][0][0]){
  895. layer.msg('选做题设置有误,题型不能为空!');
  896. return false;
  897. }
  898. for (j = 0;j<TopicType[i].length;j++){
  899. if(TopicType[i][j][1]=='' || TopicType[i][j][1]==0)
  900. {
  901. layer.msg('题号不能为空!');
  902. return false;
  903. }
  904. }
  905. }
  906. }
  907. if(flag == 0){
  908. layer.msg('题号不能为空!');
  909. return false;
  910. }
  911. var data={
  912. tpl_title:tpl_title,
  913. teacherId:teacherId,
  914. classIds:classIds,
  915. subjectId:subjectId,
  916. textbookId:0,
  917. topic:JSON.stringify(TopicType),
  918. layout:$("input[name=layout]:checked").val(),
  919. select_card_type:$("input[name=select_card_type]:checked").val()
  920. };
  921. $.post("<?php echo Yii::app()->createUrl('third/createThirdTpl')?>",data,function (data) {
  922. var m = JSON.parse(data);
  923. if(m.status==1)
  924. { //$('#btnSubmit').attr('active','false');
  925. // layer.msg(m.msg);
  926. $(".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>');
  927. $("input[name=third_tpl_id]").val(m.result.third_tpl_id);
  928. $("._tpl.active").removeClass('active');
  929. $("._tpl").eq(0).addClass('active');
  930. $("#btnCover").removeClass('dn');
  931. layer.msg('保存成功!',{
  932. icon: 1
  933. });
  934. $(".ttd").hide();
  935. $(".bnt_width").addClass('c_bnt_width');
  936. return false;
  937. }else{
  938. layer.msg('保存失败',{
  939. icon: 5
  940. }, function(){
  941. $(".ttd").fadeOut();
  942. });
  943. return false;
  944. }
  945. });
  946. });
  947. $("body").delegate("#btnCover[active='true']", "click", function(e) {
  948. var classIds='';
  949. $(".sel-classes[status=1]").children("span").each(function(){
  950. classIds += $(this).attr('classid')+",";
  951. });
  952. $('input[name="classIds"]').val(classIds);
  953. var classIds = $('input[name=classIds]').val();
  954. var teacherId = $('input[name="teacherId"]').val();
  955. var subjectId = $('input[name=subjectId]').val();
  956. var tpl_title = $('input[name=tpl_title]').val();
  957. if(tpl_title == "" || tpl_title == null){
  958. layer.msg('没有指定模板名称!');return false;
  959. }
  960. if(subjectId == 0 || subjectId == null){
  961. layer.msg('没有指定题源!');return false;
  962. }
  963. if(teacherId == '0' || teacherId == null){
  964. $('#choose-error').html('请指定阅卷老师');
  965. layer.msg('没有指定阅卷老师!');return false;
  966. }else{
  967. $('#choose-error').html('');
  968. if(classIds == "" || classIds == null){
  969. $('#classIds-error').html('请指定考试班级');
  970. layer.msg('没有指定考试班级!');return false;
  971. }else{
  972. $('#classIds-error').html('');
  973. }
  974. }
  975. if (!$(".ques-type-control label input").is(':checked')) {
  976. layer.msg('请选择题型!');return false;
  977. }
  978. var flag = 0;
  979. for(i = 0 ; i<TopicType.length;i++)
  980. {
  981. if(TopicType[i].length>0){
  982. flag = 1;
  983. if( i==4 &&!TopicType[4][0][0]){
  984. layer.msg('选做题设置有误,题型不能为空!');
  985. return false;
  986. }
  987. for (j = 0;j<TopicType[i].length;j++){
  988. if(TopicType[i][j][1]=='' || TopicType[i][j][1]==0)
  989. {
  990. layer.msg('题号不能为空!');
  991. return false;
  992. }
  993. }
  994. }
  995. }
  996. if(flag == 0){
  997. layer.msg('题号不能为空!');
  998. return false;
  999. }
  1000. var data={
  1001. tpl_title:tpl_title,
  1002. third_tpl_id:$("._tpl.active").attr('third_tpl_id'),
  1003. teacherId:teacherId,
  1004. classIds:classIds,
  1005. subjectId:subjectId,
  1006. textbookId:0,
  1007. topic:JSON.stringify(TopicType),
  1008. layout:$("input[name=layout]:checked").val(),
  1009. select_card_type:$("input[name=select_card_type]:checked").val()
  1010. };
  1011. $.post("<?php echo Yii::app()->createUrl('third/updateThirdTpl')?>",data,function (data) {
  1012. var m = JSON.parse(data);
  1013. if(m.status==1)
  1014. {
  1015. $("._tpl.active").children().find('.size').html(m.result.layout);
  1016. $("._tpl.active").children().find('.type').html(m.result.select_card_type);
  1017. $("._tpl.active").children().find('.card-name').html(m.result.title);
  1018. $("._tpl.active").removeClass('active');
  1019. $("._tpl").eq(0).addClass('active');
  1020. layer.msg('保存成功!',{
  1021. icon: 1
  1022. });
  1023. $(".ttd").fadeOut();
  1024. $("#btnCover").removeClass('dn');
  1025. $(".bnt_width").addClass('c_bnt_width');
  1026. return false;
  1027. }else{
  1028. layer.msg('保存失败',{
  1029. icon: 5
  1030. }, function(){
  1031. $(".ttd").fadeOut();
  1032. });
  1033. return false;
  1034. }
  1035. });
  1036. });
  1037. $("#btnClose").click(function(){
  1038. $(this).parents(".ttd").fadeOut();
  1039. });
  1040. $(".shut").click(function(){
  1041. $("body").css({height :"100%",overflow:"auto"});
  1042. });
  1043. });
  1044. </script>
  1045. <script>
  1046. $(function(){
  1047. //console.log(firstCartTpl);
  1048. if(firstCartTpl!='null'){
  1049. TopicType=firstCartTpl;
  1050. }
  1051. $(".template-flag").click(function(){
  1052. FillCard();
  1053. $(".teamplate-list-box").toggle();
  1054. $(".page-content").toggleClass('show-add-card')
  1055. });
  1056. // 点击显示隐藏
  1057. $(".ques-type-control label input").click(function(e){
  1058. var index=$(this).parent().index();
  1059. var tempTopic = $(".ques-topic-num .ques-topic").eq(index);
  1060. delTopicType(tempTopic);
  1061. if($(this).is(":checked")){
  1062. $(this).parent("label").addClass("active");
  1063. tempTopic.find(".include-text").val("");
  1064. tempTopic.find(".include-count").val("");
  1065. tempTopic.show();
  1066. if(index==0 || index==1){
  1067. TopicType[index].push([4,'',0]); //对应数据初始化对应题型,题号,样式三种数据
  1068. }else if(index==2){
  1069. TopicType[index].push([1,'',1]); //对应数据初始化对应题型,题号,样式三种数据
  1070. }else if(index==3){
  1071. TopicType[index].push([1,'',0]); //对应数据初始化对应题型,题号,样式三种数据
  1072. }else if(index==4){
  1073. TopicType[index].push([0,'',0]); //对应数据初始化对应题型,题号,样式三种数据
  1074. }
  1075. //console.log(TopicType);
  1076. }else{
  1077. $(this).parent("label").removeClass("active")
  1078. tempTopic.hide();
  1079. if(index==0 || index==1){
  1080. tempTopic.find(".ques-topic-list").eq(0).find("input").val("");
  1081. tempTopic.find(".ques-topic-list").find('.topic-num input').val('');
  1082. tempTopic.find(".ques-topic-list").eq(0).find(".ques-topic-item").removeClass("ques-topic-item-edit").find("a").html("选项编辑");
  1083. }else if(index==2){
  1084. // console.log(tempTopic.find(".ques-topic-list").find('.topic-num').find('input').val());
  1085. tempTopic.find(".ques-topic-list").find('.topic-num').find('input').val('');
  1086. tempTopic.find(".ques-topic-list").find('.line-control').find('input').val(1);
  1087. tempTopic.find(".ques-topic-list").eq(0).find(".ques-topic-item").find('label input').eq(0).click();
  1088. tempTopic.find(".line-type label:first input").prop("checked",true);
  1089. }else if(index==3){
  1090. tempTopic.find(".ques-topic-list").find('.topic-num input').val('');
  1091. tempTopic.find(".ques-topic-list").eq(0).find("input").val("");
  1092. tempTopic.find(".ques-topic-list").find('.line-control').find('input').val(1);
  1093. tempTopic.find(".ques-topic-list").eq(0).find(".ques-topic-item").find('label input').eq(0).click();
  1094. tempTopic.find(".line-type label:first input").prop("checked",true);
  1095. tempTopic.find(".line-type label").eq(0).find("input").prop("checked",true);
  1096. }
  1097. tempTopic.find(".ques-topic-list").eq(0).find("em").remove();
  1098. for(var i=0;i<4;i++){
  1099. tempTopic.find(".ques-topic-list").eq(0).find("s").before("<em>【"+arr[i]+"】<b></b></em>");
  1100. }
  1101. for(var i=tempTopic.find(".ques-topic-list").length;i>1;i--){
  1102. tempTopic.find(".ques-topic-list:last").remove();
  1103. }
  1104. TopicType[index]=[]; //清空对应数据
  1105. // console.log(TopicType);
  1106. }
  1107. $("input[name=bixuan]").val(1);
  1108. totalTopicCount();
  1109. });
  1110. // 答题卡类型选择
  1111. $(".card-style a").click(function(){
  1112. $(this).addClass("active").siblings().removeClass("active");
  1113. $(".card-select").eq($(this).index()).addClass("cur").siblings().removeClass("cur");
  1114. $(".card-select").eq($(this).index()).find("input:eq(0)").prop("checked",true).siblings().prop("checked",false);
  1115. })
  1116. // 选项编辑
  1117. $("body").delegate(".ques-topic-item a","click",function(){
  1118. if($(this).closest(".ques-topic-item").hasClass("ques-topic-item-edit")){
  1119. $(this).closest(".ques-topic-item").removeClass("ques-topic-item-edit");
  1120. $(this).html("选项编辑");
  1121. $(this).closest(".ques-topic-item").find("s").hide();
  1122. //装入修改后数据
  1123. var index=$(this).closest('.ques-topic').index(); //第几个大类型
  1124. var topic_index=$(this).closest('.ques-topic-list').index()-1; //该题型下第几个子题型
  1125. TopicType[index][topic_index][0]=$(this).parent().find('em').length;
  1126. // console.log(TopicType);
  1127. }else{
  1128. $(this).closest(".ques-topic-item").addClass("ques-topic-item-edit");
  1129. $(this).siblings("s").show();
  1130. if($(this).closest(".ques-topic").hasClass("ques-topic-one")){
  1131. // console.log($(this).closest(".ques-topic-item").find("em").length)
  1132. if($(this).closest(".ques-topic-item").find("em").length >3){
  1133. $(this).siblings("s").hide();
  1134. }else{
  1135. $(this).siblings("s").show();
  1136. }
  1137. }else{
  1138. // console.log($(this).closest(".ques-topic-item").find("em").length)
  1139. if($(this).closest(".ques-topic-item").find("em").length >6){
  1140. $(this).siblings("s").hide();
  1141. }else{
  1142. $(this).siblings("s").show();
  1143. }
  1144. }
  1145. $(this).html("保存");
  1146. }
  1147. });
  1148. // 删除选项
  1149. $("body").delegate(".ques-topic-item-edit b","click",function(){
  1150. if($(this).closest(".ques-topic-item-edit").find("em").length <= 10){
  1151. $(this).closest(".ques-topic-item-edit").find("s").show();
  1152. }
  1153. var tempParent = $(this).closest(".ques-topic-item-edit");
  1154. $(this).closest("em").remove();
  1155. orderABC(tempParent.find("em"))
  1156. hideDel(tempParent.find("b"))
  1157. });
  1158. function orderABC(obj){
  1159. for(var i=0;i<obj.length;i++){
  1160. obj.eq(i).html("【"+arr[i]+"】<b></b>")
  1161. }
  1162. }
  1163. // 增加选项
  1164. var arr = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N'];
  1165. $("body").delegate(".ques-topic-item-edit s","click",function(){
  1166. if($(this).closest(".ques-topic").hasClass("ques-topic-one")){
  1167. addAbc($(this),4)
  1168. }else{
  1169. addAbc($(this),7)
  1170. }
  1171. });
  1172. function addAbc(obj,count){
  1173. var idx = obj.closest(".ques-topic-item-edit").find("em").length;
  1174. obj.before("<em>【"+arr[idx]+"】<b></b></em>");
  1175. hideDel(obj.closest(".ques-topic-item-edit").find("b"))
  1176. if(obj.closest(".ques-topic-item-edit").find("em").length >= count){
  1177. obj.hide();
  1178. }
  1179. }
  1180. // 增加题型
  1181. $(".add-type a").click(function(){
  1182. var temp = $(this).closest(".add-type").prev().clone(true);
  1183. temp.find(".topic-point-num").html($(this).closest(".add-type").prev().index()+1);
  1184. temp.find(".ques-topic-item").removeClass("ques-topic-item-edit").find("a").html("选项编辑");
  1185. temp.find("em").remove();
  1186. for(var i=0;i<temp.find("input[type='text']").length;i++){
  1187. if(!temp.find("input[type='text']").eq(i).hasClass("choose-count")){
  1188. temp.find("input[type='text']").eq(i).val("")
  1189. }
  1190. }
  1191. for(var i=0;i<4;i++){
  1192. temp.find("s").before("<em>【"+arr[i]+"】<b></b></em>");
  1193. }
  1194. //主观题
  1195. if($(this).hasClass("main-topic")){
  1196. temp.find("input[name^='topicType']").attr("name","topicType_"+($(this).closest(".ques-topic").find(".ques-topic-list").length));
  1197. temp.find(".line-control input").val(1)
  1198. }
  1199. //填空题
  1200. if($(this).hasClass("tian_main-topic")){
  1201. temp.find("input[name^='tianketi_Type']").attr("name","tianketi_Type_"+($(this).closest(".ques-topic").find(".ques-topic-list").length));
  1202. temp.find(".line-control input").val(1)
  1203. }
  1204. //选做题
  1205. if($(this).hasClass("xuan-main-topic")){
  1206. temp.find("input[name^='chooseType']").attr("name","chooseType_"+($(this).closest(".ques-topic").find(".ques-topic-list").length));
  1207. }
  1208. temp.find('input:radio').each(function(i){
  1209. temp.find('input:radio').eq(i).attr('checked',false);
  1210. });
  1211. var index=$(this).closest('.ques-topic').index(); //第几个大类型
  1212. //判断数量
  1213. if(index==4 && $(this).closest(".ques-topic").find(".ques-topic-list").length>2){
  1214. return false;
  1215. }
  1216. $(this).closest(".add-type").before(temp);
  1217. if(index==0 || index==1){
  1218. TopicType[index].push([4,'',0]); //对应数据初始化对应题型,题号,样式三种数据
  1219. }else if(index==2){
  1220. $style=$('.line-type input:radio:checked').parent().index()+1;
  1221. temp.find('.line-control').css("display","inline-block");
  1222. TopicType[index].push([1,'',$style]); //对应数据初始化对应题型,题号,样式三种数据
  1223. }else if(index==3){
  1224. var topicTypeIndex=$(this).closest(".ques-topic").find(".ques-topic-list").length;
  1225. temp.find("input[name='topicType_"+topicTypeIndex+"']").eq(0).click();
  1226. $style=$('input[name=lineType]:checked').val();
  1227. temp.find('.line-control').hide();
  1228. TopicType[index].push([1,'',$style]); //对应数据初始化对应题型,题号,样式三种数据
  1229. }else if(index==4){
  1230. $("input[name=bixuan]").val(1);
  1231. var topicTypeIndex=$(this).closest(".ques-topic").find(".ques-topic-list").length;
  1232. TopicType[index].push([0,'',1]); //对应数据初始化对应题型,题号,样式三种数据
  1233. $(this).closest(".ques-topic").last().find("input[name='chooseType_"+(topicTypeIndex-1)+"']").eq(0).click();
  1234. }
  1235. delTopicType($(this).closest(".add-type").siblings(".ques-topic-list"));
  1236. // console.log(TopicType);
  1237. })
  1238. // 显示隐藏主观题横线行数
  1239. initTopicType($(".ques-topic-item input[type='radio']"))
  1240. function initTopicType(obj){
  1241. if(obj.val() == 2){
  1242. obj.closest("label").siblings(".line-control").css("display","inline-block");
  1243. }else{
  1244. obj.closest("label").siblings(".line-control").hide();
  1245. }
  1246. }
  1247. // 删除题型
  1248. function delTopicType(obj){
  1249. obj.find(".ques-item-del").show();
  1250. obj.eq(0).find(".ques-item-del").hide();
  1251. }
  1252. $("body").delegate(".ques-item-del","click",function(){
  1253. var index=$(this).closest('.ques-topic').index(); //大题型索引
  1254. var topic_index=$(this).closest('.ques-topic-list').index()-1;//子题型索引
  1255. if(topic_index!=0){
  1256. TopicType[index].splice(topic_index,1);
  1257. // console.log(TopicType[index]);
  1258. var pBox = $(this).closest(".ques-topic");
  1259. $(this).closest(".ques-topic-list").remove();
  1260. pBox.find(".item-count").html(topicCount(pBox));
  1261. pBox.find('.topic-point-num').each(function(index,val){
  1262. if(index != 0){
  1263. $(this).html(index+1)
  1264. }
  1265. })
  1266. totalTopicCount();
  1267. }
  1268. })
  1269. // 主观题样式切换
  1270. $("body").delegate(".ques-topic-item input[type='radio']","click",function(){
  1271. initTopicType($(this));
  1272. var index=$(this).closest('.ques-topic').index(); //大题型索引
  1273. var topic_index=$(this).closest('.ques-topic-list').index()-1;//子题型索引
  1274. if($(this).val()==2 && index!=2){
  1275. $(this).closest('.ques-topic-item').find('.line-control').css("display","inline-block");
  1276. TopicType[index][topic_index][0]=$(this).val()+'///'+$(this).closest('.ques-topic-item').find('.line-control input').val();
  1277. }else{
  1278. TopicType[index][topic_index][0]=$(this).val();
  1279. if($(this).val()==2){
  1280. $(this).closest('.ques-topic-item').find('.line-control').css("display","inline-block");
  1281. }else{
  1282. $(this).closest('.ques-topic-item').find('.line-control').hide();
  1283. }
  1284. }
  1285. console.log(TopicType);
  1286. });
  1287. // 主观题样式图片显示隐藏
  1288. $("body").delegate(".ques-topic-item .ques-style","mouseenter",function(){
  1289. $(this).find("img").show();
  1290. });
  1291. $("body").delegate(".ques-topic-item .ques-style","mouseleave",function(){
  1292. $(this).find("img").hide();
  1293. });
  1294. // 主观题横线行数加减
  1295. $("body").delegate(".line-control .add","click",function(){
  1296. $(this).siblings("input").val(Number($(this).siblings("input").val())+1);
  1297. var index=$(this).closest('.ques-topic').index(); //大题型索引
  1298. var topic_index=$(this).closest('.ques-topic-list').index()-1;//子题型索引
  1299. if(TopicType[index][topic_index][0]){
  1300. if(index!=2){
  1301. TopicType[index][topic_index][0]='2///'+$(this).siblings("input").val();
  1302. }else{
  1303. TopicType[index][topic_index][0]=$(this).siblings("input").val();
  1304. }
  1305. }
  1306. });
  1307. $("body").delegate(".line-control .del","click",function(){
  1308. if(Number($(this).siblings("input").val()) > 1){
  1309. $(this).siblings("input").val(Number($(this).siblings("input").val())-1);
  1310. var index=$(this).closest('.ques-topic').index(); //大题型索引
  1311. var topic_index=$(this).closest('.ques-topic-list').index()-1;//子题型索引
  1312. if(index!=2){
  1313. TopicType[index][topic_index][0]='2///'+$(this).siblings("input").val();
  1314. }else{
  1315. TopicType[index][topic_index][0]=$(this).siblings("input").val();
  1316. }
  1317. }
  1318. });
  1319. // 校验文本框输入
  1320. $("body").delegate(".topic-num input,.topic-num-choose input","keyup",function(){
  1321. $(this).val($(this).val().replace(/[^\d-,]+/g,""));
  1322. });
  1323. $("body").delegate(".choose-topic-num input,.include-list input","keyup",function(){
  1324. $(this).val($(this).val().replace(/[^\d]+/g,""));
  1325. })
  1326. // 小题校验
  1327. $("body").delegate(".include-list .include-text","blur",function(){
  1328. var tNo = trimArr($(this).closest(".include-list").siblings(".topic-num").find("input").val());
  1329. var sibIpt = $(this).closest(".ques-topic").find(".include-text");
  1330. var count = 0;
  1331. for(var i=0;i<sibIpt.length;i++){
  1332. if($(this).val() == sibIpt.eq(i).val()){
  1333. count++;
  1334. if(count > 1){
  1335. layer.msg('小题题号不能重复!');
  1336. $(this).val("");
  1337. break;
  1338. }
  1339. }
  1340. }
  1341. if($(this).val()){
  1342. console.log($(this).val())
  1343. console.log(tNo)
  1344. if(tNo.indexOf($(this).val()) == -1){
  1345. layer.msg('请输入有效题号!');
  1346. $(this).val("");
  1347. }
  1348. }
  1349. if($(this).val() != "" && $(this).next().val() != ""){
  1350. var bigTopic = $(this).val();
  1351. var smallTopic = $(this).next().val();
  1352. var index=$(this).closest('.ques-topic').index(); //大题型索引
  1353. var topic_index=$(this).closest('.ques-topic-list').index()-1;//子题型索引
  1354. if(TopicType[index][topic_index][3]){
  1355. var tp3Arr = TopicType[index][topic_index][3].split(",");
  1356. var tp3StrNext = '';
  1357. var isHave = 0;
  1358. for(var i=0;i<tp3Arr.length;i++){
  1359. var tp3ArrNext = tp3Arr[i].split("///");
  1360. console.log(tp3ArrNext);
  1361. if(tp3ArrNext[0] == bigTopic){
  1362. tp3ArrNext[1] == smallTopic;
  1363. isHave = 1;
  1364. }
  1365. if(tp3StrNext == ""){
  1366. tp3StrNext = tp3ArrNext.join("///");
  1367. }else{
  1368. tp3StrNext += ","+tp3ArrNext.join("///");
  1369. }
  1370. }
  1371. if(isHave == 0){
  1372. TopicType[index][topic_index][3] += ','+bigTopic+"///"+smallTopic;
  1373. }else{
  1374. TopicType[index][topic_index][3] = tp3StrNext;
  1375. }
  1376. }else{
  1377. TopicType[index][topic_index][3] = bigTopic+"///"+smallTopic;
  1378. }
  1379. }
  1380. })
  1381. $("body").delegate(".include-list .include-count","blur",function(){
  1382. if($(this).val() != "" && $(this).prev().val() != ""){
  1383. var bigTopic = $(this).prev().val();
  1384. var smallTopic = $(this).val();
  1385. var index=$(this).closest('.ques-topic').index(); //大题型索引
  1386. var topic_index=$(this).closest('.ques-topic-list').index()-1;//子题型索引
  1387. if(TopicType[index][topic_index][3]){
  1388. var tp3Arr = TopicType[index][topic_index][3].split(",");
  1389. var tp3StrNext = '';
  1390. var isHave = 0;
  1391. for(var i=0;i<tp3Arr.length;i++){
  1392. var tp3ArrNext = tp3Arr[i].split("///");
  1393. if(tp3ArrNext[0] == bigTopic){
  1394. tp3ArrNext[1] = smallTopic;
  1395. isHave = 1;
  1396. }
  1397. if(tp3StrNext == ""){
  1398. tp3StrNext = tp3ArrNext.join("///");
  1399. }else{
  1400. tp3StrNext += ","+tp3ArrNext.join("///");
  1401. }
  1402. }
  1403. if(isHave == 0){
  1404. TopicType[index][topic_index][3] += ','+bigTopic+"///"+smallTopic;
  1405. }else{
  1406. TopicType[index][topic_index][3] = tp3StrNext;
  1407. }
  1408. }else{
  1409. TopicType[index][topic_index][3] = bigTopic+"///"+smallTopic;
  1410. }
  1411. console.log(TopicType);
  1412. }
  1413. })
  1414. // 选做题校验
  1415. $("body").delegate(".choose-all-count","blur",function(){
  1416. // if(parseInt($(this).val()) > parseInt($(this).siblings(".choose-all-count").val())){
  1417. // layer.msg('sorry,选题数不能大于总题数!');
  1418. // $(this).val("");
  1419. // }
  1420. $(this).closest(".ques-topic").find(".item-count").html(topicCount($(this).closest(".ques-topic")))
  1421. totalTopicCount();
  1422. })
  1423. // choose-count
  1424. //题号计算,10-20
  1425. function trimArr(str){
  1426. if(!str) return [];
  1427. var arr1 = str.split(",");
  1428. var arrNo = [];
  1429. for(var i=0;i<arr1.length;i++){
  1430. var arr2 = arr1[i].split("-");
  1431. for(var j=0;j<arr2.length;j++){
  1432. if(arr2[j] == "" || typeof(arr2[j]) == "undefined"){
  1433. arr2.splice(j,1);
  1434. j= j-1;
  1435. }
  1436. }
  1437. if(arr2.length > 1){
  1438. for(var j = parseInt(arr2[0]);j<=parseInt(arr2[1]);j++){
  1439. arrNo.push(j+'')
  1440. }
  1441. }else{
  1442. if(arr2[0]){
  1443. arrNo.push(arr2[0]+'')
  1444. }
  1445. }
  1446. }
  1447. // console.log(repArr(arrNo))
  1448. return repArr(arrNo);
  1449. }
  1450. //数组去重
  1451. function repArr(arr) {
  1452. for (var i = 0; i < arr.length; i++) {
  1453. if (arr.indexOf(arr[i]) != i) {
  1454. arr.splice(i,1);//删除数组元素后数组长度减1后面的元素前移
  1455. i--;//数组下标回退
  1456. }
  1457. }
  1458. return arr;
  1459. }
  1460. // 题量计算 item-count
  1461. function topicCount(obj){
  1462. var tType = obj.find(".topic-num input");
  1463. var tCountObj = obj.find(".include-count");
  1464. var tChooseObj = obj.find(".choose-count")
  1465. var tempNoStr = "";
  1466. var count = 0;
  1467. for(var i=0;i<tType.length;i++){
  1468. tempNoStr += (','+tType.eq(i).val());
  1469. }
  1470. count = trimArr(tempNoStr).length;
  1471. for(var i=0;i<tCountObj.length;i++){
  1472. if(tCountObj.eq(i).val()){
  1473. count += (tCountObj.eq(i).val()-1)
  1474. }
  1475. }
  1476. for(var i=0;i<tChooseObj.length;i++){
  1477. if(tChooseObj.eq(i).val()){
  1478. count += parseInt(tChooseObj.eq(i).val())
  1479. }
  1480. }
  1481. return count
  1482. }
  1483. function totalTopicCount(){
  1484. var totalCount = 0;
  1485. // for(var i=0;i<$(".item-count").length;i++){z
  1486. // totalCount += parseInt($('.item-count').eq(i).html())
  1487. // }
  1488. for(var i=0;i<$(".ques-topic").length;i++){
  1489. if($(".ques-topic").eq(i).css("display") == "block"){
  1490. totalCount += topicCount($(".ques-topic").eq(i));
  1491. }
  1492. }
  1493. $(".total-count").html(totalCount)
  1494. }
  1495. $("body").delegate(".include-count","blur",function(){
  1496. if($(this).val() == "") return;
  1497. // console.log("sb")
  1498. if($(this).val() > 1){
  1499. $(this).closest(".ques-topic").find(".item-count").html(topicCount($(this).closest(".ques-topic")))
  1500. }else{
  1501. layer.msg('小题数量最小为2!');
  1502. $(this).val('')
  1503. $(this).closest(".ques-topic").find(".item-count").html(topicCount($(this).closest(".ques-topic"))+1)
  1504. }
  1505. totalTopicCount();
  1506. })
  1507. $("body").delegate(".topic-num input","blur",function(){
  1508. $(this).closest(".ques-topic").find(".item-count").html(topicCount($(this).closest(".ques-topic")));
  1509. totalTopicCount();
  1510. });
  1511. // 试题内包含小题
  1512. $("body").delegate(".include-topic a","click",function(){
  1513. var tNo = trimArr($(this).parent().siblings(".topic-num").find("input").val());
  1514. var ulList = $(this).parent().siblings().find('ul');
  1515. if(tNo.length == 0){
  1516. layer.msg('sorry,空题不能添加小题!');
  1517. return;
  1518. }else if(tNo.length <= ulList.children().length){
  1519. layer.msg('请先添加题号,谢谢!');
  1520. return;
  1521. }
  1522. ulList.append('<li>第 <input type="text" class="include-text"> 题有 <input type="text" class="include-count"> 个小题 <img src="/images/u434.png" class="del-include"></li>');
  1523. })
  1524. // 删除小题
  1525. $("body").delegate(".del-include","click",function(){
  1526. var This = $(this);
  1527. var pBox = $(this).closest(".ques-topic");
  1528. var index=This.closest('.ques-topic').index(); //大题型索引
  1529. var topic_index=This.closest('.ques-topic-list').index()-1;//子题型索引
  1530. var text = '';
  1531. var textArr = [];
  1532. $($(this).parent().parent().find("li")).each(function(k,v){
  1533. if(k < $(this).parent().parent().find("li").length - 1){
  1534. var include_text = $(this).find(".include-text").val();
  1535. var include_count = $(this).find(".include-count").val();
  1536. if(include_text > 0 && include_count > 0){
  1537. var textArrNext = include_text+'///'+include_count;
  1538. textArr.push(textArrNext);
  1539. }
  1540. }
  1541. });
  1542. if(textArr.length>0){
  1543. text = textArr.join(',');
  1544. }
  1545. TopicType[index][topic_index][3] = text;
  1546. This.closest("li").remove();
  1547. pBox.find(".item-count").html(topicCount(pBox))
  1548. totalTopicCount();
  1549. layer.msg('删除成功!');
  1550. })
  1551. //题号变化,修改数据
  1552. $('.ques-topic-num').on('change','.topic-num input',function(){
  1553. var index=$(this).closest('.ques-topic').index(); //大题型索引
  1554. var topic_index=$(this).closest('.ques-topic-list').index()-1;//子题型索引
  1555. var text=0;
  1556. if($(this).val()!='' && $(this).val()!=undefined){
  1557. text=$(this).val();
  1558. }
  1559. TopicType[index][topic_index][1]=text;
  1560. // console.log(TopicType);
  1561. });
  1562. $('.ques-topic-num').on('change','.topic-num-choose input',function(){
  1563. var index=$(this).closest('.ques-topic').index(); //大题型索引
  1564. var topic_index=$(this).closest('.ques-topic-list').index()-1;//子题型索引
  1565. var text=0;
  1566. if($(this).val()!='' && $(this).val()!=undefined){
  1567. text=$(this).val();
  1568. }
  1569. TopicType[index][topic_index][1]=text;
  1570. // console.log(TopicType);
  1571. });
  1572. //主观题样式变化,修改数据
  1573. $('.line-type label').click(function(){
  1574. //alert($(this).index());
  1575. var idx = $(this).closest(".ques-topic").index();
  1576. if(!(idx==2||idx==3)) return;
  1577. for(var i=0;i<TopicType[idx].length;i++){
  1578. TopicType[idx][i][2]=$(this).index()+1;
  1579. }
  1580. // console.log(TopicType);
  1581. });
  1582. //选做题
  1583. //题号
  1584. $('.ques-topic').on('change','.choose-topic-num input',function(){
  1585. //alert($(this).index());
  1586. var text='';
  1587. if($(this).index()==0){
  1588. text=$(this).val()+'///'+$(this).next().val();
  1589. }else{
  1590. text=$(this).prev().val()+'///'+$(this).val();
  1591. }
  1592. var index=$(this).closest('.ques-topic').index(); //大题型索引
  1593. var topic_index=$(this).closest('.ques-topic-list').index()-1;//子题型索引
  1594. TopicType[index][topic_index][0]=text;
  1595. // console.log(TopicType);
  1596. });
  1597. //样式
  1598. $('.ques-topic').on('click','.choose-topic input:radio',function(){
  1599. var index=$(this).closest('.ques-topic').index(); //大题型索引
  1600. var topic_index=$(this).closest('.ques-topic-list').index()-1;//子题型索引
  1601. TopicType[index][topic_index][2]=$(this).val();
  1602. });
  1603. function hideDel(obj){
  1604. if(obj.length > 2){
  1605. obj.closest(".ques-topic-item-edit").find("b").css("display","inline");
  1606. }else{
  1607. obj.closest(".ques-topic-item-edit").find("b").hide()
  1608. }
  1609. }
  1610. $("body").on("click","._tpl",function(){
  1611. var showmsg = $(this).attr("showmsg");
  1612. if(showmsg>0){
  1613. $("#btnCover").removeClass('dn');
  1614. $(".bnt_width").addClass('c_bnt_width');
  1615. $("input[name=tpl_title]").val($(this).find(".card-name").html());
  1616. }else {
  1617. $("input[name=layout]").eq(0).prop("checked",true);
  1618. $("input[name=select_card_type]").eq(0).prop("checked",true);
  1619. $(".bnt_width").removeClass('c_bnt_width');
  1620. $("#btnCover").addClass('dn');
  1621. $("input[name=tpl_title]").val('');
  1622. }
  1623. $("._tpl.active").removeClass('active');
  1624. $(this).addClass("active");
  1625. var data = {
  1626. third_tpl_id:$(this).attr("third_tpl_id")
  1627. };
  1628. if(showmsg>0){
  1629. $.post("<?php echo Yii::app()->createUrl('third/getThirdTpl')?>",data,function (res) {
  1630. /**
  1631. * 处理处理
  1632. * */
  1633. if(res.result.tpl_data){
  1634. TopicType=$.parseJSON(res.result.tpl_data);
  1635. FillCard();
  1636. // $("input[name=layout][value="+res.result.layout+"]").prop("checked",true);
  1637. // $("input[name=select_card_type][value="+res.result.select_card_type+"]").prop("checked",true);
  1638. $('input[name="third_tpl_id"]').val(res.result.third_tpl_id);
  1639. if(res.result.layout == 10 || res.result.layout == 11){
  1640. $(".card-select").eq(1).addClass("cur").siblings().removeClass("cur");
  1641. $(".card-style a").eq(1).addClass("active").siblings().removeClass("active");
  1642. $("input[name=layout][value="+res.result.layout+"]").prop("checked",true);
  1643. }else if(res.result.layout == 21 || res.result.layout == 31){
  1644. $(".card-select").eq(0).addClass("cur").siblings().removeClass("cur");
  1645. $(".card-style a").eq(0).addClass("active").siblings().removeClass("active");
  1646. $("input[name=layout][value="+res.result.layout+"]").prop("checked",true);
  1647. }else if(res.result.layout == 40 || res.result.layout == 41){
  1648. $(".card-select").eq(2).addClass("cur").siblings().removeClass("cur");
  1649. $(".card-style a").eq(2).addClass("active").siblings().removeClass("active");
  1650. $("input[name=layout][value="+res.result.layout+"]").prop("checked",true);
  1651. }else if(res.result.layout == 50 || res.result.layout == 51){
  1652. $(".card-select").eq(3).addClass("cur").siblings().removeClass("cur");
  1653. $(".card-style a").eq(3).addClass("active").siblings().removeClass("active");
  1654. $("input[name=layout][value="+res.result.layout+"]").prop("checked",true);
  1655. }
  1656. // console.log(TopicType[0].length);
  1657. }
  1658. console.log(TopicType);
  1659. },'json');
  1660. }else{
  1661. //创建新的答题卡
  1662. TopicType[0]=[];
  1663. TopicType[1]=[];
  1664. TopicType[2]=[];
  1665. TopicType[3]=[];
  1666. TopicType[4]=[];
  1667. $('input[name="third_tpl_id"]').val(0);
  1668. FillCard();
  1669. console.log(TopicType);
  1670. }
  1671. //获取模板数据
  1672. });
  1673. $("body").delegate(".icon-delete","click",function(){
  1674. var obj = $(this);
  1675. layer.msg("确定要永久删除此模板吗?", {
  1676. time: 0,
  1677. btn: ['确定', '取消'],
  1678. yes: function(index){
  1679. layer.close(index);
  1680. $.ajax({
  1681. url: "<?php echo Yii::app()->createUrl('third/delThirdTpl')?>",
  1682. type: "POST",
  1683. dataType: "json",
  1684. data:{
  1685. third_tpl_id:$("._tpl.active").attr('third_tpl_id')
  1686. },
  1687. success: function (m){
  1688. if(m.status){
  1689. layer.msg('删除成功',{
  1690. icon: 1
  1691. }, function(){
  1692. layer.closeAll();
  1693. $("input[name=layout]").eq(0).prop("checked",true);
  1694. $("input[name=select_card_type]").eq(0).prop("checked",true);
  1695. $(".bnt_width").removeClass('c_bnt_width');
  1696. $("#btnCover").addClass('dn');
  1697. $("input[name=tpl_title]").val('');
  1698. $("._tpl.active").removeClass('active');
  1699. $("._tpl:last").addClass("active");
  1700. obj.closest('._tpl').remove();
  1701. //创建新的答题卡
  1702. TopicType[0]=[];
  1703. TopicType[1]=[];
  1704. TopicType[2]=[];
  1705. TopicType[3]=[];
  1706. TopicType[4]=[];
  1707. $('input[name="third_tpl_id"]').val(0);
  1708. FillCard();
  1709. });
  1710. }
  1711. },
  1712. error: function (data, status, e){ //服务器响应失败处理函数
  1713. layer.msg('返回失败!',{
  1714. icon: 5
  1715. }, function(){
  1716. layer.closeAll();
  1717. });
  1718. }
  1719. });
  1720. }
  1721. });
  1722. });
  1723. //saveCard
  1724. $("#saveCard").click(function(){
  1725. var classIds='';
  1726. $(".sel-classes[status=1]").children("span").each(function(){
  1727. classIds += $(this).attr('classid')+",";
  1728. });
  1729. $('input[name="classIds"]').val(classIds);
  1730. var classIds = $('input[name="classIds"]').val();
  1731. var teacherId = $('input[name="teacherId"]').val();
  1732. var subjectId = $('input[name=subjectId]').val();
  1733. if(subjectId == 0 || subjectId == null){
  1734. layer.msg('没有指定题源!');return false;
  1735. }else{
  1736. $('#subject-error').html('');
  1737. }
  1738. if(teacherId == '0' || teacherId == null){
  1739. $('#choose-error').html('请指定阅卷老师');
  1740. layer.msg('没有指定阅卷老师!');return false;
  1741. }else{
  1742. $('#choose-error').html('');
  1743. if(classIds == "" || classIds == null){
  1744. $('#classIds-error').html('请指定考试班级');
  1745. layer.msg('没有指定考试班级!');return false;
  1746. }else{
  1747. $('#classIds-error').html('');
  1748. }
  1749. }
  1750. if (!$(".ques-type-control label input").is(':checked')) {
  1751. layer.msg('请选择题型!');return false;
  1752. }
  1753. var flag = 0;
  1754. for(i = 0 ; i<TopicType.length;i++)
  1755. {
  1756. if(TopicType[i].length>0){
  1757. flag = 1;
  1758. for (j = 0;j<TopicType[i].length;j++){
  1759. if(i==4 && TopicType[i][j][0]==0){
  1760. layer.msg('选做题设置有误,题型不能为空!');
  1761. return false;
  1762. }
  1763. if(TopicType[i][j][1]=='' || TopicType[i][j][1]==0)
  1764. {
  1765. layer.msg('题号不能为空!');
  1766. return false;
  1767. }
  1768. }
  1769. }
  1770. }
  1771. if(flag == 0){
  1772. layer.msg('题号不能为空!');
  1773. return false;
  1774. }
  1775. $(".ttd").fadeIn();
  1776. });
  1777. //根据数据重置答题卡
  1778. function FillCard(){
  1779. //所有选项卡重置
  1780. var tempBox=$(".ques-topic-num .ques-topic");
  1781. for(var i=0;i<tempBox.length;i++){
  1782. tempBox.eq(i).hide();
  1783. if(tempBox.eq(i).find('.ques-topic-list').length>0){
  1784. for(var j=tempBox.eq(i).find('.ques-topic-list').length;j>1;j--){
  1785. tempBox.eq(i).find('.ques-topic-list:last').remove();
  1786. }
  1787. if(i==0 || i==1){
  1788. tempBox.eq(i).find(".ques-topic-list").eq(0).find("input").val("");
  1789. tempBox.eq(i).find(".ques-topic-list").find('.topic-num input').val('');
  1790. tempBox.eq(i).find(".ques-topic-list").eq(0).find(".ques-topic-item").removeClass("ques-topic-item-edit").find("a").html("选项编辑");
  1791. }else if(i==2){
  1792. tempBox.eq(i).find(".ques-topic-list").find('.topic-num').find('input').val('');
  1793. tempBox.eq(i).find(".ques-topic-list").find('.line-control').find('input').val(1);
  1794. }else if(i==3){
  1795. tempBox.eq(i).find('.ques-topic-list').find(".line-control").hide().find('input').val(1);
  1796. //tempBox.eq(i).find('.ques-topic-list').find(".line-control")
  1797. tempBox.eq(i).find(".ques-topic-list").find('.topic-num input').val('');
  1798. for(var k=0;k<tempBox.eq(i).find(".ques-topic-list").find('input[name="topicType"]').length;k++){
  1799. if(k==0){
  1800. tempBox.eq(i).find(".ques-topic-list").find('input[name="topicType"]').eq(k).prop('checked',true);
  1801. }else{
  1802. tempBox.eq(i).find(".ques-topic-list").find('input[name="topicType"]').eq(k).prop('checked',false);
  1803. }
  1804. }
  1805. }else if(i==4){
  1806. tempBox.eq(i).find('.choose-topic-num input').eq(0).val('');
  1807. tempBox.eq(i).find(".ques-topic-list").find('.topic-num input').val('');
  1808. for(var k=0;k<tempBox.eq(i).find(".ques-topic-list").find('input[name="chooseType"]').length;k++){
  1809. if(k==0){
  1810. tempBox.eq(i).find(".ques-topic-list").find('input[name="chooseType"]').eq(k).prop('checked',true);
  1811. }else{
  1812. tempBox.eq(i).find(".ques-topic-list").find('input[name="chooseType"]').eq(k).prop('checked',false);
  1813. }
  1814. }
  1815. }
  1816. tempBox.eq(i).find(".ques-topic-list").eq(0).find("em").remove();
  1817. for(var k=0;k<4;k++){
  1818. tempBox.eq(i).find(".ques-topic-list").eq(0).find("s").before("<em>【"+arr[k]+"】<b></b></em>");
  1819. }
  1820. }
  1821. }
  1822. $(".ques-type-control label input").prop('checked',false).parent("label").removeClass("active");
  1823. /////////////////////
  1824. for(var l=0;l<TopicType.length;l++){
  1825. initType(l)
  1826. $(".ques-topic").eq(l).find(".item-count").html(topicCount($(".ques-topic").eq(l)));
  1827. totalTopicCount();
  1828. }
  1829. function initType(num){
  1830. if(TopicType[num] && TopicType[num].length>0){
  1831. //0单选题 1不定项选题 2填空题 3主观题 4选做题
  1832. var tempTopic = tempBox.eq(num);
  1833. var input_obj=$(".ques-type-control label input").eq(num);
  1834. input_obj.prop('checked',true).parent("label").addClass("active");
  1835. for(var i=0;i<TopicType[num].length;i++){
  1836. if(i==0){
  1837. tempTopic.show();
  1838. tempTopic.find('.ques-item-del').hide();
  1839. if(num == 0 || num == 1){
  1840. //处理题型
  1841. tempTopic.find('.ques-topic-item').find("em").remove();
  1842. for(var j=0;j<TopicType[num][i][0];j++){
  1843. tempTopic.find('.ques-topic-list').eq(0).find('.ques-topic-item').find("s").before("<em>【"+arr[j]+"】<b></b></em>");
  1844. }
  1845. }else if(num == 2){
  1846. //处理题型
  1847. tempTopic.find('.ques-topic-list').eq(0).find('.line-control').css("display","inline-block");
  1848. tempTopic.find('.ques-topic-list').eq(0).find('.line-control input').val(TopicType[2][i][0]);
  1849. var html = "";
  1850. if(TopicType[2][i][3]){
  1851. var smallTopics = TopicType[2][i][3];
  1852. var smallTopicsArr = smallTopics.split(",");
  1853. for(var a=0;a<smallTopicsArr.length;a++){
  1854. var smallTopicsStr = smallTopicsArr[a];
  1855. var nextArr = smallTopicsStr.split("///");
  1856. var bigNum = nextArr[0];
  1857. var smallNum = nextArr[1];
  1858. 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>';
  1859. }
  1860. }
  1861. tempTopic.find('.ques-topic-list').eq(0).find('.include-list ul').html(html);
  1862. //处理样式
  1863. tempTopic.find('.line-type label').eq(TopicType[num][i][2]-1).find('input:radio').attr('checked',true);
  1864. }else if(num == 3){
  1865. //处理题型
  1866. if(String(TopicType[num][i][0]).indexOf('///')>-1){
  1867. var NumberArr=TopicType[num][i][0].split('///');
  1868. tempTopic.find('.ques-topic-list').eq(0).find('input[name="topicType"][value="'+NumberArr[0]+'"]').prop("checked",true);
  1869. tempTopic.find('.ques-topic-list').eq(0).find(".line-control input").val(NumberArr[1]);
  1870. tempTopic.find('.ques-topic-list').eq(0).find(".line-control").css("display","inline-block");
  1871. }else{
  1872. tempTopic.find('.ques-topic-list').eq(0).find('input[name="topicType"]').eq(TopicType[num][i][0]-1).prop("checked",true);
  1873. tempTopic.find('.ques-topic-list').eq(0).find(".line-control").hide();
  1874. }
  1875. var html = "";
  1876. if(TopicType[3][i][3]){
  1877. var smallTopics = TopicType[3][i][3];
  1878. var smallTopicsArr = smallTopics.split(",");
  1879. for(var a=0;a<smallTopicsArr.length;a++){
  1880. var smallTopicsStr = smallTopicsArr[a];
  1881. var nextArr = smallTopicsStr.split("///");
  1882. var bigNum = nextArr[0];
  1883. var smallNum = nextArr[1];
  1884. 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>';
  1885. }
  1886. }
  1887. tempTopic.find('.ques-topic-list').eq(0).find('.include-list ul').html(html);
  1888. //处理样式
  1889. if(TopicType[num][i][2]==0){
  1890. tempTopic.find('.line-type label').eq(TopicType[num][i][2]).find('input:radio').prop('checked',true);
  1891. }else{
  1892. tempTopic.find('.line-type label').eq(TopicType[num][i][2]-1).find('input:radio').prop('checked',true);
  1893. }
  1894. }else if(num == 4){
  1895. //处理题型
  1896. if(TopicType[num][i][0]){
  1897. var NumberArr=TopicType[num][i][0].split('///');
  1898. tempTopic.find('.choose-topic-num').find('input').eq(0).val(NumberArr[0]);
  1899. tempTopic.find('.choose-topic-num').find('input').eq(1).val(NumberArr[1]);
  1900. }
  1901. //处理样式
  1902. tempTopic.find('input[name="chooseType"]').eq(TopicType[num][i][2]-1).attr('checked',true);
  1903. }
  1904. //处理题号
  1905. tempTopic.find('.ques-topic-list').eq(0).find('.topic-num input').val(TopicType[num][i][1]);
  1906. }else{
  1907. var temp= tempTopic.find(".add-type").prev().clone(true);
  1908. if(num == 0 || num == 1){
  1909. temp.find('.ques-topic-item').find("em").remove();
  1910. for(var j=0;j<TopicType[num][i][0];j++){
  1911. temp.find('.ques-topic-item').find("s").before("<em>【"+arr[j]+"】<b></b></em>");
  1912. }
  1913. }else if(num == 2){
  1914. temp.find('.line-control input').val(TopicType[num][i][0]);
  1915. var html = "";
  1916. if(TopicType[2][i][3]){
  1917. var smallTopics = TopicType[2][i][3];
  1918. var smallTopicsArr = smallTopics.split(",");
  1919. for(var a=0;a<smallTopicsArr.length;a++){
  1920. var smallTopicsStr = smallTopicsArr[a];
  1921. var nextArr = smallTopicsStr.split("///");
  1922. var bigNum = nextArr[0];
  1923. var smallNum = nextArr[1];
  1924. 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>';
  1925. }
  1926. }
  1927. temp.find('.include-list ul').html(html);
  1928. }else if(num == 3){
  1929. temp.find("input[name^='topicType']").prop("checked",'');
  1930. temp.find("input[name^='topicType']").attr("name","topicType_"+i);
  1931. //判断题型是否包括横线
  1932. if(String(TopicType[num][i][0]).indexOf('///')>-1){
  1933. var NumberArr=TopicType[num][i][0].split('///');
  1934. temp.find('input[name="topicType_'+i+'"]').eq(NumberArr[0]-1).prop("checked",true);
  1935. temp.find(".line-control input").val(NumberArr[1]);
  1936. temp.eq(0).find(".line-control").show();
  1937. }else{
  1938. temp.find('input[name="topicType_'+i+'"][value="'+TopicType[num][i][0]+'"]').prop("checked",true);
  1939. temp.find(".line-control").hide();
  1940. }
  1941. // temp.find('.line-control input').val(TopicType[num][i][0]);
  1942. var html = "";
  1943. if(TopicType[3][i][3]){
  1944. var smallTopics = TopicType[3][i][3];
  1945. var smallTopicsArr = smallTopics.split(",");
  1946. for(var a=0;a<smallTopicsArr.length;a++){
  1947. var smallTopicsStr = smallTopicsArr[a];
  1948. var nextArr = smallTopicsStr.split("///");
  1949. var bigNum = nextArr[0];
  1950. var smallNum = nextArr[1];
  1951. 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>';
  1952. }
  1953. }
  1954. temp.find('.include-list ul').html(html);
  1955. }else if(num == 4){
  1956. if(i==1){
  1957. temp.find("input[name='chooseType']").attr("name","chooseType_"+i);
  1958. }else{
  1959. temp.find("input[name='chooseType_"+(i-1)+"']").attr("name","chooseType_"+i);
  1960. }
  1961. //处理题型
  1962. if(TopicType[num][i][0]){
  1963. var NumberArr=TopicType[num][i][0].split('///');
  1964. temp.find('.choose-topic-num').find('input').eq(0).val(NumberArr[0]);
  1965. temp.find('.choose-topic-num').find('input').eq(1).val(NumberArr[1]);
  1966. }
  1967. temp.find('input[name="chooseType_'+i+'"]').eq(TopicType[num][i][2]-1).attr('checked',true);
  1968. }
  1969. temp.find('.topic-num input').val(TopicType[num][i][1]);
  1970. temp.find('.ques-item-del').show();
  1971. tempTopic.find(".add-type").before(temp);
  1972. }
  1973. }
  1974. }
  1975. }
  1976. }
  1977. });
  1978. function show_version() {
  1979. layer.msg('你的客户端版本太低,请升最新版本');
  1980. }
  1981. </script>