App({
    globalData: {
        userInfo: null,
        connectedDeviceName: "",
        connectedDeviceId: "",
        writeServicweId: "",
        writeCharacteristicsId: "",
        readServicweId: "",
        readCharacteristicsId: "",
        notifyServicweId: "",
        notifyCharacteristicsId: ""
    },
    url: "https://mphqwc.gdei.edu.cn/scanQRWaterCtrl/service",
    showToast: function(e, t) {
        wx.showToast({
            title: e,
            icon: t,
            duration: 2e3
        });
    },
    onLaunch: function() {
        var e = this, t = wx.getStorageSync("logs") || [];
        t.unshift(Date.now()), wx.setStorageSync("logs", t), wx.login({
            success: function(t) {
                t.code && (console.log("this.url:" + e.url + "/applet/getOpenId"), wx.request({
                    url: e.url + "/applet/getOpenId",
                    data: {
                        code: t.code
                    },
                    success: function(e) {
                        var t = e.data.resultObject;
                        console.log("openId:" + t), wx.setStorageSync("openId", t);
                    }
                }));
            }
        }), wx.getSetting({
            success: function(t) {
                t.authSetting["scope.userInfo"] && wx.getUserInfo({
                    success: function(t) {
                        e.globalData.userInfo = t.userInfo, console.log(JSON.stringify(t.userInfo)), e.userInfoReadyCallback && e.userInfoReadyCallback(t);
                    }
                });
            }
        });
    }
});