fix: 微服务版本 区间查询和中文搜索条件一起使用 无法正确查询
This commit is contained in:
parent
827ef2e403
commit
48ca7aca8c
@ -13,6 +13,7 @@
|
||||
**BUG FIXES**
|
||||
|
||||
- 操作日志详情 在description组件中json预览样式异常
|
||||
- 微服务版本 区间查询和中文搜索条件一起使用 无法正确查询
|
||||
|
||||
# 1.1.2
|
||||
|
||||
|
@ -10,6 +10,7 @@ import {
|
||||
authenticateResponseInterceptor,
|
||||
errorMessageResponseInterceptor,
|
||||
RequestClient,
|
||||
stringify,
|
||||
} from '@vben/request';
|
||||
import { useAccessStore } from '@vben/stores';
|
||||
|
||||
@ -94,6 +95,23 @@ function createRequestClient(baseURL: string) {
|
||||
// 添加全局clientId
|
||||
config.headers.clientId = clientId;
|
||||
|
||||
/**
|
||||
* 格式化get/delete参数
|
||||
* 如果包含自定义的paramsSerializer则不走此逻辑
|
||||
*/
|
||||
if (
|
||||
['DELETE', 'GET'].includes(config.method?.toUpperCase() || '') &&
|
||||
config.params &&
|
||||
!config.paramsSerializer
|
||||
) {
|
||||
/**
|
||||
* 1. 格式化参数 微服务在传递区间时间选择(后端的params Map类型参数)需要格式化key 否则接收不到
|
||||
* 2. 数组参数需要格式化 后端才能正常接收 会变成arr=1&arr=2&arr=3的格式来接收
|
||||
*/
|
||||
config.paramsSerializer = (params) =>
|
||||
stringify(params, { arrayFormat: 'repeat' });
|
||||
}
|
||||
|
||||
const { encrypt } = config;
|
||||
// 全局开启请求加密功能 && 该请求开启 && 是post/put请求
|
||||
if (
|
||||
|
@ -22,9 +22,11 @@
|
||||
"dependencies": {
|
||||
"@vben/locales": "workspace:*",
|
||||
"@vben/utils": "workspace:*",
|
||||
"axios": "catalog:"
|
||||
"axios": "catalog:",
|
||||
"qs": "^6.13.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/qs": "^6.9.17",
|
||||
"axios-mock-adapter": "catalog:"
|
||||
}
|
||||
}
|
||||
|
@ -1,2 +1,3 @@
|
||||
export * from './request-client';
|
||||
export * from 'axios';
|
||||
export { stringify } from 'qs';
|
||||
|
Loading…
Reference in New Issue
Block a user