成都SKPAR小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

76 lines
1.4 KiB

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: "1MF",
floorOrder: 4,
url: null,
floorId: "1MF",
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 }),
{}
),
},
});