diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js index 57c69f837..8a8ff674c 100644 --- a/public/react/src/modules/courses/Resource/Fileslistitem.js +++ b/public/react/src/modules/courses/Resource/Fileslistitem.js @@ -28,24 +28,6 @@ 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 @@ -56,7 +38,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, 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(
{ 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 ),建议: + this.setState({ + DownloadType:false, + DownloadMessageval:100 + }) + }else { + //因附件资料超过500M + this.setState({ + DownloadType:false, + DownloadMessageval:500 + }) + } + }else { + window.open(url, '_blank'); + } }).catch((error) => { console.log(error) }); @@ -152,6 +168,13 @@ class Testpapersettinghomepage extends Component{ Loadtype:false }) } + + Downloadcal=()=>{ + this.setState({ + DownloadType:false, + DownloadMessageval:undefined + }) + } render(){ let {tab,visible,Commonheadofthetestpaper}=this.state; const isAdmin =this.props.isAdmin(); @@ -159,6 +182,12 @@ class Testpapersettinghomepage extends Component{ return(
+
{/* 公用的提示弹框 */} {this.state.Modalstype===true? :""} 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) { 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..50faef559 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworks.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js @@ -4,6 +4,7 @@ import {WordsBtn, ActionBtn} from 'educoder'; import TraineetraininginformationModal from './TraineetraininginformationModal'; import ModulationModal from "../coursesPublic/ModulationModal"; import HomeworkModal from "../coursesPublic/HomeworkModal"; +import DownloadMessage from '../../modals/DownloadMessage'; import {Base64} from 'js-base64'; import {Internshipreportsy} from './Httpdownloads' import { @@ -1338,80 +1339,39 @@ 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 ),建议: + + this.setState({ + DownloadType:false, + DownloadMessageval:100 + }) + }else { + //因附件资料超过500M + this.setState({ + DownloadType:false, + DownloadMessageval:500 + }) + } + }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) - // }); - // } + Downloadcal=()=>{ + this.setState({ + DownloadType:false, + DownloadMessageval:undefined + }) + } render() { // console.log("Listofworks.js000") @@ -1436,7 +1396,13 @@ class Listofworks extends Component { issCancel={() => this.hideshowmodel()} updatas={() => this.isupdatas()} /> : ""} - + + {visibles === true ?
@@ -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}

    - + diff --git a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js index 97e8d9aa9..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 @@ -1609,89 +1609,40 @@ 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 ),建议: + this.setState({ + DownloadType:false, + DownloadMessageval:100 + }) + }else { + //因附件资料超过500M + this.setState({ + DownloadType:false, + DownloadMessageval:500 + }) + } + }else { + window.open(url, '_blank'); + } + }).catch((error) => { + console.log(error) + }); } - + Downloadcal=()=>{ + this.setState({ + DownloadType:false, + DownloadMessageval:undefined + }) + } render() { @@ -1725,6 +1676,14 @@ class Trainingjobsetting extends Component { data={[]} issCancel={()=>this.hideshowmodel()} />:""} + + + {/*立即发布*/} 导出 : ""} diff --git a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js index 63fa30370..a02ec50e7 100644 --- a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js +++ b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js @@ -1,8 +1,6 @@ import React, {Component} from "react"; import CoursesListType from '../coursesPublic/CoursesListType'; import {WordsBtn, ActionBtn, markdownToHTML} from 'educoder'; -import GraduateTopicReply from '../graduation/topics/GraduateTopicReply' -import MemoDetailMDEditortwo from '../../forums/MemoDetailMDEditortwo' import { Form, Select, @@ -37,13 +35,9 @@ import CommonReply from "../common/comments/CommonReply"; import Homeworddescription from "../shixunHomework/Homeworddescription"; import ShixunWorkModal from './Shixunworkdetails/ShixunWorkModal'; import HomeworkModal from "../coursesPublic/HomeworkModal"; -// import Homeworddescription from "../shixunHomework/Homeworddescription"; - +import DownloadMessage from '../../modals/DownloadMessage'; const TextArea = Input.TextArea -//GraduationTaskssetting.js - - //作业问答页面 class Workquestionandanswer extends Component { //unifiedsetting 统一设置 @@ -319,89 +313,38 @@ 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对象 + }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'); } }).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) - }); + Downloadcal=()=>{ + this.setState({ + DownloadType:false, + DownloadMessageval:undefined + }) } - render() { const dateFormat = 'YYYY-MM-DD HH:mm:ss'; let { @@ -430,6 +373,12 @@ class Workquestionandanswer extends Component { issCancel={() => this.hideshowmodel()} updatas={() => this.isupdatas()} /> : ""} + {/*立即发布*/} 导出 : ""} diff --git a/public/react/src/modules/login/EducoderLogin.js b/public/react/src/modules/login/EducoderLogin.js index 7d9a0be9d..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)} > + Setshowbool={(e,name,pass)=>this.Setshowbool(e,name,pass)} >
    diff --git a/public/react/src/modules/modals/DownloadMessage.js b/public/react/src/modules/modals/DownloadMessage.js new file mode 100644 index 000000000..8fa36c9b1 --- /dev/null +++ b/public/react/src/modules/modals/DownloadMessage.js @@ -0,0 +1,51 @@ +import React, { Component } from 'react'; +import {getImageUrl} from 'educoder'; +import { Modal} from 'antd'; +class DownloadMessage extends Component { + constructor(props) { + super(props); + this.state = { + funmodalsType:false, + istype:false + } + } + + setDownload=()=>{ + 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 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 = "/" - - } + // } }