API: - 新增 player-messages 域:充值审核通过/拒绝、Banner/公告推广消息,支持多语言模板 - 新增 presence 域:Redis 心跳在线状态,管理端可查询在线玩家数 - User 表增加 visible_menus 字段;新增 player_messages 表及迁移 - 充值审核通过/拒绝时按系统配置自动写入玩家站内消息 - 管理端新增 GET /deposit-orders/pending-count、GET /presence/online-count - 玩家端新增消息 CRUD、presence/ping、home 返回 inbox 开关配置 - 员工管理支持 visibleMenus 配置与删除保护(不能删自己/最后超管) - SystemConfig 增加 inbox 功能开关及各类通知开关 Admin: - 员工管理:按角色默认菜单 + 可勾选可见菜单项 - ManageLayout:按 visibleMenus 过滤侧栏;充值待审数量角标轮询 - Contents:富文本编辑器、图片字段组件重构 - DashboardPlayers:展示在线玩家数;AdminPlayerStatusCell 在线状态列 - 多页面 i18n 与权限细节调整 Player: - 站内邮箱中心(InboxHub):消息列表/详情、未读角标、一键已读/删除 - 公告列表与详情页;走马灯可跳转详情 - 客服 Modal 改为 Panel,与邮箱 Hub 整合 - 充值状态轮询通知;presence 心跳;BetSlip 清空二次确认 - HomeView 今日赛事板块;FootballView 等体验优化 Shared: 新增 CANNOT_DELETE_SELF、STAFF_NOT_FOUND、MESSAGE_NOT_FOUND 等错误码 Docs: 玩家端缺失功能分析文档 Chore: 移除 .agents/skills 设计类 skill 文件 Co-authored-by: Cursor <cursoragent@cursor.com>
179 lines
3.7 KiB
Vue
179 lines
3.7 KiB
Vue
<script setup lang="ts">
|
||
import { computed, onActivated } from 'vue';
|
||
import { useRouter } from 'vue-router';
|
||
import { useI18n } from 'vue-i18n';
|
||
import { formatLocalMatchDateTime } from '@thebet365/shared';
|
||
import GoldSpinner from '../components/GoldSpinner.vue';
|
||
import { usePlayerHome } from '../composables/usePlayerHome';
|
||
import { stripHtml } from '../utils/html';
|
||
|
||
const router = useRouter();
|
||
const { t, locale } = useI18n();
|
||
const { announcementItems, loading, load } = usePlayerHome();
|
||
|
||
const items = computed(() => announcementItems.value);
|
||
|
||
function goBack() {
|
||
router.back();
|
||
}
|
||
|
||
function openDetail(id: string) {
|
||
router.push(`/announcements/${id}`);
|
||
}
|
||
|
||
function formatDate(createdAt?: string) {
|
||
if (!createdAt) return '';
|
||
return formatLocalMatchDateTime(createdAt, locale.value, { variant: 'full' });
|
||
}
|
||
|
||
function itemTitle(item: (typeof items.value)[number]) {
|
||
const title = item.translation?.title?.trim();
|
||
if (title) return title;
|
||
return stripHtml(item.translation?.body ?? '') || t('home.announcement_badge');
|
||
}
|
||
|
||
function itemPreview(item: (typeof items.value)[number]) {
|
||
const title = item.translation?.title?.trim();
|
||
const bodyText = stripHtml(item.translation?.body ?? '');
|
||
if (bodyText && bodyText !== title) return bodyText;
|
||
return '';
|
||
}
|
||
|
||
onActivated(() => {
|
||
void load(true);
|
||
});
|
||
</script>
|
||
|
||
<template>
|
||
<div class="announce-page">
|
||
<header class="page-header">
|
||
<button type="button" class="back-btn" :aria-label="t('announcements.back')" @click="goBack">‹</button>
|
||
<h1>{{ t('announcements.title') }}</h1>
|
||
</header>
|
||
|
||
<div v-if="loading && !items.length" class="state">
|
||
<GoldSpinner :size="36" />
|
||
</div>
|
||
|
||
<div v-else-if="!items.length" class="empty">
|
||
<p>{{ t('announcements.empty') }}</p>
|
||
</div>
|
||
|
||
<div v-else class="list">
|
||
<button
|
||
v-for="item in items"
|
||
:key="item.id"
|
||
type="button"
|
||
class="list-row"
|
||
@click="openDetail(item.id)"
|
||
>
|
||
<span class="row-main">
|
||
<span class="title">{{ itemTitle(item) }}</span>
|
||
<span v-if="itemPreview(item)" class="preview">{{ itemPreview(item) }}</span>
|
||
<span v-if="item.createdAt" class="date">{{ formatDate(item.createdAt) }}</span>
|
||
</span>
|
||
<span class="chevron" aria-hidden="true">›</span>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<style scoped>
|
||
.announce-page {
|
||
min-height: 100%;
|
||
padding: 0 0 24px;
|
||
}
|
||
|
||
.page-header {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 12px;
|
||
padding: 0 0 14px;
|
||
border-bottom: 1px solid var(--border);
|
||
margin-bottom: 0;
|
||
}
|
||
|
||
.back-btn {
|
||
width: 36px;
|
||
height: 36px;
|
||
border: 1px solid var(--border);
|
||
border-radius: 10px;
|
||
background: #141414;
|
||
color: var(--gold);
|
||
font-size: 22px;
|
||
line-height: 1;
|
||
}
|
||
|
||
.page-header h1 {
|
||
margin: 0;
|
||
font-size: 18px;
|
||
font-weight: 700;
|
||
color: #fff;
|
||
}
|
||
|
||
.state,
|
||
.empty {
|
||
display: flex;
|
||
justify-content: center;
|
||
padding: 48px 16px;
|
||
color: var(--text-muted);
|
||
}
|
||
|
||
.list {
|
||
display: flex;
|
||
flex-direction: column;
|
||
}
|
||
|
||
.list-row {
|
||
width: 100%;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 12px;
|
||
padding: 16px 0;
|
||
border: none;
|
||
border-bottom: 1px solid var(--border);
|
||
background: transparent;
|
||
text-align: left;
|
||
color: inherit;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.row-main {
|
||
flex: 1;
|
||
min-width: 0;
|
||
}
|
||
|
||
.title {
|
||
display: block;
|
||
font-size: 15px;
|
||
font-weight: 600;
|
||
color: #fff;
|
||
line-height: 1.4;
|
||
}
|
||
|
||
.preview {
|
||
display: block;
|
||
margin-top: 6px;
|
||
font-size: 13px;
|
||
line-height: 1.45;
|
||
color: var(--text-muted);
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.date {
|
||
display: block;
|
||
margin-top: 8px;
|
||
font-size: 12px;
|
||
color: var(--text-muted);
|
||
}
|
||
|
||
.chevron {
|
||
flex-shrink: 0;
|
||
font-size: 20px;
|
||
color: var(--text-muted);
|
||
line-height: 1;
|
||
}
|
||
</style>
|