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