Commit c768c3b5 by FE

rank length is 0

parent ee2358a8
......@@ -21,13 +21,14 @@ class TreasureRank extends Component {
http.get(`${API.home}/sys/treasure/ranking`).then(res => {
const { code, data } = res.data;
if(code === 200) {
if(JSON.stringify(data) !== '{}') {
if(data.length > 5) {
this.setState({
rank: data.filter((item, index) => index < 5),
rankList: data,
isMore: true,
});
}else {
}else if() {
this.setState({
rank: data,
rankList: data,
......@@ -35,6 +36,7 @@ class TreasureRank extends Component {
});
}
}
}
});
}
......@@ -56,6 +58,9 @@ class TreasureRank extends Component {
render() {
const { rank, isMore } = this.state;
return (
<>
{
rank.length !== 0 &&
<div data-skip="rank">
<div className="rank-title">
<i className="rank-title__decorate"></i>
......@@ -102,6 +107,8 @@ class TreasureRank extends Component {
</div>
</div>
</div>
}
</>
)
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment