|
@ -1,5 +1,8 @@ |
|
|
|
|
|
|
|
|
import storage from '../common/utils/storage' |
|
|
import storage from '../common/utils/storage' |
|
|
|
|
|
import { |
|
|
|
|
|
removeToken |
|
|
|
|
|
} from '@/common/utils/auth' |
|
|
|
|
|
|
|
|
function service(options = {}) { |
|
|
function service(options = {}) { |
|
|
var token = storage.getStorage(storage.constant.token) |
|
|
var token = storage.getStorage(storage.constant.token) |
|
@ -20,7 +23,7 @@ function service(options = {}) { |
|
|
"dataType":"json", |
|
|
"dataType":"json", |
|
|
"tenant-id":tenantId |
|
|
"tenant-id":tenantId |
|
|
}; |
|
|
}; |
|
|
options.timeout = 10000 |
|
|
options.timeout = 300000 |
|
|
|
|
|
|
|
|
options.url = requestUrl+options.url |
|
|
options.url = requestUrl+options.url |
|
|
|
|
|
|
|
@ -31,6 +34,13 @@ function service(options = {}) { |
|
|
if(res.data.code==0){ |
|
|
if(res.data.code==0){ |
|
|
resolve(res.data); |
|
|
resolve(res.data); |
|
|
}else { |
|
|
}else { |
|
|
|
|
|
if(res.data.code==401){ |
|
|
|
|
|
uni.clearStorageSync() |
|
|
|
|
|
removeToken(); |
|
|
|
|
|
uni.reLaunch({ |
|
|
|
|
|
url: '/pages/login/index' |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
reject("系统异常:"+res.data.msg) |
|
|
reject("系统异常:"+res.data.msg) |
|
|
console.log("系统异常",res.data.msg) |
|
|
console.log("系统异常",res.data.msg) |
|
|
} |
|
|
} |
|
|