//index.js //获取应用实例 const app = getApp() import Toast from '../../miniprogram/miniprogram_npm/vant-weapp/toast/toast' Page({ data: { motto: 'Hello World', }, //事件处理函数 bindViewTap: function () { wx.navigateTo({ url: '../logs/logs' }) }, classBtn: function () { const openid = app.globalData.openid; if (!openid) { Toast.fail('未找到用户信息,请重新进入'); // wx.showToast({ // title: '未找到用户信息', // icon: 'none' // }) return; } const user = app.globalData.userInfo; if (!user) { this.toBind(); return; } wx.redirectTo({ url: '../work/index?type=0', }) }, beedroomBtn: function () { const openid = app.globalData.openid; if (!openid) { Toast.fail('未找到用户信息,请重新进入'); // wx.showToast({ // title: '未找到用户信息', // icon: 'none' // }) return; } const user = app.globalData.userInfo; if (!user) { this.toBind(); return; } wx.redirectTo({ url: '../work/index?type=1', }) }, toBind() { wx.redirectTo({ url: '/pages/bind/index', }) }, })