zhongrj
2025-11-25 b89962006164a462404b79a738bee8cbb6d7fe7e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import React from 'react';
import '../css/Standby.scss';
import PropTypes from 'prop-types';
 
class Standby extends React.Component {
  static defaultProps = {
      message: "",
      show: false,
      opacity: 0.5
  };
 
  static propTypes = {
    message: PropTypes.string,
    show: PropTypes.bool,
    opacity: PropTypes.number
  };
 
  constructor(props){
    super(props);
 
    this.state = {
        message: props.message,
        show: props.show
    };
  }
 
  componentWillReceiveProps(nextProps){
    this.setState(nextProps);
  }
 
  show(message = null){
    this.setState({show: true});
    if (message){
      this.setState({message: message});
    }
  }
 
  hide(){
    this.setState({show: false});
  }
 
  render() {
    return (
      <div className="standby"
           style={{display: this.state.show ? "block" : "none"}}>
        <div className="cover" style={{opacity: this.props.opacity}}>&nbsp;</div>
        <div className="content">
          <i className="fa fa-spinner fa-spin fa-2x fa-fw"></i>
          <p>{this.state.message}</p>
        </div>
      </div>
    );
  }
}
 
export default Standby;