get请求
wx.request({
url: app.globalData.host + '/app_user_info.php',
method: "GET",
data: {
uid: uid,
id: e.target.dataset.delid,
type: 'shipper'
},
header: {
'content-type': 'application/json' // 默认值
},
success: function (res) {
console.log(res)
wx.switchTab({
url: '/pages/check/check',
success: function (e) { //刷新返回页面
var page = getCurrentPages().pop();
if (page == undefined || page == null) return;
page.onLoad();
}
})
},
fail: function () {
console.log('获取站点失败')
wx.showModal({
title: '超时',
content: '网络连接超时,请退出重试',
success(res) {
if (res.confirm) {
console.log('用户点击确定')
wx.navigateBack({
delta: -1
})
} else if (res.cancel) {
console.log('用户点击取消')
wx.navigateBack({
delta: -1
})
}
}
})
}
})
post请求
wx.request({
url: app.globalData.host + '/app_user_info.php',
method: "POST",
data: {
uid: uid,
id: e.target.dataset.delid,
type: 'shipper'
},
header: {
'content-type': 'application/x-www-form-urlencoded' // 默认值
},
success: function (res) {
console.log(res)
wx.switchTab({
url: '/pages/check/check',
success: function (e) { //刷新返回页面
var page = getCurrentPages().pop();
if (page == undefined || page == null) return;
page.onLoad();
}
})
},
fail: function () {
console.log('获取站点失败')
wx.showModal({
title: '超时',
content: '网络连接超时,请退出重试',
success(res) {
if (res.confirm) {
console.log('用户点击确定')
wx.navigateBack({
delta: -1
})
} else if (res.cancel) {
console.log('用户点击取消')
wx.navigateBack({
delta: -1
})
}
}
})
}
})