english_reading_3.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. <link rel="stylesheet" href="/fonts/fpdf/iconfont.css"/>
  2. <link rel="stylesheet" href="/css/alert.css"/>
  3. <style>
  4. .color-red{
  5. color: red;
  6. }
  7. .en-tfb-grade-1 .date>span{
  8. margin-right: 40px;
  9. }
  10. .option-wrap{
  11. margin-top: 20px;
  12. min-width: 600px;
  13. }
  14. .option-name{
  15. display: inline-block;
  16. width: 100px;
  17. vertical-align: top;
  18. margin-top: 10px;
  19. }
  20. .option-con{
  21. display: inline-block;
  22. width: 80%;
  23. min-width: 490px;
  24. padding: 10px;
  25. border: 1px solid #ccc;
  26. }
  27. .option-con>span{
  28. display: inline-block;
  29. margin-right: 20px;
  30. margin-top:10px;
  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: #07af66;
  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: #07af66;
  53. cursor: pointer;
  54. }
  55. .en-tfb-grade-1{
  56. margin-left: 20px;
  57. }
  58. .hgc_leader-btn {
  59. display: flex;
  60. justify-content: space-between;
  61. padding: 10px 0;
  62. font-size: 14px;
  63. }
  64. .hgc_leader-btn span {
  65. display: flex;
  66. align-items: center;
  67. cursor: pointer;
  68. }
  69. .hgc_leader-btn span .icon {
  70. width: 15px;
  71. height: 15px;
  72. background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAWCAYAAADNX8xBAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHXSURBVDhPnZS/S4JRFIZvYlDQYOBg0ODg4ODW4ugaNDT2HxRE0NA/EA0NFQUNDRENjQUN0dRQQVDgEmQ4aBQouLQVJBTZ816PpvX5o154Oufce87r57X7uU6qOReBsJV/16dzU5DHpEZ8g2MYt+3+ZCYVTKZhCKLUa1Aij1hbbzGgJ5kmzmgYstRJ4j6sWFugBiw2zqTEwijxkaUNmIBXOIX5kHOTxECx15QGpIT+sLGF6R5pklgklrXeSU0jmj8IFxAD5Q3prGS+XC/7EANxziIN+mqqM6Bf7wXebS/N2pAf6CYzaxop1yDxQKZCa5CAtB9CrWfUSU987So8YHJFPQhl6gLxBLMzNXkjGsL6BOU9VLSzLDKzTj5GridLhVhIgn72Agvn5DpsL/JnQq5etYv+ezPVE0dlNEtxBMNwC8fgxePmYEE5fTcMXPqNIPEUq3BopepN8IfdSewnMB6xXN8io0/SfcrLwHch8kVLe6ppJJHEfpr1KxlBysr/m9F/zWzcyrr+akZ/hF69dn6/AFvMtgMbWkTPEuxa+VtmloU7ct23NkNqXaMd8FfFloOlYZrmQG9H3S+96DRYAf8KZj1q7d8vtm5iIEnw//Hkumeiqrou574AaXrOncWtEY0AAAAASUVORK5CYII=') no-repeat center;
  73. background-size: contain;
  74. }
  75. .hgc_leader-btn span:nth-child(2) .icon {
  76. background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAWCAYAAADAQbwGAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAE6SURBVDhP7ZStTgNBFEZvmwpkRUUFsqJJKyoqKhBIRCWiD4CkggRPeAIEgodA8gAYEgQPgICktrJJDUkJ5dztV5id7KZDlqA4ydf7N/duZtIZK+PD7Bi9rM3WoTyHTrQsDRoHNK3QEs0iLTV4rOW7YfGNmiZKfUFupNq9UjlqFI5qZm3FGTRcY/bQlNpblgygfkW+iT3DLpR2Fj5wRbKhRGV84CkDW/gXm5RdyqYS9n3vxs/FpTCZuK8u+2sUDuQYJsj/b33Ft+hRfgc9o3OPYwoHcqZd1NHZOkP8kTvYfa/j9jyO+ZstV+F/YHVSB77LOqFfTniF+GmhQ+QvjsddNJDfQAcoe6GwxVe2tLCDuC+3ZbKvcpOh50FuHu7m3fZrPxW9TxrjV3MDhTbyl3p7f1OZM8Rf7rmZ2Sd4TZIuop129AAAAABJRU5ErkJggg==') no-repeat center;
  77. background-size: contain;
  78. }
  79. .hgc_leader-btn i {
  80. font-style: normal;
  81. }
  82. .hgc_option-con label {
  83. position: relative;
  84. padding: 5px;
  85. padding-right: 30px;
  86. border: 1px solid #999;
  87. }
  88. .hgc_option-con .icon {
  89. position: absolute;
  90. top: 50%;
  91. right: 5px;
  92. transform: translateY(-50%);
  93. width: 15px;
  94. height: 15px;
  95. background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAWCAYAAADAQbwGAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAE6SURBVDhP7ZStTgNBFEZvmwpkRUUFsqJJKyoqKhBIRCWiD4CkggRPeAIEgodA8gAYEgQPgICktrJJDUkJ5dztV5id7KZDlqA4ydf7N/duZtIZK+PD7Bi9rM3WoTyHTrQsDRoHNK3QEs0iLTV4rOW7YfGNmiZKfUFupNq9UjlqFI5qZm3FGTRcY/bQlNpblgygfkW+iT3DLpR2Fj5wRbKhRGV84CkDW/gXm5RdyqYS9n3vxs/FpTCZuK8u+2sUDuQYJsj/b33Ft+hRfgc9o3OPYwoHcqZd1NHZOkP8kTvYfa/j9jyO+ZstV+F/YHVSB77LOqFfTniF+GmhQ+QvjsddNJDfQAcoe6GwxVe2tLCDuC+3ZbKvcpOh50FuHu7m3fZrPxW9TxrjV3MDhTbyl3p7f1OZM8Rf7rmZ2Sd4TZIuop129AAAAABJRU5ErkJggg==') no-repeat center;
  96. background-size: contain;
  97. cursor: pointer;
  98. }
  99. .unclick-grey{
  100. background-color:#DCDCDC;
  101. color:#393939;
  102. }
  103. </style>
  104. <div class="main-content-inner">
  105. <!-- 导航栏开始-->
  106. <?php include(Yii::app()->basePath.'/views/layouts/view_production_navigation.php');?>
  107. <!-- 导航栏结束-->
  108. <div class="en-tfb-grade-1">
  109. <h2>外刊宝生成</h2>
  110. <p class="color-red">提示:每个班级每周允许生成一次,最多选择5个主题语境</p>
  111. <p class="date">
  112. <span>当前时间:</span>
  113. <span><?php echo $year;?>年<?php echo $month;?>月第<?php echo $week;?>周</span>
  114. <span class="btn-start fr" onclick="location='/index.php/print/englishReadingTime'" style="margin: -9px 200px 0px 0!important;">时文阅读</span>
  115. <span class="btn-start fr" onclick="location='/index.php/print/englishReadingSetting'" style="margin: -9px 15px 0px 0!important;">按照教材单元设置</span>
  116. </p>
  117. <div class="option-wrap">
  118. <span class="option-name">话题:</span>
  119. <div class="option-con" id="optionEdition">
  120. <?php if(isset($theme_context) && $theme_context):?>
  121. <?php foreach($theme_context as $k=>$v):?>
  122. <span code="<?php echo $v['label_id'];?>" class="special-name"><?php echo $v['content'];?></span>
  123. <?php endforeach;?>
  124. <?php endif;?>
  125. </div>
  126. </div>
  127. <div class="option-wrap">
  128. <span class="option-name">班级:</span>
  129. <div class="option-con">
  130. <div>
  131. <select name="grade" class="select-grade">
  132. <option value="1" selected>高一</option>
  133. <option value="2">高二</option>
  134. <option value="3">高三</option>
  135. </select>
  136. </div>
  137. <div class="option-con-class" id="optionClass">
  138. </div>
  139. </div>
  140. </div>
  141. <div class="option-wrap">
  142. <span class="option-name">外刊类别:</span>
  143. <div class="option-con">
  144. <div><input type="radio" name="reading_type" value="1" checked="checked">个性外刊<span class="color-red">(班级同学语篇不完全相同,根据学生水平个性化)</span></div>
  145. <div><input type="radio" name="reading_type" value="2">共性外刊<span class="color-red">(班级同学语篇完全相同,老师可讲解)</span></div>
  146. </div>
  147. </div>
  148. <div class="option-wrap reading-level" style="display:none">
  149. <span class="option-name">外刊分级:</span>
  150. <div class="option-con">
  151. <div><input type="radio" name="reading_level" value="1" checked="checked">尖子班(优秀生)</div>
  152. <div><input type="radio" name="reading_level" value="2">培优班(中等生)</div>
  153. <div><input type="radio" name="reading_level" value="3">提高班(学困生)</div>
  154. </div>
  155. </div>
  156. <div class="option-wrap">
  157. <span class="option-name">下载方式:</span>
  158. <div class="option-con">
  159. <span><input type="radio" name="is_answer_separate" value="0" checked="checked">合并题目和答案</span>
  160. <span><input type="radio" name="is_answer_separate" value="1" >分离题目和答案</span>
  161. </div>
  162. </div>
  163. <span class="btn-start" id="confirm" active="true">开始生成</span>
  164. <span class="red class-msg" style="margin-left:20px"></span>
  165. </div>
  166. </div>
  167. <script src="/js/jquery.ajaxfileupload.js"></script>
  168. <script type="text/javascript">
  169. $(document).ready(function () {
  170. getClassByGrade(1);
  171. //增加专项
  172. function addItem(id,name) {
  173. var ele = '<label item_id="'+id+'">'+name+'<i class="icon selected-item"></i></label>';
  174. $(".special-item-box").append(ele);
  175. }
  176. function itmeNume() {
  177. $(".item-num").text($(".special-item-box>label").length);
  178. }
  179. //切换专题
  180. $(".special-name").click(function () {
  181. if($(this).hasClass("unclick-grey")){
  182. return false;
  183. }
  184. if($(this).hasClass("active")){
  185. $(this).removeClass("active");
  186. }else{
  187. $(this).addClass("active");
  188. }
  189. var num = $(".special-name.active").length;
  190. if(num >= 5){
  191. $(".special-name").each(function(){
  192. if(!$(this).hasClass("active")){
  193. $(this).addClass("unclick-grey");
  194. }
  195. });
  196. }else{
  197. $(".special-name").each(function(){
  198. if(!$(this).hasClass("active")){
  199. $(this).removeClass("unclick-grey");
  200. }
  201. });
  202. }
  203. });
  204. var optionData={
  205. edition:0,
  206. modular:0,
  207. unit:0,
  208. class:[],
  209. }
  210. // 单选按钮
  211. $("input[name='option-class']").change(function() {
  212. getsClassSelected();
  213. });
  214. function getsClassSelected() {
  215. optionData.class=[];
  216. var selectedData = $("input[name='option-class']:checked"); //获取所以选中学生
  217. for (var i = 0; i < selectedData.length; i++) {
  218. code = $(selectedData[i]).val();
  219. optionData.class.push(code);
  220. }
  221. };
  222. $('.select-grade').change(function(){
  223. var grade = $(this).val();
  224. getClassByGrade(grade);
  225. });
  226. $("body").delegate("#confirm[active='true']", "click", function() {
  227. var This = $(this);
  228. This.attr("active","false");
  229. var error = [];
  230. var selectClassIds = [];
  231. var selectedItemIds = [];
  232. var grade = parseInt($('.select-grade').val());
  233. // var textbookId = parseInt($('#optionEdition span.active').attr("code"));
  234. // var moduleId = parseInt($('#optionModular span.active').attr("code"));
  235. // var unitId = parseInt($('#optionUnit span.active').attr("code"));
  236. // var moduleName = $('#optionModular span.active').text();
  237. // var unitName = $('#optionUnit span.active').text();
  238. var type = parseInt($('input[name="reading_type"]:checked').val());
  239. var level = parseInt($('input[name="reading_level"]:checked').val());
  240. var isAnswerSeparate = $("input[name='is_answer_separate']:checked").val();
  241. $('#optionClass input:checked').each(function(k,v){
  242. if($(this).attr("status") == 0){
  243. selectClassIds.push($(this).val());
  244. }
  245. });
  246. $(".special-name.active").each(function(k,v){
  247. if($(this).attr("code")){
  248. selectedItemIds.push($(this).attr("code"));
  249. }
  250. });
  251. if(selectedItemIds.length == 0){
  252. error.push("请选择话题");
  253. }
  254. if(selectClassIds.length == 0){
  255. error.push("请选择班级");
  256. }
  257. // if(grade <= 0 || !grade){
  258. // error.push("请选择年级");
  259. // }
  260. // if(textbookId <= 0 || !textbookId){
  261. // error.push("请选择版本");
  262. // }
  263. // if(moduleId <= 0 || !moduleId){
  264. // error.push("请选择模块");
  265. // }
  266. // if(unitId <= 0 || !unitId){
  267. // error.push("请选择单元");
  268. // }
  269. if(error.length == 0){
  270. $.ajax({
  271. url: "<?php echo $this->createUrl('print/ajaxSaveEnglishReading');?>",
  272. type: "POST",
  273. dataType: "json",
  274. data: {
  275. grade:grade,
  276. selectClassIds:selectClassIds,
  277. selectedItemIds:selectedItemIds,
  278. textbookId:0,
  279. moduleId:0,
  280. unitId:0,
  281. moduleName:'',
  282. unitName:'',
  283. type:type,
  284. level:level,
  285. isAnswerSeparate:isAnswerSeparate
  286. },
  287. success: function (data) {
  288. if(data.status == 1){
  289. layer.msg('已发送到后台,预计1小时左右生成!', {
  290. time: 2000,
  291. });
  292. setTimeout(function(){window.location.href = "<?php echo Yii::app()->createUrl('print/english_reading');?>";}, 2000);
  293. }else{
  294. layer.msg(data.error.join('</br>'));
  295. This.attr("active","true");
  296. }
  297. }
  298. });
  299. }else{
  300. This.attr("active","true");
  301. layer.msg(error.join('</br>'));
  302. }
  303. });
  304. $("body").delegate("input[name='reading_type']", "click", function() {
  305. if($(this).val() == 1){
  306. $(".reading-level").hide();
  307. }else{
  308. $(".reading-level").show();
  309. }
  310. });
  311. function getClassByGrade(grade){
  312. if(grade){
  313. $.ajax({
  314. url: "<?php echo $this->createUrl('print/ajaxGetClassesBySettingReading');?>",
  315. type: "POST",
  316. dataType: "json",
  317. data: {
  318. grade: grade,
  319. },
  320. success: function (data) {
  321. console.log(data);
  322. var html = '';
  323. if(data && data.length > 0){
  324. for(var i in data){
  325. html +='<label>';
  326. if(data[i].status == 1){
  327. html += ' <input type="checkbox" name="option-class" value="'+data[i].class_id+'" checked="checked" disabled="disabled" status="1">'+data[i].class_name;
  328. }else{
  329. html += ' <input type="checkbox" name="option-class" value="'+data[i].class_id+'" status="0">'+data[i].class_name;
  330. }
  331. html +='</label>';
  332. }
  333. }
  334. $('#optionClass').html(html);
  335. if($("#optionClass input[status=0]").length > 0){
  336. $("#confirm").attr("active","true");
  337. $(".class-msg").html("");
  338. }else{
  339. $("#confirm").attr("active","false");
  340. $(".class-msg").html("本周您已经生成过啦,下周再来看看吧~");
  341. }
  342. }
  343. });
  344. }
  345. }
  346. });
  347. </script>