var e, a;

e = getApp(), a = require("../../utils/util.js"), Page({
    data: {
        list: e.globalData.sxdata,
        hei: e.globalData.sheight,
        infodata: null,
        id: 1,
        name: "鼠",
        modalHidden: !1,
        showModalStatus: !1,
        mengshow: !1,
        bottom: "-100%",
        sharelayer: !1,
        sharebox: !1,
        sharemodal: !1,
        bot: "-100%",
        openSettingBtnHidden: !0,
        hide_qcode: 1
    },
    onLoad: function(t) {
        var o = this, s = this, n = s.options.id;
        if (isNaN(n)) for (var i = n.toLowerCase(), d = 0; d < s.data.list.length; d++) i == s.data.list[d].en && (n = d + 1);
        var r = decodeURIComponent(this.options.scene);
        r && ((i = e._get(r, "id")) && (n = i), s.setData({
            id: n
        })), a.getData(n, s, "sx", function() {
            encodeURIComponent("id=" + n);
        }), e.globalData.userInfo ? this.setData({
            userInfo: e.globalData.userInfo,
            hasUserInfo: !0
        }) : this.data.canIUse ? e.userInfoReadyCallback = function(e) {
            o.setData({
                userInfo: e.userInfo,
                hasUserInfo: !0
            });
        } : wx.getUserInfo({
            success: function(a) {
                e.globalData.userInfo = a.userInfo, o.setData({
                    userInfo: a.userInfo,
                    hasUserInfo: !0
                });
            }
        }), s.data.infodata && drawImg.downImg(img_user, "user_" + s.data.userInfo.nickName);
    },
    test: function() {
        var e = encodeURIComponent("id=4");
        wx.navigateTo({
            url: "/pages/sx_info/sx_info?scene=" + e
        });
    },
    clicksx: function(e) {
        var t = this, o = e.currentTarget.dataset.index;
        if (o === t.data.id) return a.hideModal(t), !1;
        a.getData(o, t, "sx", function() {
            var e = "https://api.xzw.com/static/image/xcx/sx_" + o + ".png";
            drawImg.downImg(e, "sximg_" + o);
            var a = "https://api.xzw.com/cp/wxcode?sid=5&scene=" + encodeURIComponent("id=" + o);
            drawImg.downImg(a, "qcode_" + o);
        }), a.hideModal(t, "showModalStatus", "mengshow", "bottom");
    },
    showModal: function() {
        a.showModal(this, "modalHidden", "showModalStatus", "mengshow", "bottom");
    },
    hideModal: function() {
        a.hideModal(this, "showModalStatus", "mengshow", "bottom");
    },
    showShareModal: function() {
        a.showModal(this, "sharebox", "sharemodal", "sharelayer", "bot");
    },
    hideShareModal: function() {
        a.hideModal(this, "sharemodal", "sharelayer", "bot");
    },
    getUserInfo: function(a) {
        console.log(a), e.globalData.userInfo = a.detail.userInfo, this.setData({
            userInfo: a.detail.userInfo,
            hasUserInfo: !0
        }), drawImg.downImg(a.detail.userInfo.avatarUrl, "user_" + this.data.userInfo.nickName), 
        drawImg.setData({
            userInfo: a.detail.userInfo
        });
    },
    share: function() {
        var e = this;
        e.hideModal(), drawImg.setData({
            sximg: wx.getStorageSync("sximg_" + e.data.id),
            img_user: wx.getStorageSync("user_" + e.data.userInfo.nickName),
            qcode: wx.getStorageSync("qcode_" + e.data.id),
            userInfo: e.data.userInfo,
            desc: e.data.infodata,
            sxname: e.data.name
        }), e.setData({
            hide_qcode: 0
        }), drawImg.draw(e);
    },
    closeQcode: function() {
        this.setData({
            hide_qcode: 1
        });
    },
    get_token: function() {
        var e = this;
        wx.request({
            url: "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx86ac70758738a28c&secret=27c0db2419f2efd39574ef13f185b47f",
            success: function(a) {
                console.log(a), e.setData({
                    token: a.data.access_token
                }), e.get_ewmimg(a.data.access_token);
            }
        });
    },
    get_ewmimg: function(e) {
        encodeURI(4), wx.request({
            url: "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + e,
            dataType: "json",
            method: "POST",
            data: {
                scene: "4",
                path: "pages/sx_info/sx_info"
            },
            success: function(e) {
                console.log(e);
            }
        });
    },
    handleSetting: function(e) {
        e.detail.authSetting["scope.writePhotosAlbum"] && (this.setData({
            openSettingBtnHidden: !0
        }), drawImg.save_file(this));
    },
    onShareAppMessage: function(e) {
        return "button" === e.from && console.log(e.target), {
            title: "生肖详情",
            path: "/pages/sx/sx_info?id=" + this.data.id
        };
    }
});