123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313 |
- <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;
- }
- .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;
- 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;
- }
- .btn-start{
- display: inline-block;
- margin-top: 20px;
- margin-left: 100px;
- padding: 10px 30px;
- color: #fff;
- background-color: #07af66;
- cursor: pointer;
- }
- .en-tfb-grade-1{
- margin-left: 20px;
- }
- #selectedUnit span{
- position: relative;
- padding: 5px;
- padding-right: 30px;
- border: 1px solid #999;
- margin-right: 15px;
- }
- .teacher-word-group{
- color: green;
- }
- .word-group-hidden{
- height: 38px;
- overflow: hidden;
- }
- </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>
- <p class="color-red">* * 写作宝需选择教师端写作指导后生成产品PDF!题目需要!【每个班级 每周】最多生成【5次】写作宝,均不限年级、不限间隔时间。</p>
- <p class="date">
- <span>当前时间:</span>
- <span><?php echo $year;?>年<?php echo $month;?>月第<?php echo $week;?>周</span>
- </p>
- <div class="option-wrap">
- <span class="option-name">班级:</span>
- <div class="option-con">
- <div>
- <select name="grade" class="select-grade">
- <option value="1" <?php if(isset($setting['grade']) && $setting['grade']==1) echo 'selected';?>>高一</option>
- <option value="2" <?php if(isset($setting['grade']) && $setting['grade']==2) echo 'selected';?>>高二</option>
- <option value="3" <?php if(isset($setting['grade']) && $setting['grade']==3) echo 'selected';?>>高三</option>
- </select>
- </div>
- <div class="option-con-class" id="optionClass">
- </div>
- </div>
- </div>
- <div class="option-wrap card-teacher">
- <span class="option-name">教师端-自选写作指导:</span>
- <div class="option-con word-group-hidden" style="position: relative;" id="allTeacherWord">
- <?php foreach ($groupList as $group):?>
- <span><input type="radio" name="ewg_id" topic_type="<?php echo $group['topic_type'];?>" value="<?php echo $group['ewg_id'];?>" <?php if(isset($setting['ewg_id']) && $setting['ewg_id'] == $group['ewg_id']){ echo "checked";}; ?>> <?php echo $group['name'];?> <span class="teacher-word-group"><?php echo sprintf('(%s,%s)',$group['create_time'],$group['teacher_name']);?></span></span>
- <?php endforeach;?>
- <div style="cursor:pointer;position: absolute;right: 5px;top: 5px;color: green;" id="show-teacher-word" is-hold="1" onclick="isHold()">展开</div>
- </div>
- <p style="margin-left:100px;color: red;font-weight: bold">
- *每个写作指导名称后的括号内为生成时间。可以多次选择同一写作指导的题目以供不同班级检测。
- </p>
- </div>
-
- <div class="option-wrap">
- <span class="option-name">写作卡类型:</span>
- <div class="option-con writing-type-one" style="position: relative;">
- <span>
- <input type="radio" name="writing_type" value="1" checked="checked">一般写作卡
- <input type="radio" name="writing_type" value="2">题卡合一写作卡
- </span>
-
- </div>
- <div class="option-con writing-type-two" style="position: relative;display: none">
- <span>
- <input type="radio" name="writing_type" value="3">一卡两题
- <span style="margin-left:100px;color: red;font-weight: bold">*若写作组为一卡两题,写作卡类型为一卡两题,不可修改。</span>
- </span>
-
- </div>
- </div>
- <div class="option-wrap">
- <span class="option-name">考号方式:</span>
- <div class="option-con" style="position: relative;">
- <span>
- <input type="radio" name="scan_type" value="1" checked="checked">二维码
- <input type="radio" name="scan_type" value="2">填涂考号
- </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(<?php echo isset($setting['grade'])?$setting['grade']:1 ;?>);
- var optionData={
- edition:0,
- modular:0,
- unit:0,
- class:[],
- }
- // 选择年级
- $(".select-grade").change(function() {
- console.log($(this).val())
- });
- // 单选按钮
- $("input[name='option-class']").change(function() {
- getsClassSelected();
- });
- //选择写作指导
- $("input[name='ewg_id']").click(function() {
- var topic_type = $(this).attr("topic_type");
- if(topic_type == 3){
- $(".writing-type-two").show();
- $(".writing-type-one").hide();
- $("input[name='writing_type']").attr("checked",false);
- $("input[name='writing_type'][value='3']").prop("checked",true);
- }else{
- $(".writing-type-two").hide();
- $(".writing-type-one").show();
- $("input[name='writing_type']").attr("checked",false);
- $("input[name='writing_type'][value='1']").prop("checked",true);
- }
- });
- 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(){
- $('#selectedUnit').empty();
- var grade = $(this).val();
- getClassByGrade(grade);
- });
- $("#confirm[active='true']").on("click", function() {
- $('#confirm').attr('disabled','disabled');
- var This = $(this);
- This.attr("active","false");
- var error = [];
- var selectClassIds = [];
- var grade = parseInt($('.select-grade').val());
- var ewg_id = $("input[name='ewg_id']:checked").val();
- var scan_type = $("input[name='scan_type']:checked").val();
- var writing_type = $("input[name='writing_type']: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("请选择年级");
- }
- if(ewg_id){
- }
- if(error.length == 0){
- $.ajax({
- url: "<?php echo $this->createUrl('writing/ajaxSaveSetting');?>",
- type: "POST",
- dataType: "json",
- data: {
- grade: grade,
- selectClassIds:selectClassIds,
- ewg_id: ewg_id,
- scan_type:scan_type,
- writing_type:writing_type
- },
- success: function (data) {
- if(data.status == 1){
- layer.msg('已发送到后台,预计1小时左右生成!', {
- time: 2000,
- });
- setTimeout(function(){window.location.href = "<?php echo Yii::app()->createUrl('writing/index');?>";}, 2000);
- }else{
- layer.msg(data.error.join('</br>'));
- 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('writing/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>';
- if(data[i].status == 1){
- html += '<span title="该班级已达每周生成的最大次数"><img src="<?php echo $disableImgUrl;?>">'+data[i].class_name+'</span><span style="margin-left: 5px;" class="unit_generate_count">(<span>5</span>)</span></label>';
- }else{
- var isChecked = data[i].selected === true ? 'checked' : '';
- html += ' <input type="checkbox" name="option-class" ' + isChecked + ' value="'+data[i].class_id+'" status="0">'+data[i].class_name+'<span style="color:red;margin-left: 5px;" class="unit_generate_count">' + '(' + '<span>'+ data[i].count +'</span>' + ')' + '</span></label>';
- }
- }
- }
- html += '<div style="color: red;font-weight: bold">' + '* 提示:每个班级名称后的括号内为本班的本周生成次数。' + '</div>';
- $('#optionClass').html(html);
- }
- });
- }
- }
- });
- function isPositiveInteger(s){//是否为正整数
- var reg = /^[1-9]\d*$/;
- return reg.test(s)
- }
- function isHold() {
- var is_hold = $('#show-teacher-word').attr('is-hold');
- if(is_hold == 0){
- $('#show-teacher-word').attr('is-hold', 1);
- $('#allTeacherWord').addClass('word-group-hidden');
- $('#show-teacher-word').html('展开');
- }else {
- $('#show-teacher-word').attr('is-hold', 0);
- $('#allTeacherWord').removeClass('word-group-hidden');
- $('#show-teacher-word').html('收起');
- }
- }
- </script>
|