认证
This commit is contained in:
@@ -1,55 +1,58 @@
|
||||
<template>
|
||||
<div class="testForm">
|
||||
<u-navbar title="法治学习" :background="backgroundNavbar"></u-navbar>
|
||||
<div class="testForm_info">
|
||||
<div class="type">
|
||||
<div class="type_left">单选题</div>
|
||||
<div><span class="col_blue">{{ activeIndex + 1 }}</span>/{{ list.length }}</div>
|
||||
</div>
|
||||
<div class="topic">
|
||||
<div v-for="(item,index) in list" :key="index" >
|
||||
<div v-if="activeIndex === index">
|
||||
<!-- 题目 -->
|
||||
<div>{{ item.title }}</div>
|
||||
<!-- 单选 -->
|
||||
<div class="answer_list" v-if="item.type==0">
|
||||
<!-- 'succeed': clickIndex==inx && opt.checked == 1, 'item-error': clickIndex == inx && item.checked == 0 -->
|
||||
<div class="answer_item" v-for="(opt,inx) in item.items" :key="inx"
|
||||
:class="{'Checked': clickIndex == inx}">
|
||||
{{ opt.sort }}: {{ opt.content}}
|
||||
</div>
|
||||
</div>
|
||||
<!-- 多选 -->
|
||||
<div class="answer_list" v-if="item.type==1">
|
||||
<div class="answer_item" v-for="(opt,inx) in item.items" :key="inx"
|
||||
@click="itemClick(inx)">
|
||||
{{ opt.sort }}: {{ opt.content}}
|
||||
</div>
|
||||
</div>
|
||||
<!-- 判断 -->
|
||||
<div class="answer_list" v-if="item.type==2">
|
||||
<div class="answer_item" v-for="(opt,inx) in item.items" :key="inx"
|
||||
:class="{'Checked': clickIndex == inx}"
|
||||
@click="itemClick(inx)">
|
||||
{{ opt.sort }}: {{ opt.content}}
|
||||
<div class="testForm_info" >
|
||||
<div v-for="(item,index) in list" :key="index">
|
||||
<div v-if="activeIndex === index">
|
||||
<div class="type">
|
||||
<div class="type_left">{{ item.type==0? '单选题':item.type==1? '多选题': '判断题' }}</div>
|
||||
<div><span class="col_blue">{{ activeIndex + 1 }}</span>/{{ list.length }}</div>
|
||||
</div>
|
||||
<div class="topic">
|
||||
<div>
|
||||
<div >
|
||||
<!-- 题目 -->
|
||||
<div>{{ item.title }}</div>
|
||||
<!-- 单选 -->
|
||||
<div class="answer_list" v-if="item.type==0">
|
||||
<!-- 'succeed': clickIndex==inx && opt.checked == 1, 'item-error': clickIndex == inx && item.checked == 0 -->
|
||||
<div class="answer_item" v-for="(opt,inx) in item.items" :key="inx"
|
||||
:class="{'Checked': clickIndex == inx}">
|
||||
{{ opt.sort }}: {{ opt.content}}
|
||||
</div>
|
||||
</div>
|
||||
<!-- 多选 -->
|
||||
<div class="answer_list" v-if="item.type==1">
|
||||
<div class="answer_item" v-for="(opt,inx) in item.items" :key="inx"
|
||||
@click="itemClick(inx)">
|
||||
{{ opt.sort }}: {{ opt.content}}
|
||||
</div>
|
||||
</div>
|
||||
<!-- 判断 -->
|
||||
<div class="answer_list" v-if="item.type==2">
|
||||
<div class="answer_item" v-for="(opt,inx) in item.items" :key="inx"
|
||||
:class="{'Checked': clickIndex == inx, 'Succeed': showAnalysis && opt.checked == 1, 'Error': showAnalysis && clickIndex == inx && opt.checked == 0}"
|
||||
@click="itemClick(inx)">
|
||||
{{ opt.sort }}: {{ opt.content}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="type mar-top" v-if="showAnalysis">
|
||||
<div class="type_left">答案解析</div>
|
||||
</div>
|
||||
<div class="topic mar-top" v-if="showAnalysis">
|
||||
<div><span>正确答案:</span></div>
|
||||
<div style="margin-top: 8px" v-html="list[activeIndex].analysis"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="type mar-top" v-if="showAnalysis">
|
||||
<div class="type_left">答案解析</div>
|
||||
</div>
|
||||
<div class="topic mar-top" v-if="showAnalysis">
|
||||
<div><span>正确答案:</span></div>
|
||||
<div style="margin-top: 8px" v-html="list[activeIndex].analysis"></div>
|
||||
</div>
|
||||
|
||||
<div class="btn" v-show="showNext" @click="nextTopic" v-if="activeIndex < list.length - 1">下一题</div>
|
||||
<div class="btn" @click="nextTopic" v-if="activeIndex < list.length - 1 && showNext">下一题</div>
|
||||
<div class="btn" v-show="showConfirm" @click="confirm">确定</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -64,13 +67,13 @@ export default {
|
||||
},
|
||||
list: [],
|
||||
activeIndex: 0, // 当前第几题
|
||||
createdTime: '', // 开始答题时间
|
||||
endTime: '', // 结束时间
|
||||
id: '', // 题库id
|
||||
showConfirm: false,
|
||||
showNext: false,
|
||||
clickIndex: '',
|
||||
showAnalysis: false,
|
||||
subjectConfigs: [],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -78,21 +81,36 @@ export default {
|
||||
this.$instance.post(`/app/appexaminationinfo/queryDetailById?id=${id}`).then(res=> {
|
||||
if(res?.data) {
|
||||
this.list = res.data.questions
|
||||
this.subjectConfigs = res.data.subjectConfigs
|
||||
}
|
||||
})
|
||||
},
|
||||
itemClick(i) {
|
||||
if(this.list[this.activeIndex].type==2) { // 判断
|
||||
if (this.showAnalysis) return
|
||||
|
||||
if(this.list[this.activeIndex].type==0) { // 单选
|
||||
|
||||
} else if(this.list[this.activeIndex].type==1) { // 多选
|
||||
|
||||
} else if(this.list[this.activeIndex].type==2) { // 判断
|
||||
this.clickIndex = i
|
||||
this.showConfirm = true
|
||||
// this.list[this.activeIndex].items.myAnswer = this.list[this.activeIndex].i
|
||||
}
|
||||
},
|
||||
nextTopic() {
|
||||
this.activeIndex ++;
|
||||
this.clickIndex = ''
|
||||
this.showAnalysis = false
|
||||
},
|
||||
confirm() {
|
||||
uni.navigateTo({url: './result'})
|
||||
|
||||
this.showAnalysis = true;
|
||||
if(this.activeIndex < this.list.length - 1) {
|
||||
this.showNext = true;
|
||||
this.showConfirm = false;
|
||||
} else {
|
||||
uni.navigateTo({url: './result'})
|
||||
}
|
||||
},
|
||||
},
|
||||
onReachBottom() {
|
||||
@@ -100,7 +118,6 @@ export default {
|
||||
},
|
||||
onLoad(o) {
|
||||
this.getList(o.id)
|
||||
// this.createdTime = Date.parse(new Date())
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user