Commit 679c2e7b authored by 杨思琦's avatar 杨思琦

fix: 大屏退出修改

parent 0a59db82
Pipeline #88049 passed with stages
...@@ -14,7 +14,7 @@ const TabWidget = props => { ...@@ -14,7 +14,7 @@ const TabWidget = props => {
fullscreen: !(props.params !== undefined && props.params.fullscreen === 'true'), fullscreen: !(props.params !== undefined && props.params.fullscreen === 'true'),
}); });
const { linkUrl, fullscreen, bgColor } = params; const { linkUrl, fullscreen, bgColor } = params;
const [ref, isFullscreen, handleFullScreen, handleExitFullScreen, handleExit] = useFullScreen(fullscreen); const [ref, isFullscreen, handleFullScreen, handleExit] = useFullScreen(fullscreen);
const goToPath = (name, data, widgetId) => { const goToPath = (name, data, widgetId) => {
try { try {
const routes = window.globalConfig?.allWidgets || []; const routes = window.globalConfig?.allWidgets || [];
...@@ -74,9 +74,9 @@ const TabWidget = props => { ...@@ -74,9 +74,9 @@ const TabWidget = props => {
<div className={styles['oper-btn']}> <div className={styles['oper-btn']}>
{isFullscreen ? ( {isFullscreen ? (
<> <>
<div className={styles['btn-fullscreen_container']}> {/* <div className={styles['btn-fullscreen_container']}>
<span className={styles['btn-fullscreen_reduce']} onClick={handleExitFullScreen} /> <span className={styles['btn-fullscreen_reduce']} onClick={handleExitFullScreen} />
</div> </div> */}
<div className={styles['btn-fullscreen_container']} style={{ marginLeft: '8px' }}> <div className={styles['btn-fullscreen_container']} style={{ marginLeft: '8px' }}>
<span className={styles['btn-fullscreen_exit']} onClick={handleExit} /> <span className={styles['btn-fullscreen_exit']} onClick={handleExit} />
</div> </div>
......
...@@ -6,6 +6,9 @@ const useFullScreen = needFullscreen => { ...@@ -6,6 +6,9 @@ const useFullScreen = needFullscreen => {
useEffect(() => { useEffect(() => {
const handleToggleFullScreen = () => { const handleToggleFullScreen = () => {
if (!document.fullscreenElement && window.location.pathname !== `/civbase/${window.globalConfig.homepage}`) {
window.history.replaceState({ delete: true }, null, `/civbase/${window.globalConfig.homepage}`);
}
setIsFullscreen(!!document.fullscreenElement); setIsFullscreen(!!document.fullscreenElement);
}; };
document.addEventListener('fullscreenchange', handleToggleFullScreen); document.addEventListener('fullscreenchange', handleToggleFullScreen);
...@@ -23,7 +26,6 @@ const useFullScreen = needFullscreen => { ...@@ -23,7 +26,6 @@ const useFullScreen = needFullscreen => {
}, []); }, []);
const handleExit = useCallback(() => { const handleExit = useCallback(() => {
window.history.replaceState({ delete: true }, null, `/civbase/${window.globalConfig.homepage}`);
document.exitFullscreen(); document.exitFullscreen();
}, []); }, []);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment