showModal.jsx 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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"}>点我查看信息</a>
  37. </div>
  38. <Button
  39. onClick={this.handleOk}
  40. type={"primary"}
  41. style={{
  42. position: "relative",
  43. left: "50%",
  44. transform: "translateX(-50%)",
  45. bottom: -10
  46. }}
  47. >
  48. 关闭
  49. </Button>
  50. </Modal>
  51. );
  52. }
  53. });
  54. export default ShowModal;