import "./__antmove/component/componentClass.js";
my.global = {};
const _my = require("./__antmove/api/index.js")(my);
const wx = _my;
// app.js
const { checkUserWhiteListId } = require("./utils/api/api");
App({
    data: {
        phone: null,
        adminInfo: wx.getStorageSync("adminInfo") || null,
        language: wx.getStorageSync("language") || "ch",
        userInfo: wx.getStorageSync("userInfo") || null,
        extraMessage: wx.getStorageSync("extraMessage") || null,
        temporary_userInfo: null,
        temporary_adminInfo: null,
        type: 0,
        //0->普通码 1->常客码
        //（过审专用，禁止删除）- start
        fake: true,
        myAppointment: null
        //（过审专用，禁止删除）- end
    },

    onLaunch(options) {
        // 展示本地存储能力
        const logs = wx.getStorageSync("logs") || [];
        logs.unshift(Date.now());
        wx.setStorageSync("logs", logs);

        // 获取状态栏和导航栏的高度
        const {
          titleBarHeight,
          statusBarHeight,
        } = my.getSystemInfoSync()
        this.globalData.statusBarHeight = statusBarHeight
        this.globalData.titleBarHeight = titleBarHeight

        //检测缓存中的常客是否有效（存在）、
        if (this.data.adminInfo) {
            checkUserWhiteListId(this.data.adminInfo.userWhitelistId).then(
                res => {
                    if (!res.data) {
                        wx.removeStorageSync("adminInfo");
                        this.data.adminInfo = null;
                    }
                }
            );
        }
    },
    globalData: {
        userInfo: null
    }
});
