|
@@ -22,7 +22,7 @@ import { showFullScreenLoading, tryHideFullScreenLoading } from './loading'
|
|
|
|
|
|
|
|
import requestState from '@/constants/state'
|
|
import requestState from '@/constants/state'
|
|
|
import { BASE_API, BASE_GATEWAY_API } from '@/api/baseUrl'
|
|
import { BASE_API, BASE_GATEWAY_API } from '@/api/baseUrl'
|
|
|
-import { HEADER_TOKEN_KEY, HEADER_SYSTEM_ID, HEADER_TENANT_ID, MULTIPLE_DOMAIN, API_DOMAIN_NAMES } from '@/constant'
|
|
|
|
|
|
|
+import { HEADER_TOKEN_KEY, HEADER_SYSTEM_ID, HEADER_TENANT_ID, MULTIPLE_DOMAIN, API_DOMAIN_NAMES, ENCRYPT_GET_PARAMS } from '@/constant'
|
|
|
|
|
|
|
|
const TIMEOUT = 3000 * 100 // 请求超时(timeout)时间
|
|
const TIMEOUT = 3000 * 100 // 请求超时(timeout)时间
|
|
|
/**
|
|
/**
|
|
@@ -88,13 +88,20 @@ service.interceptors.request.use(async config => {
|
|
|
if (config.isLoading) {
|
|
if (config.isLoading) {
|
|
|
showFullScreenLoading(config.loading)
|
|
showFullScreenLoading(config.loading)
|
|
|
}
|
|
}
|
|
|
- // 防止缓存
|
|
|
|
|
- // if (config.method.toUpperCase() === 'GET') {
|
|
|
|
|
- // config.params = {
|
|
|
|
|
- // ...config.params,
|
|
|
|
|
- // _t: Date.parse(new Date()) / 1000
|
|
|
|
|
- // }
|
|
|
|
|
- // }
|
|
|
|
|
|
|
+ // 防止缓存,参数加密
|
|
|
|
|
+ if (config.method.toUpperCase() === 'GET') {
|
|
|
|
|
+ if (ENCRYPT_GET_PARAMS) {
|
|
|
|
|
+ config.params = {
|
|
|
|
|
+ _p: Utils.isNotEmpty(config.params) ? encryptByAes(JSON.stringify(config.params)) : undefined,
|
|
|
|
|
+ _t: Date.parse(new Date()) / 1000
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ config.params = {
|
|
|
|
|
+ ...config.params,
|
|
|
|
|
+ _t: Date.parse(new Date()) / 1000
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// 判断是否需要token
|
|
// 判断是否需要token
|
|
|
if (whiteList.indexOf(config.url) !== -1) {
|
|
if (whiteList.indexOf(config.url) !== -1) {
|