初始化

This commit is contained in:
2026-08-08 18:27:38 +08:00
parent efc150c937
commit 060eb79c09
336 changed files with 24613 additions and 15 deletions
@@ -0,0 +1,65 @@
@extends('admin.layout')
@php
$isEdit = isset($slide) && $slide;
@endphp
@section('title', $isEdit ? '编辑轮播项' : '新建轮播项')
@section('page-title', $isEdit ? '编辑轮播项' : '新建轮播项')
@section('actions')
<a href="{{ route('admin.hero-slides.index') }}" class="btn btn-sm">返回列表</a>
@endsection
@section('content')
<form method="POST" action="{{ $isEdit ? route('admin.hero-slides.update', $slide) : route('admin.hero-slides.store') }}">
@csrf
@if ($isEdit) @method('PUT') @endif
<div class="field">
<label>标题(后台标识 / 无障碍标题)*</label>
<input name="title" class="input" value="{{ old('title', $slide->title ?? '') }}" maxlength="120" required>
<p class="form-hint">仅用于后台识别与该区块的无障碍标题,不会作为大字标题显示(大字标题请在下方正文内排版)。</p>
</div>
<div class="field">
<label>Hero 正文(富文本)</label>
<x-rich-editor name="content" :value="old('content', $slide->content ?? '')" />
<p class="form-hint">使用富文本编辑主标题、副标题与说明文字;支持加粗、列表、引用、插入图片等。</p>
</div>
<div class="field">
<label>主按钮文字</label>
<input name="cta_text" class="input" value="{{ old('cta_text', $slide->cta_text ?? '') }}" maxlength="80" placeholder="例如:获取选型支持">
</div>
<div class="field">
<label>主按钮链接</label>
<input name="cta_url" class="input" value="{{ old('cta_url', $slide->cta_url ?? '') }}" maxlength="255" placeholder="/contact">
</div>
<div class="field">
<label>次按钮文字</label>
<input name="cta2_text" class="input" value="{{ old('cta2_text', $slide->cta2_text ?? '') }}" maxlength="80" placeholder="例如:浏览全部产品">
</div>
<div class="field">
<label>次按钮链接</label>
<input name="cta2_url" class="input" value="{{ old('cta2_url', $slide->cta2_url ?? '') }}" maxlength="255" placeholder="/products">
</div>
<div class="field">
<label>排序</label>
<input name="sort_order" type="number" class="input" value="{{ old('sort_order', $slide->sort_order ?? 0) }}" style="max-width:160px">
</div>
<div class="field">
<label class="inline-flex items-center gap-2">
<input type="checkbox" name="is_active" value="1" {{ old('is_active', $slide->is_active ?? true) ? 'checked' : '' }}>
启用该项
</label>
</div>
<div class="form-actions">
<button class="btn btn-primary">保存</button>
<a href="{{ route('admin.hero-slides.index') }}" class="btn">取消</a>
</div>
</form>
@endsection
@@ -0,0 +1,70 @@
@extends('admin.layout')
@section('title', '首页 Hero 轮播')
@section('page-title', '首页 Hero 轮播')
@section('actions')
<a href="{{ route('admin.hero-slides.create') }}" class="btn btn-primary btn-sm"><x-icon name="plus" :size="16"/> 新建轮播项</a>
@endsection
@section('content')
<div class="panel" style="margin-bottom:20px;padding:16px 18px;border:1px solid var(--color-border);border-radius:var(--radius-lg);background:var(--color-surface-2)">
<div class="flex items-center justify-between flex-wrap gap-3">
<div>
<div class="font-semibold text-fg">Hero 显示模式</div>
<div class="form-hint">轮播:启用项自动切换播放;独立单图:仅展示第一条启用项(不轮播)。</div>
</div>
<form method="POST" action="{{ route('admin.hero.mode') }}" class="flex gap-2">
@csrf
<button type="submit" name="hero_mode" value="carousel" class="btn btn-sm {{ $mode === 'carousel' ? 'btn-primary' : '' }}">轮播</button>
<button type="submit" name="hero_mode" value="single" class="btn btn-sm {{ $mode === 'single' ? 'btn-primary' : '' }}">独立单图</button>
</form>
</div>
</div>
<table class="data-table">
<thead>
<tr>
<th style="width:90px">排序</th>
<th style="width:90px">启用</th>
<th>标题(后台标识)</th>
<th class="col-op">操作</th>
</tr>
</thead>
<tbody>
@forelse ($slides as $slide)
<tr>
<td class="row-actions">
<form method="POST" action="{{ route('admin.hero-slides.move', $slide) }}" class="inline">
@csrf
<input type="hidden" name="direction" value="up">
<button class="btn btn-sm" title="上移" {{ $loop->first ? 'disabled' : '' }}><x-icon name="up" :size="16"/></button>
</form>
<form method="POST" action="{{ route('admin.hero-slides.move', $slide) }}" class="inline">
@csrf
<input type="hidden" name="direction" value="down">
<button class="btn btn-sm" title="下移" {{ $loop->last ? 'disabled' : '' }}><x-icon name="down" :size="16"/></button>
</form>
</td>
<td>
<form method="POST" action="{{ route('admin.hero-slides.toggle', $slide) }}" class="inline">
@csrf
<button class="btn btn-sm {{ $slide->is_active ? 'btn-primary' : '' }}" title="{{ $slide->is_active ? '点击停用' : '点击启用' }}">
{{ $slide->is_active ? '启用中' : '已停用' }}
</button>
</form>
</td>
<td>{{ $slide->title }}</td>
<td class="row-actions">
<a href="{{ route('admin.hero-slides.edit', $slide) }}" class="btn btn-sm"><x-icon name="edit" :size="16"/></a>
<form method="POST" action="{{ route('admin.hero-slides.destroy', $slide) }}" class="inline" onsubmit="return confirm('确认删除该轮播项?')">
@csrf @method('DELETE')
<button class="btn btn-sm btn-danger"><x-icon name="trash" :size="16"/></button>
</form>
</td>
</tr>
@empty
<tr><td colspan="4" class="muted">暂无轮播项,请点击右上角「新建轮播项」。</td></tr>
@endforelse
</tbody>
</table>
@endsection