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