css
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

This commit is contained in:
zhongjy001
2026-02-16 01:23:58 +08:00
parent 4c9790d140
commit 4d0db0c8df
3 changed files with 172 additions and 203 deletions

View File

@@ -0,0 +1,69 @@
html { scroll-behavior: smooth; }
.tool-home { display: grid; grid-template-columns: 208px minmax(0, 1fr); gap: .72rem; align-items: start; }
.tool-side { position: sticky; top: .72rem; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-surface); box-shadow: var(--shadow-sm); padding: .6rem .48rem; max-height: calc(100vh - 1.44rem); overflow: auto; }
.tool-side-logo { display: flex; align-items: center; gap: .38rem; padding: .22rem .3rem .56rem; border-bottom: 1px solid var(--line); margin-bottom: .36rem; font-family: "Outfit", "Noto Sans SC", sans-serif; color: var(--text-main); font-size: 1.12rem; font-weight: 800; }
.tool-side-logo-dot { width: 1.35rem; height: 1.35rem; border-radius: .38rem; background: linear-gradient(135deg, #a777ff, #6e77ff); color: #fff; font-size: .68rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.tool-side-links { display: grid; gap: .16rem; }
.tool-side-link { display: grid; grid-template-columns: 1rem minmax(0, 1fr) auto; align-items: center; gap: .42rem; border: 1px solid transparent; border-radius: .58rem; text-decoration: none; color: #4e6189; padding: .38rem .42rem; font-size: .82rem; transition: .16s ease; }
.tool-side-link:hover, .tool-side-link.active, .tool-side-link.is-active { border-color: var(--line-strong); background: var(--brand-soft); color: #21345f; box-shadow: inset 3px 0 0 #5f72ff; }
.tool-side-link i { color: #687ba2; text-align: center; }
.tool-side-link small { color: #97a9c8; font-size: .7rem; }
.tool-main { min-width: 0; display: grid; gap: .62rem; }
.tool-hero { border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(180deg, #f5f8ff 0, #eef3fb 100%); box-shadow: var(--shadow-sm); padding: .95rem .95rem .82rem; text-align: center; }
.tool-chip { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--bg-surface); color: #6f81a7; font-size: .68rem; font-weight: 700; padding: .14rem .5rem; }
.tool-title { margin: .34rem 0 .18rem; font-family: "Outfit", "Noto Sans SC", sans-serif; font-size: clamp(1.6rem, 2.8vw, 2.45rem); font-weight: 800; color: var(--text-main); }
.tool-sub { margin: 0; color: var(--text-muted); font-size: .84rem; }
:root[data-theme="dark"] .tool-hero { background: linear-gradient(180deg, #1b2849 0, #16223f 100%); }
.tool-search { margin: .62rem auto .38rem; width: min(860px, 100%); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .38rem; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--bg-surface); padding: .3rem; }
.tool-search input { border: 0; box-shadow: none; height: 2.16rem; padding: 0 .82rem; background: transparent; color: var(--text-main); }
.tool-search button { border-radius: 999px; min-width: 90px; height: 2.16rem; font-size: .82rem; }
.tool-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; margin-top: .52rem; }
.tool-kpi { border: 1px solid var(--line); border-radius: .7rem; background: var(--bg-surface); padding: .46rem .5rem; }
.tool-kpi .label { display: block; color: #7b8fb2; font-size: .72rem; }
.tool-kpi .value { margin-top: .12rem; font-family: "Outfit", "Noto Sans SC", sans-serif; font-size: 1.08rem; font-weight: 800; color: var(--text-main); }
.tool-channel { border: 1px solid var(--line); border-radius: 12px; background: var(--bg-surface); box-shadow: var(--shadow-sm); padding: .52rem; display: grid; grid-template-columns: 62px repeat(5, minmax(0, 1fr)); gap: .46rem; }
.tool-channel-mini { border: 1px solid var(--line); border-radius: 10px; background: var(--bg-soft); display: grid; gap: .34rem; padding: .44rem .3rem; }
.tool-channel-mini a { text-decoration: none; color: #5f7399; font-size: .72rem; text-align: center; }
.tool-channel-card { border: 1px solid var(--line); border-radius: 10px; min-height: 104px; display: flex; align-items: flex-end; justify-content: flex-start; text-decoration: none; font-family: "Outfit", "Noto Sans SC", sans-serif; font-size: .92rem; font-weight: 700; color: #fff; background-size: cover; background-position: center; position: relative; overflow: hidden; padding: .52rem; }
.tool-channel-card::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20,32,56,.08), rgba(20,32,56,.68)); }
.tool-channel-card span { position: relative; z-index: 1; }
.tool-banner-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .52rem; }
.tool-banner { border: 1px solid var(--line); border-radius: 10px; background: linear-gradient(90deg, #e8f3ff, #e4f7ef); min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: .52rem; padding: .58rem .72rem; text-decoration: none; }
.tool-banner.alt { background: linear-gradient(90deg, #e6f6ff, #dff8dd); }
.tool-banner b { color: var(--text-main); font-size: 1.06rem; font-family: "Outfit", "Noto Sans SC", sans-serif; }
.tool-banner small { border: 1px solid var(--line-strong); border-radius: 999px; background: var(--bg-surface); color: #5f749a; font-size: .72rem; padding: .14rem .48rem; }
.tool-section { border: 1px solid var(--line); border-radius: 12px; background: var(--bg-surface); box-shadow: var(--shadow-sm); padding: .62rem; scroll-margin-top: 1rem; }
.tool-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .48rem; }
.tool-section-head h2 { margin: 0; color: var(--text-main); font-size: 1rem; font-family: "Outfit", "Noto Sans SC", sans-serif; font-weight: 700; }
.tool-section-head a { color: var(--brand-strong); text-decoration: none; font-size: .76rem; font-weight: 600; }
.tool-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .52rem; }
.tool-card { border: 1px solid var(--line); border-radius: 10px; background: var(--bg-surface); box-shadow: var(--shadow-sm); padding: .56rem .62rem; text-decoration: none; transition: .16s ease; }
.tool-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: 0 12px 22px rgba(31,54,112,.14); }
.tool-card-name { color: var(--text-main); font-size: .92rem; line-height: 1.26; font-weight: 700; }
.tool-card-meta { margin-top: .2rem; color: var(--text-muted); font-size: .76rem; }
.tool-card-tag { margin-top: .42rem; display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; padding: .13rem .48rem; color: var(--brand-strong); background: var(--brand-soft); font-size: .7rem; }
@media (max-width: 1199px) {
.tool-home { grid-template-columns: 1fr; }
.tool-side { position: static; max-height: none; }
.tool-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
.tool-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tool-search { grid-template-columns: 1fr; border-radius: 12px; }
.tool-search button { width: 100%; border-radius: 10px; }
.tool-channel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tool-banner-row { grid-template-columns: 1fr; }
}

View File

@@ -6,90 +6,21 @@
@section('canonical', route('tools.index')) @section('canonical', route('tools.index'))
@section('head') @section('head')
<style> @vite('resources/css/tool_index.css')
html { scroll-behavior: smooth; }
.tool-home { display: grid; grid-template-columns: 208px minmax(0, 1fr); gap: .72rem; align-items: start; }
.tool-side { position: sticky; top: .72rem; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-surface); box-shadow: var(--shadow-sm); padding: .6rem .48rem; max-height: calc(100vh - 1.44rem); overflow: auto; }
.tool-side-logo { display: flex; align-items: center; gap: .38rem; padding: .22rem .3rem .56rem; border-bottom: 1px solid var(--line); margin-bottom: .36rem; font-family: "Outfit", "Noto Sans SC", sans-serif; color: var(--text-main); font-size: 1.12rem; font-weight: 800; }
.tool-side-logo-dot { width: 1.35rem; height: 1.35rem; border-radius: .38rem; background: linear-gradient(135deg, #a777ff, #6e77ff); color: #fff; font-size: .68rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.tool-side-links { display: grid; gap: .16rem; }
.tool-side-link { display: grid; grid-template-columns: 1rem minmax(0, 1fr) auto; align-items: center; gap: .42rem; border: 1px solid transparent; border-radius: .58rem; text-decoration: none; color: #4e6189; padding: .38rem .42rem; font-size: .82rem; transition: .16s ease; }
.tool-side-link:hover, .tool-side-link.active, .tool-side-link.is-active { border-color: var(--line-strong); background: var(--brand-soft); color: #21345f; box-shadow: inset 3px 0 0 #5f72ff; }
.tool-side-link i { color: #687ba2; text-align: center; }
.tool-side-link small { color: #97a9c8; font-size: .7rem; }
.tool-main { min-width: 0; display: grid; gap: .62rem; }
.tool-hero { border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(180deg, #f5f8ff 0, #eef3fb 100%); box-shadow: var(--shadow-sm); padding: .95rem .95rem .82rem; text-align: center; }
.tool-chip { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--bg-surface); color: #6f81a7; font-size: .68rem; font-weight: 700; padding: .14rem .5rem; }
.tool-title { margin: .34rem 0 .18rem; font-family: "Outfit", "Noto Sans SC", sans-serif; font-size: clamp(1.6rem, 2.8vw, 2.45rem); font-weight: 800; color: var(--text-main); }
.tool-sub { margin: 0; color: var(--text-muted); font-size: .84rem; }
:root[data-theme="dark"] .tool-hero { background: linear-gradient(180deg, #1b2849 0, #16223f 100%); }
.tool-search { margin: .62rem auto .38rem; width: min(860px, 100%); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .38rem; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--bg-surface); padding: .3rem; }
.tool-search input { border: 0; box-shadow: none; height: 2.16rem; padding: 0 .82rem; background: transparent; color: var(--text-main); }
.tool-search button { border-radius: 999px; min-width: 90px; height: 2.16rem; font-size: .82rem; }
.tool-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; margin-top: .52rem; }
.tool-kpi { border: 1px solid var(--line); border-radius: .7rem; background: var(--bg-surface); padding: .46rem .5rem; }
.tool-kpi .label { display: block; color: #7b8fb2; font-size: .72rem; }
.tool-kpi .value { margin-top: .12rem; font-family: "Outfit", "Noto Sans SC", sans-serif; font-size: 1.08rem; font-weight: 800; color: var(--text-main); }
.tool-channel { border: 1px solid var(--line); border-radius: 12px; background: var(--bg-surface); box-shadow: var(--shadow-sm); padding: .52rem; display: grid; grid-template-columns: 62px repeat(5, minmax(0, 1fr)); gap: .46rem; }
.tool-channel-mini { border: 1px solid var(--line); border-radius: 10px; background: var(--bg-soft); display: grid; gap: .34rem; padding: .44rem .3rem; }
.tool-channel-mini a { text-decoration: none; color: #5f7399; font-size: .72rem; text-align: center; }
.tool-channel-card { border: 1px solid var(--line); border-radius: 10px; min-height: 104px; display: flex; align-items: flex-end; justify-content: flex-start; text-decoration: none; font-family: "Outfit", "Noto Sans SC", sans-serif; font-size: .92rem; font-weight: 700; color: #fff; background-size: cover; background-position: center; position: relative; overflow: hidden; padding: .52rem; }
.tool-channel-card::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20,32,56,.08), rgba(20,32,56,.68)); }
.tool-channel-card span { position: relative; z-index: 1; }
.tool-banner-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .52rem; }
.tool-banner { border: 1px solid var(--line); border-radius: 10px; background: linear-gradient(90deg, #e8f3ff, #e4f7ef); min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: .52rem; padding: .58rem .72rem; text-decoration: none; }
.tool-banner.alt { background: linear-gradient(90deg, #e6f6ff, #dff8dd); }
.tool-banner b { color: var(--text-main); font-size: 1.06rem; font-family: "Outfit", "Noto Sans SC", sans-serif; }
.tool-banner small { border: 1px solid var(--line-strong); border-radius: 999px; background: var(--bg-surface); color: #5f749a; font-size: .72rem; padding: .14rem .48rem; }
.tool-section { border: 1px solid var(--line); border-radius: 12px; background: var(--bg-surface); box-shadow: var(--shadow-sm); padding: .62rem; scroll-margin-top: 1rem; }
.tool-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .48rem; }
.tool-section-head h2 { margin: 0; color: var(--text-main); font-size: 1rem; font-family: "Outfit", "Noto Sans SC", sans-serif; font-weight: 700; }
.tool-section-head a { color: var(--brand-strong); text-decoration: none; font-size: .76rem; font-weight: 600; }
.tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .52rem; }
.tool-card { border: 1px solid var(--line); border-radius: 10px; background: var(--bg-surface); box-shadow: var(--shadow-sm); padding: .56rem .62rem; text-decoration: none; transition: .16s ease; }
.tool-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: 0 12px 22px rgba(31,54,112,.14); }
.tool-card-name { color: var(--text-main); font-size: .92rem; line-height: 1.26; font-weight: 700; }
.tool-card-meta { margin-top: .2rem; color: var(--text-muted); font-size: .76rem; }
.tool-card-tag { margin-top: .42rem; display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; padding: .13rem .48rem; color: var(--brand-strong); background: var(--brand-soft); font-size: .7rem; }
@media (max-width: 1199px) {
.tool-home { grid-template-columns: 1fr; }
.tool-side { position: static; max-height: none; }
}
@media (max-width: 767px) {
.tool-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tool-search { grid-template-columns: 1fr; border-radius: 12px; }
.tool-search button { width: 100%; border-radius: 10px; }
.tool-channel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tool-banner-row { grid-template-columns: 1fr; }
}
</style>
@endsection @endsection
@section('content') @section('content')
@php @php
$icons = ['bi-stars', 'bi-pencil', 'bi-image', 'bi-camera-video', 'bi-briefcase', 'bi-cpu', 'bi-chat-dots', 'bi-code-slash', 'bi-kanban']; $icons = ['bi-stars', 'bi-pencil', 'bi-image', 'bi-camera-video', 'bi-briefcase', 'bi-cpu', 'bi-chat-dots', 'bi-code-slash', 'bi-kanban'];
$channelModule = $modules['channel_cards'] ?? null; $channelModule = $modules['channel_cards'] ?? null;
$bannerModule = $modules['promo_banners'] ?? null; $bannerModule = $modules['promo_banners'] ?? null;
$hotModule = $modules['hot_tools'] ?? null; $hotModule = $modules['hot_tools'] ?? null;
$latestModule = $modules['latest_tools'] ?? null; $latestModule = $modules['latest_tools'] ?? null;
$categoryModule = $modules['category_sections'] ?? null; $categoryModule = $modules['category_sections'] ?? null;
$moduleOrder = collect($modules)->sortBy('sort_order')->pluck('module_key')->values(); $moduleOrder = collect($modules)->sortBy('sort_order')->pluck('module_key')->values();
$channelItems = collect(data_get($channelModule, 'items', []))->take((int) data_get($channelModule, 'limit', 5)); $channelItems = collect(data_get($channelModule, 'items', []))->take((int) data_get($channelModule, 'limit', 5));
$bannerItems = collect(data_get($bannerModule, 'items', []))->take((int) data_get($bannerModule, 'limit', 2)); $bannerItems = collect(data_get($bannerModule, 'items', []))->take((int) data_get($bannerModule, 'limit', 2));
@endphp @endphp
<div class="tool-home"> <div class="tool-home">
@@ -157,46 +88,9 @@
<a class="channel-tab @if($activeTab === $tab['key']) active @endif" href="{{ route('tools.index', array_filter(array_merge($filters, ['tab' => $tab['key']]))) }}">{{ $tab['label'] }}</a> <a class="channel-tab @if($activeTab === $tab['key']) active @endif" href="{{ route('tools.index', array_filter(array_merge($filters, ['tab' => $tab['key']]))) }}">{{ $tab['label'] }}</a>
@endforeach @endforeach
</nav> </nav>
<x-portal.stat-grid
grid-class="tool-kpis"
item-class="tool-kpi"
:stats="[
['label' => '收录工具', 'value' => $toolStats['total'] ?? 0],
['label' => '支持 API', 'value' => $toolStats['api'] ?? 0],
['label' => '免费可用', 'value' => $toolStats['free'] ?? 0],
['label' => '7天更新', 'value' => $toolStats['updated_7d'] ?? 0],
]"
/>
</section> </section>
@foreach($moduleOrder as $moduleKey) @foreach($moduleOrder as $moduleKey)
@if($moduleKey === 'channel_cards' && data_get($channelModule, 'enabled', true) === true)
@php
$miniItems = $channelItems->take(4);
@endphp
<section id="section-channel" class="tool-section" aria-label="频道入口">
<header class="tool-section-head">
<h2><i class="bi bi-grid text-primary"></i> {{ data_get($channelModule, 'title', '频道卡片') }}</h2>
<a href="{{ route('tools.list') }}">查看更多</a>
</header>
<div class="tool-channel">
<aside class="tool-channel-mini">
@foreach($miniItems as $item)
<a href="{{ $item['url'] ?: 'javascript:void(0)' }}">{{ $item['title'] ?: '频道' }}</a>
@endforeach
</aside>
@foreach($channelItems as $item)
<a class="tool-channel-card" href="{{ $item['url'] ?: 'javascript:void(0)' }}" @if(!empty($item['image_path'])) style="background-image:url('{{ $item['image_path'] }}');" @endif>
<span>{{ $item['title'] ?: '频道入口' }}</span>
</a>
@endforeach
</div>
</section>
@endif
@if($moduleKey === 'promo_banners' && data_get($bannerModule, 'enabled', true) === true) @if($moduleKey === 'promo_banners' && data_get($bannerModule, 'enabled', true) === true)
<section id="section-banner" class="tool-section" aria-label="横幅推荐"> <section id="section-banner" class="tool-section" aria-label="横幅推荐">
<header class="tool-section-head"> <header class="tool-section-head">
@@ -299,7 +193,10 @@
event.preventDefault(); event.preventDefault();
setActive(id); setActive(id);
syncHash(id); syncHash(id);
target.scrollIntoView({ behavior: 'smooth', block: 'start' }); target.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}); });
}); });
@@ -330,7 +227,10 @@
if (target) { if (target) {
setActive(hashId); setActive(hashId);
window.requestAnimationFrame(() => { window.requestAnimationFrame(() => {
target.scrollIntoView({ behavior: 'auto', block: 'start' }); target.scrollIntoView({
behavior: 'auto',
block: 'start'
});
}); });
} else { } else {
setActive(sections[0].id); setActive(sections[0].id);

View File

@@ -5,7 +5,7 @@ import tailwindcss from '@tailwindcss/vite';
export default defineConfig({ export default defineConfig({
plugins: [ plugins: [
laravel({ laravel({
input: ['resources/css/app.css', 'resources/css/home.css', 'resources/js/app.js'], input: ['resources/css/app.css', 'resources/css/home.css', 'resources/css/tool_index.css', 'resources/js/app.js'],
refresh: true, refresh: true,
}), }),
tailwindcss(), tailwindcss(),