优化功能
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:
jiangdong.cheng
2026-02-12 17:10:36 +08:00
parent 56c685b579
commit a795b2c896
29 changed files with 2155 additions and 884 deletions

View File

@@ -0,0 +1,97 @@
@extends('layouts.admin')
@section('title', '编辑条目 - '.$module->name)
@section('head')
@include('admin.partials.modern-form-head')
@endsection
@section('page_subtitle', '独立编辑模块条目,保存后返回模块列表。')
@section('page_actions')
<a class="btn btn-outline-secondary" href="{{ route('admin.settings.show', $module) }}">返回模块配置</a>
@endsection
@section('content')
<div class="card modern-index-toolbar mb-3">
<div class="card-body d-flex flex-wrap gap-2">
@foreach($moduleNav as $navItem)
<a
class="btn btn-sm {{ $navItem->id === $module->id ? 'btn-primary' : 'btn-outline-primary' }}"
href="{{ route('admin.settings.show', $navItem) }}"
>
{{ $navItem->name }}
</a>
@endforeach
</div>
</div>
<div class="card modern-form-card">
<div class="card-header">
<h3 class="card-title mb-0">编辑条目</h3>
</div>
<div class="card-body">
<form method="post" action="{{ route('admin.settings.items.update', ['module' => $module, 'item' => $item]) }}" class="row g-3">
@csrf
@method('put')
<div class="col-md-4">
<label class="form-label">标题</label>
<input type="text" class="form-control" name="title" value="{{ old('title', $item->title) }}">
</div>
<div class="col-md-4">
<label class="form-label">副标题</label>
<input type="text" class="form-control" name="subtitle" value="{{ old('subtitle', $item->subtitle) }}">
</div>
<div class="col-md-2">
<label class="form-label">排序</label>
<input type="number" min="0" max="9999" class="form-control" name="sort_order" value="{{ old('sort_order', $item->sort_order) }}">
</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(old('enabled', $item->enabled))>
<span class="form-check-label">启用</span>
</label>
</div>
<div class="col-md-6">
<label class="form-label">图片路径(/storage/...</label>
<div class="input-group">
<input type="text" class="form-control" name="image_path" id="item-image-{{ $item->id }}" value="{{ old('image_path', $item->image_path) }}" placeholder="/storage/markdown-images/...">
<button class="btn btn-outline-primary js-md-upload-btn" type="button" data-target="#item-image-{{ $item->id }}">上传</button>
</div>
</div>
<div class="col-md-3">
<label class="form-label">链接类型</label>
<select class="form-select" name="link_type">
<option value="route" @selected(old('link_type', $item->link_type) === 'route')>内部路由</option>
<option value="url" @selected(old('link_type', $item->link_type) === 'url')>自定义 URL</option>
</select>
</div>
<div class="col-md-3">
<label class="form-label">链接目标</label>
<input type="text" class="form-control" name="link_target" value="{{ old('link_target', $item->link_target) }}" placeholder="如 tools.list 或 https://example.com" list="module-route-options">
</div>
@if(!empty($item->image_path))
<div class="col-md-6">
<img src="{{ $item->image_path }}" alt="item image" style="width: 100%; max-height: 220px; object-fit: cover; border-radius: .6rem; border: 1px solid #dbe5f4;">
</div>
@endif
<div class="col-12">
<div class="editor-sticky-actions">
<small class="text-muted">若为频道卡片/横幅,标题、图片、链接需同时填写。</small>
<button class="btn btn-primary" type="submit">保存条目</button>
</div>
</div>
</form>
</div>
</div>
<datalist id="module-route-options">
@foreach($routeOptions as $option)
<option value="{{ $option['value'] }}">{{ $option['name'] }}</option>
@endforeach
</datalist>
@endsection