|
|
@@ -15,12 +15,23 @@
|
|
|
<script>
|
|
|
import SelectPreview from '@/views/book/courseware/preview/components/select/SelectPreview.vue';
|
|
|
import JudgePreview from '@/views/book/courseware/preview/components/judge/JudgePreview.vue';
|
|
|
+import MatchingPreview from '@/views/book/courseware/preview/components/matching/MatchingPreview.vue';
|
|
|
+import SortPreview from '@/views/book/courseware/preview/components/sort/SortPreview.vue';
|
|
|
+import FillPreview from '@/views/book/courseware/preview/components/fill/FillPreview.vue';
|
|
|
+import RecordInputPreview from '@/views/book/courseware/preview/components/record_input/RecordInputPreview.vue';
|
|
|
+
|
|
|
import { GetCoursewareExerciseView } from '@/api/book';
|
|
|
import { sanitizeHTML } from '@/utils/common';
|
|
|
+
|
|
|
export default {
|
|
|
name: 'ExercisePreview',
|
|
|
- components: { SelectPreview, JudgePreview },
|
|
|
- props: ['exercise_id'],
|
|
|
+ components: { SelectPreview, JudgePreview, MatchingPreview, SortPreview, FillPreview, RecordInputPreview },
|
|
|
+ provide() {
|
|
|
+ return {
|
|
|
+ getPermissionControl: () => this.permissionControl,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ props: ['exercise_id', 'feed_back'],
|
|
|
data() {
|
|
|
return {
|
|
|
sanitizeHTML,
|
|
|
@@ -28,6 +39,13 @@ export default {
|
|
|
title: '',
|
|
|
content: null,
|
|
|
loading: false,
|
|
|
+ permissionControl: {
|
|
|
+ can_answer: true, // 可作答
|
|
|
+ can_judge_correct: false, // 可判断对错(客观题)
|
|
|
+ can_show_answer: false, // 可查看答案
|
|
|
+ can_correct: false, // 可批改
|
|
|
+ can_check_correct: false, // 可查看批改
|
|
|
+ },
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -37,6 +55,14 @@ export default {
|
|
|
return SelectPreview;
|
|
|
case 'judge':
|
|
|
return JudgePreview;
|
|
|
+ case 'sort':
|
|
|
+ return SortPreview;
|
|
|
+ case 'matching':
|
|
|
+ return MatchingPreview;
|
|
|
+ case 'fill':
|
|
|
+ return FillPreview;
|
|
|
+ case 'record_input':
|
|
|
+ return RecordInputPreview;
|
|
|
default:
|
|
|
return null;
|
|
|
}
|
|
|
@@ -57,7 +83,10 @@ export default {
|
|
|
content: this.content,
|
|
|
title: this.title,
|
|
|
};
|
|
|
- this.$emit('submitAdd', this.exercise_id, this.$refs.preview.answer, obj);
|
|
|
+ this.$emit('submitAdd', this.exercise_id, this.$refs.preview.answer, obj, this.permissionControl.can_show_answer);
|
|
|
+ if (!this.permissionControl.can_show_answer && this.feed_back === 'timely') {
|
|
|
+ this.permissionControl.can_show_answer = true;
|
|
|
+ }
|
|
|
},
|
|
|
handleData() {
|
|
|
this.loading = true;
|