123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582 |
- <link rel="stylesheet" href="/fonts/fpdf/iconfont.css"/>
- <link rel="stylesheet" href="/css/alert.css"/>
- <?php $imgUrl = Yii::app()->request->hostInfo;?>
- <?php $disableImgUrl = Yii::app()->request->hostInfo.'/images/disable.png';?>
- <style>
- .color-red{
- color: red;
- }
- .color-green{
- color: green;
- }
- .option-wrap{
- margin-top: 20px;
- min-width: 600px;
- }
- .option-name{
- display: inline-block;
- width: 100px;
- vertical-align: top;
- margin-top: 10px;
- }
- .option-con{
- display: inline-block;
- width: 80%;
- min-width: 490px;
- padding: 10px;
- border: 1px solid #ccc;
- }
- .option-con>span{
- display: inline-block;
- margin-right: 20px;
- line-height: 1rem;
- cursor: pointer;
- }
- .option-con-class label{
- display: inline-block;
- margin-right: 20px;
- }
- .active{
- color: #619aff;
- }
- .btn-start{
- display: inline-block;
- margin-top: 20px;
- margin-left: 100px;
- padding: 10px 30px;
- color: #fff;
- background-color: #2977ff;
- cursor: pointer;
- }
- .en-tfb-grade-1{
- margin-left: 20px;
- }
- #selectedUnit,#selectedPaper,#selectedSpecials{
- /*display: inline-block;*/
- width: 80%;
- min-width: 490px;
- padding: 10px;
- border: 1px solid #ccc;
- display: inline-flex;
- flex-wrap: wrap;
- }
- #selectedUnit span,#selectedPaper span,#selectedSpecials span{
- position: relative;
- padding: 5px;
- padding-right: 30px;
- border: 1px solid #999;
- margin-right: 15px;
- margin-bottom: 5px;
- }
- .delete-icon{
- position: absolute;
- top: 50%;
- right: 5px;
- transform: translateY(-50%);
- width: 15px;
- height: 15px;
- background: url(<?php echo $imgUrl.'/images/icon-delect.png';?>) no-repeat center;
- background-size: contain;
- cursor: pointer;
- }
- .download-pdf{
- margin-right: 280px;
- float: right;
- background: #2977ff;
- height: 35px;
- width: 100px;
- line-height: 35px;
- text-align: center;
- }
- .download-pdf a{
- color: white;
- }
- </style>
- <div class="main-content-inner">
- <!-- 导航栏开始-->
- <?php include(Yii::app()->basePath.'/views/layouts/view_production_navigation.php');?>
- <!-- 导航栏结束-->
- <div class="en-tfb-grade-1">
- <h2>专题宝</h2>
- <div class="download-pdf"><a href="<?php echo $this->createUrl('special/downloadDir');?>">专题目录下载</a></div>
- <div class="color-red">
- <div class="blue">
- ** 每个班级每个专题最多生成3次产品(包括自动生成和手动生成)<br>
- ** 自动生成,每次只能选择一个专题生成,学生产品根据学生层次推送一套试卷,教师产品推送两套试卷<br>
- ** 手动生成,每次只能选择一个专题,并且最多选择12个方法,最多选择1套试卷或不选试卷<br>
- </div>
- 特别提示:新高考地区,请不要选择专题八,包括手动和自动!!!<br>
- 新高考地区包括:北京、天津、上海、浙江、山东、海南、广东、江苏、河北、重庆、辽宁、福建、湖南、湖北
- </div>
- <div class="option-wrap">
- <span class="option-name">选择班级:</span>
- <div class="option-con">
- <div class="option-con-class" id="optionClass">
- </div>
- </div>
- </div>
- <div class="option-wrap">
- <span class="option-name">生成方式:</span>
- <div class="option-con">
- <span><input type="radio" name="create_type" value="1" checked="checked">自动生成(根据高三复习考试大数据)</span>
- <span><input type="radio" name="create_type" value="2">手动生成(自主选择专题方法)</span>
- </div>
- </div>
- <div class="option-wrap">
- <span class="option-name">专题:</span>
- <div class="option-con" id="optionEdition">
- <?php foreach ($topNode as $item):?>
- <span code="<?php echo $item->pc_id;?>" class=""><?php echo $item->pc_name;?></span>
- <?php endforeach;?>
- </div>
- </div>
- <div class="option-wrap" id="lectureBox">
- <span class="option-name">第几讲:</span>
- <div class="option-con" id="optionModular">
- </div>
- </div>
- <div class="option-wrap" id="methodBox">
- <span class="option-name">方法:</span>
- <div class="option-con" id="optionUnit">
- </div>
- </div>
- <div class="option-wrap" id="selectedMethod">
- <span class="option-name">已选方法:</span>
- <div id="selectedUnit">
- </div>
- </div>
- <div class="option-wrap" id="selectedSpecial">
- <span class="option-name">已选专题:</span>
- <div id="selectedSpecials">
- </div>
- </div>
- <div class="option-wrap" id="specialPaper">
- <span class="option-name">试卷:</span>
- <div class="option-con" id="optionPaper">
- </div>
- </div>
- <div class="option-wrap" id="specialSelectedPaper">
- <span class="option-name">已选试卷:</span>
- <div id="selectedPaper">
- </div>
- </div>
- <div class="option-wrap">
- <span class="option-name">生成方式:</span>
- <div class="option-con">
- <span><input type="radio" name="is_answer_merge" value=1 checked="checked">答案部分与其他合并下载</span>
- <span style="margin-left: 10px;"><input type="radio" name="is_answer_merge" value=0>答案部分与其他分开下载</span>
- </div>
- </div>
- <button class="btn-start" id="confirm" active="true">开始生成</>
- </div>
- </div>
- <script src="/js/jquery.ajaxfileupload.js"></script>
- <script type="text/javascript">
- $(document).ready(function () {
- getClassByGrade(3);
- var optionData={
- edition:0,
- modular:0,
- unit:0,
- class:[],
- }
- var create_type = $('input:radio[name="create_type"]').val();
- if (create_type ==1){
- $("#specialPaper").hide();
- $("#specialSelectedPaper").hide();
- $("#lectureBox").hide();
- $("#methodBox").hide();
- $("#selectedMethod").hide();
- $("#selectedSpecial").show();
- }else{
- $("#selectedSpecial").hide();
- $("#lectureBox").show();
- $("#methodBox").show();
- $("#selectedMethod").show();
- $("#specialPaper").show();
- $("#specialSelectedPaper").show();
- }
- $('input:radio[name="create_type"]').change(function(){
- var v = $(this).val();
- if (v ==1){
- $('#selectedUnit').empty();
- $("#selectedSpecial").show();
- $("#lectureBox").hide();
- $("#methodBox").hide();
- $("#selectedMethod").hide();
- $("#specialPaper").hide();
- $("#specialSelectedPaper").hide();
- }else{
- $('#selectedSpecials').empty();
- $("#selectedSpecial").hide();
- $("#lectureBox").show();
- $("#methodBox").show();
- $("#selectedMethod").show();
- $("#specialPaper").show();
- $("#specialSelectedPaper").show();
- }
- });
- // 专题点击
- $("#optionEdition>span").on("click", function(event) {
- var create_type = $('input:radio[name="create_type"]:checked').val();
- if(create_type == 1){
- var selected_count = $("#selectedSpecials").children("span").length;
- if(selected_count == 1) {
- layer.msg('已选专题超出限制');
- return false;
- }
- }
- $("#optionEdition>span").removeClass('active')
- $(this).addClass('active');
- var code = $(this).attr("code");
- optionData.edition=code;
- });
- // 第几讲点击
- $("#optionModular>span").on("click", function(event) {
- $("#optionModular>span").removeClass('active')
- $(this).addClass('active');
- var code = $(this).attr("code");
- optionData.modular=code;
- });
- // 方法点击
- $("body").delegate("#optionUnit>span", "click", function() {
- if(!limitUnit()){
- layer.msg('已选方法数量超出限制');return false;
- }
- // $("#optionUnit>span").on("click", function(event) {
- $("#optionUnit>span").removeClass('active')
- $(this).addClass('active');
- var code = $(this).attr("code");
- optionData.unit=code;
- console.log('单元',code)
- });
- $("body").delegate("#optionEdition span", "click", function() {
- var create_type = $('input:radio[name="create_type"]:checked').val();
- //FIXME 自动生成方式
- if(create_type == 1){
- var node_id = $(this).attr("code");
- var selected_arr = [];
- if($('#selectedSpecials span').length > 0){
- $('#selectedSpecials span').each(function(index){
- selected_arr.push($(this).attr('node'));
- });
- }
- if($.inArray(node_id, selected_arr) >= 0){
- layer.msg('不能重复添加专题');return false;
- }
- var node_name = $(this).text();
- var _html = '<span node="' + node_id + '">' + node_name + '<i class="delete-icon" onclick="deleteUnit(this)"></i></span>';
- $("#selectedSpecials").append(_html);
- }else{
- //FIXME 手动生成方式
- if(!limitUnit()){
- layer.msg('已选单元超出限制');return false;
- }
- // $('#optionEdition span').on("click", function(event) {
- var textbookId = $(this).attr("code");
- if(textbookId){
- $.ajax({
- url: "<?php echo $this->createUrl('special/ajaxSpecialChild');?>",
- type: "POST",
- dataType: "json",
- data: {
- pc_id: textbookId
- },
- success: function (data) {
- console.log(data);
- var htmlModule = '';
- var htmlPaper = '';
- if(data.data.lectureList){
- $.each(data.data.lectureList, function (index, item) {
- htmlModule += '<span code="'+item.pc_id+'">'+item.pc_name+'</span>';
- })
- }
- if(data.data.paperList){
- $.each(data.data.paperList, function (index, item) {
- htmlPaper += '<span code="'+item.paper_id+'">'+item.paper_name+'</span>';
- })
- }
- $('#optionModular').html(htmlModule);
- $('#optionPaper').html(htmlPaper);
- }
- });
- }
- }
- })
- $("body").delegate("#optionModular span", "click", function() {
- var selected_count = $("#selectedSpecials").children("span").length;
- if(selected_count == 1) {
- layer.msg('已选专题超出限制');
- return false;
- }
- //FIXME 手动生成方式
- if(!limitUnit()){
- layer.msg('已选单元超出限制');return false;
- }
- $("#optionModular>span").removeClass('active')
- $(this).addClass('active');
- var code = $(this).attr("code");
- // optionData.modular=code;
- // $('#optionModular span').on("click", function(event) {
- // var moduleId = $(this).attr("code");
- // var textbookId = $('#optionEdition span.active').attr("code");
- if(code){
- $.ajax({
- url: "<?php echo $this->createUrl('special/ajaxMethod');?>",
- type: "POST",
- dataType: "json",
- data: {
- pc_id: code,
- },
- success: function (data) {
- console.log(data);
- var htmlUnit = '';
- if(data.data.methodList){
- $.each(data.data.methodList, function (index, item) {
- htmlUnit += '<span code="'+item.method_id+'">'+item.method_name+'</span>';
- })
- }
- $('#optionUnit').html(htmlUnit);
- }
- });
- }
- });
- $("body").delegate("#optionUnit span","click",function () {
- if(!limitUnit()){
- layer.msg('已选单元超出限制');return false;
- }
- var text_book_id = $("#optionEdition").children(".active").attr("code");
- var module_id = $("#optionModular").children(".active").attr("code");
- var unit_id = $(this).attr("code");
- var ids = text_book_id + '_' + module_id + '_' + unit_id;
- var selected_arr = [];
- if($('#selectedUnit span').length > 0){
- $('#selectedUnit span').each(function(index){
- selected_arr.push($(this).attr('node'));
- });
- }
- if($.inArray(ids, selected_arr) >= 0){
- layer.msg('不能重复添加该单元');return false;
- }
- var text_book_name = $("#optionEdition").children(".active").text();
- var module_name = $("#optionModular").children(".active").text();
- var unit_name = $(this).text();
- var names = text_book_name + '_' + module_name + '_' + unit_name;
- var _html = '<span node="' + ids + '">' + names + '<i class="delete-icon" onclick="deleteUnit(this)"></i></span>';
- $("#selectedUnit").append(_html);
- });
- $("body").delegate("#optionPaper span","click",function () {
- if($('#selectedPaper span').length == 1){
- layer.msg('已选试卷超出限制');return false;
- }
- var paper_id = $(this).attr("code");
- var selected_arr = [];
- if($('#selectedPaper span').length > 0){
- $('#selectedPaper span').each(function(index){
- selected_arr.push($(this).attr('node'));
- });
- }
- if($.inArray(paper_id, selected_arr) >= 0){
- layer.msg('不能重复添加该试卷');return false;
- }
- var paper_name = $(this).text();
- var _html = '<span node="' + paper_id + '">' + paper_name + '<i class="delete-icon" onclick="deleteUnit(this)"></i></span>';
- $("#selectedPaper").append(_html);
- });
- $("#confirm[active='true']").on("click", function() {
- $('#confirm').attr('disabled','disabled');
- var This = $(this);
- This.attr("active","false");
- var error = [];
- var selectClassIds = [];
- var unitIds = [];
- var names = [];
- var specialIds = [];
- var specialNames = [];
- var create_type = $('input:radio[name="create_type"]:checked').val();
- var is_answer_merge = $('input:radio[name="is_answer_merge"]:checked').val();
- var paperIds = [];
- var paperNames = [];
- // var train_push_type = $('input:radio[name="train_push_type"]:checked').val();
- $('#optionClass input:checked').each(function(k,v){
- selectClassIds.push($(this).val());
- });
- $('#selectedUnit span').each(function(k,v){
- unitIds.push($(this).attr('node'));
- names.push($(this).text())
- });
- $('#selectedSpecials span').each(function(k,v){
- specialIds.push($(this).attr('node'));
- specialNames.push($(this).text())
- });
- if(specialIds.length == 0){
- $('#optionEdition span').each(function(k,v){
- if($(this).hasClass('active')) {
- specialIds.push($(this).attr('code'));
- specialNames.push($(this).text())
- }
- });
- }
- $('#selectedPaper span').each(function(k,v){
- paperIds.push($(this).attr('node'));
- });
- $('#selectedPaper span').each(function(k,v){
- paperNames.push($(this).text());
- });
- if(selectClassIds.length == 0){
- error.push("请选择班级");
- }
- if(create_type == 1){
- if(specialIds.length == 0){
- error.push("请选择专题")
- }
- }else{
- if(unitIds.length == 0 && paperIds.length == 0){
- error.push("请专题方法或试卷生成")
- }
- }
- if(error.length == 0){
- $.ajax({
- url: "<?php echo $this->createUrl('special/ajaxSaveSetting');?>",
- type: "POST",
- dataType: "json",
- data: {
- grade: 3,
- selectClassIds:selectClassIds,
- unitIds: unitIds,
- names: names,
- createType : create_type,
- // trainPushType : train_push_type,
- specialIds : specialIds,
- specialNames : specialNames,
- paperIds : paperIds,
- isAnswerMerge : is_answer_merge,
- paperNames : paperNames
- },
- success: function (data) {
- if(data.status == 1){
- layer.msg('已发送到后台,预计1小时左右生成!', {
- time: 2000,
- });
- setTimeout(function(){window.location.href = "<?php echo Yii::app()->createUrl('special/index');?>";}, 2000);
- }else{
- layer.msg(data.error);
- This.attr("active","true");
- }
- $('#confirm').removeAttr('disabled');
- }
- });
- }else{
- $('#confirm').removeAttr('disabled');
- This.attr("active","true");
- layer.msg(error.join('</br>'));
- }
- });
- function getClassByGrade(grade){
- if(grade){
- $.ajax({
- url: "<?php echo $this->createUrl('special/ajaxGetClasses');?>",
- type: "POST",
- dataType: "json",
- data: {
- grade: grade,
- },
- beforeSend:function(){
- layer.load(1, {
- shade: [0.1,'#fff'] //0.1透明度的白色背景
- });
- },
- success: function (data) {
- var index = layer.load();
- layer.close(index);
- var html = '';
- if(data && data.length > 0){
- for(var i in data){
- html +='<label>';
- html += ' <input type="checkbox" name="option-class" value="'+data[i].class_id+'">'+data[i].class_name+'</label>';
- }
- }
- $('#optionClass').html(html);
- }
- });
- }
- }
- });
- function limitUnit() {
- var selected_count = $("#selectedUnit").children("span").length;
- if(selected_count == 12){
- return false;
- }
- return true;
- }
- function isPositiveInteger(s){//是否为正整数
- var reg = /^[1-9]\d*$/;
- return reg.test(s)
- }
- function deleteUnit(a) {
- $(a).parent().remove();
- }
- </script>
|