Files
ai-web/resources/views/layouts/site.blade.php
zhongjy001 4c9790d140
Some checks failed
Tests / PHP 8.2 (push) Has been cancelled
Tests / PHP 8.3 (push) Has been cancelled
Tests / PHP 8.4 (push) Has been cancelled
css
2026-02-14 02:28:10 +08:00

142 lines
6.3 KiB
PHP

<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>@yield('title', 'AIWeb - AI 工具与模型导航')</title>
<meta name="description" content="@yield('meta_description', '发现优质 AI 工具、模型、资讯与教程。')">
@hasSection('canonical')
<link rel="canonical" href="@yield('canonical')">
@endif
<meta name="theme-color" content="#eef3fb" id="themeColorMeta">
<link href="{{ asset('vendor/bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<link href="{{ asset('vendor/bootstrap-icons/font/bootstrap-icons.min.css') }}" rel="stylesheet">
@vite(['resources/css/home.css', 'resources/css/app.css'])
@yield('head')
</head>
<body class="@yield('page_class', 'page-home')">
<a class="skip-link" href="#main-content">跳到主内容</a>
@php
$topNavItems = [
['route' => 'tools.index', 'label' => 'AI工具集'],
['route' => 'models.index', 'label' => '模型推荐'],
['route' => 'news.index', 'label' => '文章资讯'],
['route' => 'guides.index', 'label' => '教程学习']
];
@endphp
<header class="site-header" aria-label="全站顶部导航">
<div class="container d-flex align-items-center justify-content-between gap-3 py-2">
<a class="brand-link" href="{{ route('home') }}">
<span class="brand-mark">AI</span>
<span>AIWeb</span>
</a>
<nav class="site-nav d-none d-lg-flex" aria-label="主菜单">
@foreach($topNavItems as $item)
<a class="site-nav-link @if(request()->routeIs($item['route'])) active @endif" href="{{ route($item['route']) }}">{{ $item['label'] }}</a>
@endforeach
</nav>
</div>
</header>
<main id="main-content" class="page-main" tabindex="-1">
<div class="container">
@yield('content')
</div>
</main>
<footer class="footer-shell py-4 mt-3">
<div class="container d-flex flex-column flex-lg-row justify-content-between gap-2">
<div>© {{ date('Y') }} AIWeb · AI工具集 · 模型推荐 · 教程学习</div>
<div>
<a class="text-decoration-none me-3" href="{{ route('seo.sitemap') }}">Sitemap</a>
<a class="text-decoration-none" href="{{ route('seo.robots') }}">Robots</a>
</div>
</div>
</footer>
<div class="float-actions">
<button type="button" class="float-btn" id="themeToggle" title="切换主题" aria-label="切换明暗模式">
<i class="bi bi-moon-stars"></i>
</button>
<button type="button" class="float-btn" data-bs-toggle="modal" data-bs-target="#feedbackModal" title="提交反馈" aria-label="提交反馈">
<i class="bi bi-chat-dots"></i>
</button>
</div>
<div class="modal fade feedback-modal" id="feedbackModal" tabindex="-1" aria-labelledby="feedbackModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<form method="post" action="{{ route('feedback.store') }}">
@csrf
<div class="modal-header">
<h5 class="modal-title" id="feedbackModalLabel">提交反馈</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="关闭"></button>
</div>
<div class="modal-body d-grid gap-2">
<select class="form-select" name="feedback_type" required>
<option value="">请选择类型</option>
<option value="tool">推荐新工具</option>
<option value="model">推荐新模型</option>
<option value="news">资讯纠错/补充</option>
<option value="guide">教程建议</option>
<option value="other">其他建议</option>
</select>
<input class="form-control" type="text" name="title" maxlength="180" placeholder="标题(如:建议收录某某工具)" required>
<textarea class="form-control" name="description" rows="5" maxlength="4000" placeholder="请详细描述你的建议、来源链接、补充说明等" required></textarea>
<input class="form-control" type="text" name="contact" maxlength="160" placeholder="联系方式(可选:邮箱/微信)">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">取消</button>
<button type="submit" class="btn btn-primary">提交反馈</button>
</div>
</form>
</div>
</div>
</div>
<script src="{{ asset('vendor/bootstrap/js/bootstrap.bundle.min.js') }}"></script>
<script>
(() => {
const root = document.documentElement;
const storageKey = 'aiweb-theme';
const toggle = document.getElementById('themeToggle');
const meta = document.getElementById('themeColorMeta');
const applyTheme = (theme) => {
root.setAttribute('data-theme', theme);
if (meta) {
meta.setAttribute('content', theme === 'dark' ? '#0f1528' : '#eef3fb');
}
if (toggle) {
const icon = toggle.querySelector('i');
if (icon) {
icon.className = theme === 'dark' ? 'bi bi-sun' : 'bi bi-moon-stars';
}
}
};
const initial = localStorage.getItem(storageKey) ||
(window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
applyTheme(initial);
toggle?.addEventListener('click', () => {
const next = root.getAttribute('data-theme') === 'dark' ? 'light' : 'dark';
localStorage.setItem(storageKey, next);
applyTheme(next);
});
})();
</script>
@yield('scripts')
</body>
</html>