mirror of
http://112.124.100.131/GFRS/ebiz-h5.git
synced 2025-12-09 16:56:43 +08:00
Merge branch 'feature/GFRS-1991【待确定】APP检测结果优化-整理' into release/20201126
This commit is contained in:
@@ -5,6 +5,8 @@ import { Dialog, Toast } from 'vant'
|
||||
import dateUtil from "@/assets/js/utils/date-utils";
|
||||
import MD5 from 'js-md5';
|
||||
import CacheUtils from '@/assets/js/utils/cacheUtils'
|
||||
import BusinessCommon from '@/assets/js/business-common'
|
||||
|
||||
|
||||
let proposal = [
|
||||
'/proposal/proposal/list',
|
||||
@@ -113,7 +115,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({
|
||||
@@ -135,6 +137,20 @@ service.interceptors.request.use(
|
||||
config.data = {"data": encrypt }
|
||||
}
|
||||
}
|
||||
|
||||
// token 不存在初始化处理
|
||||
let token = CacheUtils.getLocItem('token');
|
||||
if (!token){
|
||||
// 设备类型
|
||||
const target = BusinessCommon.device()
|
||||
// 安卓or苹果
|
||||
if (target.isAndroid || target.isIphone) {
|
||||
// eslint-disable-next-line no-undef
|
||||
const res = await EWebBridge.webCallAppInJs('getToken')
|
||||
CacheUtils.setLocItem('token', JSON.parse(res).token)
|
||||
}
|
||||
}
|
||||
|
||||
config.headers['token'] = CacheUtils.getLocItem('token')
|
||||
// 添加请时间戳
|
||||
let timeStr = new Date().getTime() + '';
|
||||
|
||||
Reference in New Issue
Block a user