// Pages/index/index.js const app = getApp() Page({ data: { loading: true }, /** * 生命周期函数--监听页面显示 */ onShow() { if (typeof this.getTabBar === 'function' && this.getTabBar()) { this.getTabBar().setData({ tabBarShow:false, //true/false }) } this.setData({ loading: false }); }, goCheck(e){ console.log(e); let usertype = e.currentTarget.dataset.usertype; let url = e.currentTarget.dataset.url; wx.setStorageSync('usertype', usertype); wx.setStorageSync('next_url', url); let user_uuid = wx.getStorageSync('user_id'); console.log(user_uuid); if(user_uuid){ wx.switchTab({ url: url }) }else{ app.go(app.globalData.login_url); } }, bindGetUserInfo(){ wx.getUserInfo({ success: function(res) { var userInfo = res.userInfo var nickName = userInfo.nickName var avatarUrl = userInfo.avatarUrl var gender = userInfo.gender //性别 0:未知、1:男、2:女 var province = userInfo.province var city = userInfo.city var country = userInfo.country console.log(res.userInfo) } }) }, shenfang(){ wx.requestSubscribeMessage({ tmplIds: [ "5Tl-xmaWXrKP5BB8E6b3oTdPHbHa7WYWbmvZiuz4TLs", "kUy70xHlr7ADo4aIHiictM4Te7MSec3E5kHsYvFQu40" ], success(res){ console.log(res) }, fail(res){ console.log(res) }, complete(res){ console.log(res) } }) }, yici(){ wx.requestSubscribeMessage({ tmplIds: [ "jhYUf91ULCTX_f69hazqAYwImdFf8ELasRAwB6X-MTM", "JMPmlYGh1HcUSuEfJCVQUIsZv4H5ar3QvXZfrNYNFuc" ], success(res){ console.log(res) }, fail(res){ console.log(res) }, complete(res){ console.log(res) } }) }, check(){ wx.getSetting({ withSubscriptions: true, success (res) { console.log(res.authSetting) console.log(res.subscriptionsSetting) } }) } })