117 lines
6.7 KiB
PHP
117 lines
6.7 KiB
PHP
|
|
{{--
|
|||
|
|
文件功能:后台开发日志新增/编辑表单(仅 id=1 超级管理员可访问)
|
|||
|
|
新增时:可选立即发布 + 通知大厅用户(触发 WebSocket 广播)
|
|||
|
|
编辑时:不显示"通知大厅"选项,不更新 published_at
|
|||
|
|
|
|||
|
|
@extends admin.layouts.app
|
|||
|
|
--}}
|
|||
|
|
@extends('admin.layouts.app')
|
|||
|
|
|
|||
|
|
@section('title', $isCreate ? '新增开发日志' : '编辑开发日志')
|
|||
|
|
|
|||
|
|
@section('content')
|
|||
|
|
<div class="flex items-center gap-3 mb-6">
|
|||
|
|
<a href="{{ route('admin.changelogs.index') }}" class="text-gray-400 hover:text-gray-600 transition">← 返回列表</a>
|
|||
|
|
<h2 class="text-xl font-bold text-gray-800">{{ $isCreate ? '📝 新增开发日志' : '✏️ 编辑开发日志' }}</h2>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="max-w-3xl bg-white rounded-xl shadow-sm border border-gray-100 p-6">
|
|||
|
|
<form action="{{ $isCreate ? route('admin.changelogs.store') : route('admin.changelogs.update', $log->id) }}"
|
|||
|
|
method="POST">
|
|||
|
|
@csrf
|
|||
|
|
@if (!$isCreate)
|
|||
|
|
@method('PUT')
|
|||
|
|
@endif
|
|||
|
|
|
|||
|
|
{{-- 版本号 + 类型 --}}
|
|||
|
|
<div class="grid grid-cols-2 gap-4 mb-4">
|
|||
|
|
<div>
|
|||
|
|
<label class="block text-sm font-bold text-gray-700 mb-2">
|
|||
|
|
版本号 <span class="text-red-500">*</span>
|
|||
|
|
<span class="font-normal text-gray-400 ml-1">(推荐使用日期格式,如 2026-02-28)</span>
|
|||
|
|
</label>
|
|||
|
|
<input type="text" name="version" value="{{ old('version', $log?->version ?? $todayVersion) }}"
|
|||
|
|
required maxlength="30" placeholder="例: 2026-02-28"
|
|||
|
|
class="w-full border border-gray-200 rounded-lg p-2.5 text-sm focus:ring-2 focus:ring-indigo-400 outline-none">
|
|||
|
|
</div>
|
|||
|
|
<div>
|
|||
|
|
<label class="block text-sm font-bold text-gray-700 mb-2">类型 <span class="text-red-500">*</span></label>
|
|||
|
|
<select name="type"
|
|||
|
|
class="w-full border border-gray-200 rounded-lg p-2.5 text-sm focus:ring-2 focus:ring-indigo-400 outline-none">
|
|||
|
|
@foreach ($typeOptions as $value => $config)
|
|||
|
|
<option value="{{ $value }}" {{ old('type', $log?->type) === $value ? 'selected' : '' }}>
|
|||
|
|
{{ $config['label'] }}
|
|||
|
|
</option>
|
|||
|
|
@endforeach
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
{{-- 标题 --}}
|
|||
|
|
<div class="mb-4">
|
|||
|
|
<label class="block text-sm font-bold text-gray-700 mb-2">标题 <span class="text-red-500">*</span></label>
|
|||
|
|
<input type="text" name="title" value="{{ old('title', $log?->title) }}" required maxlength="200"
|
|||
|
|
placeholder="简洁描述本次更新的重点..."
|
|||
|
|
class="w-full border border-gray-200 rounded-lg p-2.5 text-sm focus:ring-2 focus:ring-indigo-400 outline-none">
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
{{-- Markdown 内容 --}}
|
|||
|
|
<div class="mb-5">
|
|||
|
|
<label class="block text-sm font-bold text-gray-700 mb-2">
|
|||
|
|
详细内容 <span class="text-red-500">*</span>
|
|||
|
|
<span class="font-normal text-gray-400 ml-1">(支持 Markdown 格式)</span>
|
|||
|
|
</label>
|
|||
|
|
<textarea name="content" required rows="16"
|
|||
|
|
placeholder="## 新增功能 - 新增了 AI 聊天机器人功能 - 支持多种 AI 服务商(OpenAI / DeepSeek) ## Bug 修复 - 修复了钓鱼游戏积分计算错误 ## 优化 - 改进了消息加载速度"
|
|||
|
|
class="w-full border border-gray-200 rounded-lg p-3 text-sm font-mono resize-y focus:ring-2 focus:ring-indigo-400 outline-none leading-relaxed">{{ old('content', $log?->content) }}</textarea>
|
|||
|
|
<p class="text-xs text-gray-400 mt-1">支持 ## 标题、- 列表、`代码` 等 Markdown 格式</p>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
{{-- 发布选项 --}}
|
|||
|
|
<div class="bg-gray-50 rounded-xl p-4 mb-5 border border-gray-200">
|
|||
|
|
<label class="flex items-center gap-3 cursor-pointer group">
|
|||
|
|
<input type="checkbox" name="is_published" value="1"
|
|||
|
|
{{ old('is_published', $log?->is_published) ? 'checked' : '' }}
|
|||
|
|
class="w-4 h-4 text-indigo-600 rounded focus:ring-indigo-400" id="is_published">
|
|||
|
|
<span class="font-bold text-gray-800">立即发布</span>
|
|||
|
|
<span class="text-gray-500 text-sm font-normal">(取消勾选则保存为草稿)</span>
|
|||
|
|
</label>
|
|||
|
|
|
|||
|
|
@if ($isCreate)
|
|||
|
|
{{-- 新增时显示"通知大厅"选项 --}}
|
|||
|
|
<label class="flex items-center gap-3 cursor-pointer mt-3" id="notify-row">
|
|||
|
|
<input type="checkbox" name="notify_chat" value="1" checked
|
|||
|
|
class="w-4 h-4 text-purple-600 rounded focus:ring-purple-400" id="notify_chat">
|
|||
|
|
<span class="font-bold text-gray-800">通知大厅用户</span>
|
|||
|
|
<span class="text-gray-500 text-sm font-normal">
|
|||
|
|
(发布时在「星光大厅 Room 1」的聊天区广播通知,含可点击链接)
|
|||
|
|
</span>
|
|||
|
|
</label>
|
|||
|
|
@else
|
|||
|
|
{{-- 编辑时也可手动触发通知 --}}
|
|||
|
|
<label class="flex items-center gap-3 cursor-pointer mt-3" id="notify-row">
|
|||
|
|
<input type="checkbox" name="notify_chat" value="1"
|
|||
|
|
class="w-4 h-4 text-purple-600 rounded focus:ring-purple-400" id="notify_chat">
|
|||
|
|
<span class="font-bold text-gray-800">重新通知大厅用户</span>
|
|||
|
|
<span class="text-gray-500 text-sm font-normal">
|
|||
|
|
(勾选后保存,将再次向「星光大厅」广播此日志通知)
|
|||
|
|
</span>
|
|||
|
|
</label>
|
|||
|
|
@endif
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
{{-- 操作按钮 --}}
|
|||
|
|
<div class="flex justify-end gap-3">
|
|||
|
|
<a href="{{ route('admin.changelogs.index') }}"
|
|||
|
|
class="px-5 py-2 border border-gray-200 rounded-lg text-gray-600 hover:bg-gray-50 font-medium text-sm transition">
|
|||
|
|
取消
|
|||
|
|
</a>
|
|||
|
|
<button type="submit"
|
|||
|
|
class="px-6 py-2 bg-indigo-600 text-white rounded-lg font-bold hover:bg-indigo-700 text-sm shadow-sm transition">
|
|||
|
|
{{ $isCreate ? '保存日志' : '更新日志' }}
|
|||
|
|
</button>
|
|||
|
|
</div>
|
|||
|
|
</form>
|
|||
|
|
</div>
|
|||
|
|
@endsection
|