Commit 7dc091c5 by 陈超

A

parent 94a40d9e
<include file="__THEME__/public_header_w3g"/> <include file="__THEME__/public_header_w3g" />
<link rel="stylesheet" type="text/css" href="__APP__/css/public.css">
<link rel="stylesheet" type="text/css" href="__APP__/icon/iconfont.css">
<link rel="stylesheet" type="text/css" href="__APP__/css/public_header_footer_media.css">
<link rel="stylesheet" type="text/css" href="__APP__/css/exam_2.0.css">
<style type="text/css"> <style type="text/css">
/*比较多用到的*/ /*比较多用到的*/
.box { .box {
...@@ -327,236 +322,228 @@ ...@@ -327,236 +322,228 @@
font-size: 1rem; font-size: 1rem;
line-height: 1.875rem; line-height: 1.875rem;
} }
</style> </style>
<div id="app">
<div class="cover"></div> <div class="testPaperTop box">
<div class="min-height-wrap"> <p class="testPaperTop_time flex1">00:09:54</p>
<div class="exam-header"> <span class="testPaperTop_da">答题卡</span>
<div class="testPaperTop box"> <img class="testPaperTop_pau" src="__THEME__/img/pau.png">
<p class="testPaperTop_time flex1"><span id="time_hh">-</span>:<span id="time_mm">-</span>:<span id="time_ss">-</span></p> </div>
<span class="testPaperTop_da">答题卡</span> <div class="testPaperBotm">
<img class="testPaperTop_pau" src="__THEME__/img/pau.png"> <div class="box">
<span class="testPaperNum">{{current}}/{{totalQuestion}}</span>
<p class="testPaperLei flex1">({{currentQuestionTypeName}})</p>
<img v-if="currentQuestion.is_collect == 0" @click="onCollect(1)" class="testPaperColl" src="__THEME__/img/share_unstar.png">
<img v-if="currentQuestion.is_collect == 1" @click="onCollect(0)" class="testPaperColl" src="__THEME__/img/share_star.png">
</div> </div>
</div> <template v-if="showChoiceQuestion">
<div class="answer-card" style="margin-top: 0.75rem;"> <div v-html="currentQuestion.content" class="testPaperInfo"></div>
<php>$question_num = 1;</php> <ul>
<volist name="paper_options.options_type" id="options_type"> <li v-for="(opt, index) in currentOptions" :key="index" class="testPaperAnswer box">
<php> <span @click="onChoose(opt)" class="testPaperAnswer_num" :class="opt.selected ? 'testPaperAnswer_numAt' : ''">{{opt.key}}</span>
if(!$paper_options['options_questions_data'][$options_type['question_type']]){ <div v-html="opt.value" class="testPaperAnswer_desc flex1" style="margin-top: 0.625rem;"></div>
break; </li>
} </ul>
</php> </template>
<dl> </div>
<dt><h6>{$options_type.type_info.question_type_title}</h6></dt> <div v-if="current == 1" class="testPaperBtns boxCn">
<dd> <p @click="onNextQuestion" class="testPaperBtn testPaperBtn1" style="width: 15rem;">下一题</p>
<volist name="paper_options['options_questions_data'][$options_type['question_type']]" id="question"> </div>
<a id="card{$question_num}" <php>if(isset($tempData['content'][$question['exams_question_id']])){ echo "class='on go_question'";}</php> href="javascript:;" data-question_num="{$question_num}" class="go_question">{$question_num}</a> <div v-if="current > 1" class="testPaperBtns box">
<php>$question_num++;</php> <p @click="onPreviousQuestion" class="testPaperBtn">上一题</p>
</volist> <p @click="onNextQuestion" class="testPaperBtn testPaperBtn1">下一题 / 交卷</p>
</dd> </div>
</dl> <!-- 解析 -->
</volist> <div class="testPaperJiedaPage">
<div class="box testPaperJiedaBox">
<div class="btns-complete"> <span @click="expand = !expand" class="testPaperJiedaBtn box">{{expand ? '收起解析' : '查看解析'}}<img class="testPaperJiedaBtn_icon" src="__THEME__/img/openBtn.png"></span>
<a href="javascript:void(0)" style="color:#fff;" class="assignment">交卷</a> </div>
</div> <ul v-if="expand" class="testPaperAnswers">
</div> <li class="testPaperAnswer">正确答案:<span v-for="(answer, index) in currentRightOptions" :key="index" class="testPaperAnswer_n">{{answer}}</span></li>
<input type="hidden" name="reply_time" value="{$paper.reply_time|default='0'}" /> <li class="testPaperAnswer">我的答案:<span v-for="(answer, index) in currentMyOptions" :key="index" :class="answer.right ? 'testPaperAnswer_n' : 'testPaperAnswer_e'">{{answer.key}}</span></li>
<form name="answers" method="POST" action="{:U('exams/Index/doHaddleExams')}"> </ul>
<input type="hidden" name="anser_time" id="anser_time" value="{$tempData.anser_time|default='0'}"> <div v-if="expand" class="testPaperAnswer_infoBox">
<input type="hidden" name="exams_mode" value="{$Think.get.joinType|default=1}"> <p class="testPaperAnswer_infoTitle">解析</p>
<input type="hidden" name="paper_id" value="{$paper.exams_paper_id}"> <div v-html="currentAnalyze" class="testPaperAnswer_info">
<input type="hidden" name="ch_id" value="{$_GET['s_id']}"> </div>
<input type="hidden" name="view_url" value="{$_GET['view']}"> </div>
<input type="hidden" name="is_timeout" value="0"> </div>
<php>if($tempData){</php> <!-- 交卷 -->
<input type="hidden" name="exams_users_id" value="{$tempData.exams_users_id}"> <div class="mask" style="display: none;">
<php>}</php> <div class="popUp">
<input type="hidden" name="paper_options_id" value="{$paper_options.exams_paper_options_id}"> <p class="popUp_title">提示</p>
<div class="static-exam"> <div class="popUp_content">是否交卷并退出考试?</div>
<php>$question_num = 1;</php> <div class="popUp_btns box">
<volist name="paper_options.options_type" id="options_type"> <span class="popUp_btn popUp_btn0 flex1">取消</span>
<switch name="options_type.question_type_key"> <span class="popUp_btn popUp_btn1 flex1">确定</span>
<case value="radio|judge|multiselect"> </div>
<!-- 单选题 --> </div>
<volist name="paper_options['options_questions_data'][$options_type['question_type']]" id="question"> </div>
<dl id="ex{$question_num}" data-type="{$options_type.question_type_key}" data-question_num="{$question_num}"> <!-- 暂停 -->
<dt> <div class="mask" style="display: none;">
<h5><small>{$question_num}</small>/{$paper_options.questions_count}<strong>{$options_type.type_info.question_type_title}</strong></h5> <div class="stopBox">
<h3>{$question.content}</h3> <span class="stopBtn stopBtn_on">继续</span>
</dt> <span class="stopBtn stopBtn_out">退出</span>
<dd> </div>
<php> </div>
if($tempData){
$content = isset($tempData['content'][$question['exams_question_id']]) ? $tempData['content'][$question['exams_question_id']] : []; </div>
}else{
$content = []; <include file="__THEME__/public_footer_w3g" />
}
</php> <script type="text/javascript">
<volist name="question.answer_options" id="answer"> new Vue({
<div class="answer_box"> el: "#app",
<p class="answer_p<php>if(in_array($key,$content)){</php> on<php>}</php>" data-answer="{$key}"><em>{$key}</em>{$answer}</p> data: function() {
</div> return {
</volist> info: {},
<div class="user_answer_hidden"> temp: {},
<input type="hidden" name="user_answer[{$question.exams_question_id}]" value="{:implode(',',$content)}"> current: 1,
</div> paperOptions: {},
</dd> countDown: "00:00:00",
<a href="javascript:;" data-question_num="{$question_num}" class="next next_question">下一题</a> expand: false,
<div class="operation"> //选项
<div class="operation-tit"> currentOptions: []
<eq name="isPractice" value="1"><strong><small>查看解析</small><i class="icon icon-arrowDown"></i></strong></eq> }
<php>if($question['is_collect'] == 1){</php> },
<b data-question_id="{$question.exams_question_id}" data-action="0"> computed: {
<i class="icon icon-shoucang2" style="color:#F7B659;"></i><small>已收藏</small> totalQuestion: function() {
</b> let count = 0
<php>}else{</php> let data = this.paperOptions.options_questions_data
<b data-question_id="{$question.exams_question_id}" data-action="1"> this.paperOptions.options_type.forEach( r => {
<i class="icon icon-area1"></i><span>考点:{$question.exams_point_title}</span> count += data[r.question_type].length
<i class="icon icon-shoucang2"></i><small>收藏习题</small> })
</b> return count
<php>}</php>
</div>
<eq name="isPractice" value="1">
<!--答案解析-->
<div class="analysis">
<div class="analysis-pic">
<h6>正确答案</h6><abbr><volist name="question.answer_true_option" id="answer_true">{$answer_true}</volist></abbr>
</div>
<div class="analysis-txt">
<h6>解析</h6>
<p>{$question.analyze}</p>
</div>
</div>
</eq>
</div>
</dl>
<php>$question_num++;</php>
</volist>
</case>
<case value="completion">
<!-- 填空题 -->
<volist name="paper_options['options_questions_data'][$options_type['question_type']]" id="question">
<dl id="ex{$question_num}" data-type="{$options_type.question_type_key}" data-question_num="{$question_num}">
<dt>
<h5><small>{$question_num}</small>/{$paper_options.questions_count}<strong>{$options_type.type_info.question_type_title}</strong></h5>
<h3>{$question.content}</h3>
</dt>
<dd>
<php>
if($tempData){
$content = isset($tempData['content'][$question['exams_question_id']]) ? $tempData['content'][$question['exams_question_id']] : [];
}else{
$content = [];
}
</php>
<volist name="question.answer_true_option" id="answer">
<label>{$i}、<input type="text" class="anserItem" <php>if($content){</php>value="{$content[$i-1]}"<php>}</php> name="user_answer[{$question.exams_question_id}][]"></label>
</volist>
</dd>
<a href="javascript:;" data-question_num="{$question_num}" class="next next_question">下一题</a>
<div class="operation">
<div class="operation-tit">
<eq name="isPractice" value="1"><strong><small>查看解析</small><i class="icon icon-arrowDown"></i></strong></eq>
<php>if($question['is_collect'] == 1){</php>
<b data-question_id="{$question.exams_question_id}" data-action="0"><i class="icon icon-shoucang2" style="color:#F7B659;"></i><small>已收藏</small></b>
<php>}else{</php>
<b data-question_id="{$question.exams_question_id}" data-action="1">
<i class="icon icon-area1"></i><span>考点:{$question.exams_point_title}</span>
<i class="icon icon-shoucang2"></i><small>收藏习题</small>
</b>
<php>}</php>
</div>
<eq name="isPractice" value="1">
<!--答案解析-->
<div class="analysis">
<div class="analysis-pic">
<h5>正确答案</h5>
<ul>
<volist name="question.answer_true_option" id="answer_true">
<li>{$i}、{$answer_true}</li>
</volist>
</ul>
</div>
<div class="analysis-txt">
<h6>解析</h6>
<p>{$question.analyze}</p>
</div>
</div>
</eq>
</div>
</dl>
<php>$question_num++;</php>
</volist>
</case>
<case value="essays">
<!-- 简述题-->
<volist name="paper_options['options_questions_data'][$options_type['question_type']]" id="question">
<dl id="ex{$question_num}" data-type="{$options_type.question_type_key}" data-question_num="{$question_num}">
<dt>
<h5><small>{$question_num}</small>/{$paper_options.questions_count}<strong>{$options_type.type_info.question_type_title}</strong></h5>
<h3>{$question.content}</h3>
</dt>
<dd>
<php>
if($tempData){
$content = isset($tempData['content'][$question['exams_question_id']]) ? $tempData['content'][$question['exams_question_id']] : [];
}else{
$content = [];
}
</php>
<textarea class="anserItem" name="user_answer[{$question.exams_question_id}]">{$content[0]|default=''}</textarea>
</dd>
<a href="javascript:;" data-question_num="{$question_num}" class="next next_question">下一题</a>
<div class="operation">
<div class="operation-tit">
<eq name="isPractice" value="1"><strong><small>查看解析</small><i class="icon icon-arrowDown"></i></strong></eq>
<php>if($question['is_collect'] == 1){</php>
<b data-question_id="{$question.exams_question_id}" data-action="0"><i class="icon icon-shoucang2" style="color:#F7B659;"></i><small>已收藏</small></b>
<php>}else{</php>
<b data-question_id="{$question.exams_question_id}" data-action="1">
<i class="icon icon-area1"></i><span>考点:{$question.exams_point_title}</span>
<i class="icon icon-shoucang2"></i><small>收藏习题</small>
</b>
<php>}</php>
</div>
<eq name="isPractice" value="1">
<!--答案解析-->
<div class="analysis">
<div class="analysis-txt">
<h6>解析</h6>
<p>{$question.analyze}</p>
</div>
</div>
</eq>
</div>
</dl>
<php>$question_num++;</php>
</volist>
</case>
</switch>
</volist>
</div>
</form>
</div>
<include file="__THEME__/public_footer_w3g"/>
<script src="__APP__/js/public_header_footer_media.js"></script>
<script src="__APP__/js/public_exam_3g.js"></script>
<script type="text/javascript">
if("{$_GET['examsresult']}"){
var re = "{:jiemi($_GET['examsresult'])}",
ve = "{:jiemi($_GET['view'])}";
layer.open({
content:'课时考试',
btn: ['查看结果', '返回课程'],
yes:function(){
window.location.href = re;
}, },
no:function(){ currentTypeIndex: function() {
window.location.href = ve; let count = 0
let data = this.paperOptions.options_questions_data
let current = this.current
for(let i = 0; i < this.paperOptions.options_type.length; i++) {
let r = this.paperOptions.options_type[i]
let next = count + data[r.question_type].length
if(current > count && current <= next) {
return i
} else {
count = next
}
}
},
currentQuestions: function() {
let optionType = this.currentQuestionType
let questionType = optionType.question_type
let questionData = this.paperOptions.options_questions_data
let questions = questionData[questionType]
return questions
},
currentQuestionType: function() {
return this.paperOptions.options_type[this.currentTypeIndex]
},
currentQuestionTypeName: function() {
return this.currentQuestionType.type_info.question_type_title
},
currentQuestionTypeKey: function() {
return this.currentQuestionType.question_type_key
},
currentQuestion: function() {
let count = 0
let data = this.paperOptions.options_questions_data
let current = this.current
for(let i = 0; i < this.paperOptions.options_type.length; i++) {
let r = this.paperOptions.options_type[i]
let next = count + data[r.question_type].length
if(current > count && current <= next) {
return data[r.question_type][current - count - 1]
} else {
count = next
}
}
},
//选择题答案
currentRightOptions: function() {
return this.currentQuestion.answer_true_option
},
//我的答案
currentMyOptions: function() {
let cur = this.currentRightOptions
return this.currentOptions.filter( r => { return r.selected }).map( r => {
console.log(r)
console.log(cur.hx_indexOf( k => { return k == r.key }))
return {
right: cur.hx_indexOf( k => { return k == r.key }) != -1,
key: r.key
}
})
},
//解析
currentAnalyze: function() {
return this.currentQuestion.analyze
},
//Helper
showChoiceQuestion: function() {
let key = this.currentQuestionTypeKey
return key == 'radio' || key == 'multiselect' || key == 'judge'
} }
}); },
created: function() {
} this.info = {:json_encode($paper)};
this.temp = {:json_encode($tempData)};
this.paperOptions = {:json_encode($paper_options)};
for(let k in this.currentQuestion.answer_options) {
let value = this.currentQuestion.answer_options[k]
this.currentOptions.push({
key: k,
value: value,
selected: false
})
}
console.log(this.info)
console.log(this.temp)
console.log(this.paperOptions)
},
methods: {
countDown: function() {
let time = 1
let hours = Math.floor(time / 3600)
let minutes = Math.floor((time % 3600) / 60)
let seconds = Math.round(time % 60)
},
onCollect: function(collect) {
let that = this
$.post(U('exams/Index/collect'), {
action: collect,
source_id: that.currentQuestion.exams_question_id
}, function(res) {
let r = JSON.parse(res)
if(r.status == 1) {
that.currentQuestion.is_collect = collect
}
})
},
onChoose: function(opt) {
if(this.currentQuestionTypeKey == 'radio') {
this.currentOptions.forEach( r => {
r.selected = opt.key == r.key
})
}
},
onNextQuestion: function() {
if(this.current < this.totalQuestion) {
this.current += 1
} else {
ui.confirm("已经是最后一题了,是否交卷?", { // 是否返回第一题
yes: function() {
}
})
}
},
onPreviousQuestion: function() {
if(this.current > 1) {
this.current -= 1
}
}
}
})
</script> </script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment