123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353 |
- <link rel="stylesheet" href="/css/bootstrap.min.css">
- <link rel="stylesheet" href="/css/style.css">
- <link rel="stylesheet" href="/css/ace.min.css" class="ace-main-stylesheet" id="main-ace-style">
- <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;
- cursor: pointer;
- }
- .select-grade{
- width: 150px;
- line-height: 30px;
- margin-bottom: 10px;
- }
- .option-con-class label{
- display: inline-block;
- margin-right: 20px;
- }
- .active{
- color: #07af66;
- }
- .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{
- display: inline-block;
- width: 80%;
- min-width: 490px;
- padding: 10px;
- border: 1px solid #ccc;
- }
- #selectedUnit span{
- position: relative;
- padding: 5px;
- padding-right: 30px;
- border: 1px solid #999;
- margin-right: 15px;
- }
- .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;
- }
- </style>
- <div class="main-content-inner">
- <div class="en-tfb-grade-1">
- <div class="option-wrap">
- <span class="option-name">版本:</span>
- <div class="option-con" id="optionEdition">
- <?php if(isset($textbookNames) && $textbookNames):?>
- <?php $no =1;?>
- <?php foreach($textbookNames as $k=>$v):?>
- <span code="<?php echo $k;?>" class="<?php echo $no==1?'active':'';?>"><?php echo $v;?></span>
- <?php $no++;?>
- <?php endforeach;?>
- <?php endif;?>
- </div>
- </div>
- <div class="option-wrap">
- <span class="option-name">模块:</span>
- <div class="option-con" id="optionModular">
- <?php if(isset($moduleNames) && $moduleNames):?>
- <?php $no =1;?>
- <?php foreach($moduleNames as $k=>$v):?>
- <span code="<?php echo $k;?>" class="<?php echo $no==1?'active':'';?>"><?php echo $v;?></span>
- <?php $no++;?>
- <?php endforeach;?>
- <?php endif;?>
- </div>
- </div>
- <div class="option-wrap">
- <span class="option-name">单元:</span>
- <div class="option-con" id="optionUnit">
- <?php if(isset($unitNames) && $unitNames):?>
- <?php $no =1;?>
- <?php foreach($unitNames as $k=>$v):?>
- <span code="<?php echo $k;?>" class="<?php echo $no==1?'active':'';?>"><?php echo $v;?></span>
- <?php $no++;?>
- <?php endforeach;?>
- <?php endif;?>
- </div>
- </div>
- <div class="option-wrap">
- <span class="option-name">已选单元:</span>
- <div id="selectedUnit">
- <?php if(!empty($str) && !empty($ids)):?>
- <span node="<?php echo $ids;?>"><?php echo $str;?><i class="delete-icon" onclick="deleteUnit(this)"></i></span>
- <?php endif;?>
- </div>
- </div>
- <div class="option-wrap">
- <p >* 根据所选教学进度,推送产品时,将只推送进度之前的相关知识点的语篇练习。</p>
- </div>
- </div>
- </div>
- <script src="/js/ace-extra.min.js"></script>
- <script src="/js/jquery-2.2.2.min.js"></script>
- <!-- HTML5shiv and Respond.js for IE8 to support HTML5 elements and media queries -->
- <script src="/js/layer/layer.js"></script>
- <script type="text/javascript">
- $(document).ready(function () {
- var optionData={
- edition:0,
- modular:0,
- unit:0,
- }
- //获取版本模块单元
- // 版本点击
- $("#optionEdition>span").on("click", function(event) {
- if(!limitUnit()){
- layer.msg('已选单元超出限制');return false;
- }
- $("#optionEdition>span").removeClass('active')
- $(this).addClass('active');
- var code = $(this).attr("code");
- optionData.edition=code;
- console.log('版本',code)
- });
- // 模块点击
- $("#optionModular>span").on("click", function(event) {
- if(!limitUnit()){
- layer.msg('已选单元超出限制');return false;
- }
- $("#optionModular>span").removeClass('active')
- $(this).addClass('active');
- var code = $(this).attr("code");
- optionData.modular=code;
- console.log('模块',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() {
- 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('print/ajaxGetModuleAndUnit');?>",
- type: "POST",
- dataType: "json",
- data: {
- textbookId: textbookId
- },
- success: function (data) {
- console.log(data);
- var htmlModule = '';
- var htmlUnit = '';
- if(data.moduleNames){
- var a = 1;
- for(var i in data.moduleNames){
- if(a == 1){
- htmlModule += '<span code="'+i+'" class="active">'+data.moduleNames[i]+'</span>';
- }else{
- htmlModule += '<span code="'+i+'">'+data.moduleNames[i]+'</span>';
- }
- a++;
- }
- }
- if(data.unitNames){
- var a = 1;
- for(var i in data.unitNames){
- if(a == 1){
- htmlUnit += '<span code="'+i+'" class="active">'+data.unitNames[i]+'</span>';
- }else{
- htmlUnit += '<span code="'+i+'">'+data.unitNames[i]+'</span>';
- }
- a++;
- }
- }
- $('#optionModular').html(htmlModule);
- $('#optionUnit').html(htmlUnit);
- }
- });
- }
- })
- $("body").delegate("#optionModular span", "click", function() {
- 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(textbookId && moduleId){
- $.ajax({
- url: "<?php echo $this->createUrl('print/ajaxGetUnitByModuleId');?>",
- type: "POST",
- dataType: "json",
- data: {
- textbookId: textbookId,
- moduleId:moduleId
- },
- success: function (data) {
- console.log(data);
- var htmlUnit = '';
- if(data.unitNames){
- var a = 1;
- for(var i in data.unitNames){
- if(a == 1){
- htmlUnit += '<span code="'+i+'" class="active">'+data.unitNames[i]+'</span>';
- }else{
- htmlUnit += '<span code="'+i+'">'+data.unitNames[i]+'</span>';
- }
- a++;
- }
- }
- $('#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);
- });
- });
- function deleteUnit(a) {
- var ids = $(a).parent().attr('node');
- var grade = parseInt($('.select-grade').val());
- var generate_class = ".unit"+ ids;
- $("span").remove(generate_class);
- $(a).parent().remove();
- }
- function limitUnit() {
- var selected_count = $("#selectedUnit").children("span").length;
- if(selected_count==1){
- return false;
- }
- return true;
- }
- // $("#unitsSelected").click(function () {
- //
- //
- // var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
- //
- // parent.layer.close(index); //再执行关闭
- // $("#progress").attr("value", 11)
- // })
- function callbackdata() {
- return {
- html : $("#selectedUnit").html(),
- ids : $("#selectedUnit").children().attr("node"),
- str : $("#selectedUnit").children().text()
- }
- }
- </script>
|