@@ -1560,8 +1526,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..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,
@@ -457,87 +458,40 @@ 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 ),建议:
+
+ this.setState({
+ DownloadType:false,
+ DownloadMessageval:100
+ })
+ }else {
+ //因附件资料超过500M
+ this.setState({
+ DownloadType:false,
+ DownloadMessageval:500
+ })
+ }
+ }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)
- });
+ Downloadcal=()=>{
+ this.setState({
+ DownloadType:false,
+ DownloadMessageval:undefined
+ })
}
-
render() {
let {
data,
@@ -627,6 +581,13 @@ class ShixunStudentWork extends Component {
issCancel={()=>this.hideshowmodel()}
updatas={()=>this.getupdata()}
/>:""}
+
+
{/*立即发布*/}
导出
: ""}
diff --git a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js
index 0d9b4de8f..4dce1b5f2 100644
--- a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js
+++ b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js
@@ -8,6 +8,7 @@ import OfficialAcademicTranscript from './shixunreport/OfficialAcademicTranscrip
import Coursesshixundetails from './shixunreport/Coursesshixundetails';
import Shixunechart from './shixunreport/Shixunechart';
import {UnControlled as CodeMirror} from 'react-codemirror2';
+import DownloadMessage from '../../modals/DownloadMessage';
import 'codemirror/mode/cmake/cmake';
import 'codemirror/mode/xml/xml';
import 'codemirror/mode/javascript/javascript';
@@ -30,46 +31,35 @@ 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 if(response.data.status&&response.data.status===-2){
+ if(response.data.messages === "100"){
+ // 已超出文件导出的上限数量(100 ),建议:
- }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对象
+ this.setState({
+ DownloadType:false,
+ DownloadMessageval:100
+ })
+ }else {
+ //因附件资料超过500M
+ this.setState({
+ DownloadType:false,
+ DownloadMessageval:500
+ })
+ }
+ }else {
+ window.open(url, '_blank');
}
}).catch((error) => {
console.log(error)
});
}
+
+
componentDidMount() {
this.setState({
spinning:true
@@ -103,6 +93,12 @@ class ShixunWorkReport extends Component {
}
}
}
+ Downloadcal=()=>{
+ this.setState({
+ DownloadType:false,
+ DownloadMessageval:undefined
+ })
+ }
render() {
let{data} =this.state;
let category_id=data===undefined?"":data.category.category_id;
@@ -128,13 +124,18 @@ class ShixunWorkReport extends Component {
{data&&data.username}
-
+