123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <template>
- <div class="question-view">
- <question-body :questionBody="question.body" :examQuestionId="examQuestion.id"></question-body>
- <div class="ops">
- <div class="score">({{examQuestion.questionScore}}分)</div>
- </div>
- <div class="option">
- <textarea v-model="studentAnswer" class="stu-answer" @blur="answerQuestion" type="text" />
- </div>
- <div class="reset">
- <i-button type="warning" size="large" @click="() => this.answerQuestion(null)">重置答案</i-button>
- </div>
- </div>
- </template>
- <script>
- import QuestionBody from "./QuestionBody";
- import { createNamespacedHelpers } from "vuex";
- const { mapMutations } = createNamespacedHelpers("examingHomeModule");
- export default {
- name: "TextQuestionView",
- data() {
- return {
- studentAnswer: this.examQuestion.studentAnswer
- };
- },
- props: {
- question: Object,
- examQuestion: Object
- },
- methods: {
- ...mapMutations(["updateExamQuestion"]),
- async answerQuestion(reset) {
- if (reset === null) {
- this.studentAnswer = null;
- }
- const order = this.examQuestion.order;
- const studentAnswer = this.studentAnswer;
- await this.$http.post(
- "/api/ecs_oe_student/examQuestion/submitQuestionAnswer",
- [
- {
- order: order,
- studentAnswer: studentAnswer
- }
- ]
- );
- this.updateExamQuestion({
- order: order,
- studentAnswer: studentAnswer
- });
- }
- },
- watch: {
- examQuestion(cur, prev) {
- this.studentAnswer = this.examQuestion.studentAnswer;
- }
- },
- components: {
- QuestionBody
- }
- };
- </script>
- <style scoped>
- .question-view {
- display: grid;
- grid-row-gap: 10px;
- }
- .question-body {
- font-size: 18px;
- margin-bottom: 10px;
- }
- .ops {
- display: flex;
- align-items: flex-end;
- }
- .stu-answer {
- width: 500px;
- min-height: 300px;
- }
- .option {
- display: flex;
- }
- .question-options {
- text-align: left;
- }
- </style>
|