🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# 考点练习 http://xue.test/index.php?r=croom/passer/answer&scheduleID=199 ## 考点强化—函数与导数(高考数学) http://xue.test/index.php?r=croom/passer/answer&scheduleID=199 ``` /** * 考点练习 * @author zhangjsh 2014/12/03 */ public function actionAnswer() { $this->layout = 'passer_answer_layout' ; if( Yii::app()->user->isGuest) $this->redirect_msgBox(array('default/index'),array('msg'=>'请先登录')) ; $uid = Yii::app()->user->id ; $scheID = Yii::app()->request->getParam('scheduleID') ; $alias = Yii::app()->request->getParam('alias'); $tagID = RequestUtils::getNormalRequest('tagID');//题型对应的tagID:一级考点 /*付费限制 @author chenzsh */ if($this->isCharge){ $flag = WebScheduleService::factory()->payRestrict($uid,$scheID,$alias) ; if(!$flag) $this->redirect_msgBox(array('index'), array('msg' => $this->statusArr[53],'width'=>'500')); } $this->render( 'answer', array( 'scheduleID'=> $scheID, 'alias' => $alias, 'tagID' => $tagID, )); } ``` ## 获取试题 http://xue.test/index.php?r=croom/passer/getExercise&_t=t&callback=jQuery1112012097318243600563_1547867156118&scheduleID=197&id=907442&alias=&examID=129832&_=1547867156122 'scheduleID'=> $args['scheduleID'] , 'uid' => $args['uid'] , 'sname' => $args['scheduleID'] ? StudyScheduleService::factory()->getScheTag($args['scheduleID'])->fdName : '' GET ``` // 获取试题 r: croom/passer/getExercise scheduleID: 197 id: 1562535 alias: examID: 25866 ``` http://xue.test/index.php?r=croom/passer/getRecommend&type=26&eid=149478&subject=2&schoolType=3&len=3 GET ``` //获取推荐内容 r: croom/passer/getRecommend type: 26 eid: 149478 subject: 2 schoolType: 3 len: 3 ``` http://xue.test/index.php?r=croom/passer/post&callback=jQuery111202673474636363342_1547861699091 POST ``` { "aeid": "1562534", "eid": "1075719", "type": "1", "duration": 298000, "videa": 0, "videaweike": 0, "vanalysis": 0, "vweike": 0, "submitExam": 0, "item": [{ "exerciseItemID": "1206238", "question": [{ "type": "1", "myAnswer": ["2702102"], "myScore": "5", "isRight": 1 }] }], "scheduleID": "199", "targetID": null } ``` ## 试题信息 结构看协议 ``` ExerJsonForWebService::factory()->getExerInfo($args['id'],$args['examID'],null, array( 'scheduleID'=> $args['scheduleID'] , 'uid' => $args['uid'] , 'sname' => $args['scheduleID'] ? StudyScheduleService::factory()->getScheTag($args['scheduleID'])->fdName : '' )) ; ``` D:\wamp\www\xue.test\xuetang\protected\service\ExerJsonForWebService.php ``` /** * 试题信息 结构看协议 * @param $id 题目ID * @param $examID 试卷ID(传NUll,题目分数将获取本身的分数,否则以题目在试卷所占分数为准) * @param null $aqid * <pre> * $arg e.g: * array( * 'examID' => 111,//试卷ID * ... * ) * </pre> * @param array $args * @return array * @author chenzsh 14-12-16 * @since 2016-1-14 add $args['examID'] by Zhangjsh */ public function getExerInfo($id,$examID ,$aqid = null,$args = array()) { $exercise = Exercise::model()->with('exerciseItems','exerciseAlias','diff')->findByPk($id); if(!$examID && $aqid){ $aq = wkeAnswerQuestion::model()->findByPk($aqid) ; $examID = $aq->answerExam->fdExamID ; } $data = array() ; $data['scheduleID'] = $args['scheduleID'] ; $data['targetID'] = $args['targetID'] ; $data['sname'] = $args['sname'] ; $data['myscore'] = $args['myscore'] ; $data['right'] = $args['right'] ? 1 : 0; $data['id'] = $id ; $data['aqid'] = $aqid ; $data['type'] = $exercise->fdExerciseTypeID; $data['subjective'] = $this->getExerTypeName($data['type']) ; $data['alias'] = $exercise->fdAlias ; $data['aliasname'] = $exercise->exerciseAlias->fdName ; $data['text'] = $exercise->fdText ; $data['score'] = $examID ? V2ExamService::factory()->getScore($exercise->id,$examID) : $exercise->fdScore ; //总分 $data['exerNo'] = $examID ? (ExamItemMap::model()->findByAttributes(array('fdExamID'=>$examID,'fdExerciseID'=>$exercise->id))->fdExerNo) : null ; //题号 $data['isFavorite'] = ContentService::factory()->isFavorite($exercise->fdContentID,$args['uid']) ? 1 : 0; $data['schoolType'] = ContentService::factory()->getIntegerValue($exercise->fdContentID,WK::SECTION_ATTR_ID) ; $data['subject'] = ContentService::factory()->getIntegerValue($exercise->fdContentID,WK::SUJT_ATTR_ID) ; $data['diff'] = $exercise->diff->fdValue ; $data['hasideaweike'] = $this->hasIdeaWeike($exercise->exerciseItems[0]) ; $data['tag'] = $this->getExerTag($exercise->fdContentID) ; $data['item'] = array() ; if ($exercise->exerciseItems) { foreach ($exercise->exerciseItems as $item) { //循环一道大题 if (in_array($exercise->fdExerciseTypeID, Yii::app()->params['OBJECTIVE_TYPE']) || in_array($item->fdType, Yii::app()->params['OBJECTIVE_TYPE'])) { $temp = $this->getChoose($item, $aqid, $exercise, $examID); $data['item'][] = $temp; } else if ($exercise->fdExerciseTypeID == WK::QUESTION_ID || $exercise->fdExerciseTypeID == WK::COMPLETION_ID || $item->fdType == WK::QUESTION_ID || $item->fdType == WK::COMPLETION_ID ) { $temp = $this->getQuestion($item, $aqid, $exercise, $examID); $data['item'][] = $temp; } } } return $data ; } ``` ## answer视图 **D:\wamp\www\xue.test\xuetang\protected\modules\croom\views\passer\answer.php** ``` <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->baseUrl?>/public/school/css/thickbox.css"> <link href="<?php echo Yii::app()->request->baseUrl; ?>/public/school/images/favicon.ico" mce_href="<?php echo Yii::app()->request->baseUrl; ?>/public/school/images/favicon.ico" rel="bookmark" type="image/x-icon" /> <link href="<?php echo Yii::app()->request->baseUrl; ?>/public/school/images/favicon.ico" mce_href="<?php echo Yii::app()->request->baseUrl; ?>/public/school/images/favicon.ico" rel="icon" type="image/x-icon" /> <link href="<?php echo Yii::app()->request->baseUrl; ?>/public/school/images/favicon.ico" mce_href="<?php echo Yii::app()->request->baseUrl; ?>/public/school/images/favicon.ico" rel="shortcut icon" type="image/x-icon" /> <script type="text/javascript" src="../../../../../public/school/js/showBox-2.js"></script> <script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/public/simditor/simditor.index.js"></script> <script type="text/javascript" src="<?php echo Yii::app()->baseUrl?>/public/school/js/thickbox.js"></script> <!--网页内容--> <div class="v2_loading_full"> <div class="v2_loading_tips">亲,我们正在努力的加载练习信息,稍微等一下下啦。</div> </div> <div class="contain bc pb50"> <h2 id="etitle" class="cb_hz_title tc font-y"></h2> <div class="cb_hz_status font-y"> <div class="w mb30" id="stitle"></div> <div class="w clearfix" id="status"> </div> </div> <div class="w clearfix"> <div class="w780 fl"> <div class="cb_hz_warper on pr box-sizing"> <div id="info" class="header clearfix font-y none"> </div> <div id="main" class="body"> </div> </div> </div> <div class="w200 fr"> <!-- 帮助台 --> <div id="help" class="ch_hz_help_box mb15"> </div> <!-- 帮助台 end--> <!-- 关联知识 --> <div id="attach" class="ch_hz_help_box" > </div> <!-- 关联知识 end--> </div> <div class="v2_loading_part" style="position:static;border:1px solid #83ca61;"> <div class="v2_loading_tips2">亲,我们正在努力的加载题目信息,稍微等一下下啦。</div> </div> </div> </div> <!--网页内容 end--> <script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/public/school/js/showBox-2.js"></script> <script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/public/school/js/template.js"></script> <script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/public/school/js/exam-2.js"></script> <!-- 答题状态栏 --> <script type="text/html" id="exerStatus"> <div class="fl"> <div class="fl">答题卡:</div> <% for(var i = 1, len = situ.length; i <= len; i++) { %> <% if (situ[i-1].right == 0 ) { %> <% if (!flag) { %> <% flag = true; %> <div class="def now" title="当前题目"><%=i%></div> <% } else { %> <div class="def" title="未做"><%=i%></div> <% } %> <% } else if(situ[i-1].right == 1 || situ[i-1].right == 2) { %> <div class="def answer" title="回答正确,得分率100%"><%=i%><div class="right"></div></div> <% } else if(situ[i-1].right == 3 && situ[i-1].score > 0) { %> <div class="def answer" title="回答有误,得分率0~100%之间(不含0%及100%)"><%=i%><div class="warn"></div></div> <% } else if(situ[i-1].right == 3 && situ[i-1].score == 0) { %> <div class="def answer" title="回答错误,得分率0%"><%=i%><div class="error"></div></div> <% } %> <% } %> </div> <div class="fr none"> <span class="fl">正确率:</span> <div class="line fr pr" title="本考点当前正确率:<%=rate ? rate : 0%>%"> <div class="line_left <%=(rate && rate * 1 > 0 ? '': 'none')%>" style="width:<%=rate ? rate : 0%>%;"> <div class="line_right"> <div class="line_center"><%=rate ? rate : 0%>%</div> </div> </div> </div> </div> </script> <!-- 答题状态栏 end--> <!-- 试题info --> <script type="text/html" id="exerInfo"> <div class="f16 fb fl ml20 circle"><%=index%></div> <span class="gray2 fl ml10">(本题满分<%=score%>分,难度<%=diff%>)</span> <div class="collect_group v2_exam_test_green fr"> <a id="collect" href="javaScript:" class="mr20 v2_old_exam_collect <%=(isFavorite ? 'v2_old_exam_collect_on' : '')%>" data-id="<%=id%>" data-type="<%=type%>"><%=(isFavorite ? '取消收藏' : '收藏')%></a> <a id="error" href="<?php echo $this->createUrl('passer/Feedback',array('width'=>422));?>&value=<%=id%>" class="mr20 v2_old_exam_error thickbox">纠错</a> </div> </script> <!-- 试题info end--> <!-- 试题题目 --> <script type="text/html" id="exerMain"> <% var abc = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O'], answer = "", fill, flag = true; %> <div class="content1 word-warp"> <div id="exercise<%=index%>" data-id="<%=id%>" class="w"><%=#text%></div> <% if(type * 1 == 1 || type * 1 == 7) { %> <div class="w mt20 sitems sel_item" data-i="0" data-id="<%=item[0].exerciseItemID%>" data-type="<%=item[0].type%>"> <% for (var i = 0, opt = item[0].question[0].options, len = opt.length; i < len; i++) { %> <div class="cb_hz_sel clearfix" data-t="<%=abc[i]%>" data-id="<%=opt[i].id%>"> <span class="w30 fl"><%=abc[i]%>.</span> <div class="w640 ml5 fl"><%=#opt[i].text%></div> </div> <% } %> </div> <% } else if (type * 1 == 4) { %> <% for (var i = 0, item = item, len = item.length; i < len; i++) { %> <% if (item[i].type * 1 == 1 || item[i].type * 1 == 7) { %> <div class="w clearfix items sel_item mt20" data-i="<%=i%>" data-id="<%=item[i].exerciseItemID%>" data-type="<%=item[i].type%>"> <span class="w40 fl">(<%=(i+1)%>)</span> <div class="w680 fl"><%=#item[i].text%></div> <% for(var j = 0, question = item[i].question, len1 = question.length; j < len1; j++) { %> <div class="w fr word-break mt20"> <% for (var k = 0, opt = question[j].options, len2 = opt.length; k < len2; k++) { %> <div class="cb_hz_sel clearfix" data-t="<%=abc[k]%>" data-id="<%=opt[k].id%>"> <span class="w20 fl"><%=abc[k]%>.</span> <div class="w600 ml5 fl"><%=#opt[k].text%></div> </div> <% } %> </div> <% } %> </div> <% } else {%> <% if (flag) { flag = false; answer = item[i].question[0].myAnswer; fill = item[i].id;}%> <% var idList = "";%> <% for (var j = 0, question = item[i].question, len1 = question.length; j < len1; j++) { idList += question[j].id + (j == (len1 - 1) ? "" : "-"); }%> <div class="w clearfix items fill_item" data-i="<%=i%>" data-id="<%=item[i].exerciseItemID%>" data-type="<%=item[i].type%>" data-qids="<%=idList%>"> <span class="w40 fl">(<%=(i+1)%>)</span> <div class="w680 fl"><%=#item[i].text%></div> </div> <% } %> <% } %> <% } %> </div> <div id="myAnswer" class="mt20 maxImg"> <% if (type == 1 || type == 7) { %> <div class="w mt10 tc v2_exam_gray_btn big clearfix"> <a id="submit-object" class="w120 fr submit-btn" href="javaScript:">提交答案</a> </div> <% } else { %> <% if(type == 2 || type == 3) { answer = item[0].question[0].myAnswer; flag = false;}%> <% if (!flag) { %> <% var idList = "";%> <% for (var j = 0, question = item[0].question, len1 = question.length; j < len1; j++) { idList += question[j].id + (j == (len1 - 1) ? "" : "-"); }%> <div id="answer-box"> <textarea id="item-<%=id%>" class="editor mt10" data-id="<%=item[0].exerciseItemID%>" data-type="<%=item[0].type%>" data-info="<%=answer%>" data-qids="<%=idList%>"></textarea> </div> <% } %> <div class="w mt10 tc v2_exam_next_btn big clearfix"> <a id="submit-subject" class="w120 fr" href="javaScript:">提交答案</a> </div> <% } %> </div> </script> <!-- 试题题目 end--> <!-- 解题思路 --> <script type="text/html" id="exerIdea"> <% for(var i = (start ? start: 0), item = data.item, len = (end ? end: item.length); i < len; i++) { %> <div class="mt20 border_t_d gray2 exer_answer" data-i="<%=i%>"> <h3 class="f16 fb mt20 mb20"><%=item.length == 1 ? '【参考答案】' : "(" + (i + 1) + ")、参考答案"%></h3> <div class="w mb20 pb10"> <h4 class="cb_hz_item_title">解题思路</h4> <div class="w clearfix pr mt10"> <div class="fl w660 ml20"> <% if(item[i].idea) { %> <%=#item[i].idea%> <% } else { %> 暂无解题思路内容 <% } %> </div> <% if (item[i].ideaweike && item[i].ideaweike != 0) { %> <a href="javaScript:" class="pa watchidea" style="right:10px;top:0;" data-id="<%=item[i].ideaweike%>" data-index="<%=i%>"> <img src="<?php echo Yii::app()->request->baseUrl; ?>/public/school/images/v2_country_play_big.png" alt=""> </a> <% } %> </div> </div> </div> <% } %> </script> <!-- 解题思路 end--> <!-- 解题过程 --> <script type="text/html" id="exerAnalysis"> <div class="w mb20 border_t_d pb10"> <h4 class="cb_hz_item_title mt20">解题过程</h4> <div class="w clearfix pr mt10"> <div class="fl w660 ml20"> <% if(item.analysis) { %> <%=#item.analysis%> <% } else { %> 暂无解题过程内容 <% } %> </div> <% if (item.weike && item.weike != 0) { %> <a href="javaScript:" class="pa watchweike" style="right:10px;top:0;" data-id="<%=item.weike%>" data-index="<%=i%>"> <img src="<?php echo Yii::app()->request->baseUrl; ?>/public/school/images/v2_country_play_big.png" alt=""> </a> <% } %> </div> </div> <% if (item.type * 1== 2 || item.type * 1 == 3) { %> <div class="w mb20 border_t_d pb10"> <h4 class="cb_hz_item_title mt20">答案</h4> <div class="w clearfix pr mt10"> <div class="fl w660 ml20"> <% var answerText = ""; %> <% for (var i = 0, ques = item.question, len = ques.length; i < len; i++) { %> <% if(ques[i].text) { answerText += ques[i].text + '</br>';} %> <% } %> <% if(answerText.length > 0) { %> <%=#answerText%> <% } else { %> 暂无答案内容 <% } %> </div> </div> </div> <div class="w mb20 border_t_d pb10"> <% if (item.question[0].points && item.question[0].points.length > 0) { %> <h4 class="cb_hz_item_title mt20">采分点</h4> <div class="w700 ml20 mt20 exer-points"> <% for (var i = 0, point = item.question[0].points, len = point.length; i < len; i++) { %> <div class="point_item v2_exam_test_checkbox mt10 clr" data-score="<%=point[i].score || 0%>" data-id="<%=point[i].id%>"> <div class="fl"><%=#point[i].text%></div> <span class="fl orange">(<%=point[i].score || 0%>分)</span> </div> <% }%> </div> <% } %> <div class="w cleafix mt30 <%=(item.question[0].points && item.question[0].points.length > 0? 'border_t_d pt20' : '')%>"> <h4 class="cb_hz_item_title fl">自评得分:</h4> <input type="text" class="fl w50 h25 lh25 tc mr5 selfscore" data-max="<%=item.score || 0%>" maxlength="4" data-id="<%=item.exerciseItemID%>"> <span class="fl">分</span> <span class="fl orange">(满分<%=item.score || 0%>分)</span> </div> </div> <% } %> </script> <!-- 解题过程 end--> <!-- 帮助台 --> <script type="text/html" id="exerHelp"> <div class="mt20 ml20 font-y f16 fb">帮助台</div> <% for (var i = 0, len = item.length; i < len; i++) { %> <% if (item[i].ideaweike && item[i].ideaweike != 0) { %> <div class="v2_exam_savebtn mt25 tc"> <a class="w120 idea-btn" data-index="<%=i%>" href="javaScript:"> <img src="<?php echo Yii::app()->request->baseUrl; ?>/public/school/images/v2_country_play_white.png" alt="" class="vm mr5"><%=len > 1 ? '('+(i+1)+')解题思路' : '查看解题思路'%> </a> </div> <% } %> <% } %> </script> <!-- 帮助台 end--> <!-- 关联知识 --> <script type="text/html" id="rcmList"> <% if (list.length > 0) { %> <div class="mt20 ml20 font-y f16 fb">关联知识</div> <div class="w150 h100 mt20 ml20 pr"> <a href="<?php echo $this->createUrl('exam/videoTipTable1');?>&width=590&height=454&id=<%=list[0].id%>" class="thickbox"> <img id="rcm-img" src="<%=list[0].thumb%>" alt="推荐专题图" width="150px" height="100px"> <div class="v2_exam_rcm_box"> <img class="vm ml5 mr5" src="<?php echo Yii::app()->request->baseUrl; ?>/public/school/images/v2_country_play_white.png" alt=""> <span class="inline-block w120 lh25 word-ellipsis vm" title="<%=list[0].name%>"><%=list[0].name%></span> </div> </a> </div> <% if (list.length > 1) { %> <div class="ml20 w160 mt15" id="rcm-list"> <% for (var i = 1, len = list.length; i < len; i++) {%> <div class="w h25"> <a class="thickbox" href="<?php echo $this->createUrl('exam/videoTipTable1');?>&width=590&height=454&id=<%=list[i].id%>"> <img class="vm ml5 mr5" src="<?php echo Yii::app()->request->baseUrl; ?>/public/school/images/v2_country_play_gray.png" alt=""> <span class="inline-block w130 lh25 word-ellipsis vm" title="<%=list[i].name%>"><%=list[i].name%></span> </a> </div> <% } %> </div> <% } %> <% } %> </script> <!-- 关联知识 end--> <!-- 题型练习弹窗 --> <script type="text/html" id="tipBox"> <div class="v2_exam_guide_bg"></div> <div class="v2_pay_table_box" style="width:545px;position:fixed;left:50%;top:50%;margin-left:-269px;margin-top:-114px;z-index:10002;"> <div class="w pt8 tr"> <a href="javaScript:void(0)" class="close-btn mr8" title="点击关闭当前弹窗,并跳转至报告页"> <img src="<?php echo Yii::app()->request->baseUrl; ?>/public/school/images/v2_pay_close.png"> </a> </div> <h2 class="ml15 font-y f18 fb" style="margin-top:-15px; width:480px;"><%=(result < 80 ? '好样的,你已完成本组练习,再练一次会更好!' : '本组练习成绩很棒,马上开始下一知识点的学习吧!')%></h2> <div class="w496 bc clr mt20 pb20"> <div class="fl f12 mt5"> <div class="cb_index_table_circle ml5"> <P class="<%=result >= 80 ? 'green3' : 'orange'%> mt15 font-y"><span style="font-size:30px"><%=result%></span><span class="f20">%</span></P> <P class="f12 mt3">正确率</P> </div> </div> <div class="fr w358"> <div class="w f14 lh180" style="min-height:100px;"> <div class="w pb7 clr"> <span class="fl w290 word-ellipsis" title="<%=name || '未知'%>">练习内容:<%=name || '未知'%></span> </div> <% var typeAdd = { 1: ["<?php echo $this->createUrl('passer/perExer');?>&answerExamID=" + aeid, "<?php echo $this->createUrl('passer/CountryAnalysis');?>&answerExamID=" + aeid, "<?php echo $this->createUrl('passer/answer');?>&scheduleID=" + nextId, "<?php echo $this->createUrl('passer/answer');?>&scheduleID=" + id], 2: ["<?php echo $this->createUrl('passer/perExer');?>&answerExamID=" + aeid, "<?php echo $this->createUrl('passer/AliasAnalysis');?>&answerExamID=" + aeid, "<?php echo $this->createUrl('passer/answer');?>&alias=" + nextId, "<?php echo $this->createUrl('passer/answer');?>&alias=" + id] };%> <div class="w pb7 clr"> <span class="fl w280 word-ellipsis">答题概况:正确<span class="orange"><%=right || 0%></span>,有误<span class="orange"><%=warn || 0%></span>,错误<span class="orange"><%=wrong || 0%></span></span> <span class="fr blue f13 mt2"><a href="<%=typeAdd[type][0]%>">习题解析&gt;&gt;</a></span> </div> <div class="w pb7 clr"> <span class="fl w280 word-ellipsis">练习结果: <% if (result >= 80) { %> <span class="green3">掌握良好</span> <% } else { %> <span class="orange">未掌握</span> <% } %> </span> <span class="fr blue f13 mt2"><a href="<%=typeAdd[type][1]%>">评估报告&gt;&gt;</a></span> </div> </div> <div class="w mt10 clearfix f14 font-y"> <span class="v2_exam_next_btn middle fr ml2"><a class="fr" style="width:104px;" href="<%=typeAdd[type][3]%>">再做一组练习</a></span> <span class="v2_exam_access_btn middle fr" <%=(type * 1 == 1 && nextId? '' : "style=display:none;")%>><a style="width:104px;" href="<%=typeAdd[type][2]%>">下一知识点练习</a></span> </div> </div> </div> </div> </script> <!-- 题型练习弹窗 end--> <!-- 考点强化弹窗 --> <script type="text/html" id="countryBox"> <div class="v2_exam_guide_bg"></div> <div class="v2_pay_table_box" style="width:545px;position:fixed;left:50%;top:50%;margin-left:-269px;margin-top:-114px;z-index:10002;"> <div class="w pt8 tr"> <a href="javaScript:void(0)" class="close-btn mr8" title="点击关闭当前弹窗,并跳转至报告页"> <img src="<?php echo Yii::app()->request->baseUrl; ?>/public/school/images/v2_pay_close.png"> </a> </div> <div class="pa" style="top:-50px;left:-35px;"> <img src="<?php echo Yii::app()->request->baseUrl; ?>/public/school/images/chabu/mascot.png" width="166" height="237"> </div> <div class="w360 mt15" style="min-height:150px;margin-left:130px;"> <% if (type == 1) { %> <p class="font-y lh35 fb f16 t2">好样的,<%=name%>,你已经完成了一个考点的强化练习,我们建议你创建一个系统的备考练习计划,复习零死角,考试提分嗖嗖嗖...</p> <% } else { %> <p class="font-y lh35 fb f16 t2">hi,<%=name%>,依据你的学习计划,当前有<span class="orange">2</span>个考点等待练习掌握,赶快去消灭它们,向学霸进发!</p> <% } %> <div class="w mt10 clearfix f14 font-y"> <span class="v2_exam_access_btn middle fl mr20"><a class="close-btn" style="width:104px;" href="javaScript:">我知道了</a></span> <span class="v2_exam_next_btn middle fl"><a class="fl" style="width:104px;" href="<%=(type == 1? "<?php echo $this->createUrl('/personal/user/CreatePlan');?>": "<?php echo $this->createUrl('/personal/user/plan');?>")%>"><%=(type == 1? '制定学习计划': '查看学习计划')%></a></span> </div> </div> </div> </script> <!-- 考点强化弹窗 end--> <script> var weikeInfo; var weikeType; $(function() { // CKEDITOR.disableAutoInline = true; var uid = "<?php echo Yii::app()->user->id;?>", answerExamID, scheduleID = '<?php echo $scheduleID;?>', examID, alias = '<?php echo $alias;?>', school = {}, time = 0, start_time, timer, save, index = 0, list = [], editor = null, userName = '<?php echo Yii::app()->user->id ? $this->getShowName(Yii::app()->user->id):"游客"; ?>', abc = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O'], examType = null; var preload = {}, waitList = {exer:[], rcm:[]}, view = {}; var allScore = 0, mineScore = 0; var btnG = { submit : '<div class="w v2_exam_gray_btn big clearfix mt10 tc"><a id="submit-again" class="w120 fr submit-btn" href="javaScript:">再次提交答案</a></div>', idea: '<div class="w v2_exam_next_btn big clearfix mt10 tc"><a id="watchidea" class="w120 idea-btn fr" href="javaScript:" data-index="0">查看解题思路</a><img src="<?php echo Yii::app()->request->baseUrl; ?>/public/school/images/v2_exam_error_face.png" alt=" fr" class="vm mt10 mr10 fr"><div class="w fr mt5 tr orange">答案错误,请重新选择!</div></div>', analysis: '<div class="w v2_exam_next_btn big clearfix mt10 tc"><a id="watchweike" class="w120 weike-btn fr" href="javaScript:" data-index="0">习题解题过程</a><img src="<?php echo Yii::app()->request->baseUrl; ?>/public/school/images/v2_exam_error_face.png" alt="" class="vm mt10 mr10 fr"></div>', errorN: function() { return '<div class="w v2_exam_next_btn big clearfix mt10 tc"><a class="w120 next-btn fr" href="javaScript:">' + (index == list.length ? '完成练习': '下一道') + '</a><img src="<?php echo Yii::app()->request->baseUrl; ?>/public/school/images/v2_exam_error_face.png" alt="" class="vm mt10 mr10 fr"></div>'; }, rightN: function() { return '<div class="w v2_exam_next_btn big clearfix mt10 tc"><a class="w120 next-btn fr" href="javaScript:">' + (index == list.length ? '完成练习': '下一道') + '</a><img src="<?php echo Yii::app()->request->baseUrl; ?>/public/school/images/v2_exam_right_face.png" alt="" class="vm mt10 mr10 fr"></div>'; }, rightS: function() { return '<div class="w v2_exam_next_btn big clearfix mt10 tc"><a class="w120 next-btn fr" href="javaScript:">' + (index == list.length ? '完成练习': '下一道') + '</a></div>'; } }; var stD; // 获取题目状态栏 (function getStatus() { $.ajax({ url:'<?php echo $this->createUrl("passer/test");?>', dataType:'jsonp', type:'get', data:{scheduleID: scheduleID, alias: alias, tagID: "<?php echo $tagID;?>"},//json为json数据 success:function(data) { stD = data; if (stD.status == 0) { var jsonD = stD['data']; answerExamID = jsonD.aeid; examID = jsonD.examID; time = jsonD.spend / 1000; var t = timeFormat(parseInt(jsonD.spend / 1000)); $("#time").text(t.time); $("#time").parent().attr('title', t.title); $("#print").attr("href", "<?php echo $this->createUrl('Exam/PrintExam');?>&id=" + jsonD.eid); $("#download").attr("href", "<?php echo $this->createUrl('exam/download');?>&examID=" + jsonD.eid + "&examName=" + jsonD.schoolType + " " + jsonD.subject + " " + jsonD.title); if (jsonD.type == 1) { $("#etitle").text("考点强化—" + jsonD.title + "(" +jsonD.schoolType + jsonD.subject + ")"); $("#stitle").text("强化点:" + jsonD.title + "—" + jsonD.lev3Title); } else { $("#etitle").text("题型练习—" + jsonD.title + "(" +jsonD.schoolType + jsonD.subject + ")"); $("#stitle").text("强化题型:" + jsonD.title); } examType = jsonD.type; setStatus(jsonD.situation, jsonD.rate.current); $('.v2_loading_full').hide(); school.schoolType = jsonD.schoolTypeID; school.subject = jsonD.subjectID; getExercise(list[index].eid); // getExercise(1415); // 1415 // 176115 } else { $('.v2_loading_full').hide(); if (data.status == 401) { $.showBox2({contents: data.msg, isAutoClose: true, second:3, callBack: function (){ var url = "<?php echo $this->createUrl('default/LoginBox');?>&width=330&height=419"; tb_show(null, url, false, null); }}); } else if (data.status == 36) { $.showBox2({contents: data.msg+"! 3秒后跳回升学复习主页!", isAutoClose: true, second:3, callBack: function (){ window.location.href = "<?php echo $this->createUrl('default/upgradeReview');?>"; }}); } else { $.showBox2({contents: data.msg+"! 3秒后跳回升学复习主页!", isAutoClose: true, second:3, callBack: function (){ window.location.href = "<?php echo $this->createUrl('default/upgradeReview');?>"; }}); } } } }); })(); // 设置题目状态栏 function setStatus(situ, rate) { // 获取当前题目index var flag = true; for (var i = 0, len = situ.length; i < len; i++) { if (situ[i].right == 0 && flag) { index = i; flag = false; } allScore += situ[i].exerscore ? parseFloat(situ[i].exerscore) : 0; mineScore = situ[i].score ? toFloat(mineScore + situ[i].score) : mineScore; } list = situ; $('#status').html(template.render('exerStatus', { situ: situ, rate: rate })); } // 获取试题 function getExercise(eid) { clearInterval(timer); $('.v2_loading_part').show(); $('.v2_loading_part').siblings().hide(); $.ajax({ url:'<?php echo $this->createUrl("passer/getExercise");?>', dataType:'jsonp', type:'get', data:{scheduleID: scheduleID, id: eid, alias:alias, examID: examID},//json为json数据 success: successHandle }); getRCM(eid, school); } // 预加载下一道题目和推荐 function preGetExer(eid) { preload.exer = null; preload.rcm = null; $.ajax({ url:'<?php echo $this->createUrl("passer/getExercise");?>', dataType:'jsonp', type:'get', data:{scheduleID: scheduleID, id: eid, alias:alias, examID: examID},//json为json数据 success: function(data) { preload.exer = data; if (waitList.exer && waitList.exer.length > 0) { waitList.exer.pop()(data); } } }); $.ajax({ url:'<?php echo $this->createUrl("passer/getRecommend");?>', type:'get', data:{type: '<?php echo WK::WEIKE_TYPE_ID;?>', eid: eid, subject: school.subject, schoolType: school.schoolType, len: 3},//json为json数据 success: function(data) { preload.rcm = data; if (waitList.rcm && waitList.rcm.length > 0) { waitList.rcm.pop()(data); } } }); } // 获取推荐列表 function getRCM(eid, jsonD) { $.ajax({ url:'<?php echo $this->createUrl("passer/getRecommend");?>', type:'get', data:{type: '<?php echo WK::WEIKE_TYPE_ID;?>', eid: eid, subject: jsonD.subject, schoolType: jsonD.schoolType, len: 3},//json为json数据 success: getRCMHandle }); } // 获取试题回调 function successHandle(data){ view = {}; answer_state = 0; if (data.status == 0) { var jsonD = data.data; save = jsonD; jsonD.index = index + 1; $('#info').html(template.render('exerInfo', jsonD)).show(); $('#main').html(template.render('exerMain', jsonD)); $("#help").html(template.render('exerHelp', jsonD)); $("#help").find(".idea-btn").length > 0 ? $("#help").show() : $("#help").append('<div class="w160 mt10 ml20">当前题目不含有解题思路微课!</div>').show(); index++; if (index < list.length) { preGetExer(list[index].eid); } editor = null; if ($(".editor").length) { $('.editor').each(function() { var answers = $(this).attr("data-info"); var $self = $(this); var id = $self.attr("id"); SimditorReady.addEvent(function () { editor = new Simditor({ textarea: $self, placeholder: '建议您先在草稿纸上答题,然后点击“提交答案”查看答案,进行自主评分', toolbarFloat: false, upload: { url: '<?php echo Yii::app()->request->hostInfo."/index.php?r=upload/UploadFile"?>',//粘贴图片上传路径 params: {from: 'answerExercise'}//可选,上传图片请求附带参数 }, _allowedTags: ['br', 'span', 'img', 'b', 'strong', 'i', 'strike', 'u', 'font', 'p', 'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'h1', 'h2', 'h3', 'h4', 'hr', 'table', 'tbody', 'thead', 'tfoot', 'th', 'tr', 'td', 'colgroup', 'col', 'sub', 'sup'], defaultImage: '<?php echo Yii::app()->request->baseUrl; ?>/public/school/images/ckimg.png', imageButton: ['upload'], pasteImage: true,//启用粘贴图片 toolbar: ['image', 'mathquill'],//工具栏按钮,'emoji'为表情,'mathquill'为公式编辑器 CKEDITOR_config: { toolbar: [ ['Image', 'jme'], ] } }); if (!isIE || safariVersion > DEFAULT_VERSION) { editor.uploader.on({ beforeupload: function() { $('#submit-subject').text("图片上传中..."); $('#submit-subject').parent().removeClass('v2_exam_next_btn').addClass('v2_exam_gray_btn'); }, uploadready: function() { $('#submit-subject').text("提交答案"); $('#submit-subject').parent().removeClass('v2_exam_gray_btn').addClass('v2_exam_next_btn'); } }); } answers.length > 0 && editor.setValue(answers); }); }); // CKEDITOR.inline($(".editor").attr("id")); } start_time = time; timeCount(); // 重置分数 scoreT = { subject: 0, object: 0 } $("body").scrollTop(0); } else { } $('.v2_loading_part').hide(); $('.v2_loading_part').siblings().show(); } // 获取关联知识回调 function getRCMHandle(data){ data = JSON.parse(data); if (data.status == 0) { var list = data.data; if (list.length > 0) { var html = template.render('rcmList', {list: list}); $('#attach').html(html); var $re = $('.v2_exam_rcm_box'); if (list[0].thumb) { $('#rcm-img').load(function() {}); $('#rcm-img').error(function() { $('#rcm-img').attr('src', '<?php echo Yii::app()->request->baseUrl; ?>/public/school/images/v2_pay_rcm.png'); }); } $('#attach').show(); } else { $('#attach').hide(); } } } // 计时 function timeCount() { var count = function() { time++; var t = timeFormat(time); $("#time").text(t.time); $("#time").parent().attr('title', t.title); } timer = setInterval(count, 1000); } // 时间转化 function timeFormat(time) { var hour = parseInt(time / 3600); var minute = parseInt(time % 3600 / 60); var second = time % 60; var title = "已耗时:" + hour + "时" + minute + "分" + second + "秒"; if (hour < 10) {hour = "0" + hour;} if (minute < 10) {minute = "0" + minute;} if (second < 10) {second = "0" + second;} return { time:minute + "分" + second + "秒", title:title }; } // 判断单选题目答案是否正确 function checkAnswer(itemID, optID, items) { for (var i = 0, len = items.length; i < len; i++) { if (items[i].exerciseItemID == itemID) { for (var j = 0, opt = items[i].question[0].options, len1 = opt.length; j < len1; j++) { if (opt[j].id == optID) { return parseInt(opt[j].right) ? items[i].score : 0; } } return 0; } } return 0; } // 保存答案 var answerSave; function saveAnswer(hasdone) { answerSave = new Answer({ aeid : answerExamID, eid : save.id, type : save.type, duration : (time - start_time) * 1000, videa : 0, videaweike : 0, vanalysis : 0, vweike : 0, submitExam : (index == list.length ? 1 : 0) }); if (save.scheduleID) { answerSave.scheduleID = save.scheduleID; answerSave.targetID = save.targetID; } else if (save.alias) { answerSave.alias = save.alias; } var s_type = parseInt(save.type); if (s_type == 1 || s_type == 7) { var $item = $('.sitems'); $item.each(function() { var itemID = $(this).attr('data-id'); var $sel = $(this).find('.cb_hz_sel.on'); var optID = $sel.attr("data-id"); var score = checkAnswer(itemID, optID, save.item); var need = { type : $(this).attr('data-type'), myAnswer : [optID], myScore : score, isRight : (score == 0 ? 0 : 1) }; answerInit(answerSave, itemID, need); }) } else if (s_type == 4) { var $item = $('.items'); var flag = true; $item.each(function() { var itemID = $(this).attr('data-id'); if ($(this).find('.cb_hz_sel').length > 0) { var $sel = $(this).find('.cb_hz_sel.on'); var optID = $sel.attr("data-id"); var score = checkAnswer(itemID, optID, save.item); var need = { type : $(this).attr('data-type'), myAnswer : hasdone ? [] : [optID], myScore : hasdone ? 0 : score, isRight : hasdone ? 0 : (score == 0 ? 0 : 1) }; answerInit(answerSave, itemID, need); } else { var $edit = $('.editor'); var id = $edit.attr("id"); $edit.find('.gray_tips').remove(); var str = editor.getValue(); var text = editor.getValue(); if (str.replace(/^((&nbsp;)|(<br\s*\/>)|\s)*$/g, '').length == 0) { text = ''; } var idList = $(this).attr("data-qids").split("-"); for (var di = 0, dlen = idList.length; di < dlen; di++) { var need = { type : $(this).attr('data-type'), id : idList[di], myAnswer : hasdone ? '' : (flag ? text : '') } flag = false; answerInit(answerSave, itemID, need); } } }) } else { var flag = true; var $edit = $('.editor'); $edit.find('.gray_tips').remove(); var id = $edit.attr('id'); var itemID = $edit.attr('data-id'); var str = editor.getValue(); var text = editor.getValue(); if (str.replace(/^((&nbsp;)|(<br\s*\/>)|\s)*$/g, '').length == 0) { text = ''; } var idList = $edit.attr("data-qids").split("-"); for (var di = 0, dlen = idList.length; di < dlen; di++) { var need = { type : $edit.attr('data-type'), id : idList[di], myAnswer : hasdone ? '' : (flag ? text : '') } flag = false; answerInit(answerSave, itemID, need); } } } // aexidObj用于保存返回的用于自评分的aexid var aexidObj; var aexidWait = []; function postAnswer() { aexidObj = null; $.ajax({ url:'<?php echo $this->createUrl("passer/post");?>', dataType:'jsonp', type:'post', data:{data:JSON.stringify(answerSave)},//json为json数据 success:function(data){ if (data.status == 0) { aexidObj = data.data; if (aexidWait.length > 0) { aexidWait.pop()(); } } } }) } // 检测用户,如果有用户已登录,那么可以提交答案 function checkAndSave(hasdone) { saveAnswer(hasdone); if (checkUser()) { postAnswer(); return true; } else { return false; } } // 检测用户 function checkUser(){ var flag = ''; $.ajax({ type:'post', async:false, url :"<?php echo $this->createUrl('user/CheckUserID');?>", success:function(data){ flag = data; } }) var isLogExp = /^\S+$/; if (isLogExp.test(flag)) { return true; } else { clearInterval(timer); var url = "<?php echo $this->createUrl('default/LoginBox');?>&width=330&height=419"; tb_show(null, url, false, null); return false; } } // 设置正确答案 function setRightAnswer() { var $items = $('.sel_item'); $items.each(function() { var itemId = $(this).attr('data-id'); var $sel = $(this).find('.cb_hz_sel'); $sel.each(function() { if (checkAnswer(itemId, $(this).attr('data-id'), save.item) != 0) { $(this).addClass('right'); } }); }) } // 设置解题思路 function setIdeas(start, end) { $("#main").append(template.render('exerIdea', { data: save, start: start, end: end })); // 综合题有多个小题是,帮助台解题思路不按顺序的时候排序 var $els = $(".exer_answer"); $els.sort(function(a,b) { return parseInt($(a).attr('data-i')) > parseInt($(b).attr('data-i')); }); $(".exer_answer").remove(); $("#main").append($els); } // 设置解题过程 function setAnalysis() { $(".exer_answer").each(function(i) { $(this).append(template.render('exerAnalysis', { item: save.item[i], i: i })) }) } // 测试自评分是否符合要求 function testScore(score, max) { var reg = /(^[1-9]\d*([.][0-9])?$)|(^0([.][0-9])?$)/; return reg.test(score) && toFloat(score) <= toFloat(max); } // 累加分数 function addScore() { var all = 0; $(".selfscore").each(function() { var result = testScore($(this).val(), $(this).attr('data-max')); if (result) { all += parseFloat($(this).val()); } else { all += 0; } }) scoreT.subject = all; } // 解决0.1+0.2产生的问题,保留最多一位小数 function toFloat(num) { return parseInt(num * 10) / 10; } // 设置采分点分数 var scoreFlag = false; //用于表示自评分改变的方式,true表示通过点击采分点改变,false则是输入改变 function setScore($el) { var score = 0; var $select = $el.parent().children('.v2_exam_test_checkbox_select'); var $input = $el.parent().next().find('input'); $select.each(function() { score += parseFloat($(this).attr('data-score') || 0); }); scoreFlag = true; $input.val(toFloat(score)); $input.blur(); scoreFlag = false; } // 提交自评分 function scorePost() { if (!aexidObj) { aexidWait.push(scorePost); } var data = { uid: uid, appraise: [], app: 'web.xuetang' }; if (save.scheduleID) { data.scheduleID = save.scheduleID; data.targetID = save.targetID; } else if (save.alias) { data.alias = save.alias; } $('.selfscore').each(function() { var scoreObj = { points: [], myscore: $(this).val(), aexid: aexidObj[$(this).attr('data-id')] } var $points = $(this).parent().prev('.exer-points'); if ($points.length > 0) { var $sel = $points.find('.v2_exam_test_checkbox_select'); $sel.each(function() { scoreObj.points.push({ id: $(this).attr('data-id'), score: $(this).attr('data-score') }); }); } data.appraise.push(scoreObj); }); $.ajax({ url: '<?php echo $this->createUrl("passer/selfAppraises");?>', type: 'post', data: {data:JSON.stringify(data)}, success: function(data) { } }); } // 获得题目状态 function statusChange() { return toFloat(scoreT.subject + scoreT.object) >= parseFloat(save.score) * 1 ? 2 : (toFloat(scoreT.subject + scoreT.object) > 0 ? 1 : 0); } // 设置正确率栏 function setStatusLine() { var $answer = $(".cb_hz_status .answer"); var $right = $(".cb_hz_status .answer .right"); var rate = $answer.length > 0 ? parseInt($right.length / $answer.length * 100): 0; var $line = $(".cb_hz_status .line"); if (rate > 0) { $line.attr("title", "本考点当前正确率:" + rate + "%"); $line.children(".line_left").css("width", rate + "%").show(); $line.find(".line_center").text(rate + "%"); } else { $line.attr("title", "本考点当前正确率:0%"); $line.children(".line_left").hide(); } } // 完成试卷弹框 function finalTips() { $('.v2_exam_guide_bg').remove(); $('.v2_pay_table_box').remove(); var rlen = $(".cb_hz_status .answer .right").length; var tD = stD.data; if (examType == 2) { $('body').append($(template.render('tipBox', { name: tD.type * 1 == 1 ? tD.title + "—" + tD.lev3Title : tD.title, result: list.length > 0 ? toFloat(100 * rlen / list.length) : 0, type: tD.type, aeid: tD.aeid, right: rlen, wrong: $(".cb_hz_status .answer .error").length, warn: $(".cb_hz_status .answer .warn").length, nextId: tD.type * 1 == 1 ? tD.nextScheID : alias, id: tD.type * 1 == 1 ? tD.scheduleID : alias }))); } else { $.ajax({ url: "<?php echo $this->createUrl('//personal/user/GetTagSituation')?>", type: 'GET', dataType: 'text', data: {}, success: function(data) { if (data == "meet" || data == "create") { $("body").append(template.render('countryBox', { type: data == "create" ? 1 : 2, name: userName })); } else { $.showBox2("正在为您跳转到报告页面!"); setTimeout(function() { window.location.href = "<?php echo $this->createUrl('passer/CountryAnalysis');?>&answerExamID=" + tD.aeid; }, 500); } } }) } $('.close-btn').live('click', function() { $('.v2_exam_guide_bg').remove(); $('.v2_pay_table_box').remove(); $.showBox2("正在为您跳转到报告页面!"); setTimeout(function() { if (tD.type * 1 == 1) { window.location.href = "<?php echo $this->createUrl('passer/CountryAnalysis');?>&answerExamID=" + tD.aeid; } else { window.location.href = "<?php echo $this->createUrl('passer/AliasAnalysis');?>&answerExamID=" + tD.aeid; } }, 500); }); } // 单选题选项选中 var answer_state = 0; $(".cb_hz_sel").live('click', function() { if ($(this).parent().hasClass('prevent')) { return false;} if ($(this).hasClass("on")) { $(this).removeClass("on right wrong"); if ($(this).parent().hasClass('sitems') && answer_state == 0) { $(".submit-btn").parent().removeClass('v2_exam_next_btn').addClass('v2_exam_gray_btn'); } else if (answer_state == 1) { $("#watchidea").parent().length > 0 && $("#watchidea").parent().replaceWith(btnG.submit) && setIdeas(); $("#submit-again").parent().removeClass('v2_exam_next_btn').addClass('v2_exam_gray_btn'); $(".idea-btn").removeClass('idea-btn').addClass('watchidea'); } } else { $(this).addClass("on").siblings().removeClass("on right wrong"); if ($(this).parent().hasClass('sitems') && answer_state == 0) { $(".submit-btn").parent().addClass('v2_exam_next_btn').removeClass('v2_exam_gray_btn'); } else if (answer_state == 1) { $("#watchidea").parent().length > 0 && $("#watchidea").parent().replaceWith(btnG.submit) && setIdeas(); $("#submit-again").parent().addClass('v2_exam_next_btn').removeClass('v2_exam_gray_btn') $(".idea-btn").removeClass('idea-btn').addClass('watchidea'); } } }) // 采分点 $('.point_item').live('click', function(){ if ($(this).parents('.exer-points').hasClass('prevent')) {return false;} if ($(this).hasClass('v2_exam_test_checkbox_select')) { $(this).removeClass('v2_exam_test_checkbox_select'); } else { $(this).addClass('v2_exam_test_checkbox_select'); } setScore($(this)); }) // 答案输入框响应事件 // var $sp = $('<span class="gray gray_tips">建议您先在草稿纸上答题,然后点击“提交答案”查看答案,进行自主评分</span>'); // $(".editor").live({ // focus: function() { // $(this).find('.gray_tips').remove(); // }, // blur: function() { // var str = CKEDITOR.instances[$(this).attr('id')].getData(); // if (str.replace(/^((&nbsp;)|(<br\s*\/>)|\s)*$/g, '').length == 0) { // $(this).html(''); // $(this).append($sp); // } // } // }); // 暂停事件 $("#pause").live('click', function() { clearInterval(timer); $.showBox2({contents: '不要暂停离开太久,要保持做题的节奏喔。', greets: 'Hi,亲爱的'+userName+':', hasConfirmButton: true, confirmValue: '继续答题', isAutoClose: false, confirmFunction: timeCount, closeFunction: timeCount}); }); // 收藏试题 $('#collect').live('click', function() { if ($(this).attr('prevent')) { return false; } $(this).attr('prevent', true); var self = $(this); var exerciseID = $(this).attr('data-id'); var eType = $(this).attr('data-type'); if(self.text() == "收藏") { $.ajax({ type: 'post', url: "<?php echo $this->createUrl('Exercise/AddFavorite');?>", data: {exerciseID: exerciseID, eType: eType}, success: function(data) { self.removeAttr('prevent'); if (data == "success") { self.text("取消收藏"); self.addClass('v2_old_exam_collect_on'); } else { $.showBox2("收藏失败"); } } }); } else { $.ajax({ type: 'post', url: "<?php echo $this->createUrl('Exercise/RemoveFavorite');?>", data: {exerciseID:exerciseID}, success: function(data) { self.removeAttr('prevent'); if (data == "success") { self.text("收藏"); self.removeClass('v2_old_exam_collect_on'); } else { $.showBox2("取消收藏失败"); } } }) } }); // 客观题提交按钮 $("#submit-object").live('click', function() { if ($(this).parent().hasClass('v2_exam_gray_btn')) {return false;} var $sel = $('.cb_hz_sel.on'); var result = checkAnswer($sel.parent().attr('data-id'), $sel.attr('data-id'), save.item); if (result == 0) { // 答案错误,如果是判断题则直接显示下一题按钮及解题思路和过程内容 if (save.type == 7) { scoreT.object = toFloat(result); if (checkAndSave()) { $sel.addClass('wrong'); $sel.parent().addClass('prevent'); var $main = $(this).parents("#main"); $(this).parents("#myAnswer").remove(); setIdeas(); setAnalysis(); $main.append(btnG.rightS()); // 防止点击查看解题思路按钮后再次添加解题思路信息 $(".idea-btn").removeClass('idea-btn').addClass('watchidea'); } else { return false; } } else { // 答案错误,如果有解题思路,则显示解题思路按钮 if(save.item[0].idea && save.item[0].ideaweike && save.item[0].ideaweike != "0") { $sel.addClass('wrong'); $(this).parent().replaceWith(btnG.idea); answer_state = 1; } else { // 如果没有则显示再次提交按钮 $(".cb_hz_sel").removeClass("on right wrong"); $(this).parent().replaceWith(btnG.submit); $("#submit-again").text("再次选择答案"); $("#submit-again").parent().removeClass('v2_exam_next_btn').addClass('v2_exam_gray_btn'); setIdeas(); // 防止点击查看解题思路按钮后再次添加解题思路信息 $(".idea-btn").removeClass('idea-btn').addClass('watchidea'); } } } else { // 如果答案正确则显示下一题按钮且显示解题思路解题过程 scoreT.object = toFloat(result); if (checkAndSave()) { $sel.addClass('right'); $sel.parent().addClass('prevent'); var $main = $(this).parents("#main"); $(this).parents("#myAnswer").remove(); setIdeas(); setAnalysis(); $main.append(btnG.rightS()); // 防止点击查看解题思路按钮后再次添加解题思路信息 $(".idea-btn").removeClass('idea-btn').addClass('watchidea'); } else { return false; } } }); // 查看解题思路按钮 $(".idea-btn").live('click', function() { var $help = $('#help'); if ($(this).parents("#help").length > 0) { $(this).removeClass('idea-btn').addClass('watchidea'); } else { $help.find('.idea-btn').removeClass('idea-btn').addClass('watchidea'); } weikeInfo = save.item[$(this).attr('data-index')].idea; weikeType = 1; tb_show(null, '<?php echo $this->createUrl("exam/VideoTipTable2"); ?>&width=810&height=488&id=' + save.item[$(this).attr('data-index')].ideaweike, false, null); view.idea = 1; if (save.type == 1 || save.type == 7) { answer_state = 1; $(".cb_hz_sel").removeClass("on right wrong"); $("#watchidea").length > 0 ? $("#watchidea").parent().replaceWith(btnG.submit) : $("#submit-object").parent().replaceWith(btnG.submit); $("#submit-again").parent().removeClass('v2_exam_next_btn').addClass('v2_exam_gray_btn'); setIdeas(); } else { var i = parseInt($(this).attr("data-index")); !isNaN(i) && setIdeas(i, i + 1); } }) // 客观题再次提交按钮 $("#submit-again").live('click', function() { if ($(this).parent().hasClass('v2_exam_gray_btn')) { return false; } var $sel = $('.cb_hz_sel.on'); var result = checkAnswer($sel.parent().attr('data-id'), $sel.attr('data-id'), save.item); $sel.parent().addClass('prevent'); if (result == 0) { $sel.addClass('wrong'); // 答案错误,如果有解题过程,则显示解题过程按钮 if(save.item[0].analysis && save.item[0].weike && save.item[0].weike != "0") { $(this).parent().replaceWith(btnG.analysis); } else { // 如果没有则显示错误的下一题 scoreT.object = 0; if (checkAndSave()) { $(this).parents("#main").append(btnG.rightS()); $(this).parents("#myAnswer").remove(); setRightAnswer() setAnalysis(); } else { return false; } } } else { // 如果答案正确则显示下一题按钮且显示解题思路解题过程 scoreT.object = toFloat(result); if (checkAndSave()) { $sel.addClass('right'); $(this).parents("#main").append(btnG.rightS()); $(this).parents("#myAnswer").remove(); setAnalysis(); } else { return false; } } }); // 查看解题过程按钮 $(".weike-btn").live('click', function() { weikeInfo = save.item[$(this).attr('data-index')].analysis; weikeType = 2; tb_show(null, '<?php echo $this->createUrl("exam/VideoTipTable2"); ?>&width=810&height=488&id=' + save.item[$(this).attr('data-index')].weike, false, null); view.weike = 1; if (save.type == 1 || save.type == 7) { scoreT.object = 0; if (checkAndSave()) { $("#watchweike").parents("#main").append(btnG.rightS()); $("#watchweike").parents("#myAnswer").remove(); setRightAnswer() setAnalysis(); } else { return false; } } }); // 解题思路播放按钮 $(".watchidea").live('click', function() { weikeInfo = save.item[$(this).attr('data-index')].idea; weikeType = 1; tb_show(null, '<?php echo $this->createUrl("exam/VideoTipTable2"); ?>&width=810&height=488&id=' + save.item[$(this).attr('data-index')].ideaweike, false, null); }); // 解题过程播放按钮 $(".watchweike").live('click', function() { weikeInfo = save.item[$(this).attr('data-index')].analysis; weikeType = 2; tb_show(null, '<?php echo $this->createUrl("exam/VideoTipTable2"); ?>&width=810&height=488&id=' + save.item[$(this).attr('data-index')].weike, false, null); }); // 记录分数 var scoreT = { subject: 0, object: 0 } // 主观题 $("#submit-subject").live('click', function() { var $self = $(this); if (checkAndSave()) { setRightAnswer(); // 移除现有的参考答案,后面重新渲染 $(".exer_answer").remove(); var $sel = $('.cb_hz_sel.on'); // 如果有选择题,则计算选择题的累积分值以及设置相应的对错 $sel.each(function() { var $p = $(this).parents('.sel_item'); var result = checkAnswer($p.attr('data-id'), $(this).attr('data-id'), save.item); scoreT.object += parseFloat(result); result ? $(this).addClass('right'): $(this).addClass('wrong'); }); $('.cb_hz_sel').parent().addClass('prevent'); if (editor) { $("#answer-box").html('<div class="answer_box mt10">' + editor.getValue() + '</div>'); editor = null; } setIdeas(); setAnalysis(); $self.parents("#main").append(btnG.rightS()); $self.parent().remove(); // 防止点击查看解题思路按钮后再次添加解题思路信息 $(".idea-btn").removeClass('idea-btn').addClass('watchidea'); } else { return false; } }); // 下一题按钮 $(".next-btn").live('click', function() { // 获取当前自评分输入框,并检测是否都已输入完毕并正确 var $sinput = $(".selfscore"); var len = $sinput.length; if (len > 0) { var tlen = 0; var $first; $sinput.each(function() { var result = testScore($(this).val(), $(this).attr('data-max')); tlen += (result ? 1 : 0); if (!$first && !result) { $first = $(this); } }) if (len > tlen) { $.showBox2({contents: '完成当前习题评分后可进入下一题!', greets: 'Hi,亲爱的'+userName+':', hasConfirmButton: true, confirmValue: '自动关闭', isAutoClose: true, second:2, timecount: true}); $first.focus(); return false; } } // 如果含有自评分输入框,则保存自评分 if ($('.selfscore').length > 0) { scorePost(); } var $now = $('.cb_hz_status .now'); var $div = $(statusChange() == 2 ? '<div class="right"></div>' : statusChange() == 1 ? '<div class="warn"></div>': '<div class="error"></div>'); $now.removeClass('now').addClass('answer').attr("title", statusChange() == 2 ? "回答正确,得分率100%": statusChange() == 1 ? "回答有误,得分率0~100%之间(不含0%及100%)" : "回答错误,得分率0").append($div); mineScore += toFloat(scoreT.subject + scoreT.object); // 如果当前题目不为最后一题 if (index < list.length) { var $next = $now.next(); $next.addClass('now').attr("title", "当前题目"); $('#info').html(''); $('#main').html(''); $('.v2_loading_part').show(); $('.v2_loading_part').siblings().hide(); clearInterval(timer); if (preload.exer) { successHandle(preload.exer); } else { waitList.exer.push(successHandle); } if (preload.rcm) { getRCMHandle(preload.rcm); } else { waitList.rcm.push(getRCMHandle); } } else { // 如果为最后一题则弹窗 finalTips(); $(".exer-points").addClass('prevent'); $('.selfscore').length > 0 && $('.selfscore').each(function() { var val = $(this).val(); $(this).replaceWith('<span class="orange fl">' + val + '</span>'); }) } setStatusLine(); }); // 自评分 $(".selfscore").live('blur', function() { var result = testScore($(this).val(), $(this).attr('data-max')); if (result) { $(this).parent().children('.orange.tip').remove(); } else { $(this).parent().children('.orange.tip').remove(); $(this).parent().append('<span class="fl ml20 orange tip">输入需为整数或最多一位小数(且不能超过该小题最大分值),请重新输入!</span>'); } //如果不是通过设置采分点来设置分数的,采分点全部取消选择 !scoreFlag && $(this).parent().prev('.exer-points').children('.v2_exam_test_checkbox').removeClass('v2_exam_test_checkbox_select'); // 累加分数 addScore(); }); }) </script> <!--网页内容 end--> ``` wkwke.tbAnswerExam.fdUserID ~ wkwke.tbAnswerExam.id ## 表 wkwke.tbAnswerExam ``` CREATE TABLE `tbAnswerExam` ( `id` int(11) NOT NULL AUTO_INCREMENT, `fdName` varchar(255) DEFAULT NULL COMMENT '报告名称', `fdUserID` int(11) NOT NULL COMMENT '对应tbUser.id', `fdExamID` int(11) NOT NULL COMMENT '试卷ID', `fdCreate` datetime NOT NULL COMMENT '创建时间', `fdStart` datetime DEFAULT NULL COMMENT '开始做试卷的时间', `fdEnd` datetime DEFAULT NULL COMMENT '介绍做试卷的时间', `fdUsed` int(11) NOT NULL DEFAULT '0' COMMENT '试卷已经使用的时间(单位是秒)', `fdScore` double DEFAULT NULL COMMENT '试卷总得分', `fdScoreRate` float DEFAULT '0' COMMENT '得分率 0-100', `fdRate` float DEFAULT '0' COMMENT '答题正确率,0最低,100最好', `fdStatus` tinyint(4) NOT NULL DEFAULT '0' COMMENT '状态 0:未交卷,1:交卷,2:删除记录', `fdType` int(11) DEFAULT '0' COMMENT '试卷类型,当前答题所在位置:0:作业,1:上课', `fdAppID` int(11) DEFAULT '0' COMMENT '应用ID', `fdMethod` tinyint(4) DEFAULT '0' COMMENT '答卷方式0:普通练习 1:阅卷任务', `fdSelf` tinyint(4) DEFAULT '0' COMMENT '是否完成自评 0未完成 1完成', `fdIsSyncMongo` tinyint(4) DEFAULT '0' COMMENT '是否同步到mongo', `fdSyncTime` int(11) DEFAULT '0' COMMENT '同步时间', PRIMARY KEY (`id`), KEY `FK_Reference_41` (`fdExamID`), KEY `fdUserID` (`fdUserID`), KEY `answerexam_syncmongo` (`fdIsSyncMongo`), KEY `ae_synctime` (`fdSyncTime`), KEY `ae_status` (`fdStatus`), KEY `sync-status` (`fdStatus`,`fdSyncTime`), KEY `fdEnd` (`fdEnd`), KEY `appid_syncmongo` (`fdAppID`,`fdIsSyncMongo`) ) ENGINE=MyISAM AUTO_INCREMENT=1562542 DEFAULT CHARSET=utf8 COMMENT='回答试卷'; ``` ## 表 wkwke.tbPasserUserSchedule ``` CREATE TABLE `tbPasserUserSchedule` ( `id` int(11) NOT NULL AUTO_INCREMENT, `fdUserID` int(11) NOT NULL COMMENT '用户ID', `fdTagID` int(11) NOT NULL COMMENT '三级考点ID', `fdScheduleID` int(11) NOT NULL COMMENT '对应到tbPasserSchedule.id', `fdAeid` int(11) NOT NULL COMMENT '通关答卷ID', `fdScheduleType` tinyint(4) DEFAULT '0' COMMENT '学习类型,0:自由学习 1:任务系统', `fdIsFirstPass` tinyint(4) DEFAULT '0' COMMENT '是否为第一次通关', `fdCreate` datetime NOT NULL, `fdUpdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `passusersche_uid` (`fdUserID`) ) ENGINE=MyISAM AUTO_INCREMENT=22798 DEFAULT CHARSET=utf8 COMMENT='用户考点通关进度表'; ``` ## 回答试题表 wkwke.tbAnswerQuestion ``` CREATE TABLE `tbAnswerQuestion` ( `id` int(11) NOT NULL AUTO_INCREMENT, `fdAnswerExamID` int(11) NOT NULL COMMENT '对应答卷ID,对应到tbAnswerExam.id', `fdExerciseID` int(11) NOT NULL COMMENT '题目ID,对应到tbExercise.id', `fdScore` float DEFAULT '0' COMMENT '当前题目得分,如果题目有多道小题,应为多道小题题目得分之和', `fdSelf` float DEFAULT NULL COMMENT '学生自评分', `fdTscore` double DEFAULT NULL COMMENT '教师评分', `fdCreate` datetime NOT NULL, `fdUpdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `fdStatus` tinyint(4) DEFAULT '0' COMMENT '作答状态 0:有做答,1:用户没作答', `fdRight` tinyint(4) DEFAULT '0' COMMENT '题目是否正确,0表示错误,1表示正确', `fdCount` int(11) DEFAULT '0', `fdErrSync` tinyint(4) DEFAULT '0' COMMENT '是否已经同步了正误状态', PRIMARY KEY (`id`), KEY `fdAnswerExamID` (`fdAnswerExamID`), KEY `fdExerciseID` (`fdExerciseID`), KEY `answerquestion_errsync` (`fdErrSync`) ) ENGINE=MyISAM AUTO_INCREMENT=36011035 DEFAULT CHARSET=utf8 COMMENT='回答试题'; ``` ## 回答试卷中的题目 wkwke.tbAnswerExercise ``` CREATE TABLE `tbAnswerExercise` ( `id` int(11) NOT NULL AUTO_INCREMENT, `fdAnswerExamID` int(11) NOT NULL, `fdAnswerQuestionID` int(11) DEFAULT '0' COMMENT '答题ID 对应到tbAnswerQuestion.id', `fdExerciseID` int(11) DEFAULT '0' COMMENT '题目ID', `fdExerciseItemID` int(11) NOT NULL, `fdRight` varchar(255) DEFAULT NULL COMMENT '客观题选项', `fdSelf` double DEFAULT NULL COMMENT '自评总得分', `fdTscore` double DEFAULT NULL COMMENT '教师评分', `fdScore` double NOT NULL DEFAULT '0' COMMENT '本题最终得分', `fdOrder` int(11) DEFAULT NULL, `fdVanalysis` tinyint(4) DEFAULT '0' COMMENT '是否察看答案解析', `fdVweike` tinyint(4) DEFAULT '0' COMMENT '是否查看了解析微课', `fdVidea` tinyint(4) DEFAULT '0' COMMENT '是否查看解析思路', `fdVideaweike` tinyint(4) DEFAULT '0' COMMENT '是否查看解题思路微课', `fdMark` tinyint(4) DEFAULT '0' COMMENT '教师标记标识', `fdTeacherID` int(11) DEFAULT '0' COMMENT '评分教师ID', `fdExaminationRecordID` int(11) DEFAULT '0' COMMENT '考试记录ID', `fdLockTime` int(11) DEFAULT '0' COMMENT '锁定时间', `fdScoreRate` float DEFAULT '0' COMMENT '当前小题得分率', `fdFlag` tinyint(4) DEFAULT '0' COMMENT '跑脚本标识', PRIMARY KEY (`id`), KEY `FK_Reference_40` (`fdExerciseItemID`), KEY `FK_Reference_42` (`fdAnswerExamID`), KEY `fdAnswerQuestionID` (`fdAnswerQuestionID`), KEY `examinationrecordid` (`fdExaminationRecordID`), KEY `answerexercise_exid` (`fdExerciseID`), KEY `fdFlag` (`fdFlag`) ) ENGINE=MyISAM AUTO_INCREMENT=38392684 DEFAULT CHARSET=utf8 COMMENT='回答试卷中的题目'; SELECT COUNT(fdScore) FROM wkwke.tbAnswerExercise WHERE fdAnswerExamID=:id ``` ## 练习题 ``` CREATE TABLE `tbExercise` ( `id` int(11) NOT NULL AUTO_INCREMENT, `fdContentID` int(11) NOT NULL COMMENT '微课标识,对应content.tbContent.id', `fdUserID` int(11) DEFAULT NULL COMMENT '题目上传者', `fdExerciseTypeID` int(11) NOT NULL COMMENT '题目类型,对应tbExerciseType.id\n ', `fdScore` double DEFAULT NULL, `fdText` text COMMENT '题干', `fdAnswer` text COMMENT '题目解析', `fdCreate` datetime NOT NULL COMMENT '记录创建时间', `fdApproverID` int(11) NOT NULL COMMENT '审核人标识,对应tbOperator.id', `fdApprove` datetime DEFAULT NULL COMMENT '审核时间', `fdStatus` int(11) DEFAULT NULL COMMENT '审核状态,0-悬而未决,1-审核通过,2-审核不通过', `fdAlias` mediumint(9) DEFAULT NULL, `fdDraft` mediumint(9) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `FK_Reference_35` (`fdExerciseTypeID`), KEY `fdContentID` (`fdContentID`), KEY `nxExercise_Alias` (`fdAlias`), KEY `nxExercise_Draft` (`fdDraft`), KEY `nxExercise_Status` (`fdStatus`), KEY `exercise-userid` (`fdUserID`) ) ENGINE=MyISAM AUTO_INCREMENT=1443817 DEFAULT CHARSET=utf8 COMMENT='练习题'; ``` ## 试卷 wkwke.tbExam ``` CREATE TABLE `tbExam` ( `id` int(11) NOT NULL AUTO_INCREMENT, `idString` varchar(64) DEFAULT NULL, `fdContentID` int(11) NOT NULL COMMENT '试卷标识,对应content.tbContent.id', `fdUserID` int(11) DEFAULT NULL COMMENT '用户ID', `fdExamTypeID` int(11) NOT NULL COMMENT '试卷类型,对应tbExamType.id\n ', `fdTotal` double NOT NULL COMMENT '试卷总分', `fdGrade` double NOT NULL COMMENT '及格分数线', `fdSpend` int(11) DEFAULT NULL COMMENT '试卷最大多少分钟完成', `fdCreate` datetime NOT NULL COMMENT '记录创建时间', `fdApproverID` int(11) NOT NULL COMMENT '审核人标识,对应tbOperator.id', `fdApprove` datetime DEFAULT NULL COMMENT '审核时间', `fdStatus` int(11) DEFAULT NULL COMMENT '审核状态,0-悬而未决,1-审核通过,2-审核不通过', `fdAlias` int(11) DEFAULT NULL COMMENT '题目题型、仅在题型练习试卷用于记录题型,其他为空', `fdDraft` mediumint(9) NOT NULL COMMENT '0:临时组卷;1:草稿;2:发布试卷;3:学堂考点强化;4学堂题型练习;5:学堂错题复习', `fdIsfix` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否已经修复过分数', PRIMARY KEY (`id`), KEY `FK_Reference_32` (`fdExamTypeID`), KEY `fdContentID` (`fdContentID`), KEY `exam-userid` (`fdUserID`), KEY `fdIsfix` (`fdIsfix`) ) ENGINE=MyISAM AUTO_INCREMENT=129835 DEFAULT CHARSET=utf8 COMMENT='试卷'; ```