|
|
|
@ -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()}
|
|
|
|
|
/> : ""}
|
|
|
|
|
<DownloadMessage
|
|
|
|
|
{...this.props}
|
|
|
|
|
value={this.state.DownloadMessageval}
|
|
|
|
|
modalCancel={this.Downloadcal}
|
|
|
|
|
modalsType={this.state.DownloadType}
|
|
|
|
|
/>
|
|
|
|
|
{/*立即发布*/}
|
|
|
|
|
<HomeworkModal
|
|
|
|
|
modaltype={this.state.modaltype}
|
|
|
|
@ -527,9 +476,9 @@ class Workquestionandanswer extends Component {
|
|
|
|
|
<li className="li_line drop_down fr color-blue font-16 mr8 mt20" style={{"padding": "0 20px"}}>
|
|
|
|
|
导出<i className="iconfont icon-xiajiantou font-12 ml2"></i>
|
|
|
|
|
<ul className="drop_down_menu" style={{"right": "-0px", "left": "unset", "height": "auto"}}>
|
|
|
|
|
<li><a onClick={()=>this.internshipreport(`/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}`)}>实训报告</a>
|
|
|
|
|
<li><a onClick={()=>this.confirmysl(`/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}`)}>实训报告</a>
|
|
|
|
|
</li>
|
|
|
|
|
<li><a onClick={()=>this.Classstudentachievement(`/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx`)}>学生成绩</a>
|
|
|
|
|
<li><a onClick={()=>this.confirmysl(`/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx`)}>学生成绩</a>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</li> : ""}
|
|
|
|
|