fix(push-config): 修复厂商凭据无法回显问题
- 添加 getServiceItem API,按平台精确查询推送服务配置(/services/item) - applySelectedPlatformConfig 改用精确接口而非列表,避免 listByApp 只返回第一条 PUSH 服务(IOS)导致 ANDROID 配置加载为空的问题 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
这个提交包含在:
父节点
549d4ca3c1
当前提交
1b3c94603a
@ -170,6 +170,11 @@ export const appApi = {
|
|||||||
} as typeof res & { data: { data: FeatureService } }
|
} as typeof res & { data: { data: FeatureService } }
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getServiceItem: (appKey: string, platform: string, serviceType: string) =>
|
||||||
|
client.get<{ data: FeatureService }>(`/apps/${appKey}/services/item`, {
|
||||||
|
params: { platform, serviceType },
|
||||||
|
}),
|
||||||
|
|
||||||
toggleService: (appKey: string, platform: string, serviceType: string, enable: boolean) =>
|
toggleService: (appKey: string, platform: string, serviceType: string, enable: boolean) =>
|
||||||
client.post<{ data: FeatureService }>(`/apps/${appKey}/services/toggle`, null, {
|
client.post<{ data: FeatureService }>(`/apps/${appKey}/services/toggle`, null, {
|
||||||
params: { platform, serviceType, enable },
|
params: { platform, serviceType, enable },
|
||||||
|
|||||||
@ -528,17 +528,21 @@ async function loadData() {
|
|||||||
services.value = svcRes.data.data
|
services.value = svcRes.data.data
|
||||||
// Always default to ANDROID on load; user can switch via the platform selector
|
// Always default to ANDROID on load; user can switch via the platform selector
|
||||||
selectedPlatform.value = 'ANDROID'
|
selectedPlatform.value = 'ANDROID'
|
||||||
applySelectedPlatformConfig()
|
await applySelectedPlatformConfig()
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function applySelectedPlatformConfig() {
|
async function applySelectedPlatformConfig() {
|
||||||
const raw = services.value.find(
|
if (!app.value) return
|
||||||
s => s.serviceType === 'PUSH' && s.platform === selectedPlatform.value,
|
try {
|
||||||
)?.config
|
const res = await appApi.getServiceItem(app.value.appKey, selectedPlatform.value, 'PUSH')
|
||||||
replaceState(parseConfig(raw))
|
replaceState(parseConfig(res.data.data?.config))
|
||||||
|
} catch {
|
||||||
|
// 该平台尚无配置,清空表单
|
||||||
|
replaceState(parseConfig(null))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildPayload(): PushServiceConfig {
|
function buildPayload(): PushServiceConfig {
|
||||||
|
|||||||
正在加载...
在新工单中引用
屏蔽一个用户