From dd939433b0998f476ab9da20b31953c47f850c21 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Thu, 12 Sep 2019 10:49:22 +0800 Subject: [PATCH 1/2] protocol --- public/react/src/App.js | 14 ++++++++++++++ public/react/src/common/util/ShareUtil.js | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/public/react/src/App.js b/public/react/src/App.js index 1a4aedc05..17ee34255 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -326,6 +326,20 @@ class App extends Component { }); wx.ready(function () { console.log('wx is ready') + // var shareData = { + // title: 'EduCoder - 首页', + // desc: 'Educoder是一个面向计算机类的互联网IT教育和实战平台,提供企业级工程实训,以实现工程化专业教学的自动化和智能化。高校和企业人员可以在此开展计算机实践性教学活动,将传统的知识传授和时兴的工程实战一体化。', + // link: currentUrl, + // imgUrl: window.__testImageUrl + // || (currentUrl.endsWith('/') ? currentUrl : currentUrl + '/') + 'react/build/images/share_logo_icon.jpg' + // }; + + // wx.onMenuShareAppMessage(shareData);//分享给好友 + // wx.onMenuShareTimeline(shareData);//分享到朋友圈 + // wx.onMenuShareQQ(shareData);//分享给手机QQ + // wx.onMenuShareWeibo(shareData);//分享腾讯微博 + // wx.onMenuShareQZone(shareData);//分享到QQ空间 + configShareForIndex('/') }); wx.error(function (res) { diff --git a/public/react/src/common/util/ShareUtil.js b/public/react/src/common/util/ShareUtil.js index 24fffbf15..c4ec8a62a 100644 --- a/public/react/src/common/util/ShareUtil.js +++ b/public/react/src/common/util/ShareUtil.js @@ -1,4 +1,4 @@ -const host = window.location.host +const host = window.location.protocol + '//' + window.location.host const wx = window.wx function share(shareData) { try { 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 2/2] 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() }