68 lines
4.6 KiB
PHP
68 lines
4.6 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('title', '投稿文章')
|
|
|
|
@section('content')
|
|
<section class="px-4 py-12 sm:px-6 lg:px-8 lg:py-16">
|
|
<div class="mx-auto max-w-2xl">
|
|
<div class="mb-6">
|
|
<h1 class="text-2xl font-bold tracking-tight text-fg sm:text-3xl">投稿文章</h1>
|
|
<p class="mt-2 text-sm text-muted">提交后由管理员审核,审核通过前仅你自己可见。</p>
|
|
</div>
|
|
|
|
<form method="POST" action="{{ route('articles.submit.store') }}" class="rounded-lg border border-line bg-surface p-6 shadow-soft sm:p-8">
|
|
@csrf
|
|
<div class="space-y-5">
|
|
<div>
|
|
<label class="mb-1.5 block text-sm font-medium text-fg">标题</label>
|
|
<input name="title" value="{{ old('title') }}" required class="w-full rounded-lg border border-line bg-surface px-3 py-2.5 text-sm text-fg placeholder:text-muted focus:border-primary focus:outline-none focus:shadow-[0_0_0_3px_var(--color-primary-soft)]">
|
|
</div>
|
|
<div>
|
|
<label class="mb-1.5 block text-sm font-medium text-fg">分类</label>
|
|
<select name="category_id" class="w-full rounded-lg border border-line bg-surface px-3 py-2.5 text-sm text-fg focus:border-primary focus:outline-none focus:shadow-[0_0_0_3px_var(--color-primary-soft)]">
|
|
<option value="">无分类</option>
|
|
@foreach ($categories as $c)
|
|
<option value="{{ $c->id }}" @selected(old('category_id') == $c->id)>{{ $c->name }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label class="mb-1.5 block text-sm font-medium text-fg">摘要</label>
|
|
<input name="summary" value="{{ old('summary') }}" class="w-full rounded-lg border border-line bg-surface px-3 py-2.5 text-sm text-fg placeholder:text-muted focus:border-primary focus:outline-none focus:shadow-[0_0_0_3px_var(--color-primary-soft)]">
|
|
</div>
|
|
<div>
|
|
<label class="mb-1.5 block text-sm font-medium text-fg">正文</label>
|
|
<x-rich-editor name="body" :value="old('body')" />
|
|
</div>
|
|
<div>
|
|
<label class="mb-1.5 block text-sm font-medium text-fg">版式模板</label>
|
|
<select name="template" class="w-full rounded-lg border border-line bg-surface px-3 py-2.5 text-sm text-fg focus:border-primary focus:outline-none focus:shadow-[0_0_0_3px_var(--color-primary-soft)]">
|
|
@foreach (App\Models\Article::TEMPLATES as $key => $label)
|
|
<option value="{{ $key }}" @selected(old('template', 'standard') === $key)>{{ $label }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label class="mb-1.5 block text-sm font-medium text-fg">封面图(可选,支持上传)</label>
|
|
<input type="file" id="cover-file" accept="image/*" class="mb-2 block w-full text-sm">
|
|
<div class="flex items-center gap-3">
|
|
<input name="cover" id="cover-url" value="{{ old('cover') }}" placeholder="https://..." class="w-full rounded-lg border border-line bg-surface px-3 py-2.5 text-sm text-fg placeholder:text-muted focus:border-primary focus:outline-none focus:shadow-[0_0_0_3px_var(--color-primary-soft)]">
|
|
<button type="button" class="inline-flex items-center justify-center rounded-lg border border-line bg-surface px-5 py-2.5 text-sm font-semibold text-fg transition hover:bg-surface-2" onclick="uploadFile('cover')">上传</button>
|
|
</div>
|
|
<p class="mt-1.5 text-xs text-muted">仅「专题报道」版式会使用封面图。</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mt-6 flex items-center gap-3 border-t border-line pt-6">
|
|
<button type="submit" class="inline-flex items-center justify-center gap-2 rounded-lg bg-primary px-5 py-2.5 text-sm font-semibold text-white transition hover:bg-primary-hover">
|
|
<x-icon name="send" :size="18" /> 提交投稿
|
|
</button>
|
|
<a href="{{ route('articles.index') }}" class="inline-flex items-center justify-center rounded-lg border border-line bg-surface px-5 py-2.5 text-sm font-semibold text-fg transition hover:bg-surface-2">
|
|
取消
|
|
</a>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</section>
|
|
@endsection
|