//index.js //获取应用实例 import {get,post} from "../../common/request.js" import stylemap from "../../common/stylemap" import pathmap from "../../common/pathmap" import bindTopSource from "../../common/topsource" import { retCartData} from "../../data/car" import bindSearch from "../../module/search/search.js" const app = getApp(); Page({ data: { windowh: app.globalData.windowh, banner:[], goodcars:[], recommended:[], like:[], searchfouce:false }, onLoad: function () { var _self = this; //this.testPost(); this.setData(stylemap); this.loadBanner(); this.loadBrandRecommend(); this.loadGoodCar(); this.loadRecommendedCar(); this.loadLikeCar(); bindSearch(this); //bindTopSource(this); }, loadBanner: function () { var _self = this; get(pathmap.banner, { terminal: 0 }, function (json) { _self.setData({ banner: json.data }) }) }, loadBrandRecommend:function(){ var _self = this; get(pathmap.brandrecommend, { }, function (json) { _self.setData({ brandrecommend:json.data }) }) }, loadGoodCar:function(){ var _self = this; get(pathmap.goodcar, { offset: 0, limit:3 }, function (json) { var list = json.data.list; list.forEach(function(item){ item.times = new Date(item.time.replace("-","/")).getTime(); }) list.sort(function(a,b){ return a.times