diff --git a/src/components/category-list/index.jsx b/src/components/category-list/index.jsx index efec0c5..4f48e5e 100644 --- a/src/components/category-list/index.jsx +++ b/src/components/category-list/index.jsx @@ -1,12 +1,6 @@ import React, { Fragment, useEffect, useState } from 'react' -import { - CaretDownOutlined, - CaretUpOutlined, - DownOutlined, - RightOutlined, - UpOutlined -} from '@ant-design/icons' +import { CaretDownOutlined, CaretUpOutlined, RightOutlined } from '@ant-design/icons' import req from '@utils/request' import { Divider, Modal, Spin } from 'antd' import _ from 'lodash' @@ -283,7 +277,7 @@ const CategoryList = ({ primaryCategoryId, categoryList, ...props }) => { ) })} - {secondCategoryItem.children.length > 5 ? ( + {/* {secondCategoryItem.children.length > 5 ? (
{ {secondCategoryItem.isOpen ? : }
- ) : null} + ) : null} */} )} diff --git a/src/components/question-list/index.jsx b/src/components/question-list/index.jsx index c720fc9..c9f0fb4 100644 --- a/src/components/question-list/index.jsx +++ b/src/components/question-list/index.jsx @@ -1,33 +1,40 @@ -import React, { Fragment, useState } from "react"; -import { Tag, Table, Input, Radio, Space, Button, Divider } from "antd"; -import { filterDifficulty, gradeObject } from "@constants"; -import { useNavigate } from "react-router-dom"; -import "./index.less"; +import { filterDifficulty, gradeObject } from '@constants' +import { Button, Input, Radio, Space, Table, Tag } from 'antd' +import React, { Fragment, useState } from 'react' +import { useNavigate } from 'react-router-dom' +import './index.less' -const { Search } = Input; +const { Search } = Input -const colors = ['#ffffb8', '#f4ffb8', '#b5f5ec', '#bae0ff', '#d9f7be', '#efdbff', ' #ffd6e7', '#d6e4ff'] - - -const QuestionList = (props) => { +const colors = [ + '#ffffb8', + '#f4ffb8', + '#b5f5ec', + '#bae0ff', + '#d9f7be', + '#efdbff', + ' #ffd6e7', + '#d6e4ff' +] +const QuestionList = props => { const [difficuty, setDifficuty] = useState(0) - const navigate = useNavigate(); + const navigate = useNavigate() const RandomNumBoth = (Min, Max) => { //差值 - const Range = Max - Min; + const Range = Max - Min // 随机数 - const Rand = Math.random(); - return Min + Math.round(Rand * Range); //四舍五入 + const Rand = Math.random() + return Min + Math.round(Rand * Range) //四舍五入 } - const handleSearch = (close) => { + const handleSearch = close => { props.changeDifficuty(difficuty) close() } - const changeDifficuty = (e) => { + const changeDifficuty = e => { setDifficuty(e.target.value) } @@ -36,69 +43,88 @@ const QuestionList = (props) => { */ const questionColumns = [ { - title:
题目
- (当前 - {props.total || 0} - 道题) -
, - key: "questionNo", - align: "centlefter", + title: ( +
+ 题目{' '} +
+ (当前 + {props.total || 0} + 道题) +
+
+ ), + key: 'questionNo', + align: 'centlefter', render: (item, record) => { return ( -
-
- {record.id}: {record.subjectName} -
-
+
+
{record.subjectName}
+
{item?.labelName?.length > 0 && - item.labelName.map((tagsItem) => { + item.labelName.map(tagsItem => { return ( -
+
{tagsItem}
- ); + ) })}
- ); - }, + ) + } }, { - title: "难度", - dataIndex: "subjectDifficult", - key: "subjectDifficult", - align: "center", + title: '难度', + dataIndex: 'subjectDifficult', + key: 'subjectDifficult', + align: 'center', filterDropdown: ({ close }) => ( -
e.stopPropagation()}> -
请选择
- - - { - filterDifficulty.map(item => { - return {item.title} - }) - } +
e.stopPropagation()}> +
+ 请选择 +
+ + + {filterDifficulty.map(item => { + return ( + + {item.title} + + ) + })} -
), +
+ ), width: 90, - render: (key) => { - return ( - {gradeObject?.[key]?.title} - ); - }, - }, - ]; + render: key => { + return {gradeObject?.[key]?.title} + } + } + ] /** * 进入详情 @@ -106,61 +132,57 @@ const QuestionList = (props) => { * @param {*} type * @returns */ - const onChangeAction = (item) => () => { - navigate("/brush-question/" + item.id) + const onChangeAction = item => () => { + navigate('/brush-question/' + item.id) // let { isNotToDetail } = props; - // !isNotToDetail && + // !isNotToDetail && // if (!isNotToDetail) return; - }; - + } /** * 过滤框-搜索框-模块 * @returns */ const renderFilterContainer = () => { - const { total, isShowSearch, setSearchStr } = props; + const { total, isShowSearch, setSearchStr } = props return ( -
+
{isShowSearch && ( setSearchStr(value)} + placeholder='请输入感兴趣的内容~' + onSearch={value => setSearchStr(value)} style={{ width: 240 }} allowClear - size="small" + size='small' /> )}
- ); - }; + ) + } - const { questionList, isHideSelect } = props; + const { questionList, isHideSelect } = props return ( -
+
{!isHideSelect && renderFilterContainer()} -
+
{ return { - onClick: onChangeAction(record, index), // 点击行 - }; + onClick: onChangeAction(record, index) // 点击行 + } }} columns={questionColumns} dataSource={questionList} - rowKey="id" + rowKey='id' pagination={false} - rowClassName="question-table-row" + rowClassName='question-table-row' /> - ); - - + ) } - -export default QuestionList; +export default QuestionList diff --git a/src/components/top-menu/index.jsx b/src/components/top-menu/index.jsx index cb11af8..4f93719 100644 --- a/src/components/top-menu/index.jsx +++ b/src/components/top-menu/index.jsx @@ -1,38 +1,37 @@ -import { message } from 'antd'; -import React, { useState, memo, useEffect } from 'react' -import { useLocation, useNavigate } from 'react-router-dom'; +import { message } from 'antd' +import React, { memo, useEffect, useState } from 'react' +import { useLocation, useNavigate } from 'react-router-dom' import './index.less' // 顶部tab const MENULIST = [ { key: 'questionBank', title: '刷题', - route: '/question-bank', + route: '/question-bank' }, { key: 'prictiseQuestion', title: '练题', - route: '/brush-question', + route: '/brush-question' }, { key: 'practiceQuestions', title: '鸡圈', - route: '/practice-questions', + route: '/practice-questions' }, { key: 'interList', title: '模拟面试', - route: '/inter-list', - }, + route: '/inter-list' + } ] // 顶部tab映射 const mapMenu = { - '/question-bank': 'questionBank', + '/question-bank': 'questionBank' } const TopMenu = () => { - const [currentKey, setCurrentKey] = useState('questionBank') const location = useLocation() const navigate = useNavigate() @@ -44,26 +43,29 @@ const TopMenu = () => { } else { setCurrentKey('') } - }, [location.pathname]); - + }, [location.pathname]) /** * 切换item * @param {*} item * @returns */ - const changeMenu = (item) => () => { - if (item.key === "questionBank") { + const changeMenu = item => () => { + const userInfoStorage = localStorage.getItem('userInfo') + if (!userInfoStorage) { + return message.info('请登录') + } + if (item.key === 'questionBank') { if (location.pathname === '/question-bank') return navigate('/question-bank') setCurrentKey(item.key) } else { - return message.info("敬请期待") + return message.info('敬请期待') } } return ( -
+
{MENULIST.map((item, index) => { return (
{ key={item.key + index} onClick={changeMenu(item)} > -
{item.title}
-
+
{item.title}
+
) })} diff --git a/src/imgs/login_bg.jpg b/src/imgs/login_bg.jpg index dd241f9..4d7132d 100644 Binary files a/src/imgs/login_bg.jpg and b/src/imgs/login_bg.jpg differ diff --git a/src/views/header/index.tsx b/src/views/header/index.tsx index 1beefac..1970d95 100644 --- a/src/views/header/index.tsx +++ b/src/views/header/index.tsx @@ -1,64 +1,68 @@ -import { Input, Dropdown, message } from 'antd'; -import Logo from '@/imgs/logo.jpg' import Head from '@/imgs/head.jpg' +import Logo from '@/imgs/logo.jpg' +import { HeartOutlined, LikeOutlined, LoginOutlined, UserOutlined } from '@ant-design/icons' import TopMenu from '@components/top-menu' -import { UserOutlined, HeartOutlined, LikeOutlined, LoginOutlined } from '@ant-design/icons' -import { useNavigate } from "react-router-dom"; +import { Dropdown, Input, message } from 'antd' +import { useNavigate } from 'react-router-dom' -const { Search } = Input; +const { Search } = Input const menuItems = [ - { - label: '个人中心', - key: 1, - icon: - }, - { - label: '我的收藏', - key: 2, - icon: - }, { - label: '我的点赞', - key: 3, - icon: - }, - { - type: 'divider', - }, - { - label: '退出', - key: 4, - icon: - } + { + label: '个人中心', + key: 1, + icon: + }, + { + label: '我的收藏', + key: 2, + icon: + }, + { + label: '我的点赞', + key: 3, + icon: + }, + { + type: 'divider' + }, + { + label: '退出', + key: 4, + icon: + } ] const Header = () => { - const { pathname } = window.location; - const navigate = useNavigate() + const { pathname } = window.location + const navigate = useNavigate() - const handleMenuClick = e => { - if (e.key != 1) { - return message.info('敬请期待') - } - navigate('/user-info') - } + const handleMenuClick = e => { + const userInfoStorage = localStorage.getItem('userInfo') + if (!userInfoStorage) { + return message.info('请登录') + } + if (e.key != 1) { + return message.info('敬请期待') + } + navigate('/user-info') + } - return ( -
-
-
-
- (window.location.href = '/question-bank') - }> - -
- -
-
-
- {/* {'/question-bank' == pathname && ( + return ( +
+
+
+
(window.location.href = '/question-bank')} + > + +
+ +
+
+
+ {/* {'/question-bank' == pathname && (
{ />
)} */} - {/*
*/} - {/* */} - {/*
*/} -
- - - - -
-
-
-
- ) + {/*
*/} + {/* */} + {/*
*/} +
+ + + +
+
+
+
+ ) } -export default Header \ No newline at end of file +export default Header diff --git a/src/views/login/index.less b/src/views/login/index.less index 7be6d1f..6d40523 100644 --- a/src/views/login/index.less +++ b/src/views/login/index.less @@ -1,6 +1,6 @@ .login-box { width: 100%; - height: calc(100% - 100px); + height: 100%; background: url(../../imgs/login_bg.jpg) no-repeat 50%; background-size: cover; min-height: 600px; diff --git a/src/views/login/index.tsx b/src/views/login/index.tsx index fed0a22..98cba84 100644 --- a/src/views/login/index.tsx +++ b/src/views/login/index.tsx @@ -40,11 +40,7 @@ const Login = () => { return (
-
- LeNet-5 诞生 1998 年 11 月,早期经典卷积神经网络 LeNet-5 - 诞生。杨立昆、莱昂·伯托等发表经典论文“Gradient-Based Learning Applied to Document - Recognition”,文章总结了应用于手写字符识别的各种模型并进行了比对,结果显示卷积神经网络表现超群。 -
+

微信扫码关注公众号