调整导出

dev_forum
杨树林 5 years ago
parent a514596495
commit 58eec94296

@ -14,10 +14,9 @@ import Modals from '../../modals/Modals';
import CoursesListType from '../coursesPublic/CoursesListType';
import AccessoryModal from "../coursesPublic/AccessoryModal";
import PublishRightnow from './PublishRightnow'
import DownloadMessage from '../../modals/DownloadMessage';
import '../css/Courses.css'
import CBreadcrumb from '../common/CBreadcrumb'
import DownloadMessageysl from "../../modals/DownloadMessageysl";
//引入对应跳转的组件
@ -63,7 +62,8 @@ class CommonWorkDetailIndex extends Component{
this.publishModal = React.createRef();
this.endModal = React.createRef();
this.state = {
DownloadType:false,
DownloadMessageval:undefined,
}
}
initWorkDetailCommonState = (data) => {
@ -100,6 +100,45 @@ class CommonWorkDetailIndex extends Component{
doWhenSuccess = () => {
trigger('commonwork_fetch_all')
}
/// 确认是否下载
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: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
})
}
render() {
let {course_name, homework_name, homework_status, noTab
, view_answer, author_name, category, work_id
@ -139,11 +178,16 @@ class CommonWorkDetailIndex extends Component{
isPublish={true} doWhenSuccess={this.doWhenSuccess} checkBeforePost={this.saveWorkSetting}
onToPublishClick={this.onToPublishClick}
></PublishRightnow>
<DownloadMessageysl
{...this.props}
value={this.state.DownloadMessageval}
modalCancel={this.Downloadcal}
modalsType={this.state.DownloadType}
/>
<PublishRightnow ref={this.endModal} showActionButton={false} {...this.props} checkBoxValues={[workId]}
isPublish={false} doWhenSuccess={this.doWhenSuccess}></PublishRightnow>
<DownloadMessage ref="DownloadMessage" {...this.props} />
<div className="newMain clearfix worklist1">
<div className={"educontent mt20"}>
<style>{`
@ -241,10 +285,10 @@ class CommonWorkDetailIndex extends Component{
导出<i className="iconfont icon-xiajiantou font-12 ml2"></i>
<ul className="drop_down_menu" style={{"right":"-34px","left":"unset","height":"auto"}}>
<li><a href={"javascript:void(0)"} className="color-dark"
onClick={() => this.refs.DownloadMessage.confirmysl(exportResultUrl, exportParams)}
onClick={() => this.confirmysl(exportResultUrl, exportParams)}
>导出成绩</a></li>
<li><a href={"javascript:void(0)"} className="color-dark"
onClick={() => this.refs.DownloadMessage.confirmysl(exportUrl, exportParams)}
onClick={() => this.confirmysl(exportUrl, exportParams)}
>导出作品附件</a></li>
</ul>
</li>:""}

@ -5,6 +5,7 @@ import { WordsBtn, MarkdownToHtml } from 'educoder';
import axios from 'axios';
import PublishRightnow from '../PublishRightnow'
import AccessoryModal from "../../coursesPublic/AccessoryModal";
import DownloadMessageysl from "../../../modals/DownloadMessageysl";
const { Option} = Select;
const CheckboxGroup = Checkbox.Group;
@ -23,7 +24,9 @@ class TabRightComponents extends Component{
this.endModal = React.createRef();
this.state={
accessoryVisible: false
accessoryVisible: false,
DownloadType:false,
DownloadMessageval:undefined,
}
}
@ -39,6 +42,42 @@ class TabRightComponents extends Component{
accessoryVisible:false
})
}
/// 确认是否下载
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: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
})
}
addAccessory=()=>{
this.setState({
@ -83,7 +122,12 @@ class TabRightComponents extends Component{
<PublishRightnow ref={this.endModal} showActionButton={false} {...this.props} checkBoxValues={[workId]}
isPublish={false} doWhenSuccess={this.props.doWhenSuccess}></PublishRightnow>
</div>
<DownloadMessageysl
{...this.props}
value={this.state.DownloadMessageval}
modalCancel={this.Downloadcal}
modalsType={this.state.DownloadType}
/>
<style>{`
.drop_down_menu li a {
padding: 0px;
@ -105,8 +149,8 @@ class TabRightComponents extends Component{
{this.props.isAdmin()? <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":"-34px","left":"unset","height":"auto"}}>
<li><a href={exportResultUrl} className="color-dark">导出成绩</a></li>
<li><a href={exportUrl} className="color-dark">导出作品附件</a></li>
<li><a href={exportResultUrl} onClick={(url)=>this.confirmysl(exportResultUrl)} className="color-dark">导出成绩</a></li>
<li><a href={exportUrl} onClick={(url)=>this.confirmysl(exportUrl)} className="color-dark">导出作品附件</a></li>
</ul>
</li>:""}

@ -3,6 +3,7 @@ import {Checkbox, Menu, Pagination,Spin} from "antd";
import CourseLayoutcomponent from '../../common/CourseLayoutComponent'
import Titlesearchsection from '../../common/titleSearch/TitleSearchSection'
import DownloadMessageysl from "../../../modals/DownloadMessageysl";
import { WordsBtn } from 'educoder'
import NoneData from '../../coursesPublic/NoneData'
@ -43,7 +44,9 @@ class Boards extends Component{
delTopval:"",
delLoadType:false,
delOrPublic:1,
isSpin:true
isSpin:true,
DownloadType:false,
DownloadMessageval:undefined,
}
}
fetchAll = (searchValue,page,status) => {
@ -317,7 +320,41 @@ onBoardsNew=()=>{
let courseId=this.props.match.params.coursesId
this.props.history.push(`/courses/${courseId}/graduation_topics/new`)
}
/// 确认是否下载
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: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
})
}
render(){
let {
searchValue,
@ -343,6 +380,12 @@ onBoardsNew=()=>{
return(
<React.Fragment >
<ChooseGraduateTopicModal ref="chooseGraduateTopicModal"></ChooseGraduateTopicModal>
<DownloadMessageysl
{...this.props}
value={this.state.DownloadMessageval}
modalCancel={this.Downloadcal}
modalsType={this.state.DownloadType}
/>
<Titlesearchsection
title="毕设选题"
searchValue={ searchValue }
@ -352,7 +395,7 @@ onBoardsNew=()=>{
(<React.Fragment>
{/* 参考普通作业 - 题库选用 */}
{/* <WordsBtn style="blue" className="mr30" onClick={()=>this.useFromBank()}>题库选用</WordsBtn> 正式版没有,先隐藏*/}
< a href={`/api/courses/${this.props.match.params.coursesId}/graduation_topics/export.xlsx`} className={"fl color-blue mr30 font-16"}>导出</a>
< a className={"fl color-blue mr30 font-16"} onClick={(url)=>this.confirmysl(`/courses/${this.props.match.params.coursesId}/graduation_topics/export.xlsx`)}>导出</a>
<p className="fl"><UseBank {...this.props} {...this.state} object_type={"gtopic"} useBankSuccess={this.useBankSuccess}></UseBank></p>
<WordsBtn style="blue" className="font-16" onClick={()=>this.onBoardsNew()}>新建</WordsBtn>
</React.Fragment>):""

@ -558,7 +558,7 @@ class studentsList extends Component{
{ isAdmin && isParent && <WordsBtn style="blue" className="mr30" onClick={()=>this.addDir()}>添加分班</WordsBtn> }
{ isAdmin && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="mr30" onClick={()=>this.deleteDir()}>删除分班</WordsBtn> }
{ isAdmin && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="mr30" onClick={()=>this.renameDir()}>分班重命名</WordsBtn> }
{ isAdmin && <WordsBtn style="blue" className="" onClick={()=>this.confirmysl(exportUrl)} >导出成绩</WordsBtn> }
{ isAdmin && <WordsBtn style="blue" className="" onClick={(url)=>this.confirmysl(exportUrl)} >导出成绩</WordsBtn> }
{/* */}
</React.Fragment>
}

@ -9,7 +9,7 @@ import PollTabSecond from './PollDetailTabSecond'
import PollTabThird from './PollDetailTabThird'
import PollTabForth from './PollDetailTabForth'
import DownloadMessage from '../../modals/DownloadMessage';
import DownloadMessageysl from "../../modals/DownloadMessageysl";
import ImmediatelyPublish from './pollPublicBtn/ImmediatelyPublish'
import ImmediatelyEnd from './pollPublicBtn/ImmediatelyEnd'
@ -27,7 +27,9 @@ class PollDetailIndex extends Component{
this.state={
tab:["0"],
pollDetail:undefined,
user_permission:undefined
user_permission:undefined,
DownloadType:false,
DownloadMessageval:undefined,
}
}
@ -71,10 +73,41 @@ class PollDetailIndex extends Component{
})
}
/// 确认是否下载
confirmysl(url){
this.refs.DownloadMessage.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: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
})
}
render(){
let {tab,pollDetail,user_permission}=this.state;
@ -82,7 +115,12 @@ class PollDetailIndex extends Component{
const isStudent = this.props.isStudent();
return(
<div className="newMain">
<DownloadMessage {...this.props} ref="DownloadMessage" />
<DownloadMessageysl
{...this.props}
value={this.state.DownloadMessageval}
modalCancel={this.Downloadcal}
modalsType={this.state.DownloadType}
/>
<div className="educontent mt10 mb50">
<p className="clearfix mb20">
<WordsBtn style="grey" className="fl" to={`/courses/${this.props.match.params.coursesId}/students`}>{this.props.coursedata.name}</WordsBtn>
@ -159,7 +197,7 @@ class PollDetailIndex extends Component{
</li>
:""
} */}
<a className="fl color-blue font-16" onClick={()=>this.confirmysl("/polls/"+this.props.match.params.pollId+"/commit_result.xlsx")} href="javascript:void(0);">导出统计</a>
<a className="fl color-blue font-16" onClick={(url)=>this.confirmysl("/polls/"+this.props.match.params.pollId+"/commit_result.xlsx")} href="javascript:void(0);">导出统计</a>
</span>
}
{

Loading…
Cancel
Save