This commit is contained in:
shijingjing
2023-02-14 17:10:40 +08:00
parent 8cb77ebeee
commit bb744c49b9
4 changed files with 71 additions and 51 deletions

View File

@@ -15,7 +15,7 @@
<div class="comment" @click="showComment = true;getComment()">
<img src="https://cdn.cunwuyun.cn/qujing/message.png" alt="">
<div class="comm_num">
<span>{{ commentList.length || 0}}</span><span v-show="commentList.length > 999">+</span>
<span>{{ data.msgCount || 0}}</span><span v-show="data.msgCount > 999">+</span>
</div>
</div>
</div>
@@ -115,6 +115,7 @@ export default {
this.flag = false
this.showSend = false
this.getComment()
this.getDetail()
}
}).catch(err=> {
this.flag = false
@@ -242,6 +243,8 @@ export default {
.comment_info {
margin-left: 16px;
width: calc(100% - 80px);
.avatar_info {
display: flex;
justify-content: space-between;

View File

@@ -98,8 +98,8 @@ export default {
handleToTest(id) {
// 没有认证
// if(!this.user.areaId) {
// this.showAuth = true;
// 已认证
// this.showAuth = true;
// 已认证
// } else {
this.$emit('toTest',id)
// }
@@ -126,7 +126,7 @@ export default {
this.$u.toast('认证成功')
setTimeout(()=> {
this.showAuth = false
this.$emit('toTest')
this.$emit('toTest',id)
}, 500)
}
}).catch((err)=> {

View File

@@ -1,7 +1,7 @@
<template>
<div class="OnlineClass">
<div class="search_box">
<u-search placeholder="请输入需要搜索的课程" bg-color="#FFF" v-model="title" :show-action="false"></u-search>
<u-search placeholder="请输入需要搜索的课程" bg-color="#FFF" v-model="title" :show-action="false" @search="getList"></u-search>
</div>
<p class="all_class">全部课程</p>

View File

@@ -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>