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 01/18] 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:
-
评测未通过
-
详情请参见“测试结果”
-
, - isSingleButton: true - }) - } const output_sets = { "test_sets": test_sets, @@ -689,6 +713,31 @@ pop_box_new(htmlvalue, 480, 182); // output_sets.test_sets_array = test_sets_array; // } + // 检查是否编译通过 + let compileSuccess = false; + if (test_sets && test_sets.length) { + test_sets.some((item) => { + if (item.compile_success) { + compileSuccess = true; + return true; + } + }) + } + + compileSuccess && this.language_display(response); + if (currentGamePassed) { + game.status = 2; + game.next_game = next_game; + } else { + this.showDialog({ + contentText:
+
评测未通过
+
详情请参见“测试结果”
+
, + isSingleButton: true + }) + } + this.setState({ testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0), // 重置测试集展开状态 diff --git a/public/react/src/modules/page/main/ActionView.js b/public/react/src/modules/page/main/ActionView.js index e0e52de9e..fff7d416d 100644 --- a/public/react/src/modules/page/main/ActionView.js +++ b/public/react/src/modules/page/main/ActionView.js @@ -25,7 +25,14 @@ const styles = theme => ({ color: '#4CACFF', border: '1px solid #4CACFF' } + }, + hoverButton: { + margin: theme.spacing.unit, + height: '30px', + padding: '0 16px', + color: '#4CACFF', + border: '1px solid #4CACFF' }, buttonText: { color: '#1B4061 !important', @@ -64,11 +71,12 @@ class ActionView extends Component { {/*将第一个按钮改为visibility方式隐藏,不然加载时测评按钮会出现没有垂直居中的情况*/} - - + + + { !gameBuilding && From f1894db89232d02dd54671733c815366a002f4fa 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:16:39 +0800 Subject: [PATCH 02/18] =?UTF-8?q?=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 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js index 1af027757..6b68386fb 100644 --- a/public/react/src/modules/courses/Resource/Fileslistitem.js +++ b/public/react/src/modules/courses/Resource/Fileslistitem.js @@ -5,7 +5,8 @@ import {Link} from 'react-router-dom'; import {getImageUrl} from 'educoder'; import axios from 'axios' import {getUrl} from 'educoder'; -import moment from 'moment'; +import moment from 'moment' +import { Base64 } from 'js-base64'; import CoursesListType from '../coursesPublic/CoursesListType'; import Showoldfiles from "../coursesPublic/Showoldfiles"; import Modals from '../../modals/Modals'; @@ -27,7 +28,7 @@ class Fileslistitem extends Component{ this.props.Settingtypes(discussMessage.id) } showfiles=(value)=>{ - + let newvalue=Base64.encode(value) let {discussMessage,coursesId}=this.props let file_id=discussMessage.id let url="/files/"+file_id+"/histories.json" @@ -43,7 +44,7 @@ class Fileslistitem extends Component{ document.body.appendChild(link); link.href = result.data.url; console.log(value) - link.download = value; + link.download = Base64.decode(newvalue); //兼容火狐浏览器 let evt = document.createEvent("MouseEvents"); evt.initEvent("click", false, false); From 2277013898cd887deaa3a81e39327af0fe924ee3 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Sat, 6 Jul 2019 10:21:22 +0800 Subject: [PATCH 03/18] challenge --- public/react/src/context/TPIContextProvider.js | 1 + 1 file changed, 1 insertion(+) diff --git a/public/react/src/context/TPIContextProvider.js b/public/react/src/context/TPIContextProvider.js index 3e7695847..3cb725c34 100644 --- a/public/react/src/context/TPIContextProvider.js +++ b/public/react/src/context/TPIContextProvider.js @@ -595,6 +595,7 @@ pop_box_new(htmlvalue, 480, 182); }) } initDisplayInterval = () => { + const challenge = this.state.challenge if (this.showWebDisplayButtonTimeout) { window.clearTimeout(this.showWebDisplayButtonTimeout) } From 2d0a22153f8ed3fdc55f99c4f02aaad789ea61a2 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:23:30 +0800 Subject: [PATCH 04/18] b --- 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 6b68386fb..a7123f7b8 100644 --- a/public/react/src/modules/courses/Resource/Fileslistitem.js +++ b/public/react/src/modules/courses/Resource/Fileslistitem.js @@ -43,7 +43,7 @@ class Fileslistitem extends Component{ let link = document.createElement('a'); document.body.appendChild(link); link.href = result.data.url; - console.log(value) + console.log(newvalue) link.download = Base64.decode(newvalue); //兼容火狐浏览器 let evt = document.createEvent("MouseEvents"); From 7b693c49c2f306daed6f5f56897a846c401f1163 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:32:16 +0800 Subject: [PATCH 05/18] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/Resource/Fileslistitem.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js index a7123f7b8..0b65a6f9f 100644 --- a/public/react/src/modules/courses/Resource/Fileslistitem.js +++ b/public/react/src/modules/courses/Resource/Fileslistitem.js @@ -46,10 +46,16 @@ class Fileslistitem extends Component{ console.log(newvalue) link.download = Base64.decode(newvalue); //兼容火狐浏览器 - let evt = document.createEvent("MouseEvents"); - evt.initEvent("click", false, false); - link.dispatchEvent(evt); - document.body.removeChild(link); + // let evt = document.createEvent("MouseEvents"); + // evt.initEvent("click", false, false); + // link.dispatchEvent(evt); + // document.body.removeChild(link); + + link.style.display = 'none'; + + link.setAttribute('download',result.data.title); + document.body.appendChild(link); + link.click(); // // window.location.href=result.data.url; From 77bf53215f9834032b508a416cfe2d4695509c87 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:33:21 +0800 Subject: [PATCH 06/18] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/common/SnackbarHOC.js | 39 ++++++++++++++++---------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/public/react/src/common/SnackbarHOC.js b/public/react/src/common/SnackbarHOC.js index a59607bf4..d66b697ca 100644 --- a/public/react/src/common/SnackbarHOC.js +++ b/public/react/src/common/SnackbarHOC.js @@ -23,22 +23,31 @@ export function SnackbarHOC(options = {}) { } // 全局的snackbar this.props.showSnackbar调用即可 - showSnackbar(description, message = "提示",icon) { - // this.setState({ - // snackbarOpen: true, - // snackbarText: text, - // snackbarVertical: vertical, - // snackbarHorizontal: horizontal, - // }) - const data = { - message, - description - } - if (icon) { - data.icon = icon; + // showSnackbar(description, message = "提示",icon) { + // // this.setState({ + // // snackbarOpen: true, + // // snackbarText: text, + // // snackbarVertical: vertical, + // // snackbarHorizontal: horizontal, + // // }) + // const data = { + // message, + // description + // } + // if (icon) { + // data.icon = icon; + // } + // notification.open(data); + // } + + showSnackbar(text, vertical, horizontal) { + this.setState({ + snackbarOpen: true, + snackbarText: text, + snackbarVertical: vertical, + snackbarHorizontal: horizontal, + }) } - notification.open(data); - } render() { const { snackbarOpen, snackbarText, snackbarHorizontal, snackbarVertical } = this.state; From 027dab3f9ba4fbf02c8c8dd076036b9664e7a765 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:41:05 +0800 Subject: [PATCH 07/18] b --- .../react/src/modules/courses/Resource/Fileslistitem.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js index 0b65a6f9f..4ab29ab3f 100644 --- a/public/react/src/modules/courses/Resource/Fileslistitem.js +++ b/public/react/src/modules/courses/Resource/Fileslistitem.js @@ -44,20 +44,16 @@ class Fileslistitem extends Component{ document.body.appendChild(link); link.href = result.data.url; console.log(newvalue) - link.download = Base64.decode(newvalue); + // link.download = Base64.decode(newvalue); //兼容火狐浏览器 // let evt = document.createEvent("MouseEvents"); // evt.initEvent("click", false, false); // link.dispatchEvent(evt); // document.body.removeChild(link); - - link.style.display = 'none'; - + link.style.display = 'none'; link.setAttribute('download',result.data.title); document.body.appendChild(link); link.click(); - - // // window.location.href=result.data.url; // let url = window.URL.createObjectURL(new Blob([result.data.url])); // let link = document.createElement('a'); From f423e2156134c260e4e760adc9884ec2ce2bf5e4 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 12:21:03 +0800 Subject: [PATCH 08/18] =?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 --- .../modules/courses/Resource/Fileslistitem.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js index 4ab29ab3f..5eef94d9f 100644 --- a/public/react/src/modules/courses/Resource/Fileslistitem.js +++ b/public/react/src/modules/courses/Resource/Fileslistitem.js @@ -31,6 +31,10 @@ class Fileslistitem extends Component{ let newvalue=Base64.encode(value) let {discussMessage,coursesId}=this.props let file_id=discussMessage.id + let link = document.createElement('a'); + document.body.appendChild(link); + link.download = Base64.decode(newvalue); + let url="/files/"+file_id+"/histories.json" axios.get(url,{ params:{ @@ -39,21 +43,15 @@ class Fileslistitem extends Component{ }).then((result)=>{ if(result.data.attachment_histories.length===0){ - - let link = document.createElement('a'); - document.body.appendChild(link); link.href = result.data.url; - console.log(newvalue) - // link.download = Base64.decode(newvalue); + link.style.display = 'none'; + document.body.appendChild(link); + link.click(); //兼容火狐浏览器 // let evt = document.createEvent("MouseEvents"); // evt.initEvent("click", false, false); // link.dispatchEvent(evt); // document.body.removeChild(link); - link.style.display = 'none'; - link.setAttribute('download',result.data.title); - document.body.appendChild(link); - link.click(); // // window.location.href=result.data.url; // let url = window.URL.createObjectURL(new Blob([result.data.url])); // let link = document.createElement('a'); From 6a75a6c56adb6c0ab6403424f755e7a7f3405140 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 12:35:03 +0800 Subject: [PATCH 09/18] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/Resource/Fileslistitem.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js index 5eef94d9f..239fd34a4 100644 --- a/public/react/src/modules/courses/Resource/Fileslistitem.js +++ b/public/react/src/modules/courses/Resource/Fileslistitem.js @@ -43,10 +43,10 @@ class Fileslistitem extends Component{ }).then((result)=>{ if(result.data.attachment_histories.length===0){ - link.href = result.data.url; - link.style.display = 'none'; - document.body.appendChild(link); - link.click(); + // link.href = result.data.url; + // link.style.display = 'none'; + // document.body.appendChild(link); + // link.click(); //兼容火狐浏览器 // let evt = document.createEvent("MouseEvents"); // evt.initEvent("click", false, false); @@ -60,7 +60,7 @@ class Fileslistitem extends Component{ // link.setAttribute('download',result.data.title); // document.body.appendChild(link); // link.click(); - + window.open=result.data.url; }else{ this.setState({ Showoldfiles:true, From 1414b85c6b91f030e23676cb2c1276cc1a52a465 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 12:42:48 +0800 Subject: [PATCH 10/18] =?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 239fd34a4..a9860f1e2 100644 --- a/public/react/src/modules/courses/Resource/Fileslistitem.js +++ b/public/react/src/modules/courses/Resource/Fileslistitem.js @@ -60,7 +60,7 @@ class Fileslistitem extends Component{ // link.setAttribute('download',result.data.title); // document.body.appendChild(link); // link.click(); - window.open=result.data.url; + window.open(result.data.url); }else{ this.setState({ Showoldfiles:true, From 32b94f640d9890d69eb143fe0f47f63c6823fd8b 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 12:55:40 +0800 Subject: [PATCH 11/18] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/Resource/Fileslistitem.js | 34 ++++++------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js index 239fd34a4..c0a55ee80 100644 --- a/public/react/src/modules/courses/Resource/Fileslistitem.js +++ b/public/react/src/modules/courses/Resource/Fileslistitem.js @@ -28,13 +28,8 @@ class Fileslistitem extends Component{ this.props.Settingtypes(discussMessage.id) } showfiles=(value)=>{ - let newvalue=Base64.encode(value) let {discussMessage,coursesId}=this.props let file_id=discussMessage.id - let link = document.createElement('a'); - document.body.appendChild(link); - link.download = Base64.decode(newvalue); - let url="/files/"+file_id+"/histories.json" axios.get(url,{ params:{ @@ -43,24 +38,17 @@ class Fileslistitem extends Component{ }).then((result)=>{ if(result.data.attachment_histories.length===0){ - // link.href = result.data.url; - // link.style.display = 'none'; - // document.body.appendChild(link); - // link.click(); - //兼容火狐浏览器 - // let evt = document.createEvent("MouseEvents"); - // evt.initEvent("click", false, false); - // link.dispatchEvent(evt); - // document.body.removeChild(link); - // // window.location.href=result.data.url; - // let url = window.URL.createObjectURL(new Blob([result.data.url])); - // let link = document.createElement('a'); - // link.style.display = 'none'; - // link.href = url; - // link.setAttribute('download',result.data.title); - // document.body.appendChild(link); - // link.click(); - window.open=result.data.url; + let link = document.createElement('a'); + // link.href = window.URL.createObjectURL(new Blob([result.data.url])); + link.href = result.data.url; + link.download = result.data.title; + //兼容火狐浏览器 + console.log(link) + document.body.appendChild(link); + let evt = document.createEvent("MouseEvents"); + evt.initEvent("click", false, false); + link.dispatchEvent(evt); + document.body.removeChild(link); }else{ this.setState({ Showoldfiles:true, From fc354bc549e9c59631f34dd0f2b7a93fd3829148 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 13:02:19 +0800 Subject: [PATCH 12/18] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/Resource/Fileslistitem.js | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js index c0a55ee80..3e1e21810 100644 --- a/public/react/src/modules/courses/Resource/Fileslistitem.js +++ b/public/react/src/modules/courses/Resource/Fileslistitem.js @@ -35,27 +35,27 @@ class Fileslistitem extends Component{ params:{ course_id:coursesId }, - }).then((result)=>{ + }).then((response)=>{ if(result.data.attachment_histories.length===0){ - let link = document.createElement('a'); - // link.href = window.URL.createObjectURL(new Blob([result.data.url])); - link.href = result.data.url; - link.download = result.data.title; - //兼容火狐浏览器 - console.log(link) - document.body.appendChild(link); - let evt = document.createEvent("MouseEvents"); - evt.initEvent("click", false, false); - link.dispatchEvent(evt); - document.body.removeChild(link); - }else{ + response.blob().then(blob => { + const aLink = document.createElement('a'); + document.body.appendChild(aLink); + aLink.style.display='none'; + const objectUrl = window.URL.createObjectURL(blob.data.url); + aLink.href = objectUrl; + aLink.download =blob.data.title; + aLink.click(); + document.body.removeChild(aLink); + }); + + }else{ this.setState({ Showoldfiles:true, allfiles:result.data }) } - // console.log(result) + }).catch((error)=>{ console.log(error) }) From 2cbf3f80304bbc4ff49189b69c2ff9f7dbbc6e3d 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 13:06:48 +0800 Subject: [PATCH 13/18] b --- public/react/src/modules/courses/Resource/Fileslistitem.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js index 3e1e21810..d068e86df 100644 --- a/public/react/src/modules/courses/Resource/Fileslistitem.js +++ b/public/react/src/modules/courses/Resource/Fileslistitem.js @@ -35,10 +35,10 @@ class Fileslistitem extends Component{ params:{ course_id:coursesId }, - }).then((response)=>{ + }).then((result)=>{ if(result.data.attachment_histories.length===0){ - response.blob().then(blob => { + result.blob().then(blob => { const aLink = document.createElement('a'); document.body.appendChild(aLink); aLink.style.display='none'; From f38091a59a549ebd7fb8f101806313c981fcf9bb 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 13:13:09 +0800 Subject: [PATCH 14/18] b --- .../modules/courses/Resource/Fileslistitem.js | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js index d068e86df..68d0f7542 100644 --- a/public/react/src/modules/courses/Resource/Fileslistitem.js +++ b/public/react/src/modules/courses/Resource/Fileslistitem.js @@ -38,16 +38,16 @@ class Fileslistitem extends Component{ }).then((result)=>{ if(result.data.attachment_histories.length===0){ - result.blob().then(blob => { - const aLink = document.createElement('a'); - document.body.appendChild(aLink); - aLink.style.display='none'; - const objectUrl = window.URL.createObjectURL(blob.data.url); - aLink.href = objectUrl; - aLink.download =blob.data.title; - aLink.click(); - document.body.removeChild(aLink); - }); + + const aLink = document.createElement('a'); + document.body.appendChild(aLink); + aLink.style.display='none'; + const objectUrl = window.URL.createObjectURL(result.data.url); + aLink.href = objectUrl; + aLink.download =result.data.title; + aLink.click(); + document.body.removeChild(aLink); + }else{ this.setState({ From f9a2d947098932eaa08bc7df4b8925901179953b 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 13:47:32 +0800 Subject: [PATCH 15/18] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/Resource/Fileslistitem.js | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js index 68d0f7542..cd46570bd 100644 --- a/public/react/src/modules/courses/Resource/Fileslistitem.js +++ b/public/react/src/modules/courses/Resource/Fileslistitem.js @@ -27,6 +27,17 @@ class Fileslistitem extends Component{ }) this.props.Settingtypes(discussMessage.id) } + + downloadfiles=(url,name)=>{ + const aLink = document.createElement('a'); + document.body.appendChild(aLink); + aLink.style.display='none'; + aLink.download =name; + aLink.href = url; + aLink.click(); + document.body.removeChild(aLink); + + } showfiles=(value)=>{ let {discussMessage,coursesId}=this.props let file_id=discussMessage.id @@ -38,17 +49,7 @@ class Fileslistitem extends Component{ }).then((result)=>{ if(result.data.attachment_histories.length===0){ - - const aLink = document.createElement('a'); - document.body.appendChild(aLink); - aLink.style.display='none'; - const objectUrl = window.URL.createObjectURL(result.data.url); - aLink.href = objectUrl; - aLink.download =result.data.title; - aLink.click(); - document.body.removeChild(aLink); - - + this.downloadfiles(result.data.url,filesname) }else{ this.setState({ Showoldfiles:true, From 2293487e85f969fcaaa5b2c0da54d7b0e1a34f74 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 13:51:44 +0800 Subject: [PATCH 16/18] b --- public/react/src/modules/courses/Resource/Fileslistitem.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js index cd46570bd..91d4738d5 100644 --- a/public/react/src/modules/courses/Resource/Fileslistitem.js +++ b/public/react/src/modules/courses/Resource/Fileslistitem.js @@ -30,13 +30,12 @@ class Fileslistitem extends Component{ downloadfiles=(url,name)=>{ const aLink = document.createElement('a'); - document.body.appendChild(aLink); aLink.style.display='none'; aLink.download =name; aLink.href = url; + document.body.appendChild(aLink); aLink.click(); - document.body.removeChild(aLink); - + // document.body.removeChild(aLink); } showfiles=(value)=>{ let {discussMessage,coursesId}=this.props @@ -49,7 +48,7 @@ class Fileslistitem extends Component{ }).then((result)=>{ if(result.data.attachment_histories.length===0){ - this.downloadfiles(result.data.url,filesname) + this.downloadfiles(result.data.url,result.data.title) }else{ this.setState({ Showoldfiles:true, From e8ff20d94cb59930d9958e390c3edb2ac93314c6 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 13:58:15 +0800 Subject: [PATCH 17/18] =?UTF-8?q?=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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js index 91d4738d5..6a1e16d6d 100644 --- a/public/react/src/modules/courses/Resource/Fileslistitem.js +++ b/public/react/src/modules/courses/Resource/Fileslistitem.js @@ -31,7 +31,8 @@ class Fileslistitem extends Component{ downloadfiles=(url,name)=>{ const aLink = document.createElement('a'); aLink.style.display='none'; - aLink.download =name; + console.log(name) + aLink.setAttribute('download',name) aLink.href = url; document.body.appendChild(aLink); aLink.click(); From 18f7edd511af7f1089420d517ca0af42506aa28c Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Sat, 6 Jul 2019 14:06:44 +0800 Subject: [PATCH 18/18] =?UTF-8?q?=E7=A7=81=E6=9C=89=E9=97=AE=E5=8D=B7?= =?UTF-8?q?=E7=9A=84lock=E7=9A=84tip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/poll/PollListItem.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/poll/PollListItem.js b/public/react/src/modules/courses/poll/PollListItem.js index 16770ce43..8e6198eae 100644 --- a/public/react/src/modules/courses/poll/PollListItem.js +++ b/public/react/src/modules/courses/poll/PollListItem.js @@ -21,6 +21,7 @@ class PollListItem extends Component{ const IsAdmin =this.props.isAdmin(); const isStudent = this.props.isStudent(); + const isNotMember = this.props.isNotMember(); let t= item.end_time ? moment(item.end_time) - moment() : 0; return( @@ -42,7 +43,7 @@ class PollListItem extends Component{ {item.polls_name} } { - item.lock_status === 0 ? :"" + item.lock_status === 0 ? :"" } {