showModal.jsx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import React from "react";
  2. import { Spin, Button, Tabs, Table, message, Modal } from "antd";
  3. const ShowModal = React.createClass({
  4. getInitialState() {
  5. return {
  6. newVisible: false
  7. };
  8. },
  9. componentWillReceiveProps(nextProps) {
  10. this.setState({
  11. newVisible: nextProps.ShowModal
  12. });
  13. },
  14. handleOk() {
  15. this.setState({
  16. newVisible: false
  17. });
  18. // window.setTimeout( () => {
  19. // this.setState({
  20. // newVisible: true
  21. // });
  22. // },)
  23. },
  24. render() {
  25. return (
  26. <Modal
  27. style={{ position: "relative" }}
  28. title="消息提醒"
  29. visible={this.state.newVisible}
  30. closable={false}
  31. footer={null}
  32. destroyOnClose={true}
  33. >
  34. <div style={{ textAlign: "center" }}>
  35. 您有新消息尚未查看,请及时查看信息!
  36. <a href={"/admin/index.html#normal"}
  37. onClick={() => {
  38. !!this.props.seeInfo && this.props.seeInfo()
  39. }}
  40. >点我查看信息</a>
  41. </div>
  42. <Button
  43. onClick={this.handleOk}
  44. type={"primary"}
  45. style={{
  46. position: "relative",
  47. left: "50%",
  48. transform: "translateX(-50%)",
  49. bottom: -10
  50. }}
  51. >
  52. 关闭
  53. </Button>
  54. </Modal>
  55. );
  56. }
  57. });
  58. export default ShowModal;