diff --git a/src/components/achiStatistics/index.vue b/src/components/achiStatistics/index.vue index 008257d..4613342 100644 --- a/src/components/achiStatistics/index.vue +++ b/src/components/achiStatistics/index.vue @@ -77,7 +77,7 @@ export default { 'userId' ]), ...mapState('achievement', [ - 'id','assessmentId','assessmentName','classId' + 'id','assessmentId','assessmentName','classId','stuId' ]) }, mounted() { @@ -85,7 +85,7 @@ export default { }, methods: { getData() { - this.$post(`${this.api.achievementStatistics}?userId=${this.userId}&assessmentId=${this.assessmentId}&paperId=${this.id}&classId=${this.classId}`) + this.$post(`${this.api.achievementStatistics}?userId=${this.stuId}&assessmentId=${this.assessmentId}&paperId=${this.id}&classId=${this.classId}`) .then(res => { this.info = res.data.list let statData = [] diff --git a/src/components/doReview/index.vue b/src/components/doReview/index.vue index 7cd75be..4002322 100644 --- a/src/components/doReview/index.vue +++ b/src/components/doReview/index.vue @@ -8,7 +8,7 @@
学生得分: - {{(reviewStatus == 2 || reviewStatus == 3) ? total_score : '--'}} + {{(reviewStatus == 2 || reviewStatus == 3) ? this_score : '--'}}
试卷总分: @@ -19,7 +19,7 @@ {{duration}}
- +
查看全部 @@ -30,7 +30,7 @@
{{item.isSub ? '简答题' : '客观题'}}:{{getCorrectingName(item.isCorrecting)}}
-
+

正确答案:

{{item.answer}}

@@ -50,7 +50,7 @@
考试得分:
- 分 +
@@ -71,7 +71,7 @@ export default { return { paperName: '', userName: '', - total_score: '', + this_score: '', duration: '', list: [], look: '1', @@ -82,7 +82,7 @@ export default { 'userId','clientId' ]), ...mapState('assessment', [ - 'reviewId','paperId','isReview','reviewStatus' + 'reviewId','paperId','isReview','reviewStatus','stuId' ]), ...mapGetters('assessment', [ 'getCorrectingName' @@ -98,51 +98,74 @@ export default { }, methods: { getData() { - this.$post(`${this.api.correcting}?assessmentId=${this.reviewId}&userId=${this.userId}&paperId=${this.paperId}`) + this.$post(`${this.api.correcting}?assessmentId=${this.reviewId}&userId=${this.stuId}&paperId=${this.paperId}`) .then(res => { - this.list = res.data.list - this.list.forEach(n => { - n.isCorrecting == 0 && (n.this_score = '') + let list = res.data.list + list.forEach(n => { + n.isCorrecting == 0 && (n.question_score = '') n.isSub = n.typeName == '简答题' + if(n.typeName == '填空题'){ + let answer = [] + for(let i in n){ + if(i.includes('option_')) answer.push(n[i]) + } + n.answer = answer.join('|') + n.user_answer = n.user_answer.replace(/<>/g,'|') + } }) - this.paperName = this.list[0].name - this.userName = this.list[0].userName - this.total_score = this.list[0].total_score - this.duration = this.list[0].duration + this.list = list + this.paperName = list[0].name + this.userName = list[0].userName + this.this_score = list[0].this_score + this.duration = list[0].duration }) .catch(err => {}) }, getWrong(){ - this.$post(`${this.api.getWrong}?assessmentId=${1}&userId=${566}&paperId=${1}`) + this.$post(`${this.api.getWrong}?assessmentId=${this.reviewId}&userId=${this.stuId}&paperId=${this.paperId}`) .then(res => { this.list = res.data.list }) .catch(err => {}) }, save(status) { - let data = [] + let isEmpty = false + let isNotNum = false + let invalid = false + this.list.map(n => { + if(n.question_score === '') isEmpty = true + if(isNaN(n.question_score)) isNotNum = true + if(Number(n.question_score) > Number(n.question_points)) invalid = true + }) if(status){ - let isEmpty = false - let isNotNum = false - this.list.map(n => { - if(n.this_score === '') isEmpty = true - if(isNaN(n.this_score)) isNotNum = true - if(n.isSub){ - data.push({ - detailId: n.detailId, - score: n.this_score - }) - } - }) if(isEmpty) return this.$message.warning('请批阅完所有题目') if(isNotNum) return this.$message.warning('考试得分请输入数字') } - + if(invalid) return this.$message.warning('考试得分不得大于题目分数') + let data = { + review: [], + assessmentId: this.reviewId, + userId: this.stuId, + paperId: this.paperId, + teacherId: this.userId, + } + let totalScore = 0 + this.list.map(n => { + n.question_score !== '' && n.isSub && data.review.push({ + detailId: Number(n.detailId) , + score: Number(n.question_score) + }) + totalScore += Number(n.question_score) + }) + if(!data.review.length) return this.$message.warning('请至少批阅一道题目') + + if(status || this.list.filter(n => n.isSub).length == data.review.length){ + data.totalScore = totalScore + } this.$post(this.api.reviewByid,data).then(res => { this.$message.success(status ? '提交成功' : '保存成功') this.$router.back() - }) - .catch(err => {}) + }).catch(err => {}) }, }, }; diff --git a/src/layouts/header/index.vue b/src/layouts/header/index.vue index 3da0a7f..81c6609 100644 --- a/src/layouts/header/index.vue +++ b/src/layouts/header/index.vue @@ -1,5 +1,5 @@