|
|
@@ -26,11 +26,12 @@
|
|
|
<div>
|
|
|
<span v-if="questionList[curIndex].questionType === 1">【单选题】</span>
|
|
|
<span v-else-if="questionList[curIndex].questionType === 2">【多选题】</span>
|
|
|
- <span v-else-if="questionList[curIndex].questionType === 3">【判断题】</span>
|
|
|
- <span v-else-if="questionList[curIndex].questionType === 4">【简答题】</span>
|
|
|
- <span v-else-if="questionList[curIndex].questionType === 5">【判断题】</span>
|
|
|
+ <span v-else-if="questionList[curIndex].questionType === 3">【不定项选择题】</span>
|
|
|
+ <span v-else-if="questionList[curIndex].questionType === 4">【判断题】</span>
|
|
|
+ <span v-else-if="questionList[curIndex].questionType === 5">【填空题】</span>
|
|
|
<span v-else-if="questionList[curIndex].questionType === 6">【问答题】</span>
|
|
|
- <span v-else>【理解题】</span>
|
|
|
+ <span v-else-if="questionList[curIndex].questionType === 7">【理解题】</span>
|
|
|
+ <span v-else>【综合题】</span>
|
|
|
<br>
|
|
|
<br>
|
|
|
<i class="num">{{ curIndex + 1 }}</i>
|
|
|
@@ -46,9 +47,10 @@
|
|
|
@click="showBigImg(url)"
|
|
|
>
|
|
|
|
|
|
- <!-- 单选和判断的候选答案列表 -->
|
|
|
+ <!-- 单选和判断题候选答案列表 -->
|
|
|
<div
|
|
|
- v-show="questionList[curIndex].questionType === 1 || questionList[curIndex].questionType === 3"
|
|
|
+ v-show="questionList[curIndex].questionType === 1
|
|
|
+ || questionList[curIndex].questionType === 4"
|
|
|
style="margin-top: 25px"
|
|
|
>
|
|
|
<div class="el-radio-group">
|
|
|
@@ -72,7 +74,11 @@
|
|
|
</div>
|
|
|
|
|
|
<!-- 多选和不定项选择题的候选答案列表 -->
|
|
|
- <div v-show="questionList[curIndex].questionType === 2" style="margin-top: 25px">
|
|
|
+ <div
|
|
|
+ v-show="questionList[curIndex].questionType === 2
|
|
|
+ || questionList[curIndex].questionType === 3"
|
|
|
+ style="margin-top: 25px"
|
|
|
+ >
|
|
|
<div class="el-radio-group">
|
|
|
<label
|
|
|
v-for="(item,index) in questionList[curIndex].answer"
|
|
|
@@ -94,8 +100,25 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <!-- 简答题的回答区 -->
|
|
|
- <div v-show="questionList[curIndex].questionType === 4" style="margin-top: 25px">
|
|
|
+ <!-- 填空题和问答题的回答区 -->
|
|
|
+ <div
|
|
|
+ v-show="questionList[curIndex].questionType === 5
|
|
|
+ || questionList[curIndex].questionType === 6"
|
|
|
+ style="margin-top: 25px"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="userAnswer[curIndex]"
|
|
|
+ type="textarea"
|
|
|
+ :rows="8"
|
|
|
+ placeholder="请输入答案"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 综合题的回答区 -->
|
|
|
+ <div
|
|
|
+ v-show="questionList[curIndex].questionType === 8"
|
|
|
+ style="margin-top: 25px"
|
|
|
+ >
|
|
|
<el-input
|
|
|
v-model="userAnswer[curIndex]"
|
|
|
type="textarea"
|
|
|
@@ -163,10 +186,9 @@
|
|
|
>{{ item }}
|
|
|
</el-button>
|
|
|
</div>
|
|
|
-
|
|
|
- <!-- 判断的答题卡 -->
|
|
|
+ <!-- 不定项选择题的答题卡 -->
|
|
|
<div style="margin-top: 25px">
|
|
|
- <p style="font-size: 18px;">判断题</p>
|
|
|
+ <p style="font-size: 18px;">多选题</p>
|
|
|
<el-button
|
|
|
v-for="item in questionList.length"
|
|
|
v-show="questionList[item-1].questionType === 3"
|
|
|
@@ -180,9 +202,9 @@
|
|
|
</el-button>
|
|
|
</div>
|
|
|
|
|
|
- <!-- 简答题的答题卡 -->
|
|
|
+ <!-- 判断题的答题卡 -->
|
|
|
<div style="margin-top: 25px">
|
|
|
- <p style="font-size: 18px;">简答题</p>
|
|
|
+ <p style="font-size: 18px;">判断题</p>
|
|
|
<el-button
|
|
|
v-for="item in questionList.length"
|
|
|
v-show="questionList[item-1].questionType === 4"
|
|
|
@@ -195,6 +217,54 @@
|
|
|
>{{ item }}
|
|
|
</el-button>
|
|
|
</div>
|
|
|
+
|
|
|
+ <!-- 填空题的答题卡 -->
|
|
|
+ <div style="margin-top: 25px">
|
|
|
+ <p style="font-size: 18px;">填空题</p>
|
|
|
+ <el-button
|
|
|
+ v-for="item in questionList.length"
|
|
|
+ v-show="questionList[item-1].questionType === 5"
|
|
|
+ :key="item"
|
|
|
+ style="margin-top: 10px;margin-left: 15px"
|
|
|
+ size="mini"
|
|
|
+ :class="questionList[item-1].questionType === 5 && userAnswer[item-1] !== undefined ?
|
|
|
+ 'done' : userAnswer[item-1] === undefined ? curIndex === (item-1) ? 'orange' : 'noAnswer' : 'noAnswer'"
|
|
|
+ @click="curIndex = item-1"
|
|
|
+ >{{ item }}
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 问答题的答题卡 -->
|
|
|
+ <div style="margin-top: 25px">
|
|
|
+ <p style="font-size: 18px;">问答题</p>
|
|
|
+ <el-button
|
|
|
+ v-for="item in questionList.length"
|
|
|
+ v-show="questionList[item-1].questionType === 6"
|
|
|
+ :key="item"
|
|
|
+ style="margin-top: 10px;margin-left: 15px"
|
|
|
+ size="mini"
|
|
|
+ :class="questionList[item-1].questionType === 6 && userAnswer[item-1] !== undefined ?
|
|
|
+ 'done' : userAnswer[item-1] === undefined ? curIndex === (item-1) ? 'orange' : 'noAnswer' : 'noAnswer'"
|
|
|
+ @click="curIndex = item-1"
|
|
|
+ >{{ item }}
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 综合题的答题卡 -->
|
|
|
+ <div style="margin-top: 25px">
|
|
|
+ <p style="font-size: 18px;">综合题</p>
|
|
|
+ <el-button
|
|
|
+ v-for="item in questionList.length"
|
|
|
+ v-show="questionList[item-1].questionType === 8"
|
|
|
+ :key="item"
|
|
|
+ style="margin-top: 10px;margin-left: 15px"
|
|
|
+ size="mini"
|
|
|
+ :class="questionList[item-1].questionType === 8 && userAnswer[item-1] !== undefined ?
|
|
|
+ 'done' : userAnswer[item-1] === undefined ? curIndex === (item-1) ? 'orange' : 'noAnswer' : 'noAnswer'"
|
|
|
+ @click="curIndex = item-1"
|
|
|
+ >{{ item }}
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
</el-card>
|
|
|
</el-col>
|
|
|
</el-col>
|
|
|
@@ -214,11 +284,10 @@
|
|
|
<img style="width: 100%" :src="bigImgUrl">
|
|
|
</el-dialog>
|
|
|
</el-container>
|
|
|
-
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { submitExamPaper, getExamInfoById, getQuestionByIds } from '@/api/exam'
|
|
|
+import { submitExamPaper, getExamInfoById, getQuestionByPaperId } from '@/api/exam'
|
|
|
|
|
|
export default {
|
|
|
name: 'ExamCard',
|
|
|
@@ -322,7 +391,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- // this.getExamInfo()
|
|
|
+ this.getExamInfo()
|
|
|
// 页面数据加载的等待状态栏
|
|
|
this.loading = this.$loading({
|
|
|
body: true,
|
|
|
@@ -379,8 +448,8 @@ export default {
|
|
|
methods: {
|
|
|
// 查询当前考试的信息
|
|
|
getExamInfo() {
|
|
|
- const examId = this.$route.params
|
|
|
- getExamInfoById(examId).then((resp) => {
|
|
|
+ const paperId = this.$route.params.paperId
|
|
|
+ getExamInfoById(paperId).then((resp) => {
|
|
|
if (resp.code === 0) {
|
|
|
this.examInfo = resp.data
|
|
|
// 设置定时(秒)
|
|
|
@@ -401,15 +470,14 @@ export default {
|
|
|
this.timer = window.setInterval(() => {
|
|
|
if (this.duration > 0) this.duration--
|
|
|
}, 1000)
|
|
|
-
|
|
|
- const questionIds = this.examInfo.questionIds.split(',')
|
|
|
- this.getQuestionInfo(questionIds)
|
|
|
+ var paperId = this.examInfo.examId
|
|
|
+ this.getQuestionInfo1(paperId)
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
// 查询考试的题目信息
|
|
|
- async getQuestionInfo(ids) {
|
|
|
- await getQuestionByIds({ 'ids': ids.join(',') }).then(resp => {
|
|
|
+ async getQuestionInfo1(paperId) {
|
|
|
+ await getQuestionByPaperId(paperId).then(resp => {
|
|
|
if (resp.code === 0) {
|
|
|
this.questionList = resp.data || []
|
|
|
// 重置问题的顺序 单选 多选 判断 简答
|
|
|
@@ -428,6 +496,7 @@ export default {
|
|
|
this.bigImgUrl = url
|
|
|
this.bigImgDialog = true
|
|
|
},
|
|
|
+ // ****************************************************************************************************************
|
|
|
// 检验单选题的用户选择的答案
|
|
|
checkSingleAnswer(index) {
|
|
|
this.$set(this.userAnswer, this.curIndex, index)
|
|
|
@@ -458,6 +527,7 @@ export default {
|
|
|
}).join(',')
|
|
|
}
|
|
|
},
|
|
|
+ // ****************************************************************************************************************
|
|
|
// 调用摄像头
|
|
|
getCamera() {
|
|
|
const constraints = {
|
|
|
@@ -525,14 +595,19 @@ export default {
|
|
|
}
|
|
|
return new File([ia], fileName, { type: mime })
|
|
|
},
|
|
|
+ // ****************************************************************************************************************
|
|
|
// 上传用户考试信息进入后台
|
|
|
async uploadExamToAdmin() {
|
|
|
+ console.log(this.userAnswer)
|
|
|
if (this.cameraOn) await this.takePhoto()// 结束的时候拍照上传一张
|
|
|
// 正则
|
|
|
var reg = new RegExp('-', 'g')
|
|
|
// 去掉用户输入的非法分割符号(-),保证后端接受数据处理不报错
|
|
|
this.userAnswer.forEach((item, index) => {
|
|
|
- if (this.questionList[index].questionType === 4) { // 简答题答案处理
|
|
|
+ // 简答题答案处理
|
|
|
+ if (this.questionList[index].questionType === 5 ||
|
|
|
+ this.questionList[index].questionType === 6 ||
|
|
|
+ this.questionList[index].questionType === 7) {
|
|
|
this.userAnswer[index] = item.replace(reg, ' ')
|
|
|
}
|
|
|
})
|
|
|
@@ -599,8 +674,7 @@ export default {
|
|
|
})
|
|
|
userPayload.userAnswers.split(0, userPayload.userAnswers.length - 1)
|
|
|
}
|
|
|
- userPayload.examId = parseInt(this.$route.params.examId)
|
|
|
-
|
|
|
+ userPayload.examId = parseInt(this.$route.params.paperId)
|
|
|
userPayload.questionIds = userPayload.questionIds.join(',')
|
|
|
userPayload.creditImgUrl = this.takePhotoUrl.join(',')
|
|
|
submitExamPaper(userPayload).then((resp) => {
|