mirror of
http://112.124.100.131/GFRS/ebiz-h5.git
synced 2025-12-13 15:26:43 +08:00
Merge branch 'feature/开门红首页业绩表格' into dev
# Conflicts: # src/assets/js/utils/request.js
This commit is contained in:
@@ -6,6 +6,7 @@ import dateUtil from '@/assets/js/utils/date-utils'
|
||||
import MD5 from 'js-md5'
|
||||
import CacheUtils from '@/assets/js/utils/cacheUtils'
|
||||
|
||||
import { device } from '@/assets/js/business-common.js'
|
||||
let proposal = [
|
||||
'/proposal/proposal/list',
|
||||
'/proposal/proposal/toInsurance',
|
||||
@@ -117,7 +118,7 @@ const service = axios.create({
|
||||
|
||||
// request拦截器
|
||||
service.interceptors.request.use(
|
||||
config => {
|
||||
async config => {
|
||||
let relativePath = config.url && config.url.split(configApp.API_VERSION)[1]
|
||||
console.log(config.url.split(configApp.API_VERSION)[0])
|
||||
if (whiteList.includes(relativePath)) {
|
||||
@@ -142,12 +143,27 @@ service.interceptors.request.use(
|
||||
console.log('[调用请求加密服务][请求地址:' + config.url + '][加密后报文:]', config.data)
|
||||
}
|
||||
}
|
||||
config.headers['token'] = CacheUtils.getLocItem('token')
|
||||
let token = CacheUtils.getLocItem('token')
|
||||
/**
|
||||
* 在HomeProduct页面获取代理人信息时, 客户端可能还未将token存储在本地
|
||||
* 此时如果token为空, 调用客户端方法获取token并放入localstorage中
|
||||
*/
|
||||
if (relativePath === '/customer/agent/info' && !token) {
|
||||
// 设备类型
|
||||
const target = device()
|
||||
// 安卓or苹果
|
||||
if (target.isAndroid || target.isIphone) {
|
||||
// eslint-disable-next-line no-undef
|
||||
const res = await EWebBridge.webCallAppInJs('getToken')
|
||||
const token = JSON.parse(res).token
|
||||
CacheUtils.setLocItem('token', token)
|
||||
}
|
||||
}
|
||||
config.headers['token'] = token
|
||||
// 添加请时间戳
|
||||
let timeStr = new Date().getTime() + ''
|
||||
config.headers['timeStr'] = timeStr
|
||||
config.headers['signature'] = MD5(timeStr + CacheUtils.getLocItem('token'))
|
||||
// config.headers['token'] = `f0003a753d1d492083248f723ab1b6e9`//TEST测试专用
|
||||
return config
|
||||
},
|
||||
error => {
|
||||
|
||||
Reference in New Issue
Block a user