<template>
    <div style="" class="teacher-preview-container">
        <!--返回顶部-->
        <div class="back-to-top" :title="$t('learnActivity.mgtScEv.returnTop')" v-show="showBack" @click="handleBackToTop">
            <Icon type="ios-arrow-up" />
        </div>
        <vuescroll ref="paper-preview" @handle-scroll="checkBackTop">
            <TestPaper :paper="testPaper" isExamPaper></TestPaper>
        </vuescroll>
    </div>
</template>
<script>
    import TestPaper from '@/view/evaluation/index/TestPaper.vue'
    export default {
        components: {
            TestPaper
        },
        props: {
            testPaper: {
                type: Object,
                default: () => {
                    return {
                        item: []
                    }
                }
            }
        },
        data() {
            return {
                showBack:false
            }
        },
        methods: {
           /**vuescroll回到顶部 */
            handleBackToTop() {
                this.$refs['paper-preview'].scrollTo(
                    {
                        y: '0'
                    },
                    300
                )
            },
            /**
             * 判断是否显示回到顶部按钮
             * @param vertical
             * @param horizontal
             * @param nativeEvent
             */
            checkBackTop(vertical, horizontal, nativeEvent) {
                if (vertical.scrollTop > 100) {
                    this.showBack = true
                } else {
                    this.showBack = false
                }
            },
        },
        watch: {
        },
        mounted() {
        }

    }
</script>
<style lang="less">
    @import "./TeacherPreview.less";
</style>
<style>
    .set-score-table .ivu-input-number, .set-score-table .ivu-input-number-default input {
        text-align: center;
    }
    .teacher-preview-container .paper-main-wrap {
        padding:0px;
        margin-top:0px;
    }
</style>