view.vue 3.06 KB
<template>
    <el-container class="default-body">
        <el-header>
            <back-box class="detailBack">
                <template slot="title">
                    <span class="default-title">查看课件</span>
                </template>
            </back-box>
        </el-header>
        <div class="default-filter">
            <div class="default-title">
                {{ detail.title }}
            </div>
        </div>
        <el-main>
            <div class="question-box">
                <template v-for="question in detail.questionList">
                    <template v-if="!question.subQuestions">
                        <div class="screenshot-box" v-if="question.screenshot">
                            <iframe @load="adjustIframe" class="screenshot" :src="question.screenshot"></iframe>
                        </div>
                    </template>
                    <template v-else>
                        <div v-for="subQuestions in question.subQuestions">
                            <div class="screenshot-box" v-if="subQuestions.screenshot">
                                <iframe class="screenshot" :src="subQuestions.screenshot"></iframe>
                            </div>
                        </div>
                    </template>
                </template>
            </div>
        </el-main>
    </el-container>
</template>
<script>
export default {
    data() {
        return {
            query: null,
            detail: {}
        }
    },
    async created() {
        this.query = this.$route.query
        await this._loadQuestion();
    },
    mounted() {
        // this.$nextTick(() => {
        //     var screents = document.getElementsByClassName('screenshot');
        //     console.log(screents,screents.length)
        //     for (var isc = 0; isc < screents.length; isc++) {
        //         var currentIsc = screents[isc]

        //         console.log(currentIsc.scrollHeight, currentIsc.clientHeight);
        //         if (currentIsc.scrollHeight > currentIsc.clientHeight) {
        //             console.log(currentIsc.scrollHeight, currentIsc.clientHeight);
        //         }
        //     }
        // }); 
    },
    methods: {
        adjustIframe(){},
        async _loadQuestion() {
            this.$loading.open();
            const { data, status, info } = await this.$request.tPaperDetail({
                paperId: this.query.id
            });
            this.$loading.close();
            if (status != 0) {
                this.$message.error(info);
                return;
            }
            this.detail = data;
        }
    }
}
</script>
<style scoped>
.default-filter {
    margin-bottom: 0px !important;

    .default-title {
        text-align: center;
        height: 80px;
        line-height: 80px;
    }
}

.question-box {
    margin-bottom: 20px;
    padding: 20px;

    .screenshot-box {
        width: 100%;
        border: 1px solid #e2e2e2;
        margin-bottom: 20px;

        .screenshot-img {
            margin: 0;
        }

        .screenshot {
            min-height: 40px;
        }
    }
}
</style>