|
|
|
@ -29,6 +29,7 @@ Page({ |
|
|
|
* 生命周期函数--监听页面加载 |
|
|
|
*/ |
|
|
|
onLoad: function (options) { |
|
|
|
this.checkLogin() |
|
|
|
this.setData({ |
|
|
|
height: app.globalData.fragmentHeight, |
|
|
|
CustomBar: app.globalData.CustomBar |
|
|
|
@ -59,7 +60,7 @@ Page({ |
|
|
|
request.get('/bxe-mall/product/cheapList').then(result => { |
|
|
|
//成功回调
|
|
|
|
this.setData({ loading: false, cheapList: result.data }) |
|
|
|
console.log(this.data.cheapList.length > 0) |
|
|
|
|
|
|
|
}).catch(err => { |
|
|
|
//异常回调
|
|
|
|
this.setData({ loading: false }) |
|
|
|
@ -68,6 +69,7 @@ Page({ |
|
|
|
}, |
|
|
|
|
|
|
|
fetchTaskList: function () { |
|
|
|
console.log('fetchTaskList>>>>') |
|
|
|
if (this.data.requesting || this.data.finished) { |
|
|
|
return |
|
|
|
} |
|
|
|
@ -117,7 +119,45 @@ Page({ |
|
|
|
url: '/pages/mall/order-info/index?id=' + item.id |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 进行登录,同时获取到openId,为下一步的微信登录做准备,
|
|
|
|
checkLogin: function () { |
|
|
|
wx.login({ |
|
|
|
success: res => { |
|
|
|
wx.request({ |
|
|
|
url: app.httpUrl + '/user-centre/wx/bxe/session', |
|
|
|
data: { code: res.code }, |
|
|
|
method: 'POST', |
|
|
|
success: function (result) { |
|
|
|
if (result.data.code != 0) { |
|
|
|
event.emit('EventMessage', { what: 1, desc: 'Login' }) |
|
|
|
return |
|
|
|
} |
|
|
|
app.globalData.openId = result.data.data.openid |
|
|
|
// /commonLogin/login通用登录
|
|
|
|
wx.request({ |
|
|
|
url: app.httpUrl + '/user-centre/commonLogin/login', |
|
|
|
data: { openid: app.globalData.openId }, |
|
|
|
method: 'POST', |
|
|
|
success: function (result) { |
|
|
|
if (result.data.code == 0 && result.data.data.token) { |
|
|
|
app.globalData.token = result.data.data.token |
|
|
|
} |
|
|
|
}, |
|
|
|
complete: function () { |
|
|
|
event.emit('EventMessage', { what: 1, desc: 'Login' }) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
fail: function () { |
|
|
|
event.emit('EventMessage', { what: 1, desc: 'Login' }) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
fail: function () { |
|
|
|
event.emit('EventMessage', { what: 1, desc: 'Login' }) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 生命周期函数--监听页面卸载 |
|
|
|
*/ |
|
|
|
|