|
@ -1,10 +1,10 @@ |
|
|
|
|
|
|
|
|
import storage from '../common/utils/storage' |
|
|
import storage from '../common/utils/storage' |
|
|
import { |
|
|
import { |
|
|
removeToken |
|
|
removeToken |
|
|
} from '@/common/utils/auth' |
|
|
} from '@/common/utils/auth' |
|
|
|
|
|
|
|
|
function service(options = {}) { |
|
|
function service(options = {}) { |
|
|
|
|
|
|
|
|
var token = storage.getStorage(storage.constant.token) |
|
|
var token = storage.getStorage(storage.constant.token) |
|
|
var tenantId = storage.getStorage('tenantId') |
|
|
var tenantId = storage.getStorage('tenantId') |
|
|
// if(getApp()!=undefined){
|
|
|
// if(getApp()!=undefined){
|
|
@ -69,7 +69,29 @@ function service(options = {}) { |
|
|
reject("系统异常:" + message); |
|
|
reject("系统异常:" + message); |
|
|
console.log("系统异常", message) |
|
|
console.log("系统异常", message) |
|
|
}; |
|
|
}; |
|
|
|
|
|
// #ifdef APP
|
|
|
|
|
|
uni.getNetworkType({ |
|
|
|
|
|
success: function(res) { |
|
|
|
|
|
const networkType = res.networkType; |
|
|
|
|
|
console.log("网络类型", networkType) |
|
|
|
|
|
if (networkType == "none") { |
|
|
|
|
|
reject("当前无网络"); |
|
|
|
|
|
} else { |
|
|
uni.request(options); |
|
|
uni.request(options); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
// #endif
|
|
|
|
|
|
// #ifdef H5
|
|
|
|
|
|
console.log("网s络H5", navigator.onLine) |
|
|
|
|
|
if(navigator.onLine){ |
|
|
|
|
|
uni.request(options); |
|
|
|
|
|
}else { |
|
|
|
|
|
reject("当前无网络"); |
|
|
|
|
|
} |
|
|
|
|
|
// #endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|