Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mes-pad
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ximai
mes-pad
Commits
97faa944
Commit
97faa944
authored
Apr 21, 2024
by
张海景
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update:修改统一传参处理
parent
b237daa6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
http.interceptor.js
common/http.interceptor.js
+2
-0
ruoyi.js
utils/ruoyi.js
+19
-0
No files found.
common/http.interceptor.js
View file @
97faa944
...
...
@@ -2,6 +2,7 @@
* Copyright (c) 2013-Now http://aidex.vip All rights reserved.
*/
// 此处第二个参数vm,就是我们在页面使用的this,你可以通过vm获取vuex等操作
import
{
filterObj
}
from
'@/utils/ruoyi'
const
install
=
(
Vue
,
vm
)
=>
{
// 通用请求头设定
const
ajaxHeader
=
'x-ajax'
;
...
...
@@ -21,6 +22,7 @@ const install = (Vue, vm) => {
// 请求拦截,配置Token等参数
Vue
.
prototype
.
$u
.
http
.
interceptor
.
request
=
(
req
)
=>
{
req
.
data
=
filterObj
(
req
.
data
);
if
(
!
req
.
header
)
{
req
.
header
=
[];
}
...
...
utils/ruoyi.js
View file @
97faa944
...
...
@@ -224,6 +224,25 @@ export function tansParams(params) {
return
result
}
/**
* 过滤对象中为空的属性
* @param obj
* @returns {*}
*/
export
function
filterObj
(
obj
)
{
if
(
!
(
typeof
obj
===
'object'
))
{
return
}
for
(
const
key
in
obj
)
{
if
(
obj
.
hasOwnProperty
(
key
)
&&
(
obj
[
key
]
===
null
||
obj
[
key
]
===
undefined
))
{
obj
[
key
]
=
''
}
}
return
obj
}
// 验证是否为blob格式
export
async
function
blobValidate
(
data
)
{
try
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment