_third.php 100 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513
  1. <script src="/js/jquery.ajaxfileupload.js"></script>
  2. <script src="/js/jquery.datetimepicker.js"></script>
  3. <link rel="stylesheet" href="/css/jquery.datetimepicker.css" />
  4. <script type="text/javascript">
  5. function in_array(search, array){
  6. for(var i in array){
  7. if(array[i]==search){
  8. return true;
  9. }
  10. }
  11. return false;
  12. }
  13. testFlag = "<?php echo $this->testFlag;?>";
  14. customTplsIds = new Array();
  15. var i = 0;
  16. <?php foreach(Yii::app()->params["custom_tpls_ids"] as $tplId){?>
  17. customTplsIds[i] = "<?php echo $tplId;?>";
  18. i++;
  19. <?php }?>
  20. filePaper = 1;
  21. fileAnswer = 1;
  22. jQuery(document).ready(function(){
  23. // 打印答案解析
  24. $(".answerAnalysis").click(function(){
  25. var element = this;
  26. layer.msg('您确定下载答案解析嘛?', {
  27. time: 0,
  28. btn: ['确定', '取消'],
  29. yes: function(index){
  30. layer.close(index);
  31. var wpCode = jQuery(element).attr("examId");
  32. if (!wpCode) {
  33. layer.msg('周周练id有误!');return false;
  34. }
  35. jQuery.post(
  36. '<?php echo $this->createUrl('print/createtempelate');?>',
  37. {"eid":wpCode},
  38. function(data){
  39. var obj = JSON.parse(data);
  40. if (obj.success == 1) {
  41. /*alert(obj.message);
  42. alert(obj);*/
  43. evaluationClient.printDAJX(JSON.stringify(obj.object));
  44. } else {
  45. layer.msg(obj.message);
  46. }
  47. }
  48. );
  49. }
  50. });
  51. });
  52. jQuery(".paperType").click(function(){
  53. if(testFlag != 1)
  54. return false;
  55. var examId = jQuery(this).attr("examId");
  56. var tpl_index = jQuery(this).attr("tpl_index");
  57. if(in_array(jQuery(this).attr("tpl_index"), customTplsIds)){
  58. if(in_array(jQuery(this).attr("tpl_index"), [10,1011,11])){
  59. var style = "width:200px;color:gray;";
  60. var state = "disabled";
  61. }else{
  62. var style = "width:200px;";
  63. var state = "enabled";
  64. }
  65. }
  66. else{
  67. var style = "width:200px;color:gray;";
  68. var state = "disabled";
  69. }
  70. html = ""+
  71. '<div style="padding:10px 30px">'+
  72. '<div style="margin:5px 0; float: left">选择纸张:</div>'+
  73. '<div style="float: left"><select id="paperSize" style="'+style+'" '+state+' >'+
  74. '<option value="A3" ';
  75. if(jQuery(this).attr("paper_size")=='A3'){ html=html+'selected';}
  76. html=html+'>A3</option>'+
  77. '<option value="A4" ';
  78. if(jQuery(this).attr("paper_size")=='A4'){ html=html+'selected';}
  79. html=html+'>A4</option>'+
  80. '<option value="8K" ';
  81. if(jQuery(this).attr("paper_size")=='8K'){ html=html+'selected';}
  82. html=html+'>8K</option>'+
  83. '<option value="16K" ';
  84. if(jQuery(this).attr("paper_size")=='16K'){ html=html+'selected';}
  85. html=html+'>16K</option>'+
  86. '</select></div>'+
  87. '<div style="padding-top:10px;clear: left"></div>'+
  88. '<div style="margin:5px 0; float: left">阅卷方式:</div>'+
  89. '<div style="float: left"><select id="mark_type" style="width:200px">'+
  90. '<option value="0" ';
  91. if(jQuery(this).attr("mark_type")=='0'){ html=html+'selected';}
  92. html=html+'>线下阅卷</option>'+
  93. '<option value="1" ';
  94. if(jQuery(this).attr("mark_type")=='1'){ html=html+'selected';}
  95. html=html+'>在线阅卷(题)</option> <option value="3" ';
  96. if(jQuery(this).attr("mark_type")=='3'){ html=html+'selected';}
  97. html=html+'>班级混合阅卷</option> <option value="4" ';
  98. if(jQuery(this).attr("mark_type")=='4'){ html=html+'selected';}
  99. html=html+'>班级单独阅卷</option> '+
  100. '</select></div>'+
  101. '<div class="row" style="margin:30px auto;"><button id="confirm" class="label-primary-s bth-s" style="padding:4px 12px;margin:20px 0 0 15px">确定</button>'+
  102. '<button id="cancel" class="label-primary-s bth-s" style="border:gray;background:gray;padding:4px 12px;margin:20px 0 0 25px">取消</button></div>'+
  103. '</div>'+
  104. '</div>'+
  105. "";
  106. layer.open({
  107. type: 1,
  108. area: ['350px', '220px'],
  109. title: "更改试卷",
  110. content: html,
  111. success: function(index, layerObj){
  112. jQuery("#cancel").on("click", function(){
  113. layer.closeAll();
  114. });
  115. jQuery("#confirm").on("click", function(){
  116. var paperSize = jQuery("#paperSize").val();
  117. var mark_type = jQuery("#mark_type").val();
  118. jQuery.post(
  119. "<?php echo $this->createUrl("print/setpapersize");?>",
  120. {"examId": examId, "paperSize": paperSize,"mark_type":mark_type,"tpl_index":tpl_index},
  121. function(data){
  122. data = JSON.parse(data);
  123. layer.msg(data.message);
  124. if(data.success == 1){
  125. setTimeout(function(){location.reload();}, 1300);
  126. }
  127. }
  128. );
  129. layer.closeAll();
  130. });
  131. },
  132. end: function(){
  133. }
  134. });
  135. });
  136. // 根据年级筛选班级
  137. jQuery("#grade").change(function(){
  138. var grade = $(this).val();
  139. if (!grade) return false;
  140. jQuery.post(
  141. '<?php echo $this->createUrl("print/getGradeClass");?>',{"grade": grade},function(data){
  142. data = JSON.parse(data);
  143. if(data.success == 1){
  144. var classObj = $("#class");
  145. var html = "<option value=''>全部班级</option>";
  146. classObj.empty();
  147. $.each(data.message,function(i,n){
  148. html += "<option value='"+n.class_id+"'>" + n.class_name + "</option>";
  149. });
  150. classObj.append(html);
  151. }
  152. }
  153. );
  154. });
  155. jQuery(".maskType").click(function () {
  156. var is_show = jQuery(this).attr("is_show");
  157. if (is_show > 0) {
  158. return false;
  159. }
  160. var _display = '';
  161. var exam_group_id = jQuery(this).attr("examId");
  162. var tpl_index = jQuery(this).attr("tpl_index");
  163. var marking_papers=$(this).attr('marking_papers');
  164. var online_card=$(this).attr('online');
  165. var mar = 'margin:30px auto;';
  166. html = "" +
  167. '<div style="padding:10px 30px">' +
  168. '<div style="padding-top:10px;clear: left"></div>' +
  169. '<div style="margin:5px 0; float: left;';
  170. html = html + '">阅卷方式:</div>' +
  171. '<div style="float: left"><select id="mark_type" style="width:200px;';
  172. html = html + '">' +
  173. '<option value="0" ';
  174. if (jQuery(this).attr("mark_type") == '0') {
  175. html = html + 'selected';
  176. }
  177. html = html + '>线下阅卷</option>';
  178. html = html + ' <option value="3" ';
  179. if (jQuery(this).attr("mark_type") == '3') {
  180. html = html + 'selected';
  181. }
  182. html = html + '>班级混合阅卷</option> ';
  183. html = html + ' <option value="4" ';
  184. if (jQuery(this).attr("mark_type") == '4') {
  185. html = html + 'selected';
  186. }
  187. html = html + '>班级单独阅卷</option> ' +
  188. '</select></div>' +
  189. '<div class="row" style="' + mar + 'text-align: center;"><button id="confirm" class="label-primary-s bth-s" style="padding:4px 12px;margin:20px 0 0 15px">确定</button>' +
  190. '<button id="cancel" class="label-primary-s bth-s" style="border:gray;background:gray;padding:4px 12px;margin:20px 0 0 25px">取消</button></div>' +
  191. '</div>' +
  192. "";
  193. layer.open({
  194. type: 1,
  195. area: ['350px', '300px'],
  196. title: "更改试卷",
  197. content: html,
  198. success: function (index, layerObj) {
  199. jQuery("#cancel").on("click", function () {
  200. layer.closeAll();
  201. });
  202. jQuery("#confirm").on("click", function () {
  203. var mark_type = jQuery("#mark_type").val();
  204. console.log('markpapers:'+marking_papers+',marktyp:'+mark_type+',online:'+online_card);
  205. if(online_card==1 && marking_papers==2 && mark_type==0){
  206. layer.msg("当前在线答题卡的评阅方式为网阅,不支持修改为线下阅卷,请进入在线答题卡修改评阅方式为手批后再更改阅卷方式!", {
  207. time: 0,
  208. btn: ['我已知晓'],
  209. yes: function (index) {
  210. layer.closeAll();
  211. }
  212. })
  213. }else{
  214. jQuery.post(
  215. "<?php echo $this->createUrl("print/Setmasktype");?>",
  216. {"exam_group_id": exam_group_id, "mark_type": mark_type, "tpl_index": tpl_index},
  217. function (data) {
  218. data = JSON.parse(data);
  219. if (data.success == 1) {
  220. layer.msg(data.message);
  221. setTimeout(function () {
  222. location.reload();
  223. }, 1300);
  224. }else{
  225. layer.msg(data.message,{time:10000});
  226. }
  227. }
  228. );
  229. }
  230. });
  231. },
  232. end: function () {
  233. }
  234. });
  235. });
  236. jQuery(".studentCard").click(function () {
  237. var is_show = jQuery(this).attr("is_show");
  238. var cardLength=jQuery(this).attr("cardLength");
  239. if (is_show > 0) {
  240. return false;
  241. }
  242. var _display = '';
  243. var exam_group_id = jQuery(this).attr("examId");
  244. var mar = 'margin:30px auto;';
  245. html = "" +
  246. '<div style="padding:10px 30px">' +
  247. '<div style="padding-top:10px;clear: left"></div>' +
  248. '<div style="margin:5px 0; float: left;';
  249. html = html + '">考号类型:</div>' +
  250. '<div style="float: left"><select id="schoolCard" style="width:200px;';
  251. html = html + '">' +
  252. '<option value="1" ';
  253. if (jQuery(this).attr("school_card_status") == '1') {
  254. html = html + 'selected';
  255. }
  256. html = html + '>学校准考证</option>';
  257. html = html + ' <option value="0" ';
  258. if (jQuery(this).attr("school_card_status") == '0') {
  259. html = html + 'selected';
  260. }
  261. html = html + '>系统准考证</option> '+
  262. '</select></div>';
  263. html+='<div style="margin:5px 0; float: left;">考号位数:</div>';
  264. html+='<div style="margin:5px 0; float: left"><input type="text" id="schoolCardLength" length="'+cardLength+'" name="schoolCardLength" value="'+cardLength+'"></div>'+
  265. '<div class="row" style="' + mar + 'text-align: center;"><button id="confirm" class="label-primary-s bth-s" style="padding:4px 12px;margin:20px 0 0 15px">确定</button>' +
  266. '<button id="cancel" class="label-primary-s bth-s" style="border:gray;background:gray;padding:4px 12px;margin:20px 0 0 25px">取消</button></div>' +
  267. '</div>' +
  268. "";
  269. layer.open({
  270. type: 1,
  271. area: ['350px', '300px'],
  272. title: "更改考号类型",
  273. content: html,
  274. success: function (index, layerObj) {
  275. jQuery("#cancel").on("click", function () {
  276. layer.closeAll();
  277. });
  278. jQuery("#confirm").on("click", function () {
  279. var schoolCard = jQuery("#schoolCard").val();
  280. var schoolCardLength = parseInt(jQuery("#schoolCardLength").val());
  281. if(schoolCard==1 && schoolCardLength==0){
  282. layer.msg('请输入准考证位数');
  283. return false;
  284. }else if(schoolCard==1 && (jQuery("#schoolCardLength").val()%1 !== 0 || schoolCardLength>14)){
  285. layer.msg('准考证位数不正确');
  286. return false;
  287. }
  288. jQuery.post(
  289. "<?php echo $this->createUrl("print/changeStudentCardType");?>",
  290. {"examGroupId": exam_group_id, "schoolCard": schoolCard, "schoolCardLength": schoolCardLength},
  291. function (data) {
  292. data = JSON.parse(data);
  293. layer.msg(data.message);
  294. if (data.success == 1) {
  295. setTimeout(function () {
  296. location.reload();
  297. }, 1300);
  298. }
  299. }
  300. );
  301. layer.closeAll();
  302. });
  303. },
  304. end: function () {
  305. }
  306. });
  307. });
  308. $('body').on('change','#schoolCard',function(){
  309. console.log($(this).val());
  310. studentCard= $('#schoolCardLength').attr('length');
  311. if($(this).val()==0){
  312. $('#schoolCardLength').val('');
  313. $('#schoolCardLength').attr('disabled',true);
  314. }else{
  315. $('#schoolCardLength').val(studentCard);
  316. $('#schoolCardLength').attr('disabled',false);
  317. }
  318. })
  319. });
  320. $(document).ready(function(){
  321. /*var str = '<div class="points"></div>';
  322. $(".sc-lis").each(function(){
  323. if($(this).find(".points").length>0){
  324. $(".sel-opt").append(str);
  325. }
  326. });*/
  327. $('body').on('click','.selectSendType',function(){
  328. $('.selectSendType').removeClass('selected');
  329. $('input[name=sendType]').val($(this).index());
  330. $(this).addClass('selected');
  331. })
  332. $(".layshow-btn").click(function(){
  333. var isAnswerSheet = $(this).attr("isAnswerSheet");
  334. var examGroupId = $(this).attr("examGroupId");
  335. if(isAnswerSheet != 1){
  336. layer.msg('尚未创建答题卡,请创建');
  337. return false;
  338. }
  339. $('.english_paper_id').val(examGroupId);
  340. layer.open({
  341. type: 1,
  342. title: '上传试卷',
  343. btn:['发送标注'],
  344. area: ['560px', '350px'], //宽高
  345. content: $(".layer-upload"),
  346. yes:function(index){
  347. sendPaperAndAnswer(examGroupId);
  348. layer.close(index);
  349. },
  350. });
  351. })
  352. $(".sel-opt,.sel-cons").mouseover(function(){
  353. $(".sel-cons").show();
  354. }).mouseout(function(){
  355. $(".sel-cons").hide();
  356. });
  357. $(".sc-lis").click(function(){
  358. var data = {
  359. subjectId : $(this).attr('val')
  360. };
  361. $.post("<?php echo Yii::app()->createUrl('third/setSubjectId')?>",data,function(flags){
  362. if(flags)
  363. {
  364. location.reload();
  365. }else
  366. {
  367. alert('网络异常');
  368. }
  369. });
  370. $('.has-sel').text($(this).text());
  371. $(".sel-cons").hide();
  372. });
  373. $(".ruanyun").click(function(){
  374. var exam_id = $(this).attr('exam_id');
  375. layer.msg("确定发送吗?学生是否全部上传成绩", {
  376. time: 0,
  377. btn: ['确定', '取消'],
  378. yes: function(index){
  379. layer.close(index);
  380. $.ajax({
  381. url: "<?php echo $this->createUrl('print/send_ruanyun_pdf');?>",
  382. type: "POST",
  383. dataType: "json",
  384. data:{ examId: exam_id
  385. },
  386. success: function (data){
  387. if(data.status == 1){
  388. layer.msg('发送成功',{
  389. icon: 1
  390. }, function(){
  391. layer.closeAll();
  392. location.reload();
  393. });
  394. }else if(data.status == 2){
  395. layer.msg('发送失败,未上传成绩',{
  396. icon: 5
  397. }, function(){
  398. layer.closeAll();
  399. location.reload();
  400. });
  401. }else{
  402. layer.msg('发送失败',{
  403. icon: 5
  404. }, function(){
  405. layer.closeAll();
  406. location.reload();
  407. });
  408. }
  409. },
  410. error: function (data, status, e){ //服务器响应失败处理函数
  411. layer.msg('返回失败!',{
  412. icon: 1
  413. }, function(){
  414. layer.closeAll();
  415. });
  416. }
  417. });
  418. }
  419. });
  420. });
  421. $(".create_sheet").click(function(){
  422. var exam_group_id = $(this).attr("exam_group_id");
  423. var sheet_id = $(this).attr("sheet_id");
  424. var mark_type = $(this).attr("mark_type");
  425. var tw_status = $(this).attr("tw_status");
  426. var labelled = $(this).attr("labelled");
  427. var feedback = $(this).attr("feedback");
  428. var version_number='<?php echo $version_number?>';
  429. var qxk=$(this).attr("qxk");
  430. if(mark_type==0){
  431. layer.msg('当前考试为线下阅卷,暂不支持切割模板,请使用在线答题卡功能进行考试。',{
  432. icon:5,time:5000
  433. }, function(){
  434. layer.closeAll();
  435. location.reload();
  436. });
  437. return false;
  438. }
  439. if(exam_group_id>0){
  440. $.post("<?php echo Yii::app()->createUrl('third/set_new')?>",{exam_group_id:exam_group_id});
  441. $.post("<?php echo Yii::app()->createUrl('third/verify_exam_rs')?>",{exam_group_id:exam_group_id},function(rs){
  442. var m = JSON.parse(rs);
  443. if(m.status==2)
  444. {
  445. layer.msg('非法考试!',{
  446. icon: 5
  447. }, function(){
  448. layer.closeAll();
  449. location.reload();
  450. });
  451. }
  452. if(m.status==5)
  453. {
  454. $('input[name=tpl_exam_group_id]').val(exam_group_id);
  455. $('input[name=tpl_qxk]').val(qxk);
  456. if(feedback==1 || labelled>0){
  457. $('.tpl_new').attr('feedback',1);
  458. }else{
  459. $('.tpl_new').attr('feedback',0);
  460. }
  461. $('#fieldModalTopic').show();
  462. }
  463. if(m.status==0)
  464. {
  465. msg="当前考试已发送解析,修改答题卡需要重新上传解析,请确认!";
  466. if((tw_status==2 || tw_status==1) && labelled==0){
  467. layer.msg(msg, {
  468. time: 0,
  469. btn: ['确定', '取消'],
  470. yes: function(index){
  471. if(qxk=='1'){
  472. evaluationClient.createAnswerSheetNewQuestion(0+","+exam_group_id);
  473. }else{
  474. evaluationClient.createAnswerSheet(0+","+exam_group_id);
  475. }
  476. }
  477. });
  478. }else{
  479. if(qxk=='1'){
  480. evaluationClient.createAnswerSheetNewQuestion(0+","+exam_group_id);
  481. }else{
  482. evaluationClient.createAnswerSheet(0+","+exam_group_id);
  483. }
  484. }
  485. }
  486. });
  487. }
  488. });
  489. $(".create_sheet_subject").click(function(){
  490. var exam_group_id = $(this).attr("exam_group_id");
  491. var sheet_id = $(this).attr("sheet_id");
  492. var mark_type = $(this).attr("mark_type");
  493. var tw_status = $(this).attr("tw_status");
  494. var labelled = $(this).attr("labelled");
  495. var qxk=$(this).attr("qxk");
  496. var feedback = $(this).attr("feedback");
  497. var version_number='<?php echo $version_number?>';
  498. if(mark_type==0){
  499. layer.msg('当前考试为线下阅卷,暂不支持切割模板,请使用在线答题卡功能进行考试。',{
  500. icon:5,time:5000
  501. }, function(){
  502. layer.closeAll();
  503. location.reload();
  504. });
  505. return false;
  506. }
  507. if(exam_group_id>0){
  508. $.post("<?php echo Yii::app()->createUrl('third/set_new')?>",{exam_group_id:exam_group_id});
  509. $.post("<?php echo Yii::app()->createUrl('third/verify_exam_rs')?>",{exam_group_id:exam_group_id},function(rs){
  510. var m = JSON.parse(rs);
  511. if(m.status==2)
  512. {
  513. layer.msg('非法考试!',{
  514. icon: 5
  515. }, function(){
  516. layer.closeAll();
  517. location.reload();
  518. });
  519. }
  520. if(m.status==5)
  521. {
  522. $('input[name=tpl_exam_group_id]').val(exam_group_id);
  523. $('input[name=tpl_qxk]').val(qxk);
  524. if(feedback==1 || labelled>0){
  525. $('.tpl_new').attr('feedback',1);
  526. }else{
  527. $('.tpl_new').attr('feedback',0);
  528. }
  529. $('#fieldModalTopic').show();
  530. }
  531. if(m.status==0 || m.status==1)
  532. {
  533. if((tw_status==2 || tw_status==1) && labelled==0){
  534. layer.msg('当前考试已发送解析,修改答题卡需要重新上传解析,请确认!', {
  535. time: 0,
  536. btn: ['确定', '取消'],
  537. yes: function(index){
  538. if(qxk=='1'){
  539. evaluationClient.createAnswerSheetNewQuestion(sheet_id+","+exam_group_id+",<?php echo Yii::app()->session['session_duoxueke_subject_id']?>");
  540. }else{
  541. evaluationClient.createAnswerSheet(sheet_id+","+exam_group_id+",<?php echo Yii::app()->session['session_duoxueke_subject_id']?>");
  542. }
  543. }
  544. });
  545. }else{
  546. if(qxk=='1'){
  547. evaluationClient.createAnswerSheetNewQuestion(sheet_id+","+exam_group_id+",<?php echo Yii::app()->session['session_duoxueke_subject_id']?>");
  548. }else{
  549. evaluationClient.createAnswerSheet(sheet_id+","+exam_group_id+",<?php echo Yii::app()->session['session_duoxueke_subject_id']?>");
  550. }
  551. }
  552. }
  553. });
  554. }
  555. });
  556. //打印
  557. $(".print_sheet").click(function(){
  558. var exam_group_id = $(this).attr('exam_group_id');
  559. if(!exam_group_id)
  560. {
  561. layer.msg('非法考试!');
  562. return false;
  563. }
  564. $.post("<?php echo Yii::app()->createUrl('third/print_paper')?>",{exam_group_id:exam_group_id},function(rs){
  565. var m = JSON.parse(rs);
  566. if(m.status)
  567. {
  568. evaluationClient.CreateDiSanFang(m.result);
  569. }
  570. });
  571. });
  572. $('.tab_btn').click(function(){
  573. $('input[name="list_type"]').val($(this).index());
  574. });
  575. $('.create-third').click(function(){
  576. var textbook_set_alert=0;
  577. var href='';
  578. <?php
  579. if(isset($list_type) && $list_type==1){
  580. echo "href='".$this->createUrl("third/thirdview_under_line")."';";
  581. } else{
  582. if(Yii::app()->params['section']==0){
  583. echo "href='".$this->createUrl("third/thirdview_section")."';";
  584. }elseif(in_array(Yii::app()->session['session_duoxueke_subject_id'],array(3,6))){
  585. if(!Yii::app()->params['school_textbook_setting']){
  586. echo 'textbook_set_alert=1;';
  587. }
  588. echo "href='".$this->createUrl("third/thirdview")."';";
  589. }else{
  590. echo "href='".$this->createUrl("third/thirdview_duo")."';";
  591. }
  592. }
  593. ?>
  594. if(textbook_set_alert==1){
  595. layer.msg('请先在教材管理模块设置高一、高二的教材版本');
  596. return false;
  597. }
  598. window.location=href;
  599. });
  600. $('.upload-btn-paper').click(function(){
  601. var This = $(this);
  602. $($(this).parent().find("input")).each(function(){
  603. if(!$(this).val()){
  604. $(this).remove();
  605. }
  606. });
  607. // var length = parseInt($('.upload-ul-paper li').length);
  608. var html = '<input type="file" name="paper_exam'+filePaper+'" id="paper_exam'+filePaper+'" style="display:none" class="upload-paper-types">';
  609. This.after(html);
  610. This.parent().find("#paper_exam"+filePaper).click();
  611. filePaper++;
  612. });
  613. $("body").delegate(".upload-paper-types","change",function(){
  614. var idName = $(this).attr('id');
  615. var filename = $(this).val();
  616. var nameStart = filename.lastIndexOf('\\');
  617. var fileNameRe = filename.substring(nameStart,filename.length);
  618. fileNameRe = fileNameRe.substr(1);
  619. var extStart = filename.lastIndexOf('.');
  620. var extName = filename.substring(extStart,filename.length).toLowerCase();
  621. if (extName != ".docx" && extName != ".doc" && extName != ".pdf" && extName != ".gif" && extName != ".bmp" && extName != ".jpg" && extName != ".jpeg" && extName != ".png") {
  622. layer.msg('试卷格式错误');
  623. $(this).remove();
  624. return false;
  625. }
  626. var length = $(".upload-btn-paper").parent().find("input").length;
  627. var html = "";
  628. html += '<li class="clearfix">';
  629. html += ' <span class="fl paper-no">第'+length+'页</span>';
  630. html += ' <span class="fl">'+fileNameRe+'</span>';
  631. html += ' <em class="fr red remove-file-paper" idName="'+idName+'">×</em>';
  632. html += '</li>';
  633. $('.upload-ul-paper').append(html);
  634. });
  635. $('.upload-btn-answer').click(function(){
  636. var This = $(this);
  637. $($(this).parent().find("input")).each(function(){
  638. if(!$(this).val()){
  639. $(this).remove();
  640. }
  641. });
  642. // var length = parseInt($('.upload-ul-answer li').length);
  643. var html = '<input type="file" name="paper_answer'+fileAnswer+'" id="paper_answer'+fileAnswer+'" style="display:none" class="upload-answer-types">';
  644. This.after(html);
  645. This.parent().find("#paper_answer"+fileAnswer).click();
  646. fileAnswer++;
  647. });
  648. $("body").delegate(".upload-answer-types","change",function(){
  649. var idName = $(this).attr('id');
  650. var filename = $(this).val();
  651. var nameStart = filename.lastIndexOf('\\');
  652. var fileNameRe = filename.substring(nameStart,filename.length);
  653. fileNameRe = fileNameRe.substr(1);
  654. var extStart = filename.lastIndexOf('.');
  655. var extName = filename.substring(extStart,filename.length).toLowerCase();
  656. if (extName != ".docx" && extName != ".doc" && extName != ".pdf" && extName != ".gif" && extName != ".bmp" && extName != ".jpg" && extName != ".jpeg" && extName != ".png") {
  657. layer.msg('答案解析格式错误');
  658. $(this).remove();
  659. return false;
  660. }
  661. var length = $(".upload-btn-answer").parent().find("input").length;
  662. var html = "";
  663. html += '<li class="clearfix">';
  664. html += ' <span class="fl answer-no">第'+length+'页</span>';
  665. html += ' <span class="fl">'+fileNameRe+'</span>';
  666. html += ' <em class="fr red remove-file-answer" idName="'+idName+'">×</em>';
  667. html += '</li>';
  668. $('.upload-ul-answer').append(html);
  669. });
  670. $("body").delegate(".remove-file-paper","click",function(){
  671. var idName = $(this).attr("idName");
  672. $(this).parent().remove();
  673. $('#'+idName).remove();
  674. var no = 1;
  675. $(".upload-ul-paper li").each(function(){
  676. $(this).find(".paper-no").html("第"+no +"页");
  677. no++;
  678. });
  679. });
  680. $("body").delegate(".remove-file-answer","click",function(){
  681. var idName = $(this).attr("idName");
  682. $(this).parent().remove();
  683. $('#'+idName).remove();
  684. var no = 1;
  685. $(".upload-ul-answer li").each(function(){
  686. $(this).find(".answer-no").html("第"+no +"页");
  687. no++;
  688. });
  689. });
  690. });
  691. function showError(str)
  692. {
  693. layer.msg(str,{
  694. icon: 5
  695. }, function(){
  696. layer.closeAll();
  697. location.reload();
  698. });
  699. }
  700. function objToJson(obj){
  701. var json = "{ ";
  702. for(var item in obj){
  703. json += "'"+item+"':'"+obj[item]+"',";
  704. }
  705. json += " }";
  706. return json;
  707. }
  708. function ccc(){
  709. layer.msg('敬请期待!', {
  710. time: 0,
  711. btn: ['确定', '取消'],
  712. yes: function(index){
  713. layer.close(index);
  714. return false;
  715. }
  716. });
  717. }
  718. function delExam(odj){
  719. if (!odj) return false;
  720. var classId = odj.getAttribute("w_class_id");
  721. var examId = odj.getAttribute("w_exam_id");
  722. if (!classId || !examId) return false;
  723. var msg = '您确定要删除此班的考试吗?';
  724. layer.msg(msg, {
  725. time: 0,
  726. btn: ['确定', '取消'],
  727. yes: function(index){
  728. layer.close(index);
  729. $.ajax({
  730. url: "<?php echo $this->createUrl('print/delexam');?>",
  731. type: "POST",
  732. dataType: "json",
  733. data: {
  734. examId: examId,
  735. classId:classId
  736. },
  737. success: function (data){
  738. if(data.status == 1){
  739. layer.msg('删除成功',{
  740. icon: 1
  741. }, function(){
  742. layer.closeAll();
  743. location.reload();
  744. });
  745. }else{
  746. layer.msg('删除失败',{
  747. icon: 5
  748. }, function(){
  749. layer.closeAll();
  750. location.reload();
  751. });
  752. }
  753. },
  754. error: function (data, status, e){ //服务器响应失败处理函数
  755. layer.msg('返回失败!',{
  756. icon: 1
  757. }, function(){
  758. layer.closeAll();
  759. });
  760. }
  761. });
  762. }
  763. });
  764. }
  765. // 确认上传成绩
  766. function uploadConfirm(classId, examId,className,is_uploaded_count,students_count) {
  767. //if (confirm('您确定已上传成绩了吗?')) {
  768. msg = "<div style='text-align:left;'>("+className+")已上传(<span style=' font-size:20px;color:#15ae68 ;font-weight: bold'>"+is_uploaded_count+"</span>)份试卷,还有(<span style='font-size:20px;color: red;font-weight: bold'>"+(students_count-is_uploaded_count)+"</span>)份试卷未上传!是否确认本班级试卷都已上传?<br/><br/><span style='color: red'>请注意!试卷上传确认后将不能再次上传本班的试卷!!!</span></div>";
  769. layer.msg(msg, {
  770. time: 0,
  771. btn: ['确定', '取消'],
  772. yes: function(index, layerObj){
  773. layer.close(index);
  774. $.ajax({
  775. url: "<?php echo $this->createUrl('print/uploadConfirm');?>",
  776. type: "POST",
  777. data: {
  778. classId: classId,
  779. examId: examId
  780. },
  781. beforeSend:function(){
  782. // 发送请求显示打印中
  783. layer.msg('确认中...', {time: 20000});
  784. },
  785. dataType: "JSON",
  786. success: function(data) {
  787. if (data.status == 1) {
  788. layer.msg('确认成功!');
  789. setTimeout(function(){location.reload();}, 1300);
  790. } else {
  791. layer.msg(data.error);
  792. }
  793. },
  794. complete:function(){
  795. },
  796. error:function(){
  797. }
  798. });
  799. }
  800. });
  801. //}
  802. }
  803. // 打印错题本
  804. function printBook(cid,eid,type){
  805. if (!cid || !eid || !type) {
  806. layer.msg("打印参数有误");return;
  807. }
  808. var message = '';
  809. var objUrl = '';
  810. if (type == 1) {
  811. message = "您确定要下载该班级纠错本吗?";
  812. objUrl = "<?php echo $this->createUrl('print/downloadwrongtopic');?>";
  813. divTitle = "下载错题本";
  814. improveName = "错题本";
  815. } else if (type == 2){
  816. message = "您确定要下载该班级个性化学习方案吗?";
  817. objUrl = "<?php echo $this->createUrl('print/downloadraisescheme');?>";
  818. divTitle = "下载个性化学习方案";
  819. improveName = "个性化学习方案";
  820. }else if (type == 3){
  821. message = "您确定要下载该班级个性化学习宝吗?";
  822. objUrl = "<?php echo $this->createUrl('print/downloadraisescheme');?>";
  823. divTitle = "下载个性化学习宝";
  824. improveName = "个性化学习宝";
  825. }
  826. else{
  827. layer.msg("打印参数有误");return;
  828. }
  829. html = ""+
  830. '<div style="padding:20px 30px 0px 30px">'+
  831. '<div style="padding:8px 0;">请复制下方链接下载'+improveName+'。</div>'+
  832. '<div id="downloadUrl" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:455px;"></div>'+
  833. '<div class="row" style="margin:30px auto 0px auto;text-align:center"><button id="confirm" class="label-primary-s bth-s" style="padding:4px 12px;margin:5px 0 10px 15px;background:gray;border-color:gray;">关闭</button>'+
  834. '</div>'+
  835. '</div>'+
  836. "";
  837. layer.msg(message, {
  838. time: 0,
  839. btn: ['确定', '取消'],
  840. yes: function(index){
  841. layer.close(index);
  842. msgIndex = layer.msg("下载中请稍后...", {"time": 3600000});
  843. // 更试卷打印时间
  844. $.post("<?php echo $this->createUrl('print/updatepaperprinttime');?>", {cid: cid, eid: eid,type:type } );
  845. /*if(type == 1)
  846. location.href = objUrl+"/cid/"+cid+"/eid/"+eid;
  847. else
  848. location.href = objUrl+"/cid/"+cid+"/eid/"+eid+"/type/"+type;*/
  849. startTime = (new Date()).getTime();
  850. showTip = true;
  851. tipShowed = false;
  852. toPromptTime = 3000;
  853. window.interval = setInterval(function(){
  854. execTime = (new Date()).getTime() - startTime;
  855. if(execTime > toPromptTime && showTip && !tipShowed){
  856. // msgIndex = layer.msg("该文件较大,请耐心等待...", {"time": 3600000});
  857. // tipShowed = true;
  858. }
  859. }, 1000);
  860. jQuery.get(
  861. "<?php echo $this->createUrl("print/getImproveFile");?>",
  862. {"examId": eid, "classId": cid, "type": type},
  863. function(data){
  864. data = JSON.parse(data);
  865. if(data.success == 1||data.success == 2){
  866. layer.open({
  867. type: 1,
  868. area: ['550px', '220px'],
  869. title: divTitle,
  870. content: html,
  871. success: function(index, layerObj){
  872. clearInterval(window.interval);
  873. msgIndex = layer.msg(data.limitinfo, {"time": 3000});
  874. clearInterval(window.interval);
  875. layer.close(msgIndex);
  876. jQuery("#downloadUrl").html('下载地址:<span style=""><input id="url" type="text" size="40" readonly value="'+data.downloadPath+'" /></span><button id="copy" class="label-primary-s bth-s" style="padding:4px 12px;margin:5px 0 10px 15px;">全选</button>');
  877. jQuery("#confirm, #cancel").on("click", function(){
  878. layer.close(layerObj);
  879. });
  880. jQuery("#copy").on("click", function(){
  881. jQuery("#url").select();
  882. });
  883. },
  884. end: function(){
  885. }
  886. });
  887. }
  888. else if(data.success == 0){
  889. clearInterval(window.interval);
  890. msgIndex = layer.msg(data.message, {"time": 3000});
  891. }
  892. }
  893. );
  894. }
  895. });
  896. }
  897. // 上传试卷模板
  898. function uploadTemplate(eid,name,grade){
  899. if (!eid) {
  900. layer.msg('操作失败!');
  901. return false;
  902. }
  903. forCheckUrl = "<?php echo $this->createUrl('third/checkanswercard');?>";
  904. $.post(forCheckUrl,{eid:eid},function(data){
  905. var obj = JSON.parse(data);
  906. var subject_id = '<?php echo Yii::app()->session['session_duoxueke_subject_id']?>';
  907. if(obj.success==1)
  908. {
  909. var html ='<div class="layer_notice" style="padding:5px;">';
  910. if(subject_id == 12){
  911. html += '<div><a style="color:#0e8e54" href="/assets/data/physics_topic_mould.docx">下载试卷模板</a></div>';
  912. }
  913. html +='<table class="table table-striped table-bordered table-hover ">';
  914. html +='<thead class="thin-border-bottom">';
  915. html +='<tr>';
  916. html +='<th>试卷名称</th>';
  917. html +='<th>操作</th>';
  918. html +='</tr>';
  919. html +='</thead>';
  920. html +='<tbody class="content_tbody">';
  921. if(subject_id == 3 ||subject_id == 6 ) {
  922. html += '<td>' + name + '</td><td><input type="radio" value="1" name="upload_type" class="upload_type" checked><input type="file" style="display: inline" name="word_file" id="word_file" />';
  923. html += '&nbsp;&nbsp;<input type="radio" name="upload_type" class="upload_type" value="2" >复用试卷</td></tr>';
  924. }else{
  925. html += '<td>' + name + '</td><td><input type="file" name="word_file" id="word_file" /></td></tr>';
  926. }
  927. html +='</tbody>';
  928. html +='</table>';
  929. html +='<span style="width:582px;display:inline-block;text-align:center;">';
  930. html +='<button class="btn btn-success btn-sm upload-word" onclick="uploadWord()"><i class="ace-icon fa fa-check bigger-110"></i>确定</button>';
  931. html +='<button class="btn btn-success btn-sm select-exam" onclick="selectExam('+grade+',\''+eid+'\')" style="display:none"><i class="ace-icon fa fa-check bigger-110"></i>确定</button>';
  932. html +='</span>';
  933. html +='<input type="hidden" id="mpEGid" value="'+eid+'">';
  934. html +='</div>';
  935. layer.open({
  936. type: 1,
  937. skin: 'layui-layer-rim', //加上边框
  938. area: ['600px', '300px'], //宽高
  939. content: html
  940. });
  941. }else
  942. {
  943. layer.msg(obj.message,{
  944. icon: 5
  945. }, function(){
  946. layer.closeAll();
  947. location.reload();
  948. });
  949. //layer.msg(obj.message);
  950. }
  951. });
  952. }
  953. $('body').on('click','.upload_type',function(){
  954. console.log($(this).val());
  955. if($(this).val()==1){
  956. $('.upload-word').show();
  957. $('.select-exam').hide();
  958. }else{
  959. $('.upload-word').hide();
  960. $('.select-exam').show();
  961. }
  962. });
  963. //复用试卷
  964. var copyExamArr=[];
  965. function selectExam(grade,examGroupId){
  966. copyExamArr=[];
  967. $.ajax({
  968. url:'<?php echo $this->createUrl('third/loadCopyPaper')?>',
  969. type:'POST',
  970. dataType:'json',
  971. data:{grade:grade,examGroupId:examGroupId},
  972. success:function(res){
  973. if(res.status==1){
  974. rs=res.data;
  975. if(rs.length>0){
  976. $.each(rs,function(k,v){
  977. copyExamArr.push(v)
  978. })
  979. showCopyExam(1,examGroupId)
  980. }else{
  981. layer.msg('暂时没有可以复用的考试');
  982. }
  983. }
  984. }
  985. });
  986. }
  987. function showCopyExam(page,examGroupId){
  988. var pageLimit=10;
  989. start=(page-1)*pageLimit
  990. end =start+pageLimit
  991. console.log(examGroupId);
  992. maxPage= Math.ceil(copyExamArr.length/pageLimit);
  993. var nowPageData=copyExamArr.slice(start,end)
  994. console.log(nowPageData)
  995. var html='';
  996. pageHtml='';
  997. // layer.closeAll()
  998. $.each(nowPageData,function(i,v){
  999. html+='<tr>';
  1000. html+='<td>'+v['name']+'</td>';
  1001. html+='<td>'+v['create_time']+'</td>';
  1002. html+='<td>'+v['exam_date']+'</td>';
  1003. html+='<td><a href="#" targetExamId="'+examGroupId+'" class="copyPaperTopic" id="'+v['exam_group_id']+'">复用</a></td>';
  1004. html+='</tr>';
  1005. });
  1006. if(maxPage>1){
  1007. pageHtml+='<ul class="yiiPager">';
  1008. if(page>1){
  1009. pageHtml+='<li class="previous" id="'+examGroupId+'" pageNum="'+(page-1)+'"><a href="#" >上一页</a></li>';
  1010. }
  1011. for(var i=1;i<=maxPage;i++){
  1012. if(page==i){
  1013. pageHtml+='<li class="page selected"><a href="#" >'+i+'</a></li>';
  1014. }else{
  1015. pageHtml+='<li class="page"><a href="#" id="'+examGroupId+'" class="gotoPage">'+i+'</a></li>';
  1016. }
  1017. }
  1018. if(page<maxPage){
  1019. pageHtml+='<li class="next" id="'+examGroupId+'" pageNum="'+(page+1)+'"><a href="#" >下一页</a></li>';
  1020. }
  1021. pageHtml+='<li >共:'+copyExamArr.length+'条</li>';
  1022. pageHtml+='</ul>';
  1023. }
  1024. $('.student_list_page').html(pageHtml);
  1025. $('.student-list').find('tbody').html(html)
  1026. // $('#fieldModalStudent').show();
  1027. }
  1028. $('.student-list-close').click(function(){
  1029. $('#fieldModalStudent').hide();
  1030. });
  1031. //复用按钮状态
  1032. var copyBtn=true;
  1033. $('.class_area')
  1034. .on('click','.gotoPage',function(){
  1035. page=parseInt($(this).html());
  1036. eid=$(this).attr('id');
  1037. showCopyExam(page,eid)
  1038. })
  1039. .on('click','.next',function(){
  1040. page=parseInt($(this).attr('pageNum'))
  1041. eid=$(this).attr('id');
  1042. showCopyExam(page,eid);
  1043. })
  1044. .on('click','.previous',function(){
  1045. page=parseInt($(this).attr('pageNum'))
  1046. eid=$(this).attr('id');
  1047. showCopyExam(page,eid);
  1048. })
  1049. .on('click','.copyPaperTopic',function(){
  1050. targetExamGroupId=$(this).attr('targetExamId');
  1051. copyExamGroupId=$(this).attr('id');
  1052. if(copyBtn){
  1053. var waiting=layer.msg('正在处理,请稍候。。。。。。',{time:0})
  1054. copyBtn=false;
  1055. $.ajax({
  1056. url:'<?php echo $this->createUrl('third/copyPaperTopic')?>',
  1057. type:'POST',
  1058. dataType:'json',
  1059. data:{examGroupId:targetExamGroupId,copyExamGroupId:copyExamGroupId},
  1060. success:function(res){
  1061. layer.close(waiting)
  1062. if(res.status==1){
  1063. layer.msg('复用成功',{time:2000},function(){
  1064. window.location.reload();
  1065. });
  1066. }else{
  1067. if(res.msg!=undefined){
  1068. layer.msg(res.msg);
  1069. // layer.closeAll();
  1070. //alert(res.msg);
  1071. }else{
  1072. layer.msg('复用失败');
  1073. }
  1074. copyBtn=true;
  1075. }
  1076. }
  1077. })
  1078. }
  1079. return false;
  1080. })
  1081. //复用
  1082. function uploadWord() {
  1083. var paramEid = $('input[name=upload_template_eid]').val();
  1084. if (!paramEid) {
  1085. layer.msg('没找到考试ID!');
  1086. return false;
  1087. }
  1088. var obj_file = $("#word_file").val();
  1089. if (!obj_file) {
  1090. layer.msg('请选择上传文件');
  1091. return false;
  1092. }
  1093. var extStart = obj_file.lastIndexOf('.');
  1094. var extName = obj_file.substring(extStart,obj_file.length).toLowerCase();
  1095. if (extName != ".docx" && extName != ".dotx" && extName != ".dotm") {
  1096. layer.msg('模板格式有误,请上传dotx格式word!');
  1097. return false;
  1098. }
  1099. $.ajaxFileUpload({
  1100. url: "<?php echo $this->createUrl('third/uploadTpl');?>", //用于文件上传的服务器端请求地址
  1101. secureuri: false, //是否需要安全协议,一般设置为false
  1102. fileElementId: 'word_file', //文件上传域的ID
  1103. dataType: 'text', //返回值类型 一般设置为json
  1104. data:{"eid":paramEid},
  1105. success: function (data, status){
  1106. var obj = JSON.parse(data);
  1107. if (obj.success == 1) {
  1108. layer.msg(obj.message,{
  1109. icon: 1,
  1110. }, function(){
  1111. layer.closeAll();
  1112. location.reload();
  1113. });
  1114. $("#alreadUpload").html('<span style="color:red;">已上传</span>');
  1115. } else {
  1116. layer.msg(obj.message,{
  1117. icon: 2,
  1118. }, function(){
  1119. layer.closeAll();
  1120. location.reload();
  1121. });
  1122. }
  1123. },
  1124. error: function (data, status, e){ //服务器响应失败处理函数
  1125. layer.msg('返回失败!',{
  1126. icon: 1,
  1127. }, function(){
  1128. layer.closeAll();
  1129. location.reload();
  1130. });
  1131. }
  1132. });
  1133. return false;
  1134. }
  1135. // 搜索事件
  1136. $("#search").click(function(){
  1137. $("#form1").submit();
  1138. });
  1139. function print(cid,eid,tid,fg){
  1140. if (!cid || !eid) return false;
  1141. var msg = '';
  1142. if (tid == 0) {
  1143. if (fg == 1) {
  1144. msg = '打印答题卡';
  1145. } else {
  1146. msg = '您确定要打印该试卷嘛?';
  1147. }
  1148. } else if (tid == 1) {
  1149. msg = '您确定要打印该错题本嘛?';
  1150. } else if (tid == 2) {
  1151. msg = '您确定要打印该个性化学习宝吗?';
  1152. }
  1153. layer.msg(msg, {
  1154. time: 0,
  1155. btn: ['确定', '取消'],
  1156. yes: function(index){
  1157. layer.close(index);
  1158. ajaxPrint(cid, eid, tid);
  1159. }
  1160. });
  1161. }
  1162. function ajaxPrint(cid, eid, tid) {
  1163. $.ajax({
  1164. url:"<?php echo $this->createUrl('print/ajaxupdate');?>",
  1165. type:"post",
  1166. data:{cid:cid,eid:eid,tid:tid},
  1167. dataType: "json",
  1168. beforeSend:function(){
  1169. // 发送请求显示打印中
  1170. layer.msg('打印中', {icon: 16,time: 20000});
  1171. },
  1172. success:function(obj){
  1173. var index = layer.msg();
  1174. layer.close(index);
  1175. if (obj.success == 1) {
  1176. if (tid == 0) {//console.log(JSON.stringify(obj.message));
  1177. evaluationClient.printPaper(JSON.stringify(obj.message));
  1178. //alert('提交打印试卷成功!');
  1179. } else if (tid == 1) {
  1180. evaluationClient.printCTB(JSON.stringify(obj.message));
  1181. //alert('提交打印错题本成功!');
  1182. } else if (tid == 2) {
  1183. evaluationClient.printTFFA(JSON.stringify(obj.message));
  1184. //alert('提交打印提分册成功!');
  1185. } else {
  1186. layer.msg('操作错误!');
  1187. }
  1188. location.reload();
  1189. } else {//alert(obj.message);
  1190. layer.msg(obj.message);
  1191. }
  1192. },
  1193. complete:function(){
  1194. //layer.msg('打印失败!');
  1195. //var index = layer.msg();
  1196. //layer.close(index);
  1197. },
  1198. error:function(){
  1199. //var index = layer.msg();
  1200. //layer.close(index);
  1201. }
  1202. });
  1203. }
  1204. // 生成试卷模板
  1205. function createTemplate (exam_group_id,import_type){
  1206. if (!exam_group_id) {
  1207. layer.msg('未找到试卷ID');
  1208. }
  1209. var data={
  1210. exam_group_id:exam_group_id
  1211. }
  1212. $.post("<?php echo Yii::app()->createUrl("third/paper")?>",data,function(rs){
  1213. var m = JSON.parse(rs);
  1214. if(m.status==1)
  1215. {
  1216. if(import_type>0){
  1217. evaluationClient.ImportLoadThirdParty(exam_group_id);
  1218. }else{
  1219. evaluationClient.loadThirdParty(exam_group_id);
  1220. }
  1221. }else {
  1222. layer.msg('尚未创建答题卡,请创建');
  1223. }
  1224. });
  1225. }
  1226. // 生成试卷模板
  1227. function createTemplateSubject (exam_group_id,subject,import_type){
  1228. if (!exam_group_id||!subject) {
  1229. layer.msg('未找到试卷ID');
  1230. }
  1231. var data={
  1232. exam_group_id:exam_group_id
  1233. }
  1234. console.log(import_type);
  1235. $.post("<?php echo Yii::app()->createUrl("third/paper")?>",data,function(rs){
  1236. var m = JSON.parse(rs);
  1237. if(m.status==1)
  1238. {
  1239. if(import_type>0){
  1240. console.log('导入');
  1241. evaluationClient.ImportLoadThirdParty(exam_group_id+','+subject);
  1242. }else{
  1243. console.log('非导入');
  1244. evaluationClient.loadThirdParty(exam_group_id+','+subject);
  1245. }
  1246. }else {
  1247. layer.msg('尚未创建答题卡,请创建');
  1248. }
  1249. });
  1250. }
  1251. function wb_html(odj){
  1252. if (!odj) return false;
  1253. var classId = odj.getAttribute("w_class_id");
  1254. var examId = odj.getAttribute("w_exam_id");
  1255. if (!classId || !examId) return false;
  1256. var msg = '您确定要生成该班级的错题本吗?';
  1257. layer.msg(msg, {
  1258. time: 0,
  1259. btn: ['确定', '取消'],
  1260. yes: function(index){
  1261. layer.close(index);
  1262. $.ajax({
  1263. url: "<?php echo $this->createUrl('client/wbhtml');?>",
  1264. type: "POST",
  1265. dataType: "json",
  1266. data: {
  1267. examId: examId,
  1268. classId:classId
  1269. },
  1270. success: function (data){
  1271. if(data > 0){
  1272. layer.msg('操作成功,重新生成错题本',{
  1273. icon: 1
  1274. }, function(){
  1275. layer.closeAll();
  1276. });
  1277. }else if(data==0){
  1278. layer.msg('操作失败,此班无错题本',{
  1279. icon: 1
  1280. }, function(){
  1281. layer.closeAll();
  1282. });
  1283. }
  1284. else{
  1285. layer.msg('操作失败,重新生成错题本',{
  1286. icon: 1
  1287. }, function(){
  1288. layer.closeAll();
  1289. });
  1290. }
  1291. },
  1292. error: function (data, status, e){ //服务器响应失败处理函数
  1293. layer.msg('返回失败!',{
  1294. icon: 1
  1295. }, function(){
  1296. layer.closeAll();
  1297. });
  1298. }
  1299. });
  1300. }
  1301. });
  1302. }
  1303. function isp2_html(odj){
  1304. if (!odj) return false;
  1305. var classId = odj.getAttribute("w_class_id");
  1306. var examId = odj.getAttribute("w_exam_id");
  1307. if (!classId || !examId) return false;
  1308. var msg = '您确定要生成该班级的二步提分方案吗?';
  1309. layer.msg(msg, {
  1310. time: 0,
  1311. btn: ['确定', '取消'],
  1312. yes: function(index){
  1313. layer.close(index);
  1314. $.ajax({
  1315. url: "<?php echo $this->createUrl('client/isp2html');?>",
  1316. type: "POST",
  1317. dataType: "json",
  1318. data: {
  1319. examId: examId,
  1320. classId:classId
  1321. },
  1322. success: function (data){
  1323. if(data > 0){
  1324. layer.msg('操作成功,重新生成提分方案',{
  1325. icon: 1
  1326. }, function(){
  1327. layer.closeAll();
  1328. });
  1329. }else if(data==0){
  1330. layer.msg('操作失败,此班无提分方案',{
  1331. icon: 1
  1332. }, function(){
  1333. layer.closeAll();
  1334. });
  1335. }
  1336. else{
  1337. layer.msg('操作失败,重新生成提分方案',{
  1338. icon: 1
  1339. }, function(){
  1340. layer.closeAll();
  1341. });
  1342. }
  1343. },
  1344. error: function (data, status, e){ //服务器响应失败处理函数
  1345. layer.msg('返回失败!',{
  1346. icon: 1
  1347. }, function(){
  1348. layer.closeAll();
  1349. });
  1350. }
  1351. });
  1352. }
  1353. });
  1354. }
  1355. function isp3_html(odj){
  1356. if (!odj) return false;
  1357. var classId = odj.getAttribute("w_class_id");
  1358. var examId = odj.getAttribute("w_exam_id");
  1359. if (!classId || !examId) return false;
  1360. var msg = '您确定要生成该班级的个性化学习宝吗?';
  1361. layer.msg(msg, {
  1362. time: 0,
  1363. btn: ['确定', '取消'],
  1364. yes: function(index){
  1365. layer.close(index);
  1366. $.ajax({
  1367. url: "<?php echo $this->createUrl('client/isp3html');?>",
  1368. type: "POST",
  1369. dataType: "json",
  1370. data: {
  1371. examId: examId,
  1372. classId:classId
  1373. },
  1374. success: function (data){
  1375. if(data > 0){
  1376. layer.msg('操作成功,重新生成提分方案',{
  1377. icon: 1
  1378. }, function(){
  1379. layer.closeAll();
  1380. });
  1381. }else if(data==0){
  1382. layer.msg('操作失败,此班无提分方案',{
  1383. icon: 1
  1384. }, function(){
  1385. layer.closeAll();
  1386. });
  1387. }
  1388. else{
  1389. layer.msg('操作失败,重新生成提分方案',{
  1390. icon: 1
  1391. }, function(){
  1392. layer.closeAll();
  1393. });
  1394. }
  1395. },
  1396. error: function (data, status, e){ //服务器响应失败处理函数
  1397. layer.msg('返回失败!',{
  1398. icon: 1
  1399. }, function(){
  1400. layer.closeAll();
  1401. });
  1402. }
  1403. });
  1404. }
  1405. });
  1406. }
  1407. // 隐藏试卷
  1408. function oprateExam(examGroupId,flag){
  1409. if (examGroupId) {
  1410. layer.msg('未找到周周练id',{
  1411. icon: 5
  1412. }, function(){
  1413. layer.closeAll();
  1414. });
  1415. }
  1416. var msg = '您确定要隐藏该试卷吗?';
  1417. if (flag == 0) {
  1418. msg = '您确定要恢复该试卷吗?';
  1419. }
  1420. layer.msg(msg, {
  1421. time: 0,
  1422. btn: ['确定', '取消'],
  1423. yes: function(index){
  1424. layer.close(index);
  1425. $.post('<?php echo $this->createUrl("third/oprateexam");?>',{exam_group_id:examGroupId,flag:flag},function(data){
  1426. var obj = JSON.parse(data);
  1427. if (obj.success == 1) {
  1428. location.reload();
  1429. } else {
  1430. layer.msg(obj.message,{
  1431. icon: 5
  1432. }, function(){
  1433. layer.closeAll();
  1434. });
  1435. // layer.msg(obj.message);
  1436. }
  1437. });
  1438. }
  1439. });
  1440. }
  1441. function uploadExamTopic(ExamGroupId,Subject,Sheet,tplIndex){
  1442. if (!ExamGroupId||!Subject) {
  1443. layer.msg('未找到试卷ID');
  1444. return false;
  1445. }
  1446. $.ajax({
  1447. url:"<?php echo $this->createUrl('third/getthirdsheet');?>",
  1448. type:"POST",
  1449. dataType:"json",
  1450. data:{exam_group_id:ExamGroupId},
  1451. success:function (res) {
  1452. if(res.success==1){
  1453. evaluationClient.loadExamPaper(Sheet+','+ExamGroupId+','+Subject+','+tplIndex);
  1454. }else if(res.success==4){
  1455. layer.msg('您当前已发送试卷后台协助任务,为避免您产生与后台重复的操作,以造成数据混乱,已禁止您操作。请等待后台处理结果。\n' +
  1456. '\n' +
  1457. '\n' +
  1458. '\n' +
  1459. '您也可在后台协助详情页中撤回任务,自行操作!',{icon:5,time:5000});
  1460. }else{
  1461. layer.msg('请先关联答题卡');
  1462. }
  1463. }
  1464. });
  1465. }
  1466. function uploadExamAnswer(ExamGroupId,Subject,Sheet){
  1467. if (!ExamGroupId||!Subject) {
  1468. layer.msg('未找到试卷ID');
  1469. return false;
  1470. }
  1471. $.ajax({
  1472. url:"<?php echo $this->createUrl('third/getthirdsheet');?>",
  1473. type:"POST",
  1474. dataType:"json",
  1475. data:{exam_group_id:ExamGroupId,get_type:2},
  1476. success:function (res) {
  1477. if(res.success==1){
  1478. evaluationClient.loadAnswerParsing(Sheet+','+ExamGroupId+','+Subject);
  1479. }else if(res.success==4){
  1480. layer.msg('您当前已发送答案解析后台协助任务,为避免您产生与后台重复的操作,以造成数据混乱,已禁止您操作。请等待后台处理结果。\n' +
  1481. '\n' +
  1482. '\n' +
  1483. '\n' +
  1484. '您也可在后台协助详情页中撤回任务,自行操作!',{icon:5,time:5000});
  1485. }else{
  1486. layer.msg('请先关联答题卡');
  1487. }
  1488. }
  1489. });
  1490. }
  1491. // tips
  1492. $(".open-tips").on("mouseenter", function () {
  1493. var tips_text = $(this).attr("tipstext");
  1494. layer.tips(tips_text, this, {
  1495. tips: [1, '#14AE68'] //还可配置颜色
  1496. });
  1497. });
  1498. function sendPaperAndAnswer(examGroupId){
  1499. var print_time = $('input[name="english-print-time"]').val();
  1500. var printTime = 0;
  1501. if(print_time){
  1502. var now_time = parseInt(new Date().getTime() / 1000);
  1503. printTime = new Date(print_time).getTime() / 1000;
  1504. if(now_time > printTime){
  1505. layer.msg('期望时间不得小于当前时间');
  1506. return false;
  1507. }
  1508. }else{
  1509. layer.msg('请选择期望时间');
  1510. return false;
  1511. }
  1512. var paperLength = $('.upload-btn-paper').parent().find("input").length;
  1513. var answerLength = $('.upload-btn-answer').parent().find("input").length;
  1514. var paperUrl = {};
  1515. var answerUrl = {};
  1516. var notice = '';
  1517. if(paperLength == 0 && answerLength == 0){
  1518. layer.msg('请上传试卷及答案解析');
  1519. return false;
  1520. }else if(paperLength == 0){
  1521. layer.msg('请上传试卷');
  1522. return false;
  1523. }else if(answerLength == 0){
  1524. layer.msg('请上传答案解析');
  1525. return false;
  1526. }else{
  1527. var uploadFiles = [];
  1528. $(".upload-btn-paper").parent().find("input").each(function(){
  1529. if($(this).val()){
  1530. if($("#"+$(this).attr("id"))[0].files[0].size >8388608){
  1531. // layer.msg("文件过大");
  1532. notice = "文件不能超过8M";
  1533. // alert("文件不能超过8M");
  1534. // return false;
  1535. // location.reload();
  1536. }else{
  1537. uploadFiles.push($(this).attr("id"));
  1538. }
  1539. }
  1540. });
  1541. $(".upload-btn-answer").parent().find("input").each(function(){
  1542. if($(this).val()){
  1543. if($("#"+$(this).attr("id"))[0].files[0].size >8388608){
  1544. notice = "文件不能超过8M";
  1545. // layer.msg("文件过大");
  1546. // alert("文件不能超过8M");
  1547. // return false;
  1548. // location.reload();
  1549. }else{
  1550. uploadFiles.push($(this).attr("id"));
  1551. }
  1552. }
  1553. });
  1554. if(notice != ""){
  1555. layer.msg(notice,{time:2000});
  1556. location.reload();
  1557. return false;
  1558. }
  1559. layer.msg('正在上传,请稍候......',{time:60000});
  1560. uploadFiles.reverse();
  1561. for(var i = 0;i<uploadFiles.length;i++){
  1562. var uploadOne = uploadFiles[i];
  1563. $.ajaxFileUpload({
  1564. url: "<?php echo $this->createUrl('third/uploadEnglishPaper');?>", //用于文件上传的服务器端请求地址
  1565. secureuri: false, //是否需要安全协议,一般设置为false
  1566. fileElementId: uploadOne, //文件上传域的ID
  1567. dataType: 'text', //返回值类型 一般设置为json
  1568. data:{"examGroupId":examGroupId,"uploadOne":uploadOne},
  1569. success: function (data){
  1570. console.log(data);
  1571. var obj = JSON.parse(data);
  1572. if (obj.success == 1) {
  1573. if(obj.answer_url != ''){
  1574. //answerUrl.push(obj.answer_url);
  1575. var idAnswer = obj.uploadOne.replace("paper_answer","");
  1576. answerUrl[idAnswer] = obj.answer_url;
  1577. }
  1578. if(obj.paper_url != ''){
  1579. //paperUrl.push(obj.paper_url);
  1580. var idPaper = obj.uploadOne.replace("paper_exam","");
  1581. paperUrl[idPaper] = obj.paper_url;
  1582. }
  1583. if(Object.keys(answerUrl).length + Object.keys(paperUrl).length == uploadFiles.length){
  1584. jQuery.post(
  1585. '<?php echo $this->createUrl('third/uploadEnglishPaperInsert');?>',
  1586. {"examGroupId":examGroupId,"answerUrl":answerUrl,"paperUrl":paperUrl,"printTime":printTime},
  1587. function(data1){
  1588. var obj1 = JSON.parse(data1);
  1589. console.log(obj1);
  1590. if (obj1.success == 1) {
  1591. layer.msg('上传成功');
  1592. location.reload();
  1593. return false;
  1594. } else {
  1595. layer.msg(obj1.message);
  1596. location.reload();
  1597. return false;
  1598. }
  1599. }
  1600. );
  1601. }
  1602. } else {
  1603. layer.msg(obj.message,{
  1604. icon: 1,
  1605. }, function(){
  1606. layer.closeAll();
  1607. location.reload();
  1608. });
  1609. }
  1610. },
  1611. // error: function (data, status, e){ //服务器响应失败处理函数
  1612. // layer.msg('返回失败!',{
  1613. // icon: 1,
  1614. // }, function(){
  1615. // layer.closeAll();
  1616. // location.reload();
  1617. // });
  1618. // }
  1619. });
  1620. }
  1621. // console.log(answerUrl,paperUrl);
  1622. //
  1623. // answerUrl.push(1);
  1624. // console.log(answerUrl.length);
  1625. // return false;
  1626. // MaskUtil.unmask();
  1627. // location.reload();
  1628. return false;
  1629. }
  1630. }
  1631. // 生成试卷模板
  1632. function createTemplateEnglish (eid,flag){
  1633. if (!eid) {
  1634. layer.msg('未找到考试信息');
  1635. }
  1636. var msg = '';
  1637. if (flag == 12) {
  1638. msg = '您确定要下载答题卡嘛?';
  1639. } else if(flag == 11){
  1640. msg = '您确定要下载试卷嘛?';
  1641. }
  1642. layer.msg(msg, {
  1643. time: 0,
  1644. btn: ['确定', '取消'],
  1645. yes: function(index){
  1646. layer.close(index);
  1647. $.post('<?php echo $this->createUrl('print/createtempelate');?>',{"eid":eid,"flag":flag},function(data){
  1648. var obj = JSON.parse(data);
  1649. if (obj.success == 1) {
  1650. if(flag == 11){
  1651. evaluationClient.CreateSubjectPaperTiGan(JSON.stringify(obj.object));
  1652. }else if(flag == 12){
  1653. evaluationClient.CreateSubjectWordTiKa(JSON.stringify(obj.object));
  1654. }else{
  1655. layer.msg("参数错误");
  1656. }
  1657. } else {
  1658. layer.msg(obj.message);
  1659. }
  1660. });
  1661. }
  1662. });
  1663. }
  1664. //发送/取消/重新发送标注
  1665. var flag = true;
  1666. $(".sendLabelTask").bind("click", function () {
  1667. var examId = jQuery(this).attr("examId");
  1668. var examName = jQuery(this).attr("examName");
  1669. var subjectId = jQuery(this).attr("subjectId");
  1670. var createTime = jQuery(this).attr("createTime");
  1671. var type = jQuery(this).attr("type");
  1672. var status = jQuery(this).attr("status");
  1673. var _this = jQuery(this);
  1674. var isAnswerSheet=$(this).attr('isAnswerSheet');
  1675. var productSwitch=<?php echo $productSwitch?>;
  1676. var isTagging=$(this).attr('isTagging');
  1677. if(productSwitch==3 && type!='cancel' && (subjectId==3 || subjectId==6 || subjectId==51) && isTagging!=1){
  1678. sendLabelForSelectType(examId,examName,subjectId,createTime,type,status,_this);
  1679. return false;
  1680. }
  1681. if (type=='cancel') {
  1682. //取消标注
  1683. layer.msg('本次考试不需要后台老师标注吗?', {
  1684. time: 0,
  1685. btn: ['确定', '取消'],
  1686. yes: function (index) {
  1687. _this.removeClass('sendlabeltask');
  1688. _this.unbind();
  1689. layer.close(index);
  1690. if (flag){
  1691. flag = false;
  1692. jQuery.post(
  1693. "<?php echo $this->createUrl("print/sendlabeltask");?>",
  1694. {"examId": examId, "examName": examName, "createTime": createTime, 'type': type,'status':status,'isTagging':isTagging},
  1695. function (data) {
  1696. data = JSON.parse(data);
  1697. if (data.success == 1) {
  1698. layer.alert('取消成功', {'icon': 1,'closeBtn':0}, function () {
  1699. location.reload();
  1700. });
  1701. }else if (data.success == 2){
  1702. layer.alert(data.message, {'icon': 1,'closeBtn':0}, function () {
  1703. location.reload();
  1704. });
  1705. }
  1706. else {
  1707. flag = true;
  1708. layer.msg(data.message);
  1709. }
  1710. }
  1711. );
  1712. }
  1713. }
  1714. });
  1715. }else{
  1716. if(isAnswerSheet!=1){
  1717. layer.msg('请先关联答题卡');
  1718. return false;
  1719. }
  1720. str=$('#label_win');
  1721. $('.label_remark').val('');
  1722. layer.open({
  1723. title:'发送标注',
  1724. type: 1,
  1725. skin: 'layui-layer-rim', //加上边框
  1726. area: '450px',
  1727. content: str,
  1728. shade: 0.6, //不显示遮罩
  1729. offset: 'auto',
  1730. btn: ['确定','取消'],
  1731. yes:function(){
  1732. estimate=$('.estimate').val();
  1733. remark=$('.label_remark').val();
  1734. if(estimate==''){
  1735. layer.msg('请选择期望完成时间');
  1736. return false;
  1737. }
  1738. if(remark.length>100){
  1739. layer.msg('备注内容不大于100个字符');
  1740. return false;
  1741. }
  1742. if (flag){
  1743. flag = false;
  1744. indexSend=layer.msg('正在发送,请稍候......',{time:0});
  1745. jQuery.post(
  1746. "<?php echo $this->createUrl("print/sendlabeltask");?>",
  1747. {"examId": examId, "examName": examName, "createTime": createTime,'type': type,'status':status,'isTagging':isTagging,remark:remark,estimate:estimate},
  1748. function (data) {
  1749. layer.close(indexSend);
  1750. data = JSON.parse(data);
  1751. if (data.success == 1) {
  1752. layer.msg('发送成功');
  1753. setTimeout(function () {
  1754. location.reload();
  1755. }, 2000);
  1756. }else if (data.success == 2){
  1757. layer.alert(data.message, {'icon': 1,'closeBtn':0}, function () {
  1758. location.reload();
  1759. });
  1760. }
  1761. else {
  1762. flag = true;
  1763. layer.msg(data.message);
  1764. }
  1765. }
  1766. );
  1767. }
  1768. }
  1769. });
  1770. }
  1771. });
  1772. //选择发送发注类型
  1773. function sendLabelForSelectType(examId,examName,subjectId,createTime,type,status,_this){
  1774. var str = '<div id="hgc_editor" style="padding:20px 35px;">\
  1775. <p>选择标注类型</p>\
  1776. <span class="selectSendType selected">题库后台标注</span>\
  1777. <span class="selectSendType">学校自主标注</span>\
  1778. <input type="hidden" name="sendType" value="1">\
  1779. </div>';
  1780. layer.open({
  1781. title:'选择标注类型'
  1782. ,area:'740px'
  1783. ,type: 1
  1784. ,offset: 'auto'
  1785. ,content: str
  1786. ,btn: ['确定','取消']
  1787. ,btnAlign: 'c' //按钮居中
  1788. ,shade: 0.6 //不显示遮罩
  1789. ,yes:function(){
  1790. //确定回调
  1791. var sendType=$('input[name=sendType]').val();
  1792. if(sendType==undefined){
  1793. layer.msg('请选择标注类型')
  1794. }else if(sendType==1){
  1795. var sub_id = $('input[name="subject_id"]').val();
  1796. if (sub_id == 3 || sub_id == 6) {
  1797. var str = '<div id="hgc_editor" style="padding:20px 35px;">\
  1798. <p>请慎重填写该份试卷的备注(可不写)。例如,该年级头几次使用需重视,马上放假需要快速标记等。</p>\
  1799. <textarea style="width:100%;height:200px;resize:vertical;" placeholder="请输入该份试卷的标注要求" class="label-remark"></textarea>\
  1800. </div>';
  1801. layer.open({
  1802. title:'发送标注'
  1803. ,area:'740px'
  1804. ,type: 1
  1805. ,offset: 'auto'
  1806. ,content: str
  1807. ,btn: ['确定','取消']
  1808. ,btnAlign: 'c' //按钮居中
  1809. ,shade: 0.6 //不显示遮罩
  1810. ,yes:function(){
  1811. //确定回调
  1812. sendLabel(examId,examName,createTime,type,status);
  1813. }
  1814. });
  1815. }else{
  1816. sendLabel(examId,examName,createTime,type,status);
  1817. }
  1818. }else if(sendType==2){
  1819. sendLabelToTeacher(examId,type,status)
  1820. }
  1821. }
  1822. });
  1823. }
  1824. //发送标注到题库
  1825. function sendLabel(examId,examName,createTime,type,status) {
  1826. if (flag){
  1827. flag = false;
  1828. indexSend=layer.msg('正在发送,请稍候......',{time:0});
  1829. jQuery.post(
  1830. "<?php echo $this->createUrl("print/sendlabeltask");?>",
  1831. {"examId": examId, "examName": examName, "createTime": createTime,'type': type,'status':status,remark:$(".label-remark").val()},
  1832. function (data) {
  1833. layer.close(indexSend);
  1834. data = JSON.parse(data);
  1835. if (data.success == 1) {
  1836. layer.msg('发送成功');
  1837. setTimeout(function () {
  1838. location.reload();
  1839. }, 2000);
  1840. }else if (data.success == 2){
  1841. layer.alert(data.message, {'icon': 1,'closeBtn':0}, function () {
  1842. location.reload();
  1843. });
  1844. }
  1845. else {
  1846. flag = true;
  1847. layer.msg(data.message);
  1848. }
  1849. }
  1850. );
  1851. }
  1852. }
  1853. //发送标注到教师端
  1854. function sendLabelToTeacher(examId,type,status) {
  1855. if (flag){
  1856. flag = false;
  1857. indexSend=layer.msg('正在发送,请稍候......',{time:0});
  1858. jQuery.post(
  1859. "<?php echo $this->createUrl("print/sendLabelToTeacher");?>",
  1860. {"examId": examId,'type': type,'status':status},
  1861. function (data) {
  1862. layer.close(indexSend);
  1863. data = JSON.parse(data);
  1864. if (data.success == 1) {
  1865. layer.msg('发送成功');
  1866. setTimeout(function () {
  1867. location.reload();
  1868. }, 2000);
  1869. }else if (data.success == 2){
  1870. layer.alert(data.message, {'icon': 1,'closeBtn':0}, function () {
  1871. location.reload();
  1872. });
  1873. }
  1874. else {
  1875. flag = true;
  1876. layer.msg(data.message);
  1877. }
  1878. }
  1879. );
  1880. }
  1881. }
  1882. //扫描在线答题卡
  1883. function createTemplateScanOnline(exam_group_id,obj,exam_name,import_type){
  1884. if (!exam_group_id) {
  1885. layer.msg('未找到试卷ID');
  1886. }
  1887. if($(obj).hasClass('disabled')){
  1888. return false;
  1889. }
  1890. var data={
  1891. exam_group_id:exam_group_id
  1892. }
  1893. $.post("<?php echo Yii::app()->createUrl("print/getOnlineCard")?>",data,function(rs){
  1894. var m = JSON.parse(rs);
  1895. if(m.status==1)
  1896. {
  1897. $(obj).addClass('disabled');
  1898. if(import_type>0){
  1899. evaluationClient.ImportOnLineAnswerCard_M_Subject(exam_group_id+","+exam_name+","+<?php echo Yii::app()->session['session_duoxueke_subject_id']?>);
  1900. }else{
  1901. evaluationClient.OnLineAnswerCard_M_Subject(exam_group_id+","+exam_name+","+<?php echo Yii::app()->session['session_duoxueke_subject_id']?>);
  1902. }
  1903. }else {
  1904. layer.msg('尚未创建在线答题卡,请创建');
  1905. }
  1906. });
  1907. }
  1908. //选择上传试卷类型
  1909. function uploadTemplateForSelectType(eid,name,grade){
  1910. forCheckUrl = "<?php echo $this->createUrl('third/checkanswercard');?>";
  1911. $.post(forCheckUrl,{eid:eid},function(data){
  1912. var obj = JSON.parse(data);
  1913. var subject_id = '<?php echo Yii::app()->session['session_duoxueke_subject_id']?>';
  1914. if(subject_id==12) {
  1915. $('#parse_area').find('.select_upload_mode').eq(0).closest('span').show();
  1916. $('#parse_area').find('.select_upload_mode').eq(1).closest('span').show();
  1917. $('#parse_area').find('.select_upload_mode').eq(2).closest('span').hide();
  1918. $('#parse_area').find('.select_upload_mode').eq(0).click();
  1919. $('#parse_area').find('.p_txt_1').show();
  1920. $('#parse_area').find('.p_txt_2').hide();
  1921. }else if(subject_id==8){
  1922. $('#parse_area').find('.select_upload_mode').eq(0).closest('span').hide();
  1923. $('#parse_area').find('.select_upload_mode').eq(1).closest('span').show();
  1924. $('#parse_area').find('.select_upload_mode').eq(2).closest('span').hide();
  1925. $('#parse_area').find('.select_upload_mode').eq(1).click();
  1926. $('#parse_area').find('.p_txt_1').hide();
  1927. $('#parse_area').find('.p_txt_2').show();
  1928. }else{
  1929. $('#parse_area').find('.select_upload_mode').eq(0).closest('span').show();
  1930. if(obj.math_ai==1){
  1931. $('#parse_area').find('.select_upload_mode').eq(1).closest('span').show();
  1932. }else{
  1933. $('#parse_area').find('.select_upload_mode').eq(1).closest('span').hide();
  1934. }
  1935. $('#parse_area').find('.select_upload_mode').eq(2).closest('span').show();
  1936. $('#parse_area').find('.select_upload_mode').eq(2).attr('eid',eid);
  1937. $('#parse_area').find('.select_upload_mode').eq(2).attr('grade',grade);
  1938. $('#parse_area').find('.select_upload_mode').eq(0).click();
  1939. $('#parse_area').find('.p_txt_1').show();
  1940. $('#parse_area').find('.p_txt_2').hide();
  1941. }
  1942. $('input[name=upload_template_eid]').val(eid);
  1943. if(obj.success==1)
  1944. {
  1945. if(obj.data=='ai' || subject_id==8){
  1946. $('#parse_area').find('.select_upload_mode').eq(1).attr('disabled',false);
  1947. }else{
  1948. $('#parse_area').find('.select_upload_mode').eq(1).attr('disabled',true);
  1949. }
  1950. var str=$('#parse_area');
  1951. layer.open({
  1952. title:'上传试卷',
  1953. type: 1,
  1954. skin: 'layui-layer-rim', //加上边框
  1955. area: '750px',
  1956. content: str,
  1957. shade: 0.6, //不显示遮罩
  1958. offset: 'auto',
  1959. btn: ['确定','取消'],
  1960. yes:function(){
  1961. console.log('1');
  1962. //newUploadWord();
  1963. var uploadType=$('input[name=upload_template_type]').val();
  1964. if(subject_id==12 || subject_id==8 || uploadType==1){
  1965. newUploadWord();
  1966. }else{
  1967. uploadWord();
  1968. }
  1969. }
  1970. });
  1971. }else{
  1972. layer.msg(obj.message,{
  1973. icon: 5
  1974. }, function(){
  1975. layer.closeAll();
  1976. location.reload();
  1977. });
  1978. //layer.msg(obj.message);
  1979. }
  1980. })
  1981. }
  1982. //清空答题卡数据
  1983. function clearAnswerCardData(examGroupId,type){
  1984. var data={
  1985. examGroupId:examGroupId,
  1986. type:type
  1987. }
  1988. $.post("<?php echo Yii::app()->createUrl("print/clearAnswerCard")?>",data,function(rs){
  1989. var m = JSON.parse(rs);
  1990. if(m.status==1)
  1991. {
  1992. $(obj).addClass('disabled');
  1993. evaluationClient.OnLineAnswerCard_M_Subject(exam_group_id+","+exam_name+","+<?php echo Yii::app()->session['session_duoxueke_subject_id']?>);
  1994. }else {
  1995. layer.msg('尚未创建在线答题卡,请创建');
  1996. }
  1997. });
  1998. }
  1999. $('body')
  2000. .on('click','#paper_file_button',function(){
  2001. $('#paper_file').click();
  2002. $('input[name=upload_template_type]').val(1);
  2003. $('.word_file_path').html('');
  2004. $('.word_file').val('');
  2005. })
  2006. .on('click','#parse_file_button',function(){
  2007. $('#parse_file').click();
  2008. $('input[name=upload_template_type]').val(1);
  2009. $('.word_file_path').html('');
  2010. $('.word_file').val('');
  2011. })
  2012. .on('click','#word_file_button',function(){
  2013. $('#word_file').click();
  2014. $('input[name=upload_template_type]').val(2);
  2015. $('.paper_file_path').html('');
  2016. $('.paper_file').val('');
  2017. $('.parse_file_path').html('');
  2018. $('.parse_file').val('');
  2019. })
  2020. .on('change','#paper_file',function(){
  2021. $('.paper_file_path').html($(this).val())
  2022. })
  2023. .on('change','#parse_file',function(){
  2024. $('.parse_file_path').html($(this).val())
  2025. })
  2026. .on('change','#word_file',function(){
  2027. $('.word_file_path').html($(this).val())
  2028. })
  2029. function newUploadWord() {
  2030. var paramEid = $('input[name=upload_template_eid]').val();
  2031. var uploadType=$('input[name=upload_template_type]').val();
  2032. if (!paramEid) {
  2033. layer.msg('没找到考试ID!');
  2034. return false;
  2035. }
  2036. if(uploadType==2){
  2037. var obj_file = $("#word_file").val();
  2038. if (!obj_file) {
  2039. layer.msg('请选择上传文件1');
  2040. return false;
  2041. }
  2042. var extStart = obj_file.lastIndexOf('.');
  2043. var extName = obj_file.substring(extStart,obj_file.length).toLowerCase();
  2044. if (extName != ".docx" && extName != ".dotx" && extName != ".dotm") {
  2045. layer.msg('模板格式有误,请上传dotx格式word!');
  2046. return false;
  2047. }
  2048. fileElementId='word_file';
  2049. }else{
  2050. var paper_file = $("#paper_file").val();
  2051. var parse_file = $("#parse_file").val();
  2052. if (!paper_file) {
  2053. layer.msg('请选择上传文件');
  2054. return false;
  2055. }
  2056. fileElementId=['paper_file','parse_file'];
  2057. var extStart = paper_file.lastIndexOf('.');
  2058. var extName = paper_file.substring(extStart,paper_file.length).toLowerCase();
  2059. if (extName != ".docx" && extName != ".dotx" && extName != ".dotm" && extName != ".pdf") {
  2060. layer.msg('模板格式有误,请上传PDF、WORD!');
  2061. return false;
  2062. }
  2063. if(parse_file){
  2064. var extStart = parse_file.lastIndexOf('.');
  2065. var extName = parse_file.substring(extStart,parse_file.length).toLowerCase();
  2066. if (extName != ".docx" && extName != ".dotx" && extName != ".dotm" && extName != ".pdf" ) {
  2067. layer.msg('模板格式有误,请上传PDF、WORD!');
  2068. return false;
  2069. }
  2070. }
  2071. }
  2072. $.ajaxFileUpload({
  2073. url: "<?php echo $this->createUrl('third/newUploadTpl');?>", //用于文件上传的服务器端请求地址
  2074. secureuri: false, //是否需要安全协议,一般设置为false
  2075. fileElementId: fileElementId, //文件上传域的ID
  2076. dataType: 'text', //返回值类型 一般设置为json
  2077. data:{"eid":paramEid,'uploadType':uploadType},
  2078. success: function (data, status){
  2079. var obj = JSON.parse(data);
  2080. if (obj.success == 1) {
  2081. layer.msg(obj.message,{
  2082. icon: 1,
  2083. }, function(){
  2084. layer.closeAll();
  2085. location.reload();
  2086. });
  2087. $("#alreadUpload").html('<span style="color:red;">已上传</span>');
  2088. } else {
  2089. layer.msg(obj.message,{
  2090. icon: 2,
  2091. }, function(){
  2092. layer.closeAll();
  2093. location.reload();
  2094. });
  2095. }
  2096. },
  2097. error: function (data, status, e){ //服务器响应失败处理函数
  2098. layer.msg('返回失败!',{
  2099. icon: 1,
  2100. }, function(){
  2101. // layer.closeAll();
  2102. // location.reload();
  2103. });
  2104. }
  2105. });
  2106. return false;
  2107. }
  2108. //上传试卷切换
  2109. $('.select_upload_mode').click(function(){
  2110. //console.log($(this).val());
  2111. var checkValue=$(this).val();
  2112. $('.copy_exam_list').hide();
  2113. $('.pa_list').show();
  2114. if(checkValue==1){
  2115. $('.upload_btn_1').show();
  2116. $('.upload_btn_2').hide();
  2117. $('input[name=upload_template_type]').val(2);
  2118. }else if(checkValue==2){
  2119. $('.upload_btn_1').hide();
  2120. $('.upload_btn_2').show();
  2121. $('input[name=upload_template_type]').val(1);
  2122. }else if(checkValue==3){
  2123. //复用试卷
  2124. eid=$(this).attr('eid');
  2125. grade=$(this).attr('grade');
  2126. selectExam(grade,eid);
  2127. $('.copy_exam_list').show();
  2128. $('.pa_list').hide();
  2129. }
  2130. });
  2131. $('.datetimepicker8').datetimepicker({
  2132. onGenerate:function( ct ){
  2133. $(this).find('.xdsoft_date')
  2134. .toggleClass('xdsoft_disabled');
  2135. $(this).find(".xdsoft_today").removeClass('xdsoft_disabled');
  2136. },
  2137. format:'Y-m-d H:i',
  2138. formatDate:'Y-m-d H:i',
  2139. formatTime:'H:i',
  2140. // minDate:'-1970/01/2',
  2141. minDate: '-2022-08-10 00:00',
  2142. maxDate:'+1970/01/2',
  2143. timepicker:true,
  2144. step:10,
  2145. });
  2146. $('.exam_export').click(function(){
  2147. eid=$(this).attr('eid');
  2148. data={examGroupId:eid}
  2149. $.post("<?php echo Yii::app()->createUrl('print/exportExamData')?>",data,function(flags){
  2150. var m = JSON.parse(flags);
  2151. if(m.status==1)
  2152. {
  2153. var html = ""+
  2154. '<div style="padding:20px 30px 0px 30px">'+
  2155. '<div style="padding:8px 0;">请复制下方链接打印包。</div>'+
  2156. '<div id="downloadUrl" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:455px;"></div>'+
  2157. '<div class="row" style="margin:30px auto 0px auto;text-align:center"><button id="confirm" class="label-primary-s bth-s" style="padding:4px 12px;margin:5px 0 10px 15px;background:gray;border-color:gray;">关闭</button>'+
  2158. '</div>'+
  2159. '</div>'+
  2160. "";
  2161. //
  2162. layer.open({
  2163. type: 1,
  2164. area: ['550px', '220px'],
  2165. title: '下载',
  2166. content: html,
  2167. success: function(index, layerObj){
  2168. $(".loading-pop").hide();
  2169. jQuery("#downloadUrl").html('下载地址:<span style=""><input id="url" type="text" size="40" readonly value="'+m.data+'" /></span><button id="copy" class="label-primary-s bth-s" style="padding:4px 12px;margin:5px 0 10px 15px;">全选</button>');
  2170. jQuery("#confirm, #cancel").on("click", function(){
  2171. layer.close(layerObj);
  2172. });
  2173. jQuery("#copy").on("click", function(){
  2174. jQuery("#url").select();
  2175. });
  2176. },
  2177. end: function(){
  2178. }
  2179. });
  2180. return;
  2181. }else if(m.status==2) {
  2182. layer.msg('数据正在生成中,请稍侯点击导出下载');
  2183. }else{
  2184. layer.msg(m.result);
  2185. }
  2186. });
  2187. });
  2188. $('.show_wrong_reason').click(function(){
  2189. txt=$(this).attr('txt');
  2190. layer.msg(txt);
  2191. });
  2192. $('.change-tpl-close').click(function(){
  2193. $('#fieldModalTopic').hide();
  2194. });
  2195. $('.tpl_change').click(function(){
  2196. exam_group_id=$('input[name=tpl_exam_group_id]').val();
  2197. qxk=$('input[name=tpl_qxk]').val();
  2198. subjectid='<?php echo Yii::app()->session['session_duoxueke_subject_id']?>';
  2199. if(qxk=='1'){
  2200. if(subjectid==3 || subjectid==6 || subjectid==51){
  2201. evaluationClient.CreateWholeDisciplineAnswerSheetShuxueNew(0+","+exam_group_id);
  2202. }else{
  2203. evaluationClient.CreateWholeDisciplineAnswerSheetShuxueNew(0+","+exam_group_id+","+subjectid);
  2204. }
  2205. }else{
  2206. $.post("<?php echo Yii::app()->createUrl("third/checkSelectTopicGroup")?>",{exam_group_id:exam_group_id},function(rs){
  2207. var m = JSON.parse(rs);
  2208. if(m.status==1)
  2209. {
  2210. layer.msg('本场考试选做题含有小题,暂不支持切换切割模板!');
  2211. return false;
  2212. }else {
  2213. if(qxk=='1'){
  2214. if(subjectid==3 || subjectid==6 || subjectid==51){
  2215. evaluationClient.CreateWholeDisciplineAnswerSheetShuxueNew(0+","+exam_group_id);
  2216. }else{
  2217. evaluationClient.CreateWholeDisciplineAnswerSheetShuxueNew(0+","+exam_group_id+","+subjectid);
  2218. }
  2219. }else{
  2220. if(subjectid==3 || subjectid==6 || subjectid==51){
  2221. evaluationClient.CreateWholeDisciplineAnswerSheetShuxue(0+","+exam_group_id);
  2222. }else{
  2223. evaluationClient.CreateWholeDisciplineAnswerSheetShuxue(0+","+exam_group_id+","+subjectid);
  2224. }
  2225. }
  2226. }
  2227. });
  2228. }
  2229. });
  2230. $('.tpl_new').click(function(){
  2231. exam_group_id=$('input[name=tpl_exam_group_id]').val();
  2232. qxk=$('input[name=tpl_qxk]').val();
  2233. feedback=$(this).attr('feedback');
  2234. if(feedback==1){
  2235. layer.msg('本场考试不满足重新制作条件!');
  2236. return false;
  2237. }
  2238. subjectid=<?php echo Yii::app()->session['session_duoxueke_subject_id']?>;
  2239. //清空数据
  2240. var data={
  2241. examGroupId:exam_group_id,
  2242. type:1
  2243. }
  2244. layer.msg('正在处理,请稍候。。。。。。');
  2245. $.post("<?php echo Yii::app()->createUrl("third/clearAnswerCard")?>",data,function(rs){
  2246. var m = JSON.parse(rs);
  2247. if(m.status==1)
  2248. {
  2249. layer.closeAll();
  2250. if(qxk=='1'){
  2251. if(subjectid==3 || subjectid==6 || subjectid==51){
  2252. evaluationClient.createAnswerSheetNewQuestion(0+","+exam_group_id);
  2253. }else{
  2254. evaluationClient.createAnswerSheetNewQuestion(0+","+exam_group_id+","+subjectid);
  2255. }
  2256. }else{
  2257. if(subjectid==3 || subjectid==6 || subjectid==51){
  2258. evaluationClient.createAnswerSheet(0+","+exam_group_id);
  2259. }else{
  2260. evaluationClient.createAnswerSheet(0+","+exam_group_id+","+subjectid);
  2261. }
  2262. }
  2263. }else {
  2264. layer.msg('本场考试不满足重新制作条件!');
  2265. return false;
  2266. }
  2267. });
  2268. });
  2269. <?php
  2270. if(YII_ENV=='production'){
  2271. echo 'cardurl="http://zcard.zhixinhuixue.com/";';
  2272. echo 'appId="946004280126791680";';
  2273. }else{
  2274. echo 'cardurl="http://pandora-card.testing.xueping.com/";';
  2275. echo 'appId="939792767984566272";';
  2276. }
  2277. ?>
  2278. $('.card-tools').click(function(){
  2279. eid=$(this).attr('eid');
  2280. $.post("/index.php/third/createSign",{eid:eid},function(rs){
  2281. var m = JSON.parse(rs);
  2282. if(m.status==1)
  2283. {
  2284. url=cardurl+"get_access_token.html?appId="+appId+"&sign="+m.sign+"&timestamp="+m.time+"&certificate="+m.certificate;
  2285. // url=cardurl+"get_access_token.html?appId=946004280126791680&sign="+m.sign+"&timestamp="+m.time+"&certificate="+m.certificate;
  2286. window.location.href=url
  2287. }
  2288. });
  2289. });
  2290. </script>