dev_forum
hjm 5 years ago
parent 70d2790f8d
commit 9d808ee583

@ -8,7 +8,7 @@ import { CNotificationHOC } from '../common/CNotificationHOC'
import { RouteHOC } from './common' import { RouteHOC } from './common'
import locale from 'antd/lib/date-picker/locale/zh_CN'; import locale from 'antd/lib/date-picker/locale/zh_CN';
import { WordsBtn, MarkdownToHtml, trigger, queryString } from 'educoder'; import { WordsBtn, MarkdownToHtml, trigger, queryString, downloadFile } from 'educoder';
import axios from 'axios'; import axios from 'axios';
import Modals from '../../modals/Modals'; import Modals from '../../modals/Modals';
import CoursesListType from '../coursesPublic/CoursesListType'; import CoursesListType from '../coursesPublic/CoursesListType';
@ -18,6 +18,8 @@ import '../css/Courses.css'
import CBreadcrumb from '../common/CBreadcrumb' import CBreadcrumb from '../common/CBreadcrumb'
import DownloadMessageysl from "../../modals/DownloadMessageysl"; import DownloadMessageysl from "../../modals/DownloadMessageysl";
import { Spin } from 'antd'
//引入对应跳转的组件 //引入对应跳转的组件
//新建分组/普通作业 //新建分组/普通作业
@ -64,6 +66,7 @@ class CommonWorkDetailIndex extends Component{
this.state = { this.state = {
DownloadType:false, DownloadType:false,
DownloadMessageval:undefined, DownloadMessageval:undefined,
donwloading: false,
} }
} }
initWorkDetailCommonState = (data) => { initWorkDetailCommonState = (data) => {
@ -123,7 +126,20 @@ class CommonWorkDetailIndex extends Component{
} }
}else { }else {
this.props.showNotification(`正在下载中`); this.props.showNotification(`正在下载中`);
window.open("/api"+url, '_blank');
this.setState({ donwloading: true })
downloadFile({
url: url,
successCallback: (url) => {
this.setState({ donwloading: false })
console.log('successCallback')
},
failCallback: (responseHtml, url) => {
this.setState({ donwloading: false })
console.log('failCallback')
}
})
// window.open("/api"+url, '_blank');
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
@ -244,7 +260,7 @@ class CommonWorkDetailIndex extends Component{
} }
</div> </div>
{ noTab !== true && <div className="stud-class-set bor-bottom-greyE"> { noTab !== true && <div className="stud-class-set bor-bottom-greyE floatSpinParent">
<div className="mt10 clearfix edu-back-white poll_list pl5"> <div className="mt10 clearfix edu-back-white poll_list pl5">
<Link <Link
onClick={() => this.setState({moduleName: '作品列表'})} onClick={() => this.setState({moduleName: '作品列表'})}
@ -283,18 +299,30 @@ class CommonWorkDetailIndex extends Component{
padding-top: 10px; padding-top: 10px;
padding-bottom: 8px; padding-bottom: 8px;
} }
.floatSpinParent .ant-spin-nested-loading {
float: right;
}
`}</style> `}</style>
{this.props.isAdmin()? <li className="li_line drop_down fr color-blue font-16 mr8 mt20" style={{"padding":"0 20px"}}> {this.props.isAdmin()? <Spin spinning={this.state.donwloading} style={{ }}>
<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> 导出<i className="iconfont icon-xiajiantou font-12 ml2"></i>
<ul className="drop_down_menu" style={{"right":"-34px","left":"unset","height":"auto"}}> <ul className="drop_down_menu" style={{"right":"-34px","left":"unset","height":"auto"}}>
<li><a href={"javascript:void(0)"} className="color-dark" <li>
<a href={"javascript:void(0)"} className="color-dark"
onClick={() => this.confirmysl(exportResultUrl, exportParams)} onClick={() => this.confirmysl(exportResultUrl, exportParams)}
>导出成绩</a></li> >导出成绩</a>
<li><a href={"javascript:void(0)"} className="color-dark"
</li>
<li>
<a href={"javascript:void(0)"} className="color-dark"
onClick={() => this.confirmysl(exportUrl, exportParams)} onClick={() => this.confirmysl(exportUrl, exportParams)}
>导出作品附件</a></li> >导出作品附件</a>
</li>
</ul> </ul>
</li>:""} </li>
</Spin>:""}
{/* {isAdmin && <a className={"fr color-blue font-16"} href={exportUrl}></a>} {/* {isAdmin && <a className={"fr color-blue font-16"} href={exportUrl}></a>}
{isAdmin && <a className={"fr color-blue font-16"} href={exportResultUrl}>导出成绩</a>} */} {isAdmin && <a className={"fr color-blue font-16"} href={exportResultUrl}>导出成绩</a>} */}

Loading…
Cancel
Save