diff --git a/src/views/practise/practice-analytic/components/assessment-report/index.jsx b/src/views/practise/practice-analytic/components/assessment-report/index.jsx index df625a7..508fac3 100644 --- a/src/views/practise/practice-analytic/components/assessment-report/index.jsx +++ b/src/views/practise/practice-analytic/components/assessment-report/index.jsx @@ -1,33 +1,45 @@ -import req from '@utils/request' - import AnalysisAtlas from '@components/analysis-atlas' import { splicingQuery } from '@utils' +import req from '@utils/request' import { Button, Spin } from 'antd' -import React, { Component } from 'react' +import React, { useEffect, useState } from 'react' +import { useNavigate } from 'react-router-dom' import { ApiName, ModuleName } from '../../constant' import RecommendList from '../recommend-list' + import './index.less' -class AssessmentReport extends Component { - constructor(props) { - super(props) - this.state = { - correctSubject: '3', - recommendSetList: [], - skill: [], - title: '测试试卷', - isLoading: false +const AssessmentReport = props => { + const navigate = useNavigate() + const [title, setTitle] = useState('测试试卷') + const [correctSubject, setCorrectSubject] = useState('3') + const [spinning, setSpinning] = useState(false) + const [recommendSetList, setRecommendSetList] = useState([]) + const [skill, setSkill] = useState([ + { + name: '名称1', + star: 50 + }, + { + name: '名称2', + star: 70 + }, + { + name: '名称3', + star: 90 + }, + { + name: '名称4', + star: 80 } - } + ]) - componentDidMount() { - this.getReport() - } + useEffect(() => {}, []) /** * 答案解析-获得评估报告 */ - getReport = async () => { + const getReport = async () => { const { practiceId } = this.props let params = { practiceId: practiceId @@ -69,15 +81,16 @@ class AssessmentReport extends Component { /** * 练习其他技能 */ - onChangePracticeOther = () => { - this.props.history.push('/practice-questions') + const onChangePracticeOther = () => { + // this.props.history.push('/practice-questions') + navigate('/practice-questions') } /** * 查看答案解析 */ - onChangeAnswerAnalysis = () => { - this.props.onHandleAnswerAnalysis && this.props.onHandleAnswerAnalysis(ModuleName.analysis) + const onChangeAnswerAnalysis = () => { + props.onHandleAnswerAnalysis && props.onHandleAnswerAnalysis(ModuleName.analysis) } /** @@ -85,7 +98,7 @@ class AssessmentReport extends Component { * @param {*} setId * @returns */ - onChangeSetId = setId => { + const onChangeSetId = setId => { this.props.history.push( splicingQuery('/practice-details', { setId @@ -93,56 +106,207 @@ class AssessmentReport extends Component { ) } - render() { - const { correctSubject, recommendSetList, skill, title, isLoading } = this.state - return ( - -
-
-
- {/*
- - 得分:12 -
*/} -
试卷:{title}
-
正确题数:{correctSubject}
- -
-
-
你的技能图谱
-
- -
-
-
- {recommendSetList?.length > 0 && ( - - )} -
+ return ( + +
+
+
+ {/*
+ + 得分:12 +
*/} +
试卷:{title}
+
正确题数:{correctSubject}
+
+
你的技能图谱
+
+ +
+
- - ) - } + {recommendSetList?.length > 0 && ( + + )} +
+ +
+
+
+ ) } +// class AssessmentReport extends Component { +// constructor(props) { +// super(props) +// this.state = { +// correctSubject: '3', +// recommendSetList: [], +// skill: [ +// { +// name: '名称1', +// star: 50 +// }, +// { +// name: '名称2', +// star: 70 +// }, +// { +// name: '名称3', +// star: 90 +// }, +// { +// name: '名称4', +// star: 80 +// } +// ], +// title: '测试试卷', +// isLoading: false +// } +// } + +// componentDidMount() { +// this.getReport() +// } + +// /** +// * 答案解析-获得评估报告 +// */ +// getReport = async () => { +// const { practiceId } = this.props +// let params = { +// practiceId: practiceId +// } +// await req({ +// method: 'post', +// data: params, +// url: ApiName.getReport +// }) +// .then(res => { +// if (res?.data) { +// let list = res.data.skill || [] +// let len = res.data.skill.length +// if (len === 1) { +// let l1 = [ +// { name: res.data.skill[0].name + ' ', star: res.data.skill[0].star }, +// { +// name: ' ' + res.data.skill[0].name + ' ', +// star: res.data.skill[0].star +// } +// ] +// list = list.concat(l1) +// } else if (len === 2) { +// let l1 = [{ name: res.data.skill[1].name + ' ', star: res.data.skill[1].star }] +// list = list.concat(l1) +// } +// this.setState({ +// isLoading: false, +// title: res.data.title, +// correctSubject: res.data.correctSubject, +// recommendSetList: res.data.recommendSetList, +// skill: list +// }) +// } +// }) +// .catch(err => console.log(err)) +// } + +// /** +// * 练习其他技能 +// */ +// onChangePracticeOther = () => { +// this.props.history.push('/practice-questions') +// } + +// /** +// * 查看答案解析 +// */ +// onChangeAnswerAnalysis = () => { +// this.props.onHandleAnswerAnalysis && this.props.onHandleAnswerAnalysis(ModuleName.analysis) +// } + +// /** +// * 点击推荐套题 +// * @param {*} setId +// * @returns +// */ +// onChangeSetId = setId => { +// this.props.history.push( +// splicingQuery('/practice-details', { +// setId +// }) +// ) +// } + +// render() { +// const { correctSubject, recommendSetList, skill, title, isLoading } = this.state +// return ( +// +//
+//
+//
+// {/*
+// +// 得分:12 +//
*/} +//
试卷:{title}
+//
正确题数:{correctSubject}
+// +//
+//
+//
你的技能图谱
+//
+// +//
+//
+//
+// {recommendSetList?.length > 0 && ( +// +// )} +//
+// +//
+//
+//
+// ) +// } +// } + export default AssessmentReport