|
@@ -11,7 +11,12 @@
|
|
|
placeholder="输入题干"
|
|
|
/>
|
|
|
|
|
|
- <RichText v-if="data.property.stem_type === stemTypeList[1].value" v-model="data.stem" placeholder="输入题干" />
|
|
|
+ <RichText
|
|
|
+ v-if="data.property.stem_type === stemTypeList[1].value"
|
|
|
+ v-model="data.stem"
|
|
|
+ :wordlimit-num="5000"
|
|
|
+ placeholder="输入题干"
|
|
|
+ />
|
|
|
|
|
|
<el-input
|
|
|
v-show="isEnable(data.property.is_enable_description)"
|
|
@@ -24,7 +29,25 @@
|
|
|
</div>
|
|
|
|
|
|
<div class="content">
|
|
|
- <RichText v-model="data.article" placeholder="输入文章" />
|
|
|
+ <RichText v-model="data.article" :is-border="true" :height="130" placeholder="输入文章" />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="footer">
|
|
|
+ <span class="add-option" @click="addQuestion">
|
|
|
+ <SvgIcon icon-class="add-circle" size="14" /><span>增加配题</span>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div v-for="(item, i) in data.question_list" :key="i">
|
|
|
+ <SelectQuestionType
|
|
|
+ :question-type-option="questionTypeOption"
|
|
|
+ :is-child="true"
|
|
|
+ :type="exerciseTypeList[item.type]"
|
|
|
+ @updateCurQuestionType="updateCurQuestionType(i, $event)"
|
|
|
+ @deleteQuestion="deleteQuestion(i)"
|
|
|
+ @recognition="recognition(i, $event)"
|
|
|
+ />
|
|
|
+ <component :is="exerciseComponents[item.type]" ref="exercise" :external-data="item" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -78,46 +101,82 @@
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</template>
|
|
|
- <template #footer>
|
|
|
- <div class="footer">
|
|
|
- <span class="add-option" @click="addOption">
|
|
|
- <SvgIcon icon-class="add-circle" size="14" /> <span>增加配题</span>
|
|
|
- </span>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
</QuestionBase>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import QuestionMixin from '../common/QuestionMixin.js';
|
|
|
+import { readData, questionTypeOption, exerciseTypeList } from '@/views/exercise_questions/data/read';
|
|
|
+import { getSelectData } from '@/views/exercise_questions/data/select';
|
|
|
+import { getJudgeData } from '@/views/exercise_questions/data/judge';
|
|
|
+import { getMatchingDataTemplate } from '@/views/exercise_questions/data/matching';
|
|
|
+import { fillData } from '@/views/exercise_questions/data/fill';
|
|
|
+import { curry } from '@/utils';
|
|
|
|
|
|
-import { changeOptionType } from '@/views/exercise_questions/data/common';
|
|
|
-import { readData } from '@/views/exercise_questions/data/read';
|
|
|
+import QuestionMixin from '../common/QuestionMixin.js';
|
|
|
+import SelectQuestionType from '@/views/exercise_questions/create/components/common/SelectQuestionType.vue';
|
|
|
+import SelectQuestion from '@/views/exercise_questions/create/components/exercises/SelectQuestion.vue';
|
|
|
+import JudgeQuestion from '@/views/exercise_questions/create/components/exercises/JudgeQuestion.vue';
|
|
|
+import MatchingQuestion from '@/views/exercise_questions/create/components/exercises/MatchingQuestion.vue';
|
|
|
+import FillQuestion from '@/views/exercise_questions/create/components/exercises/FillQuestion.vue';
|
|
|
|
|
|
export default {
|
|
|
name: 'ReadQuestion',
|
|
|
+ components: {
|
|
|
+ SelectQuestionType,
|
|
|
+ SelectQuestion,
|
|
|
+ JudgeQuestion,
|
|
|
+ MatchingQuestion,
|
|
|
+ FillQuestion,
|
|
|
+ },
|
|
|
mixins: [QuestionMixin],
|
|
|
data() {
|
|
|
return {
|
|
|
- changeOptionType,
|
|
|
+ curry,
|
|
|
+ questionTypeOption,
|
|
|
+ exerciseTypeList,
|
|
|
data: JSON.parse(JSON.stringify(readData)),
|
|
|
+ exerciseComponents: {
|
|
|
+ select: SelectQuestion,
|
|
|
+ judge: JudgeQuestion,
|
|
|
+ matching: MatchingQuestion,
|
|
|
+ fill: FillQuestion,
|
|
|
+ },
|
|
|
+ exerciseData: {
|
|
|
+ select: getSelectData(),
|
|
|
+ judge: getJudgeData(),
|
|
|
+ matching: getMatchingDataTemplate(),
|
|
|
+ fill: fillData,
|
|
|
+ },
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
- addOption() {
|
|
|
- this.data.question_list.push('');
|
|
|
+ addQuestion() {
|
|
|
+ this.data.question_list.push(JSON.parse(JSON.stringify(this.exerciseData['select'])));
|
|
|
+ },
|
|
|
+
|
|
|
+ deleteQuestion(i) {
|
|
|
+ this.data.question_list.splice(i, 1);
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 智能识别
|
|
|
+ * @param {Number} i 题目索引
|
|
|
+ * @param {String} text 识别数据
|
|
|
+ */
|
|
|
+ recognition(i, text) {
|
|
|
+ this.$refs.exercise[i]?.recognition(text);
|
|
|
+ },
|
|
|
+
|
|
|
+ updateCurQuestionType(i, arr) {
|
|
|
+ let type = arr[arr.length - 1];
|
|
|
+ this.$set(this.data.question_list, i, JSON.parse(JSON.stringify(this.exerciseData[type])));
|
|
|
},
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-.footer {
|
|
|
- padding: 5px 16px;
|
|
|
- margin: 16px 0;
|
|
|
- text-align: center;
|
|
|
- cursor: pointer;
|
|
|
- background-color: #fff;
|
|
|
- border-radius: 2px;
|
|
|
+.question-type {
|
|
|
+ margin-top: 16px;
|
|
|
}
|
|
|
</style>
|