2026-02-26 21:10:34 +08:00
|
|
|
|
@extends('admin.layouts.app')
|
|
|
|
|
|
|
|
|
|
|
|
@section('title', '随机事件管理')
|
|
|
|
|
|
|
|
|
|
|
|
@section('content')
|
2026-04-26 18:10:37 +08:00
|
|
|
|
@php require resource_path('views/admin/partials/list-theme.php'); @endphp
|
|
|
|
|
|
|
|
|
|
|
|
<div class="{{ $adminListPageClass }}">
|
|
|
|
|
|
<div class="{{ $adminListCardClass }}">
|
|
|
|
|
|
<div class="{{ $adminListSectionHeadClass }} flex justify-between items-center">
|
2026-02-26 21:10:34 +08:00
|
|
|
|
<div>
|
2026-04-26 18:10:37 +08:00
|
|
|
|
<h2 class="{{ $adminListSectionTitleClass }}">随机事件管理 (autoact)</h2>
|
|
|
|
|
|
<p class="{{ $adminListSectionDescClass }}">管理聊天室中随机触发的好运、坏运和中性事件,保留原有奖励与惩罚语义。</p>
|
|
|
|
|
|
</div>
|
2026-02-26 21:10:34 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
{{-- 新增事件表单 --}}
|
2026-04-26 18:10:37 +08:00
|
|
|
|
<div class="p-6 border-b border-gray-100 bg-indigo-50/50">
|
|
|
|
|
|
<h3 class="{{ $adminListSectionTitleClass }} mb-3">➕ 添加新事件</h3>
|
2026-02-26 21:10:34 +08:00
|
|
|
|
<form action="{{ route('admin.autoact.store') }}" method="POST">
|
|
|
|
|
|
@csrf
|
|
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 max-w-4xl">
|
|
|
|
|
|
<div class="md:col-span-2">
|
2026-04-26 18:10:37 +08:00
|
|
|
|
<label class="{{ $adminListFilterLabelClass }}">事件文本
|
2026-02-26 21:10:34 +08:00
|
|
|
|
<span class="text-gray-400 font-normal">({username} 将被替换为触发者用户名)</span></label>
|
2026-02-28 23:44:38 +08:00
|
|
|
|
<input type="text" name="text_body" required placeholder="例:🎉 恭喜【{username}】获得 100 经验値!"
|
2026-04-26 18:10:37 +08:00
|
|
|
|
class="w-full {{ $adminListFilterInputClass }} bg-white">
|
2026-02-26 21:10:34 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div>
|
2026-04-26 18:10:37 +08:00
|
|
|
|
<label class="{{ $adminListFilterLabelClass }}">事件类型</label>
|
2026-02-26 21:10:34 +08:00
|
|
|
|
<select name="event_type"
|
2026-04-26 18:10:37 +08:00
|
|
|
|
class="w-full {{ $adminListFilterInputClass }} bg-white">
|
2026-02-26 21:10:34 +08:00
|
|
|
|
<option value="good">🟢 好运(奖励)</option>
|
|
|
|
|
|
<option value="bad">🔴 坏运(惩罚)</option>
|
|
|
|
|
|
<option value="neutral">🟣 中性(纯文字)</option>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="flex gap-3">
|
|
|
|
|
|
<div class="flex-1">
|
2026-04-26 18:10:37 +08:00
|
|
|
|
<label class="{{ $adminListFilterLabelClass }}">经验变化</label>
|
2026-02-26 21:10:34 +08:00
|
|
|
|
<input type="number" name="exp_change" value="0"
|
2026-04-26 18:10:37 +08:00
|
|
|
|
class="w-full {{ $adminListFilterInputClass }} bg-white">
|
2026-02-26 21:10:34 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="flex-1">
|
2026-04-26 18:10:37 +08:00
|
|
|
|
<label class="{{ $adminListFilterLabelClass }}">金币变化</label>
|
2026-02-26 21:10:34 +08:00
|
|
|
|
<input type="number" name="jjb_change" value="0"
|
2026-04-26 18:10:37 +08:00
|
|
|
|
class="w-full {{ $adminListFilterInputClass }} bg-white">
|
2026-02-26 21:10:34 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="mt-4">
|
2026-04-26 18:10:37 +08:00
|
|
|
|
<button type="submit" class="{{ $adminListPrimaryButtonClass }}">
|
2026-02-26 21:10:34 +08:00
|
|
|
|
添加事件
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</form>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
{{-- 事件列表 --}}
|
2026-04-26 18:10:37 +08:00
|
|
|
|
<div class="p-6">
|
|
|
|
|
|
<h3 class="{{ $adminListSectionTitleClass }} mb-3">📋 现有事件列表(共 {{ $events->count() }} 条)</h3>
|
|
|
|
|
|
<div class="{{ $adminListTableWrapClass }}">
|
|
|
|
|
|
<table class="{{ $adminListTableClass }}">
|
|
|
|
|
|
<thead class="{{ $adminListTableHeadRowClass }}">
|
|
|
|
|
|
<tr>
|
|
|
|
|
|
<th class="{{ $adminListTableHeadCellClass }} w-10">ID</th>
|
|
|
|
|
|
<th class="{{ $adminListTableHeadCellClass }}">事件文本</th>
|
|
|
|
|
|
<th class="{{ $adminListTableHeadCellClass }} w-20">类型</th>
|
|
|
|
|
|
<th class="{{ $adminListTableHeadCellClass }} w-16">经验</th>
|
|
|
|
|
|
<th class="{{ $adminListTableHeadCellClass }} w-16">金币</th>
|
|
|
|
|
|
<th class="{{ $adminListTableHeadCellClass }} w-16">状态</th>
|
|
|
|
|
|
<th class="{{ $adminListTableHeadCellClass }} w-32">操作</th>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
</thead>
|
|
|
|
|
|
<tbody class="{{ $adminListTableBodyClass }}">
|
2026-02-26 21:10:34 +08:00
|
|
|
|
@forelse ($events as $event)
|
2026-04-26 18:10:37 +08:00
|
|
|
|
<tr class="{{ $adminListTableRowClass }} {{ !$event->enabled ? 'opacity-40' : '' }}">
|
|
|
|
|
|
<td class="p-3 {{ $adminListSecondaryTextClass }}">{{ $event->id }}</td>
|
2026-02-26 21:10:34 +08:00
|
|
|
|
<td class="p-3">
|
2026-04-26 18:10:37 +08:00
|
|
|
|
<span class="{{ $adminListBodyTextClass }}">{{ Str::limit($event->text_body, 60) }}</span>
|
2026-02-26 21:10:34 +08:00
|
|
|
|
</td>
|
|
|
|
|
|
<td class="p-3">
|
|
|
|
|
|
@if ($event->event_type === 'good')
|
2026-04-26 18:10:37 +08:00
|
|
|
|
<span class="{{ $adminListBadgeBaseClass }} border-green-200 bg-green-100 text-green-700">好运</span>
|
2026-02-26 21:10:34 +08:00
|
|
|
|
@elseif($event->event_type === 'bad')
|
2026-04-26 18:10:37 +08:00
|
|
|
|
<span class="{{ $adminListBadgeBaseClass }} border-red-200 bg-red-100 text-red-700">坏运</span>
|
2026-02-26 21:10:34 +08:00
|
|
|
|
@else
|
2026-04-26 18:10:37 +08:00
|
|
|
|
<span class="{{ $adminListBadgeBaseClass }} border-purple-200 bg-purple-100 text-purple-700">中性</span>
|
2026-02-26 21:10:34 +08:00
|
|
|
|
@endif
|
|
|
|
|
|
</td>
|
|
|
|
|
|
<td
|
2026-04-26 18:10:37 +08:00
|
|
|
|
class="p-3 {{ $adminListNumericTextClass }} {{ $event->exp_change > 0 ? 'text-green-600' : ($event->exp_change < 0 ? 'text-red-600' : 'text-gray-400') }} font-bold">
|
2026-02-26 21:10:34 +08:00
|
|
|
|
{{ $event->exp_change > 0 ? '+' : '' }}{{ $event->exp_change }}
|
|
|
|
|
|
</td>
|
|
|
|
|
|
<td
|
2026-04-26 18:10:37 +08:00
|
|
|
|
class="p-3 {{ $adminListNumericTextClass }} {{ $event->jjb_change > 0 ? 'text-green-600' : ($event->jjb_change < 0 ? 'text-red-600' : 'text-gray-400') }} font-bold">
|
2026-02-26 21:10:34 +08:00
|
|
|
|
{{ $event->jjb_change > 0 ? '+' : '' }}{{ $event->jjb_change }}
|
|
|
|
|
|
</td>
|
|
|
|
|
|
<td class="p-3">
|
2026-04-25 13:14:20 +08:00
|
|
|
|
<button type="button"
|
|
|
|
|
|
data-autoact-toggle-url="{{ route('admin.autoact.toggle', $event->id) }}"
|
2026-04-26 18:10:37 +08:00
|
|
|
|
class="{{ $adminListBadgeBaseClass }} px-2 py-1 {{ $event->enabled ? 'border-green-200 bg-green-100 text-green-700' : 'border-gray-200 bg-gray-200 text-gray-500' }} cursor-pointer">
|
2026-02-26 21:10:34 +08:00
|
|
|
|
{{ $event->enabled ? '启用' : '禁用' }}
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
<td class="p-3">
|
|
|
|
|
|
<form action="{{ route('admin.autoact.destroy', $event->id) }}" method="POST"
|
2026-04-25 13:19:13 +08:00
|
|
|
|
class="inline" data-autoact-delete-confirm="确定要删除此事件吗?">
|
2026-02-26 21:10:34 +08:00
|
|
|
|
@csrf
|
|
|
|
|
|
@method('DELETE')
|
|
|
|
|
|
<button type="submit"
|
2026-04-26 18:10:37 +08:00
|
|
|
|
class="{{ $adminListActionButtonClass }} bg-red-50 text-red-600 hover:bg-red-100">删除</button>
|
2026-02-26 21:10:34 +08:00
|
|
|
|
</form>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
@empty
|
|
|
|
|
|
<tr>
|
2026-04-26 18:10:37 +08:00
|
|
|
|
<td colspan="7" class="{{ $adminListEmptyClass }}">暂无事件,请添加。</td>
|
2026-02-26 21:10:34 +08:00
|
|
|
|
</tr>
|
|
|
|
|
|
@endforelse
|
2026-04-26 18:10:37 +08:00
|
|
|
|
</tbody>
|
|
|
|
|
|
</table>
|
|
|
|
|
|
</div>
|
2026-02-26 21:10:34 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
@endsection
|