index.js 1.4 KB

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