diff --git a/tenant-platform/src/api/app.ts b/tenant-platform/src/api/app.ts index 7eaacd4..8b50b31 100644 --- a/tenant-platform/src/api/app.ts +++ b/tenant-platform/src/api/app.ts @@ -3,7 +3,7 @@ import client from './client' export interface App { id: string tenantId: string - packageName: string + packageName?: string iosBundleId?: string harmonyBundleName?: string name: string @@ -15,7 +15,7 @@ export interface App { } export interface CreateAppRequest { - packageName: string + packageName?: string iosBundleId?: string harmonyBundleName?: string name: string diff --git a/tenant-platform/src/views/apps/AppDetailView.vue b/tenant-platform/src/views/apps/AppDetailView.vue index ad5b675..5fad9e0 100644 --- a/tenant-platform/src/views/apps/AppDetailView.vue +++ b/tenant-platform/src/views/apps/AppDetailView.vue @@ -3,11 +3,17 @@ + {{ app.name }} {{ app.packageName }} - {{ app.iosBundleId ?? '-' }} - {{ app.harmonyBundleName ?? '-' }} + {{ app.iosBundleId || '-' }} + {{ app.harmonyBundleName || '-' }} {{ app.appKey }} @@ -22,7 +28,7 @@ 重置 - {{ app.description ?? '-' }} + {{ app.description || '-' }} 下载 重新生成 @@ -193,6 +199,35 @@ + + + + + + + + + + + + + + + + + + + + + + +
至少填写一个平台的包名
+ +
+ @@ -243,6 +278,59 @@ const submittingActivation = ref(false) const activationForm = ref({ platform: '', serviceType: '', reason: '' }) const regenerating = ref(false) +const showEditDialog = ref(false) +const savingEdit = ref(false) +const editForm = ref({ + name: '', + packageName: '', + iosBundleId: '', + harmonyBundleName: '', + description: '', + iconUrl: '', +}) + +function openEditDialog() { + if (!app.value) return + editForm.value = { + name: app.value.name || '', + packageName: app.value.packageName || '', + iosBundleId: app.value.iosBundleId || '', + harmonyBundleName: app.value.harmonyBundleName || '', + description: app.value.description || '', + iconUrl: app.value.iconUrl || '', + } + showEditDialog.value = true +} + +async function submitEdit() { + if (!editForm.value.name.trim()) { + ElMessage.warning('应用名称不能为空') + return + } + if (!editForm.value.packageName.trim() && !editForm.value.iosBundleId.trim() && !editForm.value.harmonyBundleName.trim()) { + ElMessage.warning('至少填写一个平台的包名') + return + } + savingEdit.value = true + try { + await appApi.update(app.value!.appKey, { + packageName: editForm.value.packageName.trim() || undefined, + name: editForm.value.name.trim(), + iosBundleId: editForm.value.iosBundleId.trim() || undefined, + harmonyBundleName: editForm.value.harmonyBundleName.trim() || undefined, + description: editForm.value.description.trim() || undefined, + iconUrl: editForm.value.iconUrl.trim() || undefined, + }) + ElMessage.success('应用信息已更新') + showEditDialog.value = false + await loadData() + } catch (e: any) { + ElMessage.error(e?.response?.data?.message || '保存失败') + } finally { + savingEdit.value = false + } +} + function isServiceEnabled(svcType: string) { return services.value.some(s => s.serviceType === svcType && s.enabled) } @@ -435,6 +523,7 @@ onBeforeUnmount(() => {