mirror of
http://112.124.100.131/GFRS/ebiz-h5.git
synced 2025-12-09 19:16:43 +08:00
dev测试token问题
This commit is contained in:
@@ -136,7 +136,7 @@ const service = axios.create({
|
||||
|
||||
// request拦截器
|
||||
service.interceptors.request.use(
|
||||
config => {
|
||||
async config => {
|
||||
let relativePath = config.url && config.url.split(configApp.API_VERSION)[1]
|
||||
if (whiteList.includes(relativePath)) {
|
||||
Toast.loading({
|
||||
@@ -161,18 +161,18 @@ service.interceptors.request.use(
|
||||
|
||||
// token 不存在初始化处理
|
||||
let token = CacheUtils.getLocItem('token')
|
||||
console.log('前端缓存token====>>', token)
|
||||
if (!token) {
|
||||
console.log('token====>>', token)
|
||||
// 设备类型
|
||||
const target = BusinessCommon.device()
|
||||
// 安卓or苹果(非浏览器)
|
||||
if (target.isAndroid || target.isIphone) {
|
||||
if (!target.isWeixin && !target.isChrome) {
|
||||
// eslint-disable-next-line no-undef
|
||||
const res = EWebBridge.webCallAppInJs('getToken')
|
||||
const res = await EWebBridge.webCallAppInJs('getToken')
|
||||
CacheUtils.setLocItem('token', JSON.parse(res).token)
|
||||
}
|
||||
}
|
||||
console.log('最终token====>>', CacheUtils.getLocItem('token'))
|
||||
|
||||
config.headers['token'] = CacheUtils.getLocItem('token')
|
||||
// 添加请时间戳
|
||||
let timeStr = new Date().getTime() + ''
|
||||
|
||||
Reference in New Issue
Block a user