1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026 |
- <script src="/js/jquery.datetimepicker.js"></script>
- <link rel="stylesheet" href="/fonts/fpdf/iconfont.css" />
- <link rel="stylesheet" href="/css/modelCreatePaper.css" />
- <link rel="stylesheet" href="/css/jquery.datetimepicker.css" />
- <link rel="stylesheet" href="/css/third/paperCard.css" />
- <link type="text/css" rel="stylesheet" href="/js/select/select2.min.css" />
- <link rel="stylesheet" href="/css/alert.css"/>
- <script src="/js/select/select2.min.js"></script>
- <style>
- .class-box{
- width: 500px;
- }
- .class-box>p{
- margin-bottom: 10px;
- }
- .class-box>ul{
- width: 500px;
- height: 200px;
- padding: 10px 20px;
- background-color: #FAFAFA;
- box-sizing: border-box;
- border:1px solid #ddd;
- }
- .class-box>ul>li{
- float: left;
- margin-right: 15px;
- margin-bottom: 10px;
- cursor: pointer;
- }
- .class-box>ul>li>img{
- vertical-align: middle;
- margin-left: 3px;
- }
- .class-modal-body{margin-bottom:15px;}
- #gradeTxt{display:inline-block;border-left:2px solid #2977ff;padding-left:10px;}
- .class_right{
- width:650px;
- }
- .class_area li{
- width:185px;
- height:30px;
- line-height: 30px;
- text-align: center;
- border:1px solid #ccc;
- margin:5px;
- border-radius: 3px;
- cursor:pointer
- }
- .class_area li.active{
- color:#fff;
- background: #2977ff;
- cursor:pointer
- }
- .selected-box{overflow:auto}
- </style>
- <div class="main-content-inner">
- <!-- 导航栏开始-->
- <?php include(Yii::app()->basePath.'/views/layouts/view_navigation.php');?>
- <!-- 导航栏结束-->
- <div class="test-data">
- <div class="page-content">
- <div class="mcp-title">
- <span class="active">第1步、考试基本信息</span>
- <span><i class="horizontal-line"></i></span>
- <span>第2步、关联在线答题卡</span>
- </div>
- <div class="">
- <div class="mcp-main-con">
- <div class="mcp-form-list clearfix">
- <div class="mcp-form-menu fl">试卷名称</div>
- <div class="mcp-form-detail fl">
- <input type="text" placeholder="必填" class="test-paper-name" name="examName">
- </div>
- <div id="examName-error"></div>
- </div>
- <!--
- <div class="mcp-form-list clearfix">
- <div class="mcp-form-menu fl">试卷类型</div>
- <div class="mcp-form-detail fl">
- <div class="inp-text pointer">选择试卷类型</div>
- <ul class="select-con tac">
- <?php
- if(!in_array(Yii::app()->session['session_duoxueke_subject_id'],array(18,19)) && Yii::app()->params['section']!=3){
- $paperType = array('1050'=> '其他','0'=> '全国','1'=> '江苏','2'=> '浙江');
- }elseif(Yii::app()->params['section']==3){
- $paperType = array('1050'=> '其他');
- }else{
- $paperType = array('1050'=> '其他');
- }
- ?>
- <?php foreach($paperType as $key => $t):?>
- <li class="sel-paper-type pointer" id="<?php echo $key?>"><?php echo $t?></li>
- <?php endforeach;?>
- </ul>
- </div>
- <div id="paperType-error"></div>
- </div>
- -->
- <div class="mcp-form-list clearfix" style="width:1000px">
- <div class="mcp-form-menu fl">考试类型</div>
- <div class="mcp-form-detail fl clearfix">
- <div class="mcp-radio-sel fl examType">
- <span class="sel-btn select" value="1"></span>
- <span>周考</span>
- </div>
- <div class="mcp-radio-sel fl examType">
- <span class="sel-btn" value="2"></span>
- <span>单元考</span>
- </div>
- <div class="mcp-radio-sel fl examType">
- <span class="sel-btn" value="3"></span>
- <span>月考</span>
- </div>
- <div class="mcp-radio-sel fl examType">
- <span class="sel-btn" value="4"></span>
- <span>联考</span>
- </div>
- <div class="mcp-radio-sel fl examType">
- <span class="sel-btn" value="5"></span>
- <span>期中考试</span>
- </div>
- <div class="mcp-radio-sel fl examType">
- <span class="sel-btn" value="6"></span>
- <span>期末考试</span>
- </div>
- <div class="mcp-radio-sel fl examType">
- <span class="sel-btn" value="7"></span>
- <span>模拟考</span>
- </div>
- <div class="mcp-radio-sel fl examType">
- <span class="sel-btn" value="8"></span>
- <span>冲刺考</span>
- </div>
- <div class="clear"></div>
- <div class="mcp-radio-sel fl examType">
- <span class="sel-btn examType" value="9"></span>
- <span>测验(适用于非正式考试)</span>
- </div>
- </div>
- <div id="type-error"></div>
- </div>
- <div class="mcp-form-list clearfix">
- <div class="mcp-form-menu fl">主阅卷员</div>
- <div class="mcp-form-detail fl">
- <select class="sel-option projSelect" style="width: 150px">
- <option value="0">选择阅卷员</option>
- <?php foreach($teacher_arr as $t):?>
- <option class="pointer" value="<?php echo $t['teacher_id']?>"><?php echo $t['teacher_name']?></option>
- <?php endforeach;?>
- </select>
- </div>
- <div id="choose-error"></div>
- </div>
- <div class="mcp-form-list clearfix">
- <div class="mcp-form-menu fl">选择年级</div>
- <div class="mcp-form-detail fl">
- <select class="select-grade" isthird="1" name="select-grade" style="width: 150px">
- <option value="0">请选择</option>
- <?php
- if(isset(Yii::app()->params['grade_config'])){
- foreach (Yii::app()->params['grade_config'] as $id => $item){
- echo '<option value="'.$id.'">'.$item['grade_name'].'</option>';
- }
- }
- ?>
- </select>
- </div>
- <div id="choose-error"></div>
- </div>
- <div class="mcp-form-list clearfix">
- <div class="mcp-form-menu fl">选择班级</div>
- <div class="mcp-form-detail fl">
- <a class="btn btn-success btn-sm select-class">添加班级</a>
- <div class="select-class-list">
- <div class="class-box fl">
- <ul class="selected-box">
- </ul>
- </div>
- </div>
- </div>
- <div id="choose-error"></div>
- </div>
- <div class="mcp-form-list clearfix">
- <div class="mcp-form-menu fl">阅卷方式</div>
- <div class="mcp-form-detail fl clearfix" id ="markType">
- <div class="mcp-radio-sel fl">
- <span class="sel-btn select markType" value="3"></span>
- <span class ="markType" value="3">班级混合阅卷</span>
- </div>
- <div class="<?php if(!in_array(Yii::app()->session['session_duoxueke_subject_id'],array(18,19))){echo 'mcp-radio-sel';}else{echo 'mcp-radio-sel-no';}?> fl">
- <span class="sel-btn markType" value="4" ></span>
- <span class="markType" value="4">班级单独阅卷 <?php if(in_array(Yii::app()->session['session_duoxueke_subject_id'],array(18,19))){echo ' (文理综暂不支持)';}?></span>
- </div>
- <div class="mcp-radio-sel fl">
- <span class="sel-btn markType" value="0"></span>
- <span class="markType" value="0">线下阅卷(暂只支持在线答题卡)</span>
- </div>
- <div id="markType-error"></div>
- </div>
- </div>
- <div class="mcp-form-list clearfix">
- <div class="mcp-form-menu fl">考试时间</div>
- <div class="mcp-form-detail fl clearfix">
- <input type="text" class='core datetimepicker8' style="width: 140px;line-height: 27px;padding-left: 5px;" name="examDate" id="trial_begin_time_test" readonly/>
- </div>
- <div id="examDate"></div>
- </div>
- </div>
- <!-- <div class="template-flag-box"> -->
- <!-- <a href="javascript:;" id="createThird" active="true">保存试卷</a> -->
- <!--<a href="javascript:;" class="template-flag">创建答题卡</a>-->
- <!-- </div> -->
- <div class="template-flag-box">
- <a href="javascript:;" id="createThird" active="true">保存并返回</a>
- <!-- <a href="javascript:;" id="goNext" active="true">保存并下一步</a> -->
- <a href="javascript:;" id="goNextNew" active="true">保存并下一步</a>
- <a href="javascript:;" id="goBack" class="gray" active="true">放弃并返回</a>
- <!--<a href="javascript:;" class="template-flag">创建答题卡</a>-->
- </div>
- <input type="hidden" name="subjectId" value="<?php echo Yii::app()->session['session_duoxueke_subject_id'];?>">
- <input type="hidden" name="textbookId" value="0">
- <input type="hidden" name="tpl_index" value="1050">
- <input type="hidden" name="paperType" value="1050">
- <input name="type" value="1" type="hidden"/>
- <input name="teacherId" value="0" type="hidden"/>
- <input name="markType" value="3" type="hidden"/>
- <input name="classIds" value="0" type="hidden"/>
- <input name="topic" value="0" type="hidden"/>
- <input name="is_update" value="0" type="hidden"/>
- <input name="isQxk" value="<?php echo $is_qxk?>" type="hidden"/>
- <!-- <input name="third_tpl_id" value="<?php echo isset($thisTpls[0]['third_tpl_id'])?$thisTpls[0]['third_tpl_id']:0 ?>" type="hidden"/> -->
- </div>
- </div>
- </div>
- <div class="relation-answer-card">
- <div class="page-content">
- <div class="mcp-title">
- <span >第1步、考试基本信息</span>
- <span><i class="horizontal-line"></i></span>
- <span class="active">第2步、关联在线答题卡</span>
- </div>
- <!-- 新版本右侧答题卡 -->
- <div class="hgc_leftContent">
- <div class="module">
- <h2>
- <span>当前答题卡</span>
- <span class="theme notice">新版本,无需切割模板,可通过扫描入口直接扫描</span>
- </h2>
- <div class="contentInfo">
- <div class="opratorBnts">
- <span class="theme" id="saveMyTpl">保存为我的模版</span>
- <span class="theme" id="downLoadPdfBtn">下载答题卡</span>
- <span class="theme" id="editMyTpl">修改答题卡>></span>
- </div>
- <div class="subjectInfo">
- <div class="infoItem">
- <em>基本信息:</em>
- <div class="info">
- <p>
- <span>板式:A3-横版-三栏</span>
- <span>考号:填涂(10位)</span>
- <span>装订线:有</span>
- <span>总分:150分</span>
- <span>题量:50</span>
- </p>
- </div>
- </div>
- <div class="infoItem">
- <em>题目信息:</em>
- <div class="info">
- <p>
- <span>一、单项填空</span>
- <span>单选</span>
- <span>20题</span>
- <span>共20分</span>
- </p>
- </div>
- </div>
- </div>
- </div>
- <div class="contentNoInfo">
- <!-- <img src="" alt=""> -->
- <span>未创建答题卡</span>
- <div class="hbtn">创建在线答题卡</div>
- </div>
- </div>
- <div class="module">
- <h2>
- <span>我的模版(<em id="tplLength">0</em>)</span>
- </h2>
- <div class="tplBox">
- <div class="leftBtn btnItem"></div>
- <div class="tplCut">
- <div class="tplList">
- </div>
- <p id="tplListMsg" style="text-align: center;">暂未保存模板</p>
- </div>
- <div class="rightBtn btnItem"></div>
- </div>
- </div>
- </div>
- <div class="template-flag-box">
- <a href="javascript:;" id="createThirdCard" active="true">保存并返回</a>
- <a href="javascript:;" id="goBack" class="gray" active="true">放弃并返回</a>
- </div>
- </div>
- </div>
- </div>
- <!-- 弹窗 -->
- <div class="confirmbox-mask" style="display: none;" id="fieldModal">
- <div class="class-modal" style="padding: 0px;">
- <div class="class-modal-head" style="background-color: #2977ff;color: white;height: 30px;font-size: 16px;font-weight: initial;"><span style="float: left;padding: 5px;">选择考试班级</span><span class=" add-class-close" style="float: right;padding: 5px;cursor: pointer;">X</span></div>
- <form id="examSelect">
- <div class="class-modal-body">
- <p class="title">
- <input type="hidden" id="grade_id" name="grade_id" value="0">
- <span style="float: left;" id="gradeTxt">
- </span>
- <span style="margin-left: 300px;">
- <input type="checkbox" id="global_check_all" class="add_class_input"> 全选
- <input type="checkbox" id="global_check_arts" class="add_class_input"> 全部文科班
- <input type="checkbox" id="global_check_science" class="add_class_input"> 全部理科班
- </span>
- </p>
- <div class="class_area" id="class_area">
- <ul class="class_right area_1">
- </ul>
- </div>
- </div>
- <p class="class_btn" style="text-align: center;">
- <input type="hidden" name="exam_gruop_id" value="0">
- <button type="button" class="setting_sumbit" style="margin-right: 10px;">确定</button>
- <button type="button" class="cancel-btn">取消</button>
- </p>
- </form>
- </div>
- </div>
- <script>
- function isReturn(){
- // var isCardReturn = localStorage.getItem('isCardReturn');
- // var isCardReturn = ~document.referrer.indexOf('online/third');
- var locationUrl = window.location.href;
- let isCardReturn = locationUrl.indexOf('isCardReturn')
- if(isCardReturn>-1){
- $('.test-data').hide();
- $('.relation-answer-card').show();
- // saveFormData = JSON.parse(localStorage.getItem('testFormData'));
- }else {
- var locationUrl = window.location.href;
- localStorage.setItem('referrerUrl',JSON.stringify(locationUrl));
- }
- }
- isReturn();
- var TopicType=new Array(5);
- TopicType[0]=[];
- TopicType[1]=[];
- TopicType[2]=[];
- TopicType[3]=[];
- TopicType[4]=[];
- $(document).ready(function(){
- $('.projSelect').select2();
- var showmsg = $("._tpl.active").attr("showmsg");
- if(showmsg>0){
- $("#btnCover").removeClass('dn');
- $(".bnt_width").addClass('c_bnt_width');
- }else {
- $(".bnt_width").removeClass('c_bnt_width');
- $("#btnCover").addClass('dn');
- $("input[name=tpl_title]").val('');
- }
- //选择试卷类型
- $('.sel-paper-type').click(function() {
- var paper_type = $(this).attr('id');
- if (paper_type) {
- $('#paperType-error').html("");
- }
- $('input[name="paperType"]').val(paper_type);
- });
- $('.datetimepicker8').datetimepicker({
- onGenerate:function( ct ){
- $(this).find('.xdsoft_date').toggleClass('xdsoft_disabled');
- $(this).find('.xdsoft_today').removeClass('xdsoft_disabled');
- },
- format:'Y-m-d',
- formatDate:'Y-m-d',
- minDate:'-1970/01/2',
- maxDate:'+1970/01/2',
- todayBtn : true,
- // minDate: '-<?php echo date('Y-m-d', strtotime('Yesterday')); ?>',
- timepicker:false
- });
- //选择考试时间
- //选择教材题源
- var subjects = <?php echo json_encode($teacherSubjectNames); ?>;
- var textbooks = <?php echo json_encode($teacherSubjectMaterialNames); ?>;
- for(var key in subjects){
- $(".choose-grade").append('<option value="'+ key +'">'+ subjects[key] +'</option>');
- }
- $(".choose-grade").change(function(){
- var obj = $(this);
- var val = obj.val();
- var child = $('.choose-book');
- child.html('<option value="0">选择教材</option>');
- for (var key in textbooks) {
- if (key == val) {
- child.html('');
- for (var name in textbooks[key]) {
- child.append('<option value="'+ [name] +'">'+ textbooks[key][name] +'</option>');
- }
- }
- }
- });
- //返回
- $('.mcp-back-btn').click(function(){
- location.href="<?php echo Yii::app()->createUrl('third/index')?>";
- });
- $('input[name="examName"]').keydown(function(event){
- $('#examName-error').html("");
- });
- //阅卷方式
- $('.markType').click(function(){
- var markType = $(this).attr('value');
- if(markType){
- $('#markType-error').html("");
- }
- $('input[name="markType"]').val(markType);
- });
- //考试类型
- $('.examType').click(function(){
- var type = $(this).find("span:eq(0)").attr('value');
- if(type){
- $('#type-error').html("");
- }
- $('input[name="type"]').val(type);
- });
- //选择教师
- $('.sel-option').change(function(){
- var teacher_id = $(this).val();
- if(teacher_id){
- $('#choose-error').html("");
- }
- $('input[name="teacherId"]').val(teacher_id);
- });
- if ($('.sel-classes > span').length > 0){
- for (var i = 0;i < $('.sel-classes > span').length; i++){
- for (var k = 0;k < $('.bjs-lis').length; k++){
- if ($('.bjs-lis').eq(k).text().trim()==$('.sel-classes > span').eq(i).text().trim()) {
- $('.bjs-lis').eq(k).find('.judge-sel').addClass('active');
- }
- }
- }
- }
- $('.mcp-radio-sel').click(function(){
- if (!$(this).find('.sel-btn').hasClass('select')) {
- $(this).find('.sel-btn').addClass('select');
- $(this).siblings().find('.sel-btn').removeClass('select');
- }
- });
- $('.grade-sel ul li').click(function(){
- $(this).addClass('active').siblings().removeClass('active');
- });
- // $('.judge-sel').on('click',function(){
- // alert(1);
- // if (!$(this).hasClass('active')) {
- // $(this).addClass('active');
- // $('.sel-classes').append('<span>'+$(this).closest('.bjs-lis').text()+'</span>');
- // } else {
- // $(this).removeClass('active');
- // for (var i = 0;i < $('.sel-classes > span').length; i++) {
- // console.log($('.sel-classes > span').eq(i).text());
- // if ($('.sel-classes > span').eq(i).text().trim() == $(this).closest('.bjs-lis').text().trim()){
- // $('.sel-classes > span').eq(i).remove();
- // }
- // }
- // }
- // });
- $('.sel-classes > span').click(function(){
- $(this).remove();
- for (var i = 0;i < $('.bjs-lis').length; i++) {
- if ($('.bjs-lis').eq(i).text().trim()==$(this).text().trim()){
- $('.bjs-lis').eq(i).find('.judge-sel').removeClass('active');
- }
- }
- });
- // 下拉列表模拟
- $('.inp-text').click(function(){
- if ($(this).next().is(':hidden')){
- $(this).next().show();
- } else {
- $(this).next().hide();
- }
- });
- // 点下拉列表选项
- $('.select-con li').click(function(){
- $(this).closest('.select-con').hide();
- $(this).closest('.mcp-form-detail').find('.inp-text').text($(this).text());
- });
- // 点击空白处下拉列表消失
- $(document).click(function(e){
- var targetNode = $(e.target).closest(".inp-text");
- if (targetNode.length>0){
- return;
- }else{
- $(".select-con").hide();
- }
- });
- function saveThirdForm(e,btnType){
- var classIds='';
- $(".selected-box").find('li').each(function(index,el){
- classIds += $(el).attr('value')+",";
- });
- $('input[name="classIds"]').val(classIds);
- var error = new Array();
- var classIds = $('input[name="classIds"]').val();
- var examName = $('input[name="examName"]').val();
- var is_update = $('input[name="is_update"]').val();
- var type = $('input[name="type"]').val();
- var teacherId = $('input[name="teacherId"]').val();
- // var markType = $('input[name="markType"]').val();
- var markType = $("#markType").find(".select").attr("value");
- var subjectId = $('input[name=subjectId]').val();
- var examDate = $("input[name='examDate']").val();
- var paperType = $("input[name='paperType']").val();
- if(subjectId == 0 || subjectId == null){
- $('#subject-error').html('请指定题源');
- error.push('没有指定题源');
- }else{
- $('#subject-error').html('');
- }
- if(examName == "" || examName == null){
- $('#examName-error').html('请指定考试名称');
- error.push('没有指定考试名称');
- }else{
- $('#examName-error').html('');
- }
- if(type == "" || type == null){
- $('#type-error').html('请指定考试类型');
- error.push('没有指定考试类型');
- }else{
- $('#type-error').html('');
- }
- if(paperType == 0 || paperType == 1 || paperType == 2 || paperType == 1050){
- $('#paperType-error').html('');
- }else{
- $('#paperType-error').html('请指定正确的试卷类型');
- error.push('请指定正确的试卷类型');
- }
- if(teacherId == '0' || teacherId == null){
- $('#choose-error').html('请指定阅卷老师');
- error.push('没有指定阅卷老师');
- }else{
- $('#choose-error').html('');
- if(classIds == "" || classIds == null){
- $('#classIds-error').html('请指定考试班级');
- error.push('没有指定考试班级');
- }else{
- $('#classIds-error').html('');
- }
- }
- if(!markType){
- $('#markType-error').html('请指定阅卷方式');
- error.push('没有指定阅卷方式');
- }else{
- $('#markType-error').html('');
- }
- if (examDate == '') {
- $('#examDate').html('请设置考试日期');
- error.push('请设置考试日期');
- } else if (examDate < '<?php echo date('Y-m-d'); ?>') {
- // $('#examDate').html('考试日期设置错误');
- // error.push('考试日期设置错误');
- }else{
- $('#examDate').html('');
- }
- if(error.length == 0){
- $("#createThird").attr('active','false');
- var saveFormData={
- examName:examName,
- teacherId:teacherId,
- type:type,
- classIds:classIds,
- markType:markType,
- paperType:paperType,
- subjectId:subjectId,
- textbookId:0,
- examDate:examDate,
- // tpl_index:1050,
- tpl_index:paperType,
- is_update:is_update,
- // topic:JSON.stringify(TopicType),
- layout:$("input[name=layout]:checked").val(),
- select_card_type:$("input[name=select_card_type]:checked").val(),
- third_tpl_id:$("input[name='third_tpl_id']").val(),
- tpl_save_type:$("input[name='tpl_save_type']:checked").val(),
- isQxk:$('input[name="isQxk"]').val()
- };
- $.post("<?php echo Yii::app()->createUrl('third/quanCreatethird')?>",saveFormData,function (data) {
- var m = JSON.parse(data);
- if(m.status==1){
- $('input[name="is_update"]').val(m.exam_group_id);
- saveFormData.examGroupId = m.exam_group_id;
- saveFormData.referrerUrl = window.location.href;
- var addGrade = 0;
- $('.grade-sel ul li').each(function(){
- if($(this).hasClass('active')){
- addGrade = $(this).attr('grade')
- }
- })
- saveFormData.grade = addGrade;
- // var grade = $("input[name='grade']").val();
- // saveFormData.examGroupId = m.exam_group_id;
- localStorage.setItem('testFormData',JSON.stringify(saveFormData));
- if(btnType===1){
- goBack()
- }else if(btnType===2){
- $('.test-data').hide();
- $('.relation-answer-card').show();
- }else if(btnType===3){
- location.href = '/index.php/online/answersheetList/examGroupId/'+saveFormData.examGroupId+'?isThird=1&examGroupId='+saveFormData.examGroupId
- // location.href = '/index.php/third/thirdCardSecond'
- }
- }else{
- layer.msg(m.msg);
- $("#createThird").attr('active','true');
- return false;
- }
- // if(m.status==0)
- // {
- // layer.msg(m.msg);
- // $("#createThird").attr('active','true');
- // return false;
- // }else{
- // $('input[name="is_update"]').val(m.exam_group_id);
- // if(btnType===1){
- // location.href = m.result;
- // }
- // }
- });
- }else{
- layer.msg(error.join(','));
- $("#createThird").attr('active','true');
- }
- }
- function goBack(){
- // location.href = '/index.php/third/index'
- window.history.back();
- }
- $("body").delegate("#createThird[active='true']", "click", function(e) {
- $('#createThird').attr('active',false);
- $('#goNext').attr('active',false);
- $('#goNextNew').attr('active',false);
- saveThirdForm(e,1)
- });
- //保存并关联答题卡
- $("body").delegate("#goNext[active='true']", "click", function(e) {
- $('#createThird').attr('active',false);
- $('#goNext').attr('active',false);
- $('#goNextNew').attr('active',false);
- saveThirdForm(e,2);
- });
- //保存并关联答题卡新版
- $("body").delegate("#goNextNew[active='true']", "click", function(e) {
- $('#createThird').attr('active',false);
- $('#goNext').attr('active',false);
- $('#goNextNew').attr('active',false);
- saveThirdForm(e,3);
- });
- //取消并返回
- $("body").delegate("#goBack[active='true']", "click", function(e) {
- goBack();
- //window.history.back();
- });
- $("#PrintThird").click(function(){
- if (!$(".ques-type-control label input").is(':checked')) {
- layer.msg('请选择题型!');return false;
- }
- if($(".ques-topic-num .ques-topic-item-edit").length > 0){
- layer.msg('请先保存题型!');return false;
- }
- var flag = 0;
- for(i = 0 ; i<TopicType.length;i++)
- {
- if(TopicType[i].length>0){
- flag = 1;
- if( i==4 &&!TopicType[4][0][0]){
- layer.msg('选做题设置有误,题型不能为空!');
- return false;
- }
- for (j = 0;j<TopicType[i].length;j++){
- if(TopicType[i][j][1]=='' || TopicType[i][j][1]==0)
- {
- layer.msg('题号不能为空!');
- return false;
- }
- }
- }
- }
- if(flag == 0){
- layer.msg('题号不能为空!');
- return false;
- }
- $('input[name="topic"]').val(JSON.stringify(TopicType)); //题型选择数据赋值
- var classIds='';
- $(".sel-classes[status=1]").children("span").each(function(){
- classIds += $(this).attr('classid')+",";
- });
- $('input[name="classIds"]').val(classIds);
- var examName = $('input[name="examName"]').val();
- var classIds = $('input[name="classIds"]').val();
- var data = {
- examName:examName,
- classIds:classIds,
- layout:$("input[name=layout]:checked").val(),
- select_card_type:$("input[name=select_card_type]:checked").val(),
- topic:JSON.stringify(TopicType)
- };
- $.post("<?php echo Yii::app()->createUrl('third/create_sheet')?>",data,function (rs) {
- var m = JSON.parse(rs);
- if(m.status==0)
- {
- layer.msg(m.msg);
- return false;
- }else{
- evaluationClient.CreateDiSanFang(JSON.stringify(m.result));
- }
- });
- });
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- $("body").delegate("#btnSubmit[active='true']", "click", function(e) {
- var classIds='';
- $(".sel-classes[status=1]").children("span").each(function(){
- classIds += $(this).attr('classid')+",";
- });
- $('input[name="classIds"]').val(classIds);
- var classIds = $('input[name=classIds]').val();
- var teacherId = $('input[name="teacherId"]').val();
- var subjectId = $('input[name=subjectId]').val();
- var tpl_title = $('input[name=tpl_title]').val();
- if(tpl_title == "" || tpl_title == null){
- layer.msg('没有指定模板名称!');return false;
- }
- if(subjectId == 0 || subjectId == null){
- layer.msg('没有指定题源!');return false;
- }
- if(teacherId == '0' || teacherId == null){
- $('#choose-error').html('请指定阅卷老师');
- layer.msg('没有指定阅卷老师!');return false;
- }else{
- $('#choose-error').html('');
- if(classIds == "" || classIds == null){
- $('#classIds-error').html('请指定考试班级');
- layer.msg('没有指定考试班级!');return false;
- }else{
- $('#classIds-error').html('');
- }
- }
- if (!$(".ques-type-control label input").is(':checked')) {
- layer.msg('请选择题型!');return false;
- }
- var flag = 0;
- for(i = 0 ; i<TopicType.length;i++)
- {
- if(TopicType[i].length>0){
- flag = 1;
- if( i==4 &&!TopicType[4][0][0]){
- layer.msg('选做题设置有误,题型不能为空!');
- return false;
- }
- for (j = 0;j<TopicType[i].length;j++){
- if(TopicType[i][j][1]=='' || TopicType[i][j][1]==0)
- {
- layer.msg('题号不能为空!');
- return false;
- }
- }
- }
- }
- if(flag == 0){
- layer.msg('题号不能为空!');
- return false;
- }
- var data={
- tpl_title:tpl_title,
- teacherId:teacherId,
- classIds:classIds,
- subjectId:subjectId,
- textbookId:0,
- topic:JSON.stringify(TopicType),
- layout:$("input[name=layout]:checked").val(),
- select_card_type:$("input[name=select_card_type]:checked").val()
- };
- $.post("<?php echo Yii::app()->createUrl('third/createThirdTpl')?>",data,function (data) {
- var m = JSON.parse(data);
- if(m.status==1)
- { //$('#btnSubmit').attr('active','false');
- // layer.msg(m.msg);
- $(".template-box").prepend('<li class="_tpl" showmsg="1" third_tpl_id="'+m.result.third_tpl_id+'"><a href="#"><div class="card-type"><span class="size">'+m.result.layout+'</span><span class="type">'+m.result.select_card_type+'</span><i class="icon-delete"></i></div> <p class="card-name">'+m.result.title+'</p></a></li>');
- $("input[name=third_tpl_id]").val(m.result.third_tpl_id);
- $("._tpl.active").removeClass('active');
- $("._tpl").eq(0).addClass('active');
- $("#btnCover").removeClass('dn');
- layer.msg('保存成功!',{
- icon: 1
- });
- $(".ttd").hide();
- $(".bnt_width").addClass('c_bnt_width');
- return false;
- }else{
- layer.msg('保存失败',{
- icon: 5
- }, function(){
- $(".ttd").fadeOut();
- });
- return false;
- }
- });
- });
- $("body").delegate("#btnCover[active='true']", "click", function(e) {
- var classIds='';
- $(".sel-classes[status=1]").children("span").each(function(){
- classIds += $(this).attr('classid')+",";
- });
- $('input[name="classIds"]').val(classIds);
- // var classIds = $('input[name=classIds]').val();
- var teacherId = $('input[name="teacherId"]').val();
- var subjectId = $('input[name=subjectId]').val();
- var tpl_title = $('input[name=tpl_title]').val();
- if(tpl_title == "" || tpl_title == null){
- layer.msg('没有指定模板名称!');return false;
- }
- if(subjectId == 0 || subjectId == null){
- layer.msg('没有指定题源!');return false;
- }
- if(teacherId == '0' || teacherId == null){
- $('#choose-error').html('请指定阅卷老师');
- layer.msg('没有指定阅卷老师!');return false;
- }else{
- $('#choose-error').html('');
- if(classIds == "" || classIds == null){
- $('#classIds-error').html('请指定考试班级');
- layer.msg('没有指定考试班级!');return false;
- }else{
- $('#classIds-error').html('');
- }
- }
- if (!$(".ques-type-control label input").is(':checked')) {
- layer.msg('请选择题型!');return false;
- }
- var flag = 0;
- for(i = 0 ; i<TopicType.length;i++)
- {
- if(TopicType[i].length>0){
- flag = 1;
- if( i==4 &&!TopicType[4][0][0]){
- layer.msg('选做题设置有误,题型不能为空!');
- return false;
- }
- for (j = 0;j<TopicType[i].length;j++){
- if(TopicType[i][j][1]=='' || TopicType[i][j][1]==0)
- {
- layer.msg('题号不能为空!');
- return false;
- }
- }
- }
- }
- if(flag == 0){
- layer.msg('题号不能为空!');
- return false;
- }
- var data={
- tpl_title:tpl_title,
- third_tpl_id:$("._tpl.active").attr('third_tpl_id'),
- teacherId:teacherId,
- classIds:classIds,
- subjectId:subjectId,
- textbookId:0,
- topic:JSON.stringify(TopicType),
- layout:$("input[name=layout]:checked").val(),
- select_card_type:$("input[name=select_card_type]:checked").val()
- };
- $.post("<?php echo Yii::app()->createUrl('third/updateThirdTpl')?>",data,function (data) {
- var m = JSON.parse(data);
- if(m.status==1)
- {
- $("._tpl.active").children().find('.size').html(m.result.layout);
- $("._tpl.active").children().find('.type').html(m.result.select_card_type);
- $("._tpl.active").children().find('.card-name').html(m.result.title);
- $("._tpl.active").removeClass('active');
- $("._tpl").eq(0).addClass('active');
- layer.msg('保存成功!',{
- icon: 1
- });
- $(".ttd").fadeOut();
- $("#btnCover").removeClass('dn');
- $(".bnt_width").addClass('c_bnt_width');
- return false;
- }else{
- layer.msg('保存失败',{
- icon: 5
- }, function(){
- $(".ttd").fadeOut();
- });
- return false;
- }
- });
- });
- $("#btnClose").click(function(){
- $(this).parents(".ttd").fadeOut();
- });
- $(".shut").click(function(){
- $("body").css({height :"100%",overflow:"auto"});
- });
- });
- </script>
- <script>
- var subjects = [];
- $(function(){
- //console.log(firstCartTpl);
- // if(firstCartTpl!='null'){
- // TopicType=firstCartTpl;
- // }
- // $(".template-flag").click(function(){
- // FillCard();
- // $(".teamplate-list-box").toggle();
- // });
- // 点击显示隐藏
- $(".ques-type-control label input").click(function(e){
- var index=$(this).parent().index();
- var tempTopic = $(".ques-topic-num .ques-topic").eq(index);
- delTopicType(tempTopic);
- if($(this).is(":checked")){
- $(this).parent("label").addClass("active");
- tempTopic.find(".include-text").val("");
- tempTopic.find(".include-count").val("");
- tempTopic.show();
- if(index==0 || index==1){
- TopicType[index].push([4,'',0]); //对应数据初始化对应题型,题号,样式三种数据
- }else if(index==2){
- TopicType[index].push([1,'',1]); //对应数据初始化对应题型,题号,样式三种数据
- }else if(index==3){
- TopicType[index].push([1,'',0]); //对应数据初始化对应题型,题号,样式三种数据
- }else if(index==4){
- TopicType[index].push([0,'',0]); //对应数据初始化对应题型,题号,样式三种数据
- }
- //console.log(TopicType);
- }else{
- $(this).parent("label").removeClass("active")
- tempTopic.hide();
- if(index==0 || index==1){
- tempTopic.find(".ques-topic-list").eq(0).find("input").val("");
- tempTopic.find(".ques-topic-list").find('.topic-num input').val('');
- tempTopic.find(".ques-topic-list").eq(0).find(".ques-topic-item").removeClass("ques-topic-item-edit").find("a").html("选项编辑");
- }else if(index==2){
- // console.log(tempTopic.find(".ques-topic-list").find('.topic-num').find('input').val());
- tempTopic.find(".ques-topic-list").find('.topic-num').find('input').val('');
- tempTopic.find(".ques-topic-list").find('.line-control').find('input').val(1);
- tempTopic.find(".ques-topic-list").eq(0).find(".ques-topic-item").find('label input').eq(0).click();
- tempTopic.find(".line-type label:first input").prop("checked",true);
- }else if(index==3){
- tempTopic.find(".ques-topic-list").find('.topic-num input').val('');
- tempTopic.find(".ques-topic-list").eq(0).find("input").val("");
- tempTopic.find(".ques-topic-list").find('.line-control').find('input').val(1);
- tempTopic.find(".ques-topic-list").eq(0).find(".ques-topic-item").find('label input').eq(0).click();
- tempTopic.find(".line-type label:first input").prop("checked",true);
- tempTopic.find(".line-type label").eq(0).find("input").prop("checked",true);
- }
- tempTopic.find(".ques-topic-list").eq(0).find("em").remove();
- for(var i=0;i<4;i++){
- tempTopic.find(".ques-topic-list").eq(0).find("s").before("<em>【"+arr[i]+"】<b></b></em>");
- }
- for(var i=tempTopic.find(".ques-topic-list").length;i>1;i--){
- tempTopic.find(".ques-topic-list:last").remove();
- }
- TopicType[index]=[]; //清空对应数据
- // console.log(TopicType);
- }
- $("input[name=bixuan]").val(1);
- totalTopicCount();
- });
- // 答题卡类型选择
- $(".card-style a").click(function(){
- $(this).addClass("active").siblings().removeClass("active");
- $(".card-select").eq($(this).index()).addClass("cur").siblings().removeClass("cur");
- $(".card-select").eq($(this).index()).find("input:eq(0)").prop("checked",true).siblings().prop("checked",false);
- })
- // 选项编辑
- $("body").delegate(".ques-topic-item a","click",function(){
- if($(this).closest(".ques-topic-item").hasClass("ques-topic-item-edit")){
- $(this).closest(".ques-topic-item").removeClass("ques-topic-item-edit");
- $(this).html("选项编辑");
- $(this).closest(".ques-topic-item").find("s").hide();
- //装入修改后数据
- var index=$(this).closest('.ques-topic').index(); //第几个大类型
- var topic_index=$(this).closest('.ques-topic-list').index()-1; //该题型下第几个子题型
- TopicType[index][topic_index][0]=$(this).parent().find('em').length;
- // console.log(TopicType);
- }else{
- $(this).closest(".ques-topic-item").addClass("ques-topic-item-edit");
- $(this).siblings("s").show();
- if($(this).closest(".ques-topic").hasClass("ques-topic-one")){
- // console.log($(this).closest(".ques-topic-item").find("em").length)
- if($(this).closest(".ques-topic-item").find("em").length >3){
- $(this).siblings("s").hide();
- }else{
- $(this).siblings("s").show();
- }
- }else{
- // console.log($(this).closest(".ques-topic-item").find("em").length)
- if($(this).closest(".ques-topic-item").find("em").length >6){
- $(this).siblings("s").hide();
- }else{
- $(this).siblings("s").show();
- }
- }
- $(this).html("保存");
- }
- });
- // 删除选项
- $("body").delegate(".ques-topic-item-edit b","click",function(){
- if($(this).closest(".ques-topic-item-edit").find("em").length <= 10){
- $(this).closest(".ques-topic-item-edit").find("s").show();
- }
- var tempParent = $(this).closest(".ques-topic-item-edit");
- $(this).closest("em").remove();
- orderABC(tempParent.find("em"))
- hideDel(tempParent.find("b"))
- });
- function orderABC(obj){
- for(var i=0;i<obj.length;i++){
- obj.eq(i).html("【"+arr[i]+"】<b></b>")
- }
- }
- // 增加选项
- var arr = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N'];
- $("body").delegate(".ques-topic-item-edit s","click",function(){
- if($(this).closest(".ques-topic").hasClass("ques-topic-one")){
- addAbc($(this),4)
- }else{
- addAbc($(this),7)
- }
- });
- function addAbc(obj,count){
- var idx = obj.closest(".ques-topic-item-edit").find("em").length;
- obj.before("<em>【"+arr[idx]+"】<b></b></em>");
- hideDel(obj.closest(".ques-topic-item-edit").find("b"))
- if(obj.closest(".ques-topic-item-edit").find("em").length >= count){
- obj.hide();
- }
- }
- // 增加题型
- $(".add-type a").click(function(){
- var temp = $(this).closest(".add-type").prev().clone(true);
- temp.find(".topic-point-num").html($(this).closest(".add-type").prev().index()+1);
- temp.find(".ques-topic-item").removeClass("ques-topic-item-edit").find("a").html("选项编辑");
- temp.find("em").remove();
- for(var i=0;i<temp.find("input[type='text']").length;i++){
- if(!temp.find("input[type='text']").eq(i).hasClass("choose-count")){
- temp.find("input[type='text']").eq(i).val("")
- }
- }
- for(var i=0;i<4;i++){
- temp.find("s").before("<em>【"+arr[i]+"】<b></b></em>");
- }
- //主观题
- if($(this).hasClass("main-topic")){
- temp.find("input[name^='topicType']").attr("name","topicType_"+($(this).closest(".ques-topic").find(".ques-topic-list").length));
- temp.find(".line-control input").val(1)
- }
- //填空题
- if($(this).hasClass("tian_main-topic")){
- temp.find("input[name^='tianketi_Type']").attr("name","tianketi_Type_"+($(this).closest(".ques-topic").find(".ques-topic-list").length));
- temp.find(".line-control input").val(1)
- }
- //选做题
- if($(this).hasClass("xuan-main-topic")){
- temp.find("input[name^='chooseType']").attr("name","chooseType_"+($(this).closest(".ques-topic").find(".ques-topic-list").length));
- }
- temp.find('input:radio').each(function(i){
- temp.find('input:radio').eq(i).attr('checked',false);
- });
- var index=$(this).closest('.ques-topic').index(); //第几个大类型
- //判断数量
- if(index==4 && $(this).closest(".ques-topic").find(".ques-topic-list").length>2){
- return false;
- }
- $(this).closest(".add-type").before(temp);
- if(index==0 || index==1){
- TopicType[index].push([4,'',0]); //对应数据初始化对应题型,题号,样式三种数据
- }else if(index==2){
- $style=$('.line-type input:radio:checked').parent().index()+1;
- temp.find('.line-control').css("display","inline-block");
- TopicType[index].push([1,'',$style]); //对应数据初始化对应题型,题号,样式三种数据
- }else if(index==3){
- var topicTypeIndex=$(this).closest(".ques-topic").find(".ques-topic-list").length;
- temp.find("input[name='topicType_"+topicTypeIndex+"']").eq(0).click();
- $style=$('input[name=lineType]:checked').val();
- temp.find('.line-control').hide();
- TopicType[index].push([1,'',$style]); //对应数据初始化对应题型,题号,样式三种数据
- }else if(index==4){
- $("input[name=bixuan]").val(1);
- var topicTypeIndex=$(this).closest(".ques-topic").find(".ques-topic-list").length;
- TopicType[index].push([0,'',1]); //对应数据初始化对应题型,题号,样式三种数据
- $(this).closest(".ques-topic").last().find("input[name='chooseType_"+(topicTypeIndex-1)+"']").eq(0).click();
- }
- delTopicType($(this).closest(".add-type").siblings(".ques-topic-list"));
- // console.log(TopicType);
- })
- // 显示隐藏主观题横线行数
- initTopicType($(".ques-topic-item input[type='radio']"))
- function initTopicType(obj){
- if(obj.val() == 2){
- obj.closest("label").siblings(".line-control").css("display","inline-block");
- }else{
- obj.closest("label").siblings(".line-control").hide();
- }
- }
- // 删除题型
- function delTopicType(obj){
- obj.find(".ques-item-del").show();
- obj.eq(0).find(".ques-item-del").hide();
- }
- $("body").delegate(".ques-item-del","click",function(){
- var index=$(this).closest('.ques-topic').index(); //大题型索引
- var topic_index=$(this).closest('.ques-topic-list').index()-1;//子题型索引
- if(topic_index!=0){
- TopicType[index].splice(topic_index,1);
- // console.log(TopicType[index]);
- var pBox = $(this).closest(".ques-topic");
- $(this).closest(".ques-topic-list").remove();
- pBox.find(".item-count").html(topicCount(pBox));
- pBox.find('.topic-point-num').each(function(index,val){
- if(index != 0){
- $(this).html(index+1)
- }
- })
- totalTopicCount();
- }
- })
- // 主观题样式切换
- $("body").delegate(".ques-topic-item input[type='radio']","click",function(){
- initTopicType($(this));
- var index=$(this).closest('.ques-topic').index(); //大题型索引
- var topic_index=$(this).closest('.ques-topic-list').index()-1;//子题型索引
- if($(this).val()==2 && index!=2){
- $(this).closest('.ques-topic-item').find('.line-control').css("display","inline-block");
- TopicType[index][topic_index][0]=$(this).val()+'///'+$(this).closest('.ques-topic-item').find('.line-control input').val();
- }else{
- TopicType[index][topic_index][0]=$(this).val();
- if($(this).val()==2){
- $(this).closest('.ques-topic-item').find('.line-control').css("display","inline-block");
- }else{
- $(this).closest('.ques-topic-item').find('.line-control').hide();
- }
- }
- console.log(TopicType);
- });
- // 主观题样式图片显示隐藏
- $("body").delegate(".ques-topic-item .ques-style","mouseenter",function(){
- $(this).find("img").show();
- });
- $("body").delegate(".ques-topic-item .ques-style","mouseleave",function(){
- $(this).find("img").hide();
- });
- // 主观题横线行数加减
- $("body").delegate(".line-control .add","click",function(){
- $(this).siblings("input").val(Number($(this).siblings("input").val())+1);
- var index=$(this).closest('.ques-topic').index(); //大题型索引
- var topic_index=$(this).closest('.ques-topic-list').index()-1;//子题型索引
- if(TopicType[index][topic_index][0]){
- if(index!=2){
- TopicType[index][topic_index][0]='2///'+$(this).siblings("input").val();
- }else{
- TopicType[index][topic_index][0]=$(this).siblings("input").val();
- }
- }
- });
- $("body").delegate(".line-control .del","click",function(){
- if(Number($(this).siblings("input").val()) > 1){
- $(this).siblings("input").val(Number($(this).siblings("input").val())-1);
- var index=$(this).closest('.ques-topic').index(); //大题型索引
- var topic_index=$(this).closest('.ques-topic-list').index()-1;//子题型索引
- if(index!=2){
- TopicType[index][topic_index][0]='2///'+$(this).siblings("input").val();
- }else{
- TopicType[index][topic_index][0]=$(this).siblings("input").val();
- }
- }
- });
- // 校验文本框输入
- $("body").delegate(".topic-num input,.topic-num-choose input","keyup",function(){
- $(this).val($(this).val().replace(/[^\d-,]+/g,""));
- });
- $("body").delegate(".choose-topic-num input,.include-list input","keyup",function(){
- $(this).val($(this).val().replace(/[^\d]+/g,""));
- })
- // 小题校验
- $("body").delegate(".include-list .include-text","blur",function(){
- var tNo = trimArr($(this).closest(".include-list").siblings(".topic-num").find("input").val());
- var sibIpt = $(this).closest(".ques-topic").find(".include-text");
- var count = 0;
- for(var i=0;i<sibIpt.length;i++){
- if($(this).val() == sibIpt.eq(i).val()){
- count++;
- if(count > 1){
- layer.msg('小题题号不能重复!');
- $(this).val("");
- break;
- }
- }
- }
- if($(this).val()){
- console.log($(this).val())
- console.log(tNo)
- if(tNo.indexOf($(this).val()) == -1){
- layer.msg('请输入有效题号!');
- $(this).val("");
- }
- }
- if($(this).val() != "" && $(this).next().val() != ""){
- var bigTopic = $(this).val();
- var smallTopic = $(this).next().val();
- var index=$(this).closest('.ques-topic').index(); //大题型索引
- var topic_index=$(this).closest('.ques-topic-list').index()-1;//子题型索引
- if(TopicType[index][topic_index][3]){
- var tp3Arr = TopicType[index][topic_index][3].split(",");
- var tp3StrNext = '';
- var isHave = 0;
- for(var i=0;i<tp3Arr.length;i++){
- var tp3ArrNext = tp3Arr[i].split("///");
- console.log(tp3ArrNext);
- if(tp3ArrNext[0] == bigTopic){
- tp3ArrNext[1] == smallTopic;
- isHave = 1;
- }
- if(tp3StrNext == ""){
- tp3StrNext = tp3ArrNext.join("///");
- }else{
- tp3StrNext += ","+tp3ArrNext.join("///");
- }
- }
- if(isHave == 0){
- TopicType[index][topic_index][3] += ','+bigTopic+"///"+smallTopic;
- }else{
- TopicType[index][topic_index][3] = tp3StrNext;
- }
- }else{
- TopicType[index][topic_index][3] = bigTopic+"///"+smallTopic;
- }
- }
- })
- $("body").delegate(".include-list .include-count","blur",function(){
- if($(this).val() != "" && $(this).prev().val() != ""){
- var bigTopic = $(this).prev().val();
- var smallTopic = $(this).val();
- var index=$(this).closest('.ques-topic').index(); //大题型索引
- var topic_index=$(this).closest('.ques-topic-list').index()-1;//子题型索引
- if(TopicType[index][topic_index][3]){
- var tp3Arr = TopicType[index][topic_index][3].split(",");
- var tp3StrNext = '';
- var isHave = 0;
- for(var i=0;i<tp3Arr.length;i++){
- var tp3ArrNext = tp3Arr[i].split("///");
- if(tp3ArrNext[0] == bigTopic){
- tp3ArrNext[1] = smallTopic;
- isHave = 1;
- }
- if(tp3StrNext == ""){
- tp3StrNext = tp3ArrNext.join("///");
- }else{
- tp3StrNext += ","+tp3ArrNext.join("///");
- }
- }
- if(isHave == 0){
- TopicType[index][topic_index][3] += ','+bigTopic+"///"+smallTopic;
- }else{
- TopicType[index][topic_index][3] = tp3StrNext;
- }
- }else{
- TopicType[index][topic_index][3] = bigTopic+"///"+smallTopic;
- }
- console.log(TopicType);
- }
- })
- // 选做题校验
- $("body").delegate(".choose-all-count","blur",function(){
- // if(parseInt($(this).val()) > parseInt($(this).siblings(".choose-all-count").val())){
- // layer.msg('sorry,选题数不能大于总题数!');
- // $(this).val("");
- // }
- $(this).closest(".ques-topic").find(".item-count").html(topicCount($(this).closest(".ques-topic")))
- totalTopicCount();
- })
- // choose-count
- //题号计算,10-20
- function trimArr(str){
- if(!str) return [];
- var arr1 = str.split(",");
- var arrNo = [];
- for(var i=0;i<arr1.length;i++){
- var arr2 = arr1[i].split("-");
- for(var j=0;j<arr2.length;j++){
- if(arr2[j] == "" || typeof(arr2[j]) == "undefined"){
- arr2.splice(j,1);
- j= j-1;
- }
- }
- if(arr2.length > 1){
- for(var j = parseInt(arr2[0]);j<=parseInt(arr2[1]);j++){
- arrNo.push(j+'')
- }
- }else{
- if(arr2[0]){
- arrNo.push(arr2[0]+'')
- }
- }
- }
- // console.log(repArr(arrNo))
- return repArr(arrNo);
- }
- //数组去重
- function repArr(arr) {
- for (var i = 0; i < arr.length; i++) {
- if (arr.indexOf(arr[i]) != i) {
- arr.splice(i,1);//删除数组元素后数组长度减1后面的元素前移
- i--;//数组下标回退
- }
- }
- return arr;
- }
- // 题量计算 item-count
- function topicCount(obj){
- var tType = obj.find(".topic-num input");
- var tCountObj = obj.find(".include-count");
- var tChooseObj = obj.find(".choose-count")
- var tempNoStr = "";
- var count = 0;
- for(var i=0;i<tType.length;i++){
- tempNoStr += (','+tType.eq(i).val());
- }
- count = trimArr(tempNoStr).length;
- for(var i=0;i<tCountObj.length;i++){
- if(tCountObj.eq(i).val()){
- count += (tCountObj.eq(i).val()-1)
- }
- }
- for(var i=0;i<tChooseObj.length;i++){
- if(tChooseObj.eq(i).val()){
- count += parseInt(tChooseObj.eq(i).val())
- }
- }
- return count
- }
- function totalTopicCount(){
- var totalCount = 0;
- // for(var i=0;i<$(".item-count").length;i++){z
- // totalCount += parseInt($('.item-count').eq(i).html())
- // }
- for(var i=0;i<$(".ques-topic").length;i++){
- if($(".ques-topic").eq(i).css("display") == "block"){
- totalCount += topicCount($(".ques-topic").eq(i));
- }
- }
- $(".total-count").html(totalCount)
- }
- $("body").delegate(".include-count","blur",function(){
- if($(this).val() == "") return;
- // console.log("sb")
- if($(this).val() > 1){
- $(this).closest(".ques-topic").find(".item-count").html(topicCount($(this).closest(".ques-topic")))
- }else{
- layer.msg('小题数量最小为2!');
- $(this).val('')
- $(this).closest(".ques-topic").find(".item-count").html(topicCount($(this).closest(".ques-topic"))+1)
- }
- totalTopicCount();
- })
- $("body").delegate(".topic-num input","blur",function(){
- $(this).closest(".ques-topic").find(".item-count").html(topicCount($(this).closest(".ques-topic")));
- totalTopicCount();
- });
- // 试题内包含小题
- $("body").delegate(".include-topic a","click",function(){
- var tNo = trimArr($(this).parent().siblings(".topic-num").find("input").val());
- var ulList = $(this).parent().siblings().find('ul');
- if(tNo.length == 0){
- layer.msg('sorry,空题不能添加小题!');
- return;
- }else if(tNo.length <= ulList.children().length){
- layer.msg('请先添加题号,谢谢!');
- return;
- }
- ulList.append('<li>第 <input type="text" class="include-text"> 题有 <input type="text" class="include-count"> 个小题 <img src="/images/u434.png" class="del-include"></li>');
- })
- // 删除小题
- $("body").delegate(".del-include","click",function(){
- var This = $(this);
- var pBox = $(this).closest(".ques-topic");
- var index=This.closest('.ques-topic').index(); //大题型索引
- var topic_index=This.closest('.ques-topic-list').index()-1;//子题型索引
- var text = '';
- var textArr = [];
- $($(this).parent().parent().find("li")).each(function(k,v){
- if(k < $(this).parent().parent().find("li").length - 1){
- var include_text = $(this).find(".include-text").val();
- var include_count = $(this).find(".include-count").val();
- if(include_text > 0 && include_count > 0){
- var textArrNext = include_text+'///'+include_count;
- textArr.push(textArrNext);
- }
- }
- });
- if(textArr.length>0){
- text = textArr.join(',');
- }
- TopicType[index][topic_index][3] = text;
- This.closest("li").remove();
- pBox.find(".item-count").html(topicCount(pBox))
- totalTopicCount();
- layer.msg('删除成功!');
- })
- //题号变化,修改数据
- $('.ques-topic-num').on('change','.topic-num input',function(){
- var index=$(this).closest('.ques-topic').index(); //大题型索引
- var topic_index=$(this).closest('.ques-topic-list').index()-1;//子题型索引
- var text=0;
- if($(this).val()!='' && $(this).val()!=undefined){
- text=$(this).val();
- }
- TopicType[index][topic_index][1]=text;
- // console.log(TopicType);
- });
- $('.ques-topic-num').on('change','.topic-num-choose input',function(){
- var index=$(this).closest('.ques-topic').index(); //大题型索引
- var topic_index=$(this).closest('.ques-topic-list').index()-1;//子题型索引
- var text=0;
- if($(this).val()!='' && $(this).val()!=undefined){
- text=$(this).val();
- }
- TopicType[index][topic_index][1]=text;
- // console.log(TopicType);
- });
- //主观题样式变化,修改数据
- $('.line-type label').click(function(){
- //alert($(this).index());
- var idx = $(this).closest(".ques-topic").index();
- if(!(idx==2||idx==3)) return;
- for(var i=0;i<TopicType[idx].length;i++){
- TopicType[idx][i][2]=$(this).index()+1;
- }
- // console.log(TopicType);
- });
- //选做题
- //题号
- $('.ques-topic').on('change','.choose-topic-num input',function(){
- //alert($(this).index());
- var text='';
- if($(this).index()==0){
- text=$(this).val()+'///'+$(this).next().val();
- }else{
- text=$(this).prev().val()+'///'+$(this).val();
- }
- var index=$(this).closest('.ques-topic').index(); //大题型索引
- var topic_index=$(this).closest('.ques-topic-list').index()-1;//子题型索引
- TopicType[index][topic_index][0]=text;
- // console.log(TopicType);
- });
- //样式
- $('.ques-topic').on('click','.choose-topic input:radio',function(){
- var index=$(this).closest('.ques-topic').index(); //大题型索引
- var topic_index=$(this).closest('.ques-topic-list').index()-1;//子题型索引
- TopicType[index][topic_index][2]=$(this).val();
- });
- function hideDel(obj){
- if(obj.length > 2){
- obj.closest(".ques-topic-item-edit").find("b").css("display","inline");
- }else{
- obj.closest(".ques-topic-item-edit").find("b").hide()
- }
- }
- $("body").on("click","._tpl",function(){
- var showmsg = $(this).attr("showmsg");
- if(showmsg>0){
- $("#btnCover").removeClass('dn');
- $(".bnt_width").addClass('c_bnt_width');
- $("input[name=tpl_title]").val($(this).find(".card-name").html());
- }else {
- $("input[name=layout]").eq(0).prop("checked",true);
- $("input[name=select_card_type]").eq(0).prop("checked",true);
- $(".bnt_width").removeClass('c_bnt_width');
- $("#btnCover").addClass('dn');
- $("input[name=tpl_title]").val('');
- }
- $("._tpl.active").removeClass('active');
- $(this).addClass("active");
- var data = {
- third_tpl_id:$(this).attr("third_tpl_id")
- };
- if(showmsg>0){
- $.post("<?php echo Yii::app()->createUrl('third/getThirdTpl')?>",data,function (res) {
- /**
- * 处理处理
- * */
- if(res.result.tpl_data){
- TopicType=$.parseJSON(res.result.tpl_data);
- FillCard();
- // $("input[name=layout][value="+res.result.layout+"]").prop("checked",true);
- // $("input[name=select_card_type][value="+res.result.select_card_type+"]").prop("checked",true);
- $('input[name="third_tpl_id"]').val(res.result.third_tpl_id);
- if(res.result.layout == 10 || res.result.layout == 11){
- $(".card-select").eq(1).addClass("cur").siblings().removeClass("cur");
- $(".card-style a").eq(1).addClass("active").siblings().removeClass("active");
- $("input[name=layout][value="+res.result.layout+"]").prop("checked",true);
- }else if(res.result.layout == 21 || res.result.layout == 31){
- $(".card-select").eq(0).addClass("cur").siblings().removeClass("cur");
- $(".card-style a").eq(0).addClass("active").siblings().removeClass("active");
- $("input[name=layout][value="+res.result.layout+"]").prop("checked",true);
- }else if(res.result.layout == 40 || res.result.layout == 41){
- $(".card-select").eq(2).addClass("cur").siblings().removeClass("cur");
- $(".card-style a").eq(2).addClass("active").siblings().removeClass("active");
- $("input[name=layout][value="+res.result.layout+"]").prop("checked",true);
- }else if(res.result.layout == 50 || res.result.layout == 51){
- $(".card-select").eq(3).addClass("cur").siblings().removeClass("cur");
- $(".card-style a").eq(3).addClass("active").siblings().removeClass("active");
- $("input[name=layout][value="+res.result.layout+"]").prop("checked",true);
- }
- // console.log(TopicType[0].length);
- }
- console.log(TopicType);
- },'json');
- }else{
- //创建新的答题卡
- TopicType[0]=[];
- TopicType[1]=[];
- TopicType[2]=[];
- TopicType[3]=[];
- TopicType[4]=[];
- $('input[name="third_tpl_id"]').val(0);
- FillCard();
- console.log(TopicType);
- }
- //获取模板数据
- });
- $("body").delegate(".icon-delete","click",function(){
- var obj = $(this);
- layer.msg("确定要永久删除此模板吗?", {
- time: 0,
- btn: ['确定', '取消'],
- yes: function(index){
- layer.close(index);
- $.ajax({
- url: "<?php echo Yii::app()->createUrl('third/delThirdTpl')?>",
- type: "POST",
- dataType: "json",
- data:{
- third_tpl_id:$("._tpl.active").attr('third_tpl_id')
- },
- success: function (m){
- if(m.status){
- layer.msg('删除成功',{
- icon: 1
- }, function(){
- layer.closeAll();
- $("input[name=layout]").eq(0).prop("checked",true);
- $("input[name=select_card_type]").eq(0).prop("checked",true);
- $(".bnt_width").removeClass('c_bnt_width');
- $("#btnCover").addClass('dn');
- $("input[name=tpl_title]").val('');
- $("._tpl.active").removeClass('active');
- $("._tpl:last").addClass("active");
- obj.closest('._tpl').remove();
- //创建新的答题卡
- TopicType[0]=[];
- TopicType[1]=[];
- TopicType[2]=[];
- TopicType[3]=[];
- TopicType[4]=[];
- $('input[name="third_tpl_id"]').val(0);
- FillCard();
- });
- }
- },
- error: function (data, status, e){ //服务器响应失败处理函数
- layer.msg('返回失败!',{
- icon: 5
- }, function(){
- layer.closeAll();
- });
- }
- });
- }
- });
- });
- //saveCard
- $("#saveCard").click(function(){
- var classIds='';
- $(".sel-classes[status=1]").children("span").each(function(){
- classIds += $(this).attr('classid')+",";
- });
- $('input[name="classIds"]').val(classIds);
- var classIds = $('input[name="classIds"]').val();
- var teacherId = $('input[name="teacherId"]').val();
- var subjectId = $('input[name=subjectId]').val();
- if(subjectId == 0 || subjectId == null){
- layer.msg('没有指定题源!');return false;
- }else{
- $('#subject-error').html('');
- }
- if(teacherId == '0' || teacherId == null){
- $('#choose-error').html('请指定阅卷老师');
- layer.msg('没有指定阅卷老师!');return false;
- }else{
- $('#choose-error').html('');
- if(classIds == "" || classIds == null){
- $('#classIds-error').html('请指定考试班级');
- layer.msg('没有指定考试班级!');return false;
- }else{
- $('#classIds-error').html('');
- }
- }
- if (!$(".ques-type-control label input").is(':checked')) {
- layer.msg('请选择题型!');return false;
- }
- var flag = 0;
- for(i = 0 ; i<TopicType.length;i++)
- {
- if(TopicType[i].length>0){
- flag = 1;
- for (j = 0;j<TopicType[i].length;j++){
- if(i==4 && TopicType[i][j][0]==0){
- layer.msg('选做题设置有误,题型不能为空!');
- return false;
- }
- if(TopicType[i][j][1]=='' || TopicType[i][j][1]==0)
- {
- layer.msg('题号不能为空!');
- return false;
- }
- }
- }
- }
- if(flag == 0){
- layer.msg('题号不能为空!');
- return false;
- }
- $(".ttd").fadeIn();
- });
- //根据数据重置答题卡
- function FillCard(){
- //所有选项卡重置
- var tempBox=$(".ques-topic-num .ques-topic");
- for(var i=0;i<tempBox.length;i++){
- tempBox.eq(i).hide();
- if(tempBox.eq(i).find('.ques-topic-list').length>0){
- for(var j=tempBox.eq(i).find('.ques-topic-list').length;j>1;j--){
- tempBox.eq(i).find('.ques-topic-list:last').remove();
- }
- if(i==0 || i==1){
- tempBox.eq(i).find(".ques-topic-list").eq(0).find("input").val("");
- tempBox.eq(i).find(".ques-topic-list").find('.topic-num input').val('');
- tempBox.eq(i).find(".ques-topic-list").eq(0).find(".ques-topic-item").removeClass("ques-topic-item-edit").find("a").html("选项编辑");
- }else if(i==2){
- tempBox.eq(i).find(".ques-topic-list").find('.topic-num').find('input').val('');
- tempBox.eq(i).find(".ques-topic-list").find('.line-control').find('input').val(1);
- }else if(i==3){
- tempBox.eq(i).find('.ques-topic-list').find(".line-control").hide().find('input').val(1);
- //tempBox.eq(i).find('.ques-topic-list').find(".line-control")
- tempBox.eq(i).find(".ques-topic-list").find('.topic-num input').val('');
- for(var k=0;k<tempBox.eq(i).find(".ques-topic-list").find('input[name="topicType"]').length;k++){
- if(k==0){
- tempBox.eq(i).find(".ques-topic-list").find('input[name="topicType"]').eq(k).prop('checked',true);
- }else{
- tempBox.eq(i).find(".ques-topic-list").find('input[name="topicType"]').eq(k).prop('checked',false);
- }
- }
- }else if(i==4){
- tempBox.eq(i).find('.choose-topic-num input').eq(0).val('');
- tempBox.eq(i).find(".ques-topic-list").find('.topic-num input').val('');
- for(var k=0;k<tempBox.eq(i).find(".ques-topic-list").find('input[name="chooseType"]').length;k++){
- if(k==0){
- tempBox.eq(i).find(".ques-topic-list").find('input[name="chooseType"]').eq(k).prop('checked',true);
- }else{
- tempBox.eq(i).find(".ques-topic-list").find('input[name="chooseType"]').eq(k).prop('checked',false);
- }
- }
- }
- tempBox.eq(i).find(".ques-topic-list").eq(0).find("em").remove();
- for(var k=0;k<4;k++){
- tempBox.eq(i).find(".ques-topic-list").eq(0).find("s").before("<em>【"+arr[k]+"】<b></b></em>");
- }
- }
- }
- $(".ques-type-control label input").prop('checked',false).parent("label").removeClass("active");
- /////////////////////
- for(var l=0;l<TopicType.length;l++){
- initType(l)
- $(".ques-topic").eq(l).find(".item-count").html(topicCount($(".ques-topic").eq(l)));
- totalTopicCount();
- }
- function initType(num){
- if(TopicType[num] && TopicType[num].length>0){
- //0单选题 1不定项选题 2填空题 3主观题 4选做题
- var tempTopic = tempBox.eq(num);
- var input_obj=$(".ques-type-control label input").eq(num);
- input_obj.prop('checked',true).parent("label").addClass("active");
- for(var i=0;i<TopicType[num].length;i++){
- if(i==0){
- tempTopic.show();
- tempTopic.find('.ques-item-del').hide();
- if(num == 0 || num == 1){
- //处理题型
- tempTopic.find('.ques-topic-item').find("em").remove();
- for(var j=0;j<TopicType[num][i][0];j++){
- tempTopic.find('.ques-topic-list').eq(0).find('.ques-topic-item').find("s").before("<em>【"+arr[j]+"】<b></b></em>");
- }
- }else if(num == 2){
- //处理题型
- tempTopic.find('.ques-topic-list').eq(0).find('.line-control').css("display","inline-block");
- tempTopic.find('.ques-topic-list').eq(0).find('.line-control input').val(TopicType[2][i][0]);
- var html = "";
- if(TopicType[2][i][3]){
- var smallTopics = TopicType[2][i][3];
- var smallTopicsArr = smallTopics.split(",");
- for(var a=0;a<smallTopicsArr.length;a++){
- var smallTopicsStr = smallTopicsArr[a];
- var nextArr = smallTopicsStr.split("///");
- var bigNum = nextArr[0];
- var smallNum = nextArr[1];
- html += '<li>第 <input type="text" class="include-text" value="'+bigNum+'"> 题有 <input type="text" class="include-count" value="'+smallNum+'"> 个小题 <img src="/images/u434.png" class="del-include"></li>';
- }
- }
- tempTopic.find('.ques-topic-list').eq(0).find('.include-list ul').html(html);
- //处理样式
- tempTopic.find('.line-type label').eq(TopicType[num][i][2]-1).find('input:radio').attr('checked',true);
- }else if(num == 3){
- //处理题型
- if(String(TopicType[num][i][0]).indexOf('///')>-1){
- var NumberArr=TopicType[num][i][0].split('///');
- tempTopic.find('.ques-topic-list').eq(0).find('input[name="topicType"][value="'+NumberArr[0]+'"]').prop("checked",true);
- tempTopic.find('.ques-topic-list').eq(0).find(".line-control input").val(NumberArr[1]);
- tempTopic.find('.ques-topic-list').eq(0).find(".line-control").css("display","inline-block");
- }else{
- tempTopic.find('.ques-topic-list').eq(0).find('input[name="topicType"]').eq(TopicType[num][i][0]-1).prop("checked",true);
- tempTopic.find('.ques-topic-list').eq(0).find(".line-control").hide();
- }
- var html = "";
- if(TopicType[3][i][3]){
- var smallTopics = TopicType[3][i][3];
- var smallTopicsArr = smallTopics.split(",");
- for(var a=0;a<smallTopicsArr.length;a++){
- var smallTopicsStr = smallTopicsArr[a];
- var nextArr = smallTopicsStr.split("///");
- var bigNum = nextArr[0];
- var smallNum = nextArr[1];
- html += '<li>第 <input type="text" class="include-text" value="'+bigNum+'"> 题有 <input type="text" class="include-count" value="'+smallNum+'"> 个小题 <img src="/images/u434.png" class="del-include"></li>';
- }
- }
- tempTopic.find('.ques-topic-list').eq(0).find('.include-list ul').html(html);
- //处理样式
- if(TopicType[num][i][2]==0){
- tempTopic.find('.line-type label').eq(TopicType[num][i][2]).find('input:radio').prop('checked',true);
- }else{
- tempTopic.find('.line-type label').eq(TopicType[num][i][2]-1).find('input:radio').prop('checked',true);
- }
- }else if(num == 4){
- //处理题型
- if(TopicType[num][i][0]){
- var NumberArr=TopicType[num][i][0].split('///');
- tempTopic.find('.choose-topic-num').find('input').eq(0).val(NumberArr[0]);
- tempTopic.find('.choose-topic-num').find('input').eq(1).val(NumberArr[1]);
- }
- //处理样式
- tempTopic.find('input[name="chooseType"]').eq(TopicType[num][i][2]-1).attr('checked',true);
- }
- //处理题号
- tempTopic.find('.ques-topic-list').eq(0).find('.topic-num input').val(TopicType[num][i][1]);
- }else{
- var temp= tempTopic.find(".add-type").prev().clone(true);
- if(num == 0 || num == 1){
- temp.find('.ques-topic-item').find("em").remove();
- for(var j=0;j<TopicType[num][i][0];j++){
- temp.find('.ques-topic-item').find("s").before("<em>【"+arr[j]+"】<b></b></em>");
- }
- }else if(num == 2){
- temp.find('.line-control input').val(TopicType[num][i][0]);
- var html = "";
- if(TopicType[2][i][3]){
- var smallTopics = TopicType[2][i][3];
- var smallTopicsArr = smallTopics.split(",");
- for(var a=0;a<smallTopicsArr.length;a++){
- var smallTopicsStr = smallTopicsArr[a];
- var nextArr = smallTopicsStr.split("///");
- var bigNum = nextArr[0];
- var smallNum = nextArr[1];
- html += '<li>第 <input type="text" class="include-text" value="'+bigNum+'"> 题有 <input type="text" class="include-count" value="'+smallNum+'"> 个小题 <img src="/images/u434.png" class="del-include"></li>';
- }
- }
- temp.find('.include-list ul').html(html);
- }else if(num == 3){
- temp.find("input[name^='topicType']").prop("checked",'');
- temp.find("input[name^='topicType']").attr("name","topicType_"+i);
- //判断题型是否包括横线
- if(String(TopicType[num][i][0]).indexOf('///')>-1){
- var NumberArr=TopicType[num][i][0].split('///');
- temp.find('input[name="topicType_'+i+'"]').eq(NumberArr[0]-1).prop("checked",true);
- temp.find(".line-control input").val(NumberArr[1]);
- temp.eq(0).find(".line-control").show();
- }else{
- temp.find('input[name="topicType_'+i+'"][value="'+TopicType[num][i][0]+'"]').prop("checked",true);
- temp.find(".line-control").hide();
- }
- // temp.find('.line-control input').val(TopicType[num][i][0]);
- var html = "";
- if(TopicType[3][i][3]){
- var smallTopics = TopicType[3][i][3];
- var smallTopicsArr = smallTopics.split(",");
- for(var a=0;a<smallTopicsArr.length;a++){
- var smallTopicsStr = smallTopicsArr[a];
- var nextArr = smallTopicsStr.split("///");
- var bigNum = nextArr[0];
- var smallNum = nextArr[1];
- html += '<li>第 <input type="text" class="include-text" value="'+bigNum+'"> 题有 <input type="text" class="include-count" value="'+smallNum+'"> 个小题 <img src="/images/u434.png" class="del-include"></li>';
- }
- }
- temp.find('.include-list ul').html(html);
- }else if(num == 4){
- if(i==1){
- temp.find("input[name='chooseType']").attr("name","chooseType_"+i);
- }else{
- temp.find("input[name='chooseType_"+(i-1)+"']").attr("name","chooseType_"+i);
- }
- //处理题型
- if(TopicType[num][i][0]){
- var NumberArr=TopicType[num][i][0].split('///');
- temp.find('.choose-topic-num').find('input').eq(0).val(NumberArr[0]);
- temp.find('.choose-topic-num').find('input').eq(1).val(NumberArr[1]);
- }
- temp.find('input[name="chooseType_'+i+'"]').eq(TopicType[num][i][2]-1).attr('checked',true);
- }
- temp.find('.topic-num input').val(TopicType[num][i][1]);
- temp.find('.ques-item-del').show();
- tempTopic.find(".add-type").before(temp);
- }
- }
- }
- }
- }
- });
- function show_version() {
- layer.msg('你的客户端版本太低,请升最新版本');
- }
- </script>
- <script src="/js/third/submit.js"></script>
- <script src="/js/third/select-class.js"></script>
|