index.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. // pages/home/index.js
  2. const app = getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. height: app.globalData.height * 2 + 25,
  9. windowHeight: app.globalData.windowHeight,
  10. navbarData: {
  11. name: '我的'
  12. },
  13. userInfo: {
  14. url: '/image/home/image1.jpg',
  15. name: '顾红伟'
  16. }
  17. },
  18. // 跳转页面
  19. routeBtn: function (e) {
  20. let type = e.currentTarget.dataset.type
  21. if (type == '1') {
  22. wx.redirectTo({
  23. url: '/pages/history/index'
  24. })
  25. } else if (type == '2') {
  26. app.globalData.userInfo = null
  27. wx.redirectTo({
  28. url: '/pages/login/index'
  29. })
  30. }
  31. },
  32. /**
  33. * 生命周期函数--监听页面加载
  34. */
  35. onLoad: function (options) {
  36. },
  37. /**
  38. * 生命周期函数--监听页面初次渲染完成
  39. */
  40. onReady: function () {
  41. },
  42. /**
  43. * 生命周期函数--监听页面显示
  44. */
  45. onShow: function () {
  46. if (typeof this.getTabBar === 'function' &&
  47. this.getTabBar()) {
  48. this.getTabBar().setData({
  49. selected: 3
  50. })
  51. }
  52. },
  53. /**
  54. * 生命周期函数--监听页面隐藏
  55. */
  56. onHide: function () {
  57. },
  58. /**
  59. * 生命周期函数--监听页面卸载
  60. */
  61. onUnload: function () {
  62. },
  63. /**
  64. * 页面相关事件处理函数--监听用户下拉动作
  65. */
  66. onPullDownRefresh: function () {
  67. },
  68. /**
  69. * 页面上拉触底事件的处理函数
  70. */
  71. onReachBottom: function () {
  72. },
  73. /**
  74. * 用户点击右上角分享
  75. */
  76. onShareAppMessage: function () {
  77. }
  78. })