配置功能完善
This commit is contained in:
@@ -2,48 +2,345 @@
|
||||
|
||||
@section('title', '首页模块配置')
|
||||
|
||||
@section('head')
|
||||
<style>
|
||||
.module-card { border: 1px solid #d9e2f1; border-radius: .75rem; background: #fff; }
|
||||
.module-card + .module-card { margin-top: 1rem; }
|
||||
.module-items { display: grid; gap: .75rem; }
|
||||
.module-item { border: 1px dashed #d6dfef; border-radius: .65rem; padding: .75rem; background: #f9fbff; }
|
||||
.module-item-preview { width: 100%; max-height: 160px; object-fit: cover; border-radius: .5rem; border: 1px solid #dbe5f4; background: #fff; }
|
||||
.module-key { font-size: .78rem; color: #64748b; }
|
||||
.inline-add-form { border: 1px solid #e2e8f0; border-radius: .65rem; padding: .75rem; background: #f8fafc; }
|
||||
.drag-handle { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border: 1px solid #d8e1f1; border-radius: .45rem; color: #64748b; cursor: grab; background: #fff; }
|
||||
.drag-handle:active { cursor: grabbing; }
|
||||
.sortable-ghost { opacity: .45; }
|
||||
.sortable-chosen { box-shadow: 0 12px 24px rgba(42, 64, 120, .16); }
|
||||
</style>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="card">
|
||||
<div class="card module-card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">首页模块配置(AI工具集)</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@if(session('status'))
|
||||
<div class="alert alert-success">{{ session('status') }}</div>
|
||||
@endif
|
||||
<p class="text-muted mb-3">支持配置模块标题、副标题、图片、链接、排序与展示数量。保存后首页立即生效。</p>
|
||||
|
||||
<form method="post" action="{{ route('admin.settings.update') }}" class="row g-3">
|
||||
<form id="home-module-form" method="post" action="{{ route('admin.settings.update') }}" class="d-grid gap-4">
|
||||
@csrf
|
||||
@method('put')
|
||||
|
||||
<div class="js-module-list d-grid gap-4">
|
||||
@foreach($modules as $module)
|
||||
<div class="col-12">
|
||||
<div class="border rounded p-3 d-flex flex-column flex-md-row align-items-md-center justify-content-between gap-3">
|
||||
<div>
|
||||
<div class="fw-semibold">{{ $module['label'] }}</div>
|
||||
<div class="text-muted small">key: {{ $module['key'] }}</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex align-items-center gap-3">
|
||||
<label class="form-check form-switch m-0">
|
||||
<input class="form-check-input" type="checkbox" name="modules[{{ $module['key'] }}][enabled]" value="1" @checked($module['enabled'])>
|
||||
<span class="form-check-label">启用</span>
|
||||
</label>
|
||||
|
||||
<section class="module-card p-3 js-module-entry" data-module-id="{{ $module->id }}">
|
||||
<div class="d-flex flex-wrap align-items-center justify-content-between gap-2 mb-3">
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<span class="drag-handle js-drag-handle-module" title="拖拽排序"><i class="bi bi-grip-vertical"></i></span>
|
||||
<div>
|
||||
<label class="form-label mb-1 small">数量上限</label>
|
||||
<input class="form-control form-control-sm" style="width: 110px;" type="number" min="1" max="30" name="modules[{{ $module['key'] }}][limit]" value="{{ $module['limit'] }}">
|
||||
<h4 class="mb-1">{{ $module->name }}</h4>
|
||||
<div class="module-key">key: {{ $module->module_key }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<label class="form-check form-switch m-0">
|
||||
<input class="form-check-input" type="checkbox" name="modules[{{ $module->id }}][enabled]" value="1" @checked($module->enabled)>
|
||||
<span class="form-check-label">启用模块</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
<div class="col-12">
|
||||
<button class="btn btn-primary" type="submit">保存配置</button>
|
||||
<div class="row g-3">
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">模块名称</label>
|
||||
<input type="text" class="form-control" name="modules[{{ $module->id }}][name]" value="{{ old("modules.{$module->id}.name", $module->name) }}" required>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">标题</label>
|
||||
<input type="text" class="form-control" name="modules[{{ $module->id }}][title]" value="{{ old("modules.{$module->id}.title", $module->title) }}">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">副标题</label>
|
||||
<input type="text" class="form-control" name="modules[{{ $module->id }}][subtitle]" value="{{ old("modules.{$module->id}.subtitle", $module->subtitle) }}">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<label class="form-label">排序</label>
|
||||
<input type="number" min="0" max="9999" class="form-control js-module-order-input" name="modules[{{ $module->id }}][sort_order]" value="{{ old("modules.{$module->id}.sort_order", $module->sort_order) }}">
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<label class="form-label">数量上限</label>
|
||||
<input type="number" min="1" max="30" class="form-control" name="modules[{{ $module->id }}][limit]" value="{{ old("modules.{$module->id}.limit", $module->limit) }}">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<label class="form-label">更多链接类型</label>
|
||||
@php($moduleLinkType = old("modules.{$module->id}.more_link_type", $module->more_link_type))
|
||||
<select class="form-select" name="modules[{{ $module->id }}][more_link_type]">
|
||||
<option value="" @selected($moduleLinkType === null || $moduleLinkType === '')>无</option>
|
||||
<option value="route" @selected($moduleLinkType === 'route')>内部路由</option>
|
||||
<option value="url" @selected($moduleLinkType === 'url')>自定义URL</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">更多链接目标</label>
|
||||
<input type="text" class="form-control" name="modules[{{ $module->id }}][more_link_target]" value="{{ old("modules.{$module->id}.more_link_target", $module->more_link_target) }}" placeholder="route 名称或 URL / 站内路径">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<label class="form-label">侧栏标题</label>
|
||||
<input type="text" class="form-control" name="modules[{{ $module->id }}][extra][side_title]" value="{{ old("modules.{$module->id}.extra.side_title", data_get($module->extra, 'side_title')) }}">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">侧栏副标题</label>
|
||||
<input type="text" class="form-control" name="modules[{{ $module->id }}][extra][side_subtitle]" value="{{ old("modules.{$module->id}.extra.side_subtitle", data_get($module->extra, 'side_subtitle')) }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if(in_array($module->module_key, ['channel_cards', 'promo_banners'], true))
|
||||
<hr class="my-3">
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<h5 class="mb-0">模块条目</h5>
|
||||
<small class="text-muted">条目要求:标题、图片、链接必填</small>
|
||||
</div>
|
||||
|
||||
<div class="module-items js-item-list" data-module-id="{{ $module->id }}">
|
||||
@foreach($module->items as $item)
|
||||
<div class="module-item js-item-entry" data-item-id="{{ $item->id }}">
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<span class="module-key">item: {{ $item->id }}</span>
|
||||
<span class="drag-handle js-drag-handle-item" title="拖拽排序"><i class="bi bi-grip-vertical"></i></span>
|
||||
</div>
|
||||
<div class="row g-3">
|
||||
<div class="col-md-2">
|
||||
<label class="form-label">排序</label>
|
||||
<input type="number" min="0" max="9999" class="form-control js-item-order-input" name="modules[{{ $module->id }}][items][{{ $item->id }}][sort_order]" value="{{ old("modules.{$module->id}.items.{$item->id}.sort_order", $item->sort_order) }}">
|
||||
</div>
|
||||
<div class="col-md-2 d-flex align-items-end">
|
||||
<label class="form-check form-switch mb-0">
|
||||
<input class="form-check-input" type="checkbox" name="modules[{{ $module->id }}][items][{{ $item->id }}][enabled]" value="1" @checked(old("modules.{$module->id}.items.{$item->id}.enabled", $item->enabled))>
|
||||
<span class="form-check-label">启用</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">标题</label>
|
||||
<input type="text" class="form-control" name="modules[{{ $module->id }}][items][{{ $item->id }}][title]" value="{{ old("modules.{$module->id}.items.{$item->id}.title", $item->title) }}">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">副标题</label>
|
||||
<input type="text" class="form-control" name="modules[{{ $module->id }}][items][{{ $item->id }}][subtitle]" value="{{ old("modules.{$module->id}.items.{$item->id}.subtitle", $item->subtitle) }}">
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">图片路径(/storage/...)</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="modules[{{ $module->id }}][items][{{ $item->id }}][image_path]" value="{{ old("modules.{$module->id}.items.{$item->id}.image_path", $item->image_path) }}" id="module-item-image-{{ $item->id }}" placeholder="/storage/markdown-images/...">
|
||||
<button class="btn btn-outline-primary js-md-upload-btn" type="button" data-target="#module-item-image-{{ $item->id }}">上传图片</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">链接类型</label>
|
||||
@php($itemLinkType = old("modules.{$module->id}.items.{$item->id}.link_type", $item->link_type))
|
||||
<select class="form-select" name="modules[{{ $module->id }}][items][{{ $item->id }}][link_type]">
|
||||
<option value="route" @selected($itemLinkType === 'route')>内部路由</option>
|
||||
<option value="url" @selected($itemLinkType === 'url')>自定义URL</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">链接目标</label>
|
||||
<input type="text" class="form-control" name="modules[{{ $module->id }}][items][{{ $item->id }}][link_target]" value="{{ old("modules.{$module->id}.items.{$item->id}.link_target", $item->link_target) }}" placeholder="如 tools.list 或 https://...">
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
@if(!empty($item->image_path))
|
||||
<img class="module-item-preview" src="{{ $item->image_path }}" alt="{{ $item->title ?: '预览图' }}">
|
||||
@else
|
||||
<div class="module-item-preview d-flex align-items-center justify-content-center text-muted">暂无图片</div>
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-md-6 d-flex align-items-end justify-content-end">
|
||||
<button
|
||||
class="btn btn-outline-danger js-delete-item"
|
||||
type="button"
|
||||
data-delete-url="{{ route('admin.settings.items.destroy', ['module' => $module, 'item' => $item]) }}"
|
||||
>删除条目</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
</section>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<button class="btn btn-primary" type="submit">保存全部配置</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@foreach($modules as $module)
|
||||
@if(in_array($module->module_key, ['channel_cards', 'promo_banners'], true))
|
||||
<div class="card module-card mt-3">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">新增条目 - {{ $module->name }}</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form method="post" action="{{ route('admin.settings.items.store', $module) }}" class="row g-3 inline-add-form">
|
||||
@csrf
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">标题</label>
|
||||
<input type="text" class="form-control" name="title" placeholder="条目标题">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">副标题</label>
|
||||
<input type="text" class="form-control" name="subtitle" placeholder="条目副标题">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">图片</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="image_path" id="new-item-image-{{ $module->id }}" placeholder="/storage/...">
|
||||
<button class="btn btn-outline-primary js-md-upload-btn" type="button" data-target="#new-item-image-{{ $module->id }}">上传</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">排序</label>
|
||||
<input type="number" min="0" max="9999" class="form-control" name="sort_order" value="{{ (($module->items->max('sort_order') ?? 0) + 10) }}">
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">链接类型</label>
|
||||
<select class="form-select" name="link_type">
|
||||
<option value="route">内部路由</option>
|
||||
<option value="url">自定义URL</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<label class="form-label">链接目标</label>
|
||||
<input type="text" class="form-control" name="link_target" placeholder="如 tools.list 或 https://example.com">
|
||||
</div>
|
||||
<div class="col-md-2 d-flex align-items-end">
|
||||
<label class="form-check form-switch mb-2">
|
||||
<input class="form-check-input" type="checkbox" name="enabled" value="1" checked>
|
||||
<span class="form-check-label">启用</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<div class="text-muted small mb-2">可选内部路由:
|
||||
@foreach($routeOptions as $option)
|
||||
<code class="me-1">{{ $option['value'] }}</code>
|
||||
@endforeach
|
||||
</div>
|
||||
<button class="btn btn-outline-primary" type="submit">新增条目</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
<div class="card module-card mt-3">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">内部路由参考</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row g-2">
|
||||
@foreach($routeOptions as $option)
|
||||
<div class="col-md-4">
|
||||
<div class="border rounded p-2 d-flex justify-content-between align-items-center">
|
||||
<span>{{ $option['name'] }}</span>
|
||||
<code>{{ $option['value'] }}</code>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('scripts')
|
||||
<script src="https://cdn.jsdelivr.net/npm/sortablejs@1.15.2/Sortable.min.js"></script>
|
||||
<script>
|
||||
(() => {
|
||||
const moduleForm = document.getElementById('home-module-form');
|
||||
const moduleList = document.querySelector('.js-module-list');
|
||||
|
||||
const syncModuleOrder = () => {
|
||||
if (!moduleList) {
|
||||
return;
|
||||
}
|
||||
|
||||
moduleList.querySelectorAll('.js-module-entry').forEach((entry, index) => {
|
||||
const input = entry.querySelector('.js-module-order-input');
|
||||
if (input instanceof HTMLInputElement) {
|
||||
input.value = String((index + 1) * 10);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const syncItemOrder = (list) => {
|
||||
if (!(list instanceof HTMLElement)) {
|
||||
return;
|
||||
}
|
||||
|
||||
list.querySelectorAll('.js-item-entry').forEach((entry, index) => {
|
||||
const input = entry.querySelector('.js-item-order-input');
|
||||
if (input instanceof HTMLInputElement) {
|
||||
input.value = String((index + 1) * 10);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if (window.Sortable && moduleList) {
|
||||
new Sortable(moduleList, {
|
||||
animation: 150,
|
||||
handle: '.js-drag-handle-module',
|
||||
draggable: '.js-module-entry',
|
||||
ghostClass: 'sortable-ghost',
|
||||
chosenClass: 'sortable-chosen',
|
||||
onEnd: syncModuleOrder,
|
||||
});
|
||||
|
||||
document.querySelectorAll('.js-item-list').forEach((list) => {
|
||||
new Sortable(list, {
|
||||
animation: 150,
|
||||
handle: '.js-drag-handle-item',
|
||||
draggable: '.js-item-entry',
|
||||
ghostClass: 'sortable-ghost',
|
||||
chosenClass: 'sortable-chosen',
|
||||
onEnd: () => syncItemOrder(list),
|
||||
});
|
||||
|
||||
syncItemOrder(list);
|
||||
});
|
||||
|
||||
syncModuleOrder();
|
||||
}
|
||||
|
||||
moduleForm?.addEventListener('submit', () => {
|
||||
syncModuleOrder();
|
||||
document.querySelectorAll('.js-item-list').forEach((list) => syncItemOrder(list));
|
||||
});
|
||||
|
||||
document.querySelectorAll('.js-delete-item').forEach((button) => {
|
||||
button.addEventListener('click', () => {
|
||||
const action = button.getAttribute('data-delete-url');
|
||||
const token = document.querySelector('meta[name="csrf-token"]')?.getAttribute('content');
|
||||
|
||||
if (!action || !token) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!window.confirm('确认删除该条目?')) {
|
||||
return;
|
||||
}
|
||||
|
||||
const form = document.createElement('form');
|
||||
form.method = 'post';
|
||||
form.action = action;
|
||||
form.innerHTML = `<input type="hidden" name="_token" value="${token}"><input type="hidden" name="_method" value="delete">`;
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
});
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
@php
|
||||
$tabs = [
|
||||
['key' => 'tools', 'label' => 'AI工具集', 'url' => route('tools.index')],
|
||||
['key' => 'models', 'label' => 'AI应用集', 'url' => route('models.index')],
|
||||
['key' => 'news', 'label' => '每日AI资讯', 'url' => route('news.index')],
|
||||
['key' => 'guides', 'label' => 'AI教程资源', 'url' => route('guides.index')],
|
||||
['key' => 'models', 'label' => '模型推荐', 'url' => route('models.index')],
|
||||
['key' => 'news', 'label' => '文章资讯', 'url' => route('news.index')],
|
||||
['key' => 'guides', 'label' => '教程学习', 'url' => route('guides.index')],
|
||||
['key' => 'tool-list', 'label' => '工具列表', 'url' => route('tools.list')],
|
||||
];
|
||||
@endphp
|
||||
@@ -25,3 +25,4 @@
|
||||
</nav>
|
||||
<div class="{{ $statusClass }}">{{ $statusLabel }} <b>{{ $statusValue }}</b></div>
|
||||
</header>
|
||||
|
||||
|
||||
@@ -139,14 +139,22 @@
|
||||
const uploadEndpoint = '{{ route('admin.uploads.markdown-image') }}';
|
||||
const csrfToken = document.querySelector('meta[name="csrf-token"]')?.getAttribute('content') || '';
|
||||
|
||||
const insertTextAtCursor = (textarea, text) => {
|
||||
const start = textarea.selectionStart ?? textarea.value.length;
|
||||
const end = textarea.selectionEnd ?? textarea.value.length;
|
||||
textarea.value = textarea.value.substring(0, start) + text + textarea.value.substring(end);
|
||||
const insertTextAtCursor = (field, text) => {
|
||||
if (!(field instanceof HTMLInputElement) && !(field instanceof HTMLTextAreaElement)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const start = field.selectionStart ?? field.value.length;
|
||||
const end = field.selectionEnd ?? field.value.length;
|
||||
field.value = field.value.substring(0, start) + text + field.value.substring(end);
|
||||
const nextPos = start + text.length;
|
||||
textarea.selectionStart = nextPos;
|
||||
textarea.selectionEnd = nextPos;
|
||||
textarea.focus();
|
||||
|
||||
if (typeof field.selectionStart === 'number' && typeof field.selectionEnd === 'number') {
|
||||
field.selectionStart = nextPos;
|
||||
field.selectionEnd = nextPos;
|
||||
}
|
||||
|
||||
field.focus();
|
||||
};
|
||||
|
||||
const setButtonLoading = (button, loading) => {
|
||||
@@ -205,8 +213,9 @@
|
||||
const attachUploadButton = (button) => {
|
||||
button.addEventListener('click', function () {
|
||||
const selector = button.getAttribute('data-target');
|
||||
const textarea = selector ? document.querySelector(selector) : null;
|
||||
if (!textarea) {
|
||||
const targetField = selector ? document.querySelector(selector) : null;
|
||||
|
||||
if (!(targetField instanceof HTMLInputElement) && !(targetField instanceof HTMLTextAreaElement)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -222,7 +231,10 @@
|
||||
setButtonLoading(button, true);
|
||||
try {
|
||||
const payload = await uploadImage(file);
|
||||
insertTextAtCursor(textarea, buildMarkdownImageText(payload, file.name || 'image'));
|
||||
const imageText = targetField instanceof HTMLTextAreaElement
|
||||
? buildMarkdownImageText(payload, file.name || 'image')
|
||||
: payload.url;
|
||||
insertTextAtCursor(targetField, imageText);
|
||||
} catch (_) {
|
||||
alert('图片上传失败,请稍后重试');
|
||||
} finally {
|
||||
|
||||
@@ -2,472 +2,72 @@
|
||||
|
||||
@section('page_class', 'page-tools')
|
||||
@section('title', 'AI工具集 - AIWeb')
|
||||
@section('meta_description', 'AI工具集首页,按分类分块浏览工具,左侧菜单可定位到对应区块。')
|
||||
@section('meta_description', 'AI工具集首页,按分类分块浏览工具,左侧菜单可定位到对应模块。')
|
||||
@section('canonical', route('tools.index'))
|
||||
|
||||
@section('head')
|
||||
<style>
|
||||
html {
|
||||
scroll-behavior: smooth;
|
||||
html { scroll-behavior: smooth; }
|
||||
|
||||
.tool-home { display: grid; grid-template-columns: 186px minmax(0, 1fr); gap: .68rem; align-items: start; }
|
||||
.tool-side { position: sticky; top: .72rem; border: 1px solid #d8e1f1; border-radius: 12px; background: #fff; box-shadow: 0 8px 18px rgba(40,63,120,.08); 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 #e7edf8; margin-bottom: .36rem; font-family: "Outfit", "Noto Sans SC", sans-serif; color: #131e44; 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: #d4ddf2; background: #f4f7ff; 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-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; border: 1px solid #d8e1f1; border-radius: 12px; background: #fff; box-shadow: 0 8px 18px rgba(40,63,120,.08); padding: .5rem .62rem; }
|
||||
.tool-top .channel-tab { padding: .16rem .52rem; font-size: .78rem; }
|
||||
.tool-status { color: #7387ad; font-size: .76rem; white-space: nowrap; }
|
||||
.tool-status b { color: #2c4172; font-family: "Outfit", "Noto Sans SC", sans-serif; font-size: .9rem; }
|
||||
|
||||
.tool-hero { border: 1px solid #d8e1f1; border-radius: 12px; background: linear-gradient(180deg, #f5f8ff 0, #eef3fb 100%); box-shadow: 0 8px 18px rgba(40,63,120,.08); padding: .95rem .95rem .82rem; text-align: center; }
|
||||
.tool-chip { display: inline-flex; border: 1px solid #d8e0f0; border-radius: 999px; background: #fff; 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: #141f47; }
|
||||
.tool-sub { margin: 0; color: #66799f; font-size: .84rem; }
|
||||
|
||||
.tool-search { margin: .62rem auto .38rem; width: min(860px, 100%); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .38rem; border: 1px solid #d4deef; border-radius: 999px; background: #fff; padding: .3rem; }
|
||||
.tool-search input { border: 0; box-shadow: none; height: 2.16rem; padding: 0 .82rem; background: transparent; }
|
||||
.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 #d8e2f2; border-radius: .7rem; background: #fff; 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: #1c2d55; }
|
||||
|
||||
.tool-channel { border: 1px solid #d8e1f1; border-radius: 12px; background: #fff; box-shadow: 0 8px 18px rgba(40,63,120,.08); padding: .52rem; display: grid; grid-template-columns: 62px repeat(5, minmax(0, 1fr)); gap: .46rem; }
|
||||
.tool-channel-mini { border: 1px solid #dee6f5; border-radius: 10px; background: #f8faff; 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 #dce4f3; border-radius: 10px; min-height: 94px; display: flex; align-items: center; justify-content: center; text-decoration: none; font-family: "Outfit", "Noto Sans SC", sans-serif; font-size: 1.05rem; font-weight: 800; color: #273a63; background-size: cover; background-position: center; position: relative; overflow: hidden; }
|
||||
.tool-channel-card::after { content: ''; position: absolute; inset: 0; background: rgba(255,255,255,.78); }
|
||||
.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 #d8e1f1; border-radius: 10px; background: linear-gradient(90deg, #e8f3ff, #e4f7ef); min-height: 66px; 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: #1d3058; font-size: 1.06rem; font-family: "Outfit", "Noto Sans SC", sans-serif; }
|
||||
.tool-banner small { border: 1px solid #d6def0; border-radius: 999px; background: #fff; color: #5f749a; font-size: .72rem; padding: .14rem .48rem; }
|
||||
|
||||
.tool-section { border: 1px solid #d8e1f1; border-radius: 12px; background: #fff; box-shadow: 0 8px 18px rgba(40,63,120,.08); 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: #20335d; font-size: 1rem; font-family: "Outfit", "Noto Sans SC", sans-serif; font-weight: 700; }
|
||||
.tool-section-head a { color: #4d63a4; text-decoration: none; font-size: .76rem; font-weight: 600; }
|
||||
|
||||
@media (max-width: 1199px) {
|
||||
.tool-home { grid-template-columns: 1fr; }
|
||||
.tool-side { position: static; max-height: none; }
|
||||
}
|
||||
|
||||
.tool-home {
|
||||
display: grid;
|
||||
grid-template-columns: 186px minmax(0, 1fr);
|
||||
gap: .68rem;
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.tool-side {
|
||||
position: sticky;
|
||||
top: .72rem;
|
||||
border: 1px solid #d8e1f1;
|
||||
border-radius: 12px;
|
||||
background: #fff;
|
||||
box-shadow: 0 8px 18px rgba(40, 63, 120, .08);
|
||||
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 #e7edf8;
|
||||
margin-bottom: .36rem;
|
||||
font-family: "Outfit", "Noto Sans SC", sans-serif;
|
||||
color: #131e44;
|
||||
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 {
|
||||
border-color: #d4ddf2;
|
||||
background: #f4f7ff;
|
||||
color: #21345f;
|
||||
box-shadow: inset 2px 0 0 #5f72ff;
|
||||
}
|
||||
|
||||
.tool-side-link.is-active {
|
||||
border-color: #d4ddf2;
|
||||
background: #eef3ff;
|
||||
color: #1f3157;
|
||||
box-shadow: inset 3px 0 0 #536eff;
|
||||
}
|
||||
|
||||
.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-top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: .5rem;
|
||||
border: 1px solid #d8e1f1;
|
||||
border-radius: 12px;
|
||||
background: #fff;
|
||||
box-shadow: 0 8px 18px rgba(40, 63, 120, .08);
|
||||
padding: .5rem .62rem;
|
||||
}
|
||||
|
||||
.tool-top .channel-tab {
|
||||
padding: .16rem .52rem;
|
||||
font-size: .78rem;
|
||||
}
|
||||
|
||||
.tool-status {
|
||||
color: #7387ad;
|
||||
font-size: .76rem;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.tool-status b {
|
||||
color: #2c4172;
|
||||
font-family: "Outfit", "Noto Sans SC", sans-serif;
|
||||
font-size: .9rem;
|
||||
}
|
||||
|
||||
.tool-hero {
|
||||
border: 1px solid #d8e1f1;
|
||||
border-radius: 12px;
|
||||
background: linear-gradient(180deg, #f5f8ff 0, #eef3fb 100%);
|
||||
box-shadow: 0 8px 18px rgba(40, 63, 120, .08);
|
||||
padding: .95rem .95rem .82rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.tool-chip {
|
||||
display: inline-flex;
|
||||
border: 1px solid #d8e0f0;
|
||||
border-radius: 999px;
|
||||
background: #fff;
|
||||
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: #141f47;
|
||||
}
|
||||
|
||||
.tool-sub {
|
||||
margin: 0;
|
||||
color: #66799f;
|
||||
font-size: .84rem;
|
||||
}
|
||||
|
||||
.tool-search {
|
||||
margin: .62rem auto .38rem;
|
||||
width: min(860px, 100%);
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
gap: .38rem;
|
||||
border: 1px solid #d4deef;
|
||||
border-radius: 999px;
|
||||
background: #fff;
|
||||
padding: .3rem;
|
||||
}
|
||||
|
||||
.tool-search input {
|
||||
border: 0;
|
||||
box-shadow: none;
|
||||
height: 2.16rem;
|
||||
padding: 0 .82rem;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.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: .48rem;
|
||||
}
|
||||
|
||||
.tool-kpi {
|
||||
border: 1px solid #d7e0f1;
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
padding: .56rem .6rem;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.tool-kpi span {
|
||||
font-size: .74rem;
|
||||
color: #6d80a5;
|
||||
}
|
||||
|
||||
.tool-kpi b {
|
||||
display: block;
|
||||
margin-top: .12rem;
|
||||
font-family: "Outfit", "Noto Sans SC", sans-serif;
|
||||
font-size: 1.08rem;
|
||||
font-weight: 800;
|
||||
color: #1c2d55;
|
||||
}
|
||||
|
||||
.tool-channel {
|
||||
border: 1px solid #d8e1f1;
|
||||
border-radius: 12px;
|
||||
background: #fff;
|
||||
box-shadow: 0 8px 18px rgba(40, 63, 120, .08);
|
||||
padding: .52rem;
|
||||
display: grid;
|
||||
grid-template-columns: 62px repeat(5, minmax(0, 1fr));
|
||||
gap: .46rem;
|
||||
}
|
||||
|
||||
.tool-channel-mini {
|
||||
border: 1px solid #dee6f5;
|
||||
border-radius: 10px;
|
||||
background: #f8faff;
|
||||
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 #dce4f3;
|
||||
border-radius: 10px;
|
||||
min-height: 94px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-decoration: none;
|
||||
font-family: "Outfit", "Noto Sans SC", sans-serif;
|
||||
font-size: 1.8rem;
|
||||
font-weight: 800;
|
||||
color: #273a63;
|
||||
}
|
||||
|
||||
.tool-channel-card.news { background: #dce8ff; }
|
||||
.tool-channel-card.community { background: #dff3da; }
|
||||
.tool-channel-card.project { background: #ede0fa; }
|
||||
.tool-channel-card.tutorial { background: #d8f0ff; }
|
||||
.tool-channel-card.ad { background: #f4f6ff; }
|
||||
|
||||
.tool-banner-row {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: .52rem;
|
||||
}
|
||||
|
||||
.tool-banner {
|
||||
border: 1px solid #d8e1f1;
|
||||
border-radius: 10px;
|
||||
background: linear-gradient(90deg, #e8f3ff, #e4f7ef);
|
||||
min-height: 66px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: .52rem;
|
||||
padding: .58rem .72rem;
|
||||
}
|
||||
|
||||
.tool-banner.alt {
|
||||
background: linear-gradient(90deg, #e6f6ff, #dff8dd);
|
||||
}
|
||||
|
||||
.tool-banner b {
|
||||
color: #1d3058;
|
||||
font-size: 1.06rem;
|
||||
font-family: "Outfit", "Noto Sans SC", sans-serif;
|
||||
}
|
||||
|
||||
.tool-banner small {
|
||||
border: 1px solid #d6def0;
|
||||
border-radius: 999px;
|
||||
background: #fff;
|
||||
color: #5f749a;
|
||||
font-size: .72rem;
|
||||
padding: .14rem .48rem;
|
||||
}
|
||||
|
||||
.tool-section {
|
||||
border: 1px solid #d8e1f1;
|
||||
border-radius: 12px;
|
||||
background: #fff;
|
||||
box-shadow: 0 8px 18px rgba(40, 63, 120, .08);
|
||||
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: #20335d;
|
||||
font-size: 1rem;
|
||||
font-family: "Outfit", "Noto Sans SC", sans-serif;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.tool-section-head a {
|
||||
color: #4d63a4;
|
||||
text-decoration: none;
|
||||
font-size: .76rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.tool-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(6, minmax(0, 1fr));
|
||||
gap: .52rem;
|
||||
}
|
||||
|
||||
.tool-card {
|
||||
border: 1px solid #dbe3f2;
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
padding: .52rem .56rem;
|
||||
text-decoration: none;
|
||||
color: #1f3157;
|
||||
transition: .16s ease;
|
||||
min-height: 88px;
|
||||
display: grid;
|
||||
align-content: start;
|
||||
gap: .25rem;
|
||||
}
|
||||
|
||||
.tool-card:hover {
|
||||
border-color: #cdd9f0;
|
||||
box-shadow: 0 12px 24px rgba(45, 66, 122, .12);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.tool-card-name {
|
||||
font-size: .85rem;
|
||||
font-weight: 700;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.tool-card-meta {
|
||||
font-size: .72rem;
|
||||
color: #7084a8;
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
.tool-card-tag {
|
||||
display: inline-flex;
|
||||
border: 1px solid #d6def0;
|
||||
border-radius: 999px;
|
||||
background: #f6f8ff;
|
||||
color: #4f639b;
|
||||
font-size: .68rem;
|
||||
padding: .06rem .4rem;
|
||||
}
|
||||
|
||||
.tool-mobile-cats {
|
||||
display: none;
|
||||
gap: .28rem;
|
||||
flex-wrap: wrap;
|
||||
border: 1px solid #d8e1f1;
|
||||
border-radius: 12px;
|
||||
background: #fff;
|
||||
box-shadow: 0 8px 18px rgba(40, 63, 120, .08);
|
||||
padding: .42rem;
|
||||
}
|
||||
|
||||
.tool-mobile-cats .tool-side-link {
|
||||
flex: 1 1 160px;
|
||||
min-width: 144px;
|
||||
}
|
||||
|
||||
@media (max-width: 1399.98px) {
|
||||
.tool-grid {
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 991.98px) {
|
||||
.tool-home {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.tool-side {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.tool-mobile-cats {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.tool-top {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.tool-channel {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.tool-channel-mini {
|
||||
grid-column: 1 / -1;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: .22rem;
|
||||
}
|
||||
|
||||
.tool-grid {
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.tool-banner-row {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.tool-kpis {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 575.98px) {
|
||||
.tool-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.tool-kpis {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.tool-search {
|
||||
grid-template-columns: 1fr;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.tool-search button {
|
||||
width: 100%;
|
||||
border-radius: 10px;
|
||||
}
|
||||
@media (max-width: 767px) {
|
||||
.tool-kpis { 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: 1fr; }
|
||||
.tool-banner-row { grid-template-columns: 1fr; }
|
||||
}
|
||||
</style>
|
||||
@endsection
|
||||
@@ -475,27 +75,35 @@
|
||||
@section('content')
|
||||
@php
|
||||
$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;
|
||||
$bannerModule = $modules['promo_banners'] ?? null;
|
||||
$hotModule = $modules['hot_tools'] ?? null;
|
||||
$latestModule = $modules['latest_tools'] ?? null;
|
||||
$categoryModule = $modules['category_sections'] ?? null;
|
||||
$moduleOrder = collect($modules)->sortBy('sort_order')->pluck('module_key')->values();
|
||||
@endphp
|
||||
|
||||
<div class="tool-home">
|
||||
<aside class="tool-side" aria-label="工具分类侧边栏">
|
||||
<div class="tool-side-logo"><span class="tool-side-logo-dot">AI</span>AI工具集</div>
|
||||
<div class="tool-side-logo"><span class="tool-side-logo-dot">AI</span>{{ data_get($categoryModule, 'extra.side_title', 'AI工具集') }}</div>
|
||||
<nav class="tool-side-links">
|
||||
@if(($modules['hot_tools']['enabled'] ?? true) === true)
|
||||
@if(data_get($hotModule, 'enabled', true) === true)
|
||||
<a class="tool-side-link" href="#section-hot">
|
||||
<i class="bi bi-fire"></i>
|
||||
<span>热门工具</span>
|
||||
<span>{{ data_get($hotModule, 'title', '热门工具') }}</span>
|
||||
<small>{{ $hotTools->count() }}</small>
|
||||
</a>
|
||||
@endif
|
||||
@if(($modules['latest_tools']['enabled'] ?? true) === true)
|
||||
|
||||
@if(data_get($latestModule, 'enabled', true) === true)
|
||||
<a class="tool-side-link" href="#section-latest">
|
||||
<i class="bi bi-clock-history"></i>
|
||||
<span>最新收录</span>
|
||||
<span>{{ data_get($latestModule, 'title', '最新收录') }}</span>
|
||||
<small>{{ $latestTools->count() }}</small>
|
||||
</a>
|
||||
@endif
|
||||
@if(($modules['category_sections']['enabled'] ?? true) === true)
|
||||
|
||||
@if(data_get($categoryModule, 'enabled', true) === true)
|
||||
@foreach($categorySections as $index => $section)
|
||||
<a class="tool-side-link" href="#section-{{ $section['slug'] }}">
|
||||
<i class="bi {{ $icons[$index % count($icons)] }}"></i>
|
||||
@@ -510,32 +118,14 @@
|
||||
<section class="tool-main">
|
||||
<x-portal.top-nav active="tools" status-label="收录工具" :status-value="$toolStats['total'] ?? 0" wrapper-class="tool-top" />
|
||||
|
||||
<nav class="tool-mobile-cats" aria-label="移动分类导航">
|
||||
@if(($modules['hot_tools']['enabled'] ?? true) === true)
|
||||
<a class="tool-side-link" href="#section-hot"><i class="bi bi-fire"></i><span>热门</span><small>{{ $hotTools->count() }}</small></a>
|
||||
@endif
|
||||
@if(($modules['latest_tools']['enabled'] ?? true) === true)
|
||||
<a class="tool-side-link" href="#section-latest"><i class="bi bi-clock-history"></i><span>最新</span><small>{{ $latestTools->count() }}</small></a>
|
||||
@endif
|
||||
@if(($modules['category_sections']['enabled'] ?? true) === true)
|
||||
@foreach($categorySections as $index => $section)
|
||||
<a class="tool-side-link" href="#section-{{ $section['slug'] }}">
|
||||
<i class="bi {{ $icons[$index % count($icons)] }}"></i>
|
||||
<span>{{ $section['name'] }}</span>
|
||||
<small>{{ $section['count'] }}</small>
|
||||
</a>
|
||||
@endforeach
|
||||
@endif
|
||||
</nav>
|
||||
|
||||
<section class="tool-hero">
|
||||
<span class="tool-chip">AI-BOT.CN</span>
|
||||
<h1 class="tool-title">AI工具集</h1>
|
||||
<p class="tool-sub">左侧菜单点击后直接定位到对应工具区块,符合你要的交互方式。</p>
|
||||
<h1 class="tool-title">{{ data_get($hotModule, 'extra.side_title', 'AI工具集') }}</h1>
|
||||
<p class="tool-sub">{{ data_get($hotModule, 'subtitle', '左侧菜单点击后可直接定位到对应工具区块。') }}</p>
|
||||
|
||||
<form class="tool-search" method="get" action="{{ route('tools.list') }}" role="search" aria-label="站内 AI 工具搜索">
|
||||
<input type="hidden" name="tab" value="{{ $activeTab }}">
|
||||
<input type="search" name="q" value="{{ $filters['q'] ?? '' }}" placeholder="站内AI工具搜索,如:写作、图像、办公自动化" autocomplete="off" spellcheck="false">
|
||||
<input type="search" name="q" value="{{ $filters['q'] ?? '' }}" placeholder="站内 AI 工具搜索,如:写作、图像、自动化" autocomplete="off" spellcheck="false">
|
||||
<button class="btn btn-primary" type="submit"><i class="bi bi-search"></i> 搜索</button>
|
||||
</form>
|
||||
|
||||
@@ -557,74 +147,82 @@
|
||||
/>
|
||||
</section>
|
||||
|
||||
@if(($modules['channel_cards']['enabled'] ?? true) === true)
|
||||
<section class="tool-channel" aria-label="频道入口">
|
||||
<aside class="tool-channel-mini">
|
||||
<a href="{{ route('news.index') }}"><i class="bi bi-newspaper"></i>AI资讯</a>
|
||||
<a href="{{ route('models.index') }}"><i class="bi bi-box"></i>AI项目</a>
|
||||
<a href="{{ route('guides.index') }}"><i class="bi bi-journal"></i>AI百科</a>
|
||||
<a href="{{ route('home') }}"><i class="bi bi-house"></i>首页</a>
|
||||
</aside>
|
||||
<a class="tool-channel-card news" href="{{ route('news.index') }}">每日快讯</a>
|
||||
<a class="tool-channel-card community" href="{{ route('guides.index') }}">免费社群</a>
|
||||
<a class="tool-channel-card project" href="{{ route('models.index') }}">最新项目</a>
|
||||
<a class="tool-channel-card tutorial" href="{{ route('guides.index') }}">热门教程</a>
|
||||
<a class="tool-channel-card ad" href="{{ route('tools.list') }}">工具列表</a>
|
||||
</section>
|
||||
@endif
|
||||
@foreach($moduleOrder as $moduleKey)
|
||||
@if($moduleKey === 'channel_cards' && data_get($channelModule, 'enabled', true) === true)
|
||||
@php
|
||||
$channelItems = collect(data_get($channelModule, 'items', []))->take((int) data_get($channelModule, 'limit', 5));
|
||||
$miniItems = $channelItems->take(4);
|
||||
@endphp
|
||||
<section class="tool-channel" aria-label="频道入口">
|
||||
<aside class="tool-channel-mini">
|
||||
@foreach($miniItems as $item)
|
||||
<a href="{{ $item['url'] ?: 'javascript:void(0)' }}">{{ $item['title'] ?: '频道' }}</a>
|
||||
@endforeach
|
||||
</aside>
|
||||
|
||||
@if(($modules['promo_banners']['enabled'] ?? true) === true)
|
||||
<section class="tool-banner-row" aria-label="横幅推荐">
|
||||
<article class="tool-banner">
|
||||
<b>超全图片视频模板一键复制</b>
|
||||
<small>全球顶尖模型</small>
|
||||
</article>
|
||||
<article class="tool-banner alt">
|
||||
<b>一站式 AI 创作平台</b>
|
||||
<small>免费试用</small>
|
||||
</article>
|
||||
</section>
|
||||
@endif
|
||||
@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
|
||||
</section>
|
||||
@endif
|
||||
|
||||
@if(($modules['hot_tools']['enabled'] ?? true) === true)
|
||||
<section id="section-hot" class="tool-section" aria-label="热门工具">
|
||||
<header class="tool-section-head">
|
||||
<h2><i class="bi bi-fire text-danger"></i> 热门工具</h2>
|
||||
<a href="{{ route('tools.list', ['tab' => 'recommended']) }}">查看更多</a>
|
||||
</header>
|
||||
<x-portal.tool-grid :tools="$hotTools" />
|
||||
</section>
|
||||
@endif
|
||||
@if($moduleKey === 'promo_banners' && data_get($bannerModule, 'enabled', true) === true)
|
||||
@php($bannerItems = collect(data_get($bannerModule, 'items', []))->take((int) data_get($bannerModule, 'limit', 2)))
|
||||
<section class="tool-banner-row" aria-label="横幅推荐">
|
||||
@forelse($bannerItems as $banner)
|
||||
<a class="tool-banner @if($loop->index % 2 === 1) alt @endif" href="{{ $banner['url'] ?: 'javascript:void(0)' }}" @if(!empty($banner['image_path'])) style="background-image:url('{{ $banner['image_path'] }}'); background-size:cover;" @endif>
|
||||
<b>{{ $banner['title'] ?: '精选推荐' }}</b>
|
||||
<small>{{ $banner['subtitle'] ?: '查看详情' }}</small>
|
||||
</a>
|
||||
@empty
|
||||
<article class="tool-banner"><b>暂无横幅推荐</b><small>请在后台配置</small></article>
|
||||
@endforelse
|
||||
</section>
|
||||
@endif
|
||||
|
||||
@if(($modules['latest_tools']['enabled'] ?? true) === true)
|
||||
<section id="section-latest" class="tool-section" aria-label="最新收录">
|
||||
<header class="tool-section-head">
|
||||
<h2><i class="bi bi-clock-history text-primary"></i> 最新收录</h2>
|
||||
<a href="{{ route('tools.list', ['tab' => 'latest']) }}">查看更多</a>
|
||||
</header>
|
||||
<x-portal.tool-grid :tools="$latestTools" />
|
||||
</section>
|
||||
@endif
|
||||
@if($moduleKey === 'hot_tools' && data_get($hotModule, 'enabled', true) === true)
|
||||
<section id="section-hot" class="tool-section" aria-label="热门工具">
|
||||
<header class="tool-section-head">
|
||||
<h2><i class="bi bi-fire text-danger"></i> {{ data_get($hotModule, 'title', '热门工具') }}</h2>
|
||||
@php($hotMore = data_get($hotModule, 'more_url') ?: route('tools.list', ['tab' => 'recommended']))
|
||||
<a href="{{ $hotMore }}">查看更多</a>
|
||||
</header>
|
||||
<x-portal.tool-grid :tools="$hotTools" />
|
||||
</section>
|
||||
@endif
|
||||
|
||||
@if(($modules['category_sections']['enabled'] ?? true) === true)
|
||||
@foreach($categorySections as $section)
|
||||
<section id="section-{{ $section['slug'] }}" class="tool-section" aria-label="{{ $section['name'] }}工具">
|
||||
<header class="tool-section-head">
|
||||
<h2><i class="bi bi-grid-3x3-gap text-primary"></i> {{ $section['name'] }}</h2>
|
||||
<a href="{{ route('tools.list', ['category' => $section['slug']]) }}">查看更多</a>
|
||||
</header>
|
||||
@if($moduleKey === 'latest_tools' && data_get($latestModule, 'enabled', true) === true)
|
||||
<section id="section-latest" class="tool-section" aria-label="最新收录">
|
||||
<header class="tool-section-head">
|
||||
<h2><i class="bi bi-clock-history text-primary"></i> {{ data_get($latestModule, 'title', '最新收录') }}</h2>
|
||||
@php($latestMore = data_get($latestModule, 'more_url') ?: route('tools.list', ['tab' => 'latest']))
|
||||
<a href="{{ $latestMore }}">查看更多</a>
|
||||
</header>
|
||||
<x-portal.tool-grid :tools="$latestTools" />
|
||||
</section>
|
||||
@endif
|
||||
|
||||
@if($section['tools']->isNotEmpty())
|
||||
<x-portal.tool-grid :tools="$section['tools']" />
|
||||
@else
|
||||
<p class="text-muted-soft mb-0">该分类暂未收录工具</p>
|
||||
@endif
|
||||
</section>
|
||||
@if($moduleKey === 'category_sections' && data_get($categoryModule, 'enabled', true) === true)
|
||||
@foreach($categorySections as $section)
|
||||
<section id="section-{{ $section['slug'] }}" class="tool-section" aria-label="{{ $section['name'] }}工具">
|
||||
<header class="tool-section-head">
|
||||
<h2><i class="bi bi-grid-3x3-gap text-primary"></i> {{ $section['name'] }}</h2>
|
||||
<a href="{{ route('tools.list', ['category' => $section['slug']]) }}">查看更多</a>
|
||||
</header>
|
||||
|
||||
@if($section['tools']->isNotEmpty())
|
||||
<x-portal.tool-grid :tools="$section['tools']" />
|
||||
@else
|
||||
<p class="text-muted-soft mb-0">该分类暂未收录工具</p>
|
||||
@endif
|
||||
</section>
|
||||
@endforeach
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
</section>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
@section('scripts')
|
||||
@@ -637,16 +235,6 @@
|
||||
return;
|
||||
}
|
||||
|
||||
const linksById = new Map();
|
||||
links.forEach((link) => {
|
||||
const id = link.getAttribute('href')?.replace('#', '');
|
||||
if (id) {
|
||||
const group = linksById.get(id) || [];
|
||||
group.push(link);
|
||||
linksById.set(id, group);
|
||||
}
|
||||
});
|
||||
|
||||
const setActive = (activeId) => {
|
||||
links.forEach((link) => {
|
||||
const id = link.getAttribute('href')?.replace('#', '') || '';
|
||||
|
||||
Reference in New Issue
Block a user