const util = require('../../utils/util.js'); const api = require('../../config/api.js'); const user = require('../../services/user.js'); import header from './data' import { Router } from '../../utils/router.js' const app = getApp() //获取应用实例 Router({ data: { // 头部导航栏的高度 statusBarHeight: app.globalData.statusBarHeight, classifyList: [{ type: 0, title: '新房', icon: "../../static/images/icon/house@2x.png", }, { type: 1, title: '二手房', icon: "../../static/images/icon/second_hand@2x.png", }, { type: 2, title: '公寓', icon: "../../static/images/icon/apartments@2x.png", }, { type: 3, title: '民宿', icon: "../../static/images/icon/b&b@2x.png", }, { type: 4, title: '社区', icon: "../../static/images/icon/community@2x.png", }, ], type:'', middleType: 11, // type :-1:所有;0:新房;1:二手房;2:公寓;3:民宿;4:社区 // 11:新上房源;12:热门房源;13:热门企业; // 21:商家列表; // 31:VR场景;32:VR直播间 middleTabList: [{ type: 11, title: '新上房源' }, { type: 12, title: '热门房源' }, { type: 13, title: '热门企业' }, ], middleList: [{ url: 'https://m4.publicimg.browser.qq.com/publicimg/pcqb/ewtab_yunying/477_266_datu_20210802.jpg', title: '华发水岸1' }, { url: 'https://m4.publicimg.browser.qq.com/publicimg/pcqb/ewtab_yunying/477_266_datu_20210802.jpg', title: '华发水岸1' }, { url: 'https://m4.publicimg.browser.qq.com/publicimg/pcqb/ewtab_yunying/477_266_datu_20210802.jpg', title: '华发水岸1' }, ], roomTabList: [{ type: 0, title: '新房' }, { type: 1, title: '二手房' }, { type: 2, title: '公寓' }, ], roomType: 0, city: app.globalData.city, fetcherData: { type:'', city: '', page_num: 1, page_size: 20, name:'' } }, onShareAppMessage: function () { return { path: '/pages/index/index' } }, onPullDownRefresh() { // this.setData({ // brandList: this.data.brandList.slice(0, 10), // currentPage: 1 // }); // this.getBrandList(1, false, true); app.onPullDownRefresh() }, onReachBottom: function () { console.log('onReachBottom') }, inputFocus: function () {}, changeMiddleTab(e) { let type = e.currentTarget.dataset.type this.setData({ middleType: type }) }, chengeRoomType(e) { let type = e.currentTarget.dataset.type this.setData({ roomType: type }) }, getRoomList(){ this.setData({ 'fetcherData.type':this.data.roomType, }) if(app.globalData.city=='全国'){ this.setData({ 'fetcherData.city':'', }) }else{ this.setData({ 'fetcherData.city':app.globalData.city, }) } util.request(api.OrderList, this.data.fetcherData).then( (res)=> { console.log(res) if (res.errno === 0) { } }); }, getMiddleList(){ this.setData({ 'fetcherData.type':this.data.middleType, }) if(app.globalData.city=='全国'){ this.setData({ 'fetcherData.city':'', }) }else{ this.setData({ 'fetcherData.city':app.globalData.city, }) } util.request(api.OrderList, this.data.fetcherData).then( (res)=> { console.log(res) if (res.errno === 0) { } }); }, toCity() { wx.navigateTo({ url: `/pages/city/city` }) }, toSearch(e) { var id = e.currentTarget.dataset.id wx.navigateTo({ url: `/pages/searchRoom/searchRoom?id=` + id }) }, onLoad: async function (options) { }, onReady: function () { // 页面渲染完成 this.getRoomList() this.getMiddleList() }, onShow: function (options) { console.log(app.globalData.city) // 页面显示 let city = app.globalData.city if (city != this.data.city) { this.setData({ 'city': app.globalData.city, }) this.getRoomList() this.getMiddleList() } }, onHide: function () { // 页面隐藏 }, onUnload: function () { // 页面关闭 } })