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.
40 lines
764 B
40 lines
764 B
export default (params) => { |
|
return new Promise((relove, reject) => { |
|
let token = ""; |
|
token = uni.getStorageSync('token'); |
|
let createToken = ''; |
|
if (params.isAuthorization) { |
|
token = '' |
|
} |
|
|
|
uni.request({ |
|
url: uni.getStorageSync('host')+params.url, |
|
data: params.data, |
|
method: params.method, |
|
dataType: "json", |
|
header: { |
|
"content-type": "application/json", |
|
// Authorization: token, |
|
} |
|
}).then(res => { |
|
console.log(res, 9999999); |
|
let data = res[1].data; |
|
switch (data.code) { |
|
case 200: |
|
relove(data); |
|
break; |
|
case 201: |
|
relove(data); |
|
break; |
|
case 401: |
|
uni.navigateTo({ |
|
url: '/pages/login/login' |
|
}) |
|
break; |
|
case 500: |
|
relove(data); |
|
break; |
|
} |
|
}); |
|
}) |
|
}
|
|
|