1
This commit is contained in:
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -28,7 +28,7 @@
|
|||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
<script type="module" crossorigin src="/assets/index-D1wOjhOn.js"></script>
|
<script type="module" crossorigin src="/assets/index-Qg4hmCnl.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-D3IaMBsq.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-D3IaMBsq.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -146,9 +146,13 @@ const AppLayout: React.FC = () => {
|
|||||||
const [contactHovered, setContactHovered] = useState(false);
|
const [contactHovered, setContactHovered] = useState(false);
|
||||||
const [contactForm] = Form.useForm();
|
const [contactForm] = Form.useForm();
|
||||||
const [submittingContact, setSubmittingContact] = useState(false);
|
const [submittingContact, setSubmittingContact] = useState(false);
|
||||||
const [contactPosition, setContactPosition] = useState<{ x: number; y: number | string }>({ x: 24, y: '25%' });
|
const [contactPosition, setContactPosition] = useState<{ x: number; y: number }>(() => ({
|
||||||
|
x: 24,
|
||||||
|
y: window.innerHeight * 0.75
|
||||||
|
}));
|
||||||
const [isDragging, setIsDragging] = useState(false);
|
const [isDragging, setIsDragging] = useState(false);
|
||||||
const [dragStart, setDragStart] = useState({ x: 0, y: 0 });
|
const hasMovedRef = useRef(false);
|
||||||
|
const dragOffsetRef = useRef({ x: 0, y: 0 });
|
||||||
const [mobileExpandedMenus, setMobileExpandedMenus] = useState<Record<string, boolean>>({});
|
const [mobileExpandedMenus, setMobileExpandedMenus] = useState<Record<string, boolean>>({});
|
||||||
const [siteName, setSiteName] = useState(() => {
|
const [siteName, setSiteName] = useState(() => {
|
||||||
const cached = localStorage.getItem('siteInfo');
|
const cached = localStorage.getItem('siteInfo');
|
||||||
@@ -213,24 +217,41 @@ const AppLayout: React.FC = () => {
|
|||||||
const handleContactMouseDown = (e: React.MouseEvent) => {
|
const handleContactMouseDown = (e: React.MouseEvent) => {
|
||||||
if (e.button === 0) {
|
if (e.button === 0) {
|
||||||
setIsDragging(true);
|
setIsDragging(true);
|
||||||
setDragStart({
|
hasMovedRef.current = false;
|
||||||
|
dragOffsetRef.current = {
|
||||||
x: e.clientX - contactPosition.x,
|
x: e.clientX - contactPosition.x,
|
||||||
y: typeof contactPosition.y === 'string' ? e.clientY - (window.innerHeight * parseInt(contactPosition.y) / 100) : e.clientY - contactPosition.y,
|
y: e.clientY - contactPosition.y,
|
||||||
});
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleContactMouseMove = (e: MouseEvent) => {
|
const handleContactMouseMove = (e: MouseEvent) => {
|
||||||
if (!isDragging) return;
|
if (!isDragging) return;
|
||||||
|
|
||||||
const newX = Math.max(16, Math.min(window.innerWidth - 70, e.clientX - dragStart.x));
|
const deltaY = Math.abs(e.clientY - (contactPosition.y + dragOffsetRef.current.y));
|
||||||
const newY = Math.max(60, Math.min(window.innerHeight - 60, e.clientY - dragStart.y));
|
if (deltaY > 2) {
|
||||||
|
hasMovedRef.current = true;
|
||||||
|
}
|
||||||
|
|
||||||
setContactPosition({ x: newX, y: newY });
|
const newY = Math.max(60, Math.min(window.innerHeight - 60, e.clientY - dragOffsetRef.current.y));
|
||||||
|
|
||||||
|
setContactPosition(prev => ({ x: prev.x, y: newY }));
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleContactMouseUp = () => {
|
const handleContactMouseUp = () => {
|
||||||
|
const wasDragging = isDragging;
|
||||||
setIsDragging(false);
|
setIsDragging(false);
|
||||||
|
|
||||||
|
if (!hasMovedRef.current && !wasDragging) {
|
||||||
|
setContactModalOpen(true);
|
||||||
|
}
|
||||||
|
hasMovedRef.current = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleContactClick = () => {
|
||||||
|
if (!hasMovedRef.current && !isDragging) {
|
||||||
|
setContactModalOpen(true);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -242,7 +263,7 @@ const AppLayout: React.FC = () => {
|
|||||||
document.removeEventListener('mouseup', handleContactMouseUp);
|
document.removeEventListener('mouseup', handleContactMouseUp);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}, [isDragging, dragStart]);
|
}, [isDragging]);
|
||||||
|
|
||||||
const loadUnreadCount = () => {
|
const loadUnreadCount = () => {
|
||||||
getUnreadCount().then(count => {
|
getUnreadCount().then(count => {
|
||||||
@@ -958,7 +979,7 @@ const AppLayout: React.FC = () => {
|
|||||||
当前平台仅支持支付宝/微信扫码充值,如需转账支付请
|
当前平台仅支持支付宝/微信扫码充值,如需转账支付请
|
||||||
<Typography.Text
|
<Typography.Text
|
||||||
style={{
|
style={{
|
||||||
color: '#6366f1',
|
color: '#ff0000ff',
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
textDecoration: 'underline',
|
textDecoration: 'underline',
|
||||||
}}
|
}}
|
||||||
@@ -1242,7 +1263,7 @@ const AppLayout: React.FC = () => {
|
|||||||
className="contact-button-wrapper"
|
className="contact-button-wrapper"
|
||||||
style={{
|
style={{
|
||||||
right: `${contactPosition.x}px`,
|
right: `${contactPosition.x}px`,
|
||||||
bottom: typeof contactPosition.y === 'string' ? contactPosition.y : `${window.innerHeight - contactPosition.y}px`,
|
bottom: `${window.innerHeight - contactPosition.y}px`,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div style={{
|
<div style={{
|
||||||
@@ -1257,11 +1278,12 @@ const AppLayout: React.FC = () => {
|
|||||||
联系我们
|
联系我们
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
onClick={() => !isDragging && setContactModalOpen(true)}
|
onClick={handleContactClick}
|
||||||
className={`contact-button ${isDragging ? 'dragging' : ''}`}
|
className={`contact-button ${isDragging ? 'dragging' : ''}`}
|
||||||
onMouseEnter={() => setContactHovered(true)}
|
onMouseEnter={() => setContactHovered(true)}
|
||||||
onMouseLeave={() => setContactHovered(false)}
|
onMouseLeave={() => setContactHovered(false)}
|
||||||
onMouseDown={handleContactMouseDown}
|
onMouseDown={handleContactMouseDown}
|
||||||
|
onMouseUp={handleContactMouseUp}
|
||||||
>
|
>
|
||||||
<MessageOutlined style={{ fontSize: 20 }} />
|
<MessageOutlined style={{ fontSize: 20 }} />
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user