From 3218fccf7c6e331aad27827b84310995c55d3c10 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, 14 Nov 2023 00:52:40 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=96=87=E6=A1=88=E5=8F=8A=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 29 +- src/App.tsx | 22 +- src/assets/base.less | 13 +- src/components/category-list/index.jsx | 6 +- src/components/category-list/index.less | 354 +++++++++--------- .../good-collection-error/index.jsx | 120 +++--- src/components/question-list/index.less | 152 ++++---- src/constants/index.ts | 6 - src/utils/request.ts | 1 - src/views/brush-questions/constant.ts | 10 +- src/views/brush-questions/index.less | 200 ++++------ .../components/ranking-box/index.less | 6 - src/views/question-bank/index.tsx | 352 ++++++++--------- .../components/repeat-content-box/index.less | 150 ++++---- .../components/upload-left-layout/index.less | 54 ++- 15 files changed, 702 insertions(+), 773 deletions(-) diff --git a/index.html b/index.html index 0b9623e..de19e4e 100644 --- a/index.html +++ b/index.html @@ -1,17 +1,18 @@ - + + + + + - - - - + 鸡翅CLUB + - Vite App - - - -
- - - - \ No newline at end of file + +
+ + + diff --git a/src/App.tsx b/src/App.tsx index 8576cb0..2a8fbc5 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,20 +1,30 @@ -import { useEffect, memo } from 'react'; -import './App.less'; -import { useLocation, useNavigate, Outlet } from 'react-router-dom'; import Header from '@views/header' +import { memo, useEffect } from 'react' +import { Outlet, useLocation, useNavigate } from 'react-router-dom' +import './App.less' const App = () => { - const location = useLocation(); + const location = useLocation() const navigate = useNavigate() useEffect(() => { if (location.pathname === '/') { + const userInfoStorage = localStorage.getItem('userInfo') + if (!userInfoStorage) { + return window.location.replace('/login') + } navigate('/question-bank') } }, [location]) return ( -
+
-
+
diff --git a/src/assets/base.less b/src/assets/base.less index becfb70..d774bb2 100644 --- a/src/assets/base.less +++ b/src/assets/base.less @@ -1,4 +1,4 @@ -@import "normalize.less"; +@import 'normalize.less'; * { box-sizing: border-box; @@ -8,7 +8,8 @@ body, html { - font-family: -apple-system, "宋体","微软雅黑"; + font-family: -apple-system, 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', + '微软雅黑', Arial, sans-serif; width: 100%; height: 100%; color: #666666; @@ -26,7 +27,7 @@ a { display: block; clear: both; height: 0; - content: ""; + content: ''; } .arrow-right { @@ -43,7 +44,7 @@ a { //修改input高亮的问题 .ant-input-affix-wrapper { &:hover { - border-color: none!important; + border-color: none !important; } } @@ -51,11 +52,11 @@ a { box-shadow: none; } -.ant-input:focus, .ant-input:hover { +.ant-input:focus, +.ant-input:hover { border-color: #d9d9d9; } .ant-input-affix-wrapper:hover .ant-input:not(.ant-input-disabled) { border: 1px solid #d9d9d9; } - diff --git a/src/components/category-list/index.jsx b/src/components/category-list/index.jsx index 4f48e5e..4fd2963 100644 --- a/src/components/category-list/index.jsx +++ b/src/components/category-list/index.jsx @@ -305,6 +305,7 @@ const CategoryList = ({ primaryCategoryId, categoryList, ...props }) => { dashed style={{ marginTop: 10, + marginBottom: 10, fontSize: 13, cursor: 'pointer' }} @@ -326,11 +327,6 @@ const CategoryList = ({ primaryCategoryId, categoryList, ...props }) => {
{categoryList?.length && renderFirstContainer()} {secondCategoryList?.length > 0 && renderSecondContainer()} - {/* {!this.props.isHideSec && ( - - {secondCategoryList?.length > 0 && this.renderSecondContainer()} - - )} */} { + .then(res => { if (res.data) { this.setState({ isGood: res.data.isThump, goodAmount: res.data.thumpCount, isCollection: res.data.isCollect, - collectionAmount: res.data.collectCount, + collectionAmount: res.data.collectCount }) } }) - .catch((err) => console.log(err)) + .catch(err => console.log(err)) } /** * 点击纠错按钮 */ handleModal = () => { + return message.info('敬请期待') this.setState({ - isModal: true, + isModal: true }) } /** @@ -77,20 +77,20 @@ export default class GoodCollectionError extends Component { let params = { subjectId: questionId, errorType: value, - errorMsg: inputValue, + errorMsg: inputValue } if (inputValue.length === 0) { message.warning('请填写纠错详情!') } else { this.setState({ isModal: false, - inputValue: '', + inputValue: '' }) message.success('感谢纠错,立即更改!') - JDreq({ + req({ method: 'post', data: params, - url: '/admin/question/subjectError/add', + url: '/admin/question/subjectError/add' }) } } @@ -100,25 +100,25 @@ export default class GoodCollectionError extends Component { handleCancel = () => { this.setState({ isModal: false, - inputValue: '', + inputValue: '' }) } /** * * @param {选择纠错类型} e */ - handleChangeRadio = (e) => { + handleChangeRadio = e => { this.setState({ - value: e.target.value, + value: e.target.value }) } /** * * @param {纠错详情中填写内容} e */ - handleChangeInput = (e) => { + handleChangeInput = e => { this.setState({ - inputValue: e.target.value, + inputValue: e.target.value }) } /** @@ -130,19 +130,19 @@ export default class GoodCollectionError extends Component { const { isGood, goodAmount } = this.state const { questionId } = this.props let params = { - subjectId: questionId, + subjectId: questionId } this.setState( { isGood: isGood === true ? false : true, - goodAmount: isGood === true ? goodAmount - 1 : goodAmount + 1, + goodAmount: isGood === true ? goodAmount - 1 : goodAmount + 1 }, () => { - JDreq({ + req({ method: 'post', data: params, - url: 'admin/question/thump/addOrCancel', - }).catch((err) => console.log(err)) + url: 'admin/question/thump/addOrCancel' + }).catch(err => console.log(err)) } ) } @@ -154,62 +154,68 @@ export default class GoodCollectionError extends Component { const { isCollection, collectionAmount } = this.state const { questionId } = this.props let params = { - subjectId: questionId, + subjectId: questionId } this.setState( { isCollection: isCollection === true ? false : true, - collectionAmount: isCollection === true ? collectionAmount - 1 : collectionAmount + 1, + collectionAmount: isCollection === true ? collectionAmount - 1 : collectionAmount + 1 }, () => { req({ method: 'post', data: params, - url: 'admin/question/collect/addOrCancel', - }).catch((err) => console.log(err)) + url: 'admin/question/collect/addOrCancel' + }).catch(err => console.log(err)) } ) } render() { const { isCollection, isGood, isModal, value, collectionAmount, goodAmount } = this.state return ( -
+
{ this.handleChangeGood() }} > - ({goodAmount}) + + ({goodAmount})
{ this.handleChangeCollection() }} > - ( - {collectionAmount}) + + ({collectionAmount})
{/*
评论
*/}
{ - console.log('111') this.handleModal() }} > - + 纠错
{ this.handleOk() @@ -217,25 +223,25 @@ export default class GoodCollectionError extends Component { onCancel={() => { this.handleCancel() }} - okText="确认" - cancelText="取消" + okText='确认' + cancelText='取消' style={{ fontWeight: 500 }} >
-
纠错类型
-
+
纠错类型
+
{this.errorType.map((item, index) => { return ( -
+
{ + onChange={e => { this.handleChangeRadio(e) }} defaultValue={1} - buttonStyle="solid" + buttonStyle='solid' value={value} > - + {item.content} @@ -243,14 +249,14 @@ export default class GoodCollectionError extends Component { ) })}
-
纠错详情
+
纠错详情