04a2034975
- storefront 全站改为极简黑白配色:直角、细线分隔、卡片 hover 浅底、深色模式(跟随系统+手动切换) - 抽出 storefront/partials/card 复用卡片 - 一并提交此前暂存的客户端注册 API、站点设置、后台页面与测试 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
235 lines
12 KiB
PHP
235 lines
12 KiB
PHP
@php
|
|
$statusLabels = [
|
|
'draft' => '草稿',
|
|
'published' => '发布中',
|
|
'hidden' => '隐藏',
|
|
'deprecated' => '弃用',
|
|
];
|
|
$statusTones = [
|
|
'draft' => 'muted',
|
|
'published' => 'ok',
|
|
'hidden' => 'warn',
|
|
'deprecated' => 'warn',
|
|
];
|
|
$currentType = $filters['type'] ?? '';
|
|
$entityLabel = $currentType === 'plugin' ? '插件' : ($currentType === 'theme' ? '主题' : '扩展');
|
|
$entityPluralLabel = $currentType === 'plugin' ? '插件列表' : ($currentType === 'theme' ? '主题列表' : '扩展列表');
|
|
$newEntityLabel = '新建' . $entityLabel;
|
|
$currentStatusLabel = $filters['status'] !== '' ? ($statusLabels[$filters['status']] ?? $filters['status']) : '全部状态';
|
|
@endphp
|
|
|
|
@extends('admin.layout', [
|
|
'title' => 'Tstore Admin · 扩展管理',
|
|
'pageTitle' => $entityPluralLabel,
|
|
'pageSubtitle' => '统一维护扩展元数据、分类关联、发布状态与版本入口。',
|
|
'pageBadge' => 'Packages',
|
|
])
|
|
|
|
@section('content')
|
|
<div class="grid">
|
|
<section class="stats">
|
|
<div class="stat"><span class="label">当前结果</span><span class="value">{{ $packages->total() }}</span><span class="hint">符合筛选条件的{{ $entityLabel }}</span></div>
|
|
<div class="stat"><span class="label">当前类型</span><span class="value">{{ $currentType === '' ? '全部' : strtoupper($currentType) }}</span><span class="hint">{{ $entityLabel }}视角</span></div>
|
|
<div class="stat"><span class="label">当前状态</span><span class="value">{{ $currentStatusLabel }}</span><span class="hint">已应用状态筛选</span></div>
|
|
<div class="stat"><span class="label">页码</span><span class="value">{{ $packages->currentPage() }}/{{ max($packages->lastPage(), 1) }}</span><span class="hint">分页浏览</span></div>
|
|
</section>
|
|
|
|
<section class="panel">
|
|
<div class="section-title">
|
|
<div>
|
|
<h2>筛选与查询</h2>
|
|
<p>先缩小范围,再进入详情页处理版本发布或资料修改。</p>
|
|
</div>
|
|
</div>
|
|
|
|
<form method="get" class="toolbar">
|
|
<div class="filters">
|
|
<div class="field">
|
|
<label>类型</label>
|
|
<select name="type" class="select">
|
|
<option value="">全部</option>
|
|
<option value="plugin" @selected($filters['type'] === 'plugin')>插件</option>
|
|
<option value="theme" @selected($filters['type'] === 'theme')>主题</option>
|
|
</select>
|
|
</div>
|
|
<div class="field">
|
|
<label>状态</label>
|
|
<select name="status" class="select">
|
|
<option value="">全部</option>
|
|
@foreach ($statusLabels as $status => $label)
|
|
<option value="{{ $status }}" @selected($filters['status'] === $status)>{{ $label }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
<div class="field" style="flex:1 1 280px">
|
|
<label>关键词</label>
|
|
<input class="input" type="text" name="keyword" value="{{ $filters['keyword'] }}" placeholder="搜索名称、slug 或摘要">
|
|
</div>
|
|
</div>
|
|
<div class="form-actions">
|
|
<button class="btn" type="submit">应用筛选</button>
|
|
<a class="btn secondary" href="{{ route('webadmin.packages') }}">重置</a>
|
|
</div>
|
|
</form>
|
|
</section>
|
|
|
|
<div class="stack">
|
|
<section class="panel">
|
|
<div class="section-title">
|
|
<div>
|
|
<h2>{{ $entityPluralLabel }}</h2>
|
|
<p>保持列表信息密度,重点展示状态、当前版本、分类和最近更新时间。</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="table-wrap">
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>{{ $entityLabel }}</th>
|
|
<th>类型</th>
|
|
<th>状态</th>
|
|
<th>最新版本</th>
|
|
<th>分类</th>
|
|
<th>更新时间</th>
|
|
<th>操作</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@forelse ($packages as $package)
|
|
<tr>
|
|
<td>
|
|
<strong>{{ $package->name }}</strong>
|
|
<div class="muted">{{ $package->slug }}</div>
|
|
<div class="muted">{{ $package->summary ?: '暂无摘要。' }}</div>
|
|
</td>
|
|
<td>{{ strtoupper($package->type) }}</td>
|
|
<td><span class="chip {{ $statusTones[$package->status] ?? 'muted' }}">{{ $statusLabels[$package->status] ?? $package->status }}</span></td>
|
|
<td>{{ $package->latestStableVersion?->version ?: ($package->latest_version ?: '-') }}</td>
|
|
<td>
|
|
<div class="tags">
|
|
@forelse ($package->categories as $category)
|
|
<span class="chip">{{ $category->name }}</span>
|
|
@empty
|
|
<span class="muted">未分类</span>
|
|
@endforelse
|
|
</div>
|
|
</td>
|
|
<td>{{ optional($package->updated_at)->format('Y-m-d H:i') ?: '-' }}</td>
|
|
<td>
|
|
<div class="form-actions">
|
|
<a class="btn ghost small" href="{{ route('webadmin.packages.show', [$package->type, $package->slug]) }}">详情</a>
|
|
<form method="post" action="{{ route('webadmin.packages.status', [$package->type, $package->slug]) }}">
|
|
@csrf
|
|
@method('PATCH')
|
|
<input type="hidden" name="status" value="{{ $package->status === 'published' ? 'hidden' : 'published' }}">
|
|
<button class="btn secondary small" type="submit">{{ $package->status === 'published' ? '隐藏' : '发布' }}</button>
|
|
</form>
|
|
<form method="post" action="{{ route('webadmin.packages.destroy', [$package->type, $package->slug]) }}" onsubmit="return confirm('确认删除这个{{ $entityLabel }}吗?版本、截图和分类关联都会一起删除。');">
|
|
@csrf
|
|
@method('DELETE')
|
|
<button class="btn danger small" type="submit">删除</button>
|
|
</form>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="7">
|
|
<div class="empty">当前还没有{{ $entityLabel }}。</div>
|
|
</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
{{ $packages->links() }}
|
|
</section>
|
|
|
|
<section class="panel soft">
|
|
<div class="section-title">
|
|
<div>
|
|
<h2>{{ $newEntityLabel }}</h2>
|
|
<p>先创建扩展,再进入详情页继续补充版本、截图和发布信息。</p>
|
|
</div>
|
|
</div>
|
|
|
|
<form method="post" action="{{ route('webadmin.packages.store') }}" class="grid">
|
|
@csrf
|
|
|
|
<div class="form-grid">
|
|
<div class="field">
|
|
<label>类型</label>
|
|
<select class="select" name="type" required>
|
|
<option value="plugin" @selected(old('type', $currentType ?: 'plugin') === 'plugin')>插件</option>
|
|
<option value="theme" @selected(old('type', $currentType) === 'theme')>主题</option>
|
|
</select>
|
|
</div>
|
|
<div class="field">
|
|
<label>Slug</label>
|
|
<input class="input" name="slug" value="{{ old('slug') }}" placeholder="HelloStore" required>
|
|
</div>
|
|
<div class="field">
|
|
<label>名称</label>
|
|
<input class="input" name="name" value="{{ old('name') }}" placeholder="Hello Store" required>
|
|
</div>
|
|
<div class="field">
|
|
<label>状态</label>
|
|
<select class="select" name="status">
|
|
@foreach ($statusLabels as $status => $label)
|
|
<option value="{{ $status }}" @selected(old('status', 'published') === $status)>{{ $label }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
<div class="field">
|
|
<label>作者</label>
|
|
<input class="input" name="author" value="{{ old('author') }}" placeholder="LT083">
|
|
</div>
|
|
<div class="field">
|
|
<label>License</label>
|
|
<input class="input" name="license" value="{{ old('license') }}" placeholder="MIT">
|
|
</div>
|
|
<div class="field">
|
|
<label>排序</label>
|
|
<input class="input" type="number" name="sort_order" value="{{ old('sort_order', 0) }}">
|
|
</div>
|
|
<div class="field">
|
|
<label>主页</label>
|
|
<input class="input" name="homepage" value="{{ old('homepage') }}" placeholder="https://example.com/package">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="field">
|
|
<label>图标 URL</label>
|
|
<input class="input" name="icon_url" value="{{ old('icon_url') }}" placeholder="https://example.com/icon.png">
|
|
</div>
|
|
|
|
<div class="field">
|
|
<label>摘要</label>
|
|
<input class="input" name="summary" value="{{ old('summary') }}" placeholder="一句话说明这个{{ $entityLabel }}是做什么的">
|
|
</div>
|
|
|
|
<div class="field">
|
|
<label>描述</label>
|
|
<textarea name="description" placeholder="补充更完整的定位与功能说明">{{ old('description') }}</textarea>
|
|
</div>
|
|
|
|
<div class="field">
|
|
<label>分类名称或 slug,优先用逗号分隔</label>
|
|
<input class="input" name="categories_text" value="{{ old('categories_text') }}" placeholder="性能优化, seo">
|
|
</div>
|
|
|
|
<div class="checkbox-row">
|
|
<label><input type="checkbox" name="is_featured" value="1" @checked(old('is_featured'))> 设为推荐扩展</label>
|
|
</div>
|
|
|
|
<div class="form-actions">
|
|
<button class="btn" type="submit">创建{{ $entityLabel }}</button>
|
|
</div>
|
|
</form>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
@endsection
|