fix: 统一所有页面导航栏样式和位置

- 修复导航栏在不同页面显示不一致的问题
- 锁定导航栏位置,移除滚动动画
- 强制设置白色背景和高z-index确保导航栏始终在最顶层
- 统一index.html和pages目录下所有页面的导航栏表现
This commit is contained in:
Yep_Q
2025-09-09 20:55:20 +08:00
parent e665ee15ea
commit 6d3825c4ab
9 changed files with 66 additions and 30 deletions

View File

@@ -72,7 +72,13 @@
"Bash(sed:*)", "Bash(sed:*)",
"Bash(/Users/xiaoqi/Documents/Dev/Project/2025-09-08_n8nDEMO演示/n8n-n8n-1.109.2/start.bat)", "Bash(/Users/xiaoqi/Documents/Dev/Project/2025-09-08_n8nDEMO演示/n8n-n8n-1.109.2/start.bat)",
"Bash(curl:*)", "Bash(curl:*)",
"Bash(node server.js)" "Bash(node server.js)",
"mcp__browser-tools__takeScreenshot",
"Bash(for file in pages/exhibition.html pages/marketing.html pages/operation.html pages/budget.html pages/risk.html)",
"Bash(do sed -i '' 's|</body>| <script src=\"\"../js/nav-component.js\"\"></script>\\n</body>|' \"$file\")",
"Bash(done)",
"mcp__playwright__browser_navigate",
"mcp__playwright__browser_take_screenshot"
], ],
"defaultMode": "acceptEdits", "defaultMode": "acceptEdits",
"additionalDirectories": [ "additionalDirectories": [

Binary file not shown.

After

Width:  |  Height:  |  Size: 934 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 937 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

View File

@@ -0,0 +1,48 @@
> n8n-monorepo@1.109.2 start /Users/xiaoqi/Documents/Dev/Project/2025-09-08_n8nDEMO演示/n8n-n8n-1.109.2
> run-script-os
> n8n-monorepo@1.109.2 start:default
> cd packages/cli/bin && ./n8n
Permissions 0644 for n8n settings file /Users/xiaoqi/.n8n/config are too wide. This is ignored for now, but in the future n8n will attempt to change the permissions automatically. To automatically enforce correct permissions now set N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true (recommended), or turn this check off set N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=false.
Initializing n8n process
n8n ready on ::, port 5678
n8n Task Broker ready on 127.0.0.1, port 5679
Initializing AuthRolesService...
AuthRolesService initialized successfully.
[license SDK] Skipping renewal on init: license cert is not initialized
Registered runner "JS Task Runner" (12eC5bJgg_r_kudoMldG7)
Version: 1.109.2
Locale: zh-CN
Editor is now accessible via:
http://localhost:5678
(node:5685) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
TypeError: fetch failed
at node:internal/deps/undici/undici:13510:13
at processTicksAndRejections (node:internal/process/task_queues:105:5)
at TelemetryController.sourceConfig (/Users/xiaoqi/Documents/Dev/Project/2025-09-08_n8nDEMO演示/n8n-n8n-1.109.2/packages/cli/src/controllers/telemetry.controller.ts:48:20)
at handler (/Users/xiaoqi/Documents/Dev/Project/2025-09-08_n8nDEMO演示/n8n-n8n-1.109.2/packages/cli/src/controller.registry.ts:78:12)
at /Users/xiaoqi/Documents/Dev/Project/2025-09-08_n8nDEMO演示/n8n-n8n-1.109.2/packages/cli/src/controller.registry.ts:101:8
TypeError: fetch failed
at node:internal/deps/undici/undici:13510:13
at processTicksAndRejections (node:internal/process/task_queues:105:5)
at runNextTicks (node:internal/process/task_queues:69:3)
at processImmediate (node:internal/timers:453:9)
at TelemetryController.sourceConfig (/Users/xiaoqi/Documents/Dev/Project/2025-09-08_n8nDEMO演示/n8n-n8n-1.109.2/packages/cli/src/controllers/telemetry.controller.ts:48:20)
at handler (/Users/xiaoqi/Documents/Dev/Project/2025-09-08_n8nDEMO演示/n8n-n8n-1.109.2/packages/cli/src/controller.registry.ts:78:12)
at /Users/xiaoqi/Documents/Dev/Project/2025-09-08_n8nDEMO演示/n8n-n8n-1.109.2/packages/cli/src/controller.registry.ts:101:8
Error fetching feature flags Error [PostHogFetchNetworkError]: Network error while fetching PostHog
at new PostHogFetchNetworkError (/Users/xiaoqi/Documents/Dev/Project/2025-09-08_n8nDEMO演示/n8n-n8n-1.109.2/node_modules/.pnpm/posthog-node@3.2.1/node_modules/posthog-core/src/index.ts:41:5)
at PostHog.<anonymous> (/Users/xiaoqi/Documents/Dev/Project/2025-09-08_n8nDEMO演示/n8n-n8n-1.109.2/node_modules/.pnpm/posthog-node@3.2.1/node_modules/posthog-core/src/index.ts:546:17)
at step (/Users/xiaoqi/Documents/Dev/Project/2025-09-08_n8nDEMO演示/n8n-n8n-1.109.2/node_modules/.pnpm/posthog-node@3.2.1/node_modules/node_modules/tslib/tslib.es6.js:102:23)
at Object.throw (/Users/xiaoqi/Documents/Dev/Project/2025-09-08_n8nDEMO演示/n8n-n8n-1.109.2/node_modules/.pnpm/posthog-node@3.2.1/node_modules/node_modules/tslib/tslib.es6.js:83:53)
at rejected (/Users/xiaoqi/Documents/Dev/Project/2025-09-08_n8nDEMO演示/n8n-n8n-1.109.2/node_modules/.pnpm/posthog-node@3.2.1/node_modules/node_modules/tslib/tslib.es6.js:74:65) {
error: DOMException [TimeoutError]: The operation was aborted due to timeout
at node:internal/deps/undici/undici:13510:13,
[cause]: DOMException [TimeoutError]: The operation was aborted due to timeout
at node:internal/deps/undici/undici:13510:13
}

View File

@@ -78,17 +78,15 @@
function initNav() { function initNav() {
const navElement = document.querySelector('nav') || document.getElementById('navbar'); const navElement = document.querySelector('nav') || document.getElementById('navbar');
if (navElement) { if (navElement) {
// 保留原有的class和id // 统一设置导航栏样式 - 确保所有页面一致
const originalClasses = navElement.className; navElement.className = 'fixed top-0 w-full bg-white shadow-md z-50 transition-all duration-300';
const originalId = navElement.id; navElement.id = 'navbar';
navElement.style.backgroundColor = 'white';
navElement.style.zIndex = '9999';
// 更新导航内容 // 更新导航内容
navElement.innerHTML = generateNavHTML(); navElement.innerHTML = generateNavHTML();
// 恢复原有属性
if (originalClasses) navElement.className = originalClasses;
if (originalId) navElement.id = originalId;
// 添加移动端菜单交互 // 添加移动端菜单交互
const mobileMenuButton = document.getElementById('mobile-menu-button'); const mobileMenuButton = document.getElementById('mobile-menu-button');
const mobileMenu = document.getElementById('mobile-menu'); const mobileMenu = document.getElementById('mobile-menu');
@@ -106,28 +104,12 @@
}); });
} }
// 添加滚动效果 // 保持导航栏始终可见,不添加滚动隐藏效果
let lastScrollTop = 0; // 确保导航栏始终在最顶层
window.addEventListener('scroll', () => { navElement.style.position = 'fixed';
const scrollTop = window.pageYOffset || document.documentElement.scrollTop; navElement.style.top = '0';
navElement.style.left = '0';
if (scrollTop > lastScrollTop && scrollTop > 100) { navElement.style.right = '0';
// 向下滚动 - 隐藏导航
navElement.style.transform = 'translateY(-100%)';
} else {
// 向上滚动 - 显示导航
navElement.style.transform = 'translateY(0)';
}
// 添加背景效果
if (scrollTop > 50) {
navElement.classList.add('bg-white/95', 'backdrop-blur-md');
} else {
navElement.classList.remove('bg-white/95', 'backdrop-blur-md');
}
lastScrollTop = scrollTop;
});
} }
} }