123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227 |
- <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;
- }
- .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{
- 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;
- }
- #selectedChapter{
- display: inline-block;
- width: 80%;
- min-width: 490px;
- padding: 10px;
- border: 1px solid #ccc;
- }
- #selectedChapter span{
- position: relative;
- padding: 5px;
- padding-right: 30px;
- border: 1px solid #999;
- display: inline-block;
- margin-right: 15px;
- margin-top: 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;
- }
- .teacher-word-group{
- color: #619aff;
- }
- .word-group-hidden{
- height: 38px;
- overflow: hidden;
- }
- .hide{
- display:none;
- }
- .margin-left20{
- margin-left:20px;
- }
- .multiline{
- display:inline-block;
- margin-left:10px;
- }
- </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">* 好消息!词汇宝现已支持教师端选词后生成检测卡!【每个班级 每周】最多生成【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">
- <span class="option-name">版本:</span>
- <div class="option-con" id="optionEdition">
- <?php if(isset($textbooks) && $textbooks):?>
- <?php $no =1;?>
- <?php foreach($textbooks as $k=>$v):?>
- <span code="<?php echo $v['textbook_id'];?>" class="<?php echo $no==1?'active':'';?>"><?php echo $v['textbook_name'];?></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($modules) && $modules):?>
- <?php $no =1;?>
- <?php foreach($modules as $k=>$v):?>
- <span code="<?php echo $v['textbook_id'];?>" class="<?php echo $no==1?'active':'';?>"><?php echo $v['textbook_name'];?></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($units) && $units):?>
- <?php $no =1;?>
- <?php foreach($units as $k=>$v):?>
- <span code="<?php echo $v['textbook_id'];?>" class="<?php echo $no==1?'active':'';?>"><?php echo $v['textbook_name'];?></span>
- <?php $no++;?>
- <?php endforeach;?>
- <?php endif;?>
- </div>
- </div>
- <div class="option-wrap">
- <span class="option-name">小节:</span>
- <div class="option-con" id="optionChapter">
- <?php if(isset($chapters) && $chapters):?>
- <?php foreach($chapters as $k=>$v):?>
- <span code="<?php echo $v['textbook_id'];?>" class=""><?php echo $v['textbook_name'];?></span>
- <?php endforeach;?>
- <?php endif;?>
- </div>
- </div>
- <div class="option-wrap hide">
- <span class="option-name">已选单元:</span>
- <div id="selectedUnit">
- </div>
- </div>
- <div class="option-wrap">
- <span class="option-name">已选:</span>
- <div id="selectedChapter">
- </div>
- <li style="list-style:none;margin-left:100px;color: red;font-weight: bold">* 高一二年级每次只可选一个单元,高三年级可选1~3个单元。</li>
- </div>
- <?php if($isWhole):?>
- <div class="option-wrap">
- <span class="option-name">词汇精讲数量:</span>
- <div class="option-con" >
- <!-- <span><input type="radio" name="words_count" value="1" >默认数量(<i id="word_default">20</i>)个</span>-->
- <span><input value="<?php echo isset($setting['words_count'])?$setting['words_count']:15;?>" style="width: 80px;" name="words_number" type="text" placeholder="最多40个"></span>
- <span>共(<i id="word_total">0</i>)个</span>
- <span style="margin-left:50px;color: red;font-weight: bold">* 数量限制:10-40个,且不超过所选单元总单词数。</span>
- </div>
- </div>
- <?php else:?>
- <div class="option-wrap" style="display: none;">
- <span class="option-name">词汇精讲数量:</span>
- <div class="option-con" >
- <!-- <span><input type="radio" name="words_count" value="1" >默认数量(<i id="word_default">20</i>)个</span>-->
- <span><input value="15" style="width: 80px;" name="words_number" type="text" placeholder="最多40个"></span>
- <span>共(<i id="word_total">0</i>)个</span>
- </div>
- </div>
- <?php endif;?>
- <div class="option-wrap">
- <span class="option-name">下载方式:</span>
- <div class="option-con">
- <?php if(isset($setting['is_answer_separate'])):?>
- <span><input type="radio" name="is_answer_separate" value="1" <?php if($setting['is_answer_separate']==1) echo 'checked';?>>分离题目和答案</span>
- <span><input type="radio" name="is_answer_separate" value="0" <?php if($setting['is_answer_separate']==0) echo 'checked';?>>合并题目和答案</span>
- <?php else:?>
- <span><input type="radio" name="is_answer_separate" value="1" checked="checked">分离题目和答案</span>
- <span><input type="radio" name="is_answer_separate" value="0">合并题目和答案</span>
- <?php endif;?>
- <span style="margin-left:50px;color: red;font-weight: bold">* 只影响词汇集训和错词再练板块。</span>
- </div>
- </div>
- <div class="option-wrap">
- <span class="option-name">精准训练形式:</span>
- <div class="option-con" >
- <?php if(isset($setting['practice_type'])):?>
- <span><input type="radio" name="practice_type" value="1" <?php if($setting['practice_type']==1) echo 'checked';?>>共性(全班学生题目内容一致)</span>
- <span><input type="radio" name="practice_type" value="2" <?php if($setting['practice_type']==2) echo 'checked';?> >个性(根据学生正确率个性化推送题目内容) </span>
- <?php else:?>
- <span><input type="radio" name="practice_type" value="1" checked="checked">共性(全班学生题目内容一致)</span>
- <span><input type="radio" name="practice_type" value="2" >个性(根据学生正确率个性化推送题目内容) </span>
- <?php endif;?>
- </div>
- </div>
- <div id="commonSet" style="margin-left: 100px;">
- <div class="option-wrap">
- <span class="option-name">英汉互译形式:</span>
- <div class="option-con" >
- <?php if(isset($setting['translate_type'])):?>
- <span><input type="radio" name="translate_type" value="1" <?php if($setting['translate_type']==1) echo 'checked';?>>英汉互译</span>
- <span><input type="radio" name="translate_type" value="2" <?php if($setting['translate_type']==2) echo 'checked';?>>英译中</span>
- <span><input type="radio" name="translate_type" value="3" <?php if($setting['translate_type']==3) echo 'checked';?>>中译英</span>
- <?php else:?>
- <span><input type="radio" name="translate_type" value="1" checked="checked">英汉互译</span>
- <span><input type="radio" name="translate_type" value="2">英译中</span>
- <span><input type="radio" name="translate_type" value="3">中译英</span>
- <?php endif;?>
- </div>
- </div>
- <div class="option-wrap">
- <span class="option-name">班级间内容:</span>
- <div class="option-con" >
- <?php if(isset($setting['is_class_common'])):?>
- <span><input type="radio" name="is_class_common" value="1" <?php if($setting['is_class_common']==1) echo 'checked';?>>相同</span>
- <span><input type="radio" name="is_class_common" value="0" <?php if($setting['is_class_common']==0) echo 'checked';?>>不同</span>
- <?php else:?>
- <span><input type="radio" name="is_class_common" value="1" checked="checked">相同</span>
- <span><input type="radio" name="is_class_common" value="0" >不同</span>
- <?php endif;?>
- </div>
- </div>
- </div>
- <div class="option-wrap">
- <span class="option-name">检测卡来源:</span>
- <div class="option-con" >
- <?php if(isset($setting['card_word_source'])):?>
- <span><input type="radio" name="card_word_source" value="1" <?php if($setting['card_word_source']==1) echo 'checked';?>>学管端自选单元对应词汇</span>
- <span><input type="radio" name="card_word_source" value="2" <?php if($setting['card_word_source']==2) echo 'checked';?>>教师端自选词汇</span>
- <?php else:?>
- <span><input type="radio" name="card_word_source" value="1" checked="checked">学管端自选单元对应词汇</span>
- <span><input type="radio" name="card_word_source" value="2" >教师端自选词汇</span>
- <?php endif;?>
- </div>
- </div>
- <!--<div class="option-wrap card-as2" >
- <span class="option-name">检测卡词语数量:</span>
- <div class="option-con" >
- <?php /*if(isset($setting['card_word_count'])&& !empty($setting['card_word_count'])):*/?>
- <span>检测卡词语数量:</span>
- <span><input style="width: 80px;" name="card_number" type="text" value="<?php /*echo $setting['card_word_count'];*/?>" placeholder="最多50个"></span><span>共(<i id="card_word_count_total">0</i>)个</span>
- <span style="margin-left:50px;color: red;font-weight: bold">*数量限制:10-50个,且不超过所选单元总单词数。优先推送词汇回顾中的课标重点词汇,题型为中译英。</span>
- <?php /*else:*/?>
- <span>检测卡词语数量:</span>
- <span><input style="width: 80px;" name="card_number" type="text" value="30" placeholder="最多50个"></span><span>共(<i id="card_word_count_total">0</i>)个</span>
- <span style="margin-left:50px;color: red;font-weight: bold">*数量限制:10-50个,且不超过所选单元总单词数。优先推送词汇回顾中的课标重点词汇,题型为中译英。</span>
- <?php /*endif;*/?>
- </div>
- </div>-->
- <div class="option-wrap card-as2">
- <!-- mhk -->
- <span class="option-name">检测卡词语数量:</span>
- <div class="option-con">
- <div>
- <div style="display: inline-block;">
- <span>单词数量:</span>
- <span id="card_word_count_total">0</span>
- </div>
- <div style="display: inline-block; margin-left: 20px;">
- <span style="color: #6300BF;font-weight: 700; font-size: 16px;">汉译英:</span>
- <span><input style="width: 60px; text-align: center;" name="card_number" min="0" max="40" type="number" value="0" class="word_chinese_english"></span>
- </div>
- <div style="display: inline-block;margin-left: 10px;">
- <span style="color: #6300BF;font-weight: 700; font-size: 16px;">英译汉:</span>
- <span><input style="width: 60px; text-align: center;" name="card_number" min="0" max="40" type="number" value="0" class="word_english_chinese"></span>
- </div>
- </div>
- <div style="margin-top: 5px;">
- <div style="display: inline-block;">
- <span>短语数量:</span>
- <span id="card_phrase_count_total">0</span>
- </div>
- <div style="display: inline-block; margin-left: 20px;">
- <span style="color: #6300BF;font-weight: 700; font-size: 16px;">汉译英:</span>
- <span><input style="width: 60px; text-align: center;" name="card_number" min="0" max="40" type="number" value="0" class="phrase_chinese_english"></span>
- </div>
- <div style="display: inline-block;margin-left: 10px;">
- <span style="color: #6300BF;font-weight: 700; font-size: 16px;">英译汉:</span>
- <span><input style="width: 60px; text-align: center;" name="card_number" min="0" max="40" type="number" value="0" class="phrase_english_chinese"></span>
- </div>
- <span style="margin-left:30px;color: red;font-weight: bold">*数量限制:10-400个,且不超过所选单元总词汇数。优先推送词汇回顾中的课标重点词汇。</span>
- </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="word_group_id" value="<?php echo $group['word_group_id'];?>" <?php if(isset($setting['word_group_id']) && $setting['word_group_id'] == $group['word_group_id']){ echo "checked";}; ?>> <?php echo $group['name'];?> <span class="teacher-word-group"><?php echo sprintf('(%s,%s个)',$group['create_time'],$group['word_count']);?></span></span>
- <?php endforeach;?>
- <div style="cursor:pointer;position: absolute;right: 5px;top: 5px;color: #619aff;" 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">
- <div style="display: inline-block">
- <span class="">英译汉批改模式</span>
- <select name="correcting-model" class="correcting-model">
- <option value="1">广义</option>
- <option value="2">教材义</option>
- </select>
- </div>
- <div style="display: inline-block;margin-left:50px;">
- <span class="">汉译英检测卡汉语呈现范围</span>
- <select name="card-chinese-range" class="card-chinese-range">
- <option value="1">仅本单元</option>
- <option value="2">全部词义</option>
- </select>
- </div>
- </div>
- </div>
- <div class="option-wrap">
- <!-- mhk -->
- <span class="option-name">派生:</span>
- <div class="option-con">
- <div>
- <div style="display: inline-block;">
- <span>单词-英译汉:</span>
- </div>
- <div class="multiline">
- <span>
- <input type="radio" id="word_english_chinese_one" name="word_english_chinese" value="1">
- <label for="word_english_chinese_one">有</label>
- </span>
- <span class="margin-left20">
- <input type="radio" id="word_english_chinese_two" name="word_english_chinese" value="0" checked="checked">
- <label for="word_english_chinese_two">无</label>
- </span>
- </div>
- </div>
- <div style="margin-top: 5px;">
- <div style="display: inline-block;">
- <span>单词-汉译英:</span>
- </div>
- <div class="multiline">
- <span>
- <input type="radio" id="word_chinese_english_one" name="word_chinese_english" value="1">
- <label for="word_chinese_english_one">有</label>
- </span>
- <span class="margin-left20">
- <input type="radio" id="word_chinese_english_two" name="word_chinese_english" value="0" checked="checked">
- <label for="word_chinese_english_two">无</label>
- </span>
- </div>
- </div>
- </div>
- </div>
- <div class="option-wrap">
- <span class="option-name">扫描方式:</span>
- <div class="option-con">
- <?php if(isset($setting['scan_type'])):?>
- <span><input type="radio" name="scan_type" value="1" <?php if($setting['scan_type']==1) echo 'checked';?>>二维码</span>
- <span><input type="radio" name="scan_type" value="2" <?php if($setting['scan_type']==2) echo 'checked';?>>填涂考号</span>
- <?php else:?>
- <span><input type="radio" name="scan_type" value="1" checked="checked">二维码</span>
- <span><input type="radio" name="scan_type" value="2">填涂考号</span>
- <?php endif;?>
- </div>
- </div>
- <button class="btn-start" id="confirm" active="true">开始生成</>
- </div>
- </div>
- <input type="hidden" value="1" class="is-new-version"/>
- <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:[],
- }
- <?php if($setting['practice_type']==2){ ?>
- commonSet(2);
- <?php } ?>
- <?php if($setting['card_word_source']==2):?>
- $('.card-chinese-range').parent().hide();
- <?php endif;?>
- //获取版本模块单元
- // 版本点击
- $("#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)
- });
- // 选择年级
- $(".select-grade").change(function() {
- console.log($(this).val())
- });
- // 单选按钮
- $("input[name='option-class']").change(function() {
- getsClassSelected();
- });
- //检测卡来源切换
- var card_sourse = $("input[name='card_word_source']:checked").val();
- if(card_sourse == 1){
- $('.card-as2').show();
- $('.card-teacher').hide();
- }else{
- $('.card-as2').hide();
- $('.card-teacher').show();
- }
- $("input[name='card_word_source']").change(function() {
- if($(this).val() == 1){
- $('.card-teacher').hide();
- $('.card-as2').show();
- $('.card-chinese-range').parent().show();
- $('.card-chinese-range').find('option').eq(0).prop('selected',true);
- }else{
- $('.card-as2').hide();
- $('.card-teacher').show();
- $('.card-chinese-range').parent().hide();
- $('.card-chinese-range').find('option').eq(0).prop('selected',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);
- }
- };
- //
- $("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/ajaxNewGetModuleAndUnit');?>",
- type: "POST",
- dataType: "json",
- data: {
- version_id: textbookId,
- query_type:2
- },
- success: function (data) {
- console.log(data);
- if(data.status!=1){
- layer.msg('请求失败');return false;
- }
- var htmlModule = '';
- var htmlUnit = '';
- if(data.data.modules){
- var a = 1;
- for(var i in data.data.modules){
- var module=data.data.modules[i];
- if(a == 1){
- htmlModule += '<span code="'+module.textbook_id+'" class="active">'+module.textbook_name+'</span>';
- }else{
- htmlModule += '<span code="'+module.textbook_id+'">'+module.textbook_name+'</span>';
- }
- a++;
- }
- }
- if(data.data.units){
- var a = 1;
- for(var i in data.data.units){
- var unit=data.data.units[i];
- if(a == 1){
- htmlUnit += '<span code="'+unit.textbook_id+'" class="active">'+unit.textbook_name+'</span>';
- }else{
- htmlUnit += '<span code="'+unit.textbook_id+'">'+unit.textbook_name+'</span>';
- }
- a++;
- }
- }
- $('#optionModular').html(htmlModule);
- $('#optionUnit').html(htmlUnit);
- chaptersHtml(data.data.chapters);
- }
- });
- }
- })
- $("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;
- var moduleId = $(this).attr("code");
- var textbookId = $('#optionEdition span.active').attr("code");
- if(textbookId && moduleId){
- $.ajax({
- url: "<?php echo $this->createUrl('print/ajaxNewGetUnitAndChapters');?>",
- type: "POST",
- dataType: "json",
- data: {
- version_id: textbookId,
- module_id:moduleId,
- query_type:2
- },
- success: function (data) {
- console.log(data);
- if(data.status!=1){
- layer.msg('请求失败');return false;
- }
- var htmlUnit = '';
- if(data.data.units){
- var a = 1;
- for(var i in data.data.units){
- var unit=data.data.units[i];
- if(a == 1){
- htmlUnit += '<span code="'+unit.textbook_id+'" class="active">'+unit.textbook_name+'</span>';
- }else{
- htmlUnit += '<span code="'+unit.textbook_id+'">'+unit.textbook_name+'</span>';
- }
- a++;
- }
- }
- $('#optionUnit').html(htmlUnit);
- chaptersHtml(data.data.chapters);
- }
- });
- }
- })
- $("body").delegate("#optionUnit span","click",function () {
- $("#optionUnit>span").removeClass('active')
- $(this).addClass('active');
- var code = $(this).attr("code");
- optionData.modular=code;
- var moduleId = $(this).attr("code");
- var textbookId = $('#optionEdition span.active').attr("code");
- if(textbookId && moduleId){
- $.ajax({
- url: "<?php echo $this->createUrl('print/ajaxNewGetChapters');?>",
- type: "POST",
- dataType: "json",
- data: {
- version_id: textbookId,
- module_id:moduleId,
- query_type:2
- },
- success: function (data) {
- console.log(data);
- if(data.status!=1){
- layer.msg('请求失败');return false;
- }
- chaptersHtml(data.data.chapters);
- }
- });
- }
- });
- function chaptersHtml(chapters){
- var htmlChapter = '';
- var selected_chapter_arr = [];
- if($('#selectedChapter span').length > 0){
- $('#selectedChapter span').each(function(index){
- selected_chapter_arr.push($(this).attr('node'));
- });
- }
- var text_book_id = $("#optionEdition").children(".active").attr("code");
- var module_id = $("#optionModular").children(".active").attr("code");
- var unit_id =$("#optionUnit").children(".active").attr("code");
- var unit_ids = text_book_id + '_' + module_id + '_' + unit_id;
- if(chapters){
- for(var i in chapters){
- var chapter=chapters[i];
- var ids=unit_ids+ '_' +chapter.textbook_id;
- var classActive='';
- if($.inArray(ids, selected_chapter_arr) >= 0){
- classActive='active';
- }
- htmlChapter += '<span code="'+chapter.textbook_id+'" class="'+classActive+'">'+chapter.textbook_name+'</span>';
- }
- }
- $('#optionChapter').html(htmlChapter);
- }
- $("body").delegate("#optionChapter span","click",function () {
- var text_book_id = $("#optionEdition").children(".active").attr("code");
- var module_id = $("#optionModular").children(".active").attr("code");
- var unit_id =$("#optionUnit").children(".active").attr("code");
- var chapter_id=$(this).attr('code');
- var unit_ids = text_book_id + '_' + module_id + '_' + unit_id;
- var ids=unit_ids+'_'+chapter_id;
- var selected_arr = [];
- if($('#selectedUnit span').length > 0){
- $('#selectedUnit span').each(function(index){
- selected_arr.push($(this).attr('node'));
- });
- }
- //单元控制数量
- var grade = $('.select-grade').val();
- var selected_count = $("#selectedUnit").children("span").length;
- if(grade == 3 && selected_count >= 3 && $.inArray(unit_ids, selected_arr) == -1){
- layer.msg('已选单元超出限制');
- return false;
- }
- if(grade!=3 && selected_count>=1 && $.inArray(unit_ids, selected_arr) == -1){
- layer.msg('已选单元超出限制');
- return false;
- }
- var text_book_name = $("#optionEdition").children(".active").text();
- var module_name = $("#optionModular").children(".active").text();
- var unit_name = $("#optionUnit").children(".active").text();
- var names = text_book_name + '_' + module_name + '_' + unit_name;
- if($.inArray(unit_ids, selected_arr) == -1) {
- var _html = '<span node="' + unit_ids + '">' + names + '<i class="delete-icon" onclick="deleteUnit(this)"></i></span>';
- $("#selectedUnit").append(_html);
- }
- var selected_chapter_arr = [];
- if($('#selectedChapter span').length > 0){
- $('#selectedChapter span').each(function(index){
- selected_chapter_arr.push($(this).attr('node'));
- });
- }
- if($.inArray(ids, selected_chapter_arr) >= 0){
- layer.msg('不能重复添加该小节');
- getNumber();
- return false;
- }
- var chapter_name = $(this).text();
- var names = names + '_' + chapter_name;
- var _html = '<span node="' + ids + '" parent-node="' + unit_ids + '">' + names + '<i class="delete-icon" onclick="deleteChapter(this)"></i></span>';
- $("#selectedChapter").append(_html);
- $(this).addClass('active');
- getNumber();
- })
- function getNumber(){
- var selected_chapter_arr = [];
- if($('#selectedChapter span').length > 0){
- $('#selectedChapter span').each(function(index){
- selected_chapter_arr.push($(this).attr('node'));
- });
- }
- $.ajax({
- url: "<?php echo $this->createUrl('magic/ajaxNewWordCount');?>",
- type: "POST",
- dataType: "json",
- data: {
- ids: selected_chapter_arr
- },
- beforeSend:function(){
- layer.load(1, {
- shade: [0.1,'#fff'] //0.1透明度的白色背景
- });
- },
- success: function (data) {
- var index = layer.load();
- layer.close(index);
- if(data.status!=1){
- layer.msg('请稍后再试');
- return false;
- }
- $('#word_total').text(data.data.wordCount);
- $('#card_word_count_total').text(data.data.wordCount);
- $('#card_phrase_count_total').text(data.data.phraseCount);
- setCardNumberMax(data.data.wordCount,data.data.phraseCount);
- }
- });
- }
- function setCardNumberMax(wordCount,phraseCount){
- $('.word_chinese_english').attr('max',wordCount);
- $('.word_english_chinese').attr('max',wordCount);
- $('.phrase_chinese_english').attr('max',phraseCount);
- $('.phrase_english_chinese').attr('max',phraseCount);
- }
- $('.select-grade').change(function(){
- $('#selectedUnit').empty();
- $('#selectedChapter').empty();
- var grade = $(this).val();
- getClassByGrade(grade);
- $('#word_total').text(0);
- $('#card_default').text(0);
- $('#card_total').text(0);
- $('#card_word_count_total').text(0);
- $('#card_phrase_count_total').text(0);
- if($('#optionChapter span').length > 0){
- $('#optionChapter span').each(function(index){
- $(this).removeClass('active')
- });
- }
- });
- $("#confirm[active='true']").on("click", function() {
- $('#confirm').attr('disabled','disabled');
- var This = $(this);
- This.attr("active","false");
- var error = [];
- var selectClassIds = [];
- var chapterIds = [];
- var names = [];
- var grade = parseInt($('.select-grade').val());
- var is_class_common = $("input[name='is_class_common']:checked").val();
- var translate_type = $("input[name='translate_type']:checked").val();
- var practice_type = $("input[name='practice_type']:checked").val();
- var isAnswerSeparate = $("input[name='is_answer_separate']:checked").val();
- var card_word_source = $("input[name='card_word_source']:checked").val();
- var word_group_id = $("input[name='word_group_id']:checked").val();
- var scan_type = $("input[name='scan_type']:checked").val();
- var is_new_version=parseInt($('.is-new-version').val());
- var correcting_model=$(".correcting-model option:selected").val();
- var card_chinese_range=parseInt($(".card-chinese-range option:selected").val());
- var word_english_chinese = $("input[name='word_english_chinese']:checked").val();
- var word_chinese_english = $("input[name='word_chinese_english']:checked").val();
- var derive_json={};
- derive_json.word_english_chinese=word_english_chinese;
- derive_json.word_chinese_english=word_chinese_english;
- $('#optionClass input:checked').each(function(k,v){
- if($(this).attr("status") == 0){
- selectClassIds.push($(this).val());
- }
- });
- /*$('#selectedUnit span').each(function(k,v){
- unitIds.push($(this).attr('node'));
- names.push($(this).text())
- });*/
- $('#selectedChapter span').each(function(k,v){
- chapterIds.push($(this).attr('node'));
- names.push($(this).text())
- });
- if(selectClassIds.length == 0){
- error.push("请选择班级");
- }
- if(grade <= 0 || !grade){
- error.push("请选择年级");
- }
- if(chapterIds.length == 0){
- error.push("请选择小节")
- }
- var word_count = $("input[name='words_number']").val();
- if(!isPositiveInteger(word_count)){
- error.push("词汇精讲数量请输入正整数")
- }
- if(word_count > 40){
- error.push("词汇精讲数量最多40个")
- }
- if(word_count <= 0){
- error.push("请检查词汇精讲数量")
- }
- var input_card_count = $("input[name='card_number']").val();
- var total_card_count = parseInt($('#card_word_count_total').text());
- var card_count = 0;
- /*if(card_word_source == 1) {
- if (!isPositiveInteger(input_card_count)) {
- error.push("词汇检测卡词语数量请输入正整数");
- }
- card_count = parseInt(input_card_count);
- if (card_count > 50 || card_count<10) {
- error.push("词汇检测卡词语数量最多50个最少10个");
- }
- if(card_count>total_card_count){
- error.push("词汇检测卡词语数量超出总数");
- }
- }*/
- /*var word_chinese_english=parseInt($('.word_chinese_english').val());
- var word_english_chinese=parseInt($('.word_english_chinese').val());
- var phrase_chinese_english=parseInt($('.phrase_chinese_english').val());
- var phrase_english_chinese=parseInt($('.phrase_english_chinese').val());
- var card_word_count_total = parseInt($('#card_word_count_total').text());
- var card_phrase_count_total = parseInt($('#card_phrase_count_total').text());*/
- var word_chinese_english=$('.word_chinese_english').val();
- var word_english_chinese=$('.word_english_chinese').val();
- var phrase_chinese_english=$('.phrase_chinese_english').val();
- var phrase_english_chinese=$('.phrase_english_chinese').val();
- var card_word_count_total =$('#card_word_count_total').text();
- var card_phrase_count_total = $('#card_phrase_count_total').text();
- var card_count_json={};
- if(card_word_source==1){
- if (!isPositiveNumber(word_chinese_english)) {
- error.push("单词汉译英数量请输入大于或等于0整数");
- }
- if (!isPositiveNumber(word_english_chinese)) {
- error.push("单词英译汉数量请输入大于或等于0整数");
- }
- if (!isPositiveNumber(phrase_chinese_english)) {
- error.push("短语汉译英数量请输入大于或等于0整数");
- }
- if (!isPositiveNumber(phrase_english_chinese)) {
- error.push("短语英译汉数量请输入大于或等于0整数");
- }
- word_chinese_english=parseInt(word_chinese_english);
- word_english_chinese=parseInt(word_english_chinese);
- phrase_chinese_english=parseInt(phrase_chinese_english);
- phrase_english_chinese=parseInt(phrase_english_chinese);
- card_word_count_total = parseInt(card_word_count_total);
- card_phrase_count_total = parseInt(card_phrase_count_total);
- if(word_chinese_english+word_english_chinese>card_word_count_total){
- error.push("单词汉译英和英译汉数量超过单词数量总数");
- }
- if(phrase_chinese_english+phrase_english_chinese>card_phrase_count_total){
- error.push("单词汉译英和英译汉数量超过短语数量总数");
- }
- var card_total=word_chinese_english+word_english_chinese+phrase_chinese_english+phrase_english_chinese;
- if(card_total<10 || card_total>400){
- error.push("词汇检测卡词语数量最多400个最少10个");
- }
- card_count_json.word=card_word_count_total;
- card_count_json.word_chinese_english=word_chinese_english;
- card_count_json.word_english_chinese=word_english_chinese;
- card_count_json.phrase=card_phrase_count_total;
- card_count_json.phrase_chinese_english=phrase_chinese_english;
- card_count_json.phrase_english_chinese=phrase_english_chinese;
- }
- if(error.length == 0){
- $.ajax({
- url: "<?php echo $this->createUrl('magic/ajaxSaveSetting');?>",
- type: "POST",
- dataType: "json",
- data: {
- grade: grade,
- selectClassIds:selectClassIds,
- unitIds: chapterIds,
- names: names,
- translateType:translate_type,
- isClassCommon:is_class_common,
- practiceType:practice_type,
- wordCount:word_count,
- cardWord_count:card_count,
- isAnswerSeparate:isAnswerSeparate,
- cardWordSource: card_word_source,
- wordGroupId: word_group_id,
- scanType:scan_type,
- card_count_json:JSON.stringify(card_count_json),
- is_new_version:is_new_version,
- correcting_model:correcting_model,
- card_chinese_range:card_chinese_range,
- derive_json:JSON.stringify(derive_json)
- },
- success: function (data) {
- if(data.status == 1){
- layer.msg('已发送到后台,预计1小时左右生成!', {
- time: 2000,
- });
- setTimeout(function(){window.location.href = "<?php echo Yii::app()->createUrl('magic/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('magic/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 deleteUnit(a) {
- var ids = $(a).parent().attr('node');
- var grade = parseInt($('.select-grade').val());
- var generate_class = ".unit"+ ids;
- $("span").remove(generate_class);
- var units = [];
- if($('#selectedUnit span').length > 0){
- $('#selectedUnit span').each(function(index){
- if(ids!=$(this).attr('node')){
- units.push($(this).attr('node'));
- }
- });
- }
- if(units.length==0){
- $('#word_total').text(0);
- $('#card_word_count_total').text(0);
- $('#card_phrase_count_total').text(0);
- }else{
- //动态获取单元关联单词和短语数量
- $.ajax({
- url: "<?php echo $this->createUrl('magic/ajaxNewWordCount');?>",
- type: "POST",
- dataType: "json",
- data: {
- ids: units,
- grade: grade
- },
- beforeSend: function () {
- layer.load(1, {
- shade: [0.1, '#fff'] //0.1透明度的白色背景
- });
- },
- success: function (data) {
- var index = layer.load();
- layer.close(index);
- if (data.status != 1) {
- layer.msg('请稍后再试');
- return false;
- }
- $('#word_total').text(data.data.wordCount);
- $('#card_word_count_total').text(data.data.wordCount);
- $('#card_phrase_count_total').text(data.data.phraseCount);
- setCardNumberMax(data.data.wordCount,data.data.phraseCount);
- }
- });
- }
- $(a).parent().remove();
- }
- function setCardNumberMax(wordCount,phraseCount){
- $('.word_chinese_english').attr('max',wordCount);
- $('.word_english_chinese').attr('max',wordCount);
- $('.phrase_chinese_english').attr('max',phraseCount);
- $('.phrase_english_chinese').attr('max',phraseCount);
- }
- function deleteChapter(obj) {
- var ids = $(obj).parent().attr('node');
- var chapters = [];
- var chapterParent=[];
- if($('#selectedChapter span').length > 0){
- $('#selectedChapter span').each(function(index){
- if(ids!=$(this).attr('node')){
- chapters.push($(this).attr('node'));
- if($.inArray($(this).attr('parent-node'), chapterParent) == -1) {
- chapterParent.push($(this).attr('parent-node'))
- }
- }
- });
- }
- if($('#selectedUnit span').length > 0){
- $('#selectedUnit span').each(function(index){
- if($.inArray($(this).attr('node'), chapterParent) == -1) {
- $(this).remove();
- }
- });
- }
- if(chapters.length==0){
- $('#word_total').text(0);
- $('#card_word_count_total').text(0);
- $('#card_phrase_count_total').text(0);
- }else{
- //动态获取单元关联单词和短语数量
- $.ajax({
- url: "<?php echo $this->createUrl('magic/ajaxNewWordCount');?>",
- type: "POST",
- dataType: "json",
- data: {
- ids: chapters,
- },
- beforeSend: function () {
- layer.load(1, {
- shade: [0.1, '#fff'] //0.1透明度的白色背景
- });
- },
- success: function (data) {
- var index = layer.load();
- layer.close(index);
- if (data.status != 1) {
- layer.msg('请稍后再试');
- return false;
- }
- $('#word_total').text(data.data.wordCount);
- $('#card_word_count_total').text(data.data.wordCount);
- $('#card_phrase_count_total').text(data.data.phraseCount);
- setCardNumberMax(data.data.wordCount,data.data.phraseCount);
- }
- });
- }
- $(obj).parent().remove();
- var text_book_id = $("#optionEdition").children(".active").attr("code");
- var module_id = $("#optionModular").children(".active").attr("code");
- var unit_id =$("#optionUnit").children(".active").attr("code");
- var unit_ids = text_book_id + '_' + module_id + '_' + unit_id;
- if($('#optionChapter span').length > 0){
- $('#optionChapter span').each(function(index){
- if(unit_ids+'_'+$(this).attr('code')==ids){
- $(this).removeClass('active');
- }
- });
- }
- }
- function limitUnit() {
- /*var grade = $('.select-grade').val();
- var selected_count = $("#selectedUnit").children("span").length;
- if(grade == 3 && selected_count == 3){
- return false;
- }
- if(grade!=3 && selected_count>=1){
- return false;
- }*/
- return true;
- }
- function isPositiveInteger(s){//是否为正整数
- var reg = /^[1-9]\d*$/;
- return reg.test(s)
- }
- function isPositiveNumber(s){//是否为整数
- var reg = /^[0-9]\d*$/;
- return reg.test(s)
- }
- $('input:radio[name="practice_type"]').change(function(){
- var v = $(this).val();
- commonSet(v);
- });
- function commonSet(v){
- if (v ==1){
- $("#commonSet").show();
- }else{
- $("#commonSet").hide();
- }
- }
- 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>
|