feat: 修改样式
This commit is contained in:
@@ -1,25 +1,23 @@
|
|||||||
// import req from '@utils/request'
|
// import req from '@utils/request'
|
||||||
import req from '@utils/request'
|
import req from '@utils/request'
|
||||||
import { Card, Empty, Input, Pagination, Spin, Tooltip } from 'antd'
|
import { Card, Empty, Pagination, Spin, Tooltip } from 'antd'
|
||||||
import React, { useEffect, useState } from 'react'
|
import React, { useEffect, useState } from 'react'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import './index.less'
|
import './index.less'
|
||||||
|
|
||||||
const { Search } = Input
|
|
||||||
|
|
||||||
const tabList = [
|
const tabList = [
|
||||||
{
|
{
|
||||||
key: '0',
|
key: '1',
|
||||||
tab: '默认'
|
tab: '默认'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: '2',
|
||||||
|
tab: '最新'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: '3',
|
||||||
|
tab: '最热'
|
||||||
}
|
}
|
||||||
// {
|
|
||||||
// key: '1',
|
|
||||||
// tab: '最新'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// key: '2',
|
|
||||||
// tab: '最热'
|
|
||||||
// }
|
|
||||||
]
|
]
|
||||||
|
|
||||||
const PaperView = props => {
|
const PaperView = props => {
|
||||||
@@ -28,16 +26,14 @@ const PaperView = props => {
|
|||||||
|
|
||||||
const [spinning, setSpinning] = useState(false)
|
const [spinning, setSpinning] = useState(false)
|
||||||
const [paperList, setPaperList] = useState([])
|
const [paperList, setPaperList] = useState([])
|
||||||
const [orderType, setOrderType] = useState(0)
|
const [orderType, setOrderType] = useState('1')
|
||||||
const [pageInfo, setPageInfo] = useState({
|
const [pageInfo, setPageInfo] = useState({
|
||||||
total: 0,
|
total: 0,
|
||||||
pageIndex: 1
|
pageIndex: 1
|
||||||
})
|
})
|
||||||
const [searchText, setSearchText] = useState('')
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getPreSetContent()
|
getPreSetContent()
|
||||||
}, [props.type])
|
}, [type, orderType])
|
||||||
|
|
||||||
const getPreSetContent = () => {
|
const getPreSetContent = () => {
|
||||||
let api = '/practice/set/getPreSetContent'
|
let api = '/practice/set/getPreSetContent'
|
||||||
@@ -50,6 +46,9 @@ const PaperView = props => {
|
|||||||
pageSize: 8
|
pageSize: 8
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (type !== 'unfinish') {
|
||||||
|
params.orderType = orderType
|
||||||
|
}
|
||||||
req(
|
req(
|
||||||
{
|
{
|
||||||
method: 'post',
|
method: 'post',
|
||||||
@@ -65,6 +64,8 @@ const PaperView = props => {
|
|||||||
total: res.data.total
|
total: res.data.total
|
||||||
})
|
})
|
||||||
setPaperList(res.data.result || [])
|
setPaperList(res.data.result || [])
|
||||||
|
} else {
|
||||||
|
setPaperList([])
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(err => console.log(err))
|
.catch(err => console.log(err))
|
||||||
@@ -83,29 +84,21 @@ const PaperView = props => {
|
|||||||
|
|
||||||
const handleJump = setId => navigate('/practise-detail/' + setId)
|
const handleJump = setId => navigate('/practise-detail/' + setId)
|
||||||
|
|
||||||
const onSearch = value => {
|
|
||||||
setSearchText(value)
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Spin spinning={spinning}>
|
<Spin spinning={spinning}>
|
||||||
{/* <div className='paper-box-search'>
|
|
||||||
<Search
|
|
||||||
placeholder='请输入试卷名'
|
|
||||||
onSearch={onSearch}
|
|
||||||
style={{ width: 300, borderRadius: '10px' }}
|
|
||||||
/>
|
|
||||||
</div> */}
|
|
||||||
<div className='paper-box'>
|
<div className='paper-box'>
|
||||||
<div className='paper-box-cardlist'>
|
<div className='paper-box-cardlist'>
|
||||||
<Card
|
<Card
|
||||||
style={{ width: '100%' }}
|
style={{ width: '100%' }}
|
||||||
tabList={tabList}
|
tabList={type === 'unfinish' ? null : tabList}
|
||||||
bordered={false}
|
bordered={false}
|
||||||
activeTabKey={tabList.key}
|
activeTabKey={tabList.key}
|
||||||
onTabChange={onTabChange}
|
onTabChange={onTabChange}
|
||||||
>
|
>
|
||||||
<div className='ant-card-body'>
|
<div
|
||||||
|
className='ant-card-body-box'
|
||||||
|
style={{ justifyContent: paperList?.length ? 'flex-start' : 'center' }}
|
||||||
|
>
|
||||||
{paperList?.length > 0 ? (
|
{paperList?.length > 0 ? (
|
||||||
paperList.map((item, index) => {
|
paperList.map((item, index) => {
|
||||||
return (
|
return (
|
||||||
|
@@ -5,11 +5,10 @@
|
|||||||
.paper-box-cardlist {
|
.paper-box-cardlist {
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
.ant-card-body {
|
.ant-card-body-box {
|
||||||
padding: 20px 10px;
|
padding: 20px 10px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
|
||||||
.paper-box-cardlist-body-item {
|
.paper-box-cardlist-body-item {
|
||||||
height: 190px;
|
height: 190px;
|
||||||
width: 210px;
|
width: 210px;
|
||||||
|
@@ -25,11 +25,7 @@ function getItem(
|
|||||||
const PracticeQuestions = () => {
|
const PracticeQuestions = () => {
|
||||||
const [selectKeys, setSelectKeys] = useState(['1'])
|
const [selectKeys, setSelectKeys] = useState(['1'])
|
||||||
|
|
||||||
const menuItems = [
|
const menuItems = [getItem('专项练习', '1'), getItem('模拟套卷', '2'), getItem('我未完成', '3')]
|
||||||
getItem('专项练习', '1'),
|
|
||||||
getItem('模拟套卷', '2', '', [getItem('后端', '2-1'), getItem('前端', '2-2')]),
|
|
||||||
getItem('我未完成', '3')
|
|
||||||
]
|
|
||||||
|
|
||||||
const clickMenu = ({ key }: { key: string }) => {
|
const clickMenu = ({ key }: { key: string }) => {
|
||||||
setSelectKeys([key])
|
setSelectKeys([key])
|
||||||
@@ -38,9 +34,8 @@ const PracticeQuestions = () => {
|
|||||||
const renderPage = () => {
|
const renderPage = () => {
|
||||||
const pageMap = {
|
const pageMap = {
|
||||||
'1': <FrontEnd />,
|
'1': <FrontEnd />,
|
||||||
'2-1': <PaperEnd type='backend' />,
|
'2': <PaperEnd type='backend' key='backend' />,
|
||||||
'2-2': <PaperEnd />,
|
'3': <PaperEnd type='unfinish' key='unfinish' />
|
||||||
'3': <PaperEnd type='unfinish' />
|
|
||||||
}
|
}
|
||||||
return pageMap[selectKeys[0]]
|
return pageMap[selectKeys[0]]
|
||||||
}
|
}
|
||||||
|
@@ -27,31 +27,16 @@ export default function RankingBox(props) {
|
|||||||
} else {
|
} else {
|
||||||
message.info('敬请期待')
|
message.info('敬请期待')
|
||||||
}
|
}
|
||||||
// props.onHandleJump && props.onHandleJump()
|
|
||||||
})
|
})
|
||||||
const tabList =
|
const tabList = [
|
||||||
rankingType === 2
|
{
|
||||||
? [
|
tab: '总榜',
|
||||||
{
|
key: 'total'
|
||||||
tab: '本月排行',
|
}
|
||||||
key: 'month'
|
]
|
||||||
},
|
|
||||||
{
|
|
||||||
tab: '总榜',
|
|
||||||
key: 'total'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
: [
|
|
||||||
{
|
|
||||||
tab: '总榜',
|
|
||||||
key: 'total'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
// 获得当前下标的数据
|
// 获得当前下标的数据
|
||||||
let rankingList = contributionList || []
|
let rankingList = contributionList || []
|
||||||
|
|
||||||
console.log(rankingList, 'rank list ')
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='ranking-list-box'>
|
<div className='ranking-list-box'>
|
||||||
<div className='ranking-list-header'>
|
<div className='ranking-list-header'>
|
||||||
|
Reference in New Issue
Block a user