feat: 修改样式

This commit is contained in:
秋水浮尘
2024-04-16 22:39:15 +08:00
parent f84a199e5c
commit 00f2d0baf7
4 changed files with 32 additions and 60 deletions

View File

@@ -1,25 +1,23 @@
// 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 { useNavigate } from 'react-router-dom'
import './index.less'
const { Search } = Input
const tabList = [
{
key: '0',
key: '1',
tab: '默认'
},
{
key: '2',
tab: '最新'
},
{
key: '3',
tab: '最热'
}
// {
// key: '1',
// tab: '最新'
// },
// {
// key: '2',
// tab: '最热'
// }
]
const PaperView = props => {
@@ -28,16 +26,14 @@ const PaperView = props => {
const [spinning, setSpinning] = useState(false)
const [paperList, setPaperList] = useState([])
const [orderType, setOrderType] = useState(0)
const [orderType, setOrderType] = useState('1')
const [pageInfo, setPageInfo] = useState({
total: 0,
pageIndex: 1
})
const [searchText, setSearchText] = useState('')
useEffect(() => {
getPreSetContent()
}, [props.type])
}, [type, orderType])
const getPreSetContent = () => {
let api = '/practice/set/getPreSetContent'
@@ -50,6 +46,9 @@ const PaperView = props => {
pageSize: 8
}
}
if (type !== 'unfinish') {
params.orderType = orderType
}
req(
{
method: 'post',
@@ -65,6 +64,8 @@ const PaperView = props => {
total: res.data.total
})
setPaperList(res.data.result || [])
} else {
setPaperList([])
}
})
.catch(err => console.log(err))
@@ -83,29 +84,21 @@ const PaperView = props => {
const handleJump = setId => navigate('/practise-detail/' + setId)
const onSearch = value => {
setSearchText(value)
}
return (
<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-cardlist'>
<Card
style={{ width: '100%' }}
tabList={tabList}
tabList={type === 'unfinish' ? null : tabList}
bordered={false}
activeTabKey={tabList.key}
onTabChange={onTabChange}
>
<div className='ant-card-body'>
<div
className='ant-card-body-box'
style={{ justifyContent: paperList?.length ? 'flex-start' : 'center' }}
>
{paperList?.length > 0 ? (
paperList.map((item, index) => {
return (

View File

@@ -5,11 +5,10 @@
.paper-box-cardlist {
border-radius: 3px;
margin-bottom: 10px;
.ant-card-body {
.ant-card-body-box {
padding: 20px 10px;
display: flex;
flex-wrap: wrap;
.paper-box-cardlist-body-item {
height: 190px;
width: 210px;

View File

@@ -25,11 +25,7 @@ function getItem(
const PracticeQuestions = () => {
const [selectKeys, setSelectKeys] = useState(['1'])
const menuItems = [
getItem('专项练习', '1'),
getItem('模拟套卷', '2', '', [getItem('后端', '2-1'), getItem('前端', '2-2')]),
getItem('我未完成', '3')
]
const menuItems = [getItem('专项练习', '1'), getItem('模拟套卷', '2'), getItem('我未完成', '3')]
const clickMenu = ({ key }: { key: string }) => {
setSelectKeys([key])
@@ -38,9 +34,8 @@ const PracticeQuestions = () => {
const renderPage = () => {
const pageMap = {
'1': <FrontEnd />,
'2-1': <PaperEnd type='backend' />,
'2-2': <PaperEnd />,
'3': <PaperEnd type='unfinish' />
'2': <PaperEnd type='backend' key='backend' />,
'3': <PaperEnd type='unfinish' key='unfinish' />
}
return pageMap[selectKeys[0]]
}

View File

@@ -27,31 +27,16 @@ export default function RankingBox(props) {
} else {
message.info('敬请期待')
}
// props.onHandleJump && props.onHandleJump()
})
const tabList =
rankingType === 2
? [
{
tab: '本月排行',
key: 'month'
},
{
tab: '总榜',
key: 'total'
}
]
: [
{
tab: '总榜',
key: 'total'
}
]
const tabList = [
{
tab: '总榜',
key: 'total'
}
]
// 获得当前下标的数据
let rankingList = contributionList || []
console.log(rankingList, 'rank list ')
return (
<div className='ranking-list-box'>
<div className='ranking-list-header'>