You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
854 B

8 years ago
const API_URL = 'http://127.0.0.1:3000'
8 years ago
function postAddress (data) {
return new Promise((resolve, reject) => {
wx.request({
method: 'POST',
url: `${API_URL}/addresses/new`,
data: Object.assign({}, data),
header: { 'Content-Type': 'application/json' },
success (res) {
console.log('success')
wx.setStorageSync('addrss', res.data)
wx.navigateBack()
},
fail (e) {
console.log('error')
console.error(e)
}
8 years ago
})
})
}
8 years ago
function getLocation () {
wx.getLocation({
type: 'gcj02', //返回可以用于 wx.openLocation 的经纬度
success: function(res) {
var latitude = res.latitude
var longitude = res.longitude
8 years ago
// TODO
8 years ago
}
})
}
8 years ago
module.exports = {
postAddress (data) {
return postAddress(data).then(res => res.data)
}
8 years ago
}