<template>
    <div class="recent-test fsize-m2">
        <div v-if="lists.length>0" class="recent-test-boxs">
            <el-card class="box-card" shadow="hover" v-for="(item,index) in lists" :key="index">
                <div @click="cardClick(item)">
                    <h3>{{item.name}}</h3>
                    <p>{{item.startTime}}至{{item.endTime}}</p>
                    <p>总分：{{item.ksScore}}分</p>
                    <p>时长：{{item.totalTm}}分钟</p>
                    <p class="ks-status color-p" :class="{signUp: item.status !== 1}">{{item.status === 1 ? '考试中...':
                        '报名中...'}}</p>
                    <p class="ks-note">
                        <span>{{item.count}}</span>人正在考试
                    </p>
                </div>
            </el-card>
        </div>
        <div v-else class="recent-test-boxs">
            <el-card class="box-card only" shadow="hover">
                <img src="../../../../assets/images/default/c-exam-img.png" class="examImage">
<!--                <img src="https://saas-mta.oss-cn-beijing.aliyuncs.com/resource/exam-img.png" class="examImage">-->
            </el-card>
        </div>
    </div>
</template>

<script>
    export default {
        name: "recentTest",
        props: {
            busdata: {
                type: Object,
                require: true
            }
        },
        data() {
            return {
                lists: [],
            }
        },
        watch: {
            busdata: {
                handler(newVal, oldVal) {
                    if (newVal.option) {
                        this.lists = newVal.option;
                       /* setTimeout(() => {
                            this.lists = [
                                {
                                    name: '应用工具考核',
                                    startTime: '2018-10-17 18:20',
                                    endTime: '2018-10-20 18:20',
                                    ksScore: 100.0,
                                    totalTime: '120分钟',
                                    status: 1,
                                    count: 10,
                                },
                                {
                                    name: '应用工具考核',
                                    startTime: '2018-10-17 18:20',
                                    endTime: '2018-10-20 18:20',
                                    ksScore: 100.0,
                                    totalTime: '120分钟',
                                    status: 1,
                                    count: 10,
                                },
                                {
                                    name: '应用工具考核',
                                    startTime: '2018-10-17 18:20',
                                    endTime: '2018-10-20 18:20',
                                    ksScore: 100.0,
                                    totalTime: '120分钟',
                                    status: 2,
                                    count: 10,
                                },
                                {
                                    name: '应用工具考核',
                                    startTime: '2018-10-17 18:20',
                                    endTime: '2018-10-20 18:20',
                                    ksScore: 100.0,
                                    totalTime: '120分钟',
                                    status: 2,
                                    count: 10,
                                },]
                        }, 3000)*/
                    }
                },
                deep: true
            }
        },
        methods: {
            cardClick() {
                this.$router.push({path: `/a/kaoshi/jiankong`})
            }


        },
        created() {
            /*setTimeout(() => {
                this.lists = [
                    {
                        ksName: '应用工具考核',
                        startTime: '2018-10-17 18:20',
                        endTime: '2018-10-20 18:20',
                        score: 100.0,
                        totalTime: '120分钟',
                        status: 1
                    },
                    {
                        ksName: '应用工具考核',
                        startTime: '2018-10-17 18:20',
                        endTime: '2018-10-20 18:20',
                        score: 100.0,
                        totalTime: '120分钟',
                        status: 2
                    },
                    {
                        ksName: '应用工具考核',
                        startTime: '2018-10-17 18:20',
                        endTime: '2018-10-20 18:20',
                        score: 100.0,
                        totalTime: '120分钟',
                        status: 1
                    },
                    {
                        ksName: '应用工具考核',
                        startTime: '2018-10-17 18:20',
                        endTime: '2018-10-20 18:20',
                        score: 100.0,
                        totalTime: '120分钟',
                        status: 2
                    },]
            }, 3000000)*/
        }
    }
</script>

<style lang="scss" scoped>

</style>
