index.php 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728
  1. <link rel="stylesheet" href="/fonts/fpdf/iconfont.css"/>
  2. <link rel="stylesheet" href="/css/alert.css"/>
  3. <?php $imgUrl = Yii::app()->request->hostInfo;?>
  4. <?php $disableImgUrl = Yii::app()->request->hostInfo.'/images/disable.png';?>
  5. <style>
  6. .color-red{
  7. color: red;
  8. }
  9. .color-green{
  10. color: green;
  11. font-size: 16px;
  12. }
  13. .option-wrap{
  14. margin-top: 20px;
  15. min-width: 600px;
  16. }
  17. .option-name{
  18. display: inline-block;
  19. width: 100px;
  20. vertical-align: top;
  21. margin-top: 10px;
  22. }
  23. .option-con{
  24. display: inline-block;
  25. width: 80%;
  26. min-width: 490px;
  27. padding: 10px;
  28. border: 1px solid #ccc;
  29. }
  30. .option-con-alert{
  31. display: inline-block;
  32. width: 80%;
  33. color:red;
  34. }
  35. .option-con>span{
  36. display: inline-block;
  37. float:left;
  38. margin-right: 20px;
  39. /*line-height: 1rem;*/
  40. cursor: pointer;
  41. }
  42. .option-con-class label{
  43. display: inline-block;
  44. margin-right: 20px;
  45. margin-top: 15px;
  46. }
  47. .active{
  48. color: #619aff;
  49. }
  50. .btn-start{
  51. display: inline-block;
  52. margin-top: 20px;
  53. margin-left: 100px;
  54. padding: 10px 30px;
  55. color: #fff;
  56. background-color: #2977ff;
  57. cursor: pointer;
  58. }
  59. .en-tfb-grade-1{
  60. margin-left: 20px;
  61. }
  62. #selectedUnit,#selectedPaper,#selectedSpecials{
  63. /*display: inline-block;*/
  64. width: 80%;
  65. min-width: 490px;
  66. padding: 10px;
  67. border: 1px solid #ccc;
  68. display: inline-flex;
  69. flex-wrap: wrap;
  70. }
  71. #selectedUnit span,#selectedPaper span,#selectedSpecials span{
  72. position: relative;
  73. padding: 5px;
  74. padding-right: 30px;
  75. border: 1px solid #999;
  76. margin-right: 15px;
  77. margin-bottom: 5px;
  78. }
  79. .delete-icon{
  80. position: absolute;
  81. top: 50%;
  82. right: 5px;
  83. transform: translateY(-50%);
  84. width: 15px;
  85. height: 15px;
  86. background: url(<?php echo $imgUrl.'/images/icon-delect.png';?>) no-repeat center;
  87. background-size: contain;
  88. cursor: pointer;
  89. }
  90. .download-pdf{
  91. margin-right: 280px;
  92. float: right;
  93. background: green;
  94. height: 35px;
  95. width: 100px;
  96. line-height: 35px;
  97. text-align: center;
  98. }
  99. .download-pdf a{
  100. color: white;
  101. }
  102. .type-btn{
  103. float: left;width:35%
  104. }
  105. .type-btn span{
  106. display: inline-block;
  107. width:120px;
  108. line-height: 30px;
  109. border:1px solid #2977ff;
  110. color:#393939;
  111. text-align: center;
  112. }
  113. .type-btn span.active{
  114. color:#fff;
  115. background: #2977ff;
  116. }
  117. .word-group-hidden{
  118. height: 38px;
  119. overflow: hidden;
  120. }
  121. </style>
  122. <div class="main-content-inner">
  123. <!-- 导航栏开始-->
  124. <?php include(Yii::app()->basePath.'/views/layouts/view_production_navigation.php');?>
  125. <!-- 导航栏结束-->
  126. <div class="en-tfb-grade-1">
  127. <h2>e学慧通</h2>
  128. <div class="color-red">
  129. <div style="float: left;width:65%;font-size: 16px;font-weight: bold;color:#666">
  130. <span>当前时间:</span>
  131. <span><?php echo $year;?>年<?php echo $month;?>月第<?php echo $week;?>周</span>
  132. </div>
  133. <div class="type-btn">
  134. <a href="<?php echo $this->createUrl("product/index",array('type'=>1));?>"><span class="<?php echo $type==1?"active":"" ?>" data-type="1">分层作业</span></a>
  135. <a href="<?php echo $this->createUrl("product/index",array('type'=>2));?>"><span class="<?php echo $type==2?"active":"" ?>" data-type="2">个性化学习手册</span></a>
  136. <a href="<?php echo $this->createUrl("product/index",array('type'=>3));?>"><span class="<?php echo $type==3?"active":"" ?>" data-type="3">分层测评卷</span></a>
  137. </div>
  138. </div>
  139. <div class="clear"></div>
  140. <div class="option-wrap mark-papers-type" style="display: <?php echo $type==3?'block;':'none;' ?>;">
  141. <span class="option-name">类型:</span>
  142. <div class="option-con" id="">
  143. <span data-type="1" class="active">同步/一轮</span>
  144. <span data-type="2">高三备考</span>
  145. </div>
  146. </div>
  147. <div class="option-wrap textbook">
  148. <span class="option-name">版本:</span>
  149. <div class="option-con" id="optionEdition">
  150. <?php if(isset($textbooks) && $textbooks):?>
  151. <?php $no =1;?>
  152. <?php foreach($textbooks as $k=>$v):?>
  153. <span code="<?php echo $v['textbook_id'];?>" class="<?php echo $no==1?'active':'';?>"><?php echo $v['textbook_name'];?></span>
  154. <?php $no++;?>
  155. <?php endforeach;?>
  156. <?php endif;?>
  157. </div>
  158. </div>
  159. <div class="option-wrap module" id="lectureBox">
  160. <span class="option-name">模块:</span>
  161. <div class="option-con" id="optionModular">
  162. <?php if(isset($modules) && $modules):?>
  163. <?php $no =1;?>
  164. <?php foreach($modules as $k=>$v):?>
  165. <span code="<?php echo $v['textbook_id'];?>" class="<?php echo $no==1?'active':'';?>"><?php echo $v['textbook_name'];?></span>
  166. <?php $no++;?>
  167. <?php endforeach;?>
  168. <?php endif;?>
  169. </div>
  170. </div>
  171. <div class="option-wrap unit" id="methodBox">
  172. <?php if(in_array(Yii::app()->session['session_duoxueke_subject_id'],array(8))):?>
  173. <span class="option-name">单元:</span>
  174. <?php else:?>
  175. <span class="option-name">章:</span>
  176. <?php endif;?>
  177. <div class="option-con" id="optionUnit">
  178. <?php if(isset($units) && $units):?>
  179. <?php $no =1;?>
  180. <?php foreach($units as $k=>$v):?>
  181. <span code="<?php echo $v['textbook_id'];?>" class="<?php echo $no==1?'active':'';?>"><?php echo $v['textbook_name'];?></span>
  182. <?php $no++;?>
  183. <?php endforeach;?>
  184. <?php endif;?>
  185. </div>
  186. </div>
  187. <!--3层级才显示节-->
  188. <div class="option-wrap chapter" id="methodBox" style="display: <?php echo $level==3?'block;':'none;' ?>;">
  189. <span class="option-name">节:</span>
  190. <div class="option-con" id="optionChapter">
  191. <?php if(isset($chapters) && $chapters):?>
  192. <?php $no =1;?>
  193. <?php foreach($chapters as $k=>$v):?>
  194. <span code="<?php echo $v['textbook_id'];?>" class="<?php echo $no==1?'active':'';?>"><?php echo $v['textbook_name'];?></span>
  195. <?php $no++;?>
  196. <?php endforeach;?>
  197. <?php endif;?>
  198. </div>
  199. </div>
  200. <!--3层级才显示节-->
  201. <div class="option-wrap layout-paper-type" style="display:none;">
  202. <span class="option-name">类别:</span>
  203. <div class="option-con" >
  204. <?php if(isset($productDetails) && $productDetails):?>
  205. <?php $no =1;?>
  206. <?php foreach($productDetails as $k=>$v):?>
  207. <span data-pc-id="<?php echo $v['pc_id'];?>" class="<?php echo $no==1?'active':'';?>"><?php echo $v['pc_name'];?></span>
  208. <?php $no++;?>
  209. <?php endforeach;?>
  210. <?php endif;?>
  211. </div>
  212. </div>
  213. <div class="option-wrap layout-paper-paper" style="display:none;">
  214. <span class="option-name">试卷:</span>
  215. <div class="option-con word-group-hidden" style="position: relative;" id="allTeacherWord">
  216. <?php if(isset($productDetails) && $productDetails):?>
  217. <?php $no =1;$num=1;?>
  218. <?php foreach($productDetails as $k=>$item):?>
  219. <?php foreach($item['urls'] as $val):?>
  220. <span style="display:<?php echo $no==1?"inline-block;":"none;" ?>" data-pc-id="<?php echo $item['pc_id']; ?>" class="paper-info ">
  221. <input type="radio" name="file_url" value="<?php echo $val['file_url']; ?>" <?php echo $num==1?"checked":"" ?>>&nbsp;&nbsp;
  222. <span class="teacher-word-group"><?php echo $val['file_name']; ?></span>
  223. </span>
  224. <?php $num++;?>
  225. <?php endforeach; ?>
  226. <?php $no++;?>
  227. <?php endforeach;?>
  228. <?php endif;?>
  229. <div style="cursor:pointer;position: absolute;right: 5px;top: 5px;color: green;" id="show-teacher-word" is-hold="1" onclick="isHold()">展开</div>
  230. </div>
  231. </div>
  232. <div class="option-wrap">
  233. <span class="option-name">班级:</span>
  234. <div class="option-con">
  235. <div>
  236. <select name="grade" class="select-grade">
  237. <option value="1" <?php if(isset($setting['grade']) && $setting['grade']==1) echo 'selected';?>>高一</option>
  238. <option value="2" <?php if(isset($setting['grade']) && $setting['grade']==2) echo 'selected';?>>高二</option>
  239. <option value="3" <?php if(isset($setting['grade']) && $setting['grade']==3) echo 'selected';?>>高三</option>
  240. </select>
  241. </div>
  242. <div class="option-con-class" id="optionClass">
  243. </div>
  244. </div>
  245. </div>
  246. <div class="option-wrap" style="margin-top:10px;">
  247. <span class="option-name"></span>
  248. <div class="option-con-alert">
  249. 为正常使用本产品,请先上传一次考试成绩并等待1-2天大数据同步完成,如无成绩数据或成绩数据未完全同步的学生则默认为B档!
  250. </div>
  251. </div>
  252. <button class="btn-start" id="confirm" active="true">生成并下载</>
  253. </div>
  254. </div>
  255. <script src="/js/jquery.ajaxfileupload.js"></script>
  256. <script type="text/javascript">
  257. var level="<?php echo $level; ?>";
  258. var subjectId="<?php echo $subjectId; ?>";
  259. $(document).ready(function () {
  260. getClassByGrade(1);
  261. var optionData={
  262. edition:0,
  263. modular:0,
  264. unit:0,
  265. class:[],
  266. }
  267. // 版本点击
  268. $("#optionEdition>span").on("click", function(event) {
  269. if(!limitUnit()){
  270. layer.msg('已选单元超出限制');return false;
  271. }
  272. $("#optionEdition>span").removeClass('active')
  273. $(this).addClass('active');
  274. var code = $(this).attr("code");
  275. optionData.edition=code;
  276. console.log('版本',code)
  277. });
  278. //
  279. $("body").delegate("#optionEdition span", "click", function() {
  280. if(!limitUnit()){
  281. layer.msg('已选单元超出限制');return false;
  282. }
  283. // $('#optionEdition span').on("click", function(event) {
  284. var textbookId = $(this).attr("code");
  285. if(textbookId){
  286. $.ajax({
  287. url: "<?php echo $this->createUrl('print/ajaxNewGetModuleAndUnit');?>",
  288. type: "POST",
  289. dataType: "json",
  290. data: {
  291. version_id: textbookId,
  292. query_type:2
  293. },
  294. success: function (data) {
  295. console.log(data);
  296. if(data.status!=1){
  297. layer.msg('请求失败');return false;
  298. }
  299. var htmlModule = '';
  300. var htmlUnit = '';
  301. var htmlChapter = '';
  302. if(data.data.modules){
  303. var a = 1;
  304. for(var i in data.data.modules){
  305. var module=data.data.modules[i];
  306. if(a == 1){
  307. htmlModule += '<span code="'+module.textbook_id+'" class="active">'+module.textbook_name+'</span>';
  308. }else{
  309. htmlModule += '<span code="'+module.textbook_id+'">'+module.textbook_name+'</span>';
  310. }
  311. a++;
  312. }
  313. }
  314. if(data.data.units){
  315. var a = 1;
  316. for(var i in data.data.units){
  317. var unit=data.data.units[i];
  318. if(a == 1){
  319. htmlUnit += '<span code="'+unit.textbook_id+'" class="active">'+unit.textbook_name+'</span>';
  320. }else{
  321. htmlUnit += '<span code="'+unit.textbook_id+'">'+unit.textbook_name+'</span>';
  322. }
  323. a++;
  324. }
  325. }
  326. if(data.data.chapters){
  327. var a = 1;
  328. for(var i in data.data.chapters){
  329. var chapter=data.data.chapters[i];
  330. if(a == 1){
  331. htmlChapter += '<span code="'+unit.textbook_id+'" class="active">'+chapter.textbook_name+'</span>';
  332. }else{
  333. htmlChapter += '<span code="'+unit.textbook_id+'">'+chapter.textbook_name+'</span>';
  334. }
  335. a++;
  336. }
  337. }
  338. $('#optionModular').html(htmlModule);
  339. $('#optionUnit').html(htmlUnit);
  340. $('#optionChapter').html(htmlChapter);
  341. }
  342. });
  343. }
  344. })
  345. $("body").delegate("#optionModular span", "click", function() {
  346. if(!limitUnit()){
  347. layer.msg('已选单元超出限制');return false;
  348. }
  349. $("#optionModular>span").removeClass('active')
  350. $(this).addClass('active');
  351. var code = $(this).attr("code");
  352. optionData.modular=code;
  353. // $('#optionModular span').on("click", function(event) {
  354. var moduleId = $(this).attr("code");
  355. var textbookId = $('#optionEdition span.active').attr("code");
  356. if(textbookId && moduleId){
  357. $.ajax({
  358. url: "<?php echo $this->createUrl('print/AjaxNewGetUnitAndChapters');?>",
  359. type: "POST",
  360. dataType: "json",
  361. data: {
  362. version_id: textbookId,
  363. module_id:moduleId,
  364. query_type:2
  365. },
  366. success: function (data) {
  367. console.log(data);
  368. if(data.status!=1){
  369. layer.msg('请求失败');return false;
  370. }
  371. var htmlUnit = '';
  372. var htmlChapter = '';
  373. if(data.data.units){
  374. var a = 1;
  375. for(var i in data.data.units){
  376. var unit=data.data.units[i];
  377. if(a == 1){
  378. htmlUnit += '<span code="'+unit.textbook_id+'" class="active">'+unit.textbook_name+'</span>';
  379. }else{
  380. htmlUnit += '<span code="'+unit.textbook_id+'">'+unit.textbook_name+'</span>';
  381. }
  382. a++;
  383. }
  384. }
  385. if(data.data.chapters){
  386. var a = 1;
  387. for(var i in data.data.chapters){
  388. var chapter=data.data.chapters[i];
  389. if(a == 1){
  390. htmlChapter += '<span code="'+chapter.textbook_id+'" class="active">'+chapter.textbook_name+'</span>';
  391. }else{
  392. htmlChapter += '<span code="'+chapter.textbook_id+'">'+chapter.textbook_name+'</span>';
  393. }
  394. a++;
  395. }
  396. }
  397. $('#optionUnit').html(htmlUnit);
  398. $('#optionChapter').html(htmlChapter);
  399. }
  400. });
  401. }
  402. })
  403. $("body").delegate("#optionUnit span","click",function () {
  404. $("#optionUnit>span").removeClass('active')
  405. $(this).addClass('active');
  406. var code = $(this).attr("code");
  407. optionData.modular=code;
  408. // $('#optionModular span').on("click", function(event) {
  409. var moduleId = $(this).attr("code");
  410. var textbookId = $('#optionEdition span.active').attr("code");
  411. if(textbookId && moduleId){
  412. $.ajax({
  413. url: "<?php echo $this->createUrl('print/ajaxNewGetChapters');?>",
  414. type: "POST",
  415. dataType: "json",
  416. data: {
  417. version_id: textbookId,
  418. module_id:moduleId,
  419. query_type:2
  420. },
  421. success: function (data) {
  422. console.log(data);
  423. if(data.status!=1){
  424. layer.msg('请求失败');return false;
  425. }
  426. var htmlChapter = '';
  427. if(data.data.chapters){
  428. var a = 1;
  429. for(var i in data.data.chapters){
  430. var chapter=data.data.chapters[i];
  431. if(a == 1){
  432. htmlChapter += '<span code="'+chapter.textbook_id+'" class="active">'+chapter.textbook_name+'</span>';
  433. }else{
  434. htmlChapter += '<span code="'+chapter.textbook_id+'">'+chapter.textbook_name+'</span>';
  435. }
  436. a++;
  437. }
  438. }
  439. $('#optionChapter').html(htmlChapter);
  440. }
  441. });
  442. }
  443. });
  444. $("body").delegate("#optionChapter span","click",function () {
  445. $("#optionChapter>span").removeClass('active')
  446. $(this).addClass('active');
  447. })
  448. $('.select-grade').change(function(){
  449. var grade = $(this).val();
  450. console.log(grade);
  451. getClassByGrade(grade);
  452. });
  453. function getClassByGrade(grade){
  454. if(grade){
  455. $.ajax({
  456. url: "<?php echo $this->createUrl('product/ajaxGetClasses');?>",
  457. type: "POST",
  458. dataType: "json",
  459. data: {
  460. grade: grade,
  461. },
  462. beforeSend:function(){
  463. layer.load(1, {
  464. shade: [0.1,'#fff'] //0.1透明度的白色背景
  465. });
  466. },
  467. success: function (data) {
  468. var index = layer.load();
  469. layer.close(index);
  470. var html = '';
  471. if(data && data.length > 0){
  472. for(var i in data){
  473. html +='<label>';
  474. html += ' <input type="checkbox" name="option-class" value="'+data[i].class_id+'" status="0">'+data[i].class_name + '</span></label>';
  475. }
  476. }
  477. $('#optionClass').html(html);
  478. }
  479. });
  480. }
  481. }
  482. //分层测评卷 类型切换
  483. $(".mark-papers-type .option-con span").click(function(){
  484. var type=$(this).attr('data-type');
  485. if(type==1){
  486. $('.textbook').show();
  487. $('.module').show();
  488. $('.unit').show();
  489. $('.layout-paper-type').hide();
  490. $('.layout-paper-paper').hide();
  491. }else{
  492. $('.textbook').hide();
  493. $('.module').hide();
  494. $('.unit').hide();
  495. $('.layout-paper-type').show();
  496. $('.layout-paper-paper').show();
  497. }
  498. $('.mark-papers-type .option-con span').removeClass('active');
  499. $(this).addClass("active");
  500. })
  501. //分层测评卷点击类别
  502. $(".layout-paper-type .option-con span").click(function(){
  503. $('.layout-paper-type .option-con span').removeClass('active');
  504. $(this).addClass("active");
  505. var pcId=$(this).attr('data-pc-id');
  506. var papers=$(".layout-paper-paper .paper-info ");
  507. var num=1;
  508. for(var i=0;i<papers.length;i++){
  509. var itemPcId=$(papers[i]).attr('data-pc-id')
  510. $(papers[i]).find('input').prop("checked",false);
  511. if(pcId==itemPcId){
  512. $(papers[i]).show();
  513. if(num==1){
  514. $(papers[i]).find('input').prop("checked",true);
  515. }
  516. num++;
  517. }else{
  518. $(papers[i]).hide();
  519. }
  520. }
  521. });
  522. //生成并下载
  523. $("#confirm[active='true']").on("click", function() {
  524. $('#confirm').attr('disabled','disabled');
  525. var This = $(this);
  526. This.attr("active","false");
  527. var error = [];
  528. var selectClassIds = [];
  529. var selectClassIdsStr='';
  530. var type=parseInt($(".color-red .type-btn span.active").attr('data-type'));
  531. var textbookId=parseInt($(".textbook .option-con span.active").attr('code'));
  532. var moduleId=parseInt($(".module .option-con span.active").attr('code'));
  533. var unitId=parseInt($(".unit .option-con span.active").attr('code'));
  534. var unitName=$(".unit .option-con span.active").text();
  535. var chapterId=parseInt($(".chapter .option-con span.active").attr('code'));
  536. var chapterName=$(".chapter .option-con span.active").text();
  537. var grade = parseInt($('.select-grade').val());
  538. $('#optionClass input:checked').each(function(k,v){
  539. if($(this).attr("status") == 0){
  540. selectClassIds.push($(this).val());
  541. selectClassIdsStr+=$(this).val()+",";
  542. }
  543. });
  544. var markPaperType=parseInt($(".mark-papers-type .option-con span.active").attr('data-type'));
  545. var layoutType=parseInt($(".layout-paper-type .option-con span.active").attr('data-pc-id'));
  546. var layoutPaper=$(".layout-paper-paper .option-con input[name='file_url']:checked").val();
  547. var layoutPaperName=$(".layout-paper-paper .option-con input[name='file_url']:checked").next().text();
  548. if(selectClassIds.length == 0){
  549. error.push("请选择班级");
  550. }
  551. if(grade <= 0 || !grade){
  552. error.push("请选择年级");
  553. }
  554. if(type!=1 && type!=2 && type!=3){
  555. error.push("请选择分层作业或个性化学习手册或分层测评卷");
  556. }
  557. if(type==1 || type==2 || (type==3 && markPaperType==1)){
  558. if(!textbookId){
  559. error.push("版本数据为空");
  560. }
  561. if(!moduleId){
  562. error.push("模块数据为空");
  563. }
  564. if(!unitId){
  565. error.push('单元数据不能为空');
  566. }
  567. if(!unitName){
  568. error.push('获取单元名称失败');
  569. }
  570. if(level==3 && !chapterId){
  571. error.push( '节数据不能为空');
  572. }
  573. if(level==3 && !chapterName){
  574. error.push( '获取节名称失败');
  575. }
  576. layoutType=0;layoutPaper='';layoutPaperName='';
  577. if(type==1 || type==2){
  578. markPaperType=0;
  579. }
  580. //只有2层级目录时单元为0
  581. if(level==2){
  582. chapterId=0;
  583. }
  584. }
  585. if(type==3 && (markPaperType!=1 && markPaperType!=2)){
  586. error.push( '分层测评卷时请选择同步/一轮或高三备考');
  587. }
  588. if(type==3 && markPaperType==2){
  589. if(!markPaperType){
  590. error.push( '分层测评卷类型不能为空');
  591. }
  592. if(!layoutType){
  593. error.push( '分层测评卷类别不能为空');
  594. }
  595. if(!layoutPaper){
  596. error.push('分层测评卷-高三备考试卷不能为空');
  597. }
  598. if(!layoutPaperName){
  599. error.push('分层测评卷-获取高三备考试卷名称失败');
  600. }
  601. textbookId=moduleId=unitId=chapterId=0;
  602. }
  603. if(error.length == 0){
  604. $.ajax({
  605. url: "<?php echo $this->createUrl('product/ajaxSaveSetting');?>",
  606. type: "POST",
  607. dataType: "json",
  608. data: {
  609. type: type,//类型 1分层作业 2个性化学习手册 3分层测评卷
  610. textbookId:textbookId,//版本
  611. moduleId:moduleId,//模块
  612. unitId:unitId,//单元
  613. chapterId:chapterId,//节
  614. grade:grade,//年级
  615. selectClassIds:selectClassIds,//班级
  616. markPaperType:markPaperType,//分层测评卷类型
  617. layoutType:layoutType,//分层测评卷类别
  618. layoutPaper:layoutPaper,//分层测评卷试卷
  619. level:level,//层级
  620. unitName:unitName,
  621. chapterName:chapterName,
  622. layoutPaperName:layoutPaperName
  623. },
  624. success: function (data) {
  625. if(data.status == 1){
  626. selectClassIdsStr = selectClassIdsStr.substr(0, selectClassIdsStr.length-1);
  627. unitName=replaceStr(unitName);
  628. chapterName=replaceStr(chapterName);
  629. layoutPaperName=replaceStr(layoutPaperName);
  630. url = "<?php echo $this->createUrl("product/exportExcel")?>?type="+type+"&unitId="+unitId+"&unitName="+unitName+"&chapterId="+chapterId+"&chapterName="+chapterName+"&grade="+grade+"&markPaperType="+markPaperType+"&layoutType="+layoutType+"&layoutPaper="+layoutPaper+"&layoutPaperName="+layoutPaperName+"&level="+level+"&selectClassIds="+selectClassIdsStr;
  631. location.href=url;
  632. layer.msg("生成并下载成功");
  633. $('#optionClass input:checked').each(function(k,v){
  634. $(this).prop("checked",false);
  635. });
  636. }else{
  637. layer.msg(data.error.join('</br>'));
  638. This.attr("active","true");
  639. }
  640. $('#confirm').removeAttr('disabled');
  641. }
  642. });
  643. }else{
  644. $('#confirm').removeAttr('disabled');
  645. This.attr("active","true");
  646. layer.msg(error.join('</br>'));
  647. }
  648. });
  649. function replaceStr(str){
  650. /*str = str.replace(/\|/g,",");
  651. str = str.replace(/\、/g,",");
  652. str = str.replace(/\\/g,",");
  653. str = str.replace(/\;/g,",");
  654. str = str.replace(/\;/g,",");
  655. str = str.replace(/\</g,",");
  656. str = str.replace(/\>/g,",");
  657. str = str.replace(/\//g,",");
  658. str = str.replace(/\&/g,",");
  659. str = str.replace(/\,/g,",");
  660. str = str.replace(/\#/g,",");*/
  661. reg=/\||、|\\|;|\;|<|>|\/|&|,|#/g;
  662. str=str.replace(reg,",");
  663. return str;
  664. }
  665. });
  666. function limitUnit() {
  667. var selected_count = $("#selectedUnit").children("span").length;
  668. if(selected_count==1){
  669. return false;
  670. }
  671. return true;
  672. }
  673. //展开或收起
  674. function isHold() {
  675. var is_hold = $('#show-teacher-word').attr('is-hold');
  676. if(is_hold == 0){
  677. $('#show-teacher-word').attr('is-hold', 1);
  678. $('#allTeacherWord').addClass('word-group-hidden');
  679. $('#show-teacher-word').html('展开');
  680. }else {
  681. $('#show-teacher-word').attr('is-hold', 0);
  682. $('#allTeacherWord').removeClass('word-group-hidden');
  683. $('#show-teacher-word').html('收起');
  684. }
  685. }
  686. </script>