import { getMapData, post, code } from "./getMapData"; const floors = [ { name: "B3", floorOrder: 0, url: true, floorId: "B3", isPark: false, }, { name: "B2", floorOrder: 1, url: true, floorId: "B2", isPark: false, }, { name: "B1", floorOrder: 2, url: true, floorId: "B1", isPark: false, }, { name: "1F", floorOrder: 3, url: true, floorId: "F1", isPark: false, }, { name: "2F", floorOrder: 5, url: true, floorId: "F2", isPark: true, }, ]; App({ async onLaunch() { // 展示本地存储能力 getMapData(); const { code } = await new Promise((resolve, reject) => { wx.login({ success: resolve, fail: reject, }); }); const { data } = await post("/api/ar/v1/applet/MemberLogin", { code, }); this.globalData.openid = data.openid; this.globalData.memberID = data.memberID; this.globalData.isShopMember = data.isShopMember; this.openidCbs.forEach((cb) => cb(data.openid)); }, onOpenid(cb) { this.openidCbs.push(cb); }, openidCbs: [], globalData: { floors, floorIdFloorOrderMap: floors.reduce( (acc, nxt) => ({ ...acc, [nxt.floorId]: nxt.floorOrder }), {} ), }, });