mirror of
http://112.124.100.131/GFRS/ebiz-h5.git
synced 2025-12-10 09:16:43 +08:00
【登录token失效问题】修改下Android端获取token的实现
This commit is contained in:
@@ -169,8 +169,14 @@ service.interceptors.request.use(
|
||||
// 安卓or苹果(非浏览器)
|
||||
if (!target.isWeixin && !target.isChrome) {
|
||||
// eslint-disable-next-line no-undef
|
||||
const res = await EWebBridge.webCallAppInJs('getToken')
|
||||
CacheUtils.setLocItem('token', JSON.parse(res).token)
|
||||
let u = navigator.userAgent;
|
||||
let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //判断是否是 android终端
|
||||
if(isAndroid){
|
||||
CacheUtils.setLocItem('token', JSON.parse(window.Android.getToken()))
|
||||
}else{
|
||||
const res = await EWebBridge.webCallAppInJs('getToken')
|
||||
CacheUtils.setLocItem('token', JSON.parse(res).token)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user