feat: 修改分类
This commit is contained in:
@@ -123,7 +123,7 @@ const QuestionList = (props) => {
|
|||||||
const onChangeAction = (item, index) => () => {
|
const onChangeAction = (item, index) => () => {
|
||||||
let { isNotToDetail, difficulty, primaryCategoryId, labelList, pageIndex } =
|
let { isNotToDetail, difficulty, primaryCategoryId, labelList, pageIndex } =
|
||||||
props;
|
props;
|
||||||
!isNotToDetail && navigate("/brush-question")
|
!isNotToDetail && navigate("/brush-question/" + item.id)
|
||||||
// this.props.history.push(
|
// this.props.history.push(
|
||||||
// splicingQuery("/brush-questions", {
|
// splicingQuery("/brush-questions", {
|
||||||
// id: item?.id,
|
// id: item?.id,
|
||||||
@@ -191,9 +191,10 @@ const QuestionList = (props) => {
|
|||||||
}}
|
}}
|
||||||
columns={questionColumns}
|
columns={questionColumns}
|
||||||
dataSource={questionList}
|
dataSource={questionList}
|
||||||
rowKey={(record) => record.id}
|
rowKey="id"
|
||||||
pagination={false}
|
pagination={false}
|
||||||
rowClassName="question-table-row"
|
rowClassName="question-table-row"
|
||||||
|
|
||||||
/>
|
/>
|
||||||
{/* {total > 10 && (
|
{/* {total > 10 && (
|
||||||
<Pagination
|
<Pagination
|
||||||
|
@@ -17,7 +17,7 @@ const router = createBrowserRouter([
|
|||||||
element: <QuestionBank />,
|
element: <QuestionBank />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "brush-question",
|
path: "brush-question/:id",
|
||||||
element: <BrushQuestions />,
|
element: <BrushQuestions />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@@ -1,11 +1,83 @@
|
|||||||
import { Pagination, Button, Modal, Input, Radio, message } from 'antd'
|
import { Pagination, Button, Modal, Input, Radio, message } from 'antd'
|
||||||
import React, { Component, Fragment } from 'react'
|
import React, { Component, Fragment, useState, useEffect } from 'react'
|
||||||
import { queryParse } from '@utils'
|
import { useParams } from 'react-router-dom'
|
||||||
import GoodCollectionError from '@components/good-collection-error'
|
import GoodCollectionError from '@components/good-collection-error'
|
||||||
import './index.less'
|
import './index.less'
|
||||||
import req from '@utils/request'
|
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) {
|
constructor(props) {
|
||||||
super(props)
|
super(props)
|
||||||
this.state = {
|
this.state = {
|
||||||
@@ -64,7 +136,7 @@ export default class BrushQuestions extends Component {
|
|||||||
return await req({
|
return await req({
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: params,
|
data: params,
|
||||||
url: '/admin/question/subject/getSubjectList',
|
url: '/querySubjectInfo',
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.data && res.data?.pageList?.length > 0) {
|
if (res.data && res.data?.pageList?.length > 0) {
|
||||||
|
@@ -7,7 +7,6 @@ import RankingList from './components/ranking-list'
|
|||||||
import { apiName } from './constant';
|
import { apiName } from './constant';
|
||||||
import req from '@utils/request';
|
import req from '@utils/request';
|
||||||
import { Spin } from 'antd';
|
import { Spin } from 'antd';
|
||||||
import { mockDataList } from './mock';
|
|
||||||
import './index.less';
|
import './index.less';
|
||||||
|
|
||||||
const QuestionBank = () => {
|
const QuestionBank = () => {
|
||||||
@@ -132,8 +131,8 @@ const QuestionBank = () => {
|
|||||||
</div>
|
</div>
|
||||||
</Spin>
|
</Spin>
|
||||||
<div className="ranking-box">
|
<div className="ranking-box">
|
||||||
<ContributionList />
|
|
||||||
<RankingList />
|
<RankingList />
|
||||||
|
<ContributionList />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user