123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- var util = require('../../utils/util.js');
- var api = require('../../config/api.js');
- //获取应用实例
- var app = getApp()
- Page({
- data: {
- newGoods: [],
- hotGoods: [],
- topics: [],
- brands: [],
- floorGoods: [],
- banner: [],
- channel: []
- },
- onShareAppMessage: function () {
- return {
- title: 'YouApp',
- desc: '仿网易严选微信小程序商城',
- path: '/pages/index/index'
- }
- },
- getIndexData: function () {
- let that = this;
- util.request(api.IndexUrl).then(function (res) {
- if(res.errno === 0) {
- console.log(res.data);
- that.setData({
- newGoods: res.data.newGoodsList,
- hotGoods: res.data.hotGoodsList,
- topics: res.data.topicList,
- brand: res.data.brandList,
- floorGoods: res.data.categoryList,
- banner: res.data.banner,
- channel: res.data.channel
- });
- }
- });
- },
- onLoad: function (options) {
- this.getIndexData();
- },
- onReady: function () {
- // 页面渲染完成
- },
- onShow: function () {
- // 页面显示
- },
- onHide: function () {
- // 页面隐藏
- },
- onUnload: function () {
- // 页面关闭
- },
- onReachBottom: function () {
- if (this.data.bottomLoadDone === true || this.data.bottomLoading === true) {
- return false;
- }
- this.setData({
- bottomLoading: true
- });
- this.getFloorCategory();
- }
- })
|