From 7d8d1e6ecf7966f677fdd011fb34946d02987f71 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 17:17:40 +0800
Subject: [PATCH 1/7] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../tasks/GraduationTasksSubmitedit.js | 24 ++++++++++++++-----
.../tasks/GraduationTasksSubmitnew.js | 24 +++++++++++++------
2 files changed, 35 insertions(+), 13 deletions(-)
diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js
index 433a9c250..7f5553e6c 100644
--- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js
+++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js
@@ -2,7 +2,7 @@ import React,{Component} from "React";
import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal,Spin,Tooltip} from "antd";
import {Link} from 'react-router-dom';
import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor';
-import { WordsBtn,getUrl ,bytesToSize,getImageUrl} from 'educoder';
+import { WordsBtn,getUrl ,bytesToSize,getImageUrl,appendFileSizeToUploadFileAll} from 'educoder';
import axios from 'axios';
import Modals from '../../../modals/Modals';
const Search = Input.Search;
@@ -116,12 +116,12 @@ class GraduationTasksSubmitedit extends Component{
}
// 附件相关 START
handleChange = (info) => {
- let fileList = info.fileList;
- // for(var list of fileList ){
- // console.log(list)
- // }
- this.setState({ fileList });
+ if (info.file.status === 'uploading') {
+
+ let fileList = info.fileList;
+ this.setState({ fileList:appendFileSizeToUploadFileAll(fileList) });
+ }
}
//onAttachmentRemove = (file) => {
@@ -479,6 +479,18 @@ class GraduationTasksSubmitedit extends Component{
onChange: this.handleChange,
onRemove: this.onAttachmentRemove,
beforeUpload: (file) => {
+ // TODO 文件存在则提示并退出
+ let gotSameFile = false;
+ this.state.fileList && this.state.fileList.some((item) => {
+ if (item.name && item.name.startsWith(file.name)) {
+ gotSameFile = true;
+ return true
+ }
+ })
+ if (gotSameFile) {
+ this.props.showNotification("该附件已被上传!")
+ return false
+ }
console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 150;
if (!isLt150M) {
diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js
index bbe72a740..cfbd50453 100644
--- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js
+++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js
@@ -2,7 +2,7 @@ import React,{Component} from "React";
import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal,Tooltip,Spin} from "antd";
import {Link} from 'react-router-dom';
import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor';
-import { WordsBtn,getUrl,getImageUrl,bytesToSize} from 'educoder';
+import { WordsBtn,getUrl,getImageUrl,bytesToSize,appendFileSizeToUploadFileAll} from 'educoder';
import axios from 'axios';
import Modals from '../../../modals/Modals';
const Search = Input.Search;
@@ -123,12 +123,10 @@ class GraduationTasksSubmitnew extends Component{
}
// 附件相关 START
handleChange = (info) => {
- let fileList = info.fileList;
-
- // for(var list of fileList ){
- // console.log(list)
- // }
- this.setState({ fileList });
+ if (info.file.status === 'uploading') {
+ let fileList = info.fileList;
+ this.setState({ fileList:appendFileSizeToUploadFileAll(fileList) });
+ }
}
onAttachmentRemove = (file) => {
@@ -478,6 +476,18 @@ render(){
onChange: this.handleChange,
onRemove: this.onAttachmentRemove,
beforeUpload: (file) => {
+ // TODO 文件存在则提示并退出
+ let gotSameFile = false;
+ this.state.fileList && this.state.fileList.some((item) => {
+ if (item.name && item.name.startsWith(file.name)) {
+ gotSameFile = true;
+ return true
+ }
+ })
+ if (gotSameFile) {
+ this.props.showNotification("该附件已被上传!")
+ return false
+ }
console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 150;
if (!isLt150M) {
From 5690f0b21f83e1677f85bdcb87471bba5116bcf1 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 17:20:40 +0800
Subject: [PATCH 2/7] =?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, 9 insertions(+), 1 deletion(-)
diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js
index 57c69f837..4e6a9384c 100644
--- a/public/react/src/modules/courses/Resource/Fileslistitem.js
+++ b/public/react/src/modules/courses/Resource/Fileslistitem.js
@@ -56,7 +56,15 @@ class Fileslistitem extends Component{
},
}).then((result)=>{
if(result.data.attachment_histories.length===0){
- this.downloadfiles(result.data.url)
+ let link = document.createElement('a');
+ document.body.appendChild(link);
+ link.href = result.data.url;
+ link.download = result.data.title;
+ //兼容火狐浏览器
+ let evt = document.createEvent("MouseEvents");
+ evt.initEvent("click", false, false);
+ link.dispatchEvent(evt);
+ document.body.removeChild(link);
}else{
this.setState({
Showoldfiles:true,
From 2ac3c9084121346cab2f9ad38bc782ebd8f5ac8b 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 17:20:51 +0800
Subject: [PATCH 3/7] =?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 | 20 +------------------
1 file changed, 1 insertion(+), 19 deletions(-)
diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js
index 4e6a9384c..6dc38b0fb 100644
--- a/public/react/src/modules/courses/Resource/Fileslistitem.js
+++ b/public/react/src/modules/courses/Resource/Fileslistitem.js
@@ -27,25 +27,7 @@ class Fileslistitem extends Component{
})
this.props.Settingtypes(discussMessage.id)
}
-
- downloadfiles=(url)=>{
- axios.get((url),{responseType: 'blob'}).then((response) => {
- const blob = new Blob([response.data]);
- const downloadElement = document.createElement('a');
- const href = window.URL.createObjectURL(blob);
- // const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
- const string = response.headers['content-disposition'].split('=')[1];
- downloadElement.href = href;
- downloadElement.download = string;
- document.body.appendChild(downloadElement);
- downloadElement.click();
- document.body.removeChild(downloadElement) ;// 下载完成移除元素
- window.URL.revokeObjectURL(href) // 释放掉blob对象
- }).catch((error) => {
- console.log(error)
- });
- }
-
+
showfiles=(value)=>{
let {discussMessage,coursesId}=this.props
let file_id=discussMessage.id
From 8c97955ab674149ee331288a8706ced9392ba970 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 17:21:11 +0800
Subject: [PATCH 4/7] =?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 | 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 6dc38b0fb..8a8ff674c 100644
--- a/public/react/src/modules/courses/Resource/Fileslistitem.js
+++ b/public/react/src/modules/courses/Resource/Fileslistitem.js
@@ -27,7 +27,7 @@ class Fileslistitem extends Component{
})
this.props.Settingtypes(discussMessage.id)
}
-
+
showfiles=(value)=>{
let {discussMessage,coursesId}=this.props
let file_id=discussMessage.id
From 8b99e0f41ec98a453cf52eef19635a4b0fbd53d0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Sun, 7 Jul 2019 19:46:31 +0800
Subject: [PATCH 5/7] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../exercise/Testpapersettinghomepage.js | 17 ++-
.../courses/shixunHomework/Httpdownloads.js | 6 +-
.../courses/shixunHomework/Listofworks.js | 89 +++-------------
.../shixunHomework/ShixunStudentWork.js | 83 ++-------------
.../shixunHomework/ShixunWorkReport.js | 50 +++------
.../shixunHomework/Trainingjobsetting.js | 100 ++++--------------
.../shixunHomework/Workquestionandanswer.js | 92 +++-------------
.../react/src/modules/login/EducoderLogin.js | 2 +-
public/react/src/modules/user/Interestpage.js | 55 ++++++++--
9 files changed, 139 insertions(+), 355 deletions(-)
diff --git a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js
index 977ae20df..b84db0170 100644
--- a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js
+++ b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js
@@ -112,10 +112,17 @@ class Testpapersettinghomepage extends Component{
experiment=(url)=>{
axios.get(url).then((response) => {
- if(response.status === 200){
- window.open(url, '_blank');
-
- }
+ if(response.data.status&&response.data.status===-1){
+
+ }else if(response.data.status&&response.data.status===-2){
+ if(response.data.messages === "100"){
+ // 已超出文件导出的上限数量(100 ),建议:
+ }else {
+ //因附件资料超过500M
+ }
+ }else {
+ window.open(url, '_blank');
+ }
}).catch((error) => {
console.log(error)
});
@@ -262,7 +269,7 @@ class Testpapersettinghomepage extends Component{
导出
:""}
diff --git a/public/react/src/modules/courses/shixunHomework/Httpdownloads.js b/public/react/src/modules/courses/shixunHomework/Httpdownloads.js
index 84b1d090b..11bd91f6b 100644
--- a/public/react/src/modules/courses/shixunHomework/Httpdownloads.js
+++ b/public/react/src/modules/courses/shixunHomework/Httpdownloads.js
@@ -3,7 +3,8 @@ import axios from 'axios';
// 导出实习报告批量zip 、xlsx 类型
-export function Internshipreportsy (url,struy,types,stingtype,response){
+export function Internshipreportsy (url,struy,types,stingtype){
+ axios.get((url),{responseType: 'blob'}).then((response) => {
const blob = new Blob([response.data], { type: stingtype });
const downloadElement = document.createElement('a');
const href = window.URL.createObjectURL(blob);
@@ -14,4 +15,7 @@ export function Internshipreportsy (url,struy,types,stingtype,response){
downloadElement.click();
document.body.removeChild(downloadElement) ;// 下载完成移除元素
window.URL.revokeObjectURL(href) // 释放掉blob对象
+ }).catch((error) => {
+ console.log(error)
+ });
}
\ No newline at end of file
diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js
index 832d5eaa4..db023b97d 100644
--- a/public/react/src/modules/courses/shixunHomework/Listofworks.js
+++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js
@@ -1338,80 +1338,23 @@ class Listofworks extends Component {
}
/// 确认是否下载
- confirmysl(url,type){
- 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);
- }
-
+ confirmysl(url){
axios.get(url).then((response) => {
- if(response !== undefined){
- if(response.data.status&&response.data.status===-1){
-
- }else if(response.data.status&&response.data.status===-2){
-
- }else {
- // if(type === 1){
- // Internshipreportsy(url,struy,".zip",'application/zip');
- // }else{
- Internshipreportsy(url,struy,".xlsx",'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',response);
- // }
- }
- }
- }).catch((error) => {
+ if(response.data.status&&response.data.status===-1){
+
+ }else if(response.data.status&&response.data.status===-2){
+ if(response.data.messages === "100"){
+ // 已超出文件导出的上限数量(100 ),建议:
+ }else {
+ //因附件资料超过500M
+ }
+ }else {
+ window.open(url, '_blank');
+ }
+ }).catch((error) => {
console.log(error)
- });
+ });
}
- // 导出实习报告批量
- // internshipreport = (url,struy,types,stingtype)=>{
- // console.log("internshipreport");
- //
- // axios.get((url),{responseType: 'blob'}).then((response) => {
- // console.log("1350");
- // console.log(response);
- // const type='application/zip'//ZIP文件
- // const blob = new Blob([response.data], { type: stingtype });
- // const downloadElement = document.createElement('a');
- // const href = window.URL.createObjectURL(blob);
- // const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
- // console.log(response.headers['content-disposition'].split('=')[1]);
- // downloadElement.href = href;
- // downloadElement.download = string+struy+types;
- // document.body.appendChild(downloadElement);
- // downloadElement.click();
- // document.body.removeChild(downloadElement) ;// 下载完成移除元素
- // window.URL.revokeObjectURL(href) // 释放掉blob对象
- // }).catch((error) => {
- // console.log(error)
- // });
- // }
- // // 课堂学生成绩的导出下载
- // Classstudentachievement=(url,struy)=>{
- // console.log("Classstudentachievement");
- // axios.get((url),{responseType: 'blob'}).then((response) => {
- // console.log("1374");
- // console.log(response);
- // const type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' //excel文件
- // const blob = new Blob([response.data], { type: type });
- // const downloadElement = document.createElement('a');
- // const href = window.URL.createObjectURL(blob);
- // const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
- // console.log(response.headers['content-disposition'].split('=')[1]);
- // downloadElement.href = href;
- // downloadElement.download =string+struy+".xlsx";
- // document.body.appendChild(downloadElement);
- // downloadElement.click();
- // document.body.removeChild(downloadElement); // 下载完成移除元素
- // window.URL.revokeObjectURL(href) // 释放掉blob对象
- // }).catch((error) => {
- // console.log(error)
- // });
- // }
-
render() {
// console.log("Listofworks.js000")
@@ -1560,8 +1503,8 @@ class Listofworks extends Component {
{this.props.isAdmin()?
导出
:""}
diff --git a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js
index 992a957cf..de7aab180 100644
--- a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js
+++ b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js
@@ -457,86 +457,25 @@ class ShixunStudentWork extends Component {
})
}
// 导出实习报告批量
- internshipreport = (url) => {
- console.log("internshipreport");
- console.log("internshipreport");
- 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);
- }
-
+ /// 确认是否下载
+ confirmysl(url){
axios.get(url).then((response) => {
- console.log("326");
- console.log(response);
if(response.data.status&&response.data.status===-1){
-
}else if(response.data.status&&response.data.status===-2){
-
- }else{
- const type='application/zip'//ZIP文件
- const blob = new Blob([response.data], { type: type })
- const downloadElement = document.createElement('a')
- const href = window.URL.createObjectURL(blob)
- const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
- console.log(response.headers['content-disposition'].split('=')[1]);
- downloadElement.href = href
- downloadElement.download = string+struy+".zip"
- document.body.appendChild(downloadElement)
- downloadElement.click()
- document.body.removeChild(downloadElement) // 下载完成移除元素
- window.URL.revokeObjectURL(href) // 释放掉blob对象
+ if(response.data.messages === "100"){
+ // 已超出文件导出的上限数量(100 ),建议:
+ }else {
+ //因附件资料超过500M
+ }
+ }else {
+ window.open(url, '_blank');
}
-
}).catch((error) => {
console.log(error)
});
}
- // 课堂学生成绩的导出下载
- 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).then((response) => {
- console.log("1374");
- console.log(response);
- if(response.data.status&&response.data.status===-1){
-
-
- }else if(response.data.status&&response.data.status===-2){
-
- }else{
- const type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' //excel文件
- const blob = new Blob([response.data], { type: type })
- const downloadElement = document.createElement('a')
- const href = window.URL.createObjectURL(blob)
- const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
- console.log(response.headers['content-disposition'].split('=')[1]);
- downloadElement.href = href
- downloadElement.download =string+struy+".xlsx";
- document.body.appendChild(downloadElement)
- downloadElement.click()
- document.body.removeChild(downloadElement) // 下载完成移除元素
- window.URL.revokeObjectURL(href) // 释放掉blob对象
-
- }
- }).catch((error) => {
- console.log(error)
- });
- }
render() {
let {
@@ -722,9 +661,9 @@ class ShixunStudentWork extends Component {
{this.props.isAdmin() ?
导出
: ""}
diff --git a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js
index 0d9b4de8f..2f6bc8856 100644
--- a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js
+++ b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js
@@ -30,46 +30,26 @@ class ShixunWorkReport extends Component {
spinning:true
}
}
- // 导出实习报告批量
- internshipreport = (url) => {
- console.log("internshipreport");
- 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);
- if(response.status&&response.status===-1){
-
+ /// 确认是否下载
+ confirmysl(url){
+ axios.get(url).then((response) => {
+ if(response.data.status&&response.data.status===-1){
- }else if(response.status&&response.status===-2){
-
- }else{
- // window.location.href("/api"+url);
- // console.log("开始下载zip文件")
- const type='application/zip'//ZIP文件
- const blob = new Blob([response.data], { type: type })
- const downloadElement = document.createElement('a')
- const href = window.URL.createObjectURL(blob)
- const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
- console.log(response.headers['content-disposition'].split('=')[1]);
- downloadElement.href = href
- downloadElement.download = string+struy+".zip"
- document.body.appendChild(downloadElement)
- downloadElement.click()
- document.body.removeChild(downloadElement) // 下载完成移除元素
- window.URL.revokeObjectURL(href) // 释放掉blob对象
+ }else if(response.data.status&&response.data.status===-2){
+ if(response.data.messages === "100"){
+ // 已超出文件导出的上限数量(100 ),建议:
+ }else {
+ //因附件资料超过500M
+ }
+ }else {
+ window.open(url, '_blank');
}
}).catch((error) => {
console.log(error)
});
}
+
+
componentDidMount() {
this.setState({
spinning:true
@@ -134,7 +114,7 @@ class ShixunWorkReport extends Component {
{/*{this.props.isAdmin()?导出实训报告数据:""}*/}
{this.props.isAdmin() ? this.internshipreport(`/zip/shixun_report?homework_common_id=${homeworkid}`)}
+ onClick={()=>this.confirmysl(`/zip/shixun_report?homework_common_id=${homeworkid}`)}
>导出实训报告数据 : ""}
diff --git a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
index 97e8d9aa9..466f2e9b7 100644
--- a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
+++ b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
@@ -1609,86 +1609,24 @@ class Trainingjobsetting extends Component {
showmodel:false
})
}
- // 导出实习报告批量
- internshipreport = (url) => {
- console.log("internshipreport");
- 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);
- if(response.status&&response.status===-1){
-
-
- }else if(response.status&&response.status===-2){
-
- }else{
- // window.location.href("/api"+url);
- // console.log("开始下载zip文件")
- const type='application/zip'//ZIP文件
- const blob = new Blob([response.data], { type: type })
- const downloadElement = document.createElement('a')
- const href = window.URL.createObjectURL(blob)
- const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
- console.log(response.headers['content-disposition'].split('=')[1]);
- downloadElement.href = href
- downloadElement.download = string+struy+".zip"
- document.body.appendChild(downloadElement)
- downloadElement.click()
- document.body.removeChild(downloadElement) // 下载完成移除元素
- window.URL.revokeObjectURL(href) // 释放掉blob对象
- }
- }).catch((error) => {
- console.log(error)
- });
- }
- // 课堂学生成绩的导出下载
- 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);
- if(response.status&&response.status===-1){
-
-
- }else if(response.status&&response.status===-2){
-
- }else{
- const type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' //excel文件
- const blob = new Blob([response.data], { type: type })
- const downloadElement = document.createElement('a')
- const href = window.URL.createObjectURL(blob)
- const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
- console.log(response.headers['content-disposition'].split('=')[1]);
- downloadElement.href = href
- downloadElement.download =string+struy+".xlsx";
- document.body.appendChild(downloadElement)
- downloadElement.click()
- document.body.removeChild(downloadElement) // 下载完成移除元素
- window.URL.revokeObjectURL(href) // 释放掉blob对象
- }
- }).catch((error) => {
- console.log(error)
- });
+ /// 确认是否下载
+ confirmysl(url){
+ axios.get(url).then((response) => {
+ if(response.data.status&&response.data.status===-1){
+
+ }else if(response.data.status&&response.data.status===-2){
+ if(response.data.messages === "100"){
+ // 已超出文件导出的上限数量(100 ),建议:
+ }else {
+ //因附件资料超过500M
+ }
+ }else {
+ window.open(url, '_blank');
+ }
+ }).catch((error) => {
+ console.log(error)
+ });
}
@@ -1831,9 +1769,9 @@ class Trainingjobsetting extends Component {
{this.props.isAdmin() ?
导出
: ""}
diff --git a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js
index 63fa30370..0bd32271a 100644
--- a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js
+++ b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js
@@ -319,83 +319,19 @@ class Workquestionandanswer extends Component {
})
}
+ /// 确认是否下载
+ confirmysl(url){
+ axios.get(url).then((response) => {
+ if(response.data.status&&response.data.status===-1){
- // 导出实习报告批量
- internshipreport = (url) => {
- console.log("internshipreport");
- 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);
- if(response.status&&response.status===-1){
-
-
- }else if(response.status&&response.status===-2){
-
- }else{
- // window.location.href("/api"+url);
- // console.log("开始下载zip文件")
- const type='application/zip'//ZIP文件
- const blob = new Blob([response.data], { type: type })
- const downloadElement = document.createElement('a')
- const href = window.URL.createObjectURL(blob)
- const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
- console.log(response.headers['content-disposition'].split('=')[1]);
- downloadElement.href = href
- downloadElement.download = string+struy+".zip"
- document.body.appendChild(downloadElement)
- downloadElement.click()
- document.body.removeChild(downloadElement) // 下载完成移除元素
- window.URL.revokeObjectURL(href) // 释放掉blob对象
- }
- }).catch((error) => {
- console.log(error)
- });
- }
-
- // 课堂学生成绩的导出下载
- 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);
- if(response.status&&response.status===-1){
-
-
- }else if(response.status&&response.status===-2){
-
- }else{
- const type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' //excel文件
- const blob = new Blob([response.data], { type: type })
- const downloadElement = document.createElement('a')
- const href = window.URL.createObjectURL(blob)
- const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
- console.log(response.headers['content-disposition'].split('=')[1]);
- downloadElement.href = href
- downloadElement.download =string+struy+".xlsx";
- document.body.appendChild(downloadElement)
- downloadElement.click()
- document.body.removeChild(downloadElement) // 下载完成移除元素
- window.URL.revokeObjectURL(href) // 释放掉blob对象
+ }else if(response.data.status&&response.data.status===-2){
+ if(response.data.messages === "100"){
+ // 已超出文件导出的上限数量(100 ),建议:
+ }else {
+ //因附件资料超过500M
+ }
+ }else {
+ window.open(url, '_blank');
}
}).catch((error) => {
console.log(error)
@@ -527,9 +463,9 @@ class Workquestionandanswer extends Component {
导出
: ""}
diff --git a/public/react/src/modules/login/EducoderLogin.js b/public/react/src/modules/login/EducoderLogin.js
index 7d9a0be9d..9dcdbfcf2 100644
--- a/public/react/src/modules/login/EducoderLogin.js
+++ b/public/react/src/modules/login/EducoderLogin.js
@@ -165,7 +165,7 @@ class EducoderLogin extends Component {
this.Setshowbool(e)} >
+ Setshowbool={(e)=>this.Setshowbool(e,name,pass)} >
diff --git a/public/react/src/modules/user/Interestpage.js b/public/react/src/modules/user/Interestpage.js
index 1a3d19e86..97a52bae9 100644
--- a/public/react/src/modules/user/Interestpage.js
+++ b/public/react/src/modules/user/Interestpage.js
@@ -31,6 +31,42 @@ class InterestpageComponent extends Component {
passmm:this.props.passmm,
}
}
+
+ componentWillReceiveProps(nextProps) {
+ // console.log("46");
+ // console.log(nextProps);
+ // console.log(this.props);
+ if (nextProps.namezh != this.props.namezh) {
+ // console.log("50");
+ // console.log(nextProps.user);
+ if (nextProps.namezh !== undefined) {
+ // console.log("53");
+ // console.log(nextProps.user);
+ this.setState({
+ namezh: nextProps.namezh,
+ })
+ }
+
+
+ }
+ if (nextProps.passmm != this.props.passmm) {
+ // console.log("50");
+ // console.log(nextProps.user);
+ if (nextProps.passmm !== undefined) {
+ // console.log("53");
+ // console.log(nextProps.user);
+ this.setState({
+ passmm: nextProps.passmm,
+ })
+ }
+
+
+ }
+
+
+ }
+
+
Clickteacher=(e)=>{
console.log(e);
if(e === "teacher"){
@@ -98,6 +134,8 @@ class InterestpageComponent extends Component {
//跳转然后登入
Jumptotheinterestpage=()=>{
+ console.log(this.state.login);
+ console.log(this.state.password);
var url = "/accounts/login.json";
axios.post(url, {
login: this.props.login,
@@ -107,16 +145,15 @@ class InterestpageComponent extends Component {
return
}
if (response.status === 200) {
- if (response.data.status === 402) {
- window.location.href = response.data.url;
- } else {
- broadcastChannelPostMessage('refreshPage')
- this.setState({
- isRender: false
- })
+ // if (response.data.status === 402) {
+ // window.location.href = response.data.url;
+ // } else {
+ // broadcastChannelPostMessage('refreshPage')
+ // this.setState({
+ // isRender: false
+ // })
window.location.href = "/"
-
- }
+ // }
}
From 68c1d08dd39f0cc47f0cd9915608a426f2a968c9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Sun, 7 Jul 2019 20:37:15 +0800
Subject: [PATCH 6/7] =?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/exercise/Exercisesetting.js | 2 +-
.../exercise/Testpapersettinghomepage.js | 22 ++++++++
.../courses/shixunHomework/Listofworks.js | 25 ++++++++-
.../shixunHomework/ShixunStudentWork.js | 26 +++++++++-
.../shixunHomework/ShixunWorkReport.js | 23 ++++++++-
.../shixunHomework/Trainingjobsetting.js | 25 ++++++++-
.../shixunHomework/Workquestionandanswer.js | 29 ++++++++---
.../src/modules/modals/DownloadMessage.js | 51 +++++++++++++++++++
8 files changed, 188 insertions(+), 15 deletions(-)
create mode 100644 public/react/src/modules/modals/DownloadMessage.js
diff --git a/public/react/src/modules/courses/exercise/Exercisesetting.js b/public/react/src/modules/courses/exercise/Exercisesetting.js
index 1e151b654..0a2ce11ba 100644
--- a/public/react/src/modules/courses/exercise/Exercisesetting.js
+++ b/public/react/src/modules/courses/exercise/Exercisesetting.js
@@ -548,7 +548,7 @@ class Exercisesetting extends Component{
},
};
- console.log(flagPageEdit===true?polls&&polls.exercise_status===1?3:2:1)
+ // console.log(flagPageEdit===true?polls&&polls.exercise_status===1?3:2:1)
return(
{
+ this.setState({
+ DownloadType:false,
+ DownloadMessageval:undefined
+ })
+ }
render(){
let {tab,visible,Commonheadofthetestpaper}=this.state;
const isAdmin =this.props.isAdmin();
@@ -166,6 +182,12 @@ class Testpapersettinghomepage extends Component{
return(
+
{/* 公用的提示弹框 */}
{this.state.Modalstype===true?
{
+ this.setState({
+ DownloadType:false,
+ DownloadMessageval:undefined
+ })
+ }
render() {
// console.log("Listofworks.js000")
@@ -1379,7 +1396,13 @@ class Listofworks extends Component {
issCancel={() => this.hideshowmodel()}
updatas={() => this.isupdatas()}
/> : ""}
-
+
+
{visibles === true ?
diff --git a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js
index de7aab180..2d2babb09 100644
--- a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js
+++ b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js
@@ -3,7 +3,8 @@ import CoursesListType from '../coursesPublic/CoursesListType';
import {WordsBtn,ActionBtn} from 'educoder';
import ShixunWorkModal from './Shixunworkdetails/ShixunWorkModal';
import HomeworkModal from "../coursesPublic/HomeworkModal";
-import NoneData from '../coursesPublic/NoneData'
+import NoneData from '../coursesPublic/NoneData';
+import DownloadMessage from '../../modals/DownloadMessage';
import {
Form,
Select,
@@ -465,8 +466,17 @@ class ShixunStudentWork extends Component {
}else if(response.data.status&&response.data.status===-2){
if(response.data.messages === "100"){
// 已超出文件导出的上限数量(100 ),建议:
+
+ this.setState({
+ DownloadType:false,
+ DownloadMessageval:100
+ })
}else {
//因附件资料超过500M
+ this.setState({
+ DownloadType:false,
+ DownloadMessageval:500
+ })
}
}else {
window.open(url, '_blank');
@@ -476,7 +486,12 @@ class ShixunStudentWork extends Component {
});
}
-
+ Downloadcal=()=>{
+ this.setState({
+ DownloadType:false,
+ DownloadMessageval:undefined
+ })
+ }
render() {
let {
data,
@@ -566,6 +581,13 @@ class ShixunStudentWork extends Component {
issCancel={()=>this.hideshowmodel()}
updatas={()=>this.getupdata()}
/>:""}
+
+
{/*立即发布*/}
{
+ this.setState({
+ DownloadType:false,
+ DownloadMessageval:undefined
+ })
+ }
render() {
let{data} =this.state;
let category_id=data===undefined?"":data.category.category_id;
@@ -108,7 +124,12 @@ class ShixunWorkReport extends Component {
{data&&data.username}
-
+
{data&&data.shixun_name}
{/*{this.props.isAdmin()?
导出实训报告数据:""}*/}
diff --git a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
index 466f2e9b7..1ff1c1170 100644
--- a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
+++ b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
@@ -27,7 +27,7 @@ import '../poll/pollStyle.css'
import moment from 'moment';
import 'moment/locale/zh-cn';
import Modals from "../../modals/Modals";
-
+import DownloadMessage from '../../modals/DownloadMessage';
const RadioGroup = Radio.Group;
//GraduationTaskssetting.js
@@ -1618,8 +1618,16 @@ class Trainingjobsetting extends Component {
}else if(response.data.status&&response.data.status===-2){
if(response.data.messages === "100"){
// 已超出文件导出的上限数量(100 ),建议:
+ this.setState({
+ DownloadType:false,
+ DownloadMessageval:100
+ })
}else {
//因附件资料超过500M
+ this.setState({
+ DownloadType:false,
+ DownloadMessageval:500
+ })
}
}else {
window.open(url, '_blank');
@@ -1629,7 +1637,12 @@ class Trainingjobsetting extends Component {
});
}
-
+ Downloadcal=()=>{
+ this.setState({
+ DownloadType:false,
+ DownloadMessageval:undefined
+ })
+ }
render() {
@@ -1663,6 +1676,14 @@ class Trainingjobsetting extends Component {
data={[]}
issCancel={()=>this.hideshowmodel()}
/>:""}
+
+
+
{/*立即发布*/}
{
+ this.setState({
+ DownloadType:false,
+ DownloadMessageval:undefined
+ })
+ }
render() {
const dateFormat = 'YYYY-MM-DD HH:mm:ss';
let {
@@ -366,6 +373,12 @@ class Workquestionandanswer extends Component {
issCancel={() => this.hideshowmodel()}
updatas={() => this.isupdatas()}
/> : ""}
+
{/*立即发布*/}
{
+ this.props.modalCancel();
+ window.open(`/users/${this.props.user.login}/private_messages`)
+ }
+render() {
+
+ return(
+
+
+ {this.props.value===500?
+
因附件资料超过500M,您可以通过检索分批下载
+
或者通过微信或者QQ联系管理员辅助您打包下载
+ :this.props.value===100?
+
+
已超出文件导出的上限数量( 100 ),建议:
+
1.通过检索分批次下载
+
2.联系管理员辅助下载
+
+ :""}
+
+
+
+ )
+ }
+}
+
+export default DownloadMessage;
\ No newline at end of file
From 170e8b8a8dcb556311f7e65762b9952fd5748ba8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Sun, 7 Jul 2019 20:46:16 +0800
Subject: [PATCH 7/7] b
---
public/react/src/modules/login/EducoderLogin.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/react/src/modules/login/EducoderLogin.js b/public/react/src/modules/login/EducoderLogin.js
index 9dcdbfcf2..787acedce 100644
--- a/public/react/src/modules/login/EducoderLogin.js
+++ b/public/react/src/modules/login/EducoderLogin.js
@@ -165,7 +165,7 @@ class EducoderLogin extends Component {
this.Setshowbool(e,name,pass)} >
+ Setshowbool={(e,name,pass)=>this.Setshowbool(e,name,pass)} >