Commit dad2df0e by xuzhenghua

bug

parent a3d1d96a
...@@ -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