初始化

This commit is contained in:
2026-08-08 18:27:38 +08:00
parent efc150c937
commit 060eb79c09
336 changed files with 24613 additions and 15 deletions
+59
View File
@@ -0,0 +1,59 @@
@extends('layouts.app')
@section('title', '技术文章 - 深圳市云创芯电子有限公司')
@section('content')
<section class="px-4 py-12 sm:px-6 lg:px-8 lg:py-16">
<div class="max-w-8xl mx-auto">
<div class="mb-8">
<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="GET" class="flex flex-wrap items-end gap-3">
<div class="min-w-[220px] flex-1">
<label class="mb-1.5 block text-sm font-medium text-fg">搜索</label>
<div class="relative">
<span class="pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-muted">
<x-icon name="search" :size="18" />
</span>
<input type="text" name="q" value="{{ $q }}" placeholder="搜索标题、摘要..." class="w-full rounded-lg border border-line bg-surface py-2.5 pl-10 pr-3 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>
<div class="w-full sm:w-56">
<label class="mb-1.5 block text-sm font-medium text-fg">分类</label>
<select name="category" onchange="this.form.submit()" 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((int) $categoryId === $c->id)>{{ $c->name }}</option>
@endforeach
</select>
</div>
<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="search" :size="18" /> 查询
</button>
</form>
<div class="mt-8 space-y-4">
@forelse ($articles as $article)
<a href="{{ route('articles.show', $article->slug) }}" class="group flex items-center justify-between gap-4 rounded-lg border border-line bg-surface p-5 shadow-soft transition hover:border-primary hover:shadow-card">
<div>
<h3 class="text-lg font-semibold text-fg transition group-hover:text-primary">{{ $article->title }}</h3>
<p class="mt-1 line-clamp-2 text-sm text-muted">{{ $article->summary ?: Str::limit(strip_tags($article->body), 120) }}</p>
<p class="mt-2 text-xs text-muted">{{ $article->published_at?->format('Y-m-d') }} · {{ $article->author ?: '云创芯' }}</p>
</div>
<span class="shrink-0 text-muted transition group-hover:text-primary">
<x-icon name="arrow" :size="20" />
</span>
</a>
@empty
<p class="text-sm text-muted">暂无文章。</p>
@endforelse
</div>
<div class="mt-8">
{{ $articles->links('pagination::bootstrap-5') }}
</div>
</div>
</section>
@endsection
+61
View File
@@ -0,0 +1,61 @@
@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-4xl">
<div class="mb-6 flex flex-wrap items-center justify-between gap-3">
<h1 class="text-2xl font-bold tracking-tight text-fg sm:text-3xl">我的投稿</h1>
<a href="{{ route('articles.submit') }}" class="inline-flex items-center gap-1.5 rounded-lg bg-primary px-4 py-2 text-sm font-semibold text-white transition hover:bg-primary-hover">
<x-icon name="plus" :size="16" /> 新投稿
</a>
</div>
@if ($articles->isEmpty())
<div class="rounded-lg border border-line bg-surface p-8 text-center shadow-soft">
<p class="text-sm text-muted">你还没有投稿。</p>
<a href="{{ route('articles.submit') }}" class="mt-3 inline-flex items-center gap-1.5 text-sm font-medium text-primary hover:text-primary-hover">去投稿 </a>
</div>
@else
<div class="overflow-hidden rounded-lg border border-line bg-surface shadow-soft">
<table class="w-full text-left text-sm">
<thead class="bg-surface-2 text-xs font-semibold text-muted">
<tr>
<th class="px-4 py-3">标题</th>
<th class="px-4 py-3">状态</th>
<th class="px-4 py-3">提交时间</th>
<th class="px-4 py-3 text-right">操作</th>
</tr>
</thead>
<tbody class="divide-y divide-line">
@foreach ($articles as $a)
<tr class="transition hover:bg-surface">
<td class="px-4 py-3 font-medium text-fg">{{ $a->title }}</td>
<td class="px-4 py-3">
@if ($a->status === 'approved')
<span class="inline-flex items-center rounded-full bg-success-soft px-2.5 py-0.5 text-xs font-medium text-success">已发布</span>
@elseif ($a->status === 'pending')
<span class="inline-flex items-center rounded-full bg-warning-soft px-2.5 py-0.5 text-xs font-medium text-warning">待审</span>
@elseif ($a->status === 'rejected')
<span class="inline-flex items-center rounded-full bg-danger-soft px-2.5 py-0.5 text-xs font-medium text-danger">已驳回</span>
@else
<span class="inline-flex items-center rounded-full bg-surface-2 px-2.5 py-0.5 text-xs font-medium text-muted">草稿</span>
@endif
</td>
<td class="px-4 py-3 text-muted">{{ $a->created_at?->format('Y-m-d H:i') }}</td>
<td class="px-4 py-3 text-right">
<a href="{{ route('articles.show', $a->slug) }}" class="inline-flex items-center gap-1 rounded-lg border border-line px-3 py-1.5 text-xs font-medium text-fg transition hover:bg-surface-2 hover:text-primary">查看</a>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="mt-6">
{{ $articles->links('pagination::bootstrap-5') }}
</div>
@endif
</div>
</section>
@endsection
+58
View File
@@ -0,0 +1,58 @@
@extends('layouts.app')
@php $siteName = App\Models\Setting::get('site_name', '深圳市云创芯电子有限公司'); @endphp
@section('title', $article->seoTitle() . ' - ' . $siteName)
@section('description', $article->seoDescription())
@section('content')
<section class="px-4 py-12 sm:px-6 lg:px-8 lg:py-16">
<div class="mx-auto max-w-3xl">
<nav class="mb-6 flex items-center gap-1.5 text-sm text-muted">
<a href="{{ url('/') }}" class="hover:text-primary">首页</a>
<span>/</span>
<a href="{{ route('articles.index') }}" class="hover:text-primary">技术文章</a>
<span>/</span>
<span class="text-fg">{{ $article->title }}</span>
</nav>
@if ($article->template === 'feature' && $article->cover)
<div class="mb-6 overflow-hidden rounded-lg border border-line">
<img src="{{ $article->cover }}" alt="{{ $article->title }}" class="max-h-96 w-full object-cover">
</div>
@endif
<article class="rounded-lg border border-line bg-surface p-6 shadow-soft sm:p-8">
<h1 class="text-2xl font-bold tracking-tight text-fg sm:text-3xl">{{ $article->title }}</h1>
<p class="mt-3 text-sm text-muted">
{{ $article->published_at?->format('Y-m-d') }} · {{ $article->author ?: '云创芯' }}
@if ($article->template === 'tech') <span class="ml-2 rounded bg-primary-soft px-2 py-0.5 text-xs font-medium text-primary">技术文档</span> @endif
@if ($article->template === 'feature') <span class="ml-2 rounded bg-primary-soft px-2 py-0.5 text-xs font-medium text-primary">专题报道</span> @endif
</p>
@if ($article->category)
<p class="mt-2 text-sm text-muted">分类:{{ $article->category->name }}</p>
@endif
@if ($article->template === 'feature' && $article->summary)
<p class="lead mt-5 text-base text-muted">{{ $article->summary }}</p>
@elseif ($article->summary)
<p class="mt-5 text-base text-muted">{{ $article->summary }}</p>
@endif
@if ($article->body)
<div class="prose mt-6 text-fg">
{{-- 旧文(纯文本)用 nl2br 换行,新文(Quill HTML)安全渲染(已过 Purifier --}}
@if (preg_match('/<[a-z][a-z0-9]*[\s>]/i', $article->body))
{!! $article->body !!}
@else
{!! nl2br(e($article->body)) !!}
@endif
</div>
@endif
</article>
<div class="mt-6">
<a href="{{ route('articles.index') }}" class="inline-flex items-center gap-1.5 text-sm font-medium text-primary hover:text-primary-hover">
<x-icon name="arrow" :size="16" class="rotate-180" /> 返回文章列表
</a>
</div>
</div>
</section>
@endsection
+67
View File
@@ -0,0 +1,67 @@
@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