dev_forum
杨树林 5 years ago
parent 31d6f89448
commit 10fce08c59

@ -1338,7 +1338,7 @@ class Listofworks extends Component {
// 导出实习报告批量 // 导出实习报告批量
internshipreport = ()=>{ internshipreport = ()=>{
console.log("internshipreport"); console.log("internshipreport");
let url = "/zip/shixun_report"; let url = "http://47.96.87.25:48080/zip/shixun_report";
let homeworkid = this.props.match.params.homeworkid; let homeworkid = this.props.match.params.homeworkid;
axios.get((url),{ axios.get((url),{
params: { params: {
@ -1350,6 +1350,8 @@ class Listofworks extends Component {
},{responseType: 'blob'}).then((response) => { },{responseType: 'blob'}).then((response) => {
console.log("1342"); console.log("1342");
console.log(response); console.log(response);
if (response.status == 200) {
var blob = new Blob([response.data]) var blob = new Blob([response.data])
var downloadElement = document.createElement('a'); var downloadElement = document.createElement('a');
var href = window.URL.createObjectURL(blob); //创建下载的链接 var href = window.URL.createObjectURL(blob); //创建下载的链接
@ -1363,6 +1365,7 @@ class Listofworks extends Component {
document.body.removeChild(downloadElement); //下载完成移除元素 document.body.removeChild(downloadElement); //下载完成移除元素
} }
window.URL.revokeObjectURL(href); //释放掉blob对象 window.URL.revokeObjectURL(href); //释放掉blob对象
}
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}); });
@ -1372,7 +1375,7 @@ class Listofworks extends Component {
Classstudentachievement=()=>{ Classstudentachievement=()=>{
console.log("Classstudentachievement"); console.log("Classstudentachievement");
const course_id = this.props.match.params.coursesId; const course_id = this.props.match.params.coursesId;
let url = "/courses/"+course_id+"/export_member_scores_excel.xlsx"; let url = "http://47.96.87.25:48080/courses/"+course_id+"/export_member_scores_excel.xlsx";
axios.get((url),{ axios.get((url),{
params: { params: {
group_id: this.state.checkedValuesineinfo, group_id: this.state.checkedValuesineinfo,
@ -1381,17 +1384,7 @@ class Listofworks extends Component {
},{responseType: 'blob'}).then((response) => { },{responseType: 'blob'}).then((response) => {
console.log("1306"); console.log("1306");
console.log(response); console.log(response);
// if (response.status == 200) { if (response.status == 200) {
// let url = window.URL.createObjectURL(new Blob([response.data]))
// let link = document.createElement('a')
// link.style.display = 'none'
// link.href = url
// link.setAttribute('download', fileName) // 自定义下载文件名如exemple.txt
// document.body.appendChild(link)
// link.click()
// }
var blob = new Blob([response.data]) var blob = new Blob([response.data])
var downloadElement = document.createElement('a'); var downloadElement = document.createElement('a');
var href = window.URL.createObjectURL(blob); //创建下载的链接 var href = window.URL.createObjectURL(blob); //创建下载的链接
@ -1405,7 +1398,7 @@ class Listofworks extends Component {
document.body.removeChild(downloadElement); //下载完成移除元素 document.body.removeChild(downloadElement); //下载完成移除元素
} }
window.URL.revokeObjectURL(href); //释放掉blob对象 window.URL.revokeObjectURL(href); //释放掉blob对象
}
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}); });

Loading…
Cancel
Save