7.3提交
This commit is contained in:
+10
-11
@@ -12,7 +12,7 @@ if(envVersion=="develop" || envVersion=="trial"){
|
||||
}
|
||||
|
||||
//loding 是否加loading弹窗
|
||||
function request(url, method, data, loding = false) {
|
||||
function request(url, method, data, loding = false,contentType="application/json") {
|
||||
|
||||
if (loding) {
|
||||
wx.showLoading({
|
||||
@@ -35,9 +35,9 @@ function request(url, method, data, loding = false) {
|
||||
|
||||
// }
|
||||
let token = wx.getStorageSync(tokenStr);
|
||||
console.log(token)
|
||||
//console.log(token)
|
||||
let header = {
|
||||
'content-type': 'application/json',
|
||||
'content-type': contentType,
|
||||
'x-access-token': token
|
||||
// 'Authorization': 'Bearer ' + token
|
||||
}
|
||||
@@ -48,7 +48,7 @@ console.log(token)
|
||||
data: data,
|
||||
header: header,
|
||||
success: function (res) {
|
||||
console.log(res.data);
|
||||
//console.log(res.data);
|
||||
// var Authorization_token = res.header['x-access-token'];
|
||||
// if (Authorization_token) {
|
||||
// wx.setStorageSync(tokenStr, Authorization_token); //当token快过期时,服务器会返回新token,本地刷新
|
||||
@@ -60,25 +60,24 @@ console.log(token)
|
||||
if (Number(res.data.code) == 200 || Number(res.data.code) == 0) {
|
||||
resolve(res.data.data);
|
||||
|
||||
}else if (Number(res.data.code) == 401 ) {
|
||||
}else if (Number(res.data.code) == 30007 ) {
|
||||
wx.hideLoading()
|
||||
let redirectUrl=formatUrl();
|
||||
|
||||
wx.reLaunch({
|
||||
url: '/case/pages/mobileLogin/mobileLogin?redirectUrl='+redirectUrl
|
||||
});
|
||||
|
||||
}else if(Number(res.data.code) ==30007 || Number(res.data.code) ==10007){
|
||||
reject(res.data);
|
||||
} else {
|
||||
}else {
|
||||
console.log(res.data)
|
||||
reject(res.data);
|
||||
wx.showToast({
|
||||
title: res.data.msg,
|
||||
title: res.data.msg.length>=30?'操作失败':res.data.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
|
||||
//wx.hideLoading()
|
||||
},
|
||||
fail: function (res) {
|
||||
console.log(res)
|
||||
|
||||
Reference in New Issue
Block a user