mirror of
http://112.124.100.131/GFRS/ebiz-h5.git
synced 2025-12-10 05:46:44 +08:00
ios按照原來的方式获取token,安卓的按照通过window拿Android,然后调getToken
This commit is contained in:
@@ -217,7 +217,8 @@ export default {
|
||||
// eslint-disable-next-line no-useless-escape
|
||||
isAndroid: ua.match(/(Android);?[\s\/]+([\d.]+)?/),
|
||||
isIphone: ua.indexOf('iPhone') != -1,
|
||||
isWeixin: ua.match(/MicroMessenger/i)
|
||||
isWeixin: ua.match(/MicroMessenger/i),
|
||||
mobile: !!ua.match(/AppleWebKit.*Mobile.*/)
|
||||
}
|
||||
},
|
||||
/**
|
||||
|
||||
@@ -167,13 +167,15 @@ service.interceptors.request.use(
|
||||
// 设备类型
|
||||
const target = BusinessCommon.device()
|
||||
// 安卓or苹果(非浏览器)
|
||||
if (!target.isWeixin && !target.isChrome) {
|
||||
if (!target.isWeixin && target.mobile) {
|
||||
// eslint-disable-next-line no-undef
|
||||
let u = navigator.userAgent;
|
||||
let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //判断是否是 android终端
|
||||
if(isAndroid){
|
||||
console.log(window.Android.getToken(),'Android获取token')
|
||||
CacheUtils.setLocItem('token', JSON.parse(window.Android.getToken()))
|
||||
// setTimeout(() => {
|
||||
console.log(window.Android.getToken(),'Android获取token')
|
||||
CacheUtils.setLocItem('token', window.Android.getToken())
|
||||
// }, 1000)
|
||||
}else{
|
||||
const res = await EWebBridge.webCallAppInJs('getToken')
|
||||
CacheUtils.setLocItem('token', JSON.parse(res).token)
|
||||
|
||||
Reference in New Issue
Block a user