yujialong 4 years ago
parent 8f814c81fd
commit 2904385193
  1. 1
      src/api/index.js
  2. BIN
      src/assets/img/false.png
  3. BIN
      src/assets/img/true.png
  4. 62
      src/pages/wrongBook/do/index.vue
  5. 155
      src/pages/wrongBook/list/index.vue
  6. 4
      src/store/modules/wrongBook.js

@ -61,6 +61,7 @@ export default {
getMineWrong:`/user/wrong/getMineWrong`, getMineWrong:`/user/wrong/getMineWrong`,
getPaperInfo: `/user/wrong/getPaperInfo`, getPaperInfo: `/user/wrong/getPaperInfo`,
questionInfo: `/user/wrong/questionInfo`, questionInfo: `/user/wrong/questionInfo`,
removes: `/user/wrong/removes`,
// 留言板 // 留言板
delComment:`/management/messageBoard/delComment`, delComment:`/management/messageBoard/delComment`,

Binary file not shown.

After

Width:  |  Height:  |  Size: 709 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 722 B

@ -80,6 +80,24 @@
</template> </template>
</div> </div>
</div> </div>
<el-dialog title="成绩详情" :visible.sync="resultVisible" width="30%" center :close-on-click-modal="false" :show-close="false">
<el-table :data="resultData" border>
<el-table-column type="index" label="序号" width="60" align="center"></el-table-column>
<el-table-column label="正误" min-width="45" align="center">
<template slot-scope="scope">
<img v-if="scope.row.true" width="15" src="../../../assets/img/true.png" alt="">
<img v-else width="15" src="../../../assets/img/false.png" alt="">
</template>
</el-table-column>
<el-table-column prop="answer" label="正确答案" min-width="70" align="center"></el-table-column>
<el-table-column prop="userAnswer" label="你的答案" min-width="70" align="center"></el-table-column>
<el-table-column prop="answerAnalysis" label="解析" min-width="80"></el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="back">返回</el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
@ -111,6 +129,8 @@ export default {
briefAnswerScore: 0, briefAnswerScore: 0,
scoreList: [], scoreList: [],
questionType: ['单选题','多选题','判断题','填空题','简答题'], questionType: ['单选题','多选题','判断题','填空题','简答题'],
resultVisible: false,
resultData: []
}; };
}, },
computed: { computed: {
@ -118,7 +138,7 @@ export default {
'userId','clientId' 'userId','clientId'
]), ]),
...mapState('wrongBook', [ ...mapState('wrongBook', [
'qid' 'qid','type'
]), ]),
}, },
beforeDestroy(){ beforeDestroy(){
@ -186,9 +206,45 @@ export default {
} }
}, },
save(){ save(){
this.$message.success('提交成功') let subjects = this.subjects
this.$router.back() let result = []
subjects.map((e,i) => {
e.map((n,k) => {
let right = true
let val = n.val
let answer = n.answer
if(n.name == '单项选择' || n.name == '判断题'){
if(val != n.answer) right = false
}else if(n.name == '多项选择'){
val = n.val.join('')
if(val != n.answer) right = false
}else if(n.name == '填空题'){
let options = [...document.querySelectorAll(`.stem${i}${k} input`)].map(n => n.value)
let answers = []
for(let i in n.options){
answers.push(n.options[i])
}
answers.map((n,i) => {
if(n != options[i]) right = false
})
val = options.filter(n => n).join()
answer = answers.join()
}
// if(right) this.$post(`${this.api.removes}?qid=${quesInfo.questionId}&userId=${this.userId}&type=${this.type}`).then(res => {}).catch(err => {})
result.push({
true: right,
answer: answer,
userAnswer: val,
answerAnalysis: n.answerAnalysis,
})
})
})
this.resultData = result
this.resultVisible = true
}, },
back(){
this.$router.back()
}
}, },
} }
</script> </script>

@ -65,9 +65,10 @@
<el-table-column prop="courses" label="对应课程" width="140" align="center"></el-table-column> <el-table-column prop="courses" label="对应课程" width="140" align="center"></el-table-column>
<el-table-column prop="knowledgePoints" label="对应知识点" width="140" align="center"></el-table-column> <el-table-column prop="knowledgePoints" label="对应知识点" width="140" align="center"></el-table-column>
<el-table-column prop="wrongNum" label="错题次数" width="100" align="center"></el-table-column> <el-table-column prop="wrongNum" label="错题次数" width="100" align="center"></el-table-column>
<el-table-column label="操作" width="100" align="center"> <el-table-column label="操作" width="140" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="show(scope.row)">查看</el-button> <el-button type="text" @click="show(scope.row)">查看</el-button>
<!-- <el-button type="text" @click="correct(scope.row)" v-if="scope.row.typeId != 4">去纠错</el-button> -->
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -96,16 +97,46 @@
<p v-for="(option,i) in quesInfo.options" :key="i">{{i}}.{{quesInfo.options[i]}}</p> <p v-for="(option,i) in quesInfo.options" :key="i">{{i}}.{{quesInfo.options[i]}}</p>
</div> </div>
</div> </div>
<div class="meta ans"> <!-- <div class="meta ans">
<div class="info"> <div class="info">
<p class="key">正确答案</p> <p class="key">正确答案</p>
<p class="val">{{quesInfo.answer}}</p> <p class="val">{{quesInfo.answer}}</p>
</div> </div>
</div> </div> -->
<div class="meta"> <!-- <div class="meta">
<p class="key">答案解析</p> <p class="key">答案解析</p>
<p class="val" v-html="quesInfo.answerAnalysis"></p> <p class="val" v-html="quesInfo.answerAnalysis"></p>
</div> -->
</div> </div>
</el-dialog>
<el-dialog title="纠错" :visible.sync="correctVisible" width="40%">
<div class="ques">
<div class="name-wrap">
<div class="name" v-html="quesInfo.questionStem"></div>
</div>
<div class="options">
<template v-if="quesInfo.typeId == 1 || quesInfo.typeId == 3">
<div class="option">
<el-radio-group v-model="quesInfo.val">
<el-radio v-for="(option,i) in quesInfo.options" :key="i" :label="i">
{{i}}.{{quesInfo.options[i]}}
</el-radio>
</el-radio-group>
</div>
</template>
<template v-if="quesInfo.typeId == 2">
<el-checkbox-group v-model="quesInfo.val">
<el-checkbox class="option-check" :label="i" v-for="(option,i) in quesInfo.options" :key="i">
{{i}}.{{quesInfo.options[i]}}
</el-checkbox>
</el-checkbox-group>
</template>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button v-throttle @click="correctVisible = false">取消</el-button>
<el-button type="primary" @click="toCorrect" v-throttle>确定</el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
@ -143,7 +174,8 @@ export default {
pageSizeNum: 10, pageSizeNum: 10,
totalNum: 0, totalNum: 0,
detailVisible: false, detailVisible: false,
quesInfo: {} quesInfo: {},
correctVisible: false
}; };
}, },
computed: { computed: {
@ -152,6 +184,7 @@ export default {
]), ]),
}, },
mounted() { mounted() {
console.log(process.env.NODE_ENV)
this.getType() this.getType()
this.getName() this.getName()
}, },
@ -202,8 +235,7 @@ export default {
}, },
show(row){ show(row){
this.detailVisible = true this.detailVisible = true
this.$post(`${this.api.questionInfo}?qid=${row.questionId}`) this.$post(`${this.api.questionInfo}?qid=${row.questionId}`).then(res => {
.then(res => {
let info = res.data.list let info = res.data.list
let options = {} let options = {}
for(let i in info){ for(let i in info){
@ -215,10 +247,67 @@ export default {
this.quesInfo = info this.quesInfo = info
}).catch(err => {}) }).catch(err => {})
}, },
correct(row){
this.correctVisible = true
this.$post(`${this.api.questionInfo}?qid=${row.questionId}`).then(res => {
let info = res.data.list
let options = {}
for(let i in info){
if(i.includes('option') && info[i]){
options[i.replace('option','')] = info[i]
}
}
info.options = options
if(info.typeId == 2){
this.$set(info,'val',[])
}else if(info.typeId == 5){
info.questionStem = info.questionStem.replace(/\(\)\(\)\(\)/g,`<input class="input"></input>`)
}else{
this.$set(info,'val','')
}
this.quesInfo = info
}).catch(err => {})
},
toCorrect(){
let right = true
let quesInfo = this.quesInfo
let type = quesInfo.typeId
if(type == 1 || type == 3){
if(quesInfo.val != quesInfo.answer) right = false
}else if(type == 2){
let val = quesInfo.val.sort().join('')
if(val != quesInfo.answer) right = false
}else if(type == 5){
let options = [...document.querySelectorAll(`.ques input`)].map(n => n.value)
let answers = []
for(let i in quesInfo.options){
answers.push(quesInfo.options[i])
}
answers.map((n,i) => {
if(n != options[i]) right = false
})
}
if(right){
this.$post(`${this.api.removes}?qid=${quesInfo.id}&userId=${this.userId}&type=${this.type}`).then(res => {
this.$message.success('纠错成功')
this.correctVisible = false
this.getData()
}).catch(err => {})
}else{
this.$message.error('回答错误')
this.correctVisible = false
}
},
practice(){ practice(){
let qid = this.listData.map(n => n.questionId).join() if(!this.listData.length) return this.$message.warning('错题列表为空,无法练习')
let qid = []
this.listData.map(n => {
n.typeName != '简答题' && qid.push(n.questionId)
})
if(!qid.length) return this.$message.warning('未查询到客观题,无法练习')
this.setInfo({ this.setInfo({
qid qid: qid.join(),
type: this.type
}) })
this.$router.push('do') this.$router.push('do')
} }
@ -230,7 +319,7 @@ export default {
/deep/.no-mb.el-form-item{ /deep/.no-mb.el-form-item{
margin-bottom: 0; margin-bottom: 0;
} }
.ques{ /deep/.ques{
.key{ .key{
font-weight: bold; font-weight: bold;
color: #333; color: #333;
@ -255,6 +344,23 @@ export default {
margin-right: 30px; margin-right: 30px;
} }
} }
.input{
width: 100px;
height: 28px;
padding: 0 5px;
margin: 0 5px 5px;
color: #444;
background-color: #fff;
border: 1px solid #ebebeb;
box-sizing: border-box;
&:focus{
outline: none;
}
&:disabled{
background-color: #e8e8e8;
cursor: not-allowed;
}
}
.meta{ .meta{
padding-left: 10px; padding-left: 10px;
margin: 20px 0; margin: 20px 0;
@ -273,5 +379,34 @@ export default {
margin-top: 10px; margin-top: 10px;
} }
} }
.options{
margin-top: 10px;
font-size: 14px;
color: #8b8b8b;
.option{
margin: 5px 0;
&.selected{
font-weight: bold;
color: #555;
}
.el-radio-group{
display: flex;
flex-direction: column;
.el-radio{
margin: 3px 0;
}
}
}
.option-check{
display: block;
margin-right: 6px;
}
/deep/.el-radio__label{
padding-left: 6px;
}
.upload{
margin: 20px 0 10px;
}
}
} }
</style> </style>

@ -4,7 +4,8 @@
export default { export default {
namespaced: true, namespaced: true,
state: { state: {
qid: '' qid: '',
type: 1
}, },
getters: { getters: {
@ -12,6 +13,7 @@ export default {
mutations: { mutations: {
SET_INFO: (state, info) => { SET_INFO: (state, info) => {
state.qid = info.qid state.qid = info.qid
state.type = info.type
}, },
}, },
actions: { actions: {

Loading…
Cancel
Save