Quellcode durchsuchen

Merge branch 'dev' of http://192.168.1.41:3000/outaozhen/cldV2react into dev

outaozhen vor 4 Jahren
Ursprung
Commit
22bca180be

+ 1 - 0
package.json

@@ -81,6 +81,7 @@
     "@babel/plugin-proposal-optional-chaining": "^7.13.12",
     "@babel/preset-env": "^7.16.11",
     "@babel/preset-react": "^7.16.7",
+    "@babel/preset-typescript": "^7.16.7",
     "@types/express": "^4.17.0",
     "@types/history": "^4.7.2",
     "@types/jest": "^26.0.0",

+ 2 - 2
src/components/RightContent/Book/components/UserList/index.less

@@ -72,10 +72,10 @@
     transform: translateY(-50%);
   }
   &.show-short {
-    width: 3rem;
+    width: 14.563rem;
+    // width: 3rem;
     border-left: 1px solid #d6d6d6;
     &:hover {
-      width: 14.563rem;
       border-left-color: rgba(0, 0, 0, 0.1);
     }
   }

+ 10 - 8
src/components/RightContent/Book/components/UserList/index.tsx

@@ -1,9 +1,10 @@
 import { isDevMode } from '@/utils/env'
+import classNames from 'classnames'
 import { useState, useRef } from 'react'
 import { useIntl } from 'umi'
 import './index.less'
 
-interface StaffItem {
+export type StaffItem = {
   avatar: string
   id: string
   username: string
@@ -35,13 +36,13 @@ const UesrList: React.FC<UserListProps> = ({ onlineList }) => {
     <>
       <span className="absolute top-70 left-[-0.75rem]" onClick={() => setVisible(!visible)}>
         <div className="side-bg">
-          <span className={['side-bg-current', visible ? 'show-side-bg' : ''].join(' ')} />
+          <span className={classNames('side-bg-current', { 'show-side-bg': visible })} />
         </div>
       </span>
       <div
-        className={['book-list flex flex-col bg-hex-ffffff text-hex-666 shadow-card', visible ? 'show-short' : ''].join(
-          ' '
-        )}
+        className={classNames('book-list flex flex-col bg-hex-ffffff text-hex-666 shadow-card', {
+          'show-short': visible
+        })}
       >
         <div className="flex-1 h-full custom-scroll" ref={ref} onScroll={handleOnScroll}>
           <div className="w-full">
@@ -49,7 +50,10 @@ const UesrList: React.FC<UserListProps> = ({ onlineList }) => {
               {visible &&
                 onlineList.map(item => {
                   return (
-                    <li key={item.id} className="table px-2 py-2 text-hex-505050 hover-white hvr-rectangle-out w-full">
+                    <li
+                      key={item.id}
+                      className="table px-2 py-2 text-hex-505050 hover-white hvr-rectangle-out w-full"
+                    >
                       <div className="table-cell align-middle status status-success status-sm ">
                         <span
                           className="w-8 h-8 rounded-1/2 block"
@@ -65,9 +69,7 @@ const UesrList: React.FC<UserListProps> = ({ onlineList }) => {
                       <div className="table-cell w-full align-middle pl-2 pr-2">
                         <div className="max-w-160px overflow-hidden whitespace-nowrap overflow-ellipsis text-sm relative">
                           <span>{item.username}</span>
-                          {/* <small className="block italic text-hex-1dc9b7 text-xs">Online</small> */}
                           <small className="block text-xs">
-                            {/* <span className="mr-1">正在</span> */}
                             <span className="italic">
                               {item.workStatus &&
                                 intl.formatMessage({

+ 5 - 5
src/pages/Hr/Notification/index.jsx

@@ -1,4 +1,4 @@
-import React, { useState, useEffect } from 'react'
+import { useState, useEffect } from 'react'
 import { List, Avatar, Tag, Skeleton, Divider, message, Typography } from 'antd'
 import InfiniteScroll from 'react-infinite-scroll-component'
 import { queryMessageList, sendMessage } from '@/services/staff'
@@ -66,7 +66,7 @@ const Notification = () => {
   return (
     <div className="bg-hex-ffffff rounded-md px-6 pb-6">
       <div className="flex justify-between items-center">
-        <h4 className="py-4 text-xl">通知中心</h4>
+        <div className="py-4 text-xl">通知中心</div>
         {hasPerm ? <AddMessage onConfirm={trySendMessage} /> : null}
       </div>
       <div
@@ -108,11 +108,11 @@ const Notification = () => {
                     </span>
                   }
                   description={
-                    <div className="mb-1">
+                    <div className="mb-1 flex items-center">
                       <Tag color="purple">
                         {intl.formatMessage({ id: `component.globalHeader.${item.msgType}` })}
-                      </Tag>{' '}
-                      &apos;发布范围&apos;,
+                      </Tag>
+                      <span className="ml-2px">&apos;发布范围&apos;,</span>
                       <span className="ml-2">全公司</span>
                     </div>
                   }

+ 6 - 5
src/pages/User/Account/Settings/index.jsx

@@ -47,7 +47,7 @@ const Settings = () => {
   }, [dom.current])
 
   const getMenu = () => {
-    return Object.keys(menuMap).map(item => <Item key={item}>{menuMap[item]}</Item>)
+    return Object.keys(menuMap).map(item => ({ label: menuMap[item], key: item }))
   }
 
   const renderChildren = () => {
@@ -70,19 +70,20 @@ const Settings = () => {
           if (ref) {
             dom.current = ref
           }
-        }}>
+        }}
+      >
         <div className={styles.leftMenu}>
           <Menu
             mode={initConfig.mode}
+            items={getMenu()}
             selectedKeys={[initConfig.selectKey]}
             onClick={({ key }) => {
               setInitConfig({
                 ...initConfig,
                 selectKey: key
               })
-            }}>
-            {getMenu()}
-          </Menu>
+            }}
+          />
         </div>
         <div className={styles.right}>
           {/* <div className={styles.title}>{menuMap[initConfig.selectKey]}</div> */}

+ 4 - 7
src/utils/ws.ts

@@ -19,11 +19,11 @@ export enum CmdType {
   FirstMsg = 1,
   /** @name 通知、消息 */
   NoticeOrMessage = 13,
-  /** @name 在线员工列表 */
+  /** @name 初始化用户列表 */
   OnlineBook = 12,
-  /** @name 员工工作状态 */
+  /** @name 用户工作状态(推) */
   WorkStatus = 14,
-  /** @name 强制退出 */
+  /** @name 强制退出(推) */
   OutLine = 15
 }
 
@@ -163,10 +163,7 @@ class Ws {
 
   // 重连
   private reconnect(): void {
-    if (
-      !this.isLock &&
-      !(this.opts?.reconnectLimit && this.reconnectLimit > this.opts?.reconnectLimit)
-    ) {
+    if (!this.isLock && !(this.opts?.reconnectLimit && this.reconnectLimit > this.opts?.reconnectLimit)) {
       this.reconnectLimit += 1
       this.timer && clearTimeout(this.timer)
       this.timer = setTimeout(() => {