From c035ffc6cd17acf46eb8bd90fc0578803227ffb0 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期五, 07 六月 2024 15:00:20 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
src/views/Manage/ScoreInquiry/detail.vue | 114 ++++++++++++++++
src/views/Manage/ScoreInquiry/list.vue | 15 +
src/components/exam/QuestionEdit.vue | 83 +++++++++++
src/api/examPaperAnswer.js | 1
src/utils/index.js | 21 +++
src/components/exam/QuestionAnswerShow.vue | 127 ++++++++++++++++++
6 files changed, 356 insertions(+), 5 deletions(-)
diff --git a/src/api/examPaperAnswer.js b/src/api/examPaperAnswer.js
index 4689a0c..d5dad9c 100644
--- a/src/api/examPaperAnswer.js
+++ b/src/api/examPaperAnswer.js
@@ -3,4 +3,5 @@
export default {
page: query => post('/api/admin/examPaperAnswer/page', query),
pageExamPaper: query => post('/api/admin/examPaperAnswer/pageExamPaper', query),
+ read: id => post('/api/admin/examPaperAnswer/read/' + id)
}
diff --git a/src/components/exam/QuestionAnswerShow.vue b/src/components/exam/QuestionAnswerShow.vue
new file mode 100644
index 0000000..da7f677
--- /dev/null
+++ b/src/components/exam/QuestionAnswerShow.vue
@@ -0,0 +1,127 @@
+<template>
+ <div v-loading="qLoading" style="line-height:1.8">
+ <div v-if="qType==1||qType==2||qType==3||qType==4||qType==5">
+ <div v-if="qType==1" >
+ <div class="q-title" v-html="question.title"/>
+ <div class="q-content">
+ <el-radio-group v-model="answer.content">
+ <el-radio v-for="item in question.items" :key="item.prefix" :label="item.prefix" >
+ <span class="question-prefix">{{item.prefix}}.</span>
+ <span v-html="item.content" class="q-item-span-content"></span>
+ </el-radio>
+ </el-radio-group>
+ </div>
+ </div>
+ <div v-else-if="qType==2" >
+ <div class="q-title" v-html="question.title"/>
+ <div class="q-content">
+ <el-checkbox-group v-model="answer.contentArray" >
+ <el-checkbox v-for="item in question.items" :label="item.prefix" :key="item.prefix" >
+ <span class="question-prefix">{{item.prefix}}.</span>
+ <span v-html="item.content" class="q-item-span-content"></span>
+ </el-checkbox>
+ </el-checkbox-group>
+ </div>
+ </div>
+ <div v-else-if="qType==3" >
+ <div class="q-title" v-html="question.title" style="display: inline;margin-right: 10px"/>
+ <span style="padding-right: 10px;">(</span>
+ <el-radio-group v-model="answer.content">
+ <el-radio v-for="item in question.items" :key="item.prefix" :label="item.prefix">
+ <span v-html="item.content" class="q-item-span-content"></span>
+ </el-radio>
+ </el-radio-group>
+ <span style="padding-left: 10px;">)</span>
+ </div>
+ <div v-else-if="qType==4" >
+ <div class="q-title" v-html="question.title"/>
+ <div v-if="answer.contentArray!==null">
+ <el-form-item :label="item.prefix" :key="item.prefix" v-for="item in question.items" label-width="50px" style="margin-top: 10px;margin-bottom: 10px;">
+ <el-input v-model="answer.contentArray[item.prefix-1]" />
+ </el-form-item>
+ </div>
+ </div>
+ <div v-else-if="qType==5">
+ <div class="q-title" v-html="question.title"/>
+ <div>
+ <el-input v-model="answer.content" type="textarea" rows="5" ></el-input>
+ </div>
+ </div>
+ <div class="question-answer-show-item" style="margin-top: 15px">
+ <span class="question-show-item">缁撴灉锛�</span>
+ <el-tag :type="doRightTagFormatter(answer.doRight)">
+ {{ doRightTextFormatter(answer.doRight) }}
+ </el-tag>
+ </div>
+ <div class="question-answer-show-item">
+ <span class="question-show-item">鍒嗘暟锛�</span>
+ <span>{{question.score}}</span>
+ </div>
+ <div class="question-answer-show-item">
+ <span class="question-show-item">闅惧害锛�</span>
+ <el-rate disabled v-model="question.difficult" class="question-show-item"></el-rate>
+ </div>
+ <br/>
+ <div class="question-answer-show-item" style="line-height: 1.8">
+ <span class="question-show-item">瑙f瀽锛�</span>
+ <span v-html="question.analyze" class="q-item-span-content" />
+ </div>
+ <div class="question-answer-show-item">
+ <span class="question-show-item">姝g‘绛旀锛�</span>
+ <span v-if="qType==1||qType==2 ||qType==5" v-html="question.correct" class="q-item-span-content"/>
+ <span v-if="qType==3" v-html="trueFalseFormatter(question)" class="q-item-span-content"/>
+ <span v-if="qType==4">{{question.correctArray}}</span>
+ </div>
+ </div>
+ <div v-else>
+ </div>
+ </div>
+
+</template>
+
+<script>
+import { mapState, mapGetters } from 'vuex'
+export default {
+ name: 'QuestionShow',
+ props: {
+ question: {
+ type: Object,
+ default: function () {
+ return {}
+ }
+ },
+ answer: {
+ type: Object,
+ default: function () {
+ return { id: null, content: '', contentArray: [], doRight: false }
+ }
+ },
+ qLoading: {
+ type: Boolean,
+ default: false
+ },
+ qType: {
+ type: Number,
+ default: 0
+ }
+ },
+ methods: {
+ trueFalseFormatter (question) {
+ return question.items.filter(d => d.prefix === question.correct)[0].content
+ },
+ doRightTagFormatter (status) {
+ return this.enumFormat(this.doRightTag, status)
+ },
+ doRightTextFormatter (status) {
+ return this.enumFormat(this.doRightEnum, status)
+ }
+ },
+ computed: {
+ ...mapGetters('enumItem', ['enumFormat']),
+ ...mapState('enumItem', {
+ doRightEnum: state => state.exam.question.answer.doRightEnum,
+ doRightTag: state => state.exam.question.answer.doRightTag
+ })
+ }
+}
+</script>
diff --git a/src/components/exam/QuestionEdit.vue b/src/components/exam/QuestionEdit.vue
new file mode 100644
index 0000000..7144d56
--- /dev/null
+++ b/src/components/exam/QuestionEdit.vue
@@ -0,0 +1,83 @@
+<template>
+ <div style="line-height:1.8">
+ <div v-if="qType==1" v-loading="qLoading">
+ <div class="q-title" v-html="question.title"/>
+ <div class="q-content">
+ <el-radio-group v-model="answer.content" @change="answer.completed = true" >
+ <el-radio v-for="item in question.items" :key="item.prefix" :label="item.prefix" >
+ <span class="question-prefix">{{item.prefix}}.</span>
+ <span v-html="item.content" class="q-item-span-content"></span>
+ </el-radio>
+ </el-radio-group>
+ </div>
+ </div>
+ <div v-else-if="qType==2" v-loading="qLoading">
+ <div class="q-title" v-html="question.title"/>
+ <div class="q-content">
+ <el-checkbox-group v-model="answer.contentArray" @change="answer.completed = true" >
+ <el-checkbox v-for="item in question.items" :label="item.prefix" :key="item.prefix" >
+ <span class="question-prefix">{{item.prefix}}.</span>
+ <span v-html="item.content" class="q-item-span-content"></span>
+ </el-checkbox>
+ </el-checkbox-group>
+ </div>
+ </div>
+ <div v-else-if="qType==3" v-loading="qLoading">
+ <div class="q-title" v-html="question.title" style="display: inline;margin-right: 10px"/>
+ <span style="padding-right: 10px;">(</span>
+ <el-radio-group v-model="answer.content" @change="answer.completed = true" >
+ <el-radio v-for="item in question.items" :key="item.prefix" :label="item.prefix" >
+ <span v-html="item.content" class="q-item-span-content"></span>
+ </el-radio>
+ </el-radio-group>
+ <span style="padding-left: 10px;">)</span>
+ </div>
+ <div v-else-if="qType==4" v-loading="qLoading">
+ <div class="q-title" v-html="question.title"/>
+ <div>
+ <el-form-item :label="item.prefix" :key="item.prefix" v-for="item in question.items" label-width="50px" style="margin-top: 10px;margin-bottom: 10px;">
+ <el-input v-model="answer.contentArray[item.prefix-1]" @change="answer.completed = true" />
+ </el-form-item>
+ </div>
+ </div>
+ <div v-else-if="qType==5" v-loading="qLoading">
+ <div class="q-title" v-html="question.title"/>
+ <div>
+ <el-input v-model="answer.content" type="textarea" rows="5" @change="answer.completed = true"/>
+ </div>
+ </div>
+ <div v-else>
+ </div>
+ </div>
+
+</template>
+
+<script>
+export default {
+ name: 'QuestionShow',
+ props: {
+ question: {
+ type: Object,
+ default: function () {
+ return {}
+ }
+ },
+ answer: {
+ type: Object,
+ default: function () {
+ return { id: null, content: '', contentArray: [] }
+ }
+ },
+ qLoading: {
+ type: Boolean,
+ default: false
+ },
+ qType: {
+ type: Number,
+ default: 0
+ }
+ },
+ methods: {
+ }
+}
+</script>
diff --git a/src/utils/index.js b/src/utils/index.js
index b46bf3a..88c408d 100644
--- a/src/utils/index.js
+++ b/src/utils/index.js
@@ -351,3 +351,24 @@
ele.className = ele.className.replace(reg, ' ')
}
}
+
+export function formatSeconds (theTime) {
+ let theTime1 = 0
+ let theTime2 = 0
+ if (theTime > 60) {
+ theTime1 = parseInt(theTime / 60)
+ theTime = parseInt(theTime % 60)
+ if (theTime1 > 60) {
+ theTime2 = parseInt(theTime1 / 60)
+ theTime1 = parseInt(theTime1 % 60)
+ }
+ }
+ let result = '' + parseInt(theTime) + '绉�'
+ if (theTime1 > 0) {
+ result = '' + parseInt(theTime1) + '鍒�' + result
+ }
+ if (theTime2 > 0) {
+ result = '' + parseInt(theTime2) + '灏忔椂' + result
+ }
+ return result
+}
\ No newline at end of file
diff --git a/src/views/Manage/ScoreInquiry/detail.vue b/src/views/Manage/ScoreInquiry/detail.vue
index e69de29..9235034 100644
--- a/src/views/Manage/ScoreInquiry/detail.vue
+++ b/src/views/Manage/ScoreInquiry/detail.vue
@@ -0,0 +1,114 @@
+<template>
+ <div style="background-color: #FFFFFF; padding-top: 50px;min-height: 900px;">
+ <el-row class="do-exam-title" style="background-color: #F5F5DC">
+ <el-col :span="24">
+ <span :key="item.itemOrder" v-for="item in answer.answerItems">
+ <el-tag :type="questionDoRightTag(item.doRight)" class="do-exam-title-tag"
+ @click="goAnchor('#question-' + item.itemOrder)">{{ item.itemOrder }}</el-tag>
+ </span>
+ </el-col>
+ </el-row>
+ <el-row class="do-exam-title-hidden">
+ <el-col :span="24">
+ <span :key="item.itemOrder" v-for="item in answer.answerItems">
+ <el-tag class="do-exam-title-tag">{{ item.itemOrder }}</el-tag>
+ </span>
+ </el-col>
+ </el-row>
+ <el-container class="app-item-contain">
+ <el-header class="align-center">
+ <h1>{{ form.name }}</h1>
+ <div>
+ <span class="question-title-padding">璇曞嵎寰楀垎锛歿{ answer.score }}</span>
+ <span class="question-title-padding">璇曞嵎鑰楁椂锛歿{ formatSeconds(answer.doTime) }}</span>
+ </div>
+ </el-header>
+ <el-main>
+ <el-form :model="form" ref="form" v-loading="formLoading" label-width="100px">
+ <el-row :key="index" v-for="(titleItem, index) in form.titleItems">
+ <h3>{{ titleItem.name }}</h3>
+ <el-card class="exampaper-item-box" v-if="titleItem.questionItems.length !== 0">
+ <el-form-item :key="questionItem.itemOrder" :label="questionItem.itemOrder + '.'"
+ v-for="questionItem in titleItem.questionItems" class="exam-question-item"
+ label-width="50px" :id="'question-' + questionItem.itemOrder">
+ <QuestionAnswerShow :qType="questionItem.questionType" :question="questionItem"
+ :answer="answer.answerItems[questionItem.itemOrder - 1]" />
+ </el-form-item>
+ </el-card>
+ </el-row>
+ </el-form>
+ </el-main>
+ </el-container>
+ </div>
+</template>
+
+<script>
+import { mapState, mapGetters } from 'vuex'
+import { formatSeconds } from '@/utils'
+import QuestionAnswerShow from '@/components/exam/QuestionAnswerShow.vue'
+import examPaperAnswerApi from '@/api/examPaperAnswer'
+export default {
+ components: { QuestionAnswerShow },
+ data() {
+ return {
+ form: {},
+ formLoading: false,
+ answer: {
+ id: null,
+ score: 0,
+ doTime: 0,
+ answerItems: [],
+ doRight: false
+ }
+ }
+ },
+ created() {
+ let id = this.$route.query.id
+ let _this = this
+ if (id && parseInt(id) !== 0) {
+ _this.formLoading = true
+ examPaperAnswerApi.read(id).then(re => {
+ _this.form = re.data.paper
+ _this.answer = re.data.answer
+ _this.formLoading = false
+ })
+ }
+ },
+ methods: {
+ formatSeconds(theTime) {
+ return formatSeconds(theTime)
+ },
+ questionDoRightTag(status) {
+ return this.enumFormat(this.doRightTag, status)
+ },
+ goAnchor(selector) {
+ this.$el.querySelector(selector).scrollIntoView({ behavior: 'instant', block: 'center', inline: 'nearest' })
+ }
+ },
+ computed: {
+ ...mapGetters('enumItem', ['enumFormat']),
+ ...mapState('enumItem', {
+ doRightTag: state => state.exam.question.answer.doRightTag
+ })
+ }
+}
+</script>
+
+<style lang="scss" scoped>
+.align-center {
+ text-align: center
+}
+
+.exam-question-item {
+ padding: 10px;
+
+ .el-form-item__label {
+ font-size: 15px !important;
+ }
+}
+
+.question-title-padding {
+ padding-left: 25px;
+ padding-right: 25px;
+}
+</style>
\ No newline at end of file
diff --git a/src/views/Manage/ScoreInquiry/list.vue b/src/views/Manage/ScoreInquiry/list.vue
index 15d4720..21643df 100644
--- a/src/views/Manage/ScoreInquiry/list.vue
+++ b/src/views/Manage/ScoreInquiry/list.vue
@@ -19,20 +19,25 @@
</div>
<!-- 琛ㄦ牸 -->
<el-table v-loading="listLoading" :data="tableData" border fit highlight-current-row style="width: 100%">
- <el-table-column prop="paperName" label="璇曞嵎鍚嶇О" />
- <el-table-column prop="userName" label="鐢ㄦ埛鍚嶇О" />
+ <el-table-column prop="paperName" label="璇曞嵎鍚嶇О" align="center" />
+ <el-table-column prop="userName" label="鐢ㄦ埛鍚嶇О" align="center" />
<el-table-column label="寰楀垎" width="100px">
<template slot-scope="{row}">
{{ row.userScore }} / {{ row.paperScore }}
</template>
</el-table-column>
- <el-table-column label="棰樼洰瀵归敊" width="80px">
+ <el-table-column label="棰樼洰瀵归敊" width="100px" align="center">
<template slot-scope="{row}">
{{ row.questionCorrect }} / {{ row.questionCount }}
</template>
</el-table-column>
- <el-table-column prop="doTime" label="鑰楁椂" width="100px" />
- <el-table-column prop="createTime" label="鎻愪氦鏃堕棿" width="160px" />
+ <el-table-column prop="doTime" label="鑰楁椂" width="80px" align="center" />
+ <el-table-column prop="createTime" label="鎻愪氦鏃堕棿" width="160px" align="center" />
+ <el-table-column label="鎿嶄綔" width="200px" align="center">
+ <template slot-scope="{row}">
+ <el-button size="mini" @click="view(row)">璇︽儏</el-button>
+ </template>
+ </el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParam.pageIndex"
:limit.sync="queryParam.pageSize" @pagination="search" />
--
Gitblit v1.8.0