From f72237a3b549502e66eee16cd6de9212deb0c6ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sat, 6 Jul 2019 10:03:16 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=20=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/Resource/Fileslistitem.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js index 6239f1b3d..1af027757 100644 --- a/public/react/src/modules/courses/Resource/Fileslistitem.js +++ b/public/react/src/modules/courses/Resource/Fileslistitem.js @@ -42,7 +42,7 @@ class Fileslistitem extends Component{ let link = document.createElement('a'); document.body.appendChild(link); link.href = result.data.url; - console.log(filesname) + console.log(value) link.download = value; //兼容火狐浏览器 let evt = document.createEvent("MouseEvents"); From f102b5a8adf02580bca9884409fb43758e73bcb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sat, 6 Jul 2019 10:05:13 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/shixunHomework/Listofworks.js | 56 ++++++++----------- 1 file changed, 24 insertions(+), 32 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js index db008e2c4..5dd049441 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworks.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js @@ -1340,14 +1340,15 @@ class Listofworks extends Component { // 导出实习报告批量 internshipreport = (url)=>{ console.log("internshipreport"); - // params: { - // homework_common_id: homeworkid, - // work_status: this.state.course_groupyslstwo, - // course_group: this.state.checkedValuesineinfo, - // search: this.state.searchtext, - // } - // let url = "/zip/shixun_report"; - // let homeworkid = this.props.match.params.homeworkid; + var struy=""; + try { + struy = moment().format('YYYY-MM-DD')+"-"+moment().format('hh-mm'); + struy=struy.replace(/-/g,""); + }catch (e) { + console.log(1347); + console.log(e); + } + axios.get((url),{responseType: 'blob'}).then((response) => { console.log("1350"); console.log(response); @@ -1363,19 +1364,10 @@ class Listofworks extends Component { const blob = new Blob([response.data], { type: type }) const downloadElement = document.createElement('a') const href = window.URL.createObjectURL(blob) - //后台再header中传文件名 - // console.log(Base64.decode(response.headers['content-disposition'].split('=')[1])); const string = Base64.decode(response.headers['content-disposition'].split('=')[1]); + console.log(response.headers['content-disposition'].split('=')[1]); downloadElement.href = href - var now=""; - try { - now = moment().year()+""+(moment().month()+1)+""+moment().date()+""+moment().hour()+""+moment().minute()+"" - console.log(now); - - } catch (e) { - console.log("1376"); - } - downloadElement.download = string+now+".zip" + downloadElement.download = string+struy+".zip" document.body.appendChild(downloadElement) downloadElement.click() document.body.removeChild(downloadElement) // 下载完成移除元素 @@ -1388,6 +1380,17 @@ class Listofworks extends Component { // 课堂学生成绩的导出下载 Classstudentachievement=(url)=>{ console.log("Classstudentachievement"); + // console.log(); + var struy=""; + try { + struy = moment().format('YYYY-MM-DD')+"-"+moment().format('hh-mm'); + struy=struy.replace(/-/g,""); + }catch (e) { + console.log(1397); + console.log(e); + } + + axios.get((url),{responseType: 'blob'}).then((response) => { console.log("1374"); console.log(response); @@ -1401,21 +1404,10 @@ class Listofworks extends Component { const blob = new Blob([response.data], { type: type }) const downloadElement = document.createElement('a') const href = window.URL.createObjectURL(blob) - //后台再header中传文件名 - // console.log("1409"); - // console.log(Base64.decode(response.headers['content-disposition'].split('=')[1])); const string = Base64.decode(response.headers['content-disposition'].split('=')[1]); - var now=""; - try { - now = moment().year()+""+(moment().month()+1)+""+moment().date()+""+moment().hour()+""+moment().minute()+"" - console.log("1422"); - console.log(now); - - } catch (e) { - console.log("1432"); - } + console.log(response.headers['content-disposition'].split('=')[1]); downloadElement.href = href - downloadElement.download =string+now+".xlsx"; + downloadElement.download =string+struy+".xlsx"; document.body.appendChild(downloadElement) downloadElement.click() document.body.removeChild(downloadElement) // 下载完成移除元素 From a9c694225649cc02a9b459ef3a393e9a562442fe Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Sat, 6 Jul 2019 10:13:30 +0800 Subject: [PATCH 3/3] display --- .../react/src/context/TPIContextProvider.js | 79 +++++++++++++++---- .../react/src/modules/page/main/ActionView.js | 18 +++-- 2 files changed, 77 insertions(+), 20 deletions(-) diff --git a/public/react/src/context/TPIContextProvider.js b/public/react/src/context/TPIContextProvider.js index ae88bf865..3e7695847 100644 --- a/public/react/src/context/TPIContextProvider.js +++ b/public/react/src/context/TPIContextProvider.js @@ -54,6 +54,8 @@ const testSetsExpandedArrayInitVal = [false, false, false, false, false, false, false, false, false, false, false, false, false, false, false] window.__fetchAllFlag = false; // 是否调用过fetchAll TODO 如何多次使用provider? + +const $ = window.$ class TPIContextProvider extends Component { constructor(props) { super(props) @@ -592,13 +594,48 @@ pop_box_new(htmlvalue, 480, 182); currentPassedGameGainExperience: experience, }) } + initDisplayInterval = () => { + if (this.showWebDisplayButtonTimeout) { + window.clearTimeout(this.showWebDisplayButtonTimeout) + } + this.showWebDisplayButtonTimeout = window.setTimeout(() => { + this.setState({ challenge: update(challenge, + { + showWebDisplayButton: { $set: false }, + }) + }) + this.showWebDisplayButtonTimeout = null + }, 61 * 1000) + + let remain = 60 + if (this.displayInterval) { + window.clearInterval(this.displayInterval) + } + this.displayInterval = window.setInterval(() => { + const button = $('#showWebDisplayButton'); + if (button.length) { + button.html(`查看效果(${remain})`) + if (remain == 0) { + button.html('查看效果') + } + } + if (remain == 0) { + window.clearInterval(this.displayInterval) + this.displayInterval = null + return; + } + + remain -= 1; + }, 1000) + } language_display(data) { const { game, tomcat_url } = this.state; - const $ = window.$; const challenge = Object.assign({}, this.state.challenge) if(challenge.isWeb && data.port != -1) { // var $result = $("#php_display"); challenge.showWebDisplayButton = true; // ActionView处是否出现查看效果按钮 + this.initDisplayInterval() + const path = challenge.web_route || challenge.path const webDisplayUrl = `${tomcat_url}:${data.port}/${path}` challenge.webDisplayUrl = webDisplayUrl @@ -653,24 +690,11 @@ pop_box_new(htmlvalue, 480, 182); const currentGamePassed = this.props.game !== 2 && status === 2 - currentGamePassed && this.language_display(response); + // 评测通过了,立即同步costTime currentGamePassed && this._updateCostTime(true, true); - if (currentGamePassed) { - game.status = 2; - game.next_game = next_game; - - } else { - this.showDialog({ - contentText: