feat: 修改分类
This commit is contained in:
@@ -123,7 +123,7 @@ const QuestionList = (props) => {
|
||||
const onChangeAction = (item, index) => () => {
|
||||
let { isNotToDetail, difficulty, primaryCategoryId, labelList, pageIndex } =
|
||||
props;
|
||||
!isNotToDetail && navigate("/brush-question")
|
||||
!isNotToDetail && navigate("/brush-question/" + item.id)
|
||||
// this.props.history.push(
|
||||
// splicingQuery("/brush-questions", {
|
||||
// id: item?.id,
|
||||
@@ -191,9 +191,10 @@ const QuestionList = (props) => {
|
||||
}}
|
||||
columns={questionColumns}
|
||||
dataSource={questionList}
|
||||
rowKey={(record) => record.id}
|
||||
rowKey="id"
|
||||
pagination={false}
|
||||
rowClassName="question-table-row"
|
||||
|
||||
/>
|
||||
{/* {total > 10 && (
|
||||
<Pagination
|
||||
|
@@ -17,7 +17,7 @@ const router = createBrowserRouter([
|
||||
element: <QuestionBank />,
|
||||
},
|
||||
{
|
||||
path: "brush-question",
|
||||
path: "brush-question/:id",
|
||||
element: <BrushQuestions />,
|
||||
},
|
||||
{
|
||||
|
@@ -1,11 +1,83 @@
|
||||
import { Pagination, Button, Modal, Input, Radio, message } from 'antd'
|
||||
import React, { Component, Fragment } from 'react'
|
||||
import { queryParse } from '@utils'
|
||||
import React, { Component, Fragment, useState, useEffect } from 'react'
|
||||
import { useParams } from 'react-router-dom'
|
||||
import GoodCollectionError from '@components/good-collection-error'
|
||||
import './index.less'
|
||||
import req from '@utils/request'
|
||||
|
||||
export default class BrushQuestions extends Component {
|
||||
const grade: Record<string, string> = {
|
||||
1: '初级',
|
||||
2: '中级',
|
||||
3: '高级',
|
||||
4: '资深',
|
||||
5: '专家',
|
||||
}
|
||||
|
||||
const BrushQuestions = () => {
|
||||
|
||||
const { id } = useParams()
|
||||
const [question, setQuestion] = useState<Record<string, any>>(null)
|
||||
const [index, setIndex] = useState(1)
|
||||
|
||||
useEffect(() => {
|
||||
if (!id) return
|
||||
req({
|
||||
method: 'post',
|
||||
data: {
|
||||
id
|
||||
},
|
||||
url: '/querySubjectInfo',
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.success && res.data) {
|
||||
setQuestion(res.data)
|
||||
}
|
||||
})
|
||||
.catch((err) => console.log(err))
|
||||
}, [id])
|
||||
|
||||
return (
|
||||
<div className="brush-questions-box">
|
||||
<div className="question-box">
|
||||
<div className="question">
|
||||
<div className="question-type">
|
||||
<div className="number">{index}</div>
|
||||
<div className="type">问答题</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{
|
||||
question ? <Fragment>
|
||||
<div className="question-content">
|
||||
<div className="difficulty">
|
||||
{grade[question.subjectDifficult]}-{question?.labelName.join('、')}
|
||||
</div>
|
||||
<div>{question.subjectName}</div>
|
||||
</div>
|
||||
<div className="answer-box">
|
||||
<div className="reference-answer">参考答案</div>
|
||||
<div
|
||||
className="answer-content wang-editor-style"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: question.subjectAnswer,
|
||||
}}
|
||||
></div>
|
||||
<br />
|
||||
</div>
|
||||
<div className="change-question-box">
|
||||
<GoodCollectionError
|
||||
questionId={question.id}
|
||||
/>
|
||||
</div>
|
||||
</Fragment> : null
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default BrushQuestions
|
||||
|
||||
class BrushQuestions1 extends Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
this.state = {
|
||||
@@ -64,7 +136,7 @@ export default class BrushQuestions extends Component {
|
||||
return await req({
|
||||
method: 'post',
|
||||
data: params,
|
||||
url: '/admin/question/subject/getSubjectList',
|
||||
url: '/querySubjectInfo',
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.data && res.data?.pageList?.length > 0) {
|
||||
|
@@ -7,7 +7,6 @@ import RankingList from './components/ranking-list'
|
||||
import { apiName } from './constant';
|
||||
import req from '@utils/request';
|
||||
import { Spin } from 'antd';
|
||||
import { mockDataList } from './mock';
|
||||
import './index.less';
|
||||
|
||||
const QuestionBank = () => {
|
||||
@@ -132,8 +131,8 @@ const QuestionBank = () => {
|
||||
</div>
|
||||
</Spin>
|
||||
<div className="ranking-box">
|
||||
<ContributionList />
|
||||
<RankingList />
|
||||
<ContributionList />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
Reference in New Issue
Block a user