From 0b0e004c2e8f5f94a01d77ab4501f7c055cfa811 Mon Sep 17 00:00:00 2001 From: XuqmGroup Date: Fri, 26 Jun 2026 14:27:06 +0800 Subject: [PATCH] =?UTF-8?q?feat(push-config):=20=E5=8E=82=E5=95=86?= =?UTF-8?q?=E5=87=AD=E6=8D=AE=E4=B8=8E=20Profiles=20=E5=88=86=E5=88=AB?= =?UTF-8?q?=E7=8B=AC=E7=AB=8B=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 厂商凭据卡片 header 右侧增加「保存凭据」按钮 - Profiles 卡片底部保留「保存 Profiles」按钮 - 拆分 saving 为 savingVendors / savingProfiles,加载状态独立 Co-Authored-By: Claude Sonnet 4.6 --- .../src/views/push/PushConfigView.vue | 67 +++++++++++++------ 1 file changed, 45 insertions(+), 22 deletions(-) diff --git a/tenant-platform/src/views/push/PushConfigView.vue b/tenant-platform/src/views/push/PushConfigView.vue index 46ff195..f6d7697 100644 --- a/tenant-platform/src/views/push/PushConfigView.vue +++ b/tenant-platform/src/views/push/PushConfigView.vue @@ -34,7 +34,12 @@ - +
@@ -194,7 +199,7 @@
刷新 - 保存配置 + 保存 Profiles
@@ -261,7 +266,8 @@ const route = useRoute() const app = ref(null) const services = ref([]) const loading = ref(false) -const saving = ref(false) +const savingVendors = ref(false) +const savingProfiles = ref(false) const isMobile = ref(window.innerWidth < 768) const selectedPlatform = ref<'ANDROID' | 'IOS' | 'HARMONY'>('ANDROID') @@ -535,31 +541,48 @@ function applySelectedPlatformConfig() { replaceState(parseConfig(raw)) } -async function saveConfig() { +function buildPayload(): PushServiceConfig { + return { + schemaVersion: 2, + updatedAt: new Date().toISOString(), + vendors: { + huawei: { ...pushConfig.vendors.huawei }, + xiaomi: { ...pushConfig.vendors.xiaomi }, + oppo: { ...pushConfig.vendors.oppo }, + vivo: { ...pushConfig.vendors.vivo }, + honor: { ...pushConfig.vendors.honor }, + harmony: { ...pushConfig.vendors.harmony }, + apns: { ...pushConfig.vendors.apns }, + }, + profiles: pushConfig.profiles.map(profile => normalizeProfile(profile)), + } +} + +async function saveVendors() { if (!app.value) return - saving.value = true + savingVendors.value = true try { - const payload: PushServiceConfig = { - schemaVersion: 2, - updatedAt: new Date().toISOString(), - vendors: { - huawei: { ...pushConfig.vendors.huawei }, - xiaomi: { ...pushConfig.vendors.xiaomi }, - oppo: { ...pushConfig.vendors.oppo }, - vivo: { ...pushConfig.vendors.vivo }, - honor: { ...pushConfig.vendors.honor }, - harmony: { ...pushConfig.vendors.harmony }, - apns: { ...pushConfig.vendors.apns }, - }, - profiles: pushConfig.profiles.map(profile => normalizeProfile(profile)), - } - await appApi.updateServiceConfig(app.value.appKey, selectedPlatform.value, 'PUSH', { pushConfig: payload }) - ElMessage.success('推送配置已保存') + await appApi.updateServiceConfig(app.value.appKey, selectedPlatform.value, 'PUSH', { pushConfig: buildPayload() }) + ElMessage.success('厂商凭据已保存') await loadData() } catch { ElMessage.error('保存失败') } finally { - saving.value = false + savingVendors.value = false + } +} + +async function saveProfiles() { + if (!app.value) return + savingProfiles.value = true + try { + await appApi.updateServiceConfig(app.value.appKey, selectedPlatform.value, 'PUSH', { pushConfig: buildPayload() }) + ElMessage.success('Profiles 已保存') + await loadData() + } catch { + ElMessage.error('保存失败') + } finally { + savingProfiles.value = false } }