mrv_setting.php 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774
  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. <style>
  5. .color-red{
  6. color: red;
  7. }
  8. .en-tfb-grade-1 .date>span{
  9. margin-right: 40px;
  10. }
  11. .option-wrap{
  12. margin-top: 20px;
  13. min-width: 600px;
  14. }
  15. .option-name{
  16. display: inline-block;
  17. width: 100px;
  18. vertical-align: top;
  19. margin-top: 10px;
  20. }
  21. .option-con{
  22. display: inline-block;
  23. width: 80%;
  24. min-width: 490px;
  25. padding: 10px;
  26. border: 1px solid #ccc;
  27. }
  28. .option-con>span{
  29. display: inline-block;
  30. margin-right: 20px;
  31. line-height: 1rem;
  32. cursor: pointer;
  33. }
  34. .select-grade{
  35. width: 150px;
  36. line-height: 30px;
  37. margin-bottom: 10px;
  38. }
  39. .option-con-class label{
  40. display: inline-block;
  41. margin-right: 20px;
  42. }
  43. .active{
  44. color: #2977ff;
  45. }
  46. .btn-start{
  47. display: inline-block;
  48. margin-top: 20px;
  49. margin-left: 100px;
  50. padding: 10px 30px;
  51. color: #fff;
  52. background-color: #2977ff;
  53. cursor: pointer;
  54. }
  55. .en-tfb-grade-1{
  56. margin-left: 20px;
  57. }
  58. #selectedUnit{
  59. display: inline-block;
  60. width: 80%;
  61. min-width: 490px;
  62. padding: 10px;
  63. border: 1px solid #ccc;
  64. }
  65. #selectedUnit span{
  66. position: relative;
  67. padding: 5px;
  68. padding-right: 30px;
  69. border: 1px solid #999;
  70. margin-right: 15px;
  71. }
  72. .delete-icon{
  73. position: absolute;
  74. top: 50%;
  75. right: 5px;
  76. transform: translateY(-50%);
  77. width: 15px;
  78. height: 15px;
  79. background: url(<?php echo $imgUrl.'/images/icon-delect.png';?>) no-repeat center;
  80. background-size: contain;
  81. cursor: pointer;
  82. }
  83. .p-one-level{
  84. margin-left: 5%;
  85. }
  86. .p-two-level{
  87. margin-left: 8%;
  88. }
  89. .option-wrap-content{
  90. margin-left: 10%;
  91. }
  92. .option-wrap-content .option-con{
  93. border-color: #2977ff;
  94. width: auto;
  95. min-width: 250px;
  96. }
  97. </style>
  98. <div class="main-content-inner">
  99. <!-- 导航栏开始-->
  100. <?php include(Yii::app()->basePath.'/views/layouts/view_production_navigation.php');?>
  101. <!-- 导航栏结束-->
  102. <div class="en-tfb-grade-1">
  103. <h2>课本同步词汇自定义生成</h2>
  104. <p class="color-red">提示:每个班级每周最多生成3个单元,请根据班级的实际上课进度生成</p>
  105. <p class="date">
  106. <span>当前时间:</span>
  107. <span><?php echo $year;?>年<?php echo $month;?>月第<?php echo $week;?>周</span>
  108. </p>
  109. <div class="option-wrap">
  110. <span class="option-name">班级:</span>
  111. <div class="option-con">
  112. <div>
  113. <select name="grade" class="select-grade">
  114. <option value="1" selected>高一</option>
  115. <option value="2">高二</option>
  116. <!-- <option value="3">高三</option>-->
  117. </select>
  118. </div>
  119. <div class="option-con-class" id="optionClass">
  120. </div>
  121. </div>
  122. </div>
  123. <div class="option-wrap">
  124. <span class="option-name">版本:</span>
  125. <div class="option-con" id="optionEdition">
  126. <?php if(isset($textbookNames) && $textbookNames):?>
  127. <?php $no =1;?>
  128. <?php foreach($textbookNames as $k=>$v):?>
  129. <span code="<?php echo $k;?>" class="<?php echo $no==1?'active':'';?>"><?php echo $v;?></span>
  130. <?php $no++;?>
  131. <?php endforeach;?>
  132. <?php endif;?>
  133. </div>
  134. </div>
  135. <div class="option-wrap">
  136. <span class="option-name">模块:</span>
  137. <div class="option-con" id="optionModular">
  138. <?php if(isset($moduleNames) && $moduleNames):?>
  139. <?php $no =1;?>
  140. <?php foreach($moduleNames as $k=>$v):?>
  141. <span code="<?php echo $k;?>" class="<?php echo $no==1?'active':'';?>"><?php echo $v;?></span>
  142. <?php $no++;?>
  143. <?php endforeach;?>
  144. <?php endif;?>
  145. </div>
  146. </div>
  147. <div class="option-wrap">
  148. <span class="option-name">单元:</span>
  149. <div class="option-con" id="optionUnit">
  150. <?php if(isset($unitNames) && $unitNames):?>
  151. <?php $no =1;?>
  152. <?php foreach($unitNames as $k=>$v):?>
  153. <span code="<?php echo $k;?>" class="<?php echo $no==1?'active':'';?>"><?php echo $v;?></span>
  154. <?php $no++;?>
  155. <?php endforeach;?>
  156. <?php endif;?>
  157. </div>
  158. </div>
  159. <div class="option-wrap">
  160. <span class="option-name">已选单元:</span>
  161. <div id="selectedUnit">
  162. </div>
  163. </div>
  164. <div class="option-wrap">
  165. <span class="option-name">下载方式:</span>
  166. <div class="option-con">
  167. <span><input type="radio" name="is_answer_separate" value="1" checked="checked">分离题目和答案</span>
  168. <span><input type="radio" name="is_answer_separate" value="0">合并题目和答案</span>
  169. </div>
  170. </div>
  171. <div class="option-wrap" style="display: none">
  172. <span class="option-name">班级间内容:</span>
  173. <div class="option-con">
  174. <span><input type="radio" name="is_same_answer" value="1" checked="checked">答案相同</span>
  175. <span><input type="radio" name="is_same_answer" value="0" >答案不同</span>
  176. </div>
  177. </div>
  178. <p style="margin-top:10px;background-color: #2977ff;color:white;height: 40px;line-height:40px;min-width: 600px;width: 85%;">
  179. <span style="float: left;margin-left: 20px;">内容自定义</span>
  180. <span style="float: right;margin-right: 20px;"> *产品设置未打开部分,设置将无效。</span></p>
  181. <p class="p-one-level">1. 词汇自测</p>
  182. <p class="p-two-level">1.1 核心单词/全单元词汇</p>
  183. <div class="option-wrap option-wrap-content">
  184. <span class="option-name">数量:</span>
  185. <div class="option-con">
  186. <span><input style="width: 50px;" name="words_count" type="text" value=30>(<i id="word_total">0</i>)个(1-100)</span>
  187. </div>
  188. </div>
  189. <div class="option-wrap option-wrap-content">
  190. <span class="option-name">范围:</span>
  191. <div class="option-con">
  192. <span><input type="radio" name="words_range" value=1 checked="checked">核心词汇</span>
  193. <span><input type="radio" name="words_range" value=2>全单元单词</span>
  194. </div>
  195. </div>
  196. <div class="option-wrap option-wrap-content">
  197. <span class="option-name">形式:</span>
  198. <div class="option-con">
  199. <span><input type="radio" name="words_type" value="1" checked="checked">汉译英</span>
  200. <span><input type="radio" name="words_type" value="2">英译汉</span>
  201. <span><input type="radio" name="words_type" value="3">中英互译</span>
  202. </div>
  203. </div>
  204. <div class="option-wrap option-wrap-content">
  205. <span class="option-name">派生:</span>
  206. <div class="option-con">
  207. <span><input type="radio" name="is_word_derive" value=1 checked="checked">有</span>
  208. <span><input type="radio" name="is_word_derive" value=0>无</span>
  209. </div>
  210. </div>
  211. <p class="p-two-level">1.2 词汇运用</p>
  212. <div class="option-wrap option-wrap-content">
  213. <span class="option-name">题数(0~20):</span>
  214. <div class="option-con">
  215. <span>单词拼写&nbsp;<input style="width: 50px;" name="spell_count" type="text">&nbsp;题</span>
  216. <span>完成句子&nbsp;<input style="width: 50px;" name="sentence_count" type="text">&nbsp;题</span>
  217. <span>单句语法填空&nbsp;<input style="width: 50px;" name="blank_count" type="text">&nbsp;题</span>
  218. <span>单句翻译&nbsp;<input style="width: 50px;" name="translate_count" type="text">&nbsp;题</span>
  219. </div>
  220. </div>
  221. <p class="p-two-level">1.3 重点短语</p>
  222. <div class="option-wrap option-wrap-content">
  223. <span class="option-name">数量:</span>
  224. <div class="option-con">
  225. <span><input style="width: 50px;" name="phrase_count" type="text" value=20>(<i id="phrase_total">0</i>)个</span>
  226. </div>
  227. </div>
  228. <div class="option-wrap option-wrap-content">
  229. <span class="option-name">形式:</span>
  230. <div class="option-con">
  231. <span><input type="radio" name="phrase_type" value="1" checked="checked">汉译英</span>
  232. <span><input type="radio" name="phrase_type" value="2">英译汉</span>
  233. </div>
  234. </div>
  235. <p class="p-one-level">2. 语法聚焦</p>
  236. <p class="p-two-level">2.1 单句语法填空</p>
  237. <div class="option-wrap option-wrap-content">
  238. <span class="option-name">题数:</span>
  239. <div class="option-con">
  240. <span><input style="width: 50px;" name="grammar_single_count" type="text">&nbsp;题(0-20)个</span>
  241. </div>
  242. </div>
  243. <p class="p-two-level">2.2 语法填空</p>
  244. <div class="option-wrap option-wrap-content">
  245. <span class="option-name">篇数:</span>
  246. <div class="option-con">
  247. <span><input style="width: 50px;" name="grammar_sheet_count" type="text">&nbsp;题(0-3)篇</span>
  248. </div>
  249. </div>
  250. <p class="p-one-level">3. 外刊泛读</p>
  251. <div class="option-wrap option-wrap-content">
  252. <span class="option-name">篇数:</span>
  253. <div class="option-con">
  254. <span><input style="width: 50px;" name="reading_count" type="text">&nbsp;题(0-3)篇</span>
  255. </div>
  256. </div>
  257. <button class="btn-start" id="confirm" active="true">开始生成</>
  258. </div>
  259. </div>
  260. <script src="/js/jquery.ajaxfileupload.js"></script>
  261. <script type="text/javascript">
  262. $(document).ready(function () {
  263. getClassByGrade(1);
  264. $("input[name='words_count']").val(20);
  265. var optionData={
  266. edition:0,
  267. modular:0,
  268. unit:0,
  269. class:[],
  270. }
  271. //获取版本模块单元
  272. // 版本点击
  273. $("#optionEdition>span").on("click", function(event) {
  274. if(!limitUnit()){
  275. layer.msg('已选单元超出限制');return false;
  276. }
  277. $("#optionEdition>span").removeClass('active')
  278. $(this).addClass('active');
  279. var code = $(this).attr("code");
  280. optionData.edition=code;
  281. console.log('版本',code)
  282. });
  283. // 模块点击
  284. $("#optionModular>span").on("click", function(event) {
  285. if(!limitUnit()){
  286. layer.msg('已选单元超出限制');return false;
  287. }
  288. $("#optionModular>span").removeClass('active')
  289. $(this).addClass('active');
  290. var code = $(this).attr("code");
  291. optionData.modular=code;
  292. console.log('模块',code)
  293. });
  294. // 单元点击
  295. $("body").delegate("#optionUnit>span", "click", function() {
  296. if(!limitUnit()){
  297. layer.msg('已选单元超出限制');return false;
  298. }
  299. // $("#optionUnit>span").on("click", function(event) {
  300. $("#optionUnit>span").removeClass('active')
  301. $(this).addClass('active');
  302. var code = $(this).attr("code");
  303. optionData.unit=code;
  304. console.log('单元',code)
  305. });
  306. // 选择年级
  307. $(".select-grade").change(function() {
  308. console.log($(this).val())
  309. });
  310. // 单选按钮
  311. $("input[name='option-class']").change(function() {
  312. getsClassSelected();
  313. });
  314. function getsClassSelected() {
  315. optionData.class=[];
  316. var selectedData = $("input[name='option-class']:checked"); //获取所以选中学生
  317. for (var i = 0; i < selectedData.length; i++) {
  318. code = $(selectedData[i]).val();
  319. optionData.class.push(code);
  320. }
  321. };
  322. //
  323. $("body").delegate("#optionEdition span", "click", function() {
  324. if(!limitUnit()){
  325. layer.msg('已选单元超出限制');return false;
  326. }
  327. // $('#optionEdition span').on("click", function(event) {
  328. var textbookId = $(this).attr("code");
  329. if(textbookId){
  330. $.ajax({
  331. url: "<?php echo $this->createUrl('print/ajaxWeekGetModuleAndUnit');?>",
  332. type: "POST",
  333. dataType: "json",
  334. data: {
  335. textbookId: textbookId
  336. },
  337. success: function (data) {
  338. console.log(data);
  339. var htmlModule = '';
  340. var htmlUnit = '';
  341. if(data.moduleNames){
  342. var a = 1;
  343. for(var i in data.moduleNames){
  344. if(a == 1){
  345. htmlModule += '<span code="'+i+'" class="active">'+data.moduleNames[i]+'</span>';
  346. }else{
  347. htmlModule += '<span code="'+i+'">'+data.moduleNames[i]+'</span>';
  348. }
  349. a++;
  350. }
  351. }
  352. if(data.unitNames){
  353. var a = 1;
  354. for(var i in data.unitNames){
  355. if(a == 1){
  356. htmlUnit += '<span code="'+i+'" class="active">'+data.unitNames[i]+'</span>';
  357. }else{
  358. htmlUnit += '<span code="'+i+'">'+data.unitNames[i]+'</span>';
  359. }
  360. a++;
  361. }
  362. }
  363. $('#optionModular').html(htmlModule);
  364. $('#optionUnit').html(htmlUnit);
  365. }
  366. });
  367. }
  368. })
  369. $("body").delegate("#optionModular span", "click", function() {
  370. if(!limitUnit()){
  371. layer.msg('已选单元超出限制');return false;
  372. }
  373. $("#optionModular>span").removeClass('active')
  374. $(this).addClass('active');
  375. var code = $(this).attr("code");
  376. optionData.modular=code;
  377. // $('#optionModular span').on("click", function(event) {
  378. var moduleId = $(this).attr("code");
  379. var textbookId = $('#optionEdition span.active').attr("code");
  380. if(textbookId && moduleId){
  381. $.ajax({
  382. url: "<?php echo $this->createUrl('print/ajaxWeekGetUnitByModuleId');?>",
  383. type: "POST",
  384. dataType: "json",
  385. data: {
  386. textbookId: textbookId,
  387. moduleId:moduleId
  388. },
  389. success: function (data) {
  390. console.log(data);
  391. var htmlUnit = '';
  392. if(data.unitNames){
  393. var a = 1;
  394. for(var i in data.unitNames){
  395. if(a == 1){
  396. htmlUnit += '<span code="'+i+'" class="active">'+data.unitNames[i]+'</span>';
  397. }else{
  398. htmlUnit += '<span code="'+i+'">'+data.unitNames[i]+'</span>';
  399. }
  400. a++;
  401. }
  402. }
  403. $('#optionUnit').html(htmlUnit);
  404. }
  405. });
  406. }
  407. })
  408. $("body").delegate("#optionUnit span","click",function () {
  409. if(!limitUnit()){
  410. layer.msg('已选单元超出限制');return false;
  411. }
  412. var text_book_id = $("#optionEdition").children(".active").attr("code");
  413. var module_id = $("#optionModular").children(".active").attr("code");
  414. var unit_id = $(this).attr("code");
  415. var ids = text_book_id + '_' + module_id + '_' + unit_id;
  416. var selected_arr = [];
  417. if($('#selectedUnit span').length > 0){
  418. $('#selectedUnit span').each(function(index){
  419. selected_arr.push($(this).attr('node'));
  420. });
  421. }
  422. if($.inArray(ids, selected_arr) >= 0){
  423. layer.msg('不能重复添加该单元');return false;
  424. }
  425. var grade = parseInt($('.select-grade').val());
  426. //动态获取单元关联单词和短语数量
  427. $.ajax({
  428. url: "<?php echo $this->createUrl('englishWeek/ajaxWordPhraseCount');?>",
  429. type: "POST",
  430. dataType: "json",
  431. data: {
  432. ids: ids,
  433. grade: grade
  434. },
  435. beforeSend:function(){
  436. layer.load(1, {
  437. shade: [0.1,'#fff'] //0.1透明度的白色背景
  438. });
  439. },
  440. success: function (data) {
  441. var index = layer.load();
  442. layer.close(index);
  443. var label = $("#optionClass > label");
  444. jQuery.each(label, function(){
  445. var class_id = $(this).children().val();
  446. count = 0;
  447. $.each(data.data.classCount, function(id,number) {
  448. if(id==class_id){
  449. count = number;
  450. }
  451. });
  452. $(this).children('.unit_generate_count').children('span').append('<span style="color: #07af66;margin-left:5px;margin-right: 5px" class="unit' + ids + '">' + count + '</span>');
  453. $('.unit_generate_count').show();
  454. });
  455. var word_total = parseInt($('#word_total').text());
  456. var phrase_total = parseInt($('#phrase_total').text());
  457. word_total = word_total + data.data.wordCount;
  458. phrase_total = phrase_total + data.data.phraseCount;
  459. $('#word_total').text(word_total);
  460. $('#phrase_total').text(phrase_total);
  461. }
  462. });
  463. var text_book_name = $("#optionEdition").children(".active").text();
  464. var module_name = $("#optionModular").children(".active").text();
  465. var unit_name = $(this).text();
  466. var names = text_book_name + '_' + module_name + '_' + unit_name;
  467. var _html = '<span node="' + ids + '">' + names + '<i class="delete-icon" onclick="deleteUnit(this)"></i></span>';
  468. $("#selectedUnit").append(_html);
  469. });
  470. $('.select-grade').change(function(){
  471. $('#selectedUnit').empty();
  472. var grade = $(this).val();
  473. getClassByGrade(grade);
  474. $('#word_total').text(0);
  475. $('#phrase_total').text(0);
  476. if(grade == 3) {
  477. $("input[name='words_count']").val(30);
  478. }else{
  479. $("input[name='words_count']").val(20);
  480. }
  481. $("input[name='phrase_count']").val(20);
  482. });
  483. $("#confirm[active='true']").on("click", function() {
  484. $('#confirm').attr('disabled','disabled');
  485. var This = $(this);
  486. This.attr("active","false");
  487. var error = [];
  488. var selectClassIds = [];
  489. var unitIds = [];
  490. var names = [];
  491. var grade = parseInt($('.select-grade').val());
  492. $('#optionClass input:checked').each(function(k,v){
  493. if($(this).attr("status") == 0){
  494. selectClassIds.push($(this).val());
  495. }
  496. });
  497. $('#selectedUnit span').each(function(k,v){
  498. unitIds.push($(this).attr('node'));
  499. names.push($(this).text())
  500. });
  501. if(selectClassIds.length == 0){
  502. error.push("请选择班级");
  503. }
  504. if(grade <= 0 || !grade){
  505. error.push("请选择年级");
  506. }
  507. if(unitIds.length == 0){
  508. error.push("请选择单元")
  509. }
  510. //核心单词输入校验
  511. var word_count = $("input[name='words_count']").val();
  512. if(!isPositiveInteger(word_count)){
  513. error.push("单词数量请输入正整数")
  514. }
  515. word_count = parseInt(word_count);
  516. var word_total = parseInt($('#word_total').text());
  517. if(word_count > word_total || word_count>100){
  518. error.push("单词数量超出总数")
  519. }
  520. if(word_count <= 0){
  521. error.push("请检查单词数量")
  522. }
  523. //重点短语输入校验
  524. var phrase_count = $("input[name='phrase_count']").val();
  525. if(!isPositiveInteger(phrase_count)){
  526. error.push("重点短语数量请输入正整数")
  527. }
  528. phrase_count = parseInt(phrase_count);
  529. var phrase_total = parseInt($('#phrase_total').text());
  530. if(phrase_count > phrase_total || phrase_count>100){
  531. error.push("重点短语数量超出总数")
  532. }
  533. if(phrase_count <= 0){
  534. error.push("请检查短语数量")
  535. }
  536. var isAnswerSeparate = $("input[name='is_answer_separate']:checked").val();
  537. var isSameAnswer = $("input[name='is_same_answer']:checked").val();
  538. var wordsType = $("input[name='words_type']:checked").val();
  539. var phraseType = $("input[name='phrase_type']:checked").val();
  540. var isWordDerive = $("input[name='is_word_derive']:checked").val();
  541. var wordRange = $("input[name='words_range']:checked").val();
  542. var spellCount = parseInt($("input[name='spell_count']").val());
  543. var sentenceCount = parseInt($("input[name='sentence_count']").val());
  544. var blankCount = parseInt($("input[name='blank_count']").val());
  545. var translateCount = parseInt($("input[name='translate_count']").val());
  546. var grammarSingleCount = parseInt($("input[name='grammar_single_count']").val());
  547. var grammarSheetCount = parseInt($("input[name='grammar_sheet_count']").val());
  548. var readingCount = parseInt($("input[name='reading_count']").val());
  549. if(!isPositiveInteger(spellCount) || spellCount<0 ){
  550. error.push("请检查单词拼写数量")
  551. }
  552. if(!isPositiveInteger(sentenceCount) || sentenceCount<0){
  553. error.push("请检查完成句子数量")
  554. }
  555. if(!isPositiveInteger(blankCount) || blankCount<0){
  556. error.push("请检查单句语法填空数量")
  557. }
  558. if(!isPositiveInteger(translateCount) || translateCount<0){
  559. error.push("请检查单句翻译数量")
  560. }
  561. if((spellCount+sentenceCount+blankCount+translateCount)>20){
  562. error.push("词汇运用题数超出限制")
  563. }
  564. if(!isPositiveInteger(grammarSingleCount) || grammarSingleCount<0 || grammarSingleCount>20 || !isPositiveInteger(grammarSheetCount) || grammarSheetCount<0 || grammarSheetCount>3){
  565. error.push("请检查语法聚焦数量")
  566. }
  567. if(!isPositiveInteger(readingCount) || readingCount<0 || readingCount>3){
  568. error.push("请检查外刊泛读数量")
  569. }
  570. if(error.length == 0){
  571. $.ajax({
  572. url: "<?php echo $this->createUrl('print/ajaxSaveEnglishWeek');?>",
  573. type: "POST",
  574. dataType: "json",
  575. data: {
  576. grade: grade,
  577. selectClassIds:selectClassIds,
  578. unitIds: unitIds,
  579. names: names,
  580. wordCount:word_count,
  581. phraseCount:phrase_count,
  582. isAnswerSeparate:isAnswerSeparate,
  583. wordsType:wordsType,
  584. phraseType:phraseType,
  585. isSameAnswer:isSameAnswer,
  586. wordRange:wordRange,
  587. spellCount:spellCount,
  588. sentenceCount:sentenceCount,
  589. isWordDerive:isWordDerive,
  590. blankCount:blankCount,
  591. translateCount:translateCount,
  592. grammarSingleCount:grammarSingleCount,
  593. grammarSheetCount:grammarSheetCount,
  594. readingCount:readingCount
  595. },
  596. success: function (data) {
  597. if(data.status == 1){
  598. layer.msg('已发送到后台,预计1小时左右生成!', {
  599. time: 2000,
  600. });
  601. setTimeout(function(){window.location.href = "<?php echo Yii::app()->createUrl('print/mrv');?>";}, 2000);
  602. }else{
  603. layer.msg(data.error.join('</br>'));
  604. This.attr("active","true");
  605. }
  606. }
  607. });
  608. }else{
  609. $('#confirm').removeAttr('disabled');
  610. This.attr("active","true");
  611. layer.msg(error.join('</br>'));
  612. }
  613. });
  614. function getClassByGrade(grade){
  615. if(grade){
  616. $.ajax({
  617. url: "<?php echo $this->createUrl('print/ajaxGetClassesBySettingWeek');?>",
  618. type: "POST",
  619. dataType: "json",
  620. data: {
  621. grade: grade,
  622. },
  623. beforeSend:function(){
  624. layer.load(1, {
  625. shade: [0.1,'#fff'] //0.1透明度的白色背景
  626. });
  627. },
  628. success: function (data) {
  629. var index = layer.load();
  630. layer.close(index);
  631. var html = '';
  632. if(data && data.length > 0){
  633. for(var i in data){
  634. html +='<label>';
  635. if(data[i].status == 1){
  636. html += ' <input type="checkbox" name="option-class" value="'+data[i].class_id+'" checked="checked" disabled="disabled" status="1">'+data[i].class_name;
  637. }else{
  638. html += ' <input type="checkbox" name="option-class" value="'+data[i].class_id+'" status="0">'+data[i].class_name;
  639. }
  640. html +='<span style="display: none;margin-left: 5px;" class="unit_generate_count">' + '(' + '<span></span>' + ')' + '</span></label>';
  641. }
  642. }
  643. html += '<div style="color: red;font-weight: bold">' + '* 选择单元后班级右边括号内数字为该单元历史生成次数' + '</div>';
  644. $('#optionClass').html(html);
  645. }
  646. });
  647. }
  648. }
  649. });
  650. function deleteUnit(a) {
  651. var ids = $(a).parent().attr('node');
  652. var grade = parseInt($('.select-grade').val());
  653. var generate_class = ".unit"+ ids;
  654. $("span").remove(generate_class);
  655. //动态获取单元关联单词和短语数量
  656. $.ajax({
  657. url: "<?php echo $this->createUrl('englishWeek/ajaxWordPhraseCount');?>",
  658. type: "POST",
  659. dataType: "json",
  660. data: {
  661. ids: ids,
  662. grade: grade
  663. },
  664. beforeSend:function(){
  665. layer.load(1, {
  666. shade: [0.1,'#fff'] //0.1透明度的白色背景
  667. });
  668. },
  669. success: function (data) {
  670. var index = layer.load();
  671. layer.close(index);
  672. var word_total = parseInt($('#word_total').text());
  673. var phrase_total = parseInt($('#phrase_total').text());
  674. word_total = word_total - data.data.wordCount;
  675. phrase_total = phrase_total - data.data.phraseCount;
  676. $('#word_total').text(word_total);
  677. $('#phrase_total').text(phrase_total);
  678. }
  679. });
  680. $(a).parent().remove();
  681. if($("#selectedUnit").children("span").length == 0){
  682. $('.unit_generate_count').hide();
  683. }
  684. }
  685. function limitUnit() {
  686. var grade = $('.select-grade').val();
  687. var selected_count = $("#selectedUnit").children("span").length;
  688. if(grade == 3 && selected_count == 3){
  689. return false;
  690. }
  691. if(grade!=3 && selected_count==1){
  692. return false;
  693. }
  694. return true;
  695. }
  696. function isPositiveInteger(s){//是否为正整数
  697. var re = /^[0-9]+$/ ;
  698. return re.test(s)
  699. }
  700. </script>