setting_homework2.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  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. <?php if($productType == ProductDownload::PRODUCT_TYPE_WRONG_REFINE):?>
  71. <p class="color-red">* 错题精练每册每学期仅可生成3次!</p>
  72. <?php else:?>
  73. <p class="color-red">* 假期作业每个班级一个学期仅能生成一次!</p>
  74. <?php endif;?>
  75. <h4>学期:<?php echo $semesterName; ?></h4>
  76. <?php if($productType == ProductDownload::PRODUCT_TYPE_WRONG_REFINE):?>
  77. <div class="option-wrap">
  78. <label><input type="radio" name="textbook" class="textbook" checked value="1">第一册&nbsp;&nbsp;</label>
  79. <label><input type="radio" name="textbook" class="textbook" value="2">第二册&nbsp;&nbsp;</label>
  80. <label><input type="radio" name="textbook" class="textbook" value="3">第三册&nbsp;&nbsp;</label>
  81. <label><input type="radio" name="textbook" class="textbook" value="4">第四册&nbsp;&nbsp;</label>
  82. <label><input type="radio" name="textbook" class="textbook" value="5">第五册&nbsp;&nbsp;</label>
  83. <label><input type="radio" name="textbook" class="textbook" value="6">第六册&nbsp;&nbsp;</label>
  84. </div>
  85. <?php else:?>
  86. <input type="hidden" name="textbook" value="0">
  87. <?php endif;?>
  88. <div class="option-wrap">
  89. <span class="option-name"><span class="color-red">*</span>班级:</span>
  90. <div class="option-con">
  91. <div>
  92. <select name="grade" class="select-grade">
  93. <option value="1" selected>高一</option>
  94. <option value="2">高二</option>
  95. <option value="3">高三</option>
  96. </select>
  97. </div>
  98. <div class="option-con-class" id="optionClass">
  99. </div>
  100. </div>
  101. </div>
  102. <div class="option-wrap" style="display: none;">
  103. <span class="option-name">得分率范围:</span>
  104. <div class="option-con">
  105. <div>
  106. <select name="scoring-rate" class="scoring-rate">
  107. <option value="C">50%以下</option>
  108. <option value="B" selected>50%-70%</option>
  109. <option value="A">70%以上</option>
  110. </select>
  111. <span class="color-red">(注:得分率设置仅适用于无考试数据班级,有数据者,以系统统计数据为准)</span>
  112. </div>
  113. <div class="option-con-class" id="optionClass">
  114. </div>
  115. </div>
  116. </div>
  117. <div class="option-wrap">
  118. <span class="option-name"><span class="color-red">*</span>下载方式:</span>
  119. <div class="option-con">
  120. <span><input type="radio" name="is-answer-merge" value="0" checked="checked">合并题目和答案</span>
  121. <span><input type="radio" name="is-answer-merge" value="1" >分离题目和答案</span>
  122. </div>
  123. </div>
  124. <span class="btn-start" id="confirm" active="true" style="margin-left: 10px;">开始生成</span>
  125. </div>
  126. </div>
  127. <script src="/js/jquery.ajaxfileupload.js"></script>
  128. <script type="text/javascript">
  129. $(document).ready(function () {
  130. var productType=<?php echo $productType; ?>;
  131. getClassByGrade(1,1);
  132. // 选择年级
  133. $(".select-grade").change(function() {
  134. console.log($(this).val())
  135. });
  136. // 单选按钮
  137. $("input[name='option-class']").change(function() {
  138. getsClassSelected();
  139. });
  140. function getsClassSelected() {
  141. optionData.class=[];
  142. var selectedData = $("input[name='option-class']:checked"); //获取所以选中学生
  143. for (var i = 0; i < selectedData.length; i++) {
  144. code = $(selectedData[i]).val();
  145. optionData.class.push(code);
  146. }
  147. };
  148. $('.select-grade').change(function(){
  149. var grade = $(this).val();
  150. var textbook=parseInt($('input[name=textbook]:checked').val());
  151. getClassByGrade(grade,textbook);
  152. });
  153. $('.textbook').click(function(){
  154. var grade = parseInt($('.select-grade').val())
  155. var textbook=parseInt($('input[name=textbook]:checked').val());
  156. getClassByGrade(grade,textbook);
  157. });
  158. $("body").delegate("#confirm[active='true']", "click", function() {
  159. var This = $(this);
  160. This.attr("active","false");
  161. var error = [];
  162. var selectClassIds = [];
  163. var grade = parseInt($('.select-grade').val())
  164. var textbook = parseInt($('input[name=textbook]:checked').val());
  165. var scoringRate=$('.scoring-rate').val();
  166. var isAnswerMerge =parseInt($("input[name='is-answer-merge']:checked").val());
  167. $('#optionClass input:checked').each(function(k,v){
  168. if($(this).attr("status") == 0){
  169. selectClassIds.push($(this).val());
  170. }
  171. });
  172. if(selectClassIds.length == 0){
  173. error.push("请选择班级");
  174. }
  175. if(grade <= 0 || !grade){
  176. error.push("请选择年级");
  177. }
  178. var settingJson={};
  179. settingJson.isAnswerMerge=isAnswerMerge;
  180. settingJson.scoringRate=scoringRate;
  181. if(error.length == 0){
  182. $.ajax({
  183. url: "<?php echo $this->createUrl('generalproduct/ajaxSaveSetting');?>",
  184. type: "POST",
  185. dataType: "json",
  186. data: {
  187. grade: grade,
  188. textbook:textbook,
  189. selectClassIds:selectClassIds,
  190. settingJson:JSON.stringify(settingJson),
  191. productType:productType
  192. },
  193. success: function (data) {
  194. if(data.status == 1){
  195. layer.msg('已发送到后台,预计24小时左右生成!', {
  196. time: 2000,
  197. });
  198. setTimeout(function(){window.location.href = "<?php echo Yii::app()->createUrl('generalproduct/index/productType/'.$productType);?>";}, 2000);
  199. }else{
  200. if($.isArray(data.error)) {
  201. layer.msg(data.error.join('</br>'));
  202. }else{
  203. layer.msg(data.error);
  204. }
  205. This.attr("active","true");
  206. }
  207. }
  208. });
  209. }else{
  210. This.attr("active","true");
  211. layer.msg(error[0]);
  212. }
  213. });
  214. function isPositiveNumber(s){//是否为整数
  215. var reg = /^[0-9]\d*$/;
  216. return reg.test(s)
  217. }
  218. function getClassByGrade(grade,textbook){
  219. if(grade){
  220. $.ajax({
  221. url: "<?php echo $this->createUrl('generalproduct/ajaxGetClasses');?>",
  222. type: "POST",
  223. dataType: "json",
  224. data: {
  225. grade: grade,
  226. productType:productType,
  227. textbook:textbook
  228. },
  229. success: function (data) {
  230. var html = '';
  231. if(data && data.length > 0){
  232. for(var i in data){
  233. html +='<label>';
  234. if(data[i].status == 1){
  235. html += '<span title="该班级已达每学期生成的最大次数"><img src="<?php echo $imgUrl;?>">'+data[i].class_name+'</span>';
  236. }else{
  237. html += '<input type="checkbox" name="option-class" value="'+data[i].class_id+'" status="0">'+data[i].class_name;
  238. }
  239. html +='</label>';
  240. }
  241. }
  242. $('#optionClass').html(html);
  243. }
  244. });
  245. }
  246. }
  247. });
  248. </script>