diff --git a/pages/index/index.js b/pages/index/index.js index db85539..c94f220 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -24,7 +24,7 @@ Page({ }, onShow: function() { - this.userLogin() + this.userLogin(); }, onGetCode: function(e) { @@ -42,33 +42,32 @@ Page({ var that = this; // 登录 wx.login({ - success: ({ - code - }) => { + success: ({ code }) => { var usrdata = { appId: config.weapp.AppId, code: code, - sceneAddress: app.globalData.sceneAddress, - } + sceneAddress: app.globalData.sceneAddress + }; if (app.globalData.locationInfo) { usrdata = { appId: config.weapp.AppId, code: code, sceneAddress: app.globalData.sceneAddress, - latitude: '' + app.globalData.locationInfo.latitude, - longitude: '' + app.globalData.locationInfo.longitude, - } + latitude: "" + app.globalData.locationInfo.latitude, + longitude: "" + app.globalData.locationInfo.longitude + }; } Http.post({ - url: config.api.login, - data: usrdata - }) + url: config.api.login, + data: usrdata + }) .then(res => { console.log("userlogin:app", res); app.globalData.token = res.data.token; Http.setToken(res.data.token); that.checkUserCarStatus(); that.getUserInfo(); + that.getBannerlist(); if (app.couponChannelListCallback) { app.couponChannelListCallback(app.globalData.token); } @@ -99,6 +98,25 @@ Page({ }); }, + /** + * banner + */ + getBannerlist: function() { + let that = this; + Http.get({ + url: config.api.bannerlist, + data: { + pageNum: 1, + pageSize: 10 + } + }).then(res => { + console.log(res); + that.setData({ + list: res.data.list + }); + console.log(res.data.list); + }); + }, /** * 检查用户是否有车 */