feat: 修改部分文案及删除多余内容

This commit is contained in:
秋水浮尘
2023-11-14 00:52:40 +08:00
parent 13f794caea
commit 3218fccf7c
15 changed files with 702 additions and 773 deletions

View File

@@ -1,17 +1,18 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/src/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
/>
<title>Vite App</title>
</head>
<title>鸡翅CLUB</title>
</head>
<body>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</body>
</html>

View File

@@ -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 (
<div className="app-main" style={{ padding: location.pathname === '/login' ? '66px 0 0' : '66px 16px 32px' }}>
<div
className='app-main'
style={{ padding: location.pathname === '/login' ? '66px 0 0' : '66px 16px 32px' }}
>
<Header />
<div className='content-box' style={{ width: location.pathname === '/login' ? '100%' : '1439px' }}>
<div
className='content-box'
style={{ width: location.pathname === '/login' ? '100%' : '1439px' }}
>
<Outlet />
</div>
</div>

View File

@@ -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;
}

View File

@@ -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 }) => {
<div className='category-box'>
<Fragment>{categoryList?.length && renderFirstContainer()}</Fragment>
<Fragment>{secondCategoryList?.length > 0 && renderSecondContainer()}</Fragment>
{/* {!this.props.isHideSec && (
<Fragment>
{secondCategoryList?.length > 0 && this.renderSecondContainer()}
</Fragment>
)} */}
<Modal
open={openMoreFlag}
footer={null}

View File

@@ -65,7 +65,7 @@
display: flex;
align-items: center;
margin-right: 16px;
min-width: 60px;
min-width: 70px;
height: 40px;
font-size: 14px;
color: rgba(0, 0, 0, 0.85);
@@ -90,32 +90,18 @@
margin: 8px 15px 8px 0;
cursor: pointer;
font-size: 14px;
border: 1px solid rgba(0, 0, 0, 0.04);
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: 4px;
// @mixin box-backgroundColor($alpha: 1) {
// background-color: rgba(60, 110, 238, $alpha) !important;
// }
// @mixin box-border($width: 1px, $style: solid, $alpha: 1) {
// border: $width $style rgba(60, 110, 238, $alpha) !important;
// }
// @mixin font-color($alpha: 1) {
// color: rgba(60, 110, 238, $alpha) !important;
// }
&:hover {
background-color: rgba(60, 110, 238, 0.1);
border: 1px solid rgba(60, 110, 238, 1);
color: rgba(60, 110, 238, 1)
color: rgba(60, 110, 238, 1);
}
}
.third-category-item-active {
// @include box-backgroundColor(0.1);
// @include box-border();
// @include font-color();
background-color: rgba(60, 110, 238, 0.1);
border: 1px solid rgba(60, 110, 238, 1);
color: rgba(60, 110, 238, 1)
color: rgba(60, 110, 238, 1);
}
}
.second-category-item-status {
@@ -197,4 +183,4 @@
}
}
}
}
}

View File

@@ -1,8 +1,7 @@
import React, { Component } from 'react'
import { Modal, Input, Radio, message } from 'antd'
import { HeartTwoTone, LikeTwoTone, InfoCircleTwoTone } from '@ant-design/icons'
import { collection, good } from './constant'
import { HeartTwoTone, InfoCircleTwoTone, LikeTwoTone } from '@ant-design/icons'
import req from '@utils/request'
import { Input, Modal, Radio, message } from 'antd'
import React, { Component } from 'react'
import './index.less'
const { TextArea } = Input
@@ -19,19 +18,19 @@ export default class GoodCollectionError extends Component {
isModal: false, //是否显示纠错弹框
value: 1, //纠错类型对应值
inputValue: '', //纠错详情内容
questionId: '', //题目id
questionId: '' //题目id
}
}
/**纠错类型 */
errorType = [
{
value: 1,
content: '答案错误',
content: '答案错误'
},
{
value: 2,
content: '题目与答案不符',
},
content: '题目与答案不符'
}
]
componentDidMount() {
// this.getDetail()
@@ -39,32 +38,33 @@ export default class GoodCollectionError extends Component {
getDetail() {
let params = {
subjectId: this.props.questionId,
subjectId: this.props.questionId
}
req({
method: 'post',
data: params,
url: 'admin/question/collect/getDetail',
url: 'admin/question/collect/getDetail'
})
.then((res) => {
.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 (
<div className="left">
<div className='left'>
<div
className="good"
size="middle"
className='good'
size='middle'
onClick={() => {
this.handleChangeGood()
}}
>
<LikeTwoTone twoToneColor={isGood == false ? 'grey' : 'blue'} style={{ marginRight: 4 }} />({goodAmount})
<LikeTwoTone
twoToneColor={isGood == false ? 'grey' : 'blue'}
style={{ marginRight: 4 }}
/>
({goodAmount})
</div>
<div
className="collection"
className='collection'
onClick={() => {
this.handleChangeCollection()
}}
>
<HeartTwoTone twoToneColor={isCollection == false ? 'grey' : 'blue'} style={{ marginRight: 4 }} />(
{collectionAmount})
<HeartTwoTone
twoToneColor={isCollection == false ? 'grey' : 'blue'}
style={{ marginRight: 4 }}
/>
({collectionAmount})
</div>
{/* <div className="comment">
<MessageTwoTone twoToneColor="blue" style={{ marginRight: 4 }} />
评论
</div> */}
<div
className="error-collection"
className='error-collection'
onClick={() => {
console.log('111')
this.handleModal()
}}
>
<InfoCircleTwoTone twoToneColor="red" style={{ marginRight: 4 }} />
<InfoCircleTwoTone twoToneColor='red' style={{ marginRight: 4 }} />
纠错
</div>
<Modal
className="error-modal"
title="题目纠错"
visible={isModal}
className='error-modal'
title='题目纠错'
open={isModal}
destroyOnClose={true}
onOk={() => {
this.handleOk()
@@ -217,25 +223,25 @@ export default class GoodCollectionError extends Component {
onCancel={() => {
this.handleCancel()
}}
okText="确认"
cancelText="取消"
okText='确认'
cancelText='取消'
style={{ fontWeight: 500 }}
>
<div>
<div className="error-collection-title">纠错类型</div>
<div className="error-collection-type">
<div className='error-collection-title'>纠错类型</div>
<div className='error-collection-type'>
{this.errorType.map((item, index) => {
return (
<div key={index} className="error-collection-type-detail">
<div key={index} className='error-collection-type-detail'>
<Radio.Group
onChange={(e) => {
onChange={e => {
this.handleChangeRadio(e)
}}
defaultValue={1}
buttonStyle="solid"
buttonStyle='solid'
value={value}
>
<Radio.Button value={item.value} className="ll">
<Radio.Button value={item.value} className='ll'>
{item.content}
</Radio.Button>
</Radio.Group>
@@ -243,14 +249,14 @@ export default class GoodCollectionError extends Component {
)
})}
</div>
<div className="error-collection-title">纠错详情</div>
<div className='error-collection-title'>纠错详情</div>
<TextArea
className="error-input"
placeholder="请输入..."
className='error-input'
placeholder='请输入...'
maxLength={256}
rows={4}
showCount={true}
onChange={(e) => {
onChange={e => {
this.handleChangeInput(e)
}}
/>

View File

@@ -69,8 +69,6 @@
padding: 0px 6px;
font-size: 10px !important;
border-radius: 4px;
// @include font-color();
// border: 1px solid rgba(60, 110, 238, 0.6);
}
}
}

View File

@@ -54,9 +54,3 @@ export const gradeObject = {
title: '专家'
}
}
export const imgObject = {
clickImg:
host +
'/jichi/icon/%E7%83%AD%E9%97%A8.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=minioadmin%2F20231102%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20231102T153146Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=e6b8cdb3231b1c3d7114212cb9278ecc17cf6d4ec0f759ea0200e04156d4c8b7'
}

View File

@@ -15,7 +15,6 @@ export const baseHttp = () => {
}
export default function request(config, url) {
console.log(config, url, 'config url')
// const navigate = useNavigate()
const userInfoStorage = localStorage.getItem('userInfo')
const userInfo = userInfoStorage ? JSON.parse(userInfoStorage) : {}

View File

@@ -1,9 +1,9 @@
export const good = {
0:'未点赞',
1:'已点赞',
0: '未点赞',
1: '已点赞'
}
export const collection={
0:'未收藏',
1:'已收藏',
export const collection = {
0: '未收藏',
1: '已收藏'
}

View File

@@ -1,8 +1,6 @@
.brush-questions-box {
width: 1439px;
margin: 0 auto;
// display: flex;
background-color: #fff;
padding: 20px 50px;
border-radius: 5px;
@@ -10,17 +8,13 @@
overflow: auto;
.brush-questions-box,
.question-box {
// display: flex;
// flex: 1;
flex-direction: column;
overflow-y: auto;
background-color: #fff;
border-radius: 8px;
// position: relative;
.question,
.question-content {
display: flex;
// flex: 1;
.question-type,
.question-number {
display: flex;
@@ -30,9 +24,6 @@
}
}
}
// .answer-box{
// }
.question-box {
margin-bottom: 10px;
}
@@ -40,24 +31,19 @@
margin-bottom: 20px;
}
.question-type {
// padding-left: 50px;
color: rgba(60, 110, 238, 1) !important;
font-size: 16px;
}
.question-number {
justify-content: right;
// padding-right: 50px;
color: rgba(60, 110, 238, 1) !important;
font-size: 16px;
font-weight: 600;
// padding:2px 10px;
}
.question-content {
display: flex;
align-items: center;
font-size: 16px;
// padding: 20px 0 20px 30px;
// border-bottom:1px dashed #000
line-height: 35px;
margin-top: 50px;
margin-bottom: 10px;
@@ -98,27 +84,10 @@
margin: 10px 0 10px 700px;
}
// .question-number-box{
// position:absolute;right:0px;
// }
// .right{
// position:absolute;right:0px;
// }
.jump-question {
margin: 0 auto;
text-align: center;
}
// .answer-box,.question-box{
// display: flex;
// flex: 1;
// overflow-y: auto;
// border-radius: 8px;
// // position: relative;
// background-color: rgb(84, 169, 248);
// font-size: 20px;
// height: auto;
// min-height:200px;
// }
.last,
.next {
// background-color: rgba(60, 110, 238,1) !important;
@@ -127,20 +96,7 @@
cursor: pointer;
width: 110px;
height: 46px;
// color: white
}
// .question-type-box,.question-number-box {
// height: 200px;
// line-height: 200px;
// font-size: 30px;
// font-weight: bold;
// color: rgb(84, 169, 248);
// }
// .word{
// font-size: 20px;
// font-weight: bold;
// color: rgb(84, 169, 248);
// }
.last:active,
.next:active {
background-color: rgba(60, 110, 238, 1) !important;

View File

@@ -38,13 +38,9 @@
&:last-child {
margin-right: 0px;
}
&:hover {
// @include font-color();
}
}
.ranking-list-btn-active {
font-weight: 600;
// @include font-color();
border-bottom: 1px solid rgba(60, 110, 238, 1);
}
}
@@ -101,7 +97,6 @@
color: #c3c3c6;
}
&:hover {
// @include box-backgroundColor(0.05);
background-color: rgba(60, 110, 238, 0.05);
}
}
@@ -119,7 +114,6 @@
border-radius: 30px;
box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.1);
background-color: rgba(60, 110, 238, 0.9);
// @include box-backgroundColor(0.9);
.ranking-btn-go-icon {
width: 22px;
height: 22px;

View File

@@ -1,28 +1,26 @@
import { useState, useEffect, memo } from 'react'
import QuestionList from '@components/question-list';
import CategoryList from '@components/category-list';
import ContributionList from './components/contribution-list';
import CategoryList from '@components/category-list'
import QuestionList from '@components/question-list'
import req from '@utils/request'
import { memo, useEffect, useState } from 'react'
import ContributionList from './components/contribution-list'
import RankingList from './components/practice-list'
import { apiName } from './constant';
import req from '@utils/request';
import './index.less';
import { apiName } from './constant'
import './index.less'
const QuestionBank = () => {
const [firstCategoryList, setFirstCategoryList] = useState<Record<string, any>[]>([])
const [questionList, setQuestionList] = useState([])
const [labelList, setLabelList] = useState<string | number>(); // 选中的标签列表
const [difficulty, setDiffculty] = useState(''); //困难度(全部)
const [total, setTotal] = useState(0); // 总条数
const [pageIndex, setPageIndex] = useState(0);
const [primaryCategoryId, setPromaryCategoryId] = useState(''); //第一个大类id
const [labelList, setLabelList] = useState<string | number>() // 选中的标签列表
const [difficulty, setDiffculty] = useState('') //困难度(全部)
const [total, setTotal] = useState(0) // 总条数
const [pageIndex, setPageIndex] = useState(0)
const [primaryCategoryId, setPromaryCategoryId] = useState('') //第一个大类id
const [secondCategoryId, setSecondCategoryId] = useState('')
const [loading, setLoading] = useState(false)
const [finished, setFinished] = useState(false)
const [switchFlag, setSwitchFlag] = useState(false)
/**
* 获取大类分类
*/
@@ -34,7 +32,7 @@ const QuestionBank = () => {
})
.then((res: Record<string, any>) => {
if (res.data && res.data.length > 0) {
setPromaryCategoryId(res.data[0].id);
setPromaryCategoryId(res.data[0].id)
setFirstCategoryList(res.data)
}
})
@@ -53,8 +51,7 @@ const QuestionBank = () => {
setQuestionList([])
setTotal(0)
setPageIndex(1)
};
}
/**
* 选择标签时,请求列表数据
@@ -67,7 +64,7 @@ const QuestionBank = () => {
setQuestionList([])
setTotal(0)
setPageIndex(1)
};
}
const queryQuestionList = () => {
setLoading(true)
@@ -82,14 +79,15 @@ const QuestionBank = () => {
method: 'post',
url: apiName.getSubjectPage,
data: params
}).then(res => {
})
.then(res => {
setLoading(false)
let lastList = [...questionList]
const { total, result } = res.data
const { total = 0, result } = res.data
setTotal(total)
if (result.length) {
lastList = lastList.concat(result)
setQuestionList(lastList)
setTotal(total)
if (result.length < 20 || lastList.length >= total) {
setFinished(true)
} else {
@@ -97,9 +95,11 @@ const QuestionBank = () => {
setSwitchFlag(false)
}
}
}).catch(err => {
})
.catch(err => {
console.log(err)
}).finally(() => {
})
.finally(() => {
setLoading(false)
})
}
@@ -130,11 +130,11 @@ const QuestionBank = () => {
}
const scrollHandler = e => {
let scrollTop = e.target.scrollTop; // listBox 滚动条向上卷曲出去的长度,随滚动变化
let clientHeight = e.target.clientHeight; // listBox 的视口可见高度,固定不变
let scrollHeight = e.target.scrollHeight; // listBox 的整体高度,随数据加载变化
let saveHeight = 30; // 安全距离距离底部XX时触发加载
let tempVal = scrollTop + clientHeight + saveHeight;
let scrollTop = e.target.scrollTop // listBox 滚动条向上卷曲出去的长度,随滚动变化
let clientHeight = e.target.clientHeight // listBox 的视口可见高度,固定不变
let scrollHeight = e.target.scrollHeight // listBox 的整体高度,随数据加载变化
let saveHeight = 30 // 安全距离距离底部XX时触发加载
let tempVal = scrollTop + clientHeight + saveHeight
// 如果不加入 saveHeight 安全距离,在 scrollTop + clientHeight == scrollHeight 时,触发加载
// 加入安全距离,相当于在 scrollTop + clientHeight >= scrollHeight - 30 时,触发加载,比前者更早触发
if (tempVal >= scrollHeight) {
@@ -154,10 +154,10 @@ const QuestionBank = () => {
}
return (
<div className="question-bank-box">
<div className='question-bank-box'>
<div className='mask-box' onScroll={scrollHandler}>
<div className="question-box" >
<div className="category-list-box">
<div className='question-box'>
<div className='category-list-box'>
{firstCategoryList?.length > 0 && (
<CategoryList
onChangeCategory={onChangeCategory}
@@ -169,7 +169,7 @@ const QuestionBank = () => {
/>
)}
</div>
<div className="question-list-box">
<div className='question-list-box'>
<QuestionList
pageIndex={pageIndex}
total={total}
@@ -179,21 +179,21 @@ const QuestionBank = () => {
/>
</div>
<div className='loading-more'>{
questionList.length == 0
? "暂无数据"
<div className='loading-more'>
{questionList.length == 0
? '暂无数据'
: loading && !finished
? "努力加载中..."
: "我是有底线的(:"
}</div>
? '努力加载中...'
: '我是有底线的(:'}
</div>
</div>
<div className="ranking-box">
</div>
<div className='ranking-box'>
<RankingList />
<ContributionList />
</div>
</div>
);
)
}
export default memo(QuestionBank)

View File

@@ -27,16 +27,6 @@
background: #fff;
border: 1px solid #d4d4d4;
border-radius: 4px;
// .repeat-subject-label {
// margin-right: 4px;
// width: 20px;
// height: 20px;
// line-height: 20px;
// text-align: center;
// color: rgba(51, 51, 51, 0.8);
// border-radius: 50%;
// @include box-backgroundColor(0.3);
// }
.repeat-subject-text {
line-height: 22px;
font-size: 14px;

View File

@@ -19,8 +19,6 @@
border: 1px solid rgba(208, 212, 222, 1);
border-radius: 12px;
&:hover {
@include font-color(0.9);
@include box-backgroundColor(0.3);
}
}
.upload-left-layout-item-active {