考试题

This commit is contained in:
shijingjing
2023-02-14 14:06:46 +08:00
parent d4acc37880
commit a319b5decc
3 changed files with 67 additions and 103 deletions

View File

@@ -51,8 +51,8 @@ export default {
}
},
methods: {
toTest() {
uni.navigateTo({url: "./testForm"})
toTest(id) {
uni.navigateTo({url: "./testForm?id=" + id})
},
toDetail() {
uni.navigateTo({url: "./classDetail"})

View File

@@ -12,7 +12,7 @@
<div class="card_top">
<div class="card_title">{{ item.examinationName }}</div>
<div class="card_count">
<span class="col_blue">{{ item.questions.length }}</span>
<span class="col_blue">{{ item.allSubjectNumber }}</span>
</div>
<div class="card_statistics">
<span>{{ item.passNumber }}</span>人通过/<span>{{ item.examinationNumber }}</span>人参与
@@ -25,7 +25,7 @@
</div>
<div class="grade">{{ item.myRecord.score }}</div>
</div>
<div class="card_bottom col_blue" @click="handleToTest()">参加考试</div>
<div class="card_bottom col_blue" @click="handleToTest(item.id)">参加考试</div>
</div>
</div>
@@ -95,13 +95,13 @@ export default {
}
})
},
handleToTest() {
handleToTest(id) {
// 没有认证
// if('没有认证') {
this.showAuth = true;
// if(!this.user.areaId) {
// this.showAuth = true;
// 已认证
// } else {
// this.$emit('toTest')
this.$emit('toTest',id)
// }
},
comfirm() {

View File

@@ -4,37 +4,50 @@
<div class="testForm_info">
<div class="type">
<div class="type_left">单选题</div>
<div><span class="col_blue">{{ activeIndex + 1 }}</span>/{{questionList.length}}</div>
<div><span class="col_blue">{{ activeIndex + 1 }}</span>/{{ list.length }}</div>
</div>
<div class="topic">
<div v-for="(item,index) in questionList" :key="index" >
<div v-for="(item,index) in list" :key="index" >
<div v-if="activeIndex === index">
<!-- 题目 -->
<div>{{ item.subject }}</div>
<div>{{ item.title }}</div>
<!-- 单选 -->
<div class="answer_list">
<div class="answer_item error">
{{ options[index] }}: {{ item.answer}}
<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">
<div class="answer_item error">
{{ options[index] }}: {{ item.answer}}
<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>
<!-- 判断 -->
<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>
</div>
</div>
</div>
</div>
<div class="type mar-top">
<div class="type mar-top" v-if="showAnalysis">
<div class="type_left">答案解析</div>
</div>
<div class="topic mar-top">
<div class="topic mar-top" v-if="showAnalysis">
<div><span>正确答案</span></div>
<div>获悉党的十八大以来曲靖市深入学习贯彻习近平新时代中国特色社会主义思想坚持以习近平法治思想为根本遵循和行动指南</div>
<div style="margin-top: 8px" v-html="list[activeIndex].analysis"></div>
</div>
<!-- <div class="btn" @click="nextTopic" v-if="activeIndex < questionList.length - 1">下一题</div> -->
<div class="btn" @click="confirm">确定</div>
<div class="btn" v-show="showNext" @click="nextTopic" v-if="activeIndex < list.length - 1">下一题</div>
<div class="btn" v-show="showConfirm" @click="confirm">确定</div>
</div>
</div>
@@ -49,94 +62,35 @@ export default {
background: "url('https://cdn.cunwuyun.cn/qujing/navbar.png') no-repeat",
backgroundSize: '100% 100%',
},
options: ['A','B','C','D','E','F','G','H','I','J','K','L','M'],
questionList: [
{
index: 0,
subject: "共产党成立年份是?",
answer: "答案",
jiexi: '解析'
},
{
index: 1,
subject: "第2题",
answer: "答案",
jiexi: '解析'
},
{
index: 2,
subject: "第3题",
answer: "答案",
jiexi: '解析'
},
{
index: 3,
subject: "第4题",
answer: "答案",
jiexi: '解析'
},
{
index: 4,
subject: "第5题",
answer: "答案",
jiexi: '解析'
}
],
startX: 0, // 滑动开始x轴位置
moveX: 0, // 滑动的x轴距离
list: [],
activeIndex: 0, // 当前第几题
newIndex: 0, // 滑动到第几题
// list: [{
// image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
// title: '昨夜星辰昨夜风,画楼西畔桂堂东'
// },
// {
// image: 'https://cdn.uviewui.com/uview/swiper/2.jpg',
// title: '身无彩凤双飞翼,心有灵犀一点通'
// },
// {
// image: 'https://cdn.uviewui.com/uview/swiper/3.jpg',
// title: '谁念西风独自凉,萧萧黄叶闭疏窗,沉思往事立残阳'
// }
// ],
createdTime: '', // 开始答题时间
endTime: '', // 结束时间
id: '', // 题库id
showConfirm: false,
showNext: false,
clickIndex: '',
showAnalysis: false,
}
},
methods: {
onSwiper() {
console.log(e);
getList(id) {
this.$instance.post(`/app/appexaminationinfo/queryDetailById?id=${id}`).then(res=> {
if(res?.data) {
this.list = res.data.questions
}
})
},
onSlideChange(o) {
console.log(o);
},
getList() {
console.log('题目列表');
itemClick(i) {
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 ++;
},
// touchStart(e) {
// this.startX = e.changedTouches[0].pageX
// console.log('开始触摸:', this.startX);
// },
// touchEnd(e, index) { // 手指离开屏幕时触发
// // 获取滑动距离
// const moveX = e.changedTouches[0].pageX - this.startX
// // 判断滑动方向
// if (moveX < -100 && index < this.topic.length-1) {
// // 【下一题】 判断大幅度左滑且不是最后一题
// this.newIndex=this.newIndex+1
// this.activeIndex= this.activeIndex+1
// console.log('第'+this.index+'题');
// }
// else if (moveX > 100 && index!= 0) {
// // 【上一题】 判断大幅度右滑且不是第一题
// this.newIndex=this.newIndex-1
// this.activeIndex=this.activeIndex-1
// }
// },
confirm() {
uni.navigateTo({url: './result'})
},
@@ -144,7 +98,8 @@ export default {
onReachBottom() {
this.current ++;
},
onLoad() {
onLoad(o) {
this.getList(o.id)
// this.createdTime = Date.parse(new Date())
}
}
@@ -191,6 +146,7 @@ export default {
border-radius: 16px;
padding: 28px 24px;
box-sizing: border-box;
margin-bottom: 24px;
.myChoice {
width: 136px;
@@ -201,14 +157,22 @@ export default {
}
}
.succeed {
.Checked {
border: 2px solid #2D7EFE;
color: #2D7DFF;
background: #EAF2FF;
}
.error {
.Succeed {
border: 2px solid #3BBC37;
color: #3BBC37;
background: #F5FCF5;
}
.Error {
border: 2px solid #E23C3C;
color: #E23C3C;
background: #FDF4F4;
}
}
}