<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="token" value="{{ csrf_token() }}">
    <title>阿拉德之怒</title>
    <script>
        function reSizeRem() {
            var ClientWidth = document.documentElement.clientWidth > 540 ? 540 : document.documentElement.clientWidth,
                UiWidth = 1080,
                FontSize = ClientWidth / UiWidth * 100;
            document.documentElement.style.fontSize = FontSize + 'px';
        }
        reSizeRem();
        window.onresize = function () {
            reSizeRem();
        }
    </script>
    <link rel="stylesheet" href="{{ asset('postcard/css/style.css?v=20210607') }}">
    <script src="{{ asset('js/jquery.2.1.3.min.js') }}"></script>
    <script src="{{ asset('js/toast.js') }}"></script>
    <script src="{{ asset('postcard/js/main.js?v=20210607') }}"></script>
</head>
<body>
<div class="container home-container">
    <div class="login-info">
        欢迎您，
        @if($isLogin == 1) {{ $userName }} <a href="/logout">【注销】</a> @endif
        @if($isLogin == 0) <a href="/login">【登录】</a> @endif
    </div>
    <div class="header-avatar">
        <span></span>
        <img src="{{ asset('postcard/images/default_img.png') }}" alt="">
    </div>
    <a href="javascript:" class="btn-start"></a>

    <div class="dialog dialog-server hide">
        <div class="content">
            <a href="javascript:" class="close"></a>
            <ul>
                <li>
                    <select name="" id="serve" class="server-select">
                    </select>
                </li>
                <li>
                    <select name="" id="role" class="role-select">
                    </select>
                </li>
            </ul>
            <a href="javascript:" class="btn-card-bind-role"></a>
        </div>
    </div>
</div>
<div class="loading hide">
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
</div>
<script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script>
    $(function(){
        var isWeixin = function () {
            //判断是否是微信
            var ua = navigator.userAgent.toLowerCase();
            return ua.match(/MicroMessenger/i) == "micromessenger";
        };
        function _wechatConfig(o) {
            wx.config({
                debug: false,
                appId: o.appId,
                timestamp: o.timestamp,
                nonceStr: o.nonceStr,
                signature: o.signature,
                jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage'] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
            });
        }

        function _getWechatJsSdkInfo(callback) {
            $.ajax({
                type:"GET",
                url:"/wx/config",
                data:{
                    url:location.href
                },
                async:false,
                success:function(data){
                    callback(data.data);
                }
            });
        }
        if (isWeixin()) {
            _getWechatJsSdkInfo(_wechatConfig);
        }
        wx.checkJsApi({
            jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage'],
            success: function (res) {
            }
        });
        function wx_share(title, link, imgurl, desc) {
            //朋友圈
            wx.onMenuShareTimeline({
                title: title,
                link: link,
                imgUrl: imgurl,
                success: function() {

                },
                cancel: function() {

                }
            });
            //微信好友
            wx.onMenuShareAppMessage({
                title: title,
                desc: desc,
                link: link,
                imgUrl: imgurl,
                type: 'link',
                dataUrl: '',
                success: function() {

                },
                cancel: function() {

                }
            });
        }

        wx.ready(function () {
            var  title = '阿拉德之怒',
                link = 'http://uc-card.aldzn.cn',
                img  = "http://uc-card.aldzn.cn/static/postcard/images/default_img.png",
                desc = "阿拉德之怒-明信片";
            wx_share(title,link,img,desc);
        });
        wx.error(function (res) {
            console.log(res);
        });
    });
</script>
</body>
</html>