index.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { UnityAction } from '@/utils/utils';
  2. import { CloseOutlined, LeftOutlined } from '@ant-design/icons';
  3. import { history } from '@umijs/max';
  4. import { ConfigProvider } from 'antd';
  5. import locale from 'antd/es/locale/zh_CN';
  6. import styles from './index.less';
  7. export default (props) => {
  8. const {
  9. children,
  10. style,
  11. closeable = true,
  12. returnable = false,
  13. tabs = false,
  14. } = props;
  15. const handleClose = () => {
  16. UnityAction.sendMsg('closePage');
  17. };
  18. const handleReturn = () => {
  19. history.back();
  20. };
  21. return (
  22. <ConfigProvider locale={locale}>
  23. <div className={styles.page} style={style}>
  24. {returnable && (
  25. <LeftOutlined
  26. onClick={handleReturn}
  27. className={styles.return}
  28. style={{ top: tabs ? 42.5 : '' }}
  29. />
  30. )}
  31. {closeable && (
  32. <CloseOutlined
  33. onClick={handleClose}
  34. className={styles.close}
  35. style={{ top: tabs ? 42.5 : '' }}
  36. />
  37. )}
  38. {children}
  39. </div>
  40. </ConfigProvider>
  41. );
  42. };