faet: 跳帧跳转
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import req from '@utils/request'
|
||||
import { message } from 'antd'
|
||||
import React, { Fragment, useState } from 'react'
|
||||
import React, { Fragment, useEffect, useState } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { RankingType, apiName } from '../../constant'
|
||||
import { mockRankingModuleList } from '../../mock'
|
||||
@@ -23,20 +23,20 @@ const ContributionList = props => {
|
||||
})
|
||||
.then(res => {
|
||||
if (res.data && res.data.length > 0) {
|
||||
this.setState({
|
||||
contributionList: res.data,
|
||||
isLoading: false
|
||||
})
|
||||
setLoading(false)
|
||||
setContributionList(res.data)
|
||||
} else {
|
||||
this.setState({
|
||||
contributionList: [],
|
||||
isLoading: false
|
||||
})
|
||||
setLoading(false)
|
||||
setContributionList([])
|
||||
}
|
||||
})
|
||||
.catch(err => console.log(err))
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
getContributeList()
|
||||
}, [])
|
||||
|
||||
/**
|
||||
* 切换排行榜
|
||||
* @param {*} index
|
||||
|
@@ -3,6 +3,7 @@ import React, { Component, Fragment } from 'react'
|
||||
import { RankingType, apiName } from '../../constant'
|
||||
import { mockRankingModuleList } from '../../mock'
|
||||
import RankingBox from '../ranking-box'
|
||||
// import {} from 'react-router-dom'
|
||||
|
||||
class PracticeList extends Component {
|
||||
constructor(props) {
|
||||
@@ -15,7 +16,7 @@ class PracticeList extends Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.getPracticeRankList()
|
||||
// this.getPracticeRankList()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,7 +49,6 @@ class PracticeList extends Component {
|
||||
* @returns
|
||||
*/
|
||||
onChangeRanking = index => {
|
||||
console.log(index, 'practice index')
|
||||
this.setState({
|
||||
contributeType: index
|
||||
})
|
||||
@@ -58,7 +58,7 @@ class PracticeList extends Component {
|
||||
* 去练题
|
||||
*/
|
||||
onChangeJump = () => {
|
||||
this.props.history.push('/practice-questions')
|
||||
window.open('/practice-questions', '_blank')
|
||||
}
|
||||
|
||||
render() {
|
||||
|
@@ -30,7 +30,7 @@ export default function RankingBox(props) {
|
||||
// props.onHandleJump && props.onHandleJump()
|
||||
})
|
||||
const tabList =
|
||||
rankingType === 1
|
||||
rankingType === 2
|
||||
? [
|
||||
{
|
||||
tab: '本月排行',
|
||||
|
@@ -15,7 +15,7 @@ export const apiName = {
|
||||
/**
|
||||
* 练题排行榜
|
||||
*/
|
||||
getPracticeRankList: '/getContributeList'
|
||||
getContributeList: '/getContributeList'
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -36,14 +36,14 @@ export const RankingType = {
|
||||
* 模块名称
|
||||
*/
|
||||
export const RankingTypeText = {
|
||||
[RankingType.contribution]: '综合练习榜',
|
||||
[RankingType.practice]: '出题贡献榜'
|
||||
[RankingType.practice]: '综合练习榜',
|
||||
[RankingType.contribution]: '出题贡献榜'
|
||||
}
|
||||
|
||||
/**
|
||||
* 对应按钮名字
|
||||
*/
|
||||
export const RankingTypeBtnText = {
|
||||
[RankingType.contribution]: '去练习',
|
||||
[RankingType.practice]: '去出题'
|
||||
[RankingType.contribution]: '去出题',
|
||||
[RankingType.practice]: '去练习'
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@ import QuestionList from '@components/question-list'
|
||||
import req from '@utils/request'
|
||||
import { memo, useEffect, useState } from 'react'
|
||||
import ContributionList from './components/contribution-list'
|
||||
import RankingList from './components/practice-list'
|
||||
import PracticeList from './components/practice-list'
|
||||
import { apiName } from './constant'
|
||||
import './index.less'
|
||||
|
||||
@@ -132,8 +132,8 @@ const QuestionBank = () => {
|
||||
</div>
|
||||
</div>
|
||||
<div className='ranking-box'>
|
||||
<RankingList />
|
||||
<ContributionList />
|
||||
<PracticeList />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
@@ -6,42 +6,42 @@ export const mockRankingModuleList = [
|
||||
{
|
||||
id: 1,
|
||||
wechatName: 'jcdw',
|
||||
headImg:
|
||||
createUserAvatar:
|
||||
'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg1.doubanio.com%2Fview%2Fnote%2Flarge%2Fpublic%2Fp37015927.jpg&refer=http%3A%2F%2Fimg1.doubanio.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1699286185&t=00db8ff5a1e11783f6c8eba954a5891f',
|
||||
name: '鸡翅大王1',
|
||||
count: 160
|
||||
createUser: '鸡翅大王1',
|
||||
subjectCount: 160
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
wechatName: 'jcdw1',
|
||||
headImg:
|
||||
createUserAvatar:
|
||||
'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg1.doubanio.com%2Fview%2Fnote%2Flarge%2Fpublic%2Fp37015927.jpg&refer=http%3A%2F%2Fimg1.doubanio.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1699286185&t=00db8ff5a1e11783f6c8eba954a5891f',
|
||||
name: '鸡翅大王2',
|
||||
count: 140
|
||||
createUser: '鸡翅大王2',
|
||||
subjectCount: 140
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
wechatName: 'jcdw2',
|
||||
headImg:
|
||||
createUserAvatar:
|
||||
'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg1.doubanio.com%2Fview%2Fnote%2Flarge%2Fpublic%2Fp37015927.jpg&refer=http%3A%2F%2Fimg1.doubanio.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1699286185&t=00db8ff5a1e11783f6c8eba954a5891f',
|
||||
name: '鸡翅大王',
|
||||
count: 101
|
||||
createUser: '鸡翅大王',
|
||||
subjectCount: 101
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
wechatName: 'jcdw3',
|
||||
headImg:
|
||||
createUserAvatar:
|
||||
'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg1.doubanio.com%2Fview%2Fnote%2Flarge%2Fpublic%2Fp37015927.jpg&refer=http%3A%2F%2Fimg1.doubanio.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1699286185&t=00db8ff5a1e11783f6c8eba954a5891f',
|
||||
name: '鸡翅小王',
|
||||
count: 100
|
||||
createUser: '鸡翅小王',
|
||||
subjectCount: 100
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
wechatName: 'jcdw4',
|
||||
headImg:
|
||||
createUserAvatar:
|
||||
'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg1.doubanio.com%2Fview%2Fnote%2Flarge%2Fpublic%2Fp37015927.jpg&refer=http%3A%2F%2Fimg1.doubanio.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1699286185&t=00db8ff5a1e11783f6c8eba954a5891f',
|
||||
name: '鸡翅大王5',
|
||||
count: 99
|
||||
createUser: '鸡翅大王5',
|
||||
subjectCount: 99
|
||||
}
|
||||
]
|
||||
},
|
||||
|
Reference in New Issue
Block a user