index.js 1.8 KB

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