$(document).ready(function () {

    try {
        window.Origami.fastclick(document.body);
    } catch (e) {
    }
    document.addEventListener("touchmove", function (e) {
        e.preventDefault();
    }, false);
    var clickEvent = $.isFunction($.fn.tap) ? 'tap' : 'click';
    window['max_zindex'] = 100;
    $.fn.show_dialog = function () {
        window['max_zindex'] += 1;
        this.css('z-index', window['max_zindex']);
        this.show();
    };
alert(1);
});
function btnPrize() {

    $.ajax({
        url: '/index/tryPrize',
        type: 'post',
        data:'',
        success: function (resp) {
            if (resp.errcode != 0) {
                my_notify(resp.errmsg);
                return;
            }else{
                $('.page').hide();
                if (resp.data.prize ==0) {
                    $('.page_result').show();
                    $('.no-prize').show();
                }else{
                    if(resp.data.type==1){
                        $('.t-s').show();
                        setTimeout(function () {
                            $('.t-s').hide();
                        },2500)
                    }
                    $('#code').qrcode(resp.data.url);
                    var mycanvas1 = document.getElementsByTagName('canvas')[0];
                    var img = convertCanvasToImage(mycanvas1);

                    $('.code').append(img);//imagQrDiv表示你要插入的容器id
                    $('.page').hide();
                    $('.page_prize').show();

                }
            }

        },
        error: function () {
            my_notify('网络异常，请稍后重试');
        }
    });

}
function convertCanvasToImage(canvas) {
    //新Image对象，可以理解为DOM
    var image = new Image();
    // canvas.toDataURL 返回的是一串Base64编码的URL，当然,浏览器自己肯定支持
    // 指定格式 PNG
    image.src = canvas.toDataURL("image/png");
    return image;
}
window.wx && wx.ready(function () {
    document.getElementById('y-x').play();
    document.getElementById('b-j').play();
    // document.getElementById('b-j').pause();
    document.getElementById('y-x').pause();
    var base = location.origin;
    var wxFriendData = {
        'link': base,
        'imgUrl': base + '/Public/static/images/share.png',
        // 内容
        'desc': '小伙伴快抢！',
        // 标题
        'title': '【现在大乐透】进来抽吃喝玩乐福利，不定期限时派送！小伙伴快抢！',
        trigger: function () {
        },
        success: function () {
        }
    };
    var wxTimelineData = {
        'link': base,
        'imgUrl': base + '/Public/static/images/share.png',
        'title': '【现在大乐透】进来抽吃喝玩乐福利，不定期限时派送！小伙伴快抢！',
        trigger: function () {


        },
        success: function () {

        }
    };
    wx.onMenuShareAppMessage(wxFriendData);
    wx.onMenuShareTimeline(wxTimelineData);
});