diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 5182cb991..d91c42fcf 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -46,7 +46,7 @@ debugType = "admin"; // 老师 // debugType="teacher"; // 学生 - debugType="student"; + //debugType="student"; diff --git a/public/react/src/context/TPIContextProvider.js b/public/react/src/context/TPIContextProvider.js index bb1e0bef4..fa0cbafcd 100644 --- a/public/react/src/context/TPIContextProvider.js +++ b/public/react/src/context/TPIContextProvider.js @@ -137,6 +137,9 @@ class TPIContextProvider extends Component { this.costTimeInterval && window.clearInterval(this.costTimeInterval) } componentDidMount() { + window.$(window).unload( ()=>{ + console.log(12321) + }); // TODO 登录状态的判断? // request @@ -158,12 +161,24 @@ class TPIContextProvider extends Component { } }, 1000) - // 页面离开时存下用户的任务耗时 + // 页面离开时存下用户的任务耗时 + window.$(window).bind('beforeunload', function (e) { + console.log(111111) + this._updateCostTime(); + }) + + // // 页面离开时存下用户的任务耗时 + // window.$(window).unload( ()=>{ + // this._updateCostTime(); + + // }); - window.$(window).unload( ()=>{ - this._updateCostTime(); - }); } + + + + + // force 评测通过后,异步执行该方法,强制同步costTime到服务端 _updateCostTime(async = false, force) { const { game, loading } = this.state; diff --git a/public/react/src/modules/page/LeftNav.js b/public/react/src/modules/page/LeftNav.js index d1a7b1a11..63628d7ff 100644 --- a/public/react/src/modules/page/LeftNav.js +++ b/public/react/src/modules/page/LeftNav.js @@ -59,7 +59,7 @@ class LeftNav extends Component {