init
This commit is contained in:
36
resources/views/admin/sources/form.blade.php
Normal file
36
resources/views/admin/sources/form.blade.php
Normal file
@@ -0,0 +1,36 @@
|
||||
@extends('layouts.admin')
|
||||
|
||||
@section('title', $item->exists ? '编辑来源' : '新建来源')
|
||||
|
||||
@section('content')
|
||||
<div class="card">
|
||||
<div class="card-header"><h3 class="card-title mb-0">{{ $item->exists ? '编辑来源' : '新建来源' }}</h3></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">域名</label><input class="form-control" name="domain" value="{{ old('domain', $item->domain) }}" required></div>
|
||||
<div class="col-md-6"><label class="form-label">类型</label><input class="form-control" name="type" value="{{ old('type', $item->type ?: 'media') }}" required></div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">信任等级</label>
|
||||
<select class="form-select" name="trust_level">
|
||||
@foreach(['official' => 'official','trusted_media' => 'trusted_media','community' => 'community','unknown' => 'unknown'] as $value => $label)
|
||||
<option value="{{ $value }}" @selected(old('trust_level', $item->trust_level?->value ?? 'trusted_media') === $value)>{{ $label }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-12 d-flex flex-wrap gap-3">
|
||||
<label class="form-check"><input class="form-check-input" type="checkbox" name="is_whitelisted" value="1" @checked(old('is_whitelisted', $item->is_whitelisted))><span class="form-check-label">加入白名单</span></label>
|
||||
<label class="form-check"><input class="form-check-input" type="checkbox" name="crawl_allowed" value="1" @checked(old('crawl_allowed', $item->crawl_allowed))><span class="form-check-label">允许抓取</span></label>
|
||||
</div>
|
||||
|
||||
<div class="col-12"><label class="form-label">备注</label><textarea class="form-control" name="note" rows="4">{{ old('note', $item->note) }}</textarea></div>
|
||||
|
||||
<div class="col-12"><button class="btn btn-primary" type="submit">保存</button></div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
53
resources/views/admin/sources/index.blade.php
Normal file
53
resources/views/admin/sources/index.blade.php
Normal file
@@ -0,0 +1,53 @@
|
||||
@extends('layouts.admin')
|
||||
|
||||
@section('title', '来源白名单管理')
|
||||
|
||||
@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.sources.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.sources.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>{{ $item->name }}</td>
|
||||
<td>{{ $item->domain }}</td>
|
||||
<td>{{ $item->type }}</td>
|
||||
<td>{{ $item->trust_level?->value ?? '-' }}</td>
|
||||
<td>
|
||||
@if($item->is_whitelisted)
|
||||
<span class="badge bg-green-lt text-green-fg">是</span>
|
||||
@else
|
||||
<span class="badge bg-gray-200 text-dark">否</span>
|
||||
@endif
|
||||
</td>
|
||||
<td class="text-end"><a class="btn btn-sm btn-outline-primary" href="{{ route('admin.sources.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