sync(theme-2): 同步 main 最新 API/Admin 与玩家端逻辑
从 main 同步站内信手动发送、媒体库选择、列表子路由重构等 API/Admin 改动;玩家端仅合并 ADMIN_CUSTOM 富文本、消息预览与充值截图压缩逻辑,保留 theme-2 样式。
This commit is contained in:
@@ -16,11 +16,23 @@ import {
|
||||
} from '../match-form';
|
||||
import AdminSubNav from '../../components/AdminSubNav.vue';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
matchIdProp?: string;
|
||||
embedded?: boolean;
|
||||
}>(),
|
||||
{ embedded: false },
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
saved: [];
|
||||
}>();
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const { t } = useAdminLocale();
|
||||
|
||||
const matchId = computed(() => String(route.params.matchId ?? ''));
|
||||
const matchId = computed(() => props.matchIdProp ?? String(route.params.matchId ?? ''));
|
||||
const loading = ref(false);
|
||||
const savingMeta = ref(false);
|
||||
const status = ref('DRAFT');
|
||||
@@ -52,7 +64,7 @@ async function load() {
|
||||
const detail = data.data as AdminMatchDetail;
|
||||
if (detail.isOutright) {
|
||||
ElMessage.warning(t('msg.outright_no_edit'));
|
||||
router.replace('/matches');
|
||||
if (!props.embedded) router.replace('/matches');
|
||||
return;
|
||||
}
|
||||
status.value = detail.status;
|
||||
@@ -81,7 +93,8 @@ async function saveMeta() {
|
||||
try {
|
||||
await api.put(`/admin/matches/${matchId.value}`, payload);
|
||||
ElMessage.success(t('msg.saved'));
|
||||
await load();
|
||||
emit('saved');
|
||||
if (!props.embedded) await load();
|
||||
} catch (e: unknown) {
|
||||
const err = e as { response?: { data?: { error?: string } } };
|
||||
ElMessage.error(err.response?.data?.error ?? t('msg.save_failed'));
|
||||
@@ -92,8 +105,13 @@ async function saveMeta() {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-loading="loading" class="match-editor-page page-scroll">
|
||||
<div
|
||||
v-loading="loading"
|
||||
class="match-editor-page"
|
||||
:class="{ 'match-editor-page--embedded': embedded, 'page-scroll': !embedded }"
|
||||
>
|
||||
<AdminSubNav
|
||||
v-if="!embedded"
|
||||
:title="t('matchEditor.title')"
|
||||
:subtitle="`#${matchId}`"
|
||||
>
|
||||
@@ -257,6 +275,12 @@ async function saveMeta() {
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.match-editor-page--embedded {
|
||||
padding-bottom: 0;
|
||||
max-height: min(78vh, 880px);
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.panel {
|
||||
background: #ffffff;
|
||||
border: 1px solid var(--border);
|
||||
|
||||
Reference in New Issue
Block a user