123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <!-- eslint-disable vue/no-v-html -->
- <template>
- <div v-if="show_preview" class="essayquestion-preview">
- <div class="stem">
- <span class="question-number" :style="{ fontSize: data.property.stem_question_number_font_size }">
- {{ questionNumberEndIsBracket(data.property.question_number) }}
- </span>
- <span v-html="sanitizeHTML(data.stem)"></span>
- </div>
- <div
- v-if="isEnable(data.property.is_enable_description)"
- class="description rich-text"
- v-html="sanitizeHTML(data.description)"
- ></div>
- <el-input
- v-model="answer.answer_list[0].text"
- rows="12"
- resize="none"
- type="textarea"
- placeholder="请输入"
- :maxlength="1000"
- show-word-limit
- :readonly="disabled"
- @input="handleInput"
- />
- <div v-if="isEnable(data.property.is_enable_reference_answer) && isShowRightAnswer" class="reference-box">
- <h5 class="reference-title">参考答案</h5>
- <span class="reference-answer rich-text" v-html="sanitizeHTML(data.reference_answer)"></span>
- </div>
- </div>
- </template>
- <script>
- import PreviewMixin from './components/PreviewMixin';
- export default {
- name: 'EssayQuestionPreview',
- mixins: [PreviewMixin],
- data() {
- return {
- show_preview: false,
- };
- },
- watch: {
- data: {
- handler(val) {
- if (!val || this.data.type !== 'essay_question') return;
- this.handleData();
- },
- deep: true,
- immediate: true,
- },
- },
- methods: {
- // 初始化数据
- handleData() {
- if (!this.isJudgingRightWrong) {
- let obj = {
- text: '',
- };
- this.answer.answer_list.push(obj);
- }
- this.show_preview = true;
- },
- handleInput(value) {
- if (value.length >= 1000) {
- this.$message.warning(`字数达到1000字!`);
- }
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- @use '@/styles/mixin.scss' as *;
- .essayquestion-preview {
- @include preview;
- :deep .sound-record-wrapper {
- justify-content: center;
- }
- .reference-box {
- padding: 12px;
- background: #f9f8f9;
- .reference-title {
- margin: 0 0 10px;
- font-size: 14px;
- font-weight: 400;
- line-height: 32px;
- color: #4e5969;
- }
- }
- }
- </style>
|