<template>
    <div>
        <!--<sumNumber :cur-number="curNumber"></sumNumber>-->
        <h5>每个上课的人</h5>
        <ul>
            <li v-for="(s,i) in students" v-show="students"
                v-if="students.length > 0">
                {{ s.Name }}

            </li>
        </ul>
        <div>

        </div>
    </div>
</template>

<script>
    import sumNumber from '@/components/sumNumber'
    import
    {
        getHello,
        getClassStat,
        getRecordBreak,
        getNewUser
    } from '@/api/getApiRes'

    import '../libs/rem';
    import '../Global'

    let qs = require('qs');
    export default {
        data() {
            return {
                curNumber: 723519,
                students:[]
            }
        },
        mounted() {
            this.mainTimer = setInterval(() => {
                this.init();
            }, 1000);
        },
        methods: {
            setNumber() {
                this.curNumber = parseInt(Math.random()*1000);
            },
            init() {
                this.GetgetUserList();
            },
            GetgetUserList() {
                let that = this;
                let param = {
                    token: localStorage.token,
                    eqSn: localStorage.eqSn
                };
                let postdata = qs.stringify(param);
                getHello(postdata).then(res => {
                    let json = res;
                    if (json.Code == 0) {
                        that.students = json.Rs;
                        // that.giveClassName(json.Rs);
                    } else {
                        // 已下课
                        if (json.Code == '999') {
                            that.students = ""
                        } else {
                            // 已出错
                            that.$message.error(json.Memo);
                        }
                    }
                })
            },
        },
        components: {
            sumNumber
        }
    }
</script>

<style scoped>

</style>
