|
@@ -1,6 +1,7 @@
|
|
import uni from '@/utils/uniHooks';
|
|
import uni from '@/utils/uniHooks';
|
|
import { getUTMSource } from '@/utils/utils';
|
|
import { getUTMSource } from '@/utils/utils';
|
|
import axios, { AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
import axios, { AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
|
|
+import {md} from '@/utils/common'
|
|
// import { Message } from 'element-ui';
|
|
// import { Message } from 'element-ui';
|
|
// import { jumpLogin } from '@/utils';
|
|
// import { jumpLogin } from '@/utils';
|
|
// import { Loading } from 'element-ui';
|
|
// import { Loading } from 'element-ui';
|
|
@@ -20,6 +21,7 @@ const CONTENT_TYPE_ARRAY = {
|
|
};
|
|
};
|
|
|
|
|
|
function getHeaders(config = {}) {
|
|
function getHeaders(config = {}) {
|
|
|
|
+ console.log(24, '接口返送出去的config', config);
|
|
const { contentType = 'json' } = config;
|
|
const { contentType = 'json' } = config;
|
|
const ct = CONTENT_TYPE_ARRAY[contentType];
|
|
const ct = CONTENT_TYPE_ARRAY[contentType];
|
|
let header = {
|
|
let header = {
|
|
@@ -140,8 +142,19 @@ function XUser(config) {
|
|
console.log(140140140140, params);
|
|
console.log(140140140140, params);
|
|
return JSON.stringify(params);
|
|
return JSON.stringify(params);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+function getSign(config) {
|
|
|
|
+ let params = {}
|
|
|
|
+ if(config.method === 'get' && config?.params) {
|
|
|
|
+ params = config.params
|
|
|
|
+ }
|
|
|
|
+ if(config.method === 'post' && config?.data) {
|
|
|
|
+ params = JSON.parse(config.data)
|
|
|
|
+ }
|
|
|
|
+ const newHeader = md(params, true)
|
|
|
|
+ return newHeader
|
|
|
|
+}
|
|
export const createAxiosByinterceptors = (config) => {
|
|
export const createAxiosByinterceptors = (config) => {
|
|
|
|
+ console.log('接口返送出去的config', config);
|
|
const instance = axios.create({
|
|
const instance = axios.create({
|
|
timeout: 100000, //超时配置
|
|
timeout: 100000, //超时配置
|
|
baseURL: `${window.profileApi}/temporary-parking-service`,
|
|
baseURL: `${window.profileApi}/temporary-parking-service`,
|
|
@@ -154,12 +167,13 @@ export const createAxiosByinterceptors = (config) => {
|
|
function (config) {
|
|
function (config) {
|
|
// 在发送请求之前做些什么
|
|
// 在发送请求之前做些什么
|
|
const { loading = true } = config;
|
|
const { loading = true } = config;
|
|
- console.log('configconfig:', config);
|
|
|
|
|
|
+ console.log('接口返送出去的config160:', config);
|
|
if (loading) addLoading();
|
|
if (loading) addLoading();
|
|
// 设置 headers
|
|
// 设置 headers
|
|
config.headers = {
|
|
config.headers = {
|
|
...config.headers,
|
|
...config.headers,
|
|
...handleConfig().header,
|
|
...handleConfig().header,
|
|
|
|
+ ...getSign(config),
|
|
'XConversationId': uuidv4(),
|
|
'XConversationId': uuidv4(),
|
|
'X-User': XUser(config),
|
|
'X-User': XUser(config),
|
|
};
|
|
};
|