parent
9bffad1a60
commit
a592850d8b
4 changed files with 41 additions and 37 deletions
@ -1,17 +1,40 @@ |
|||||||
const API_URL = 'http://localhost:3000' |
const API_URL = 'http://localhost:3000' |
||||||
|
const app = getApp() |
||||||
|
|
||||||
function getZichanSlides (data, resolve) { |
function getZichanSlides (resolve) { |
||||||
wx.request({ |
wx.request({ |
||||||
url: `${API_URL}/profiles/zichan_sildes`, |
url: `${API_URL}/profiles/zichan_sildes`, |
||||||
data: data, |
data: {token: app.globalData.token}, |
||||||
header: { 'Content-Type': 'application/json'}, |
header: { 'Content-Type': 'application/json'}, |
||||||
success: resolve, |
success: resolve, |
||||||
fail: function(){} |
fail: function(){} |
||||||
}) |
}) |
||||||
} |
} |
||||||
|
|
||||||
|
function getCustomerInfo (cb) { |
||||||
|
wx.request({ |
||||||
|
url: `${API_URL}/sessions/new`, |
||||||
|
header: { 'Content-Type': 'application/json'}, |
||||||
|
data: { |
||||||
|
code: 'sadjfskdf', |
||||||
|
mobile: '13054277977', |
||||||
|
name: 'test' |
||||||
|
}, |
||||||
|
success: function(res) { |
||||||
|
app.globalData.currentCustomer = res.data.customer |
||||||
|
app.globalData.token = res.data.token |
||||||
|
typeof cb == "function" && cb(app.globalData.currentCustomer) |
||||||
|
}, |
||||||
|
fail: function(res) { |
||||||
|
} |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
module.exports = { |
module.exports = { |
||||||
getZichanSlides (data, resolve) { |
getZichanSlides (resolve) { |
||||||
return getZichanSlides(data, resolve) |
return getZichanSlides(resolve) |
||||||
|
}, |
||||||
|
getCustomerInfo (resolve) { |
||||||
|
return getCustomerInfo(resolve) |
||||||
} |
} |
||||||
} |
} |
Loading…
Reference in new issue