var a, e;

a = getApp(), e = require("../../utils/util.js"), Page({
    data: {
        list: a.globalData.xzwdata,
        mhei: a.globalData.sheight,
        infodata: "",
        male: 1,
        female: 1,
        malename: "金牛座",
        femalename: "金牛座",
        userInfo: "",
        iscollect: !1,
        sharelayer: !1,
        modalHidden: !1,
        showModalStatus: !1,
        mengshow: !1,
        bottom: "-100%",
        openSettingBtnHidden: !0,
        hide_qcode: 1,
        show: !0,
        id: ""
    },
    onLoad: function(t) {
        var o = this, n = this, s = e.GetCxId(t.id, 2), i = decodeURIComponent(this.options.scene);
        if (i) {
            var d = a._get(i, "id");
            d && (s = d);
            var l = s[0] - 1, r = s[1] - 1;
            n.setData({
                id: s,
                male: l,
                female: r
            });
        }
        console.log(t.scene), e.getPairData(n, "xz", function() {
            parseInt(l), parseInt(r), encodeURIComponent("id=" + s);
            var a = n.data.infodata[3], e = a.split(":")[0], t = a.split(":")[1], o = e / 100 * 420, i = t / 100 * 420;
            n.setData({
                bz1: e,
                bz2: t,
                bz1p: o,
                bz2p: i
            });
        }), a.globalData.userInfo ? this.setData({
            userInfo: a.globalData.userInfo,
            hasUserInfo: !0
        }) : this.data.canIUse ? a.userInfoReadyCallback = function(a) {
            o.setData({
                userInfo: a.userInfo,
                hasUserInfo: !0
            });
        } : wx.getUserInfo({
            success: function(e) {
                a.globalData.userInfo = e.userInfo, o.setData({
                    userInfo: e.userInfo,
                    hasUserInfo: !0
                });
            }
        }), n.data.infodata;
        var f = n.data.userInfo, u = n.data.list[n.data.male].name, g = n.data.list[n.data.female].name, c = (u.substr(0, u.length - 1), 
        g.substr(0, g.length - 1));
        console.log(c), f && n.data.userInfo.avatarUrl;
    },
    showModal: function(a) {
        e.showModal(this);
    },
    hideModal: function(a) {
        e.hideModal(this);
    },
    getUserInfo: function(e) {
        console.log(e), a.globalData.userInfo = e.detail.userInfo, this.setData({
            userInfo: e.detail.userInfo,
            hasUserInfo: !0
        }), drawImg.downImg(e.detail.userInfo.avatarUrl, "user_" + e.detail.userInfo.nickName), 
        drawImg.setData({
            userInfo: e.detail.userInfo
        });
    },
    share: function(a) {
        var e = this;
        console.log(e.data.infodata), e.hideModal(), drawImg.setData({
            desc: e.data.infodata,
            img_user: wx.getStorageSync("user_" + e.data.userInfo.nickName),
            maleurl: wx.getStorageSync("xzmale_" + e.data.male),
            femaleurl: wx.getStorageSync("xzfemale_" + e.data.female),
            qcode: wx.getStorageSync("xzqcode_" + e.data.id)
        }), e.setData({
            hide_qcode: 0
        }), drawImg.draw(e);
    },
    closeQcode: function() {
        this.setData({
            hide_qcode: 1
        });
    },
    test: function() {
        var a = encodeURIComponent("id=" + this.data.id);
        wx.navigateTo({
            url: "/pages/xzpair_info/xzpair_info?scene=" + a
        });
    },
    handleSetting: function(a) {
        a.detail.authSetting["scope.writePhotosAlbum"] && (this.setData({
            openSettingBtnHidden: !0
        }), drawImg.save_file(this));
    },
    goback: function(a) {
        wx.navigateBack({
            delta: 1
        });
    },
    navigateToPair: function(a) {
        wx.navigateTo({
            url: "/pages/pair_astro/index"
        });
    },
    onShareAppMessage: function(a) {
        "button" === a.from && console.log(a.target);
        var t = e.formatCxLink(2, [ this.data.male + 1, this.data.female + 1 ]);
        return console.log(this.data.male + 1, this.data.female + 1), console.log("id", t), 
        {
            title: "星座配对详情",
            path: "/pages/pair_astro/xzpair_info?id=" + t
        };
    }
});