sync(theme-4): 从 main 同步优胜赛结算态与钱包流水展示优化
- checkout shared/api/admin 自 d3c2114
- player: outright 结算态逻辑、wallet txAmountClass、i18n 新增 key(保留海军蓝主题样式)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, h, defineAsyncComponent } from 'vue';
|
||||
import { ref, watch, h, defineAsyncComponent, onActivated } from 'vue';
|
||||
import { consumeAdminListStale } from '../../utils/adminListStale';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { ElMessage, ElMessageBox, ElDatePicker } from 'element-plus';
|
||||
import { useAdminLocale } from '../../composables/useAdminLocale';
|
||||
@@ -32,6 +33,7 @@ const props = withDefaults(
|
||||
const emit = defineEmits<{
|
||||
changed: [];
|
||||
'add-match': [];
|
||||
'league-meta': [meta: { isOutrightSettled: boolean }];
|
||||
}>();
|
||||
|
||||
const { t, locale } = useAdminLocale();
|
||||
@@ -99,8 +101,8 @@ function resetFilters() {
|
||||
onFilterChange();
|
||||
}
|
||||
|
||||
async function load() {
|
||||
loading.value = true;
|
||||
async function load(options: { silent?: boolean } = {}) {
|
||||
if (!options.silent) loading.value = true;
|
||||
try {
|
||||
const { data } = await api.get(`/admin/leagues/${props.leagueId}/matches`, {
|
||||
params: {
|
||||
@@ -124,19 +126,31 @@ async function load() {
|
||||
total: number;
|
||||
page: number;
|
||||
pageSize: number;
|
||||
league?: { isOutrightSettled?: boolean };
|
||||
};
|
||||
matches.value = payload.items;
|
||||
matchTotal.value = payload.total;
|
||||
emit('league-meta', {
|
||||
isOutrightSettled: Boolean(payload.league?.isOutrightSettled),
|
||||
});
|
||||
matchPage.value = payload.page;
|
||||
matchPageSize.value = payload.pageSize;
|
||||
} catch (e: unknown) {
|
||||
const err = e as { response?: { data?: { error?: string } } };
|
||||
ElMessage.error(err.response?.data?.error ?? t('msg.load_matches_failed'));
|
||||
} finally {
|
||||
loading.value = false;
|
||||
if (!options.silent) loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
onActivated(() => {
|
||||
if (!props.leagueId) return;
|
||||
const stale = consumeAdminListStale();
|
||||
if (stale || matches.value.length > 0) {
|
||||
void load({ silent: !stale && matches.value.length > 0 });
|
||||
}
|
||||
});
|
||||
|
||||
function scheduleLoad(resetPage = false) {
|
||||
if (!props.leagueId) return;
|
||||
if (resetPage) matchPage.value = 1;
|
||||
|
||||
Reference in New Issue
Block a user