统一后台列表页样式并调整站长菜单
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
@section('title', '钓鱼事件管理')
|
||||
|
||||
@section('content')
|
||||
@php require resource_path('views/admin/partials/list-theme.php'); @endphp
|
||||
|
||||
@php
|
||||
$fishingEventPayload = $events->mapWithKeys(
|
||||
fn($event) => [
|
||||
@@ -25,59 +27,62 @@
|
||||
|
||||
<script type="application/json" id="admin-fishing-events-data">@json($fishingEventPayload)</script>
|
||||
|
||||
<div class="space-y-6">
|
||||
<div class="{{ $adminListPageClass }}">
|
||||
|
||||
{{-- 页头 --}}
|
||||
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6 flex justify-between items-center">
|
||||
<div>
|
||||
<h2 class="text-lg font-bold text-gray-800">🎣 钓鱼事件管理</h2>
|
||||
<p class="text-xs text-gray-500 mt-1">
|
||||
管理钓鱼随机事件。权重越大被触发概率越高。
|
||||
当前激活事件总权重:<strong class="text-indigo-600">{{ $totalWeight }}</strong>
|
||||
</p>
|
||||
<div class="{{ $adminListHeaderCardClass }}">
|
||||
<div class="flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between">
|
||||
<div>
|
||||
<h2 class="{{ $adminListHeaderTitleClass }}">🎣 钓鱼事件管理</h2>
|
||||
<p class="{{ $adminListHeaderSubtitleClass }}">
|
||||
管理钓鱼随机事件。权重越大被触发概率越高。
|
||||
当前激活事件总权重:<strong class="text-indigo-600">{{ $totalWeight }}</strong>
|
||||
</p>
|
||||
</div>
|
||||
<a href="{{ route('admin.game-configs.index') }}"
|
||||
class="{{ $adminListSecondaryButtonClass }} inline-flex items-center justify-center">
|
||||
⚙️ 钓鱼参数设置
|
||||
</a>
|
||||
</div>
|
||||
<a href="{{ route('admin.game-configs.index') }}"
|
||||
class="px-4 py-2 bg-gray-100 text-gray-700 rounded-lg text-sm font-bold hover:bg-gray-200 transition">
|
||||
⚙️ 钓鱼参数设置
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{{-- 钓鱼事件列表 --}}
|
||||
<div class="bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden">
|
||||
<table class="w-full text-sm">
|
||||
<thead class="bg-gray-50 border-b border-gray-100">
|
||||
<div class="{{ $adminListCardClass }}">
|
||||
<div class="{{ $adminListTableWrapClass }}">
|
||||
<table class="{{ $adminListTableClass }}">
|
||||
<thead class="{{ $adminListTableHeadRowClass }}">
|
||||
<tr>
|
||||
<th class="px-4 py-3 text-left text-xs font-bold text-gray-500 uppercase">排序</th>
|
||||
<th class="px-4 py-3 text-left text-xs font-bold text-gray-500 uppercase">符号</th>
|
||||
<th class="px-4 py-3 text-left text-xs font-bold text-gray-500 uppercase">名称</th>
|
||||
<th class="px-4 py-3 text-left text-xs font-bold text-gray-500 uppercase w-1/3">播报内容</th>
|
||||
<th class="px-4 py-3 text-center text-xs font-bold text-gray-500 uppercase">经验</th>
|
||||
<th class="px-4 py-3 text-center text-xs font-bold text-gray-500 uppercase">金币</th>
|
||||
<th class="px-4 py-3 text-center text-xs font-bold text-gray-500 uppercase">权重</th>
|
||||
<th class="px-4 py-3 text-center text-xs font-bold text-gray-500 uppercase">概率</th>
|
||||
<th class="px-4 py-3 text-center text-xs font-bold text-gray-500 uppercase">状态</th>
|
||||
<th class="px-4 py-3 text-right text-xs font-bold text-gray-500 uppercase">操作</th>
|
||||
<th class="{{ $adminListTableHeadCellClass }}">排序</th>
|
||||
<th class="{{ $adminListTableHeadCellClass }}">符号</th>
|
||||
<th class="{{ $adminListTableHeadCellClass }}">名称</th>
|
||||
<th class="{{ $adminListTableHeadCellClass }} w-1/3">播报内容</th>
|
||||
<th class="{{ $adminListTableHeadCellClass }} text-center">经验</th>
|
||||
<th class="{{ $adminListTableHeadCellClass }} text-center">金币</th>
|
||||
<th class="{{ $adminListTableHeadCellClass }} text-center">权重</th>
|
||||
<th class="{{ $adminListTableHeadCellClass }} text-center">概率</th>
|
||||
<th class="{{ $adminListTableHeadCellClass }} text-center">状态</th>
|
||||
<th class="{{ $adminListTableHeadCellClass }} text-right">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-50">
|
||||
<tbody class="{{ $adminListTableBodyClass }}">
|
||||
@foreach ($events as $event)
|
||||
<tr id="row-{{ $event->id }}" class="{{ $event->is_active ? '' : 'opacity-50' }}">
|
||||
<td class="px-4 py-3 text-gray-500 text-xs">{{ $event->sort }}</td>
|
||||
<tr id="row-{{ $event->id }}" class="{{ $adminListTableRowClass }} {{ $event->is_active ? '' : 'opacity-50' }}">
|
||||
<td class="px-4 py-3 {{ $adminListSecondaryTextClass }}">{{ $event->sort }}</td>
|
||||
<td class="px-4 py-3 text-xl">{{ $event->emoji }}</td>
|
||||
<td class="px-4 py-3 font-medium text-gray-800">{{ $event->name }}</td>
|
||||
<td class="px-4 py-3 text-gray-500 text-xs">{{ $event->message }}</td>
|
||||
<td class="px-4 py-3 {{ $adminListPrimaryTextClass }}">{{ $event->name }}</td>
|
||||
<td class="px-4 py-3 {{ $adminListBodyTextClass }}">{{ $event->message }}</td>
|
||||
<td
|
||||
class="px-4 py-3 text-center font-mono text-xs
|
||||
class="px-4 py-3 text-center {{ $adminListNumericTextClass }}
|
||||
{{ $event->exp > 0 ? 'text-green-600' : ($event->exp < 0 ? 'text-red-500' : 'text-gray-400') }}">
|
||||
{{ $event->exp > 0 ? '+' : '' }}{{ $event->exp }}
|
||||
</td>
|
||||
<td
|
||||
class="px-4 py-3 text-center font-mono text-xs
|
||||
class="px-4 py-3 text-center {{ $adminListNumericTextClass }}
|
||||
{{ $event->jjb > 0 ? 'text-amber-600' : ($event->jjb < 0 ? 'text-red-500' : 'text-gray-400') }}">
|
||||
{{ $event->jjb > 0 ? '+' : '' }}{{ $event->jjb }}
|
||||
</td>
|
||||
<td class="px-4 py-3 text-center text-xs text-indigo-600 font-bold">{{ $event->weight }}</td>
|
||||
<td class="px-4 py-3 text-center text-xs text-gray-500">
|
||||
<td class="px-4 py-3 text-center text-indigo-600 {{ $adminListNumericTextClass }} font-bold">{{ $event->weight }}</td>
|
||||
<td class="px-4 py-3 text-center {{ $adminListBodyTextClass }}">
|
||||
@if ($totalWeight > 0 && $event->is_active)
|
||||
{{ number_format(($event->weight / $totalWeight) * 100, 1) }}%
|
||||
@else
|
||||
@@ -87,78 +92,78 @@
|
||||
<td class="px-4 py-3 text-center">
|
||||
<button type="button" data-fishing-toggle-id="{{ $event->id }}"
|
||||
id="toggle-{{ $event->id }}"
|
||||
class="px-2 py-1 rounded-full text-xs font-bold transition
|
||||
{{ $event->is_active ? 'bg-emerald-100 text-emerald-700 hover:bg-emerald-200' : 'bg-gray-100 text-gray-500 hover:bg-gray-200' }}">
|
||||
class="{{ $adminListBadgeBaseClass }} px-2 py-1 transition
|
||||
{{ $event->is_active ? 'border-emerald-200 bg-emerald-100 text-emerald-700 hover:bg-emerald-200' : 'border-gray-200 bg-gray-100 text-gray-500 hover:bg-gray-200' }}">
|
||||
{{ $event->is_active ? '启用' : '禁用' }}
|
||||
</button>
|
||||
</td>
|
||||
<td class="px-4 py-3 text-right">
|
||||
<button type="button" data-fishing-edit-id="{{ $event->id }}"
|
||||
class="px-3 py-1 bg-indigo-50 text-indigo-700 rounded text-xs font-bold hover:bg-indigo-100 transition mr-1">
|
||||
class="{{ $adminListActionButtonClass }} bg-indigo-50 text-indigo-700 hover:bg-indigo-100 mr-1">
|
||||
编辑
|
||||
</button>
|
||||
<form action="{{ route('admin.fishing.destroy', $event->id) }}" method="POST"
|
||||
class="inline" data-fishing-delete-confirm="确定删除事件「{{ $event->name }}」?">
|
||||
@csrf @method('DELETE')
|
||||
<button type="submit"
|
||||
class="px-3 py-1 bg-red-50 text-red-600 rounded text-xs font-bold hover:bg-red-100 transition">
|
||||
class="{{ $adminListActionButtonClass }} bg-red-50 text-red-600 hover:bg-red-100">
|
||||
删除
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- 新增事件卡片 --}}
|
||||
<div class="bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden">
|
||||
<div class="p-5 border-b border-gray-100 bg-gray-50">
|
||||
<h3 class="font-bold text-gray-700 text-sm">➕ 新增钓鱼事件</h3>
|
||||
<div class="{{ $adminListCardClass }}">
|
||||
<div class="{{ $adminListSectionHeadClass }}">
|
||||
<h3 class="{{ $adminListSectionTitleClass }}">➕ 新增钓鱼事件</h3>
|
||||
</div>
|
||||
<form action="{{ route('admin.fishing.store') }}" method="POST" class="p-5">
|
||||
@csrf
|
||||
<div class="grid grid-cols-2 md:grid-cols-4 gap-4">
|
||||
<div>
|
||||
<label class="block text-xs font-bold text-gray-600 mb-1">Emoji 符号</label>
|
||||
<label class="{{ $adminListFilterLabelClass }}">Emoji 符号</label>
|
||||
<input type="text" name="emoji" value="{{ old('emoji') }}" placeholder="🐟" required
|
||||
class="w-full border border-gray-300 rounded-lg p-2 text-sm focus:border-indigo-400">
|
||||
class="w-full {{ $adminListFilterInputClass }}">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-bold text-gray-600 mb-1">名称</label>
|
||||
<label class="{{ $adminListFilterLabelClass }}">名称</label>
|
||||
<input type="text" name="name" value="{{ old('name') }}" placeholder="小鲤鱼" required
|
||||
class="w-full border border-gray-300 rounded-lg p-2 text-sm focus:border-indigo-400">
|
||||
class="w-full {{ $adminListFilterInputClass }}">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-bold text-gray-600 mb-1">经验变化</label>
|
||||
<label class="{{ $adminListFilterLabelClass }}">经验变化</label>
|
||||
<input type="number" name="exp" value="{{ old('exp', 0) }}"
|
||||
class="w-full border border-gray-300 rounded-lg p-2 text-sm focus:border-indigo-400">
|
||||
class="w-full {{ $adminListFilterInputClass }}">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-bold text-gray-600 mb-1">金币变化</label>
|
||||
<label class="{{ $adminListFilterLabelClass }}">金币变化</label>
|
||||
<input type="number" name="jjb" value="{{ old('jjb', 0) }}"
|
||||
class="w-full border border-gray-300 rounded-lg p-2 text-sm focus:border-indigo-400">
|
||||
class="w-full {{ $adminListFilterInputClass }}">
|
||||
</div>
|
||||
<div class="md:col-span-2">
|
||||
<label class="block text-xs font-bold text-gray-600 mb-1">播报内容</label>
|
||||
<label class="{{ $adminListFilterLabelClass }}">播报内容</label>
|
||||
<input type="text" name="message" value="{{ old('message') }}" placeholder="钓到一条小鲤鱼..." required
|
||||
class="w-full border border-gray-300 rounded-lg p-2 text-sm focus:border-indigo-400">
|
||||
class="w-full {{ $adminListFilterInputClass }}">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-bold text-gray-600 mb-1">权重(概率)</label>
|
||||
<label class="{{ $adminListFilterLabelClass }}">权重(概率)</label>
|
||||
<input type="number" name="weight" value="{{ old('weight', 10) }}" min="1"
|
||||
class="w-full border border-gray-300 rounded-lg p-2 text-sm focus:border-indigo-400">
|
||||
class="w-full {{ $adminListFilterInputClass }}">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-bold text-gray-600 mb-1">排序</label>
|
||||
<label class="{{ $adminListFilterLabelClass }}">排序</label>
|
||||
<input type="number" name="sort" value="{{ old('sort', 0) }}" min="0"
|
||||
class="w-full border border-gray-300 rounded-lg p-2 text-sm focus:border-indigo-400">
|
||||
class="w-full {{ $adminListFilterInputClass }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-4 flex items-center gap-4">
|
||||
<button type="submit"
|
||||
class="px-5 py-2 bg-indigo-600 text-white rounded-lg font-bold hover:bg-indigo-700 transition text-sm shadow-sm">
|
||||
<button type="submit" class="{{ $adminListPrimaryButtonClass }}">
|
||||
💾 添加事件
|
||||
</button>
|
||||
<label class="flex items-center gap-2 text-sm text-gray-600 cursor-pointer">
|
||||
@@ -224,12 +229,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-5 flex gap-3">
|
||||
<button type="submit"
|
||||
class="px-5 py-2 bg-indigo-600 text-white rounded-lg font-bold hover:bg-indigo-700 transition text-sm">
|
||||
<button type="submit" class="{{ $adminListPrimaryButtonClass }}">
|
||||
💾 保存修改
|
||||
</button>
|
||||
<button type="button" data-fishing-edit-close
|
||||
class="px-4 py-2 bg-gray-100 text-gray-700 rounded-lg font-bold hover:bg-gray-200 transition text-sm">
|
||||
class="{{ $adminListSecondaryButtonClass }}">
|
||||
取消
|
||||
</button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user