index.php 83 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>试题编辑</title>
  6. <link rel="stylesheet" type="text/css" href="/css/base.css">
  7. <script type="text/javascript" src="/js/jquery.min.js"></script>
  8. <script src="/js/layer/layer.js"></script>
  9. <style type="text/css">
  10. /*.topic-content*/
  11. .choose-topic h3,.filling-topic h3,.answer-topic h3{font-weight: 700;font-size: 14px;line-height: 34px;}
  12. .topic{padding-left: 30px; font-size:14px;text-align: justify;line-height: 22px;}
  13. .topic a{margin:0 5px; color: #4395ff}
  14. .topic p{display: inline;}
  15. /*.topic .score{color: #f00;}*/
  16. .score input,.right-answer{width: 30px;text-align: center; background: #fff;border:0;color: #0155fe}
  17. .score input:focus,.right-answer:focus{border:1px solid #0155fe;outline: none;}
  18. /*.right-answer{color: #f40;}*/
  19. .topic-answer input{width: 60px;}
  20. .words{position: relative;padding-left: 25px; width: 80%;box-sizing: border-box;cursor:pointer;}
  21. .controls{width: 20%;}
  22. .order{position: absolute;left: 0;top: 0;width: 25px;}
  23. .options{padding-left: 35px;}
  24. .options li{margin-top: 10px; list-style:upper-latin;}
  25. .listType_1{width: 70%;padding:0 20px;margin-right:10px}
  26. .listType_2{width: 50%;}
  27. .listType_3{width: 100%;}
  28. .topic-answer,.topic-explain{padding-left: 20px;margin:10px 0;}
  29. .answer-tit{width: 80%;}
  30. .answer-btn{width: 20%;}
  31. .topic-detail{display: none;}
  32. /*弹出层*/
  33. .modal{position: fixed;top: 0;left: 0;width: 100%;height: 100%;font-size:14px;display: none;}
  34. .modal{width: 100%;height: 100%;background: rgba(0,0,0,.4)}
  35. .modal-content{position: absolute;left: 50%;top: 50%;padding-top: 40px; width: 500px;background: #fff; transform: translate(-50%,-50%);}
  36. .modal-title{position: absolute;top: 0;left: 0;padding-left: 20px; width: 100%;height: 40px;line-height: 40px;background: #0155fe;box-sizing: border-box;}
  37. .modal-title em{width: 40px;height: 40px;text-align: center;font-size: 20px;cursor: pointer;}
  38. .model-score{text-align: center;margin:30px 0;}
  39. .model-score input{padding-left: 5px; height: 30px;width: 230px;border:1px solid #ccc;outline: none;}
  40. .model-score input:focus{border-color: #0155fe;box-shadow: 0 0 5px #0155fe;}
  41. .modal-btn{text-align: center;margin:10px 0;}
  42. .modal-btn a{display: inline-block;margin:0 5px; width: 100px; line-height: 40px;background: #0155fe;color: #fff;}
  43. .modal1{position: fixed;top: 0;left: 0;width: 100%;height: 100%;font-size:14px;display: none;}
  44. .modal1{width: 100%;height: 100%;background: rgba(0,0,0,.4)}
  45. .modal-content{position: absolute;left: 50%;top: 50%;padding-top: 40px; width: 500px;background: #fff; transform: translate(-50%,-50%);}
  46. .modal-title{position: absolute;top: 0;left: 0;padding-left: 20px; width: 100%;height: 40px;line-height: 40px;background: #0155fe;box-sizing: border-box;}
  47. .modal-title em{width: 40px;height: 40px;text-align: center;font-size: 20px;cursor: pointer;}
  48. .model-score1{text-align: center;margin:30px 0;}
  49. .model-score1 input{padding-left: 5px; height: 30px;width: 230px;border:1px solid #ccc;outline: none;}
  50. .model-score1 input:focus{border-color: #0155fe;box-shadow: 0 0 5px #0155fe;}
  51. .modal-btn{text-align: center;margin:10px 0;}
  52. .modal-btn a{display: inline-block;margin:0 5px; width: 100px; line-height: 40px;background: #0155fe;color: #fff;}
  53. .modal2{position: fixed;top: 0;left: 0;width: 100%;height: 100%;font-size:14px;display: none;}
  54. .modal2{width: 100%;height: 100%;background: rgba(0,0,0,.4)}
  55. .modal-content{position: absolute;left: 50%;top: 50%;padding-top: 40px; width: 500px;background: #fff; transform: translate(-50%,-50%);}
  56. .modal-title{position: absolute;top: 0;left: 0;padding-left: 20px; width: 100%;height: 40px;line-height: 40px;background: #0155fe;box-sizing: border-box;}
  57. .modal-title em{width: 40px;height: 40px;text-align: center;font-size: 20px;cursor: pointer;}
  58. .model-score2{text-align: center;margin:30px 0;}
  59. .model-score2 input{padding-left: 5px; height: 30px;width: 230px;border:1px solid #ccc;outline: none;}
  60. .model-score2 input:focus{border-color: #0155fe;box-shadow: 0 0 5px #0155fe;}
  61. .modal-btn{text-align: center;margin:10px 0;}
  62. .modal-btn a{display: inline-block;margin:0 5px; width: 100px; line-height: 40px;background: #0155fe;color: #fff;}
  63. .controls {width: 26%;}
  64. .modal1_multi{position: fixed;top: 0;left: 0;width: 100%;height: 100%;font-size:14px;display: none;background: rgba(0,0,0,.4)}
  65. .model-rule{width:80%;margin:5px auto;}
  66. .model-rule label{display: block;margin:10px 0;}
  67. .modal1_multi .model-score1{width:80%;margin:10px auto;text-align: left}
  68. .modal1_multi .modal-btn{text-align: center;margin:5px 0;clear:both;}
  69. .modal1_multi .modal-btn a{display: inline-block;margin:5px 5px; width: 100px; line-height: 40px;background: #0155fe;color: #fff;}
  70. .modal1_multi .model-score-m{width:80%;margin:5px auto;}
  71. #update_msg{color:red}
  72. .modal1_multi .model-score-m label{display: block;margin:5px 0;}
  73. .modal1_multi .model-score-m label .score_tag{width:70px;display: inline-block;}
  74. .modal1_multi .model-score-m label .score_input{padding-left: 5px; height: 20px;width: 200px;border:1px solid #ccc;outline: none; }
  75. .dn{display: none}
  76. .modal_student{position: fixed;top: 0;left: 0;width: 100%;height: 100%;font-size:14px;display: none;}
  77. .modal_student{width: 100%;height: 100%;background: rgba(0,0,0,.4)}
  78. .modal-content{position: absolute;left: 50%;top: 50%;padding-top: 40px; width: 500px;background: #fff; transform: translate(-50%,-50%);}
  79. .modal-title{position: absolute;top: 0;left: 0;padding-left: 20px; width: 100%;height: 40px;line-height: 40px;background: #2977ff;box-sizing: border-box;color: #fff}
  80. .modal-title em{width: 40px;height: 40px;text-align: center;font-size: 20px;cursor: pointer;}
  81. .model-score1{text-align: center;margin:30px 0;}
  82. .model-score1 input{padding-left: 5px; height: 30px;width: 230px;border:1px solid #ccc;outline: none;}
  83. .model-score1 input:focus{border-color: #0155fe;box-shadow: 0 0 5px #0155fe;}
  84. .modal-btn{text-align: center;margin:10px 0;}
  85. .modal-btn a{display: inline-block;margin:0 5px; width: 100px; line-height: 40px;background: #2977ff;color: #fff;}
  86. .modal_subject{position: fixed;top: 0;left: 0;width: 100%;height: 100%;font-size:14px;display: none;}
  87. .modal_subject{width: 100%;height: 100%;background: rgba(0,0,0,.4)}
  88. .batch_topic{padding-left: 30px; font-size:14px;text-align: justify;line-height: 22px;}
  89. .batch_topic a{margin:0 5px; color: #4395ff}
  90. .batch_topic p{display: inline;}
  91. .confirmbox-mask {
  92. background: rgba(0, 0, 0, .7);
  93. left: 0;
  94. right: 0;
  95. top: 0;
  96. bottom: 0;
  97. z-index: 99;
  98. position: fixed;
  99. }
  100. button {
  101. border: none;
  102. background: #2977ff;
  103. width: 80px;
  104. height: 26px;
  105. border-radius: 3px;
  106. font-size: 14px;
  107. color: #fff;
  108. outline: none;
  109. cursor: pointer;
  110. }
  111. button.save {
  112. display: block;
  113. margin: 40px auto;
  114. }
  115. .confirmbox .confirmbox-btns {
  116. margin-top: 40px;
  117. }
  118. .class-modal {
  119. width: 500px;
  120. min-height: 400px;
  121. background: #fff;
  122. // border-radius: 5px;
  123. position: absolute;
  124. top: 50%;
  125. left: 50%;
  126. transform: translate(-50%, -50%);
  127. }
  128. .class-modal-head {
  129. font-size: 14px;
  130. background:#2977ff;
  131. color:#fff;
  132. height:35px;
  133. line-height: 35px;
  134. padding: 0 0 0 15px;
  135. }
  136. .class-modal-body {
  137. margin-top: 20px;
  138. max-height: 300px;
  139. overflow: auto;
  140. margin-left:50px;
  141. }
  142. .class-modal-body .classes {
  143. margin-bottom: 20px;
  144. }
  145. .class-modal-body .classes > div {
  146. display: inline-block;
  147. max-width: 640px;
  148. vertical-align: top;
  149. }
  150. .class-modal-body .classes a {
  151. text-decoration: none;
  152. display: inline-block;
  153. margin: 0 5px 5px;
  154. color: #136bfb;
  155. font-size: 14px;
  156. }
  157. .class-modal-body .classes a.active {
  158. color: #fc091b
  159. }
  160. .class-modal .icon-close{
  161. position: absolute;
  162. right: 20px;
  163. top: 2px;
  164. color:#fff;
  165. }
  166. .c-red {
  167. color: #CC3300
  168. }
  169. .avg{
  170. margin:0 10px;
  171. }
  172. .class_btn{
  173. text-align: center;
  174. }
  175. .confirmbox-mask p{
  176. word-wrap : break-word ;
  177. }
  178. .template-flag-box a{display:inline-block;color:#fff;text-decoration:none;border-radius:3px;width: 100px;text-align: center;background: #1FBF86;height: 30px;margin-right:20px;line-height:30px}
  179. .class-modal-body p{margin:10px 0;}
  180. .class-modal-body p span{display: inline-block;width:60px;}
  181. .icon-close{cursor:pointer;font-size:20px;line-height: 35px;}
  182. .class_btn{position: fixed;bottom: 2%;text-align: center;width:500px;}
  183. .red-tig{color:red;}
  184. .topic a.c-red{ color: #CC3300}
  185. </style>
  186. <script type="text/javascript">
  187. $(function(){
  188. /* 图片不完全按比例自动缩小 */
  189. $('div.words img,div.topic-explain img').each(function(){
  190. var x = 400; //填入目标图片宽度
  191. var y = 40; //填入目标图片高度
  192. var w=$(this).width(), h=$(this).height();//获取图片宽度、高度
  193. if (w > x) { //图片宽度大于目标宽度时
  194. var w_original=w, h_original=h;
  195. h = h * (x / w); //根据目标宽度按比例算出高度
  196. w = x; //宽度等于预定宽度
  197. if (h < y) { //如果按比例缩小后的高度小于预定高度时
  198. w = w_original * (y / h_original); //按目标高度重新计算宽度
  199. h = y; //高度等于预定高度
  200. }
  201. $(this).attr({width:w,height:h});
  202. }
  203. });
  204. $('li.listType_1 img').each(function(){
  205. var x = 200; //填入目标图片宽度
  206. var y = 30; //填入目标图片高度
  207. var w=$(this).width(), h=$(this).height();//获取图片宽度、高度
  208. if (w > x) { //图片宽度大于目标宽度时
  209. var w_original=w, h_original=h;
  210. h = h * (x / w); //根据目标宽度按比例算出高度
  211. w = x; //宽度等于预定宽度
  212. if (h < y) { //如果按比例缩小后的高度小于预定高度时
  213. w = w_original * (y / h_original); //按目标高度重新计算宽度
  214. h = y; //高度等于预定高度
  215. }
  216. $(this).attr({width:w,height:h});
  217. }
  218. });
  219. /* 点击展开试题解析*/
  220. $("body").delegate('.words', 'click', function(event) {
  221. $(this).parent(".topic-content").siblings('.topic-detail').slideToggle();
  222. });
  223. /*修改分数*/
  224. // $("body").delegate('.change-score', 'click', function(event) {
  225. // $(this).closest(".controls").siblings(".words").find("input").attr("disabled",false).focus();
  226. // })
  227. // $("body").delegate('.answer-btn a', 'click', function(event) {
  228. // $(this).closest('.answer-btn').prev(".answer-tit").find("input").attr("disabled",false).focus();
  229. // });
  230. // $("body").delegate('.words input,.right-answer', 'keyup', function(event) {
  231. // if($(this).is(".words input")){
  232. // $(this).val($(this).val().replace(/[^0-9]/g,""));
  233. // }else{
  234. // $(this).val($(this).val().replace(/[^A-D]/g,""));
  235. // }
  236. // var testLength = $(this).val().length;
  237. // $(this).width(testLength*10 + "px");
  238. // if(event.keyCode == 13){
  239. // $(this).blur();
  240. // $(this).attr("disabled",true)
  241. // }
  242. // })
  243. var open=1;
  244. /* 上移试题 */
  245. $("body").delegate('.topic .up', 'click', function(event) {
  246. var curTopic = $(this).closest(".topic");
  247. var prevTopic = curTopic.prev(".topic");
  248. curTopic.after(prevTopic);
  249. var data={
  250. paper_id:$(this).attr('paper_id'),
  251. topic_id:$(this).attr('topic'),
  252. order:$(this).parent().prev().find('.order').attr('order_id'),
  253. type:$(this).attr('type')
  254. };
  255. $(this).attr('disabled',true);
  256. layer.msg("正在处理。。。。。。",{time:0})
  257. if(open==1){
  258. open=0;
  259. $.post("<?php echo Yii::app()->createUrl('paper/up')?>",data,function(falgs){
  260. });
  261. window.location.reload();
  262. }
  263. //order();
  264. });
  265. /* 下移试题 */
  266. $("body").delegate('.topic .down', 'click', function(event) {
  267. var curTopic = $(this).closest(".topic");
  268. var nextTopic = curTopic.next(".topic");
  269. nextTopic.after(curTopic);
  270. var data={
  271. paper_id:$(this).attr('paper_id'),
  272. topic_id:$(this).attr('topic'),
  273. order:$(this).parent().prev().find('.order').attr('order_id'),
  274. type:$(this).attr('type')
  275. };
  276. $(this).attr('disabled',true);
  277. layer.msg("正在处理。。。。。。",{time:0})
  278. if(open==1){
  279. open=0;
  280. $.post("<?php echo Yii::app()->createUrl('paper/down')?>",data,function(falgs){
  281. });
  282. window.location.reload();
  283. }
  284. //order();
  285. });
  286. function order(){
  287. /*排序试题*/
  288. for(var i=0;i<$(".order").length;i++){
  289. $(".order").eq(i).html(i+1+".");
  290. $(".order").eq(i).attr('order_id',i+1);
  291. }
  292. }
  293. /* 修改分数弹层*/
  294. $(".close").click(function(event) {
  295. $(".sumbit").attr('disabled',false);
  296. layer.closeAll();
  297. $(this).closest(".modal").fadeOut();
  298. });
  299. $(".close1").click(function(event) {
  300. $(".sumbit1").attr('disabled',false);
  301. layer.closeAll();
  302. $(this).closest(".modal1").fadeOut();
  303. });
  304. $(".close2").click(function(event) {
  305. $(".sumbit2").attr('disabled',false);
  306. layer.closeAll();
  307. $(this).closest(".modal2").fadeOut();
  308. });
  309. $(".close3").click(function(event) {
  310. $(".sumbit3").attr('disabled',false);
  311. layer.closeAll();
  312. hideMulti($(this));
  313. });
  314. $(".close_student").click(function(event) {
  315. $(".sumbit_student").attr('disabled',false);
  316. layer.closeAll();
  317. $(this).closest(".modal_student").fadeOut();
  318. });
  319. $(".close_subject").click(function(event) {
  320. $(".sumbit_subject").attr('disabled',false);
  321. layer.closeAll();
  322. $(this).closest(".modal_subject").fadeOut();
  323. });
  324. $(".sumbit").click(function(event) {
  325. if($(this).attr('disabled')=='disabled'){
  326. return false;
  327. }
  328. var type=$("input[name=type]").val();
  329. var score_m=$("input[name=score]").val();
  330. if(score_m==0 || score_m==''){
  331. layer.msg('分值不能为空');
  332. return false;
  333. }
  334. if(type==1 || type==2 || type==11){
  335. if(score_m>49){
  336. layer.msg('最大分值不能超过49分');
  337. return false;
  338. }
  339. }else if(type==5){
  340. if(score_m>49){
  341. layer.msg('最大分值不能超过49分');
  342. return false;
  343. }
  344. }else if(type==7){
  345. if(score_m>60){
  346. layer.msg('最大分值不能超过60分');
  347. return false;
  348. }
  349. }else if(type==17){
  350. if(score_m>60){
  351. layer.msg('最大分值不能超过60分');
  352. return false;
  353. }
  354. }
  355. var questionEle=$('.question_score');
  356. var question_count=0,question_score='';
  357. if(questionEle!=undefined && questionEle.length>0){
  358. question_count=questionEle.length;
  359. questionEle.each(function(i,v){
  360. console.log($(v).val());
  361. if($(v).val()=='' || $(v).val()==0){
  362. layer.msg('请设置小问分数');
  363. return false;
  364. }
  365. if(question_score==''){
  366. question_score=$(v).val();
  367. }else{
  368. question_score=question_score+','+$(v).val();
  369. }
  370. });
  371. }
  372. $(this).closest(".modal").fadeOut();
  373. var data={
  374. paper_id:$("input[name=paper_id]").val(),
  375. topic_id:$("input[name=topic_id]").val(),
  376. score:$("input[name=score]").val(),
  377. type:$("input[name=type]").val(),
  378. question_count:question_count,
  379. question_score:question_score
  380. };
  381. $(this).attr('disabled',true);
  382. var alertIndex=layer.msg('正在更新,请稍候。。。。。。',{time:0});
  383. $.post("<?php echo Yii::app()->createUrl('paper/score')?>",data,function(falgs){
  384. var m =JSON.parse(falgs);
  385. layer.close(alertIndex);
  386. console.log(m);
  387. if(m.status==-1)
  388. {
  389. layer.msg('分数不能为空');return;
  390. }else if(m.status==0)
  391. {
  392. if(m.msg!=undefined){
  393. layer.msg(m.msg);
  394. }else{
  395. layer.msg('修改分数失败');
  396. }
  397. return;
  398. }else{
  399. location.reload();
  400. }
  401. });
  402. });
  403. $(".sumbit1").click(function(event) {
  404. if($(this).attr('disabled')=='disabled'){
  405. return false;
  406. }
  407. $(this).closest(".modal").fadeOut();
  408. if(!$("input[name=answer]").val())
  409. {
  410. layer.msg('不能为空');return;
  411. }
  412. var data={
  413. paper_id:$("input[name=paper_id]").val(),
  414. topic_id:$("input[name=topic_id]").val(),
  415. answer:$("input[name=answer]").val(),
  416. type:$("input[name=type]").val()
  417. };
  418. $(this).attr('disabled',true);
  419. var alertIndex=layer.msg('正在更新,请稍候。。。。。。',{time:0});
  420. $.post("<?php echo Yii::app()->createUrl('paper/answernew')?>",data,function(falgs){
  421. var m =falgs;
  422. layer.close(alertIndex);
  423. if(m==-1)
  424. {
  425. layer.msg('无考试');return;
  426. }else if(m==0)
  427. {
  428. layer.msg('提交失败');return;
  429. }else if(m==-2){
  430. layer.msg('参数有误');return;
  431. }else if(m==-3){
  432. layer.msg('无此题');return;
  433. }else if(m==-4){
  434. layer.msg('接口写入有误');return;
  435. }else if(m==-5){
  436. layer.msg('接口报错:Trans rollback');return;
  437. }else if(m==-6){
  438. layer.msg('校本题库答案修改失败');return;
  439. }else if(m==-7){
  440. layer.msg('校本题库答案已修改,报告无内容需要更新');return;
  441. }else{
  442. location.reload();
  443. }
  444. });
  445. });
  446. $(".sumbit2").click(function(event) {
  447. if($(this).attr('disabled')=='disabled'){
  448. return false;
  449. }
  450. $(this).closest(".modal2").fadeOut();
  451. if(!$("input[name=answer1]").val())
  452. {
  453. layer.msg('不能为空');return;
  454. }
  455. var data={
  456. paper_id:$("input[name=paper_id]").val(),
  457. topic_id:$("input[name=topic_id]").val(),
  458. answer:$("input[name=answer1]").val(),
  459. type:$("input[name=type]").val()
  460. };
  461. $(this).attr('disabled',true);
  462. var alertIndex=layer.msg('正在更新,请稍候。。。。。。',{time:0});
  463. $.post("<?php echo Yii::app()->createUrl('paper/update_answer')?>",data,function(falgs){
  464. var m = falgs;
  465. layer.close(alertIndex);
  466. if(m==-1)
  467. {
  468. layer.msg('无题或不是校本题库的题');return;
  469. }else if(m==0)
  470. {
  471. layer.msg('提交失败');return;
  472. }else if(m==-2){
  473. layer.msg('参数有误');return;
  474. }else if(m==-3){
  475. layer.msg('类型有误');return;
  476. }else if(m==-4){
  477. layer.msg('填写不是A,B,C,D');return;
  478. }else if(m==-5){
  479. layer.msg('校本题库的题有误');return;
  480. }else{
  481. location.reload();
  482. }
  483. });
  484. });
  485. $(".sumbit3").click(function(event) {
  486. if($(this).attr('disabled')=='disabled'){
  487. return false;
  488. }
  489. var obj=$(this);
  490. var rule=$("input[name=rule]:checked").val();
  491. var score_m=$("input[name=score_m]").val();
  492. var score_half_m=$("input[name=score_half_m]").val();
  493. var answer=$("input[name=answer_m]").val();
  494. var is_batch=parseInt($('input[name=is_batch]').val());
  495. var step=parseInt($('input[name=step]').val());
  496. var type=parseInt($('input[name=type_m]').val());
  497. if(!answer)
  498. {
  499. layer.msg('答案不能为空');return;
  500. }
  501. if(score_m<0 || score_m=='' ){
  502. layer.msg('分数不能为空');return false;
  503. }
  504. if(is_batch==0) {
  505. if (parseFloat(score_half_m) > parseFloat(score_m)) {
  506. layer.msg('半对分不能大于满分');
  507. return;
  508. }
  509. }else{
  510. score_half_m=$("input[name=score_half_h]").val();
  511. }
  512. if(rule!=1 && score_half_m==''){
  513. layer.msg('半对分数不能为空');
  514. return false;
  515. }
  516. if(type==1 || type==2 || type==11){
  517. if(score_m>49){
  518. layer.msg('最大分值不能超过49分');
  519. return false;
  520. }
  521. }else if(type==5){
  522. if(score_m>49){
  523. layer.msg('最大分值不能超过49分');
  524. return false;
  525. }
  526. }else if(type==7){
  527. if(score_m>60){
  528. layer.msg('最大分值不能超过60分');
  529. return false;
  530. }
  531. }else if(type==17){
  532. if(score_m>60){
  533. layer.msg('最大分值不能超过60分');
  534. return false;
  535. }
  536. }
  537. var data={
  538. exam_id:$("input[name=exam_id_m]").val(),
  539. topic_id:$("input[name=topic_id_m]").val(),
  540. answer:answer,
  541. type:$("input[name=type_m]").val(),
  542. score_m:score_m,
  543. score_half_m:score_half_m,
  544. rule:rule,
  545. step:step
  546. };
  547. $(this).attr('disabled',true);
  548. var alertIndex=layer.msg('正在更新,请稍候。。。。。。',{time:0});
  549. if(is_batch==1){
  550. postUrl="<?php echo Yii::app()->createUrl('paper/changeMultiRuleBatch')?>";
  551. }else{
  552. postUrl="<?php echo Yii::app()->createUrl('paper/changemulti')?>";
  553. }
  554. $.ajax({
  555. url:postUrl,
  556. data:data,
  557. dataType:'json',
  558. type:'POST',
  559. success:function(res){
  560. layer.close(alertIndex);
  561. if(res.status==1){
  562. layer.msg('更新成功',hideMulti(obj));
  563. location.reload();
  564. }else{
  565. layer.msg(res.msg);
  566. }
  567. }
  568. });
  569. });
  570. $(".sumbit_student").click(function(event) {
  571. if($(this).attr('disabled')=='disabled'){
  572. return false;
  573. }
  574. if(!$("input[name=answer_student]").val())
  575. {
  576. layer.msg('答案不能为空');return;
  577. }
  578. var data={
  579. exam_id:$("input[name=exam_id_student]").val(),
  580. topic_id:$("input[name=topic_id_student]").val(),
  581. answer:$("input[name=answer_student]").val(),
  582. old_answer:$("input[name=old_answer_student]").val(),
  583. topic_answer:$("input[name=topic_answer]").val(),
  584. };
  585. $(this).attr('disabled',true);
  586. var alertIndex=layer.msg('正在更新,请稍候。。。。。。',{time:0});
  587. $.post("<?php echo Yii::app()->createUrl('paper/editstudentanswer')?>",data,function(falgs){
  588. var m = falgs;
  589. layer.close(alertIndex);
  590. if(m==-2)
  591. {
  592. layer.msg('提交失败');return;
  593. }else if(m==-3)
  594. {
  595. layer.msg('还未上传成绩');return;
  596. }else if(m==-4){
  597. layer.msg('修改失败');return;
  598. }else if(m==-1){
  599. layer.msg('答案不正确');return;
  600. }else if(m==-5){
  601. layer.msg('未获取到原答案');return;
  602. }else if(m==-6){
  603. layer.msg('原答案和新答案没有变化');return;
  604. }else if(m==-7){
  605. layer.msg('没有需要更新的数据');return;
  606. }else{
  607. //location.reload();
  608. layer.msg('修改成功',{icon:1,time:2000 },function(){
  609. $(".modal_student").fadeOut();
  610. location.reload();
  611. });
  612. }
  613. });
  614. });
  615. //更新科目
  616. $(".sumbit_subject").click(function(event) {
  617. // $(this).closest(".sumbit_student").fadeOut();
  618. if($(this).attr('disabled')=='disabled'){
  619. return false;
  620. }
  621. console.log($(this).attr('disabled'));
  622. if($("#subject_id").val()==0)
  623. {
  624. layer.msg('请选择新科目');return;
  625. }
  626. if($("#subject_id").val()==$("input[name=old_subject_id]").val()){
  627. layer.msg('科目没有变化 ');return;
  628. }
  629. var data={
  630. exam_id:$("input[name=exam_id_subject]").val(),
  631. topic_id:$("input[name=topic_id_subject]").val(),
  632. subject:$("#subject_id").val(),
  633. old_subject:$("input[name=old_subject_id]").val(),
  634. paper_id:$("input[name=paper_id_subject]").val(),
  635. };
  636. $(this).attr('disabled',true);
  637. var alertIndex=layer.msg('正在更新,请稍候。。。。。。',{time:0});
  638. $.post("<?php echo Yii::app()->createUrl('paper/editTopicSubject')?>",data,function(falgs){
  639. var m = falgs;
  640. layer.close(alertIndex);
  641. if(m==-2)
  642. {
  643. layer.msg('提交失败');return;
  644. }else if(m==-3)
  645. {
  646. layer.msg('还未上传成绩');return;
  647. }else if(m==-4){
  648. layer.msg('修改失败');return;
  649. }else if(m==-1){
  650. layer.msg('答案不正确');return;
  651. }else{
  652. //location.reload();
  653. layer.msg('修改成功');
  654. $(".modal_subject").fadeOut();
  655. location.reload();
  656. }
  657. });
  658. });
  659. $(".change-score").click(function(){
  660. if($(this).attr('type')==5 || $(this).attr('type')==7 || $(this).attr('type')==17){
  661. msg='1、线上阅卷:<br>' +
  662. '(1)未开始阅卷可修改分值。<br>' +
  663. '(2)已开始阅卷,已阅学生成绩不会自动更新。若将分值改大,需重新按更新后分值再次批改,否则会导致修改分值后批阅的学生分值比修改前已阅学生分值大;若将分值改小,需老师对已阅学生重新打分,否则会导致无法完成阅卷。\n' +
  664. '<br>' +
  665. '2、线下阅卷:\n' +
  666. '<br>' +
  667. '(1)答题卡未保存可修改分值。\n' +
  668. '<br>' +
  669. '(2)答题卡已保存,修改分值对学生打分不生效。';
  670. indexmsg=layer.confirm(msg, {
  671. title:"*修改需知!!!",
  672. btn: ['我已知晓', '取消'] //按钮
  673. }, function () {
  674. layer.close(indexmsg)
  675. $(".modal").fadeIn();
  676. })
  677. }else{
  678. $(".modal").fadeIn();
  679. }
  680. $('.question_scores').html('');
  681. $("input[name=score]").attr('disabled',false);
  682. order=$(this).parent().prev().find('.order').attr('order_id');
  683. $("#topic_order").html("题号:"+order);
  684. $("input[name=topic_id]").val($(this).attr('topic'));
  685. $("input[name=type]").val($(this).attr('type'));
  686. $("input[name=score]").val('');
  687. $question_count=parseInt($(this).attr('question_count'));
  688. $question_score=$(this).attr('question_score');
  689. $score_type=$(this).attr('score_type');
  690. if($question_count>0){
  691. //小问
  692. var wenSign=['(1)','(2)','(3)','(4)','(5)','(6)','(7)','(8)','(9)','(10)'];
  693. var kongSign=['①','②','③','④','⑤','⑥','⑦','⑧','⑨','⑩'];
  694. var html='';
  695. $scores=$question_score.split(',');
  696. $scoreSum=0
  697. for(var i=0;i<$question_count;i++){
  698. $scoreSum+=parseInt($scores[i]);
  699. if($score_type==2){
  700. html+='<p style="margin-top:8px;">'+order+kongSign[i]+':<input type="text" name="question_score[]" class="question_score" value="'+$scores[i]+'">分</p>';
  701. }else{
  702. html+='<p style="margin-top:8px;">'+order+wenSign[i]+':<input type="text" name="question_score[]" class="question_score" value="'+$scores[i]+'">分</p>';
  703. }
  704. }
  705. $('.question_scores').html(html);
  706. $("input[name=score]").val($scoreSum);
  707. $("input[name=score]").attr('disabled',true);
  708. }
  709. if($(this).attr('type')==1 || $(this).attr('type')==11 || $(this).attr('type')==2){
  710. $('.red-tig').hide();
  711. }else{
  712. $('.red-tig').show();
  713. }
  714. });
  715. $(".change-answer").click(function(){
  716. $(".modal1").fadeIn();
  717. $("#topic_order1").html("题号:"+$(this).parent().prev().find('.order').attr('order_id'));
  718. $("input[name=topic_id]").val($(this).attr('topic'));
  719. $("input[name=type]").val($(this).attr('type'));
  720. });
  721. $(".change_multi_answer").click(function () {
  722. var step=$(this).attr('step');
  723. if(step==1){
  724. $('.total_score').hide();
  725. $('.half_score').hide();
  726. $('.model-score-m').hide();
  727. $('.tig-txt').hide();
  728. }else if(step==2){
  729. $('.model-rule').hide();
  730. $('.total_score').hide();
  731. $('.half_score').hide();
  732. $('.model-score-m').show();
  733. }else if(step==3){
  734. $('.model-rule').hide();
  735. $('.total_score').show();
  736. $('.half_score').show();
  737. $('.batch').hide();
  738. $('.tig-txt').hide();
  739. }
  740. $('.title-txt').html("题号:"+$(this).parent().prev().find('.order').attr('order_id'));
  741. $(".modal1_multi").fadeIn();
  742. $("#topic_order_m").html("题号:"+$(this).parent().prev().find('.order').attr('order_id'));
  743. $("input[name=topic_id_m]").val($(this).attr('topic'));
  744. $("input[name=type_m]").val($(this).attr('type'));
  745. $("input[name=step]").val(step);
  746. //判断是否修改过规则
  747. var ruleAnswer=$(this).closest('.topic').find('.rule_answer').val(),
  748. ruleType=$(this).closest('.topic').find('.rule_type').val(),
  749. ruleScoreHalf=$(this).closest('.topic').find('.rule_score_half').val();
  750. var rightAnswer=$(this).closest('.topic').find('.right-answer').val();
  751. if(ruleType!=0 ){
  752. if(ruleAnswer!=''){
  753. $("input[name=answer_m]").val(ruleAnswer);
  754. // $("input[name=answer_student]").val(ruleAnswer);
  755. }else{
  756. $("input[name=answer_m]").val(rightAnswer);
  757. // $("input[name=answer_student]").val(rightAnswer);
  758. }
  759. $("input[name=score_half_m]").val(ruleScoreHalf);
  760. var index=parseInt(ruleType)-1;
  761. $('input[name=rule]').eq(index).prop("checked",'checked');
  762. rightAnswer=ruleAnswer;
  763. }else{
  764. $('input[name=score_half_m]').val(0);
  765. $("input[name=answer_m]").val(rightAnswer);
  766. $("input[name=answer_student]").val(rightAnswer);
  767. }
  768. $("input[name=score_m]").val($(this).attr('score'));
  769. });
  770. $(".upload-answer").click(function(){
  771. $(".modal2").fadeIn();
  772. $("#topic_order2").html("题号:"+parseInt($(this).parent().prev().find('.order').attr('order_id')));
  773. $("input[name=topic_id]").val($(this).attr('topic'));
  774. $("input[name=type]").val($(this).attr('type'));
  775. });
  776. //修改学生答案
  777. $(".change-student-answer").click(function(){
  778. $(".modal_student").fadeIn();
  779. var rightAnswer=$(this).closest('.topic').find('.right-answer').val();
  780. var updateAnswer=$(this).closest('.topic').find('.update_answer').val();
  781. if(updateAnswer!=undefined && updateAnswer!=""){
  782. rightAnswer=updateAnswer;
  783. }
  784. $("#topic_order_student").html("题号:"+parseInt($(this).parent().prev().find('.order').attr('order_id')));
  785. $("input[name=topic_id_student]").val($(this).attr('topic'));
  786. $("input[name=type]").val($(this).attr('type'));
  787. $("input[name=topic_answer]").val(rightAnswer);
  788. });
  789. //批量更新
  790. $(".change_multi_answer1").click(function () {
  791. $(".modal1_multi").fadeIn();
  792. $("#topic_order_m").html('');
  793. $('.total_score').hide();
  794. $('.half_score').hide();
  795. $('.title-txt').html('批量更改判分规则');
  796. $('.tig-txt').hide();
  797. //读取答案
  798. var topicAnswer=[];
  799. var topicId=[];
  800. var scoreHalf=[];
  801. var obj=$(this).closest('.choose-topic').find('.topic');
  802. if(obj.length>0){
  803. for(var i=0;i<obj.length;i++){
  804. if(obj.eq(i).find('.rule_answer').val()!='' && obj.eq(i).find('.rule_answer').val()!=undefined){
  805. topicAnswer.push(obj.eq(i).find('.rule_answer').val());
  806. }else{
  807. topicAnswer.push(obj.eq(i).find('.right-answer').val());
  808. }
  809. if(obj.eq(i).find('.rule_score_half').val()!='' && obj.eq(i).find('.rule_score_half').val()!=undefined){
  810. scoreHalf.push(obj.eq(i).find('.rule_score_half').val());
  811. }else{
  812. scoreHalf.push(0);
  813. }
  814. topicId.push(obj.eq(i).attr('id'));
  815. }
  816. }
  817. $('.batch').hide();
  818. $('input[name=score_half_m]').val(0);
  819. $('input[name=score_m]').val(0);
  820. $("input[name=type_m]").val($(this).attr('type'));
  821. $("input[name=topic_id_m]").val(topicId.join('///'));
  822. $("input[name=answer_m]").val(topicAnswer.join('///'));
  823. $("input[name=score_half_h]").val(scoreHalf.join('///'));
  824. $('input[name=is_batch]').val(1);
  825. $('input[name=step]').val(0);
  826. });
  827. //修改文理综试题科目
  828. $(".change-topic-subject").click(function(){
  829. $(".modal_subject").fadeIn();
  830. var old_subject=$(this).attr('subject-name');
  831. var old_subject_id=$(this).attr('subject');
  832. $('.oldSubjectName').html('原科目:'+old_subject);
  833. $("input[name=topic_id_subject]").val($(this).attr('topic'));
  834. $("input[name=old_subject_id]").val(old_subject_id);
  835. });
  836. $(".model-score input").keyup(function(){
  837. $(this).val($(this).val().replace(/[^0-9|\.]/g,""));
  838. });
  839. $(".model-score1 input").keyup(function(){
  840. $(this).val($(this).val().replace(/[^A-Z]|\.]/g,""));
  841. });
  842. $(".model-score2 input").keyup(function(){
  843. $(this).val($(this).val().replace(/[^A-Z]|\.]/g,""));
  844. });
  845. $("input[name=answer_m]").keyup(function(){
  846. $(this).val($(this).val().replace(/[^A-Z,]|\.]/g,""));
  847. });
  848. $("input[name=answer_student]").keyup(function(){
  849. $(this).val($(this).val().replace(/[^A-Z,]|\.]/g,""));
  850. });
  851. $("input[name=score_half_m]").keyup(function(){
  852. $(this).val($(this).val().replace(/[^\d+|\.]/g,""));
  853. });
  854. $("input[name=old_answer_student]").keyup(function(){
  855. $(this).val($(this).val().replace(/[^A-Z,]|\.]/g,""));
  856. });
  857. function hideMulti(obj) {
  858. obj.closest(".modal1_multi").hide();
  859. $('#update_msg').html('');
  860. obj.closest(".modal1_multi").find('input[name=rule]').eq(1).prop('checked',true);
  861. $('input[name=answer_m]').val('');
  862. $('input[name=score_m]').val(5);
  863. $('input[name=score_half_m]').val(3);
  864. $('input[name=is_batch]').val(0);
  865. $('input[name=score_half_h]').val('');
  866. $('.total_score').show();
  867. $('.half_score').show();
  868. $('.model-rule').show();
  869. $('.model-score-m').show();
  870. $('.batch').show();
  871. $('.tig-txt').show();
  872. }
  873. })
  874. </script>
  875. </head>
  876. <body>
  877. <a href="<?php echo Yii::app()->createUrl('paper/recover',array('exam_id'=>$exam_id))?>" class="<?php if( isset(Yii::app()->session['testFlag'])&&(Yii::app()->session['testFlag']==1)) {
  878. }else{ echo 'dn';}?>"><h3 style="color:#ff7800">恢复考试状态</h3></a>
  879. <?php if($type && isset($type[1]) && !empty($type[1])){?>
  880. <div class="choose-topic">
  881. <h3>选择题</h3>
  882. <div class="batch_topic">
  883. <div class="topic-content clearfix">
  884. <div class="words fl"></div>
  885. <?php if(!isset($send_points)){?>
  886. <div class="controls fr clearfix"><a href="javascript:;" score="0" topic="0" type="1" class="fr up_score">批量更改分值</a>
  887. <a href="javascript:;" score="0" topic="0" type="1" class="fr update_answer_batch">批量更改答案</a></div>
  888. <?php } ?>
  889. </div>
  890. </div>
  891. <!-- 选择题 答案一排 -->
  892. <?php foreach($type[1] as $k=>$v){
  893. $k=$k+1;
  894. ?>
  895. <div class="topic">
  896. <div class="topic-content clearfix">
  897. <div class="words fl">
  898. <span class="order" order_id="<?php if(isset($alias[$v['order']])){ echo $alias[$v['order']] ;}else{echo $v['order'];}?>"><?php if(isset($alias[$v['order']])){ echo $alias[$v['order']] ;}else{echo $v['order'];}?>.</span><span class="score">(<input type="text" value="<?php echo isset($score[$v['topic_id']])? $score[$v['topic_id']]:0 ?>" disabled />分)</span>[ID:<?php echo $v['topic_id'];?>]<?php echo isset($topic[$v['topic_id']])? $topic[$v['topic_id']]['title']:'' ?>
  899. </div>
  900. <div class="controls fr clearfix ">
  901. <?php if(!$is_third) { ?>
  902. <?php if (isset(Yii::app()->session['testFlag']) && (Yii::app()->session['testFlag'] == 1)) { ?>
  903. <a href="javascript:;" class="fr up" paper_id="<?php echo $paper_id ?>"
  904. topic="<?php echo $v['topic_id'] ?>" type="1">上移</a>
  905. <a href="javascript:;" class="fr down" paper_id="<?php echo $paper_id ?>"
  906. topic="<?php echo $v['topic_id'] ?>" type="1">下移</a>
  907. <?php }
  908. }?>
  909. <?php if(!isset($send_points[$v['order']])){?>
  910. <a href="javascript:;" class="fr change-answer" paper_id="<?php echo $paper_id ?>" topic="<?php echo $v['topic_id']?>" type="1" >更改试题答案</a>
  911. <?php }?>
  912. <?php if($is_third){?>
  913. <?php if(in_array($subject,array(18,19))):?>
  914. <a href="javascript:;" class="fr change-topic-subject" subject-name="<?php if(isset($topic_subject_data[$v['order']]) && isset($subjects[$topic_subject_data[$v['order']]])){echo $subjects[$topic_subject_data[$v['order']]];}?>" subject="<?php if(isset($topic_subject_data[$v['order']])){echo $topic_subject_data[$v['order']];}?>" paper_id="<?php echo $paper_id ?>" topic="<?php echo $v['topic_id']?>" type="1" >更改试题科目</a>
  915. <?php endif;?>
  916. <!--<a href="javascript:;" class="fr upload-answer" paper_id="<?php echo $paper_id ?>" topic="<?php echo $v['topic_id']?>" type="1" >修改校本题库的题</a>-->
  917. <?php }
  918. ?>
  919. <?php if(!isset($send_points[$v['order']])){?>
  920. <a href="javascript:;" class="fr change-score" paper_id="<?php echo $paper_id ?>"
  921. topic="<?php echo $v['topic_id'] ?>" type="1">更改分值</a>
  922. <?php }?>
  923. <?php
  924. if(isset(Yii::app()->session['testFlag'])&&(Yii::app()->session['testFlag']==1)){
  925. ?>
  926. <?php
  927. $sendPointArr=array();
  928. $sendPointArr[1]='';
  929. $sendPointArr[2]='';
  930. if(isset($send_points[$v['order']])){
  931. if($send_points[$v['order']]['actionType']==1){
  932. $sendPointArr[1]='fr c-red';
  933. $sendPointArr[2]='fr ';
  934. }elseif($send_points[$v['order']]['actionType']==2){
  935. $sendPointArr[2]='fr c-red';
  936. $sendPointArr[1]='fr ';
  937. }
  938. }else{
  939. $sendPointArr[1]='fr sendPoints';
  940. $sendPointArr[2]='fr sendPoints';
  941. }
  942. $optionCount=4;
  943. if(isset($topic[$v['topic_id']]) && !empty($topic[$v['topic_id']]) && isset($topic[$v['topic_id']]['items'][0]['options'])){
  944. $optionCount=count($topic[$v['topic_id']]['items'][0]['options']);
  945. }
  946. ?>
  947. <a href="javascript:;" option_count="<?php echo $optionCount ?>" class="<?php echo $sendPointArr[1]?>" action_type="1" paper_id="<?php echo $paper_id ?>" topic="<?php echo $v['topic_id']?>" type="1" >送分题</a>
  948. <a href="javascript:;" option_count="<?php echo $optionCount ?>" class="<?php echo $sendPointArr[2]?>" action_type="2" paper_id="<?php echo $paper_id ?>" topic="<?php echo $v['topic_id']?>" type="1" >0分题</a>
  949. <?php }?>
  950. </div>
  951. </div>
  952. <div class="topic-detail">
  953. <ul class="options clearfix">
  954. <?php
  955. $arr = array(0=>'A',1=>'B',2=>'C',3=>'D',4=>'E',5=>'F',6=>'G');
  956. $right = '';
  957. if(isset($topic[$v['topic_id']]) && !empty($topic[$v['topic_id']]) && isset($topic[$v['topic_id']]['items'][0]['options']))
  958. {
  959. foreach($topic[$v['topic_id']]['items'][0]['options'] as $ok=>$opt){
  960. if($opt['option_correct']==1)
  961. {
  962. $right =numToLetter($ok+1);
  963. }
  964. ?>
  965. <li class="listType_1 ">
  966. <?php echo $opt['option_content']?>
  967. </li>
  968. <?php } }?>
  969. </ul>
  970. <div class="topic-answer clearfix">
  971. <div class="fl answer-tit">
  972. 试题答案:<input type="text" value="<?php echo $right ?>" class="right-answer" disabled="">
  973. <?php
  974. if(isset($update_answer[$v['order']])){
  975. echo '更新答案:<span style="color:red">'.$update_answer[$v['order']]['update_answer'].'<input type="hidden" class="update_answer" name="update_answer" value="'.$update_answer[$v['order']]['update_answer'].'"></span>';
  976. if(isset($sheet_answer[$v['order']])){
  977. echo '原始答案:<span style="color:red">'.$sheet_answer[$v['order']].'</span>';
  978. }
  979. }
  980. ?>
  981. </div>
  982. <!-- <div class="fr answer-btn clearfix">
  983. <a href="javascript:;" class="fr">修改答案</a>
  984. </div> -->
  985. </div>
  986. <div class="topic-explain">
  987. 试题解析:
  988. <?php echo isset($topic[$v['topic_id']]['parse_content']) ? $topic[$v['topic_id']]['parse_content'] :''?>
  989. </div>
  990. </div>
  991. </div>
  992. <?php }?>
  993. </div>
  994. <?php }?>
  995. <?php if($type && ((isset($type[2]) && !empty($type[2])) )){?>
  996. <div class="choose-topic" >
  997. <!--<a href="<?php /*echo Yii::app()->createUrl('paper/recover',array('exam_id'=>$exam_id))*/?>"><h3 style="color:#ff7800">恢复考试状态</h3></a>-->
  998. <h3>多项选择题</h3>
  999. <div class="batch_topic">
  1000. <div class="topic-content clearfix">
  1001. <div class="words fl"></div>
  1002. <div class="controls fr clearfix">
  1003. <a href="javascript:;" score="0" topic="0" type="2" class="fr change_multi_answer1">批量更改判分规则</a>
  1004. <a href="javascript:;" score="0" topic="0" type="2" class="fr update_score_batch">批量更改分值</a>
  1005. <a href="javascript:;" score="0" topic="0" type="2" class="fr update_answer_batch">批量更改答案</a>
  1006. </div>
  1007. </div>
  1008. </div>
  1009. <!-- 选择题 答案一排 -->
  1010. <?php foreach($type[2] as $k=>$v){
  1011. $k=$k+1;
  1012. ?>
  1013. <div class="topic" id="<?php echo $v['topic_id']?>">
  1014. <div class="topic-content clearfix">
  1015. <div class="words fl">
  1016. <span class="order" order_id="<?php if(isset($alias[$v['order']])){ echo $alias[$v['order']] ;}else{echo $v['order'];}?>"><?php if(isset($alias[$v['order']])){ echo $alias[$v['order']] ;}else{echo $v['order'];}?>.</span><span class="score">(<input type="text" value="<?php echo isset($score[$v['topic_id']])? $score[$v['topic_id']]:0 ?>" disabled />分)</span>[ID:<?php echo $v['topic_id'];?>]<?php echo isset($topic[$v['topic_id']])? $topic[$v['topic_id']]['title']:'' ?>
  1017. </div>
  1018. <div class="controls fr clearfix ">
  1019. <a href="javascript:;" class="fr change_multi_answer" score="<?php echo isset($score[$v['topic_id']])? $score[$v['topic_id']]:0 ?>" exam_id="<?php echo $exam_id?>" topic="<?php echo $v['topic_id']?>" type="2" step="1" >更改判分规则</a>
  1020. <a href="javascript:;" class="fr change_multi_answer" score="<?php echo isset($score[$v['topic_id']])? $score[$v['topic_id']]:0 ?>" exam_id="<?php echo $exam_id?>" topic="<?php echo $v['topic_id']?>" type="2" step="2" >更改试题答案</a>
  1021. <a href="javascript:;" class="fr change_multi_answer" score="<?php echo isset($score[$v['topic_id']])? $score[$v['topic_id']]:0 ?>" exam_id="<?php echo $exam_id?>" topic="<?php echo $v['topic_id']?>" type="2" step="3" >更改分值</a>
  1022. <!--<a href="javascript:;" class="fr change_multi_answer" score="<?php echo isset($score[$v['topic_id']])? $score[$v['topic_id']]:0 ?>" exam_id="<?php echo $exam_id?>" topic="<?php echo $v['topic_id']?>" type="11" >更改报告</a>-->
  1023. <?php if(in_array($subject,array(18,19))):?>
  1024. <a href="javascript:;" class="fr change-topic-subject" subject-name="<?php if(isset($topic_subject_data[$v['order']]) && isset($subjects[$topic_subject_data[$v['order']]])){echo $subjects[$topic_subject_data[$v['order']]];}?>" subject="<?php if(isset($topic_subject_data[$v['order']])){echo $topic_subject_data[$v['order']];}?>" paper_id="<?php echo $paper_id ?>" topic="<?php echo $v['topic_id']?>" type="1" >更改试题科目</a>
  1025. <?php endif;?>
  1026. </div>
  1027. </div>
  1028. <div class="topic-detail">
  1029. <ul class="options clearfix">
  1030. <?php
  1031. $ruleAnswer='';
  1032. $ruleType=2; //默认规则
  1033. $ruleScoreHalf=0;
  1034. if(isset($new_rules[$v['order']])){
  1035. $ruleAnswer=$new_rules[$v['order']]['rule_answer'];
  1036. if($new_rules[$v['order']]['rule_type']){
  1037. $ruleType=$new_rules[$v['order']]['rule_type'];
  1038. }
  1039. $ruleScoreHalf=$new_rules[$v['order']]['rule_score_half'];
  1040. }
  1041. echo '<input type="hidden" name="rule_answer" class="rule_answer" value="'.$ruleAnswer.'">';
  1042. echo '<input type="hidden" name="rule_type" class="rule_type" value="'.$ruleType.'">';
  1043. echo '<input type="hidden" name="rule_score_half" class="rule_score_half" value="'.$ruleScoreHalf.'">';
  1044. $arr = array(0=>'A',1=>'B',2=>'C',3=>'D',4=>'E',5=>'F',6=>'G');
  1045. $right = '';
  1046. if($subject==8 && isset($topic[$v['topic_id']]['answer'])){
  1047. $right=$topic[$v['topic_id']]['answer'];
  1048. }else{
  1049. if(isset($topic[$v['topic_id']]) && !empty($topic[$v['topic_id']]) && isset($topic[$v['topic_id']]['items'][0]['options']))
  1050. {
  1051. foreach($topic[$v['topic_id']]['items'][0]['options'] as $ok=>$opt){
  1052. if($opt['option_correct']==1)
  1053. {
  1054. if(!$right){
  1055. $right = numToLetter($ok+1);
  1056. }else{
  1057. $right = $right.','.numToLetter($ok+1);
  1058. }
  1059. }
  1060. ?>
  1061. <li class="listType_1">
  1062. <?php echo $opt['option_content']?>
  1063. </li>
  1064. <?php }
  1065. }
  1066. }
  1067. ?>
  1068. </ul>
  1069. <div class="topic-answer clearfix">
  1070. <div class="fl answer-tit">
  1071. 试题答案:<input type="text" value="<?php echo $right ?>" class="right-answer" disabled="">
  1072. <?php
  1073. if(isset($ruleAnswer) && $ruleAnswer){
  1074. echo '更改答案:<span style="color:red">'.$ruleAnswer.'</span>';
  1075. if(isset($sheet_answer[$v['order']])){
  1076. echo '&nbsp;&nbsp;原始答案:<span style="color:red">'.$sheet_answer[$v['order']].'</span>';
  1077. }
  1078. }
  1079. ?>
  1080. </div>
  1081. <!-- <div class="fr answer-btn clearfix">
  1082. <a href="javascript:;" class="fr">修改答案</a>
  1083. </div> -->
  1084. </div>
  1085. <div class="topic-explain">
  1086. 试题解析:
  1087. <?php echo isset($topic[$v['topic_id']]['parse_content']) ? $topic[$v['topic_id']]['parse_content'] :''?>
  1088. </div>
  1089. </div>
  1090. </div>
  1091. <?php }?>
  1092. </div>
  1093. <?php }?>
  1094. <?php if($type && ((isset($type[11]) && !empty($type[11])) )){?>
  1095. <div class="choose-topic" >
  1096. <!--<a href="<?php /*echo Yii::app()->createUrl('paper/recover',array('exam_id'=>$exam_id))*/?>"><h3 style="color:#ff7800">恢复考试状态</h3></a>-->
  1097. <h3>多项选择题</h3>
  1098. <div class="batch_topic">
  1099. <div class="topic-content clearfix">
  1100. <div class="words fl"></div>
  1101. <div class="controls fr clearfix">
  1102. <a href="javascript:;" score="0" topic="0" type="11" class="fr change_multi_answer1">批量更改判分规则</a>
  1103. <a href="javascript:;" score="0" topic="0" type="11" class="fr update_score_batch">批量更改分值</a>
  1104. <a href="javascript:;" score="0" topic="0" type="11" class="fr update_answer_batch">批量更改答案</a>
  1105. </div>
  1106. </div>
  1107. </div>
  1108. <!-- 选择题 答案一排 -->
  1109. <?php foreach($type[11] as $k=>$v){
  1110. $k=$k+1;
  1111. ?>
  1112. <div class="topic" id="<?php echo $v['topic_id']?>">
  1113. <div class="topic-content clearfix">
  1114. <div class="words fl">
  1115. <span class="order" order_id="<?php if(isset($alias[$v['order']])){ echo $alias[$v['order']] ;}else{echo $v['order'];}?>"><?php if(isset($alias[$v['order']])){ echo $alias[$v['order']] ;}else{echo $v['order'];}?>.</span><span class="score">(<input type="text" value="<?php echo isset($score[$v['topic_id']])? $score[$v['topic_id']]:0 ?>" disabled />分)</span>[ID:<?php echo $v['topic_id'];?>]<?php echo isset($topic[$v['topic_id']])? $topic[$v['topic_id']]['title']:'' ?>
  1116. </div>
  1117. <div class="controls fr clearfix ">
  1118. <a href="javascript:;" class="fr change_multi_answer" score="<?php echo isset($score[$v['topic_id']])? $score[$v['topic_id']]:0 ?>" exam_id="<?php echo $exam_id?>" topic="<?php echo $v['topic_id']?>" type="11" step="1" >更改判分规则</a>
  1119. <a href="javascript:;" class="fr change_multi_answer" score="<?php echo isset($score[$v['topic_id']])? $score[$v['topic_id']]:0 ?>" exam_id="<?php echo $exam_id?>" topic="<?php echo $v['topic_id']?>" type="11" step="2" >更改试题答案</a>
  1120. <a href="javascript:;" class="fr change_multi_answer" score="<?php echo isset($score[$v['topic_id']])? $score[$v['topic_id']]:0 ?>" exam_id="<?php echo $exam_id?>" topic="<?php echo $v['topic_id']?>" type="11" step="3" >更改分值</a>
  1121. <!--a href="javascript:;" class="fr change_multi_answer" score="<?php echo isset($score[$v['topic_id']])? $score[$v['topic_id']]:0 ?>" exam_id="<?php echo $exam_id?>" topic="<?php echo $v['topic_id']?>" type="11" >更改报告</a>-->
  1122. <?php if(in_array($subject,array(18,19))):?>
  1123. <a href="javascript:;" class="fr change-topic-subject" subject-name="<?php if(isset($topic_subject_data[$v['order']]) && isset($subjects[$topic_subject_data[$v['order']]])){echo $subjects[$topic_subject_data[$v['order']]];}?>" subject="<?php if(isset($topic_subject_data[$v['order']])){echo $topic_subject_data[$v['order']];}?>" paper_id="<?php echo $paper_id ?>" topic="<?php echo $v['topic_id']?>" type="1" >更改试题科目</a>
  1124. <?php endif;?>
  1125. </div>
  1126. </div>
  1127. <div class="topic-detail">
  1128. <ul class="options clearfix">
  1129. <?php
  1130. $ruleAnswer='';
  1131. $ruleType=2; //默认规则
  1132. $ruleScoreHalf=0;
  1133. if(isset($new_rules[$v['order']])){
  1134. $ruleAnswer=$new_rules[$v['order']]['rule_answer'];
  1135. if($new_rules[$v['order']]['rule_type']){
  1136. $ruleType=$new_rules[$v['order']]['rule_type'];
  1137. }
  1138. $ruleScoreHalf=$new_rules[$v['order']]['rule_score_half'];
  1139. }
  1140. echo '<input type="hidden" name="rule_answer" class="rule_answer" value="'.$ruleAnswer.'">';
  1141. echo '<input type="hidden" name="rule_type" class="rule_type" value="'.$ruleType.'">';
  1142. echo '<input type="hidden" name="rule_score_half" class="rule_score_half" value="'.$ruleScoreHalf.'">';
  1143. $arr = array(0=>'A',1=>'B',2=>'C',3=>'D',4=>'E',5=>'F',6=>'G');
  1144. $right = '';
  1145. if($subject==8 && isset($topic[$v['topic_id']]['answer'])){
  1146. $right=$topic[$v['topic_id']]['answer'];
  1147. }else{
  1148. if(isset($topic[$v['topic_id']]) && !empty($topic[$v['topic_id']]) && isset($topic[$v['topic_id']]['items'][0]['options']))
  1149. {
  1150. foreach($topic[$v['topic_id']]['items'][0]['options'] as $ok=>$opt){
  1151. if($opt['option_correct']==1)
  1152. {
  1153. if(!$right){
  1154. $right = numToLetter($ok+1);
  1155. }else{
  1156. $right = $right.','.numToLetter($ok+1);
  1157. }
  1158. }
  1159. ?>
  1160. <li class="listType_1">
  1161. <?php echo $opt['option_content']?>
  1162. </li>
  1163. <?php } }
  1164. }
  1165. ?>
  1166. </ul>
  1167. <div class="topic-answer clearfix">
  1168. <div class="fl answer-tit">
  1169. 试题答案:<input type="text" value="<?php echo $right ?>" class="right-answer" disabled="">
  1170. <?php
  1171. if(isset($ruleAnswer) && $ruleAnswer){
  1172. echo '更改答案:<span style="color:red">'.$ruleAnswer.'</span>';
  1173. if(isset($sheet_answer[$v['order']])){
  1174. echo '&nbsp;&nbsp;原始答案:<span style="color:red">'.$sheet_answer[$v['order']].'</span>';
  1175. }
  1176. }
  1177. ?>
  1178. </div>
  1179. <!-- <div class="fr answer-btn clearfix">
  1180. <a href="javascript:;" class="fr">修改答案</a>
  1181. </div> -->
  1182. </div>
  1183. <div class="topic-explain">
  1184. 试题解析:
  1185. <?php echo isset($topic[$v['topic_id']]['parse_content']) ? $topic[$v['topic_id']]['parse_content'] :''?>
  1186. </div>
  1187. </div>
  1188. </div>
  1189. <?php }?>
  1190. </div>
  1191. <?php }?>
  1192. <?php if($type && isset($type[6]) && !empty($type[6])){?>
  1193. <div class="filling-topic">
  1194. <h3>填空题</h3>
  1195. <!-- 填空题 -->
  1196. <?php foreach($type[6] as $k=>$v){
  1197. $k=$k+1;
  1198. ?>
  1199. <div class="topic">
  1200. <div class="topic-content clearfix">
  1201. <div class="words fl">
  1202. <span class="order" order_id="<?php if(isset($alias[$v['order']])){ echo $alias[$v['order']] ;}else{echo $v['order'];}?>"><?php if(isset($alias[$v['order']])){ echo $alias[$v['order']] ;}else{echo $v['order'];}?>.</span><span class="score">(<input type="text" value="<?php echo isset($score[$v['topic_id']])? $score[$v['topic_id']]:0 ?>" disabled />分)</span>[ID:<?php echo $v['topic_id'];?>]<?php echo isset($topic[$v['topic_id']])? $topic[$v['topic_id']]['title']:'' ?>
  1203. </div>
  1204. <div class="controls fr clearfix ">
  1205. <?php if(!isset($is_third) || !$is_third){?>
  1206. <?php if( isset(Yii::app()->session['testFlag'])&&(Yii::app()->session['testFlag']==1)) { ?>
  1207. <a href="javascript:;" class="fr up" paper_id="<?php echo $paper_id ?>" topic="<?php echo $v['topic_id']?>" type="6">上移</a>
  1208. <a href="javascript:;" class="fr down" paper_id="<?php echo $paper_id ?>" topic="<?php echo $v['topic_id']?>" type="6">下移</a>
  1209. <?php }?>
  1210. <?php
  1211. }?>
  1212. <a href="javascript:;" class="fr change-score" paper_id="<?php echo $paper_id ?>" topic="<?php echo $v['topic_id']?>" type="6" >更改分值</a>
  1213. <?php if(in_array($subject,array(18,19))):?>
  1214. <a href="javascript:;" class="fr change-topic-subject" subject-name="<?php if(isset($topic_subject_data[$v['order']]) && isset($subjects[$topic_subject_data[$v['order']]])){echo $subjects[$topic_subject_data[$v['order']]];}?>" subject="<?php if(isset($topic_subject_data[$v['order']])){echo $topic_subject_data[$v['order']];}?>" paper_id="<?php echo $paper_id ?>" topic="<?php echo $v['topic_id']?>" type="1" >更改试题科目</a>
  1215. <?php endif;?>
  1216. </div>
  1217. </div>
  1218. <div class="topic-detail">
  1219. <div class="topic-answer clearfix">
  1220. <div class="fl answer-tit">
  1221. 试题答案:<?php if(isset($topic[$v['topic_id']]['items'][0]['options'])){
  1222. foreach($topic[$v['topic_id']]['items'][0]['options'] as $item =>$opt)
  1223. {
  1224. echo $opt['option_content'].';';
  1225. }
  1226. }?>
  1227. </div>
  1228. <!-- <div class="fr answer-btn clearfix">
  1229. <a href="javascript:;" class="fr">修改答案</a>
  1230. </div> -->
  1231. </div>
  1232. <div class="topic-explain">
  1233. 试题解析:
  1234. <?php echo isset($topic[$v['topic_id']]['parse_content']) ? $topic[$v['topic_id']]['parse_content'] :''?>
  1235. </div>
  1236. </div>
  1237. </div>
  1238. <?php }?>
  1239. </div>
  1240. <?php }?>
  1241. <?php if($type && isset($type[5]) && !empty($type[5])){?>
  1242. <div class="filling-topic">
  1243. <h3>填空题</h3>
  1244. <!-- 填空题 -->
  1245. <?php foreach($type[5] as $k=>$v){
  1246. $k=$k+1;
  1247. ?>
  1248. <div class="topic">
  1249. <div class="topic-content clearfix">
  1250. <div class="words fl">
  1251. <span class="order" order_id="<?php if(isset($alias[$v['order']])){ echo $alias[$v['order']] ;}else{echo $v['order'];}?>"><?php if(isset($alias[$v['order']])){ echo $alias[$v['order']] ;}else{echo $v['order'];}?>.</span><span class="score">(<input type="text" value="<?php echo isset($score[$v['topic_id']])? $score[$v['topic_id']]:0 ?>" disabled />分)</span>[ID:<?php echo $v['topic_id'];?>]<?php echo isset($topic[$v['topic_id']])? $topic[$v['topic_id']]['title']:'' ?>
  1252. </div>
  1253. <div class="controls fr clearfix ">
  1254. <?php if(!isset($is_third) || !$is_third){?>
  1255. <?php if( isset(Yii::app()->session['testFlag'])&&(Yii::app()->session['testFlag']==1)) { ?>
  1256. <a href="javascript:;" class="fr up" paper_id="<?php echo $paper_id ?>" topic="<?php echo $v['topic_id']?>" type="5">上移</a>
  1257. <a href="javascript:;" class="fr down" paper_id="<?php echo $paper_id ?>" topic="<?php echo $v['topic_id']?>" type="5">下移</a>
  1258. <?php }?>
  1259. <?php
  1260. }?>
  1261. <a href="javascript:;" class="fr change-score" score_type="<?php if(isset($score_type[$v['order']])){echo $score_type[$v['order']]; }else{ echo 0;} ?>" question_score="<?php if(isset($question_scores[$v['order']])){ echo $question_scores[$v['order']]; }else{echo 0;}?>" question_count="<?php if(isset($question_count[$v['order']])){ echo $question_count[$v['order']]; }else{echo 0;}?>" paper_id="<?php echo $paper_id ?>" topic="<?php echo $v['topic_id']?>" type="5" >更改分值</a>
  1262. <?php if(in_array($subject,array(18,19))):?>
  1263. <a href="javascript:;" class="fr change-topic-subject" subject-name="<?php if(isset($topic_subject_data[$v['order']]) && isset($subjects[$topic_subject_data[$v['order']]])){echo $subjects[$topic_subject_data[$v['order']]];}?>" subject="<?php if(isset($topic_subject_data[$v['order']])){echo $topic_subject_data[$v['order']];}?>" paper_id="<?php echo $paper_id ?>" topic="<?php echo $v['topic_id']?>" type="1" >更改试题科目</a>
  1264. <?php endif;?>
  1265. </div>
  1266. </div>
  1267. <div class="topic-detail">
  1268. <div class="topic-answer clearfix">
  1269. <div class="fl answer-tit">
  1270. 试题答案:<?php if(isset($topic[$v['topic_id']]['items'][0]['options'])){
  1271. foreach($topic[$v['topic_id']]['items'][0]['options'] as $item =>$opt)
  1272. {
  1273. echo $opt['option_content'].';';
  1274. }
  1275. }?>
  1276. </div>
  1277. <!-- <div class="fr answer-btn clearfix">
  1278. <a href="javascript:;" class="fr">修改答案</a>
  1279. </div> -->
  1280. </div>
  1281. <div class="topic-explain">
  1282. 试题解析:
  1283. <?php echo isset($topic[$v['topic_id']]['parse_content']) ? $topic[$v['topic_id']]['parse_content'] :''?>
  1284. </div>
  1285. </div>
  1286. </div>
  1287. <?php }?>
  1288. </div>
  1289. <?php }?>
  1290. <?php if($type && isset($type[7]) && !empty($type[7])){?>
  1291. <div class="answer-topic">
  1292. <h3>解答题</h3>
  1293. <?php foreach($type[7] as $k=>$v){
  1294. $k=$k+1;
  1295. ?>
  1296. <!-- 解答题 -->
  1297. <div class="topic">
  1298. <div class="topic-content clearfix">
  1299. <div class="words fl">
  1300. <span class="order" order_id="<?php if(isset($alias[$v['order']])){ echo $alias[$v['order']] ;}else{echo $v['order'];}?>"><?php if(isset($alias[$v['order']])){ echo $alias[$v['order']] ;}else{echo $v['order'];}?>.</span><span class="score">(<input type="text" value="<?php echo isset($score[$v['topic_id']])? $score[$v['topic_id']]:0 ?>" disabled />分)</span>[ID:<?php echo $v['topic_id'];?>]<?php echo isset($topic[$v['topic_id']])? $topic[$v['topic_id']]['title']:'' ?>
  1301. </div>
  1302. <div class="controls fr clearfix ">
  1303. <?php if(!isset($is_third) || !$is_third){?>
  1304. <?php if( isset(Yii::app()->session['testFlag'])&&(Yii::app()->session['testFlag']==1)) { ?>
  1305. <a href="javascript:;" class="fr up" paper_id="<?php echo $paper_id ?>" topic="<?php echo $v['topic_id']?>" type="7">上移</a>
  1306. <a href="javascript:;" class="fr down" paper_id="<?php echo $paper_id ?>" topic="<?php echo $v['topic_id']?>" type="7">下移</a>
  1307. <?php }?>
  1308. <?php
  1309. }?>
  1310. <a href="javascript:;" class="fr change-score" score_type="<?php if(isset($score_type[$v['order']])){echo $score_type[$v['order']]; }else{ echo 0;} ?>" question_score="<?php if(isset($question_scores[$v['order']])){ echo $question_scores[$v['order']]; }else{echo 0;}?>" question_count="<?php if(isset($question_count[$v['order']])){ echo $question_count[$v['order']]; }else{echo 0;}?>" paper_id="<?php echo $paper_id ?>" topic="<?php echo $v['topic_id']?>" type="7" >更改分值</a>
  1311. <?php if(in_array($subject,array(18,19))):?>
  1312. <a href="javascript:;" class="fr change-topic-subject" subject-name="<?php if(isset($topic_subject_data[$v['order']]) && isset($subjects[$topic_subject_data[$v['order']]])){echo $subjects[$topic_subject_data[$v['order']]];}?>" subject="<?php if(isset($topic_subject_data[$v['order']])){echo $topic_subject_data[$v['order']];}?>" paper_id="<?php echo $paper_id ?>" topic="<?php echo $v['topic_id']?>" type="1" >更改试题科目</a>
  1313. <?php endif;?>
  1314. </div>
  1315. </div>
  1316. <div class="topic-detail">
  1317. <div class="topic-answer clearfix">
  1318. <div class="fl answer-tit">
  1319. 试题答案:<?php if(isset($topic[$v['topic_id']]['items'][0]['options'])){
  1320. foreach($topic[$v['topic_id']]['items'][0]['options'] as $item =>$opt)
  1321. {
  1322. echo $opt['option_content'].';';
  1323. }
  1324. }?>
  1325. </div>
  1326. <!-- <div class="fr answer-btn clearfix">
  1327. <a href="javascript:;" class="fr">修改答案</a>
  1328. </div> -->
  1329. </div>
  1330. <div class="topic-explain">
  1331. 试题解析:
  1332. <?php echo isset($topic[$v['topic_id']]['parse_content']) ? $topic[$v['topic_id']]['parse_content'] :''?>
  1333. </div>
  1334. </div>
  1335. </div>
  1336. <?php }?>
  1337. </div>
  1338. <?php }?>
  1339. <?php
  1340. for($oi=8;$oi<28;$oi++){
  1341. if($oi==11)
  1342. {
  1343. continue;
  1344. }
  1345. if($type && isset($type[$oi]) && !empty($type[$oi])){?>
  1346. <div class="answer-topic">
  1347. <h3>选做题</h3>
  1348. <?php foreach($type[$oi] as $k=>$v){
  1349. $k=$k+1;
  1350. ?>
  1351. <!-- 解答题 -->
  1352. <div class="topic">
  1353. <div class="topic-content clearfix">
  1354. <div class="words fl">
  1355. <span class="order" order_id="<?php if(isset($alias[$v['order']])){ echo $alias[$v['order']] ;}else{echo $v['order'];}?>"><?php if(isset($alias[$v['order']])){ echo $alias[$v['order']] ;}else{echo $v['order'];}?>.</span><span class="score">(<input type="text" value="<?php echo isset($score[$v['topic_id']])? $score[$v['topic_id']]:0 ?>" disabled />分)</span>[ID:<?php echo $v['topic_id'];?>]<?php echo isset($topic[$v['topic_id']])? $topic[$v['topic_id']]['title']:'' ?>
  1356. </div>
  1357. <div class="controls fr clearfix ">
  1358. <?php if(!isset($is_third) || !$is_third){?>
  1359. <?php if( isset(Yii::app()->session['testFlag'])&&(Yii::app()->session['testFlag']==1)) { ?>
  1360. <a href="javascript:;" class="fr up" paper_id="<?php echo $paper_id ?>" topic="<?php echo $v['topic_id']?>" type="<?php echo $oi?>">上移</a>
  1361. <a href="javascript:;" class="fr down" paper_id="<?php echo $paper_id ?>" topic="<?php echo $v['topic_id']?>" type="<?php echo $oi?>">下移</a>
  1362. <?php }?>
  1363. <?php
  1364. }?>
  1365. <a href="javascript:;" class="fr change-score" paper_id="<?php echo $paper_id ?>" topic="<?php echo $v['topic_id']?>" type="<?php echo $oi?>" >更改分值</a>
  1366. <?php if(in_array($subject,array(18,19))):?>
  1367. <a href="javascript:;" class="fr change-topic-subject" subject-name="<?php if(isset($topic_subject_data[$v['order']]) && isset($subjects[$topic_subject_data[$v['order']]])){echo $subjects[$topic_subject_data[$v['order']]];}?>" subject="<?php if(isset($topic_subject_data[$v['order']])){echo $topic_subject_data[$v['order']];}?>" paper_id="<?php echo $paper_id ?>" topic="<?php echo $v['topic_id']?>" type="1" >更改试题科目</a>
  1368. <?php endif;?>
  1369. </div>
  1370. </div>
  1371. <div class="topic-detail">
  1372. <div class="topic-answer clearfix">
  1373. <div class="fl answer-tit">
  1374. 试题答案:<?php if(isset($topic[$v['topic_id']]['items'][0]['options'])){
  1375. foreach($topic[$v['topic_id']]['items'][0]['options'] as $item =>$opt)
  1376. {
  1377. echo $opt['option_content'].';';
  1378. }
  1379. }?>
  1380. </div>
  1381. <!-- <div class="fr answer-btn clearfix">
  1382. <a href="javascript:;" class="fr">修改答案</a>
  1383. </div> -->
  1384. </div>
  1385. <div class="topic-explain">
  1386. 试题解析:
  1387. <?php echo isset($topic[$v['topic_id']]['parse_content']) ? $topic[$v['topic_id']]['parse_content'] :''?>
  1388. </div>
  1389. </div>
  1390. </div>
  1391. <?php }?>
  1392. </div>
  1393. <?php }}?>
  1394. <?php include_once '_popup.php'?>
  1395. </body>
  1396. </html>
  1397. <script>
  1398. var paper_id='<?php echo $paper_id ?>';
  1399. $('.topic').hover(function(){
  1400. $(this).css('border',"1px solid #0155fe")
  1401. },function(){
  1402. $(this).css('border',"none")
  1403. })
  1404. $('.up_score').click(function(){
  1405. classModal.style.display = 'block';
  1406. });
  1407. $('.icon-close,.exam-close').click(function(){
  1408. $(this).closest('.confirmbox-mask').hide();
  1409. });
  1410. $('.class-modal-body')
  1411. .on('click','.avg',function(){
  1412. var total_score=$('input[name=total_score]').val();
  1413. var topic_count=$('.topic_score').length;
  1414. if(total_score==0 || total_score==''){
  1415. layer.msg('请填写题目总分!');
  1416. }else{
  1417. var avg_score=total_score/topic_count;
  1418. if(checkFloat(avg_score)==false){
  1419. $('.avg_result').html('无法平均分配');
  1420. $('.avg_result').addClass('red');
  1421. }else{
  1422. $('.avg_result').html('');
  1423. for(var i=1;i<=topic_count;i++){
  1424. $('.topic_score').val(avg_score);
  1425. }
  1426. }
  1427. }
  1428. })
  1429. .on('change','.total_score',function(){
  1430. $(this).val($(this).val().replace(/[^0-9|\.]/g,""));
  1431. if(checkFloat($(this).val())==false){
  1432. layer.msg('分数设置不正确!');
  1433. $(this).val(0);
  1434. }
  1435. if( $(this).val()!=''){
  1436. $(this).val(parseFloat($(this).val()));
  1437. }
  1438. $('.topic_score').val(0);
  1439. $('#topic_error').html('');
  1440. })
  1441. .on('change','.topic_score',function(){
  1442. $(this).val($(this).val().replace(/[^0-9|\.]/g,""));
  1443. if(checkFloat($(this).val())==false){
  1444. layer.msg('分数设置不正确!');
  1445. $(this).val(0);
  1446. }
  1447. if( $(this).val()!=''){
  1448. $(this).val(parseFloat($(this).val()));
  1449. }
  1450. var sum=0;
  1451. for(var i=0;i<$('.topic_score').length;i++){
  1452. if($('.topic_score').eq(i).val()!=''){
  1453. sum+=parseFloat($('.topic_score').eq(i).val());
  1454. }
  1455. }
  1456. $('.total_score').val(sum);
  1457. $('#topic_error').html('');
  1458. });
  1459. $('.save_score').click(function(){
  1460. var topicScore={};
  1461. for(var i=0;i<$('.topic_score').length;i++){
  1462. if($('.topic_score').eq(i).val()==0 || $('.topic_score').eq(i).val()==''){
  1463. layer.msg('请填写题目分数!');
  1464. return false;
  1465. }
  1466. if(parseInt($('.topic_score').eq(i).val())>49){
  1467. layer.msg('选择题分数上限为49分!');
  1468. return false;
  1469. }
  1470. var order=$('.topic_score').eq(i).attr('name');
  1471. var score=$('.topic_score').eq(i).val();
  1472. topicScore[order]=score;
  1473. }
  1474. $(this).attr('disabled',true);
  1475. //批量更改分数
  1476. $.ajax({
  1477. url:'<?php echo $this->createUrl('paper/updateScoreBatch')?>',
  1478. type:'POST',
  1479. dataType:'json',
  1480. data:{scores:topicScore,paper_id:paper_id},
  1481. success:function(res){
  1482. if(res.status==1){
  1483. layer.msg('修改成功',{icon:1,time:2000},function () {
  1484. window.location.reload();
  1485. });
  1486. }else{
  1487. if(res.msg!=undefined){
  1488. layer.msg(res.msg)
  1489. }else{
  1490. layer.msg('修改失败',{icon:1,time:2000},function () {
  1491. window.location.reload();
  1492. });
  1493. }
  1494. }
  1495. }
  1496. });
  1497. });
  1498. function checkFloat(num){
  1499. num=String(num);
  1500. arr=num.split(".");
  1501. //console.log(arr[1]);
  1502. if(arr[1]==undefined){
  1503. return true;
  1504. }else if(arr[1]==5){
  1505. return true;
  1506. }
  1507. return false;
  1508. }
  1509. function checkFloat1(num){
  1510. num=String(num);
  1511. arr=num.split(".");
  1512. if(arr.length<3){
  1513. return true;
  1514. }
  1515. return false;
  1516. }
  1517. </script>