Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
marketing
Overview
Overview
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
marketing-web
marketing
Commits
9a0c7c9c
Commit
9a0c7c9c
authored
Jan 04, 2022
by
黑潮
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update: 修复重复请求
parent
ffc67a7c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
1 deletions
+19
-1
index.js
src/service/api/index.js
+13
-0
group-send.vue
src/views/card/group-send.vue
+4
-0
form.js
src/views/ecm/form.js
+2
-1
No files found.
src/service/api/index.js
View file @
9a0c7c9c
...
...
@@ -89,6 +89,8 @@ function handlerErr(code, message = '请求错误', alertError = true) {
}
}
const
pendingRequest
=
new
Map
();
/**
* 请求地址,请求数据,是否静默,请求方法
*/
...
...
@@ -111,6 +113,16 @@ const requests = (url, data = {}, contentTypeIsJSON = false, isSilence = false,
}
else
{
_opts
.
params
=
_query
;
}
let
key
=
JSON
.
stringify
(
_opts
);
if
(
!
pendingRequest
.
has
(
key
))
{
pendingRequest
.
set
(
key
,
Date
.
now
());
}
else
if
(
Date
.
now
()
-
pendingRequest
.
get
(
key
)
>
1000
)
{
pendingRequest
.
delete
(
key
);
}
else
{
return
Promise
.
reject
();
}
return
new
Promise
((
resolve
,
reject
)
=>
{
let
_random
=
{
stamp
:
Date
.
now
(),
url
:
`
${
_apiHost
+
url
}
`
};
if
(
!
isSilence
)
{
...
...
@@ -138,6 +150,7 @@ const requests = (url, data = {}, contentTypeIsJSON = false, isSilence = false,
.
catch
(
res
=>
{
clearTimeout
(
_timer
);
popRequest
(
_random
);
pendingRequest
.
delete
(
key
);
if
(
res
)
{
handlerErr
(
res
.
response
.
status
,
'接口异常'
,
alertError
);
}
...
...
src/views/card/group-send.vue
View file @
9a0c7c9c
...
...
@@ -626,6 +626,7 @@ export default {
if
(
this
.
$route
.
meta
.
type
===
'edit'
)
{
params
.
coupCardPutOnId
=
this
.
$route
.
params
.
id
;
// 投放主键ID, 新建不传; 修改传
}
this
.
loading
=
true
;
saveUpdatePutonCard
(
params
)
.
then
(
res
=>
{
if
(
res
.
errorCode
===
0
)
{
...
...
@@ -639,16 +640,19 @@ export default {
this
.
$router
.
push
(
'/card/record/send?new=1'
);
})
.
catch
(
err
=>
{
this
.
loading
=
false
;
this
.
getCardPutonDetail
();
});
}
else
{
this
.
$router
.
push
(
'/card/record/send?new=1'
);
}
}
else
{
this
.
loading
=
false
;
this
.
$tips
({
type
:
'error'
,
message
:
'操作失败'
});
}
})
.
catch
(
err
=>
{
this
.
loading
=
false
;
this
.
$tips
({
type
:
'error'
,
message
:
'操作失败'
});
});
},
...
...
src/views/ecm/form.js
View file @
9a0c7c9c
...
...
@@ -992,7 +992,6 @@ export default {
this
.
loading
=
true
;
saveEcmInfo
(
params
)
.
then
(
res
=>
{
this
.
loading
=
false
;
if
(
res
.
errorCode
===
0
)
{
if
(
this
.
isEdit
)
{
this
.
$confirm
(
'操作成功, 是否返回列表?'
,
'提示'
,
{
...
...
@@ -1004,12 +1003,14 @@ export default {
this
.
$router
.
push
(
'/ecm/list'
);
})
.
catch
(
err
=>
{
this
.
loading
=
false
;
this
.
getEcmInfo
();
});
}
else
{
this
.
$router
.
push
(
'/ecm/list'
);
}
}
else
{
this
.
loading
=
false
;
this
.
$tips
({
type
:
'error'
,
message
:
res
.
message
||
'操作失败'
});
}
})
...
...
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