extends /apps/entim/include/layout.pug

block content
    .ukefu-entim-point.ukefu-entim-msgbox(style='cursor: pointer;', onclick='top.closeentim();')
        i.layui-icon 
        - var newmsg = 0
        if recentUserList
            for recentUser in recentUserList
                - newmsg = recentUser.newmsg + newmsg
        span.layui-anim.layer-anim-05.animated#msgbox(data-newmsg='#{newmsg}', style='#{newmsg == 0?"display:none":""};top: 15px;background-color: red;left: 0px;') #{newmsg}
        |  企业聊天
        .putAway#putAway(title='收起', style='width:30px; height: 100%;float: right')
            i.layui-icon 
    style.
        .putAway:hover {
            background: rgba(0, 0, 0, 0.2);
        }

    script.
        var hostname = location.hostname;
        var socket = io.connect(location.protocol + "//" + top.hostname + ":" + top.port + "/im/ent?userid=#{user.id}&orgi=#{user.orgi}");
        socket.on('connect', function () {
        })
        socket.on('message', function (data) {
            $('#msgbox').data("newmsg", $('#msgbox').data("newmsg") + 1).text($('#msgbox').data("newmsg")).show();
        });

        socket.on('disconnect', function () {
        });
        $("#putAway").click(function (e) {
            top.isImIndex = true;
            top.closeentim();
            e.stopPropagation();
        })

