From 568f0e3e8a03d57029d9aa6886fa45701018db1e Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Thu, 12 Sep 2019 11:29:07 +0800 Subject: [PATCH] unload --- public/react/src/context/TPIContextProvider.js | 2 +- public/react/src/modules/page/MainContentContainer.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/public/react/src/context/TPIContextProvider.js b/public/react/src/context/TPIContextProvider.js index 2d58140e6..ee01c3c72 100644 --- a/public/react/src/context/TPIContextProvider.js +++ b/public/react/src/context/TPIContextProvider.js @@ -174,7 +174,7 @@ class TPIContextProvider extends Component { } let testPath = '' if (window.location.port == 3007) { - testPath = 'http://pre-newweb.educoder.net' + testPath = 'http://test-newweb.educoder.net' } // var url = `${testPath}/api/v1/games/${ game.identifier }/cost_time` var url = `${testPath}/api/tasks/${ game.identifier }/cost_time` diff --git a/public/react/src/modules/page/MainContentContainer.js b/public/react/src/modules/page/MainContentContainer.js index 8d6153186..50eacdd4b 100644 --- a/public/react/src/modules/page/MainContentContainer.js +++ b/public/react/src/modules/page/MainContentContainer.js @@ -391,9 +391,16 @@ class MainContentContainer extends Component { // var fileUpdatePromise = this.doFileUpdateRequest(true) // }); // } + + window.addEventListener("beforeunload", this.beforeunload); + } componentWillUnmount() { // window.$(window).off( "unload" ) + window.removeEventListener("beforeunload", this.beforeunload); + } + beforeunload = () => { + this.doFileUpdateRequestOnCodeMirrorBlur() }