diff --git a/src/api/index.js b/src/api/index.js index 765454b..032f13c 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -61,6 +61,7 @@ export default { getMineWrong:`/user/wrong/getMineWrong`, getPaperInfo: `/user/wrong/getPaperInfo`, questionInfo: `/user/wrong/questionInfo`, + removes: `/user/wrong/removes`, // 留言板 delComment:`/management/messageBoard/delComment`, diff --git a/src/assets/img/false.png b/src/assets/img/false.png new file mode 100644 index 0000000..352a207 Binary files /dev/null and b/src/assets/img/false.png differ diff --git a/src/assets/img/true.png b/src/assets/img/true.png new file mode 100644 index 0000000..abd335a Binary files /dev/null and b/src/assets/img/true.png differ diff --git a/src/pages/wrongBook/do/index.vue b/src/pages/wrongBook/do/index.vue index f1d2513..1a58160 100644 --- a/src/pages/wrongBook/do/index.vue +++ b/src/pages/wrongBook/do/index.vue @@ -80,6 +80,24 @@ + + + + + + + + + + + + + diff --git a/src/pages/wrongBook/list/index.vue b/src/pages/wrongBook/list/index.vue index 7d33b23..9d05047 100644 --- a/src/pages/wrongBook/list/index.vue +++ b/src/pages/wrongBook/list/index.vue @@ -65,9 +65,10 @@ - + @@ -96,17 +97,47 @@

{{i}}.{{quesInfo.options[i]}}

-
+ + +
+ + + +
+
+
+
+
+ +
+
@@ -143,7 +174,8 @@ export default { pageSizeNum: 10, totalNum: 0, detailVisible: false, - quesInfo: {} + quesInfo: {}, + correctVisible: false }; }, computed: { @@ -152,6 +184,7 @@ export default { ]), }, mounted() { + console.log(process.env.NODE_ENV) this.getType() this.getName() }, @@ -202,8 +235,21 @@ export default { }, show(row){ this.detailVisible = true - this.$post(`${this.api.questionInfo}?qid=${row.questionId}`) - .then(res => { + 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 + this.quesInfo = info + }).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){ @@ -212,13 +258,56 @@ export default { } } info.options = options + if(info.typeId == 2){ + this.$set(info,'val',[]) + }else if(info.typeId == 5){ + info.questionStem = info.questionStem.replace(/\(\)\(\)\(\)/g,``) + }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(){ - 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({ - qid + qid: qid.join(), + type: this.type }) this.$router.push('do') } @@ -230,7 +319,7 @@ export default { /deep/.no-mb.el-form-item{ margin-bottom: 0; } - .ques{ + /deep/.ques{ .key{ font-weight: bold; color: #333; @@ -255,6 +344,23 @@ export default { 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{ padding-left: 10px; margin: 20px 0; @@ -273,5 +379,34 @@ export default { 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; + } + } } \ No newline at end of file diff --git a/src/store/modules/wrongBook.js b/src/store/modules/wrongBook.js index 2fdfdc8..150d6f6 100644 --- a/src/store/modules/wrongBook.js +++ b/src/store/modules/wrongBook.js @@ -4,7 +4,8 @@ export default { namespaced: true, state: { - qid: '' + qid: '', + type: 1 }, getters: { @@ -12,6 +13,7 @@ export default { mutations: { SET_INFO: (state, info) => { state.qid = info.qid + state.type = info.type }, }, actions: {