Commit 9d34350f by zhanghaozhe

ai-test

parent 1299fa3c
...@@ -6,6 +6,7 @@ import storage from 'store2' ...@@ -6,6 +6,7 @@ import storage from 'store2'
import { html } from '@/utils' import { html } from '@/utils'
import { compareDesc } from "date-fns"; import { compareDesc } from "date-fns";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { connect } from "react-redux";
class Scores extends Component { class Scores extends Component {
...@@ -48,8 +49,10 @@ class Scores extends Component { ...@@ -48,8 +49,10 @@ class Scores extends Component {
componentDidMount() { componentDidMount() {
this.getInitialData() this.getInitialData()
this.getRankList(null, 0) this.getRankList(null, 0)
this.getUserScores(0) if (!this.props.user.hasError) {
this.getUserAddress() this.getUserScores(0)
this.getUserAddress()
}
} }
handleChange = (e) => { handleChange = (e) => {
...@@ -171,6 +174,7 @@ class Scores extends Component { ...@@ -171,6 +174,7 @@ class Scores extends Component {
userAddress, userAddress,
entryButtonInRule, entryButtonInRule,
} = this.state } = this.state
const {user, history} = this.props
const _rankList = Array.isArray(rankList) ? isExpandRankList ? rankList : rankList.slice(0, 10) : [] const _rankList = Array.isArray(rankList) ? isExpandRankList ? rankList : rankList.slice(0, 10) : []
return ( return (
<div className={'scores'}> <div className={'scores'}>
...@@ -202,16 +206,24 @@ class Scores extends Component { ...@@ -202,16 +206,24 @@ class Scores extends Component {
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> {
{ user.hasError
userScore.score === '-' ? '-' : ? <tr>
<td>{userScore.score} <Link to={`/ai-test/analysis/${userScore.r_id}`}>解析</Link></td> <td>--</td>
} <td>--</td>
<td>{userScore.cost_time}</td> <td>--</td>
{ </tr>
userScore.rank === '-' ? '-' : <td>{userScore.rank}</td> : <tr>
} {
</tr> userScore.score === '-' ? '-' :
<td>{userScore.score} <Link to={`/ai-test/analysis/${userScore.r_id}`}>解析</Link></td>
}
<td>{userScore.cost_time}</td>
{
userScore.rank === '-' ? '-' : <td>{userScore.rank}</td>
}
</tr>
}
</tbody> </tbody>
</table> </table>
</div> </div>
...@@ -231,9 +243,13 @@ class Scores extends Component { ...@@ -231,9 +243,13 @@ class Scores extends Component {
<div> <div>
<span>仅显示前50</span> <span>仅显示前50</span>
<a href="javascript:void(0);" onClick={() => { <a href="javascript:void(0);" onClick={() => {
this.setState({ if(user.hasError){
isShowUserAddress: true, history.push('/passport')
}) }else {
this.setState({
isShowUserAddress: true,
})
}
}}>收货地址</a> }}>收货地址</a>
</div> </div>
</div> </div>
...@@ -386,4 +402,7 @@ function Rule({neverShow, isNeverShow, rule, close, startTest, entryButtonInRule ...@@ -386,4 +402,7 @@ function Rule({neverShow, isNeverShow, rule, close, startTest, entryButtonInRule
} }
export default Scores; export default connect(
\ No newline at end of file ({user}) => ({user}),
null,
)(Scores);
\ No newline at end of file
...@@ -50,6 +50,10 @@ ...@@ -50,6 +50,10 @@
background-color: $blue-bg; background-color: $blue-bg;
} }
th{
width: 33.333333%;
}
} }
th { th {
......
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