123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- <!-- eslint-disable vue/no-v-html -->
- <template>
- <div class="talkpictrue-preview">
- <div class="stem">
- <span class="question-number">{{ data.property.question_number }}.</span>
- <span v-html="sanitizeHTML(data.stem)"></span>
- </div>
- <div v-if="isEnable(data.property.is_enable_description)" class="description">{{ data.description }}</div>
- <div class="content">
- <div class="content-left">
- <el-carousel
- type="card"
- height="276px"
- :autoplay="false"
- indicator-position="none"
- arrow="always"
- @change="changeImg"
- >
- <el-carousel-item v-for="(item, index) in data.option_list" :key="index">
- <el-image
- v-if="pic_list[item.picture_file_id]"
- style="width: 370px; height: 276px"
- :src="pic_list[item.picture_file_id]"
- fit="contain"
- />
- </el-carousel-item>
- </el-carousel>
- <h3 class="pic-title" v-html="sanitizeHTML(data.option_list[active_index].picture_title)"></h3>
- <p class="pic-info" v-html="sanitizeHTML(data.option_list[active_index].picture_info)"></p>
- <template v-if="isEnable(data.property.is_enable_voice_answer)">
- <!-- 语音作答 -->
- <SoundRecordPreview :wav-blob.sync="answer_list[active_index].audio_file_id" />
- </template>
- </div>
- <div class="content-right"></div>
- </div>
- <div v-if="isEnable(data.property.is_enable_reference_answer) && 1 === 2" class="reference-box">
- <h5 class="reference-title">参考答案</h5>
- <span class="reference-answer" v-html="sanitizeHTML(data.option_list[active_index].reference_answer)"></span>
- </div>
- </div>
- </template>
- <script>
- import PreviewMixin from './components/PreviewMixin';
- import { GetFileStoreInfo } from '@/api/app';
- import SoundRecordPreview from './components/common/SoundRecordPreview.vue';
- export default {
- name: 'TalkPictruePreview',
- components: {
- SoundRecordPreview,
- },
- mixins: [PreviewMixin],
- data() {
- return {
- pic_list: {},
- active_index: 0,
- answer_list: [],
- };
- },
- created() {
- this.handleData();
- },
- methods: {
- // 初始化数据
- handleData() {
- this.answer_list = [];
- this.pic_list = {};
- this.active_index = 0;
- this.data.file_id_list.forEach((item) => {
- GetFileStoreInfo({ file_id: item }).then(({ file_id, file_url }) => {
- this.$set(this.pic_list, file_id, file_url);
- });
- });
- this.data.option_list.forEach((item) => {
- let obj = {
- mark: item.mark,
- audio_file_id: '',
- };
- this.answer_list.push(obj);
- });
- },
- changeImg(index) {
- this.active_index = index;
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- @use '@/styles/mixin.scss' as *;
- .talkpictrue-preview {
- @include preview;
- :deep p {
- margin: 0;
- }
- .content {
- display: flex;
- column-gap: 24px;
- &-left {
- flex-shrink: 0;
- width: 478px;
- :deep .el-carousel__item--card {
- width: 77%;
- margin-left: -13.5%;
- }
- .el-image {
- opacity: 0.2;
- }
- :deep .el-carousel__arrow:focus {
- outline: none;
- }
- .el-carousel__item--card.is-active {
- .el-image {
- background: #fff;
- opacity: 1;
- }
- }
- .pic-title {
- margin: 8px 0 4px;
- font-size: 12px;
- font-weight: 600;
- line-height: 20px;
- color: #000;
- word-break: break-word;
- }
- .pic-info {
- margin: 0;
- font-size: 12px;
- font-weight: 400;
- line-height: 20px;
- color: #000;
- word-break: break-word;
- }
- }
- .sound-record-wrapper {
- margin-top: 8px;
- }
- &-right {
- flex: 1;
- .el-textarea {
- height: 276px;
- margin-bottom: 16px;
- }
- }
- }
- .reference-box {
- padding: 12px;
- background: #f9f8f9;
- .reference-title {
- margin: 0 0 10px;
- font-size: 14px;
- font-weight: 400;
- line-height: 32px;
- color: #4e5969;
- }
- }
- }
- </style>
|