init
This commit is contained in:
140
resources/views/admin/tools/form.blade.php
Normal file
140
resources/views/admin/tools/form.blade.php
Normal file
@@ -0,0 +1,140 @@
|
||||
@extends('layouts.admin')
|
||||
|
||||
@section('title', $item->exists ? '编辑工具' : '新建工具')
|
||||
|
||||
@section('content')
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<h3 class="card-title mb-0">{{ $item->exists ? '编辑工具' : '新建工具' }}</h3>
|
||||
@if($item->exists)
|
||||
<div class="d-flex gap-2">
|
||||
<form method="post" action="{{ route('admin.tools.publish', $item) }}">@csrf<button class="btn btn-sm btn-success" type="submit">发布</button></form>
|
||||
<form method="post" action="{{ route('admin.tools.mark-stale', $item) }}">@csrf<button class="btn btn-sm btn-warning" type="submit">标记失效</button></form>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form method="post" action="{{ $submitRoute }}" class="row g-3">
|
||||
@csrf
|
||||
@if($method !== 'POST') @method($method) @endif
|
||||
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">名称</label>
|
||||
<input class="form-control" name="name" value="{{ old('name', $item->name) }}" required>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Slug</label>
|
||||
<input class="form-control" name="slug" value="{{ old('slug', $item->slug) }}" required>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">分类</label>
|
||||
<select class="form-select" name="category_id">
|
||||
<option value="">未分类</option>
|
||||
@foreach($categories as $category)
|
||||
<option value="{{ $category->id }}" @selected((string) old('category_id', $item->category_id) === (string) $category->id)>{{ $category->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">来源</label>
|
||||
<select class="form-select" name="source_id">
|
||||
<option value="">无</option>
|
||||
@foreach($sources as $source)
|
||||
<option value="{{ $source->id }}" @selected((string) old('source_id', $item->source_id) === (string) $source->id)>{{ $source->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">价格类型</label>
|
||||
<input class="form-control" name="pricing_type" value="{{ old('pricing_type', $item->pricing_type ?: 'freemium') }}">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">平台</label>
|
||||
<input class="form-control" name="platform" value="{{ old('platform', $item->platform) }}">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">语言</label>
|
||||
<input class="form-control" name="language" value="{{ old('language', $item->language) }}">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">状态</label>
|
||||
<select class="form-select" name="status">
|
||||
@foreach($statusOptions as $status)
|
||||
<option value="{{ $status->value }}" @selected(old('status', $item->status?->value) === $status->value)>{{ $status->value }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">来源等级</label>
|
||||
<select class="form-select" name="source_level">
|
||||
@foreach(['official' => 'official','trusted_media' => 'trusted_media','community' => 'community','unknown' => 'unknown'] as $value => $label)
|
||||
<option value="{{ $value }}" @selected(old('source_level', $item->source_level?->value ?? 'unknown') === $value)>{{ $label }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">发布日期</label>
|
||||
<input class="form-control" type="datetime-local" name="published_at" value="{{ old('published_at', optional($item->published_at)->format('Y-m-d\TH:i')) }}">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">最后校验</label>
|
||||
<input class="form-control" type="datetime-local" name="last_verified_at" value="{{ old('last_verified_at', optional($item->last_verified_at)->format('Y-m-d\TH:i')) }}">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">官网 URL</label>
|
||||
<input class="form-control" name="official_url" value="{{ old('official_url', $item->official_url) }}">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Logo URL(可选)</label>
|
||||
<input class="form-control" name="logo_url" value="{{ old('logo_url', $item->logo_url) }}" placeholder="https://example.com/logo.png">
|
||||
</div>
|
||||
<div class="col-12 d-flex flex-wrap gap-3">
|
||||
<label class="form-check"><input class="form-check-input" type="checkbox" name="has_api" value="1" @checked(old('has_api', $item->has_api))><span class="form-check-label">提供 API</span></label>
|
||||
<label class="form-check"><input class="form-check-input" type="checkbox" name="is_stale" value="1" @checked(old('is_stale', $item->is_stale))><span class="form-check-label">标记失效</span></label>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<label class="form-label">摘要</label>
|
||||
<textarea class="form-control" name="summary" rows="2" required>{{ old('summary', $item->summary) }}</textarea>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="d-flex justify-content-between align-items-center mb-1">
|
||||
<label class="form-label mb-0">详情描述(Markdown)</label>
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<small class="text-muted">支持图片:``</small>
|
||||
<button class="btn btn-sm btn-outline-primary js-md-upload-btn" type="button" data-target="[name='description']">
|
||||
<i class="bi bi-image me-1"></i>上传图片
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<textarea class="form-control font-monospace js-md-editor" name="description" rows="10">{{ old('description', $item->description) }}</textarea>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<label class="form-label">失效说明</label>
|
||||
<textarea class="form-control" name="stale_note" rows="2">{{ old('stale_note', $item->stale_note) }}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">SEO 标题</label>
|
||||
<input class="form-control" name="seo_title" value="{{ old('seo_title', $item->seo_title) }}">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">SEO 描述</label>
|
||||
<input class="form-control" name="seo_description" value="{{ old('seo_description', $item->seo_description) }}">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">H1</label>
|
||||
<input class="form-control" name="h1" value="{{ old('h1', $item->h1) }}">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Canonical</label>
|
||||
<input class="form-control" name="canonical_url" value="{{ old('canonical_url', $item->canonical_url) }}">
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<button class="btn btn-primary" type="submit">保存</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
52
resources/views/admin/tools/index.blade.php
Normal file
52
resources/views/admin/tools/index.blade.php
Normal file
@@ -0,0 +1,52 @@
|
||||
@extends('layouts.admin')
|
||||
|
||||
@section('title', 'AI 工具管理')
|
||||
|
||||
@section('content')
|
||||
<div class="card mb-3">
|
||||
<div class="card-body d-flex flex-column flex-lg-row gap-2 align-items-lg-center justify-content-between">
|
||||
<form method="get" action="{{ route('admin.tools.index') }}" class="d-flex flex-column flex-md-row gap-2 w-100">
|
||||
<input class="form-control" type="text" name="q" value="{{ $filters['q'] ?? '' }}" placeholder="搜索工具名称 / 摘要关键词">
|
||||
<button class="btn btn-primary" type="submit"><i class="bi bi-search me-1"></i>搜索</button>
|
||||
</form>
|
||||
<a class="btn btn-success" href="{{ route('admin.tools.create') }}"><i class="bi bi-plus-circle me-1"></i>新建工具</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-vcenter card-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>名称</th>
|
||||
<th>分类</th>
|
||||
<th>状态</th>
|
||||
<th>来源等级</th>
|
||||
<th>更新时间</th>
|
||||
<th class="text-end">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse($items as $item)
|
||||
<tr>
|
||||
<td>
|
||||
<div class="fw-semibold">{{ $item->name }}</div>
|
||||
<div class="text-muted small">{{ $item->summary }}</div>
|
||||
</td>
|
||||
<td>{{ $item->category?->name ?? '-' }}</td>
|
||||
<td><span class="badge bg-azure-lt text-azure-fg">{{ $item->status?->value ?? '-' }}</span></td>
|
||||
<td>{{ $item->source_level?->value ?? '-' }}</td>
|
||||
<td>{{ $item->updated_at?->format('Y-m-d H:i') }}</td>
|
||||
<td class="text-end">
|
||||
<a class="btn btn-sm btn-outline-primary" href="{{ route('admin.tools.edit', $item) }}">编辑</a>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr><td colspan="6" class="text-center text-muted py-4">暂无工具数据</td></tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-footer">{{ $items->links() }}</div>
|
||||
</div>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user