This commit is contained in:
zoujiandong
2025-08-27 15:57:36 +08:00
parent 42ef4d312e
commit cc0ddd0bc9
3 changed files with 59 additions and 20 deletions
+23 -10
View File
@@ -19,7 +19,7 @@ export const request = (url, data = {}, method = 'post', loading = false, conten
};
let token = '';
if (process.env.UNI_PLATFORM == "h5") {
if (window.location.href.indexOf('//App.igandan.com') > -1) {
if (window.location.href.indexOf('//.igandan.com') > -1) {
token = uni.getStorageSync('AUTH_TOKEN_App');
} else {
token = uni.getStorageSync('DEV_AUTH_TOKEN_App');
@@ -38,20 +38,33 @@ export const request = (url, data = {}, method = 'post', loading = false, conten
'content-type': contentType,
}
let defaultData={}
if(token){
header['Authorization']='Bearer ' + token
}
defaultData = {
version: '4.0.0',
user_uuid: 'Rj3zuTY6zP6YTjHsYEz',
client_type: 'A', //client_type,
let freeList=['/manager/getSystemTimeStamp','/expertAPI/smsLogin','/login/mobile','/expertAPI/login','/expertAPI/index']
if(freeList.indexOf(url)!=-1){
if(freeList[4].indexOf(url)!=-1){
if(!token){
header['Authorization']='Bearer ' + ''
}else{
header['Authorization']='Bearer ' + token
}
}
}else{
if(token){
header['Authorization']='Bearer ' +token
}
}
// defaultData = {
// version: '4.0.0',
// user_uuid: 'Rj3zuTY6zP6YTjHsYEz',
// client_type: 'A', //client_type,
// }
return new Promise(function(e, n) {
let timestamp = Date.now();
uni.request({
data: {...data,...defaultData,timestamp:new Date().getTime().toString()},
data: {...data},
url: url.indexOf('http') != -1 ? url : encodeURI(BASE_URL + url),
method: method,
sslVerify: false,