From 00f2d0baf75ac498b2ee4c5fc05bc8660f15ea79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E6=B0=B4=E6=B5=AE=E5=B0=98?= <18510549872@163.comm> Date: Tue, 16 Apr 2024 22:39:15 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/paper-end/index.jsx | 51 ++++++++----------- .../components/paper-end/index.less | 3 +- .../practise/practise-questions/index.tsx | 11 ++-- .../components/ranking-box/index.jsx | 27 +++------- 4 files changed, 32 insertions(+), 60 deletions(-) diff --git a/src/views/practise/practise-questions/components/paper-end/index.jsx b/src/views/practise/practise-questions/components/paper-end/index.jsx index 76b3483..62b8c99 100644 --- a/src/views/practise/practise-questions/components/paper-end/index.jsx +++ b/src/views/practise/practise-questions/components/paper-end/index.jsx @@ -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 ( - {/*
- -
*/}
-
+
{paperList?.length > 0 ? ( paperList.map((item, index) => { return ( diff --git a/src/views/practise/practise-questions/components/paper-end/index.less b/src/views/practise/practise-questions/components/paper-end/index.less index 1d0a755..875f5b0 100644 --- a/src/views/practise/practise-questions/components/paper-end/index.less +++ b/src/views/practise/practise-questions/components/paper-end/index.less @@ -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; diff --git a/src/views/practise/practise-questions/index.tsx b/src/views/practise/practise-questions/index.tsx index 980a1d1..e9acd19 100644 --- a/src/views/practise/practise-questions/index.tsx +++ b/src/views/practise/practise-questions/index.tsx @@ -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': , - '2-1': , - '2-2': , - '3': + '2': , + '3': } return pageMap[selectKeys[0]] } diff --git a/src/views/question-bank/components/ranking-box/index.jsx b/src/views/question-bank/components/ranking-box/index.jsx index f713983..3f972ee 100644 --- a/src/views/question-bank/components/ranking-box/index.jsx +++ b/src/views/question-bank/components/ranking-box/index.jsx @@ -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 (