dev_ec
hjm 6 years ago
parent 2881ac6254
commit bb49f978c9

@ -1,5 +1,5 @@
import React,{ Component } from "react"; import React,{ Component } from "react";
import { Modal,Input, Checkbox} from "antd"; import { Modal,Input, Checkbox, Spin} from "antd";
import '../css/members.css' import '../css/members.css'
class ModalWrapper extends Component{ class ModalWrapper extends Component{
@ -23,7 +23,7 @@ class ModalWrapper extends Component{
} }
render(){ render(){
let {flag, visible}=this.state let {flag, visible}=this.state
let { onOk, cancelText, okText, title, width, className, bottomRender}=this.props; let { onOk, cancelText, okText, title, width, className, bottomRender, loading}=this.props;
return( return(
<Modal <Modal
@ -48,6 +48,7 @@ class ModalWrapper extends Component{
} }
</style>:"" </style>:""
} }
<Spin spinning={!!this.props.loading}>
<div className="newupload_conbox clearfix"> <div className="newupload_conbox clearfix">
{this.props.children} {this.props.children}
{this.props.checkBoxValuestype===true?<div className={"mt10 color-red"}> {this.props.checkBoxValuestype===true?<div className={"mt10 color-red"}>
@ -59,6 +60,7 @@ class ModalWrapper extends Component{
</div> </div>
{ bottomRender } { bottomRender }
</div> </div>
</Spin>
</Modal> </Modal>
) )
} }

@ -1,5 +1,5 @@
import React, { Component } from "react"; import React, { Component } from "react";
import { Modal } from "antd"; import { Spin } from "antd";
import axios from 'axios' import axios from 'axios'
import ModalWrapper from "../../courses/common/ModalWrapper" import ModalWrapper from "../../courses/common/ModalWrapper"
import { Cropper, getUrl } from 'educoder' import { Cropper, getUrl } from 'educoder'
@ -13,7 +13,7 @@ class ChangeHeaderPicModal extends Component{
constructor(props){ constructor(props){
super(props); super(props);
this.state={ this.state={
uploading: false
} }
} }
init = () => { init = () => {
@ -85,12 +85,23 @@ class ChangeHeaderPicModal extends Component{
} }
onOk = () => { onOk = () => {
if (this.state.uploading == true) return;
if (this.fileUploaded != true) { if (this.fileUploaded != true) {
this.props.showNotification("请先上传图片") this.props.showNotification("请先上传图片")
return; return;
} }
console.log(new Date().getTime())
this.setState({ uploading: true }, () => {
window.setTimeout(() => {
console.log(new Date().getTime())
this._onOk()
}, 10)
})
}
_onOk = () => {
var img_lg = document.getElementById(previewId); var img_lg = document.getElementById(previewId);
// https://github.com/niklasvh/html2canvas/issues/1908 // https://github.com/niklasvh/html2canvas/issues/1908
// 截图小的显示框内的内容 // 截图小的显示框内的内容
@ -115,9 +126,12 @@ class ChangeHeaderPicModal extends Component{
} else { } else {
this.doAfterUpdated(); this.doAfterUpdated();
} }
this.setState({ uploading: false })
} }
}) })
.catch(function (error) { .catch(function (error) {
this.setState({ uploading: false })
console.log(error); console.log(error);
}); });
}); });
@ -142,6 +156,8 @@ class ChangeHeaderPicModal extends Component{
okText="保存" okText="保存"
width={552} width={552}
className="changeHeaderModal" className="changeHeaderModal"
loading={this.state.uploading}
onCancel={() => this.setState({ uploading: false })}
> >
<style>{` <style>{`
#changeHeader_imagePreview { #changeHeader_imagePreview {

Loading…
Cancel
Save