<html>
    <head>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="chrome=1,IE=Edge">
    <link rel="shortcut icon" type="image/x-icon" href="/500vip/statics/images/favicon.ico" media="screen">
    <meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0,user-scalable=yes">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="format-detection" content="telephone=no">
    <script src="/Public/Home/js/jquery-1.11.3.js"></script>
    <script src="/Public/js/vue.min.js"></script>
    <script src="/Public/js/commons.js"></script>
    <script src="/Public/Home/js/checkagent.js"></script>
    <script src="/Public/js/layer/layer.js"></script>
    <script src="/Public/js/laypage/laypage.js"></script>
    <title>代理</title>
    <link rel="stylesheet" href="/Public/Agent/Home/css/agent.css">
</head>
<body>
{literal}
<header class="headsy">
    <div class="contens_y clearfix">
        <ul class="headNavigation">
            <li><a href="/home-index/index"><img src="/Public/Home/img/xinlogo.png" alt=""></a></li>
            <li><a href="/home-agent/index">代理首页</a></li>
            <li v-if="user"><a href="/home-agent/Child">客户管理</a></li>
            <li v-if="user"><a href="/home-agent/Extension">推广中心</a></li>
            <li v-if="user"><a href="/Home-Gamecenter/Index">游戏中心</a></li>
            <li v-if="user"><a href="/Home-Account/Index">会员中心</a></li>
        </ul>

        <div class="agenpictrue clearfix">
            <div class="msg_y">
                <!-- <a href="">
                        <span class="massg">
                            <img src="/Public/Agent/Home/img/短信.png" alt="">
                        </span>
                    消息
                </a> -->
                <!-- <a style="display: block;width: auto;cursor: pointer;" class="goout" href="javascript:AgentLogout();" onclick="">退出</a> -->
            </div>
            <div class="agentphoto">
                <div class="pic_y">
                    <img src="" alt="">
                    <img class="dengji" src="/Public/Agent/Home/img/t.png" alt="">
                </div>
                <div class="picname_y">
                    <span v-text="agent.agent_user"></span>&nbsp;&nbsp;
                    <span>余额：<span id="copycash" v-text="agent.money_total"></span>元</span><br>
                    <span>等级：<span v-text="agent.grade"></span></span>&nbsp;&nbsp;&nbsp;
                    <span onclick="logout()">退出</span>
                </div>

               <!--  <span class="icon_y"> money_y
                        ﹀
                    </span> -->
                <!--用户详情-->
                <!--<div class="userdetails">
                    <p>会员等级：<span v-text="user.grade"></span></p>
                    <p>账户余额：<span class="money_y" v-text="user.money_total"></span>元</p>
                    <p class="goout"  onclick="AgentLogout()">退出</p>
                </div>-->
            </div>

        </div>
    </div>
</header>
{/literal}

{literal}
<script>
    $(function () {
        $('.picname_y').on('click',function () {
            $(".userdetails").toggle();
        });
        apiAgentAjax('/api-agent/GetAgent',{},function(data) {
            header.agent=data.data;
            console.log(header.agent);
        });
//        initAgent(data);
//        apiAgentAjax('/api-agent/GetAgent',{},function(data) {
//            console.log(1234);
//            console.log(data);
//            if(data.status<0){
//                layer.open({
//                    title: '系统提示',//设置弹框标题
//                    skin: 'postion',
//                    area: ['300px', '200px'],//设置弹框大小
//                    shadeClose: true, //点击遮罩关闭
//                    content: data.msg,
//                    btn: ['确定'],
//                    yes: function () {
//                        window.location.href='/Home-Index/Index';
//                    }
//                });
//                return ;
//            }
//            header.user=data.data;
//        });
    });
    var header=new Vue({
        el:'.headsy',
        data:{
            user:[],
            agent:[]
        }
    });
    function initAgent(data) {
        if(data.status<0){
            layer.open({
                title: '系统提示',//设置弹框标题
                skin: 'postion',
                area: ['300px', '200px'],//设置弹框大小
                shadeClose: true, //点击遮罩关闭
                content: data.msg,
                btn: ['确定'],
                yes: function () {
                    window.location.href='/Home-Index/Index';
                }
            });
            return ;
        }else{
            header.user=data.data;
        }
    }

     //用户退出登录
    function logout(){
        var token=kaiYou.storage.getItem('token');
//        layer.alert('确定退出登录吗？','',function () {
//            apiAjax('/Api-Account/Logout?token='+token, '', function(data) {
//                layer.close();
//                if (data.status > 0) {
//                    window.location.href='/Home-Index/Index';
//                }else{
//                    layer.msg('退出失败')
//                }
//
//            });
//        })
        layer.open({
            title: '系统提示',//设置弹框标题
            skin: 'postion',
            area: ['300px', '200px'],//设置弹框大小
            shadeClose: true, //点击遮罩关闭
            content: '确定退出登录吗?',
            btn: ['确定', '取消'],
            yes: function () {
                apiAjax('/Api-Account/Logout?token='+token, '', function(data) {
                    layer.close();
                    if (data.status > 0) {
                        localStorage.removeItem("tokenWs");
                        window.location.href='/Home-Index/Index';
                    }else{
                        layer.msg('退出失败')
                    }
                });
            }
        });
    }
    
    function AgentLogout() {
       apiAgentAjax('/api-agent/Logout',{},function(data) {
           if(data.status==1){
            alert('退出成功');
            window.location.href='/Home/agent/login';
           }
       });
    }
//    function initAgent() {
//        if(kaiYou.Agent){
//            $("#zc").hide();
//        }
//    }
</script>
{/literal}
