杨树林 5 years ago
commit 64ac8470f0

File diff suppressed because one or more lines are too long

@ -622,45 +622,16 @@ class GraduationTaskssettinglist extends Component{
let {teacher_comment, task_status, course_group, cross_comment, order, b_order, search,page} =this.state; let {teacher_comment, task_status, course_group, cross_comment, order, b_order, search,page} =this.state;
axios.get(url,{ let params ={
teacher_comment:teacher_comment, teacher_comment:teacher_comment,
task_status:task_status, task_status:task_status,
course_group:course_group, course_group:course_group,
cross_comment:cross_comment, cross_comment:cross_comment,
order:order, order:order,
b_order:b_order, b_order:b_order,
search:search, search:search,
}).then((response) => { }
if(response.data.status&&response.data.status===-1){ this.refs.DownloadMessage.confirmysl(url,params);
}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(){ render(){
@ -1010,13 +981,7 @@ class GraduationTaskssettinglist extends Component{
setupdate={this.setupdate} setupdate={this.setupdate}
/>:""} />:""}
<DownloadMessage <DownloadMessage ref="DownloadMessage" {...this.props} />
{...this.props}
value={this.state.DownloadMessageval}
modalCancel={this.Downloadcal}
modalsType={this.state.DownloadType}
/>
{taskslistdata&&taskslistdata? {taskslistdata&&taskslistdata?
// 教师列表 // 教师列表

@ -1,19 +1,62 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import {getImageUrl} from 'educoder'; import {getImageUrl} from 'educoder';
import { Modal} from 'antd'; import { Modal} from 'antd';
import axios from 'axios';
class DownloadMessage extends Component { class DownloadMessage extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
funmodalsType:false, funmodalsType:false,
istype:false istype:false,
DownloadMessageval:undefined,
DownloadType:false
} }
} }
setDownload=()=>{ setDownload=()=>{
this.props.modalCancel(); this.modalCancel();
window.open(`/users/${this.props.user.login}/private_messages`) 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() { render() {
return( return(
@ -39,7 +82,7 @@ render() {
</p> </p>
:""} :""}
<div className="clearfix mt30 edu-txt-center"> <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> <a className="task-btn task-btn-orange" onClick={this.setDownload}>立即联系</a>
</div> </div>
</div> </div>

@ -39,11 +39,27 @@ class ChangeHeaderPicModal extends Component{
URL.revokeObjectURL(uploadedImageURL); URL.revokeObjectURL(uploadedImageURL);
} }
const image = document.getElementById( imageId ); const image = document.getElementById( imageId );
image.src = uploadedImageURL = URL.createObjectURL(file);
that.refs['cropper'].renew(image) // base64
// cropper.destroy(); var reader = new FileReader();
// cropper = new Cropper(image, options); reader.readAsBinaryString(file);
inputImage.value = null;
reader.onload = () => {
let base64_content = btoa(reader.result);
console.log();
image.src = `data:${file.type};base64,${base64_content}` // uploadedImageURL = URL.createObjectURL(file);
that.fileUploaded = true;
that.refs['cropper'].renew(image)
// cropper.destroy();
// cropper = new Cropper(image, options);
inputImage.value = null;
};
reader.onerror = function() {
console.log('there are some problems');
};
} else { } else {
this.props.showNotification && this.props.showNotification("请选择一个图片格式的文件") this.props.showNotification && this.props.showNotification("请选择一个图片格式的文件")
// window.alert('Please choose an image file.'); // window.alert('Please choose an image file.');
@ -57,6 +73,8 @@ class ChangeHeaderPicModal extends Component{
this.refs['modalWrapper'].setVisible(visible) this.refs['modalWrapper'].setVisible(visible)
if (visible) { if (visible) {
this.fileUploaded = false;
setTimeout(() => { setTimeout(() => {
this.init() this.init()
}, 500) }, 500)
@ -69,7 +87,12 @@ class ChangeHeaderPicModal extends Component{
} }
onOk = () => { onOk = () => {
var img_lg = document.getElementById(previewId); if (this.fileUploaded != true) {
this.props.showNotification("请先上传图片")
return;
}
var img_lg = document.getElementById(previewId);
// https://github.com/niklasvh/html2canvas/issues/1908
// 截图小的显示框内的内容 // 截图小的显示框内的内容
window.html2canvas(img_lg).then((canvas) => { window.html2canvas(img_lg).then((canvas) => {
var dataUrl = canvas.toDataURL("image/jpeg"); var dataUrl = canvas.toDataURL("image/jpeg");

Loading…
Cancel
Save