You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
125 lines
3.1 KiB
125 lines
3.1 KiB
9 months ago
|
<template>
|
||
|
|
||
|
<BaseContainer>
|
||
|
<NavBar title="答题卡" />
|
||
|
<view class="answer-sheet-page">
|
||
|
<view class="header">
|
||
|
<navigator
|
||
|
open-type="redirect"
|
||
|
:url="`/pages/topic/problem_detail?test_id=${test_id}&e_id=${e_id}&index=${index}`"
|
||
|
>返回答题</navigator
|
||
|
>
|
||
|
</view>
|
||
|
<view class="main">
|
||
|
<view class="main-hd">
|
||
|
<view>答题情况</view>
|
||
|
<view class="list">
|
||
|
<view class="item">正确</view>
|
||
|
<view class="item">错误</view>
|
||
|
<view class="item">未答</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
<view v-if="questions.length" class="main-bd">
|
||
|
<navigator
|
||
|
open-type="redirect"
|
||
|
v-for="(item, index) in questions"
|
||
|
:class="{
|
||
|
green: item.is_correct === 2,
|
||
|
red: item.is_correct === 1,
|
||
|
}"
|
||
|
:url="`/pages/topic/problem_detail?test_id=${test_id}&e_id=${e_id}&index=${index}&is_analysis=1`"
|
||
|
>{{ index + 1 }}</navigator
|
||
|
>
|
||
|
</view>
|
||
|
</view>
|
||
|
<view v-if="from !== 'problem_result'" class="footer">
|
||
|
<view class="btn" @click="onAgain(1)">重新答题</view>
|
||
|
<view class="btn" @click="onAgain(2)">提交练习</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
</BaseContainer>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import { getAnswerSheet, submitTestPaper } from "@/api/topic";
|
||
|
export default {
|
||
|
data() {
|
||
|
return {
|
||
|
test_id: 0,
|
||
|
e_id: 0,
|
||
|
index: 0,
|
||
|
questions: [],
|
||
|
from: "",
|
||
|
};
|
||
|
},
|
||
|
onLoad({ test_id, record_id, index = 0, from }) {
|
||
|
this.test_id = test_id;
|
||
|
this.e_id = record_id;
|
||
|
if (index) {
|
||
|
this.index = index;
|
||
|
}
|
||
|
if (from) {
|
||
|
this.from = from;
|
||
|
}
|
||
|
this.getSheet();
|
||
|
},
|
||
|
methods: {
|
||
|
async getSheet() {
|
||
|
try {
|
||
|
const { data: questions } = await getAnswerSheet({
|
||
|
test_id: this.test_id,
|
||
|
type: 1,
|
||
|
record_id: this.e_id,
|
||
|
});
|
||
|
for (let i = questions.length; i--; ) {
|
||
|
if (!Array.isArray(questions[i].userAnswer)) {
|
||
|
Object.assign(questions[i], questions[i].userAnswer);
|
||
|
}
|
||
|
}
|
||
|
this.questions = questions;
|
||
|
} catch (err) {
|
||
|
this.$util.showMsg(err);
|
||
|
uni.redirectTo({
|
||
|
url: "/pages/topic/question_user",
|
||
|
});
|
||
|
}
|
||
|
},
|
||
|
onAgain(n) {
|
||
|
submitTestPaper({
|
||
|
examination_id: this.e_id,
|
||
|
}).then(() => {
|
||
|
this.$util.delCookie("e_id");
|
||
|
if (n == 1) {
|
||
|
uni.redirectTo({
|
||
|
url: "/pages/topic/problem_index?id=" + this.test_id,
|
||
|
});
|
||
|
} else {
|
||
|
uni.redirectTo({
|
||
|
url: "/pages/topic/problem_result?test_id=" + this.test_id,
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
},
|
||
|
},
|
||
|
};
|
||
|
</script>
|
||
|
|
||
|
<style>
|
||
|
page {
|
||
|
background-color: #f5f5f5;
|
||
|
}
|
||
|
</style>
|
||
|
|
||
|
<style scoped lang="scss">
|
||
|
@import "@/static/style/sheet.scss";
|
||
|
.answer-sheet-page .main .main-hd .item:nth-child(1)::before {
|
||
|
border-color: #ebf9eb;
|
||
|
background-color: #ebf9eb;
|
||
|
}
|
||
|
|
||
|
.answer-sheet-page .main .main-hd .item:nth-child(2)::before {
|
||
|
border-color: #fff0e5;
|
||
|
background-color: #fff0e5;
|
||
|
}
|
||
|
</style>
|