Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sts网站
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
liyang
sts网站
Commits
d58942c5
Commit
d58942c5
authored
Aug 21, 2023
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
防重复提交数据大小限制(I7KZDA)
parent
6a742e1d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
request.js
ruoyi-ui/src/utils/request.js
+6
-0
No files found.
ruoyi-ui/src/utils/request.js
View file @
d58942c5
...
@@ -42,6 +42,12 @@ service.interceptors.request.use(config => {
...
@@ -42,6 +42,12 @@ service.interceptors.request.use(config => {
data
:
typeof
config
.
data
===
'object'
?
JSON
.
stringify
(
config
.
data
)
:
config
.
data
,
data
:
typeof
config
.
data
===
'object'
?
JSON
.
stringify
(
config
.
data
)
:
config
.
data
,
time
:
new
Date
().
getTime
()
time
:
new
Date
().
getTime
()
}
}
const
requestSize
=
Object
.
keys
(
JSON
.
stringify
(
requestObj
)).
length
;
// 请求数据大小
const
limitSize
=
5
*
1024
*
1024
;
// 限制存放数据5M
if
(
requestSize
>=
limitSize
)
{
console
.
warn
(
`[
${
config
.
url
}
]: `
+
'请求数据大小超出允许的5M限制,无法进行防重复提交验证。'
)
return
config
;
}
const
sessionObj
=
cache
.
session
.
getJSON
(
'sessionObj'
)
const
sessionObj
=
cache
.
session
.
getJSON
(
'sessionObj'
)
if
(
sessionObj
===
undefined
||
sessionObj
===
null
||
sessionObj
===
''
)
{
if
(
sessionObj
===
undefined
||
sessionObj
===
null
||
sessionObj
===
''
)
{
cache
.
session
.
setJSON
(
'sessionObj'
,
requestObj
)
cache
.
session
.
setJSON
(
'sessionObj'
,
requestObj
)
...
...
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