index.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. const app = getApp()
  2. Page({
  3. data: {
  4. frameStyle: { useTop: true, name: '俱乐部', leftArrow: false, useBar: true },
  5. },
  6. // 跳转菜单
  7. tabPath(e) {
  8. let { route } = e.detail.detail;
  9. if (route) wx.redirectTo({ url: `/${route}` })
  10. },
  11. /**
  12. * 生命周期函数--监听页面加载
  13. */
  14. onLoad: function (options) { },
  15. /**
  16. * 生命周期函数--监听页面初次渲染完成
  17. */
  18. onReady: function () { },
  19. /**
  20. * 生命周期函数--监听页面显示
  21. */
  22. onShow: function () {
  23. const that = this;
  24. // 监听用户是否登录
  25. that.watchLogin();
  26. },
  27. // 监听用户是否登录
  28. watchLogin: async function () {
  29. const that = this;
  30. wx.getStorage({
  31. key: 'user',
  32. success: async res => { },
  33. fail: async res => {
  34. // wx.redirectTo({ url: '/pages/index/index' })
  35. }
  36. })
  37. },
  38. /**
  39. * 页面上拉触底事件的处理函数
  40. */
  41. /**
  42. * 生命周期函数--监听页面隐藏
  43. */
  44. onHide: function () {
  45. },
  46. /**
  47. * 生命周期函数--监听页面卸载
  48. */
  49. onUnload: function () {
  50. },
  51. /**
  52. * 页面相关事件处理函数--监听用户下拉动作
  53. */
  54. onPullDownRefresh: function () {
  55. },
  56. /**
  57. * 用户点击右上角分享
  58. */
  59. onShareAppMessage: function () {
  60. }
  61. })