const { default: api } = require("../../js/api"); Page({ data: { isLoggedIn: false, userInfo: null, scanTitle:'扫码加油', scanTip:'请扫描加油机键盘上的二维码' }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { var wxChatID = wx.getStorageSync("WachatID") console.log("wxchatid",wxChatID); if(wxChatID) { api.request_GetSiteInfo().then(res => { console.log(res) }) this.setData({ isLoggedIn: true, userInfo: null, scanTitle:'扫码加油', scanTip:'请扫码加油机键盘上的二维码' }) } }, toLoginOrOrderPage: function() { if(!this.data.isLoggedIn) { wx.redirectTo({ url: '../login/login' }) } else { wx.navigateTo({ url: '../historyOrder/historyOrder', }) } } });