From 02cea41a0b989340deaa72bb7ae686a530bd57ad Mon Sep 17 00:00:00 2001 From: rd <1344903914@qq.com> Date: Mon, 14 Jul 2025 17:39:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8D=A1=E7=89=87loading?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/account-table/index.vue | 12 ++++++------ .../media-account/account-manage/index.vue | 10 +++++++--- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/views/property-marketing/media-account/account-manage/components/account-table/index.vue b/src/views/property-marketing/media-account/account-manage/components/account-table/index.vue index 9f13f9f..70b4fe2 100644 --- a/src/views/property-marketing/media-account/account-manage/components/account-table/index.vue +++ b/src/views/property-marketing/media-account/account-manage/components/account-table/index.vue @@ -175,10 +175,10 @@ const toggleSelect = (item) => { emits('selectionChange', newSelected); }; const isSyncing = (item) => { - if (!props.selectedItems.length) return false; + if (!props.syncMediaAccounts.length) return false; - const target = props.selectedItems.find((v) => v.id === item.id); - return target.status === 0; + const target = props.syncMediaAccounts.find((v) => v.id === item.id); + return target?.status === 0; }; const openEdit = (item) => { @@ -223,9 +223,9 @@ const isAbnormalStatus = (status) => { ].includes(status); }; -const getTooltipText = (status) => { - return STATUS_LIST.find((v) => v.value === status)?.tooltip ?? '-'; -}; +// const getTooltipText = (status) => { +// return STATUS_LIST.find((v) => v.value === status)?.tooltip ?? '-'; +// }; const syncData = inject('handleSyncData'); diff --git a/src/views/property-marketing/media-account/account-manage/index.vue b/src/views/property-marketing/media-account/account-manage/index.vue index fa0c62d..efb4ec5 100644 --- a/src/views/property-marketing/media-account/account-manage/index.vue +++ b/src/views/property-marketing/media-account/account-manage/index.vue @@ -282,20 +282,24 @@ const startSyncDataPolling = () => { startSyncData.value = true; clearSyncDataTimer(); - syncDataTimer = setInterval(async () => { + // 先立即执行一次 + const poll = async () => { const { code, data } = await getMediaAccountSyncStatus(); if (code === 200) { syncMediaAccounts.value = data; + + console.log('poll', syncMediaAccounts.value); // 所有任务都结束了,才停止轮询,刷新页面 const isEnd = data.every((item) => item.status !== 0); if (isEnd) { clearSyncDataTimer(); startSyncData.value = false; - getData(); } } - }, 5000); + }; + poll(); + syncDataTimer = setInterval(poll, 3000); }; const handleSyncData = async (item) => {