Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
Ygopro Arena Web
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Ygopro Arena Web
Commits
57c7d822
Commit
57c7d822
authored
Jul 13, 2023
by
Tang Xinwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "纠正api.js中的错误"
This reverts commit
b849e68c
.
parent
b849e68c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
+31
-0
src/components/Profile.vue
src/components/Profile.vue
+31
-0
No files found.
src/components/Profile.vue
View file @
57c7d822
...
@@ -319,6 +319,37 @@ export default {
...
@@ -319,6 +319,37 @@ export default {
});
});
// 每月决斗记录数据获取
var
monthly
=
[];
function
fetchData
(
username
,
monthOffset
)
{
var
date
=
moment
().
subtract
(
monthOffset
,
'
months
'
).
format
(
'
YYYY-MM
'
);
// 发送请求获取数据
var
opt
=
{
username
:
username
,
season
:
date
};
return
API
.
getMonthlyHistory
(
opt
)
.
then
(
response
=>
{
const
res
=
response
.
data
;
// 判断是否有返回数据
if
(
res
&&
res
.
length
>
0
)
{
// 将每次收到的数据按照season从今日往更早的顺序存储在monthly数组中
console
.
log
(
opt
);
console
.
log
(
res
);
monthly
.
unshift
(...
res
);
// 继续请求前一个月的数据
return
fetchData
(
username
,
monthOffset
+
1
);
}
else
{
// 当不再返回数据时,结束递归,并返回最终的monthly数组
console
.
log
(
opt
);
console
.
log
(
'
之后没数据了
'
);
return
monthly
;
}});}
// 调用递归函数开始请求数据
fetchData
(
username
,
-
1
);
console
.
log
(
111
)
console
.
log
(
monthly
)
var
_this
=
this
;
var
_this
=
this
;
API
.
getFirstWin
({
username
:
username
}).
then
((
res
)
=>
{
API
.
getFirstWin
({
username
:
username
}).
then
((
res
)
=>
{
...
...
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