AdministratorApe.js 2.4 KB
//*
// 管理员列表
// */

import Loger from "../Loger";
import Ape from "./Ape";
import $ from "jquery";
import ClassDataProxy from "proxy/ClassDataProxy";
import MessageTypes from "../MessageTypes";
import dateUI from 'libs/laydate';
let loger = Loger.getLoger('PC-AdministratorApe');

class AdministratorApe extends Ape {
    constructor() {
        super();
        this.isLocalStorage();
        this.addEvent();
        this.init();
    }

    init() {
        $('#classManagementRight0').show();
        $('#recordUl .recordLi').on('click',this._switchover.bind(this));//课堂分类

        //日历插件
        this._dateUI();
    }

    addEvent() {

    }
    isLocalStorage(){
        //设置当前时间 给输入框默认值
        this._setNewTime();
    }
    _switchover(evt){
        $(evt.currentTarget).addClass('recordLiCheck').siblings().removeClass('recordLiCheck');
        let ind = $(evt.currentTarget).attr('data');
        this._emit(MessageTypes.SWITCH_CLASS,ind);
        if(ind > 1){
            $('.classManagementRight').eq(ind-1).show().siblings().hide();
        }else{
            $('#recordUl .recordLi').eq(0).addClass('recordLiCheck').siblings().removeClass('recordLiCheck');
            $('.classManagementRight').eq(0).show().siblings().hide();
        }
    }
    _dateUI(){
        //执行一个laydate实例
        dateUI.render({
            elem: '.liveInfoCenterLiveStart' //指定元素
        });
        //执行一个laydate实例
        dateUI.render({
            elem: '.liveInfoCenterLiveEnd' //指定元素
        });
        //执行一个laydate实例
        dateUI.render({
            elem: '#createClassStartTime' //指定元素
        });
        //执行一个laydate实例
        dateUI.render({
            elem: '#createClassEndTime' //指定元素
        });
        //执行一个laydate实例
        dateUI.render({
            elem: '#createUserAbortTime' //指定元素
        });
    }
    //设置当前时间 给输入框默认值
    _setNewTime(){
        let newDate = new Date();
        let ysar = newDate.getFullYear();
        let month = newDate.getMonth()+1;//月
        let date = newDate.getDate();//日
        month<10?'0'+month:month;
        date<10?'0'+date:date;
        let time = ysar+'-'+month+'-'+date;
        $('.liveInfoCenterLiveStart').html(time);
        $('.liveInfoCenterLiveEnd').html(time);
        $('#createUserAbortTime').html(time);
    }
}
export default AdministratorApe;