Bladeren bron

fix: 我的任务添加return 按钮

ZhaoJun 1 jaar geleden
bovenliggende
commit
74ddc96e96
3 gewijzigde bestanden met toevoegingen van 28 en 3 verwijderingen
  1. 19 2
      src/components/PageContent/index.js
  2. 8 0
      src/components/PageContent/index.less
  3. 1 1
      src/pages/Center/MyTask/index.js

+ 19 - 2
src/components/PageContent/index.js

@@ -1,19 +1,36 @@
 import { UnityAction } from '@/utils/utils';
-import { CloseOutlined } from '@ant-design/icons';
+import { CloseOutlined, LeftOutlined } from '@ant-design/icons';
+import { history } from '@umijs/max';
 import { ConfigProvider } from 'antd';
 import locale from 'antd/es/locale/zh_CN';
 import styles from './index.less';
 
 export default (props) => {
-  const { children, style, closeable = true, tabs = false } = props;
+  const {
+    children,
+    style,
+    closeable = true,
+    returnable = false,
+    tabs = false,
+  } = props;
 
   const handleClose = () => {
     UnityAction.sendMsg('closePage');
   };
+  const handleReturn = () => {
+    history.back();
+  };
 
   return (
     <ConfigProvider locale={locale}>
       <div className={styles.page} style={style}>
+        {returnable && (
+          <LeftOutlined
+            onClick={handleReturn}
+            className={styles.return}
+            style={{ top: tabs ? 42.5 : '' }}
+          />
+        )}
         {closeable && (
           <CloseOutlined
             onClick={handleClose}

+ 8 - 0
src/components/PageContent/index.less

@@ -13,4 +13,12 @@
     color: #4a4a4a;
     cursor: pointer;
   }
+  .return {
+    position: absolute;
+    top: 26px;
+    left: 20px;
+    font-size: 34px;
+    color: #4a4a4a;
+    cursor: pointer;
+  }
 }

+ 1 - 1
src/pages/Center/MyTask/index.js

@@ -118,7 +118,7 @@ const MyTask = () => {
   };
 
   return (
-    <PageContent tabs closeable={false}>
+    <PageContent tabs closeable={false} returnable>
       <TabsContent
         defaultActiveKey={tab}
         onChange={onTabChange}