lanjianrong 4 سال پیش
والد
کامیت
9d403ea9d1
4فایلهای تغییر یافته به همراه50 افزوده شده و 30 حذف شده
  1. 15 0
      src/app.tsx
  2. 10 0
      src/global.less
  3. 16 20
      src/pages/Hr/Notification/components/MessageDrawer.jsx
  4. 9 10
      src/pages/Hr/Notification/index.jsx

+ 15 - 0
src/app.tsx

@@ -11,6 +11,11 @@ import { LAYOUT_COLLAPSED_KEY } from './utils/cache/cacheEnum'
 
 const loginPath = '/user/login'
 
+// 重新构建MenuData,解决重定向没有权限的路由
+// const generateMenu = (menuData, permission) => menuData.map(menu => {
+
+// })
+
 export async function getInitialState() {
   // 如果是登录页面,不执行
   const fetchUserInfo = async () => {
@@ -68,6 +73,16 @@ export const layout = ({ initialState, setInitialState }) => {
 
   return {
     logo,
+    // menu: {
+    //   params: {
+    //     userId: initialState?.currentUser?.staffId
+    //   },
+    //   request: (_, defaultMenuData) => {
+    //     console.log('defaultMenuData', defaultMenuData)
+
+    //     return defaultMenuData
+    //   }
+    // },
     rightContentRender: () => <RightContent />,
     disableContentMargin: false,
     waterMarkProps: {

+ 10 - 0
src/global.less

@@ -140,6 +140,7 @@ input:-webkit-autofill:active {
       // overflow-x: hidden;
     }
   }
+
   .sheet-box-right {
     background-color: #fafafa;
     border-left: 1px solid #eaeaea;
@@ -151,6 +152,7 @@ input:-webkit-autofill:active {
   overflow-x: hidden;
   overflow-y: auto;
 }
+
 .sheet-btns {
   height: 54px;
 }
@@ -206,6 +208,14 @@ input:-webkit-autofill:active {
   .ant-pro-basicLayout-content {
     margin: 0 !important;
   }
+
+  .sheet-box-left {
+    height: unset;
+  }
+  .sheet-right-panel,
+  .sheet-panel-record {
+    height: unset;
+  }
 }
 // .react-resizable {
 //   background-clip: padding-box !important;

+ 16 - 20
src/pages/Hr/Notification/components/MessageDrawer.jsx

@@ -1,4 +1,4 @@
-import { useRef, useState, useEffect } from 'react'
+import { useEffect } from 'react'
 import MarkDown from 'react-markdown'
 import styles from '@/pages/Hr/Notification/index.less'
 import { Tag, Typography } from 'antd'
@@ -6,31 +6,27 @@ import { useIntl } from 'umi'
 import 'vditor/src/assets/scss/index.scss'
 
 const MessageDrawer = props => {
-  const ref = useRef(null)
-  const [tHeight, setTHeight] = useState(0)
   const {
     item: { title, createTime, content, msgType }
   } = props
   const intl = useIntl()
-  useEffect(() => {
-    if (ref?.current) {
-      setTHeight(ref?.current.offsetTop)
-    }
-  }, [])
   return (
-    <div className="px-5 vditor-reset">
-      <span className="pt-5 block">
-        <Tag color="purple">{intl.formatMessage({ id: `component.globalHeader.${msgType}` })}</Tag>
-      </span>
-      <h1 className={['text-xl pr-6 mt-3', styles.NotificationCont].join(' ')}>{title}</h1>
-      <span className="text-hex-aaa">{createTime}</span>
-      <div className="w-22 h-[1px] bg-hex-ddd mt-3 mb-5 " />
+    <div className="px-5 vditor-reset h-full">
+      <div className="max-h-20vh">
+        <span className="pt-5 block">
+          <Tag color="purple">
+            {intl.formatMessage({ id: `component.globalHeader.${msgType}` })}
+          </Tag>
+        </span>
+        <h1 className={['text-xl pr-6 mt-3', styles.NotificationCont].join(' ')}>{title}</h1>
+        <span className="text-hex-aaa">{createTime}</span>
+        <div className="w-22 h-[1px] bg-hex-ddd mt-3 mb-5 " />
+      </div>
       <div
-        ref={ref}
-        className={['py-3 px-4 bg-hex-f9f9f9 rounded-md boxShadow', styles.NotificationCont].join(
-          ' '
-        )}
-        style={{ height: `calc(100vh - ${tHeight}px - 1.2rem)`, overflowY: 'auto' }}>
+        className={[
+          'overflow-y-auto max-h-80vh py-3 px-4 bg-hex-f9f9f9 rounded-md boxShadow',
+          styles.NotificationCont
+        ].join(' ')}>
         <Typography.Paragraph>
           <MarkDown>{content}</MarkDown>
         </Typography.Paragraph>

+ 9 - 10
src/pages/Hr/Notification/index.jsx

@@ -9,6 +9,7 @@ import { useModal } from '@/components/Modal'
 import MessageDrawer from './components/MessageDrawer'
 import ws, { CmdType } from '@/utils/ws'
 import MarkDown from 'react-markdown'
+import { isMobile } from '@/utils/is'
 
 const Notification = () => {
   const intl = useIntl()
@@ -90,16 +91,17 @@ const Notification = () => {
       <div
         id="scrollableDiv"
         className="pr-4"
-        style={{ height: 'calc(100vh - 180px)', overflowY: 'auto' }}
-      >
+        style={{
+          height: `calc(100vh - ${isMobile() ? '108px' : '156px'} - 1.5rem)`,
+          overflowY: 'auto'
+        }}>
         <InfiniteScroll
           dataLength={state.total}
           next={loadMoreData}
           hasMore={state.hasMore}
           loader={<Skeleton avatar paragraph={{ rows: 1 }} active />}
           endMessage={<Divider plain>别再滚啦,已是尽头</Divider>}
-          scrollableTarget="scrollableDiv"
-        >
+          scrollableTarget="scrollableDiv">
           <List
             itemLayout="vertical"
             // pagination={{ pageSize: 5 }}
@@ -111,15 +113,13 @@ const Notification = () => {
                   <span width={200} className="mt-1 text-hex-aaa">
                     {item.createTime}
                   </span>
-                }
-              >
+                }>
                 <List.Item.Meta
                   avatar={<Avatar src={item.avatar} />}
                   title={
                     <span
                       className="cursor-pointer text-primary"
-                      onClick={() => showMessageDrawer(item)}
-                    >
+                      onClick={() => showMessageDrawer(item)}>
                       {item.title}
                     </span>
                   }
@@ -141,8 +141,7 @@ const Notification = () => {
                           rows: 4
                         }
                       : false
-                  }
-                >
+                  }>
                   <MarkDown>{item.content}</MarkDown>
                 </Paragraph>
                 {/* <div className="mt-1 text-hex-aaa">{item.createTime}</div> */}