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.
44 lines
864 B
44 lines
864 B
export default (params) => { |
|
return new Promise((relove, reject) => { |
|
let token = '' |
|
let createToken='' |
|
if(params.isfa){ |
|
token = uni.getStorageSync('token'); |
|
createToken=uni.getStorageSync('createToken'); |
|
} |
|
let time=new Date().toString() |
|
uni.request({ |
|
url: params.url, |
|
data: params.data, |
|
method: params.method, |
|
dataType: "json", |
|
header: { |
|
"content-type": "application/json", |
|
token: token, |
|
Authorization:createToken, |
|
'If-Modified-Since':'0', |
|
'Cache-Control':'no-cache' |
|
} |
|
}).then(res => { |
|
// console.log(res.data); |
|
let data = res.data; |
|
switch (data.code) { |
|
case 200: |
|
relove(data); |
|
break; |
|
|
|
case 401: |
|
uni.navigateTo({ |
|
url: '/pages/login/login' |
|
}) |
|
break; |
|
case 500: |
|
relove(data); |
|
break; |
|
default: |
|
relove(data) |
|
break |
|
} |
|
}); |
|
}) |
|
}
|
|
|