|
@@ -10,7 +10,7 @@
|
|
<div class="option">
|
|
<div class="option">
|
|
<!-- <textarea v-model="studentAnswer" maxlength="5000" type="text" /> -->
|
|
<!-- <textarea v-model="studentAnswer" maxlength="5000" type="text" /> -->
|
|
|
|
|
|
- <div>
|
|
|
|
|
|
+ <div v-if="examQuestion.answerType !== 'SINGLE_AUDIO'">
|
|
<div class="menu">
|
|
<div class="menu">
|
|
<i-button type="info" class="text-ops" size="small" @click="textCopy">
|
|
<i-button type="info" class="text-ops" size="small" @click="textCopy">
|
|
复制
|
|
复制
|
|
@@ -62,6 +62,20 @@
|
|
class="stu-answer"
|
|
class="stu-answer"
|
|
></div>
|
|
></div>
|
|
</div>
|
|
</div>
|
|
|
|
+ <div v-else>
|
|
|
|
+ <div v-if="!this.examQuestion.studentAnswer">
|
|
|
|
+ <div v-if="qrValue && !this.examQuestion.studentAnswer">
|
|
|
|
+ <qrcode :value="qrValue" :options="{ width: 200 }"></qrcode>
|
|
|
|
+ <div>请使用微信扫码二维码后,在微信小程序上录音,并上传录音</div>
|
|
|
|
+ <div v-if="qrScanned">已扫描 <Icon type="md-checkmark" /></div>
|
|
|
|
+ </div>
|
|
|
|
+ <div v-else>正在获取二维码...</div>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <div v-else>
|
|
|
|
+ <audio controls :src="this.examQuestion.studentAnswer" />
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
<div class="reset" style="padding-top: 20px">
|
|
<div class="reset" style="padding-top: 20px">
|
|
<i-button type="warning" size="large" @click="studentAnswer = null">
|
|
<i-button type="warning" size="large" @click="studentAnswer = null">
|
|
重置答案
|
|
重置答案
|
|
@@ -86,23 +100,30 @@
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import QuestionBody from "./QuestionBody";
|
|
import QuestionBody from "./QuestionBody";
|
|
|
|
+import { getQRCode } from "./ws.js";
|
|
import { createNamespacedHelpers } from "vuex";
|
|
import { createNamespacedHelpers } from "vuex";
|
|
-const { mapMutations, mapGetters } = createNamespacedHelpers(
|
|
|
|
|
|
+const { mapMutations, mapGetters, mapState } = createNamespacedHelpers(
|
|
"examingHomeModule"
|
|
"examingHomeModule"
|
|
);
|
|
);
|
|
|
|
+import VueQrcode from "@chenfengyuan/vue-qrcode";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "TextQuestionView",
|
|
name: "TextQuestionView",
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
studentAnswer: this.examQuestion.studentAnswer,
|
|
studentAnswer: this.examQuestion.studentAnswer,
|
|
- isShowAnswer: false
|
|
|
|
|
|
+ isShowAnswer: false,
|
|
|
|
+ qrValue: "",
|
|
|
|
+ qrScanned: false
|
|
};
|
|
};
|
|
},
|
|
},
|
|
props: {
|
|
props: {
|
|
question: Object,
|
|
question: Object,
|
|
examQuestion: Object
|
|
examQuestion: Object
|
|
},
|
|
},
|
|
|
|
+ created() {
|
|
|
|
+ this.fetchQRCode();
|
|
|
|
+ },
|
|
methods: {
|
|
methods: {
|
|
...mapMutations(["updateExamQuestion"]),
|
|
...mapMutations(["updateExamQuestion"]),
|
|
...mapGetters(["examShouldShowAnswer"]),
|
|
...mapGetters(["examShouldShowAnswer"]),
|
|
@@ -158,6 +179,11 @@ export default {
|
|
},
|
|
},
|
|
showAnswer() {
|
|
showAnswer() {
|
|
this.isShowAnswer = !this.isShowAnswer;
|
|
this.isShowAnswer = !this.isShowAnswer;
|
|
|
|
+ },
|
|
|
|
+ fetchQRCode() {
|
|
|
|
+ if (this.examQuestion.answerType === "SINGLE_AUDIO") {
|
|
|
|
+ getQRCode(this.examQuestion.questionId);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
@@ -165,6 +191,51 @@ export default {
|
|
// console.log(this.examQuestion.studentAnswer);
|
|
// console.log(this.examQuestion.studentAnswer);
|
|
this.studentAnswer = this.examQuestion.studentAnswer;
|
|
this.studentAnswer = this.examQuestion.studentAnswer;
|
|
},
|
|
},
|
|
|
|
+ questionQrCode(value) {
|
|
|
|
+ // console.log(this.examQuestion.studentAnswer);
|
|
|
|
+ // console.log("watch", value);
|
|
|
|
+ if (value.questionId === this.examQuestion.questionId) {
|
|
|
|
+ this.qrValue = value.qrCode;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ questionQrCodeScanned(value) {
|
|
|
|
+ // console.log(this.examQuestion.studentAnswer);
|
|
|
|
+ // console.log("watch", value);
|
|
|
|
+ if (value.questionId === this.examQuestion.questionId) {
|
|
|
|
+ this.qrScanned = true;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ questionAudioFileUrl(value) {
|
|
|
|
+ // console.log(this.examQuestion.studentAnswer);
|
|
|
|
+ // console.log("watch", value);
|
|
|
|
+ const examRecordDataId = this.$route.params.examRecordDataId;
|
|
|
|
+ const that = this;
|
|
|
|
+ for (const q of value) {
|
|
|
|
+ if (q.questionId === this.examQuestion.questionId) {
|
|
|
|
+ this.$http
|
|
|
|
+ .post(
|
|
|
|
+ "/api/ecs_oe_student/examControl/confirmAudioUploadSaveStatus",
|
|
|
|
+ {
|
|
|
|
+ examRecordDataId,
|
|
|
|
+ filePath: q.audioFileUrl,
|
|
|
|
+ questionId: this.examQuestion.questionId
|
|
|
|
+ }
|
|
|
|
+ )
|
|
|
|
+ .then(() => {
|
|
|
|
+ that.updateExamQuestion({
|
|
|
|
+ order: that.examQuestion.order,
|
|
|
|
+ studentAnswer: q.audioFileUrl
|
|
|
|
+ });
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {
|
|
|
|
+ this.$Message.error({
|
|
|
|
+ content: "更新音频题答案失败!",
|
|
|
|
+ duration: 10
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
studentAnswer() {
|
|
studentAnswer() {
|
|
let realAnswer = null;
|
|
let realAnswer = null;
|
|
if (this.studentAnswer) {
|
|
if (this.studentAnswer) {
|
|
@@ -187,6 +258,11 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
|
|
+ ...mapState([
|
|
|
|
+ "questionQrCode",
|
|
|
|
+ "questionQrCodeScanned",
|
|
|
|
+ "questionAudioFileUrl"
|
|
|
|
+ ]),
|
|
isSyncState() {
|
|
isSyncState() {
|
|
return this.examQuestion.order == this.$route.params.order;
|
|
return this.examQuestion.order == this.$route.params.order;
|
|
},
|
|
},
|
|
@@ -195,7 +271,8 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
components: {
|
|
components: {
|
|
- QuestionBody
|
|
|
|
|
|
+ QuestionBody,
|
|
|
|
+ qrcode: VueQrcode
|
|
}
|
|
}
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|