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