Commit 9d34350f by zhanghaozhe

ai-test

parent 1299fa3c
import React, {Component} from 'react'
import {HeaderBar} from '@/common'
import {http} from '@/utils'
import React, { Component } from 'react'
import { HeaderBar } from '@/common'
import { http } from '@/utils'
import './index.scss'
import QRCode from 'qrcode'
import html2canvas from 'html2canvas'
import scoreIconL from '@assets/image/score_icon-l.png'
import scoreIconR from '@assets/image/score_icon-r.png'
import scoreReportBg from '@assets/image/scoreReport_bg.png'
import {connect} from "react-redux"
import { connect } from "react-redux"
@connect(state => ({
user: state.user,
......@@ -23,7 +23,7 @@ class scoreReport extends Component {
myRankList: '',
imgUrl: '',
codeSrc: '',
avatar_file: ''
avatar_file: '',
}
}
......@@ -92,14 +92,8 @@ class scoreReport extends Component {
http.get(`${API.home}/sys/at/user_score/${index}`).then(res => {
const {code, data} = res.data
if (code === 200) {
const {user, history} = this.props
if (user.hasError) {
history.push('/passport')
return
}
this.setState({
myRankList: data
myRankList: data,
})
let avatar = this.props.user && this.props.user.data.avatar
......@@ -107,6 +101,11 @@ class scoreReport extends Component {
setTimeout(() => {
this.getCanvas()
}, 500)
} else if (code === 4030) {
const {user, history} = this.props
if (user.hasError) {
history.push('/passport')
}
}
})
}
......
......@@ -6,6 +6,7 @@ import storage from 'store2'
import { html } from '@/utils'
import { compareDesc } from "date-fns";
import { Link } from "react-router-dom";
import { connect } from "react-redux";
class Scores extends Component {
......@@ -48,9 +49,11 @@ class Scores extends Component {
componentDidMount() {
this.getInitialData()
this.getRankList(null, 0)
if (!this.props.user.hasError) {
this.getUserScores(0)
this.getUserAddress()
}
}
handleChange = (e) => {
const isNeverSHow = e.target.checked
......@@ -171,6 +174,7 @@ class Scores extends Component {
userAddress,
entryButtonInRule,
} = this.state
const {user, history} = this.props
const _rankList = Array.isArray(rankList) ? isExpandRankList ? rankList : rankList.slice(0, 10) : []
return (
<div className={'scores'}>
......@@ -202,7 +206,14 @@ class Scores extends Component {
</tr>
</thead>
<tbody>
<tr>
{
user.hasError
? <tr>
<td>--</td>
<td>--</td>
<td>--</td>
</tr>
: <tr>
{
userScore.score === '-' ? '-' :
<td>{userScore.score} <Link to={`/ai-test/analysis/${userScore.r_id}`}>解析</Link></td>
......@@ -212,6 +223,7 @@ class Scores extends Component {
userScore.rank === '-' ? '-' : <td>{userScore.rank}</td>
}
</tr>
}
</tbody>
</table>
</div>
......@@ -231,9 +243,13 @@ class Scores extends Component {
<div>
<span>仅显示前50</span>
<a href="javascript:void(0);" onClick={() => {
if(user.hasError){
history.push('/passport')
}else {
this.setState({
isShowUserAddress: true,
})
}
}}>收货地址</a>
</div>
</div>
......@@ -386,4 +402,7 @@ function Rule({neverShow, isNeverShow, rule, close, startTest, entryButtonInRule
}
export default Scores;
\ No newline at end of file
export default connect(
({user}) => ({user}),
null,
)(Scores);
\ No newline at end of file
......@@ -50,6 +50,10 @@
background-color: $blue-bg;
}
th{
width: 33.333333%;
}
}
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