function t(t) {
    return function() {
        var n = t.apply(this, arguments);
        return new Promise(function(t, e) {
            return function o(a, i) {
                try {
                    var s = n[a](i), r = s.value;
                } catch (a) {
                    return void e(a);
                }
                if (!s.done) return Promise.resolve(r).then(function(t) {
                    o("next", t);
                }, function(t) {
                    o("throw", t);
                });
                t(r);
            }("next");
        });
    };
}

getApp();

var n = require("../../provider/dataApi.js");

Page({
    data: {
        statusBarHeight: "",
        titleBarHeight: "",
        userInfo: {}
    },
    onLoad: function(t) {
        this.setData({
            statusBarHeight: getApp().globalData.statusBarHeight,
            titleBarHeight: getApp().globalData.titleBarHeight
        }), this.getUserInfo();
    },
    getUserInfo: function() {
        var t = this;
        n.userinfo({
            uid: wx.getStorageSync("uid"),
            op: "getinfo"
        }).then(function(n) {
            console.log(n), t.setData({
                userInfo: n.data.info
            });
        }).catch(function(t) {});
    },
    goBack: function() {
        wx.navigateBack({
            delta: 1
        });
    },
    saveImgBtn: function() {
        var t = this.data.userInfo.customer_service;
        wx.showLoading({
            title: "保存中"
        }), this.uploadImg(t);
    },
    uploadImg: function(n) {
        var e = this;
        return t(regeneratorRuntime.mark(function t() {
            var o, a;
            return regeneratorRuntime.wrap(function(t) {
                for (;;) switch (t.prev = t.next) {
                  case 0:
                    return o = e, t.next = 3, o.getImgInfo(n);

                  case 3:
                    a = t.sent, console.log(a.path), wx.saveImageToPhotosAlbum({
                        filePath: a.path,
                        success: function(t) {
                            console.log(t), wx.hideLoading(), wx.showToast({
                                title: "保存成功",
                                icon: "none"
                            });
                        },
                        fail: function(t) {
                            console.log(t), wx.hideLoading(), "saveImageToPhotosAlbum:fail:auth denied" !== t.errMsg && "saveImageToPhotosAlbum:fail auth deny" !== t.errMsg || wx.showModal({
                                title: "提示",
                                content: "需要您授权保存相册",
                                showCancel: !1,
                                success: function() {
                                    wx.openSetting({
                                        success: function(t) {
                                            console.log("settingdata", t), wx.hideLoading(), t.authSetting["scope.writePhotosAlbum"] ? wx.showModal({
                                                title: "提示",
                                                content: "获取权限成功,再次点击保存图片即可保存图片",
                                                showCancel: !1
                                            }) : wx.showModal({
                                                title: "提示",
                                                content: "获取权限失败，将无法保存到相册哦~",
                                                showCancel: !1
                                            });
                                        }
                                    });
                                }
                            });
                        }
                    });

                  case 6:
                  case "end":
                    return t.stop();
                }
            }, t, e);
        }))();
    },
    getImgInfo: function(t) {
        return new Promise(function(n) {
            wx.getImageInfo({
                src: t,
                success: function(t) {
                    console.log(t), n(t);
                },
                fail: function(t) {
                    console.log(t);
                }
            });
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {}
});