setting_homework.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519
  1. <link rel="stylesheet" href="/fonts/fpdf/iconfont.css"/>
  2. <link rel="stylesheet" href="/css/alert.css"/>
  3. <?php $imgUrl = Yii::app()->request->hostInfo.'/images/disable.png';?>
  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. margin-top:10px;
  32. line-height: 1rem;
  33. cursor: pointer;
  34. }
  35. .select-grade{
  36. width: 150px;
  37. line-height: 30px;
  38. margin-bottom: 10px;
  39. }
  40. .option-con-class label{
  41. display: inline-block;
  42. margin-right: 20px;
  43. }
  44. .active{
  45. color: #697aff;
  46. }
  47. .btn-start{
  48. display: inline-block;
  49. margin-top: 20px;
  50. margin-left: 100px;
  51. padding: 10px 30px;
  52. color: #fff;
  53. background-color: #2977ff;
  54. cursor: pointer;
  55. }
  56. .en-tfb-grade-1{
  57. margin-left: 20px;
  58. }
  59. .layered-training .describe{width: 150px;margin-bottom: 10px;display: inline-block;}
  60. .layered-training .number{margin-bottom: 10px;display: inline-block; margin-left: 20px;}
  61. .layered-training .number input{width: 80px;text-align:center;}
  62. .layered-training .number .prompt{color: #6300BF;font-weight: 700;font-size: 16px;}
  63. </style>
  64. <div class="main-content-inner">
  65. <!-- 导航栏开始-->
  66. <?php include(Yii::app()->basePath.'/views/layouts/view_production_navigation.php');?>
  67. <!-- 导航栏结束-->
  68. <div class="en-tfb-grade-1">
  69. <h2><?php echo $productName; ?>生成</h2>
  70. <p class="color-red">* 假期作业每个班级一个学期仅能生成一次!</p>
  71. <h4>学期:<?php echo $semesterName; ?></h4>
  72. <div class="option-wrap">
  73. <span class="option-name"><span class="color-red">*</span>班级:</span>
  74. <div class="option-con">
  75. <div>
  76. <select name="grade" class="select-grade">
  77. <option value="1" selected>高一</option>
  78. <option value="2">高二</option>
  79. <option value="3">高三</option>
  80. </select>
  81. </div>
  82. <div class="option-con-class" id="optionClass">
  83. </div>
  84. </div>
  85. </div>
  86. <div class="option-wrap" style="display: none;">
  87. <span class="option-name">得分率范围:</span>
  88. <div class="option-con">
  89. <div>
  90. <select name="scoring-rate" class="scoring-rate">
  91. <option value="C" selected>50%以下</option>
  92. <option value="B" selected>50%-70%</option>
  93. <option value="A">70%以上</option>
  94. </select>
  95. <span class="color-red">(注:得分率设置仅适用于无考试数据班级,有数据者,以系统统计数据为准)</span>
  96. </div>
  97. <div class="option-con-class" id="optionClass">
  98. </div>
  99. </div>
  100. </div>
  101. <div class="option-wrap">
  102. <span class="option-name"><span class="color-red">*</span>高考类型:</span>
  103. <div class="option-con">
  104. <span><input type="radio" name="exam-type" class="exam-type" value="1" <?php echo $type==1?'checked':'' ?>>新高考</span>
  105. <span><input type="radio" name="exam-type" class="exam-type" value="2" <?php echo $type==0?'checked':'' ?>>老高考</span>
  106. </div>
  107. </div>
  108. <!-- 新高考开始-->
  109. <div class="option-wrap layered-training layered-training-new-exam" style="display:<?php echo $type==1?'':'none' ?>">
  110. <!-- mhk -->
  111. <span class="option-name"><span class="color-red">*</span>分层训练:</span>
  112. <div class="option-con">
  113. <div class="item">
  114. <div class="describe">
  115. <span>听力</span>
  116. </div>
  117. <div style="" class="number">
  118. <span><input style="" class="hearing" min="0" max="1" type="number" value="1" oninput="if(value){value=value.replace(/[^\d]/g,'')} if(value<=0){value=0} if(value>1){value=1}"></span>
  119. <span class="prompt">(题数限制为0-1)</span>
  120. </div>
  121. </div>
  122. <div class="item">
  123. <div class="describe">
  124. <span>阅读理解</span>
  125. </div>
  126. <div style="" class="number">
  127. <span><input style="" class="reading-comprehension" min="0" max="8" type="number" value="4" oninput="if(value){value=value.replace(/[^\d]/g,'')} if(value<=0){value=0} if(value>8){value=8}"></span>
  128. <span class="prompt">(题数限制为0-8)</span>
  129. </div>
  130. </div>
  131. <div class="item">
  132. <div class="describe">
  133. <span>七选五</span>
  134. </div>
  135. <div style="" class="number">
  136. <span><input style="" class="seven-choose-five" min="0" max="3" type="number" value="1" oninput="if(value){value=value.replace(/[^\d]/g,'')} if(value<=0){value=0} if(value>3){value=3}"></span>
  137. <span class="prompt">(题数限制为0-3)</span>
  138. </div>
  139. </div>
  140. <div class="item">
  141. <div class="describe completion-fill-in-describe">
  142. <span>完形填空(15小题)</span>
  143. </div>
  144. <div style="" class="number">
  145. <span><input style="" class="completion-fill-in" min="0" max="3" type="number" value="1" oninput="if(value){value=value.replace(/[^\d]/g,'')} if(value<=0){value=0} if(value>3){value=3}"></span>
  146. <span class="prompt">(题数限制为0-3)</span>
  147. </div>
  148. </div>
  149. <div class="item">
  150. <div class="describe">
  151. <span>语法填空</span>
  152. </div>
  153. <div style="" class="number">
  154. <span><input style="" class="grammatical-fill-in" min="0" max="5" type="number" value="1" oninput="if(value){value=value.replace(/[^\d]/g,'')} if(value<=0){value=0} if(value>5){value=5}"></span>
  155. <span class="prompt">(题数限制为0-5)</span>
  156. </div>
  157. </div>
  158. <div class="item">
  159. <div class="describe practical-writing-describe">
  160. <span>应用文(80词)</span>
  161. </div>
  162. <div style="" class="number">
  163. <span><input style="" class="practical-writing" min="0" max="1" type="number" value="1" oninput="if(value){value=value.replace(/[^\d]/g,'')} if(value<=0){value=0} if(value>1){value=1}"></span>
  164. <span class="prompt">(题数限制为0-1)</span>
  165. </div>
  166. </div>
  167. <div class="item">
  168. <div class="describe">
  169. <span>读后续写</span>
  170. </div>
  171. <div style="" class="number">
  172. <span><input style="" class="reading-prior-written" min="0" max="1" type="number" value="1" oninput="if(value){value=value.replace(/[^\d]/g,'')} if(value<=0){value=0} if(value>1){value=1}"></span>
  173. <span class="prompt">(题数限制为0-1)</span>
  174. </div>
  175. </div>
  176. <div class="item">
  177. <span class=" color-red">*数量限制:分层训练题数不少于3个</span>
  178. </div>
  179. </div>
  180. </div>
  181. <!-- 新高考结束-->
  182. <!-- 老高考开始-->
  183. <div class="option-wrap layered-training layered-training-old-exam" style="display:<?php echo $type==0?'':'none' ?>">
  184. <!-- mhk -->
  185. <span class="option-name"><span class="color-red">*</span>分层训练:</span>
  186. <div class="option-con">
  187. <div class="item">
  188. <div class="describe">
  189. <span>听力</span>
  190. </div>
  191. <div style="" class="number">
  192. <span><input style="" class="hearing" min="0" max="1" type="number" value="1" oninput="if(value){value=value.replace(/[^\d]/g,'')} if(value<=0){value=0} if(value>1){value=1}"></span>
  193. <span class="prompt">(题数限制为0-1)</span>
  194. </div>
  195. </div>
  196. <div class="item">
  197. <div class="describe">
  198. <span>阅读理解</span>
  199. </div>
  200. <div style="" class="number">
  201. <span><input style="" class="reading-comprehension" min="0" max="8" type="number" value="4" oninput="if(value){value=value.replace(/[^\d]/g,'')} if(value<=0){value=0} if(value>8){value=8}"></span>
  202. <span class="prompt">(题数限制为0-8)</span>
  203. </div>
  204. </div>
  205. <div class="item">
  206. <div class="describe">
  207. <span>七选五</span>
  208. </div>
  209. <div style="" class="number">
  210. <span><input style="" class="seven-choose-five" min="0" max="3" type="number" value="1" oninput="if(value){value=value.replace(/[^\d]/g,'')} if(value<=0){value=0} if(value>3){value=3}"></span>
  211. <span class="prompt">(题数限制为0-3)</span>
  212. </div>
  213. </div>
  214. <div class="item">
  215. <div class="describe completion-fill-in-describe">
  216. <span>完形填空(20小题)</span>
  217. </div>
  218. <div style="" class="number">
  219. <span><input style="" class="completion-fill-in" min="0" max="3" type="number" value="1" oninput="if(value){value=value.replace(/[^\d]/g,'')} if(value<=0){value=0} if(value>3){value=3}"></span>
  220. <span class="prompt">(题数限制为0-3)</span>
  221. </div>
  222. </div>
  223. <div class="item">
  224. <div class="describe">
  225. <span>语法填空</span>
  226. </div>
  227. <div style="" class="number">
  228. <span><input style="" class="grammatical-fill-in" min="0" max="5" type="number" value="1" oninput="if(value){value=value.replace(/[^\d]/g,'')} if(value<=0){value=0} if(value>5){value=5}"></span>
  229. <span class="prompt">(题数限制为0-5)</span>
  230. </div>
  231. </div>
  232. <div class="item">
  233. <div class="describe">
  234. <span>短文改错</span>
  235. </div>
  236. <div style="" class="number">
  237. <span><input style="" class="passages-change-wrong" min="0" max="5" type="number" value="1" oninput="if(value){value=value.replace(/[^\d]/g,'')} if(value<=0){value=0} if(value>5){value=5}"></span>
  238. <span class="prompt">(题数限制为0-5)</span>
  239. </div>
  240. </div>
  241. <div class="item">
  242. <div class="describe practical-writing-describe">
  243. <span>应用文(100词)</span>
  244. </div>
  245. <div style="" class="number">
  246. <span><input style="" class="practical-writing" min="0" max="1" type="number" value="1" oninput="if(value){value=value.replace(/[^\d]/g,'')} if(value<=0){value=0} if(value>1){value=1}"></span>
  247. <span class="prompt">(题数限制为0-1)</span>
  248. </div>
  249. </div>
  250. <div class="item">
  251. <span class=" color-red">*数量限制:分层训练题数不少于3个</span>
  252. </div>
  253. </div>
  254. </div>
  255. <!-- 老高考结束-->
  256. <div class="option-wrap">
  257. <span class="option-name"><span class="color-red">*</span>下载方式:</span>
  258. <div class="option-con">
  259. <span><input type="radio" name="is-answer-merge" value="0" checked="checked">合并题目和答案</span>
  260. <span><input type="radio" name="is-answer-merge" value="1" >分离题目和答案</span>
  261. </div>
  262. </div>
  263. <span class="btn-start" id="confirm" active="true" style="margin-left: 10px;">开始生成</span>
  264. </div>
  265. </div>
  266. <script src="/js/jquery.ajaxfileupload.js"></script>
  267. <script type="text/javascript">
  268. $(document).ready(function () {
  269. var productType=<?php echo $productType; ?>;
  270. getClassByGrade(1);
  271. // 选择年级
  272. $(".select-grade").change(function() {
  273. console.log($(this).val())
  274. });
  275. // 单选按钮
  276. $("input[name='option-class']").change(function() {
  277. getsClassSelected();
  278. });
  279. function getsClassSelected() {
  280. optionData.class=[];
  281. var selectedData = $("input[name='option-class']:checked"); //获取所以选中学生
  282. for (var i = 0; i < selectedData.length; i++) {
  283. code = $(selectedData[i]).val();
  284. optionData.class.push(code);
  285. }
  286. };
  287. $('.select-grade').change(function(){
  288. var grade = $(this).val();
  289. getClassByGrade(grade);
  290. });
  291. $("body").delegate("#confirm[active='true']", "click", function() {
  292. var This = $(this);
  293. This.attr("active","false");
  294. var error = [];
  295. var selectClassIds = [];
  296. var grade = parseInt(parseInt($('.select-grade').val()));
  297. var scoringRate=$('.scoring-rate').val();
  298. var examType = parseInt($("input[name='exam-type']:checked").val());
  299. var isAnswerMerge =parseInt($("input[name='is-answer-merge']:checked").val());
  300. $('#optionClass input:checked').each(function(k,v){
  301. if($(this).attr("status") == 0){
  302. selectClassIds.push($(this).val());
  303. }
  304. });
  305. if(selectClassIds.length == 0){
  306. error.push("请选择班级");
  307. }
  308. if(grade <= 0 || !grade){
  309. error.push("请选择年级");
  310. }
  311. var hearing=readingComprehension=sevenChooseFive=completionFillIn=grammaticalFillIn=practicalWriting=readingPriorWritten=passagesChangeWrong=0;
  312. if(examType==1) {
  313. hearing = $('.layered-training-new-exam .hearing').val();//听力
  314. readingComprehension = $('.layered-training-new-exam .reading-comprehension').val();//阅读理解
  315. sevenChooseFive = $('.layered-training-new-exam .seven-choose-five').val();//七选五
  316. completionFillIn = $('.layered-training-new-exam .completion-fill-in').val();//完型填空(15小题)
  317. grammaticalFillIn = $('.layered-training-new-exam .grammatical-fill-in').val();//语法填空
  318. practicalWriting = $('.layered-training-new-exam .practical-writing').val();//应用文(80词) *
  319. readingPriorWritten = $('.layered-training-new-exam .reading-prior-written').val();//读后续写 *
  320. }else{
  321. hearing = $('.layered-training-old-exam .hearing').val();//听力
  322. readingComprehension = $('.layered-training-old-exam .reading-comprehension').val();//阅读理解
  323. sevenChooseFive = $('.layered-training-old-exam .seven-choose-five').val();//七选五
  324. completionFillIn = $('.layered-training-old-exam .completion-fill-in').val();//完型填空(15小题)
  325. grammaticalFillIn = $('.layered-training-old-exam .grammatical-fill-in').val();//语法填空
  326. passagesChangeWrong = $('.layered-training-old-exam .passages-change-wrong').val();//短文改错 *
  327. practicalWriting = $('.layered-training-old-exam .practical-writing').val();//应用文(100词) *
  328. }
  329. if (!isPositiveNumber(hearing) || parseInt(hearing)<0 || parseInt(hearing)>1) {
  330. error.push("听力数量范围在0-1的整数");
  331. }
  332. if (!isPositiveNumber(readingComprehension) || parseInt(readingComprehension)<0 || parseInt(readingComprehension)>8) {
  333. error.push("阅读理解数量范围在0-8的整数");
  334. }
  335. if (!isPositiveNumber(sevenChooseFive) || parseInt(sevenChooseFive)<0 || parseInt(sevenChooseFive)>3) {
  336. error.push("七选五数量范围在0-3的整数");
  337. }
  338. if (!isPositiveNumber(completionFillIn) || parseInt(completionFillIn)<0 || parseInt(completionFillIn)>3) {
  339. error.push("完型填空(15小题)数量范围在0-3的整数");
  340. }
  341. if (!isPositiveNumber(grammaticalFillIn) || parseInt(grammaticalFillIn)<0 || parseInt(grammaticalFillIn)>5) {
  342. error.push("语法填空数量范围在0-5的整数");
  343. }
  344. if(examType==1) {
  345. if (!isPositiveNumber(practicalWriting) || parseInt(practicalWriting) < 0 || parseInt(practicalWriting) > 1) {
  346. error.push("应用文(80词)数量范围在0-1的整数");
  347. }
  348. if (!isPositiveNumber(readingPriorWritten) || parseInt(readingPriorWritten)<0 || parseInt(readingPriorWritten)>1) {
  349. error.push("读后续写数量范围在0-1的整数");
  350. }
  351. }else{
  352. if (!isPositiveNumber(passagesChangeWrong) || parseInt(passagesChangeWrong)<0 || parseInt(passagesChangeWrong)>5) {
  353. error.push("短文改错数量范围在0-5的整数");
  354. }
  355. if (!isPositiveNumber(practicalWriting) || parseInt(practicalWriting) < 0 || parseInt(practicalWriting) > 1) {
  356. error.push("应用文(100词)数量范围在0-1的整数");
  357. }
  358. }
  359. var hearing=parseInt(hearing);
  360. var readingComprehension=parseInt(readingComprehension);
  361. var sevenChooseFive=parseInt(sevenChooseFive);
  362. var completionFillIn=parseInt(completionFillIn);
  363. var grammaticalFillIn =parseInt(grammaticalFillIn);
  364. var practicalWriting =parseInt(practicalWriting);
  365. var readingPriorWritten = parseInt(readingPriorWritten);
  366. var passagesChangeWrong = parseInt(passagesChangeWrong);
  367. if(examType==1) {
  368. var total = hearing + readingComprehension + sevenChooseFive + completionFillIn + grammaticalFillIn + practicalWriting + readingPriorWritten;
  369. }else{
  370. var total = hearing + readingComprehension + sevenChooseFive + completionFillIn + grammaticalFillIn + passagesChangeWrong + practicalWriting;
  371. }
  372. if(total<3){
  373. error.push("分层训练题数不少于3个");
  374. }
  375. var settingJson={};
  376. var layeredTraining={};
  377. layeredTraining.hearing=hearing;
  378. layeredTraining.readingComprehension=readingComprehension;
  379. layeredTraining.sevenChooseFive=sevenChooseFive;
  380. layeredTraining.completionFillIn=completionFillIn;
  381. layeredTraining.grammaticalFillIn=grammaticalFillIn;
  382. layeredTraining.practicalWriting=practicalWriting;
  383. if(examType==1) {
  384. layeredTraining.readingPriorWritten = readingPriorWritten;
  385. }else{
  386. layeredTraining.passagesChangeWrong = passagesChangeWrong;
  387. }
  388. settingJson.layeredTraining=layeredTraining;
  389. settingJson.isAnswerMerge=isAnswerMerge;
  390. settingJson.scoringRate=scoringRate;
  391. settingJson.examType=examType;
  392. if(error.length == 0){
  393. $.ajax({
  394. url: "<?php echo $this->createUrl('generalproduct/ajaxSaveSetting');?>",
  395. type: "POST",
  396. dataType: "json",
  397. data: {
  398. grade: grade,
  399. selectClassIds:selectClassIds,
  400. settingJson:JSON.stringify(settingJson),
  401. productType:productType
  402. },
  403. success: function (data) {
  404. if(data.status == 1){
  405. layer.msg('已发送到后台,预计24小时左右生成!', {
  406. time: 2000,
  407. });
  408. setTimeout(function(){window.location.href = "<?php echo Yii::app()->createUrl('generalproduct/index');?>";}, 2000);
  409. }else{
  410. if($.isArray(data.error)) {
  411. layer.msg(data.error.join('</br>'));
  412. }else{
  413. layer.msg(data.error);
  414. }
  415. This.attr("active","true");
  416. }
  417. }
  418. });
  419. }else{
  420. This.attr("active","true");
  421. layer.msg(error[0]);
  422. }
  423. });
  424. function isPositiveNumber(s){//是否为整数
  425. var reg = /^[0-9]\d*$/;
  426. return reg.test(s)
  427. }
  428. function getClassByGrade(grade){
  429. if(grade){
  430. $.ajax({
  431. url: "<?php echo $this->createUrl('generalproduct/ajaxGetClasses');?>",
  432. type: "POST",
  433. dataType: "json",
  434. data: {
  435. grade: grade,
  436. productType:productType
  437. },
  438. success: function (data) {
  439. var html = '';
  440. if(data && data.length > 0){
  441. for(var i in data){
  442. html +='<label>';
  443. if(data[i].status == 1){
  444. html += '<span title="该班级已达每周生成的最大次数"><img src="<?php echo $imgUrl;?>">'+data[i].class_name+'</span>';
  445. }else{
  446. html += '<input type="checkbox" name="option-class" value="'+data[i].class_id+'" status="0">'+data[i].class_name;
  447. }
  448. html +='</label>';
  449. }
  450. }
  451. $('#optionClass').html(html);
  452. }
  453. });
  454. }
  455. }
  456. $('.exam-type').click(function(){
  457. var examType=$(this).val();
  458. if(examType==1){
  459. $('.layered-training-new-exam .hearing').val(1);//听力
  460. $('.layered-training-new-exam .reading-comprehension').val(4);//阅读理解
  461. $('.layered-training-new-exam .seven-choose-five').val(1);//七选五
  462. $('.layered-training-new-exam .completion-fill-in').val(1);//完型填空(15小题)
  463. $('.layered-training-new-exam .grammatical-fill-in').val(1);//语法填空
  464. $('.layered-training-new-exam .practical-writing').val(1);//应用文(80词) *
  465. $('.layered-training-new-exam .reading-prior-written').val(1);//读后续写 *
  466. $('.layered-training-new-exam').show();
  467. $('.layered-training-old-exam').hide();
  468. }else{
  469. $('.layered-training-old-exam .hearing').val(1);//听力
  470. $('.layered-training-old-exam .reading-comprehension').val(4);//阅读理解
  471. $('.layered-training-old-exam .seven-choose-five').val(1);//七选五
  472. $('.layered-training-old-exam .completion-fill-in').val(1);//完型填空(15小题)
  473. $('.layered-training-old-exam .grammatical-fill-in').val(1);//语法填空
  474. $('.layered-training-old-exam .passages-change-wrong').val(1);//短文改错 *
  475. $('.layered-training-old-exam .practical-writing').val(1);//应用文(100词) *
  476. $('.layered-training-new-exam').hide();
  477. $('.layered-training-old-exam').show();
  478. }
  479. })
  480. });
  481. </script>