<template>
    <div class="timePart">
        <div class="lt">
            <h5>ACTIVE RANGE </h5>
            <P>{{ time }}</P>
            <em>step
                <i class="number">
                    {{ step }}
                </i>
                CK
                <i class="number">
                    {{ step }}
                </i>
                CALORIE
                <i class="number">
                    {{ calorie }}
                </i>
                oxygen
                <i class="number">
                    {{ calorie }}
                </i>
            </em>
            <span>{{ percent }}%</span>
            <ul>
                <li>
                    <em>STOP</em>
                    <mu-scale-transition>
                        <i v-show="i == 1"></i>
                    </mu-scale-transition>
                </li>
                <li>
                    <em>SLOW</em>
                    <mu-scale-transition>
                        <i v-show="i == 2"></i>
                    </mu-scale-transition>
                </li>
                <li>
                    <em>NORMAL</em>
                    <mu-scale-transition>
                        <i v-show="i == 3"></i>
                    </mu-scale-transition>
                </li>
                <li>
                    <em>RACING</em>
                    <mu-scale-transition>
                        <i v-show="i == 4"></i>
                    </mu-scale-transition>
                </li>
            </ul>
        </div>
        <div class="rt">
            <div class="top">
                <h5>INTERNAL</h5>
                <mu-scale-transition>
                    <i v-show="type"></i>
                </mu-scale-transition>
            </div>
            <div class="middle">
                <span>MAIN POWER SUPPLE</span>
            </div>
            <div class="bottom">
                <h5>EXTERNAL</h5>
                <mu-scale-transition>
                    <i v-show="!type"></i>
                </mu-scale-transition>
            </div>
        </div>
    </div>
</template>

<script>
    import global from '../Global'
    import '../libs/rem';

    export default {
        data() {
            return {
                i: 1,
                type: true,
                time: '8:88:88',
                step: '4302',
                calorie: '763',
                percent: '00',
            }
        },
        mounted() {
            this.mockDate();
            this.timer = setInterval(() => {
                this.mockDate();
            }, 1000);
        },
        beforeDestroy() {
            clearInterval(this.timer);
        },
        methods: {
            mockDate() {
                this.time = globalcurrentTime();
                this.percent = (Math.random(0, 100) * 100).toFixed(0);
                // this.type = !this.type;
                this.i = parseInt(Math.random(1, 3) * 4 + 1);
            }
        }
    }
</script>

<style scoped>
    @font-face {
        font-family: UnidreamLED;
        src: url('../assets/font/UnidreamLED.ttf');
    }

    ul, li {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    em, s, i {
        font-style: normal;
        text-decoration: none;
    }

    .timePart {
        width: 100%;
        height: 100%;
        overflow: hidden;
        display: block;
        margin: 0 auto;

    }

    .timePart .lt {
        width: 70%;
        overflow: hidden;
        float: left;
    }

    .timePart .rt {
        width: 28%;
        overflow: hidden;
        float: right;
    }

    .timePart .lt h5 {
        width: 100%;
        overflow: hidden;
        display: block;
        margin: 0 auto;
        font-size: 1rem;
        font-weight: normal;
        color: red;
        text-align: left;
    }

    .timePart .lt s {
        font-size: 0.2rem;
    }

    .timePart .lt p {
        width: 100%;
        overflow: hidden;
        display: block;
        margin: 0 auto;
        font-size: 1.4rem;
        color: red;
        text-align: left;
        font-family: UniDreamLED;
        letter-spacing: 3px;
    }

    .timePart .lt > em {
        width: 100%;
        height: 1rem;
        line-height: 1rem;
        overflow: hidden;
        display: block;
        margin: 0 auto;
        font-size: 0.4rem;
        color: red;
        text-align: left;
        letter-spacing: 3px;
        margin-top: 0;
        margin-bottom: 0;
    }

    .timePart .lt em div {
        float: right;
        text-align: right;
    }

    .lt .number {
        font-family: UniDreamLED;
        font-size: 0.45rem;
    }

    .timePart .lt span {
        position: relative;
        top: -4.2rem;
        width: 100%;
        height: 0.01rem;
        overflow: visible;
        display: block;
        margin: 0 auto;
        font-size: 1rem;
        text-align: right;
        font-family: UniDreamLED;
    }

    .timePart .lt ul {
        width: 100%;
        overflow: hidden;
        display: block;
        margin: 0 auto;
        margin-top: 0.2rem;
        color: #fff;
    }

    .timePart .lt ul em {
        color: #fff;
        text-align: center;
    }

    .timePart .lt li {
        width: 23%;
        height: 1.5rem;
        background: red;
        color: #fff;
        text-align: center;
        float: left;
        margin-right: 0.2rem;
        font-size: 0.4rem;
        padding-top: 0.2rem;
        padding-bottom: 0.2rem;
    }

    .timePart .lt li:nth-child(4) {
        margin-right: 0;
    }

    .timePart .lt li i {
        width: 90%;
        overflow: hidden;
        display: block;
        margin: 0 auto;
        margin-top: 0.2rem;
        height: 0.2rem;
        background: #fff;
        color: #fff;
    }

    .rt .top {
        width: 100%;
        height: 2rem;
        overflow: hidden;
        display: block;
        margin: 0 auto;
        background: red;
        color: #fff;
    }

    .rt .top h5 {
        width: 100%;
        height: 2rem;
        line-height: 2rem;
        font-size: 0.7rem;
        margin: 0;
        float: left;
        text-align: left;
        padding-left: 0.2rem;
    }

    .rt .top s {
        float: left;
        font-size: 0.7rem;
        text-align: left;
        padding-left: 1.2rem;
    }

    .rt .top i {
        position: relative;
        top: -1.5rem;
        right: 10px;
        float: right;
        width: 15px;
        height: 1.2rem;
        background: linear-gradient(135deg, #fff 25%, red 0,
        red 50%, #fff 0,
        #fff 75%, red 0);
        background-size: 12px 12px;
    }

    .rt .middle {
        width: 100%;
        overflow: hidden;
        display: block;
        margin: 0 auto;
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
        background: red;
        color: #fff;
        padding-bottom: 3px;
    }

    .middle span {
        width: 100%;
        height: 1.3rem;
        line-height: 1.3rem;
        margin: 0 auto;
        display: block;
        font-size: 0.4rem;
        text-align: left;
        padding-left: 10px;
    }

    .middle s {
        width: 100%;
        overflow: hidden;
        display: block;
        margin: 0 auto;
        font-size: 12px;
    }

    .rt .bottom {
        width: 100%;
        height: 2rem;
        overflow: hidden;
        display: block;
        margin: 0 auto;
        background: red;
        color: #fff;
        padding-top: 3px;
        padding-bottom: 3px;
    }

    .rt .bottom h5 {
        width: 100%;
        height: 2rem;
        line-height: 2rem;
        font-size: 0.7rem;
        margin: 0;
        float: left;
        text-align: left;
        padding-left: 0.2rem;
    }

    .rt .bottom s {
        float: left;
        font-size: 12px;
        text-align: left;
        padding-left: 20px;
    }

    .rt .bottom s {
        font-size: 12px;
    }

    .rt .bottom i {
        position: relative;
        top: -1.6rem;
        right: 10px;
        float: right;
        width: 15px;
        height: 1.2rem;
        background: linear-gradient(135deg, #fff 25%, red 0,
        red 50%, #fff 0,
        #fff 75%, red 0);
        background-size: 12px 12px;
    }
</style>
