123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271 |
- <link rel="stylesheet" href="/fonts/fpdf/iconfont.css"/>
- <link rel="stylesheet" href="/css/alert.css"/>
- <?php $imgUrl = Yii::app()->request->hostInfo.'/images/disable.png';?>
- <style>
- .color-red{
- color: red;
- }
- .en-tfb-grade-1 .date>span{
- margin-right: 40px;
- }
- .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;
- margin-top:10px;
- line-height: 1rem;
- cursor: pointer;
- }
- .select-grade{
- width: 150px;
- line-height: 30px;
- margin-bottom: 10px;
- }
- .option-con-class label{
- display: inline-block;
- margin-right: 20px;
- }
- .active{
- color: #697aff;
- }
- .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;
- }
- .layered-training .describe{width: 150px;margin-bottom: 10px;display: inline-block;}
- .layered-training .number{margin-bottom: 10px;display: inline-block; margin-left: 20px;}
- .layered-training .number input{width: 80px;text-align:center;}
- .layered-training .number .prompt{color: #6300BF;font-weight: 700;font-size: 16px;}
- </style>
- <div class="main-content-inner">
- <!-- 导航栏开始-->
- <?php include(Yii::app()->basePath.'/views/layouts/view_production_navigation.php');?>
- <!-- 导航栏结束-->
- <div class="en-tfb-grade-1">
- <h2><?php echo $productName; ?>生成</h2>
- <?php if($productType == ProductDownload::PRODUCT_TYPE_WRONG_REFINE):?>
- <p class="color-red">* 错题精练每册每学期仅可生成3次!</p>
- <?php else:?>
- <p class="color-red">* 假期作业每个班级一个学期仅能生成一次!</p>
- <?php endif;?>
- <h4>学期:<?php echo $semesterName; ?></h4>
- <?php if($productType == ProductDownload::PRODUCT_TYPE_WRONG_REFINE):?>
- <div class="option-wrap">
- <label><input type="radio" name="textbook" class="textbook" checked value="1">第一册 </label>
- <label><input type="radio" name="textbook" class="textbook" value="2">第二册 </label>
- <label><input type="radio" name="textbook" class="textbook" value="3">第三册 </label>
- <label><input type="radio" name="textbook" class="textbook" value="4">第四册 </label>
- <label><input type="radio" name="textbook" class="textbook" value="5">第五册 </label>
- <label><input type="radio" name="textbook" class="textbook" value="6">第六册 </label>
- </div>
- <?php else:?>
- <input type="hidden" name="textbook" value="0">
- <?php endif;?>
- <div class="option-wrap">
- <span class="option-name"><span class="color-red">*</span>班级:</span>
- <div class="option-con">
- <div>
- <select name="grade" class="select-grade">
- <option value="1" selected>高一</option>
- <option value="2">高二</option>
- <option value="3">高三</option>
- </select>
- </div>
- <div class="option-con-class" id="optionClass">
- </div>
- </div>
- </div>
- <div class="option-wrap" style="display: none;">
- <span class="option-name">得分率范围:</span>
- <div class="option-con">
- <div>
- <select name="scoring-rate" class="scoring-rate">
- <option value="C">50%以下</option>
- <option value="B" selected>50%-70%</option>
- <option value="A">70%以上</option>
- </select>
- <span class="color-red">(注:得分率设置仅适用于无考试数据班级,有数据者,以系统统计数据为准)</span>
- </div>
- <div class="option-con-class" id="optionClass">
- </div>
- </div>
- </div>
- <div class="option-wrap">
- <span class="option-name"><span class="color-red">*</span>下载方式:</span>
- <div class="option-con">
- <span><input type="radio" name="is-answer-merge" value="0" checked="checked">合并题目和答案</span>
- <span><input type="radio" name="is-answer-merge" value="1" >分离题目和答案</span>
- </div>
- </div>
- <span class="btn-start" id="confirm" active="true" style="margin-left: 10px;">开始生成</span>
- </div>
- </div>
- <script src="/js/jquery.ajaxfileupload.js"></script>
- <script type="text/javascript">
- $(document).ready(function () {
- var productType=<?php echo $productType; ?>;
- getClassByGrade(1,1);
- // 选择年级
- $(".select-grade").change(function() {
- console.log($(this).val())
- });
- // 单选按钮
- $("input[name='option-class']").change(function() {
- getsClassSelected();
- });
- function getsClassSelected() {
- optionData.class=[];
- var selectedData = $("input[name='option-class']:checked"); //获取所以选中学生
- for (var i = 0; i < selectedData.length; i++) {
- code = $(selectedData[i]).val();
- optionData.class.push(code);
- }
- };
- $('.select-grade').change(function(){
- var grade = $(this).val();
- var textbook=parseInt($('input[name=textbook]:checked').val());
- getClassByGrade(grade,textbook);
- });
- $('.textbook').click(function(){
- var grade = parseInt($('.select-grade').val())
- var textbook=parseInt($('input[name=textbook]:checked').val());
- getClassByGrade(grade,textbook);
- });
- $("body").delegate("#confirm[active='true']", "click", function() {
- var This = $(this);
- This.attr("active","false");
- var error = [];
- var selectClassIds = [];
- var grade = parseInt($('.select-grade').val())
- var textbook = parseInt($('input[name=textbook]:checked').val());
- var scoringRate=$('.scoring-rate').val();
- var isAnswerMerge =parseInt($("input[name='is-answer-merge']:checked").val());
- $('#optionClass input:checked').each(function(k,v){
- if($(this).attr("status") == 0){
- selectClassIds.push($(this).val());
- }
- });
- if(selectClassIds.length == 0){
- error.push("请选择班级");
- }
- if(grade <= 0 || !grade){
- error.push("请选择年级");
- }
- var settingJson={};
- settingJson.isAnswerMerge=isAnswerMerge;
- settingJson.scoringRate=scoringRate;
- if(error.length == 0){
- $.ajax({
- url: "<?php echo $this->createUrl('generalproduct/ajaxSaveSetting');?>",
- type: "POST",
- dataType: "json",
- data: {
- grade: grade,
- textbook:textbook,
- selectClassIds:selectClassIds,
- settingJson:JSON.stringify(settingJson),
- productType:productType
- },
- success: function (data) {
- if(data.status == 1){
- layer.msg('已发送到后台,预计24小时左右生成!', {
- time: 2000,
- });
- setTimeout(function(){window.location.href = "<?php echo Yii::app()->createUrl('generalproduct/index/productType/'.$productType);?>";}, 2000);
- }else{
- if($.isArray(data.error)) {
- layer.msg(data.error.join('</br>'));
- }else{
- layer.msg(data.error);
- }
- This.attr("active","true");
- }
- }
- });
- }else{
- This.attr("active","true");
- layer.msg(error[0]);
- }
- });
- function isPositiveNumber(s){//是否为整数
- var reg = /^[0-9]\d*$/;
- return reg.test(s)
- }
- function getClassByGrade(grade,textbook){
- if(grade){
- $.ajax({
- url: "<?php echo $this->createUrl('generalproduct/ajaxGetClasses');?>",
- type: "POST",
- dataType: "json",
- data: {
- grade: grade,
- productType:productType,
- textbook:textbook
- },
- success: function (data) {
- var html = '';
- if(data && data.length > 0){
- for(var i in data){
- html +='<label>';
- if(data[i].status == 1){
- html += '<span title="该班级已达每学期生成的最大次数"><img src="<?php echo $imgUrl;?>">'+data[i].class_name+'</span>';
- }else{
- html += '<input type="checkbox" name="option-class" value="'+data[i].class_id+'" status="0">'+data[i].class_name;
- }
- html +='</label>';
- }
- }
- $('#optionClass').html(html);
- }
- });
- }
- }
- });
- </script>
|