mirror of
http://112.124.100.131/GFRS/ebiz-h5.git
synced 2025-12-12 13:46:43 +08:00
Merge branch 'feature/GFRS-1991【待确定】APP检测结果优化-整理' into dev
# Conflicts: # src/assets/js/utils/request.js
This commit is contained in:
@@ -118,9 +118,8 @@ const service = axios.create({
|
||||
|
||||
// request拦截器
|
||||
service.interceptors.request.use(
|
||||
async config => {
|
||||
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)) {
|
||||
Toast.loading({
|
||||
duration: 0, // 持续展示 toast
|
||||
@@ -132,15 +131,13 @@ service.interceptors.request.use(
|
||||
/**
|
||||
* 请求拦截处理(待添加 判断走统一网关处理)
|
||||
*/
|
||||
if (configApp.API_VERSION == 'v2' && config.url && /api\/$/.test(config.url.split(configApp.API_VERSION)[0])) {
|
||||
if(config.url && /api\/$/.test(config.url.split(configApp.API_VERSION)[0]) && configApp.API_VERSION == 'v2'){
|
||||
if(!config.data || config.data == null){
|
||||
config.data = {}
|
||||
}
|
||||
if(!!config.data && config.data != null){
|
||||
let encrypt = AESTools.AESEncrypt(JSON.stringify(config.data),configApp.REQ_PWD)
|
||||
console.log('[调用请求加密服务][请求地址:' + config.url + '][加密前报文:]', JSON.stringify(config.data))
|
||||
config.data = { data: encrypt }
|
||||
console.log('[调用请求加密服务][请求地址:' + config.url + '][加密后报文:]', config.data)
|
||||
config.data = {"data": encrypt }
|
||||
}
|
||||
}
|
||||
let token = CacheUtils.getLocItem('token')
|
||||
@@ -175,20 +172,10 @@ service.interceptors.request.use(
|
||||
// respone拦截器
|
||||
service.interceptors.response.use(
|
||||
response => {
|
||||
console.log(response)
|
||||
console.log('----------------')
|
||||
let res = response.data
|
||||
if (
|
||||
configApp.API_VERSION == 'v2' &&
|
||||
response.config.url &&
|
||||
response.headers['content-type'].match(/application\/json/) &&
|
||||
/api\/$/.test(response.config.url.split(configApp.API_VERSION)[0])
|
||||
) {
|
||||
if (res.response) {
|
||||
// 正常情況返回必有response 节点
|
||||
console.log('[调用请求解密服务][请求地址:' + response.config.url + '][解密前报文:]', JSON.stringify(res.response))
|
||||
if( configApp.API_VERSION == 'v2' && response.config.url && response.headers['content-type'].match(/application\/json/) && /api\/$/.test(response.config.url.split(configApp.API_VERSION)[0])){
|
||||
if(res.response){// 正常情況返回必有response 节点
|
||||
res = JSON.parse(AESTools.AESDecrypt(res.response,configApp.REQ_PWD))
|
||||
console.log('[调用请求解密服务][请求地址:' + response.config.url + '][解密后报文:]', res)
|
||||
}
|
||||
}
|
||||
Toast.clear()
|
||||
|
||||
@@ -19,7 +19,6 @@ const service = axios.create({
|
||||
service.interceptors.request.use(
|
||||
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)) {
|
||||
Toast.loading({
|
||||
duration: 0, // 持续展示 toast
|
||||
@@ -37,9 +36,7 @@ service.interceptors.request.use(
|
||||
}
|
||||
if(!!config.data && config.data != null){
|
||||
let encrypt = AESTools.AESEncrypt(JSON.stringify(config.data),configApp.REQ_PWD)
|
||||
console.log("[调用请求加密服务][请求地址:"+config.url+"][加密前报文:]",JSON.stringify(config.data))
|
||||
config.data = {"data": encrypt }
|
||||
console.log("[调用请求加密服务][请求地址:"+config.url+"][加密后报文:]",config.data)
|
||||
}
|
||||
}
|
||||
config.headers['token'] = CacheUtils.getLocItem('token')
|
||||
@@ -47,7 +44,6 @@ service.interceptors.request.use(
|
||||
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 => {
|
||||
@@ -64,9 +60,7 @@ service.interceptors.response.use(
|
||||
let res = response.data
|
||||
if( configApp.API_VERSION == 'v2' && response.config.url && response.headers['content-type'].match(/application\/json/) && /api\/$/.test(response.config.url.split(configApp.API_VERSION)[0])){
|
||||
if(res.response){// 正常情況返回必有response 节点
|
||||
console.log("[调用请求解密服务][请求地址:"+response.config.url+"][解密前报文:]",JSON.stringify(res.response))
|
||||
res = JSON.parse(AESTools.AESDecrypt(res.response,configApp.REQ_PWD))
|
||||
console.log("[调用请求解密服务][请求地址:"+response.config.url+"][解密后报文:]",res)
|
||||
}
|
||||
}
|
||||
Toast.clear()
|
||||
|
||||
@@ -35,7 +35,7 @@ switch (process.env.VUE_APP_FLAG) {
|
||||
API_VERSION = 'v2'
|
||||
break
|
||||
case 'prd':
|
||||
apiDomain = 'https://iagentsales.e-guofu.com/api/v1'
|
||||
apiDomain = 'https://iagentsales.e-guofu.com/api/v2'
|
||||
imgDomain = 'https://iagentsales-ud.e-guofu.com:8553/updown'
|
||||
assetsUrl = 'https://iagentsales-sr.e-guofu.com:8443/'
|
||||
mainUrl = 'https://iagentsales.e-guofu.com'
|
||||
|
||||
Reference in New Issue
Block a user