index.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. const util = require('../../utils/util.js');
  2. const api = require('../../config/api.js');
  3. const user = require('../../services/user.js');
  4. import header from './data'
  5. import {
  6. Router
  7. } from '../../utils/router.js'
  8. const app = getApp()
  9. //获取应用实例
  10. Router({
  11. data: {
  12. // 头部导航栏的高度
  13. statusBarHeight: app.globalData.statusBarHeight,
  14. classifyList: [{
  15. id: 1,
  16. title: '新房',
  17. icon: "../../static/images/icon/house@2x.png",
  18. },
  19. {
  20. id: 2,
  21. title: '二手房',
  22. icon: "../../static/images/icon/second_hand@2x.png",
  23. },
  24. {
  25. id: 3,
  26. title: '公寓',
  27. icon: "../../static/images/icon/apartments@2x.png",
  28. },
  29. {
  30. id: 4,
  31. title: '民宿',
  32. icon: "../../static/images/icon/b&b@2x.png",
  33. },
  34. {
  35. id: 5,
  36. title: '社区',
  37. icon: "../../static/images/icon/community@2x.png",
  38. },
  39. ],
  40. middleTabList: [{
  41. id: 1,
  42. title: '新上房源'
  43. },
  44. {
  45. id: 2,
  46. title: '热门房源'
  47. },
  48. {
  49. id: 3,
  50. title: '热门企业'
  51. },
  52. ],
  53. middleType: 1,
  54. city: app.globalData.city,
  55. fetcherData: {
  56. city:'',
  57. page_num: 1,
  58. page_size:20
  59. }
  60. },
  61. onShareAppMessage: function () {
  62. return {
  63. path: '/pages/index/index'
  64. }
  65. },
  66. onPullDownRefresh() {
  67. // this.setData({
  68. // brandList: this.data.brandList.slice(0, 10),
  69. // currentPage: 1
  70. // });
  71. // this.getBrandList(1, false, true);
  72. app.onPullDownRefresh()
  73. },
  74. inputFocus: function () {},
  75. toCity() {
  76. wx.navigateTo({
  77. url: `/pages/city/city`
  78. })
  79. },
  80. toSearch(e) {
  81. var id = e.currentTarget.dataset.id
  82. wx.navigateTo({
  83. url: `/pages/searchRoom/searchRoom?id=` + id
  84. })
  85. },
  86. onLoad: async function (options) {
  87. },
  88. onReady: function () {
  89. // 页面渲染完成
  90. },
  91. onShow: function (options) {
  92. console.log(app.globalData.city)
  93. // 页面显示
  94. let city = app.globalData.city
  95. if (city != this.data.city) {
  96. this.setData({
  97. 'city': app.globalData.city,
  98. })
  99. }
  100. },
  101. onHide: function () {
  102. // 页面隐藏
  103. },
  104. onUnload: function () {
  105. // 页面关闭
  106. }
  107. })