index.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. const app = getApp()
  2. import { examine_status } from '../../utils/dict';
  3. import WxValidate from '../../utils/wxValidate';
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. frameStyle: { useTop: true, name: '话题', leftArrow: false, useBar: true },
  10. searchInfo: {},
  11. list: [{ name: '1' }],
  12. },
  13. // 跳转菜单
  14. tabPath(e) {
  15. let { route } = e.detail.detail;
  16. if (route) wx.redirectTo({ url: `/${route}` })
  17. },
  18. // 跳转菜单
  19. back(e) {
  20. wx.navigateBack({ delta: 1 })
  21. },
  22. // 查询
  23. search: function (e) { console.log('查询'); },
  24. /**
  25. * 生命周期函数--监听页面加载
  26. */
  27. onLoad: function (options) {
  28. const that = this;
  29. that.watchLogin();
  30. },
  31. // 监听用户是否登录
  32. watchLogin: async function () {
  33. const that = this;
  34. wx.getStorage({
  35. key: 'user',
  36. success: async res => {
  37. },
  38. fail: res => {
  39. wx.redirectTo({ url: '/pages/index/index', })
  40. }
  41. })
  42. },
  43. /**
  44. * 生命周期函数--监听页面初次渲染完成
  45. */
  46. onReady: function () {
  47. },
  48. /**
  49. * 生命周期函数--监听页面显示
  50. */
  51. onShow: function () {
  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. })