导出附件组件

dev_forum
caishi 5 years ago
parent 57ddb15bcc
commit 7d19eb9637

@ -622,45 +622,16 @@ class GraduationTaskssettinglist extends Component{
let {teacher_comment, task_status, course_group, cross_comment, order, b_order, search,page} =this.state;
axios.get(url,{
teacher_comment:teacher_comment,
task_status:task_status,
course_group:course_group,
cross_comment:cross_comment,
order:order,
b_order:b_order,
search:search,
}).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:true,
DownloadMessageval:100
})
}else {
//因附件资料超过500M
this.setState({
DownloadType:true,
DownloadMessageval:500
})
}
}else {
this.props.showNotification(`正在下载中`);
window.open("/api"+url, '_blank');
}
}).catch((error) => {
console.log(error)
});
}
Downloadcal=()=>{
this.setState({
DownloadType:false,
DownloadMessageval:undefined
})
let params ={
teacher_comment:teacher_comment,
task_status:task_status,
course_group:course_group,
cross_comment:cross_comment,
order:order,
b_order:b_order,
search:search,
}
this.refs.DownloadMessage.confirmysl(url,params);
}
render(){
@ -1010,13 +981,7 @@ class GraduationTaskssettinglist extends Component{
setupdate={this.setupdate}
/>:""}
<DownloadMessage
{...this.props}
value={this.state.DownloadMessageval}
modalCancel={this.Downloadcal}
modalsType={this.state.DownloadType}
/>
<DownloadMessage ref="DownloadMessage" {...this.props} />
{taskslistdata&&taskslistdata?
// 教师列表

@ -1,19 +1,62 @@
import React, { Component } from 'react';
import {getImageUrl} from 'educoder';
import { Modal} from 'antd';
import axios from 'axios';
class DownloadMessage extends Component {
constructor(props) {
super(props);
this.state = {
funmodalsType:false,
istype:false
istype:false,
DownloadMessageval:undefined,
DownloadType:false
}
}
setDownload=()=>{
this.props.modalCancel();
this.modalCancel();
window.open(`/users/${this.props.user.login}/private_messages`)
}
Downloadcal=()=>{
this.setState({
DownloadType:false,
DownloadMessageval:undefined
})
}
/// 确认是否下载
confirmysl(url,params){
axios.get(url,{
params
}).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:true,
DownloadMessageval:100
})
}else {
//因附件资料超过500M
this.setState({
DownloadType:true,
DownloadMessageval:500
})
}
}else {
this.props.showNotification(`正在下载中`);
window.open("/api"+url, '_blank');
}
}).catch((error) => {
console.log(error)
});
}
render() {
return(
@ -39,7 +82,7 @@ render() {
</p>
:""}
<div className="clearfix mt30 edu-txt-center">
<a className="task-btn mr30" onClick={this.props.modalCancel}>取消</a>
<a className="task-btn mr30" onClick={this.modalCancel}>取消</a>
<a className="task-btn task-btn-orange" onClick={this.setDownload}>立即联系</a>
</div>
</div>

Loading…
Cancel
Save