初始化

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,47 @@
@extends('admin.layout')
@php
$isEdit = isset($menu) && $menu;
@endphp
@section('title', $isEdit ? '编辑菜单' : '新建菜单')
@section('page-title', $isEdit ? '编辑菜单' : '新建菜单')
@section('actions')
<a href="{{ route('admin.menus.index') }}" class="btn btn-sm">返回列表</a>
@endsection
@section('content')
<form method="POST" action="{{ $isEdit ? route('admin.menus.update', $menu) : route('admin.menus.store') }}">
@csrf
@if ($isEdit) @method('PUT') @endif
<div class="field">
<label>菜单文字 *</label>
<input name="label" class="input" value="{{ old('label', $menu->label ?? '') }}" placeholder="例如:产品服务" maxlength="60" required>
</div>
<div class="field">
<label>链接地址 *</label>
<input name="url" class="input" value="{{ old('url', $menu->url ?? '') }}" placeholder="站内路径如 /products 或完整外链 https://..." maxlength="255" required>
<p class="form-hint">站内页面填写相对路径(以 / 开头),外链填写完整 https:// 地址。</p>
</div>
<div class="field">
<label>排序</label>
<input name="sort_order" type="number" class="input" value="{{ old('sort_order', $menu->sort_order ?? 0) }}" style="max-width:160px">
<p class="form-hint">数字越小越靠前,相同则按添加先后排列。</p>
</div>
<div class="field">
<label class="inline-flex items-center gap-2">
<input type="checkbox" name="is_visible" value="1" {{ old('is_visible', $menu->is_visible ?? true) ? 'checked' : '' }}>
在前台显示
</label>
</div>
<div class="form-actions">
<button class="btn btn-primary">保存</button>
<a href="{{ route('admin.menus.index') }}" class="btn">取消</a>
</div>
</form>
@endsection
@@ -0,0 +1,60 @@
@extends('admin.layout')
@section('title', '导航菜单管理')
@section('page-title', '导航菜单管理')
@section('actions')
<a href="{{ route('admin.menus.create') }}" class="btn btn-primary btn-sm"><x-icon name="plus" :size="16"/> 新建菜单</a>
@endsection
@section('content')
<p class="form-hint mb-4">管理前台顶部导航菜单:可新增、编辑、删除,一键显示/隐藏,并通过上下移调整顺序。排序越小越靠前。</p>
<table class="data-table">
<thead>
<tr>
<th style="width:90px">排序</th>
<th style="width:90px">显示</th>
<th>菜单文字</th>
<th>链接</th>
<th class="col-op">操作</th>
</tr>
</thead>
<tbody>
@forelse ($menus as $menu)
<tr>
<td class="row-actions">
<form method="POST" action="{{ route('admin.menus.move', $menu) }}" 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.menus.move', $menu) }}" 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.menus.toggle', $menu) }}" class="inline">
@csrf
<button class="btn btn-sm {{ $menu->is_visible ? 'btn-primary' : '' }}" title="{{ $menu->is_visible ? '点击隐藏' : '点击显示' }}">
{{ $menu->is_visible ? '显示中' : '已隐藏' }}
</button>
</form>
</td>
<td>{{ $menu->label }}</td>
<td><code class="muted">{{ $menu->url }}</code></td>
<td class="row-actions">
<a href="{{ route('admin.menus.edit', $menu) }}" class="btn btn-sm"><x-icon name="edit" :size="16"/></a>
<form method="POST" action="{{ route('admin.menus.destroy', $menu) }}" 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="5" class="muted">暂无菜单项,请点击右上角「新建菜单」。</td></tr>
@endforelse
</tbody>
</table>
@endsection