feat: 自行开发设计 ui样式优化 超管端-控制台 相关的页面

This commit is contained in:
zhanjunhao
2026-11-09 21:45:37 +08:00
parent 54b3e0cc21
commit 5c0849e82b
242 changed files with 9242 additions and 5043 deletions
+58 -15
View File
@@ -17,17 +17,14 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import React, { useState, useEffect, useCallback, useRef } from 'react';
import { Avatar, Tag, Spin, Empty, Button, Divider, theme } from 'antd';
import {
Avatar,
Tag,
Spin,
Empty,
Button,
Tooltip,
Divider,
theme,
} from 'antd';
import { X, RefreshCw, Headphones } from 'lucide-react';
X,
RefreshCw,
Headphones,
ChevronLeft,
ChevronRight,
} from 'lucide-react';
import { API } from '../../helpers';
import { getServerURL } from '../../helpers/config';
import { useTranslation } from 'react-i18next';
@@ -43,6 +40,7 @@ const CustomerServiceFloat = () => {
const { t } = useTranslation();
const { token } = theme.useToken();
const [isOpen, setIsOpen] = useState(false);
const [isCollapsed, setIsCollapsed] = useState(false);
const [loading, setLoading] = useState(false);
const [currentAgent, setCurrentAgent] = useState(null);
const [agentList, setAgentList] = useState([]);
@@ -78,8 +76,9 @@ const CustomerServiceFloat = () => {
API.post(path).catch(() => {});
}, []);
// 打开客服面板;不再读取或提供边缘收起状态。
// 打开面板时恢复完整浮钮,确保关闭后的焦点可以回到触发器。
const handleExpand = () => {
setIsCollapsed(false);
setIsOpen(true);
};
@@ -104,6 +103,7 @@ const CustomerServiceFloat = () => {
if (!config.enabled) return undefined;
const onOpenRequest = (event) => {
event.preventDefault();
setIsCollapsed(false);
setIsOpen(true);
};
window.addEventListener(CUSTOMER_SERVICE_OPEN_EVENT, onOpenRequest);
@@ -252,7 +252,7 @@ const CustomerServiceFloat = () => {
return (
<div
className='customer-service-container'
className={`customer-service-container${isCollapsed ? ' customer-service-container-collapsed' : ''}`}
ref={containerRef}
style={{
'--cs-surface': token.colorBgContainer,
@@ -262,6 +262,9 @@ const CustomerServiceFloat = () => {
'--cs-fill': token.colorFillQuaternary,
'--cs-hover': token.colorFillTertiary,
'--cs-primary': token.colorPrimary,
'--cs-primary-hover': token.colorPrimaryHover,
'--cs-primary-active': token.colorPrimaryActive,
'--cs-on-primary': token.colorTextLightSolid,
'--cs-primary-bg': token.colorPrimaryBg,
'--cs-primary-border': token.colorPrimaryBorder,
'--cs-primary-text': token.colorPrimaryText,
@@ -272,14 +275,54 @@ const CustomerServiceFloat = () => {
{isOpen && (
<div className='cs-backdrop' onClick={handleClose} aria-hidden='true' />
)}
<div className='cs-float-wrapper'>
<Tooltip title={isOpen ? t('关闭客服') : t('联系客服')}>
<div
className={`cs-float-wrapper${isCollapsed ? ' cs-float-wrapper-collapsed' : ''}`}
>
{!isOpen &&
(isCollapsed ? (
<div className='cs-float-tab'>
<Button
className='cs-float-tab-action'
type='text'
title={t('联系客服')}
aria-label={t('联系客服')}
onClick={handleExpand}
icon={<Headphones size={16} strokeWidth={2} />}
/>
<Button
className='cs-float-tab-action'
type='text'
title={t('展开')}
aria-label={t('展开')}
aria-expanded={false}
onClick={() => setIsCollapsed(false)}
icon={<ChevronLeft size={16} strokeWidth={2} />}
/>
</div>
) : (
<Button
className='cs-float-toggle'
type='default'
title={t('收起')}
aria-label={t('收起')}
aria-expanded={true}
onClick={() => setIsCollapsed(true)}
>
<ChevronRight size={16} strokeWidth={2} aria-hidden='true' />
</Button>
))}
<div
className='cs-float-main'
inert={isCollapsed ? '' : undefined}
aria-hidden={isCollapsed}
>
<Button
type='primary'
shape='circle'
className='cs-float-button'
onClick={isOpen ? handleClose : handleExpand}
ref={triggerRef}
title={isOpen ? t('关闭客服') : t('联系客服')}
aria-label={isOpen ? t('关闭客服') : t('联系客服')}
icon={
isOpen ? (
@@ -289,7 +332,7 @@ const CustomerServiceFloat = () => {
)
}
/>
</Tooltip>
</div>
</div>
<div
className={`cs-panel ${isOpen ? 'cs-panel-open' : ''}`}