zhejiushizhuce 2 лет назад
Родитель
Сommit
33490697b6
2 измененных файлов с 18 добавлено и 2 удалено
  1. 12 2
      src/layout/Navbar/index.jsx
  2. 6 0
      src/layout/Navbar/styles.module.scss

+ 12 - 2
src/layout/Navbar/index.jsx

@@ -258,7 +258,16 @@ const PageHeader = () => {
     const getHeaderHeight = () => {
     const getHeaderHeight = () => {
         // console.log(document.querySelector('div.progressier-install-banner'))
         // console.log(document.querySelector('div.progressier-install-banner'))
         const header = document.querySelector('#appbar');
         const header = document.querySelector('#appbar');
-        if (header!=null)return `${header.offsetHeight || 0}px`
+        let offset = 0;
+        if (barRef){
+           const headerRoom=document.querySelector('#headerRoom');
+           if (headerRoom){
+              if (!barRef.showHeader){
+                  offset=headerRoom.clientHeight;
+              }
+           }
+        }
+        if (header!=null)return `${(header.offsetHeight-offset) || 0}px`
         else return '0px';
         else return '0px';
     }
     }
     const handleScroll=()=>{
     const handleScroll=()=>{
@@ -464,6 +473,7 @@ const PageHeader = () => {
     useEffect(()=>{
     useEffect(()=>{
         setShowMHeader(showHeader);
         setShowMHeader(showHeader);
         barRef.showHeader=showHeader;
         barRef.showHeader=showHeader;
+        changeHeaderHeight();
     },[showHeader]);
     },[showHeader]);
 
 
     useEffect(()=>{
     useEffect(()=>{
@@ -490,7 +500,7 @@ const PageHeader = () => {
     const renderHeaderRoom=()=>{
     const renderHeaderRoom=()=>{
         const active=styles.active;
         const active=styles.active;
         return (
         return (
-            <animated.div className={`${styles.header_room}`} style={headerAni}>
+            <animated.div id={'headerRoom'} className={`${styles.header_room}`} style={headerAni}>
                 <div className={`${styles['mobile-top-navigate-list']}`}>
                 <div className={`${styles['mobile-top-navigate-list']}`}>
                     <button className={`${styles['mb-top-navigate-item']}  ${pathname==='/'?active:''}`} onClick={()=>{
                     <button className={`${styles['mb-top-navigate-item']}  ${pathname==='/'?active:''}`} onClick={()=>{
                         changePath('/');
                         changePath('/');

+ 6 - 0
src/layout/Navbar/styles.module.scss

@@ -13,6 +13,9 @@
     //height: 8.5rem;
     //height: 8.5rem;
     height: auto;
     height: auto;
     //overflow-x: auto;
     //overflow-x: auto;
+    //background-color: rgba(0, 0, 0, 0); /* 使用透明背景 */
+    //pointer-events: auto;
+    pointer-events: none;
   }
   }
   &.hide_header{
   &.hide_header{
     //height:3.75rem;
     //height:3.75rem;
@@ -37,6 +40,7 @@
     height:3.75rem;
     height:3.75rem;
     padding: 0px 10px;
     padding: 0px 10px;
     z-index: 2;
     z-index: 2;
+    pointer-events: auto;
   }
   }
 }
 }
 .header_room{
 .header_room{
@@ -54,6 +58,7 @@
   width: 100%;
   width: 100%;
   overflow-x: auto;
   overflow-x: auto;
   overflow-y: hidden;
   overflow-y: hidden;
+  pointer-events: auto;
 }
 }
 .header_install{
 .header_install{
   display: flex;
   display: flex;
@@ -65,6 +70,7 @@
     transition: none !important;
     transition: none !important;
     top: 0 !important;
     top: 0 !important;
   }
   }
+  pointer-events: auto;
 }
 }
 .btn_sign_in{
 .btn_sign_in{
   //padding: 12px 5px !important;
   //padding: 12px 5px !important;