Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mr-julyedu
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
baiguangyao
mr-julyedu
Commits
c768c3b5
Commit
c768c3b5
authored
Dec 16, 2019
by
FE
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rank length is 0
parent
ee2358a8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
57 deletions
+64
-57
src/components/activity/newyear-2019/treasure-box/rank.js
+64
-57
No files found.
src/components/activity/newyear-2019/treasure-box/rank.js
View file @
c768c3b5
...
...
@@ -21,18 +21,20 @@ class TreasureRank extends Component {
http
.
get
(
`
${
API
.
home
}
/sys/treasure/ranking`
).
then
(
res
=>
{
const
{
code
,
data
}
=
res
.
data
;
if
(
code
===
200
)
{
if
(
data
.
length
>
5
)
{
this
.
setState
({
rank
:
data
.
filter
((
item
,
index
)
=>
index
<
5
),
rankList
:
data
,
isMore
:
true
,
});
}
else
{
this
.
setState
({
rank
:
data
,
rankList
:
data
,
isMore
:
false
,
});
if
(
JSON
.
stringify
(
data
)
!==
'{}'
)
{
if
(
data
.
length
>
5
)
{
this
.
setState
({
rank
:
data
.
filter
((
item
,
index
)
=>
index
<
5
),
rankList
:
data
,
isMore
:
true
,
});
}
else
if
()
{
this
.
setState
({
rank
:
data
,
rankList
:
data
,
isMore
:
false
,
});
}
}
}
});
...
...
@@ -56,52 +58,57 @@ class TreasureRank extends Component {
render
()
{
const
{
rank
,
isMore
}
=
this
.
state
;
return
(
<
div
data
-
skip
=
"rank"
>
<
div
className
=
"rank-title"
>
<
i
className
=
"rank-title__decorate"
><
/i
>
<
h2
className
=
"rank-title__txt"
>
宝箱达人榜
<
/h2
>
<
i
className
=
"rank-title__decorate"
><
/i
>
<
/div
>
<
p
className
=
"rank-desc"
>
宝箱数量前
50
名可额外获得一份奖品,数量相同的用时短者排名在前
<
/p
>
<
dl
className
=
"rank-header"
>
<
dd
className
=
"rank-column"
>
排名
<
/dd
>
<
dd
className
=
"rank-column"
>
用户
<
/dd
>
<
dd
className
=
"rank-column"
>
宝箱数量
<
/dd
>
<
dd
className
=
"rank-column"
>
奖品
<
/dd
>
<
/dl
>
<
div
className
=
"rank-body"
>
{
rank
.
map
((
item
,
index
)
=>
(
<
dl
className
=
"rank-item"
key
=
{
index
}
>
<
dd
className
=
"rank-column"
>
{
index
<=
2
?
<
span
className
=
"rank-column__number"
data
-
num
=
{
index
}
><
/span
>
:
<
span
>
{
index
+
1
}
<
/span
>
}
<
/dd
>
<
dd
className
=
"rank-column"
>
<
span
className
=
"rank-column__name"
>
{
item
.
user_name
}
<
/span
>
<
/dd
>
<
dd
className
=
"rank-column"
>
<
span
>
{
item
.
num
}
<
/span
>
<
/dd
>
<
dd
className
=
"rank-column"
>
{
item
.
url
?
<
a
className
=
"rank-column__txt"
href
=
{
item
.
url
}
>
{
item
.
prize_name
}
<
/a
>
:
<
span
className
=
"rank-column__txt"
>
{
item
.
prize_name
}
<
/span
>
}
<
/dd
>
<
/dl
>
))
}
<
div
className
=
"rank-more"
onClick
=
{
this
.
switchMoreRank
}
>
<
span
className
=
"rank-more__txt"
>
{
isMore
?
'展开'
:
'收起'
}
<
/span
>
<
i
className
=
"rank-more__icon"
data
-
more
=
{
isMore
}
><
/i
>
<>
{
rank
.
length
!==
0
&&
<
div
data
-
skip
=
"rank"
>
<
div
className
=
"rank-title"
>
<
i
className
=
"rank-title__decorate"
><
/i
>
<
h2
className
=
"rank-title__txt"
>
宝箱达人榜
<
/h2
>
<
i
className
=
"rank-title__decorate"
><
/i
>
<
/div
>
<
p
className
=
"rank-desc"
>
宝箱数量前
50
名可额外获得一份奖品,数量相同的用时短者排名在前
<
/p
>
<
dl
className
=
"rank-header"
>
<
dd
className
=
"rank-column"
>
排名
<
/dd
>
<
dd
className
=
"rank-column"
>
用户
<
/dd
>
<
dd
className
=
"rank-column"
>
宝箱数量
<
/dd
>
<
dd
className
=
"rank-column"
>
奖品
<
/dd
>
<
/dl
>
<
div
className
=
"rank-body"
>
{
rank
.
map
((
item
,
index
)
=>
(
<
dl
className
=
"rank-item"
key
=
{
index
}
>
<
dd
className
=
"rank-column"
>
{
index
<=
2
?
<
span
className
=
"rank-column__number"
data
-
num
=
{
index
}
><
/span
>
:
<
span
>
{
index
+
1
}
<
/span
>
}
<
/dd
>
<
dd
className
=
"rank-column"
>
<
span
className
=
"rank-column__name"
>
{
item
.
user_name
}
<
/span
>
<
/dd
>
<
dd
className
=
"rank-column"
>
<
span
>
{
item
.
num
}
<
/span
>
<
/dd
>
<
dd
className
=
"rank-column"
>
{
item
.
url
?
<
a
className
=
"rank-column__txt"
href
=
{
item
.
url
}
>
{
item
.
prize_name
}
<
/a
>
:
<
span
className
=
"rank-column__txt"
>
{
item
.
prize_name
}
<
/span
>
}
<
/dd
>
<
/dl
>
))
}
<
div
className
=
"rank-more"
onClick
=
{
this
.
switchMoreRank
}
>
<
span
className
=
"rank-more__txt"
>
{
isMore
?
'展开'
:
'收起'
}
<
/span
>
<
i
className
=
"rank-more__icon"
data
-
more
=
{
isMore
}
><
/i
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/
div
>
}
<
/
>
)
}
}
...
...
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