<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,height=device-height, user-scalable=no,initial-scale=1, minimum-scale=1, maximum-scale=1,target-densitydpi=device-dpi "> 
    <title>手机号</title>
    <link rel="stylesheet" href="${ctx }/styles/common/reset.css?ver=5.2" type="text/css">
    <link rel="stylesheet" type="text/css" href="${ctx }/styles/wechat/bindPhone.css?v=2.7" />
    <link rel="stylesheet" href="${ctx }/styles/visitor/layer.css" type="text/css">
    <script type="text/javascript" src="${ctx}/plugin/vconsole/vconsole.min.js"></script>
    <style>
        .head-con{
            margin-top: 0px;
            width: 100%;
            height: 50px;
            line-height: 50px;
            background: #ffffff;
            font-size: 14px;
            color: #666666;
            padding: 0 14px;
            box-sizing: border-box
        }
        .head-con>span{
            display: inline-block;
        }
        .head-con>span:first-of-type{
            float: left;
        }
        .head-con>span:last-of-type{
            float: right;
        }
        .back-btn{
            display: block;
            width: 92%;
            height: 45px;
            line-height: 45px;
            text-align: center;
            color: #FFFFFF;
            font-size: 18px;
            background: #E3452F;
            border-radius: 4px;
            margin: 30px auto;
            cursor: pointer;
        }
    </style>
</head>

<body>
    <input type="hidden" value="${ctx}" id="contextPath" />
    <input type="hidden" id="openId" value="${openId}" />
    <input type="hidden" id="userMobile" value="${userMobile}" />
    <div class="bind-phone">
        <div class="head-con">
            <span>已登录号码</span>
            <span class="mobile"></span>
            <!-- <span>18971302234</span> -->
        </div>
        <button class="back-btn">退出登录</button>
    </div>
    <script type="text/javascript" src="${ctx}/scripts/common/jquery-1.11.3.min.js"></script>
    <script type="text/javascript" src="${ctx }/plugin/layer/mobile/layer.js?v=4.1"></script>
    <script>
    	//var vConsole = new VConsole();
        var ERROR_OK = 200;
        var openId = GetQueryString("openId");
        if(!openId){
        	openId  = localStorage.getItem('openId')
        }
        var userMobile = $("#userMobile").val();
        console.log(openId,'openId')
        $(".mobile").html(userMobile);
        $(".back-btn").on('click',function() {
            $.ajax({
                url: $("#contextPath").val() + "/wechat/newneigou/quitLogin",
                type: "POST",
                dataType: "json",
                data: {
                    openId: openId,
                    userMobile: $("#userMobile").val()
                },
                success: function (data) {
                    if (data.code == ERROR_OK) {
                    console.log(data);
                     window.location.href = $("#contextPath").val() + "/wechat/newneigou/loginPage"
//                    WeixinJSBridge.call('closeWindow');
                    } else {
                        layer.open({
                            content: data.msg,
                            skin: 'msg',
                            time: 2
                        });
                    }
                },
                error: function (data) {
                    alert("系统繁忙..");
                }
            });
        })
        function GetQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return unescape(r[2]);
            return null;
        };
    </script>
</body>

</html>