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,9 +1,9 @@
export const good = {
0:'未点赞',
1:'已点赞',
0: '未点赞',
1: '已点赞'
}
export const collection={
0:'未收藏',
1:'已收藏',
export const collection = {
0: '未收藏',
1: '已收藏'
}

View File

@@ -1,162 +1,118 @@
.brush-questions-box {
width: 1439px;
margin: 0 auto;
// display: flex;
background-color: #fff;
padding: 20px 50px;
border-radius: 5px;
width: 1439px;
margin: 0 auto;
background-color: #fff;
padding: 20px 50px;
border-radius: 5px;
flex-direction: column;
overflow: auto;
.brush-questions-box,
.question-box {
flex-direction: column;
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;
flex: 1;
align-items: center;
}
}
overflow-y: auto;
background-color: #fff;
border-radius: 8px;
.question,
.question-content {
display: flex;
.question-type,
.question-number {
display: flex;
flex: 1;
align-items: center;
}
}
}
}
// .answer-box{
// }
.question-box {
margin-bottom: 10px;
margin-bottom: 10px;
}
.question {
margin-bottom: 20px;
margin-bottom: 20px;
}
.question-type {
// padding-left: 50px;
color: rgba(60, 110, 238, 1) !important;
font-size: 16px;
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;
justify-content: right;
color: rgba(60, 110, 238, 1) !important;
font-size: 16px;
font-weight: 600;
}
.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;
.difficulty {
margin-right: 10px;
padding: 0 10px;
border-radius: 4px;
background-color: rgba(60, 110, 238, 0.3) !important;
}
display: flex;
align-items: center;
font-size: 16px;
line-height: 35px;
margin-top: 50px;
margin-bottom: 10px;
.difficulty {
margin-right: 10px;
padding: 0 10px;
border-radius: 4px;
background-color: rgba(60, 110, 238, 0.3) !important;
}
}
.reference-answer {
color: rgba(60, 110, 238, 0.8) !important;
font-size: 14px;
padding: 20px 0 10px 0px;
color: rgba(60, 110, 238, 0.8) !important;
font-size: 14px;
padding: 20px 0 10px 0px;
}
.answer-content {
background-color: rgba(60, 110, 238, 0.2) !important;
padding: 15px 0 15px 35px;
font-size: 14px;
line-height: 35px;
border-radius: 6px;
margin-bottom: 5px;
max-height: 500px;
overflow-y: scroll;
background-color: rgba(60, 110, 238, 0.2) !important;
padding: 15px 0 15px 35px;
font-size: 14px;
line-height: 35px;
border-radius: 6px;
margin-bottom: 5px;
max-height: 500px;
overflow-y: scroll;
}
.answer-box {
border-radius: 0px;
border-top: 1px dashed #e4e4e4;
border-bottom: 1px dashed #e4e4e4;
border-radius: 0px;
border-top: 1px dashed #e4e4e4;
border-bottom: 1px dashed #e4e4e4;
}
.change-question-box {
display: flex;
display: flex;
}
.right {
display: flex;
flex: 1;
margin: 10px 0 10px 700px;
display: flex;
flex: 1;
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;
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;
margin: 0px 15px 15px 20px;
font-size: 16px;
cursor: pointer;
width: 110px;
height: 46px;
// color: white
// background-color: rgba(60, 110, 238,1) !important;
margin: 0px 15px 15px 20px;
font-size: 16px;
cursor: pointer;
width: 110px;
height: 46px;
}
// .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;
background-color: rgba(60, 110, 238, 1) !important;
}
.number {
width: 35px;
height: 35px;
line-height: 35px;
border-radius: 50%;
background-color: rgba(60, 110, 238, 1) !important;
color: white;
text-align: center;
width: 35px;
height: 35px;
line-height: 35px;
border-radius: 50%;
background-color: rgba(60, 110, 238, 1) !important;
color: white;
text-align: center;
}
.all-number {
color: #34495e;
color: #34495e;
}
.type {
padding: 2px 10px;
padding: 2px 10px;
}

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,199 +1,199 @@
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 [secondCategoryId, setSecondCategoryId] = useState('')
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 [secondCategoryId, setSecondCategoryId] = useState('')
const [loading, setLoading] = useState(false)
const [finished, setFinished] = useState(false)
const [switchFlag, setSwitchFlag] = useState(false)
const [loading, setLoading] = useState(false)
const [finished, setFinished] = useState(false)
const [switchFlag, setSwitchFlag] = useState(false)
/**
* 获取大类分类
*/
const getPrimaryCategoryInfo = () => {
req({
method: 'post',
url: apiName.queryPrimaryCategory,
data: { categoryType: 1 }
})
.then((res: Record<string, any>) => {
if (res.data && res.data.length > 0) {
setPromaryCategoryId(res.data[0].id)
setFirstCategoryList(res.data)
}
})
.catch((err: string) => {
console.log(err)
})
}
/**
* 切换一级分类
* @param {*} e
*/
const onChangeCategory = (item: Record<string, any>) => {
setLabelList('')
setPromaryCategoryId(item.id)
setQuestionList([])
setTotal(0)
setPageIndex(1)
}
/**
* 获取大类分类
*/
const getPrimaryCategoryInfo = () => {
req({
method: 'post',
url: apiName.queryPrimaryCategory,
data: { categoryType: 1 }
})
.then((res: Record<string, any>) => {
if (res.data && res.data.length > 0) {
setPromaryCategoryId(res.data[0].id);
setFirstCategoryList(res.data)
}
})
.catch((err: string) => {
console.log(err)
})
/**
* 选择标签时,请求列表数据
* @param {*} secondCategoryId 一级分类id
* @param {*} assembleIds 三级标签 assembleIds
*/
const onChangeLabel = (secondCategoryId: any, assembleIds: string) => {
setSecondCategoryId(secondCategoryId)
setLabelList(assembleIds)
setQuestionList([])
setTotal(0)
setPageIndex(1)
}
const queryQuestionList = () => {
setLoading(true)
const params = {
pageNo: pageIndex,
pageSize: 20,
labelId: labelList,
categoryId: secondCategoryId,
subjectDifficult: difficulty || ''
}
/**
* 切换一级分类
* @param {*} e
*/
const onChangeCategory = (item: Record<string, any>) => {
setLabelList('')
setPromaryCategoryId(item.id)
setQuestionList([])
setTotal(0)
setPageIndex(1)
};
/**
* 选择标签时,请求列表数据
* @param {*} secondCategoryId 一级分类id
* @param {*} assembleIds 三级标签 assembleIds
*/
const onChangeLabel = (secondCategoryId: any, assembleIds: string) => {
setSecondCategoryId(secondCategoryId)
setLabelList(assembleIds)
setQuestionList([])
setTotal(0)
setPageIndex(1)
};
const queryQuestionList = () => {
setLoading(true)
const params = {
pageNo: pageIndex,
pageSize: 20,
labelId: labelList,
categoryId: secondCategoryId,
subjectDifficult: difficulty || ''
req({
method: 'post',
url: apiName.getSubjectPage,
data: params
})
.then(res => {
setLoading(false)
let lastList = [...questionList]
const { total = 0, result } = res.data
setTotal(total)
if (result.length) {
lastList = lastList.concat(result)
setQuestionList(lastList)
if (result.length < 20 || lastList.length >= total) {
setFinished(true)
} else {
setFinished(false)
setSwitchFlag(false)
}
}
req({
method: 'post',
url: apiName.getSubjectPage,
data: params
}).then(res => {
setLoading(false)
let lastList = [...questionList]
const { total, result } = res.data
if (result.length) {
lastList = lastList.concat(result)
setQuestionList(lastList)
setTotal(total)
if (result.length < 20 || lastList.length >= total) {
setFinished(true)
} else {
setFinished(false)
setSwitchFlag(false)
}
}
}).catch(err => {
console.log(err)
}).finally(() => {
setLoading(false)
})
})
.catch(err => {
console.log(err)
})
.finally(() => {
setLoading(false)
})
}
useEffect(() => {
if (!primaryCategoryId) {
getPrimaryCategoryInfo()
}
}, [])
useEffect(() => {
if (!primaryCategoryId) {
getPrimaryCategoryInfo()
}
}, [])
useEffect(() => {
if (labelList && secondCategoryId) {
queryQuestionList()
}
}, [labelList, pageIndex, secondCategoryId, difficulty])
useEffect(() => {
if (labelList && secondCategoryId) {
queryQuestionList()
}
}, [labelList, pageIndex, secondCategoryId, difficulty])
/**
/**
* 更多分类切换
* @param {*} e
*/
const onChangeCategoryMore = (id: string, categoryList: Record<string, any>[]) => {
setFirstCategoryList(categoryList)
setPromaryCategoryId(id)
setLabelList('')
setQuestionList([])
setPageIndex(1)
setTotal(0)
const onChangeCategoryMore = (id: string, categoryList: Record<string, any>[]) => {
setFirstCategoryList(categoryList)
setPromaryCategoryId(id)
setLabelList('')
setQuestionList([])
setPageIndex(1)
setTotal(0)
}
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
// 如果不加入 saveHeight 安全距离,在 scrollTop + clientHeight == scrollHeight 时,触发加载
// 加入安全距离,相当于在 scrollTop + clientHeight >= scrollHeight - 30 时,触发加载,比前者更早触发
if (tempVal >= scrollHeight) {
if (!finished && !switchFlag) {
// 数据加载未结束 && 未加锁
setPageIndex(pageIndex + 1)
}
setSwitchFlag(true)
}
}
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;
// 如果不加入 saveHeight 安全距离,在 scrollTop + clientHeight == scrollHeight 时,触发加载
// 加入安全距离,相当于在 scrollTop + clientHeight >= scrollHeight - 30 时,触发加载,比前者更早触发
if (tempVal >= scrollHeight) {
if (!finished && !switchFlag) {
// 数据加载未结束 && 未加锁
setPageIndex(pageIndex + 1)
}
setSwitchFlag(true)
}
}
const changeDifficuty = cur => {
if (cur === difficulty) return
setPageIndex(1)
setDiffculty(cur)
setQuestionList([])
}
const changeDifficuty = cur => {
if (cur === difficulty) return
setPageIndex(1)
setDiffculty(cur)
setQuestionList([])
}
return (
<div className='question-bank-box'>
<div className='mask-box' onScroll={scrollHandler}>
<div className='question-box'>
<div className='category-list-box'>
{firstCategoryList?.length > 0 && (
<CategoryList
onChangeCategory={onChangeCategory}
categoryList={firstCategoryList}
onChangeLabel={onChangeLabel}
primaryCategoryId={primaryCategoryId}
isMultipleChoice={false}
onChangeCategoryMore={onChangeCategoryMore}
/>
)}
</div>
<div className='question-list-box'>
<QuestionList
pageIndex={pageIndex}
total={total}
questionList={questionList}
changeDifficuty={changeDifficuty}
labelList={labelList}
/>
</div>
return (
<div className="question-bank-box">
<div className='mask-box' onScroll={scrollHandler}>
<div className="question-box" >
<div className="category-list-box">
{firstCategoryList?.length > 0 && (
<CategoryList
onChangeCategory={onChangeCategory}
categoryList={firstCategoryList}
onChangeLabel={onChangeLabel}
primaryCategoryId={primaryCategoryId}
isMultipleChoice={false}
onChangeCategoryMore={onChangeCategoryMore}
/>
)}
</div>
<div className="question-list-box">
<QuestionList
pageIndex={pageIndex}
total={total}
questionList={questionList}
changeDifficuty={changeDifficuty}
labelList={labelList}
/>
</div>
<div className='loading-more'>{
questionList.length == 0
? "暂无数据"
: loading && !finished
? "努力加载中..."
: "我是有底线的(:"
}</div>
</div>
</div>
<div className="ranking-box">
<RankingList />
<ContributionList />
</div>
<div className='loading-more'>
{questionList.length == 0
? '暂无数据'
: loading && !finished
? '努力加载中...'
: '我是有底线的(:'}
</div>
</div>
);
</div>
<div className='ranking-box'>
<RankingList />
<ContributionList />
</div>
</div>
)
}
export default memo(QuestionBank)

View File

@@ -1,88 +1,78 @@
.repeat-content-box {
font-size: 14px;
.repeat-subject-box {
padding-bottom: 14px;
margin-bottom: 14px;
line-height: 22px;
border-bottom: 1px dotted #e4e4e4;
.repeat-subject-title {
margin-right: 8px;
margin-bottom: 4px;
font-size: 12px;
font-weight: 600;
color: #3c6eee;
line-height: 22px;
}
.repeat-subject-text {
flex: 1;
line-height: 18px;
font-size: 14px;
color: rgba(51, 51, 51, 0.8);
}
.repeat-subject-list {
.repeat-subject-item {
display: flex;
margin-bottom: 20px;
padding: 12px 10px 13px;
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;
color: rgba(51, 51, 51, 0.8);
}
&:last-child {
margin-bottom: 0;
}
}
}
font-size: 14px;
.repeat-subject-box {
padding-bottom: 14px;
margin-bottom: 14px;
line-height: 22px;
border-bottom: 1px dotted #e4e4e4;
.repeat-subject-title {
margin-right: 8px;
margin-bottom: 4px;
font-size: 12px;
font-weight: 600;
color: #3c6eee;
line-height: 22px;
}
.repeat-subject-info-box {
.repeat-subject-text {
flex: 1;
line-height: 18px;
font-size: 14px;
color: rgba(51, 51, 51, 0.8);
}
.repeat-subject-list {
.repeat-subject-item {
display: flex;
margin-bottom: 0;
margin-bottom: 20px;
padding: 12px 10px 13px;
background: #fff;
border: 1px solid #d4d4d4;
border-radius: 4px;
.repeat-subject-text {
line-height: 22px;
font-size: 14px;
color: rgba(51, 51, 51, 0.8);
}
&:last-child {
margin-bottom: 0;
}
}
}
}
.repeat-subject-info-box {
display: flex;
margin-bottom: 0;
}
}
.repeat-content-repeat-box {
// 弹框宽度
.ant-modal-content {
width: 630px;
// 提示框-头部title位置
.ant-modal-header {
border-bottom: none;
.ant-modal-title {
display: flex;
justify-content: center;
align-items: baseline;
margin-top: 10px;
font-size: 13px;
line-height: 40px;
color: rgba(51, 51, 51, 0.8);
}
}
// 提示框-两个按钮
.ant-modal-footer {
display: flex;
justify-content: center;
padding: 14px 0;
border-top: none;
.ant-btn {
border-radius: 18px;
}
.ant-btn-primary {
background: rgba(60, 110, 238, 1);
margin-left: 60px;
}
}
// 弹框宽度
.ant-modal-content {
width: 630px;
// 提示框-头部title位置
.ant-modal-header {
border-bottom: none;
.ant-modal-title {
display: flex;
justify-content: center;
align-items: baseline;
margin-top: 10px;
font-size: 13px;
line-height: 40px;
color: rgba(51, 51, 51, 0.8);
}
}
// 提示框-两个按钮
.ant-modal-footer {
display: flex;
justify-content: center;
padding: 14px 0;
border-top: none;
.ant-btn {
border-radius: 18px;
}
.ant-btn-primary {
background: rgba(60, 110, 238, 1);
margin-left: 60px;
}
}
}
}

View File

@@ -1,32 +1,30 @@
.upload-left-layout {
width: 233px;
display: flex;
flex-direction: column;
padding-left: 26px;
width: 233px;
display: flex;
flex-direction: column;
padding-left: 26px;
.upload-left-layout-item {
display: flex;
justify-content: flex-end;
align-items: center;
padding-right: 10px;
margin-bottom: 20px;
width: 207px;
height: 48px;
font-size: 16px;
color: rgba(57, 60, 76, 1);
transition: all 0.3s;
background: rgba(255, 255, 255, 1);
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 {
color: rgba(60, 110, 238, 1);
font-weight: bold;
background: rgba(60, 110, 238, 0.1);
border: 1px solid rgba(60, 110, 238, 1);
.upload-left-layout-item {
display: flex;
justify-content: flex-end;
align-items: center;
padding-right: 10px;
margin-bottom: 20px;
width: 207px;
height: 48px;
font-size: 16px;
color: rgba(57, 60, 76, 1);
transition: all 0.3s;
background: rgba(255, 255, 255, 1);
border: 1px solid rgba(208, 212, 222, 1);
border-radius: 12px;
&:hover {
}
}
.upload-left-layout-item-active {
color: rgba(60, 110, 238, 1);
font-weight: bold;
background: rgba(60, 110, 238, 0.1);
border: 1px solid rgba(60, 110, 238, 1);
}
}