import { post } from "../../getMapData"; Page({ /** * 页面的初始数据 */ data: { agreed: true, }, toPrivacy() { wx.navigateTo({ url: "/pages/privacy/index", }); }, toggleAgreed() { this.setData({ agreed: !this.data.agreed }); }, toMainPage() { const app = getApp(); app.globalData.userDeny = true; return wx.redirectTo({ url: "/pages/h5map/index", }); }, async ongetphonenumber(e) { if (!e.detail.code) { return this.toMainPage(); } try { wx.showLoading(); const app = getApp(); const { openid } = app.globalData; const { code: resCode, data: { isShopMember, memberID }, } = await post("/api/ar/v1/applet/MemberRegister", { code: e.detail.code, wechatID: openid, }); if (resCode === "200") { app.globalData.memberID = memberID; app.globalData.isShopMember = isShopMember; wx.reLaunch({ url: "/pages/h5map/index", }); } else { this.toMainPage(); } } catch (error) { this.toMainPage(); console.log(error); } finally { wx.hideLoading(); } }, });