|
|
|
@ -133,13 +133,15 @@ class TPIContextProvider extends Component {
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentWillMount () {
|
|
|
|
|
// 拦截判断是否离开当前页面
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentWillUnmount() {
|
|
|
|
|
this.costTimeInterval && window.clearInterval(this.costTimeInterval)
|
|
|
|
|
}
|
|
|
|
|
componentDidMount() {
|
|
|
|
|
window.$(window).unload( ()=>{
|
|
|
|
|
console.log(12321)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO 登录状态的判断?
|
|
|
|
|
// request
|
|
|
|
@ -161,12 +163,16 @@ class TPIContextProvider extends Component {
|
|
|
|
|
}
|
|
|
|
|
}, 1000)
|
|
|
|
|
|
|
|
|
|
// 页面离开时存下用户的任务耗时
|
|
|
|
|
window.$(window).bind('beforeunload', function (e) {
|
|
|
|
|
console.log(111111)
|
|
|
|
|
// // 页面离开时存下用户的任务耗时
|
|
|
|
|
window.$(window).bind('beforeunload',()=>{
|
|
|
|
|
console.log(111)
|
|
|
|
|
this._updateCostTime();
|
|
|
|
|
})
|
|
|
|
|
window.$(window).unload( ()=>{
|
|
|
|
|
|
|
|
|
|
this._updateCostTime();
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
// // 页面离开时存下用户的任务耗时
|
|
|
|
|
// window.$(window).unload( ()=>{
|
|
|
|
|
// this._updateCostTime();
|
|
|
|
@ -190,6 +196,7 @@ class TPIContextProvider extends Component {
|
|
|
|
|
if (window.location.port == 3007) {
|
|
|
|
|
testPath = 'http://test-newweb.educoder.net'
|
|
|
|
|
}
|
|
|
|
|
console.log(222)
|
|
|
|
|
// var url = `${testPath}/api/v1/games/${ game.identifier }/cost_time`
|
|
|
|
|
var url = `${testPath}/api/tasks/${ game.identifier }/cost_time${getRandomNumber()}`
|
|
|
|
|
window.$.ajax({
|
|
|
|
|