Commit 95fbdc9c by xuzhenghua

Merge branch 'ai-test' of https://gitlab.julyedu.com/baiguangyao/mr-julyedu into dev

parents 27af6986 19f48b47
...@@ -86,7 +86,8 @@ class Analysis extends Component { ...@@ -86,7 +86,8 @@ class Analysis extends Component {
</div> </div>
</div> </div>
{ {
!!questions.length && questions[activeIndex].type_id && <Recommends typeId={questions[activeIndex].type_id}/> !!questions.length && questions[activeIndex] && questions[activeIndex].commend_course && !!questions[activeIndex].commend_course.length &&
<Recommends recommends={questions[activeIndex].commend_course}/>
} }
<Navigation questions={questions} isAnalysis={true} handleClick={(index) => { <Navigation questions={questions} isAnalysis={true} handleClick={(index) => {
this.setState({ this.setState({
......
...@@ -115,7 +115,8 @@ class Assist extends Component { ...@@ -115,7 +115,8 @@ class Assist extends Component {
<div style={{height: '8px', backgroundColor: '#f5f5f5'}}></div> <div style={{height: '8px', backgroundColor: '#f5f5f5'}}></div>
{ {
result && <div className="content"> result && <div className="content">
<div class={'info'}>您的选择是{userAnswer},正确答案是{rightAnswer} 回答{userAnswer === rightAnswer ? '正确' : '错误'}</div> <div
className={'info'}>您的选择是{userAnswer},正确答案是{rightAnswer} 回答{userAnswer === rightAnswer ? '正确' : '错误'}</div>
<div className="head"> <div className="head">
<i className="icon"></i> <i className="icon"></i>
<span>解析</span> <span>解析</span>
...@@ -124,8 +125,8 @@ class Assist extends Component { ...@@ -124,8 +125,8 @@ class Assist extends Component {
</div> </div>
} }
{ {
result && <> result && question.commend_course && question.commend_course.length && <>
<Recommends typeId={question.type_id}/> <Recommends recommends={question.commend_course}/>
<div className={classnames(['status', { <div className={classnames(['status', {
end: result.status === 6, end: result.status === 6,
success: result.status === 1, success: result.status === 1,
...@@ -152,6 +153,6 @@ class Assist extends Component { ...@@ -152,6 +153,6 @@ class Assist extends Component {
} }
export default connect( export default connect(
state => state.user, ({user}) => ({user}),
null, null,
)(Assist) )(Assist)
\ No newline at end of file
import React, { Component } from 'react'; import React, { Component } from 'react';
import './index.scss' import './index.scss'
import { http } from "@/utils"
import { Toast } from "antd-mobile";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
class Recommends extends Component { class Recommends extends Component {
state = {
recommends: [],
}
componentDidMount() {
this.props.typeId && this.getRecommends(this.props.typeId)
}
getRecommends = (typeId) => {
http.post(`${API.home}/sys/get_commend_course`, {
type_id: typeId,
}).then(res => {
const {code, msg, data} = res.data
if (code === 200) {
this.setState({
recommends: data,
})
} else {
Toast.fail(msg, 2, null, msg)
}
})
}
render() { render() {
const {recommends} = this.state const {recommends} = this.props
return ( return (
<div className="recommends"> <div className="recommends">
<div>相关课程</div> <div>相关课程</div>
......
...@@ -28,12 +28,17 @@ class scoreReport extends Component { ...@@ -28,12 +28,17 @@ class scoreReport extends Component {
} }
componentDidMount() { componentDidMount() {
window.onbeforeunload = () => {
document.documentElement.scrollTop = 0
document.body.scrollTop = 0
}
this.getCodeWe() this.getCodeWe()
this.handleFetchInfo(0) this.handleFetchInfo(0)
} }
shouldComponentUpdate(nextProps, nextState, nextContext) { shouldComponentUpdate(nextProps, nextState, nextContext) {
if (this.props.user.data.avatar!==nextProps.user.data.avatar) { if (this.props.user.data.avatar !== nextProps.user.data.avatar) {
this.getCanvas() this.getCanvas()
return false return false
} }
...@@ -42,10 +47,13 @@ class scoreReport extends Component { ...@@ -42,10 +47,13 @@ class scoreReport extends Component {
getCanvas() { getCanvas() {
document.documentElement.scrollTop = 0
document.body.scrollTop = 0
let _this = this let _this = this
var canvas2 = document.createElement("canvas") var canvas2 = document.createElement("canvas")
let _canvas = document.getElementsByClassName('score-list')[0] let _canvas = document.getElementsByClassName('score-list')[0]
if(!_canvas){ if (!_canvas) {
return return
} }
var w = parseInt(window.getComputedStyle(_canvas).width) var w = parseInt(window.getComputedStyle(_canvas).width)
...@@ -98,7 +106,7 @@ class scoreReport extends Component { ...@@ -98,7 +106,7 @@ class scoreReport extends Component {
this.getBase64(avatar) this.getBase64(avatar)
setTimeout(() => { setTimeout(() => {
this.getCanvas() this.getCanvas()
},500) }, 500)
} }
}) })
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment