fix(push-config): 按平台过滤厂商凭据展示

切换平台时只展示对应平台的厂商:
- Android:小米、华为、荣耀、OPPO、VIVO
- iOS:APNs
- HarmonyOS:鸿蒙 Push Kit

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
这个提交包含在:
XuqmGroup 2026-06-26 14:23:17 +08:00
父节点 43d6215e10
当前提交 43a4e29ae5

查看文件

@ -36,7 +36,7 @@
<el-card style="margin-bottom:16px">
<template #header>厂商凭据</template>
<div class="vendor-grid">
<el-card v-for="vendor in vendorDefs" :key="vendor.key" shadow="never" class="vendor-card">
<el-card v-for="vendor in filteredVendorDefs" :key="vendor.key" shadow="never" class="vendor-card">
<template #header>{{ vendor.label }}</template>
<div class="vendor-hint">{{ vendor.hint }}</div>
<el-form :label-position="isMobile ? 'top' : 'right'" label-width="110px">
@ -201,7 +201,7 @@
</template>
<script setup lang="ts">
import { onBeforeUnmount, onMounted, reactive, ref } from 'vue'
import { computed, onBeforeUnmount, onMounted, reactive, ref } from 'vue'
import { useRoute } from 'vue-router'
import { CopyDocument } from '@element-plus/icons-vue'
import { ElMessage } from 'element-plus'
@ -247,6 +247,7 @@ type VendorDef = {
label: string
hint: string
fields: FieldDef[]
platforms: Array<'ANDROID' | 'IOS' | 'HARMONY'>
}
type PushConfigState = {
@ -317,6 +318,7 @@ const vendorDefs: VendorDef[] = [
key: 'xiaomi',
label: '小米 MiPush',
hint: '这里仅填写厂商凭据。Channel ID 放在 profiles 中按场景单独配置,支持后续补充或删除。',
platforms: ['ANDROID'],
fields: [
{ key: 'appId', label: 'AppId' },
{ key: 'appKey', label: 'AppKey' },
@ -327,6 +329,7 @@ const vendorDefs: VendorDef[] = [
key: 'huawei',
label: '华为 HMS',
hint: '仅保留厂商账号信息。Category、Channel ID、重要性等由 profiles 负责。',
platforms: ['ANDROID'],
fields: [
{ key: 'appId', label: 'AppId' },
{ key: 'appSecret', label: 'AppSecret' },
@ -336,6 +339,7 @@ const vendorDefs: VendorDef[] = [
key: 'honor',
label: '荣耀 Push',
hint: '荣耀账号凭据。业务场景与展示策略在 profiles 中配置。',
platforms: ['ANDROID'],
fields: [
{ key: 'appId', label: 'AppId' },
{ key: 'clientId', label: 'ClientId' },
@ -346,6 +350,7 @@ const vendorDefs: VendorDef[] = [
key: 'oppo',
label: 'OPPO 推送',
hint: '仅保留 AppKey / MasterSecret。通道配置与优先级在 profiles 中维护。',
platforms: ['ANDROID'],
fields: [
{ key: 'appId', label: 'AppId' },
{ key: 'appKey', label: 'AppKey' },
@ -356,6 +361,7 @@ const vendorDefs: VendorDef[] = [
key: 'vivo',
label: 'vivo 推送',
hint: '厂商凭据与业务分类分离。classification 由 profiles 的 Category 驱动。',
platforms: ['ANDROID'],
fields: [
{ key: 'appId', label: 'AppId' },
{ key: 'appKey', label: 'AppKey' },
@ -366,6 +372,7 @@ const vendorDefs: VendorDef[] = [
key: 'harmony',
label: '鸿蒙 Push Kit',
hint: '鸿蒙厂商凭据。需要的 Category / Channel ID 放到 profiles 中。',
platforms: ['HARMONY'],
fields: [
{ key: 'appId', label: 'AppId' },
{ key: 'appSecret', label: 'AppSecret' },
@ -375,6 +382,7 @@ const vendorDefs: VendorDef[] = [
key: 'apns',
label: 'iOS APNs',
hint: 'Team ID / Key ID / Bundle ID / 私钥统一放这里。Badge、Thread ID、Interruption Level 放在 profiles 中。',
platforms: ['IOS'],
fields: [
{ key: 'teamId', label: 'Team ID' },
{ key: 'keyId', label: 'Key ID' },
@ -385,6 +393,10 @@ const vendorDefs: VendorDef[] = [
},
]
const filteredVendorDefs = computed(() =>
vendorDefs.filter(v => v.platforms.includes(selectedPlatform.value)),
)
function updateViewport() {
isMobile.value = window.innerWidth < 768
}