lanjianrong 4 سال پیش
والد
کامیت
d1196c6ff6
1فایلهای تغییر یافته به همراه33 افزوده شده و 31 حذف شده
  1. 33 31
      src/pages/Hr/Notification/index.jsx

+ 33 - 31
src/pages/Hr/Notification/index.jsx

@@ -14,7 +14,7 @@ const Notification = () => {
     message: [],
     hasMore: false,
     current: 1,
-    pageSize: 10,
+    pageSize: 15,
     total: 0
   })
   const initData = async params => {
@@ -46,36 +46,38 @@ const Notification = () => {
       <span className="py-4">通知中心</span>
       <div style={{ height: 'calc(100vh - 96px - 3.5rem)', overflowY: 'auto' }}>
         <div id="scrollableDiv">
-          <InfiniteScroll
-            dataLength={state.message?.length}
-            next={loadMoreData}
-            hasMore={state.hasMore}
-            loader={<Skeleton avatar paragraph={{ rows: 1 }} active />}
-            endMessage={<Divider plain>别再滚啦,已是尽头</Divider>}
-            scrollableTarget="scrollableDiv"
-          >
-            <List
-              itemLayout="horizontal"
-              // pagination={{ pageSize: 5 }}
-              dataSource={state.message}
-              renderItem={item => (
-                <List.Item key={item.id}>
-                  <List.Item.Meta
-                    avatar={<Avatar src={item.avatar} />}
-                    title={<a href="#">{item.title}</a>}
-                    description={
-                      <div className="mb-1">
-                        <Tag color="purple">{msgTypeEnum[item.msgType]}</Tag> '发布于',
-                        <span className="ml-2">全公司</span>
-                      </div>
-                    }
-                  />
-                  {item.content}
-                  <div className="mt-1 text-hex-aaa">{item.createTime}</div>
-                </List.Item>
-              )}
-            />
-          </InfiniteScroll>
+          {state.message?.length ? (
+            <InfiniteScroll
+              dataLength={state.message?.length}
+              next={loadMoreData}
+              hasMore={state.hasMore}
+              loader={<Skeleton avatar paragraph={{ rows: 1 }} active />}
+              endMessage={<Divider plain>别再滚啦,已是尽头</Divider>}
+              scrollableTarget="scrollableDiv"
+            >
+              <List
+                itemLayout="horizontal"
+                // pagination={{ pageSize: 5 }}
+                dataSource={state.message}
+                renderItem={item => (
+                  <List.Item key={item.id}>
+                    <List.Item.Meta
+                      avatar={<Avatar src={item.avatar} />}
+                      title={<a href="#">{item.title}</a>}
+                      description={
+                        <div className="mb-1">
+                          <Tag color="purple">{msgTypeEnum[item.msgType]}</Tag> '发布于',
+                          <span className="ml-2">全公司</span>
+                        </div>
+                      }
+                    />
+                    {item.content}
+                    <div className="mt-1 text-hex-aaa">{item.createTime}</div>
+                  </List.Item>
+                )}
+              />
+            </InfiniteScroll>
+          ) : null}
         </div>
       </div>
     </div>