diff --git a/tenant-platform/src/api/app.ts b/tenant-platform/src/api/app.ts index e5c5fae..7eaacd4 100644 --- a/tenant-platform/src/api/app.ts +++ b/tenant-platform/src/api/app.ts @@ -199,6 +199,9 @@ export const appApi = { downloadConfigFile: (appKey: string) => client.get(`/apps/${appKey}/config-file`, { responseType: 'blob' }), + regenerateConfigFile: (appKey: string) => + client.post<{ data: null }>(`/apps/${appKey}/config-file/regenerate`), + requestActivation: (appKey: string, serviceType: 'IM' | 'PUSH' | 'UPDATE' | 'LICENSE', reason: string) => client.post<{ data: null }>(`/apps/${appKey}/services/request-activation`, null, { params: { platform: 'ANDROID', serviceType, applyReason: reason }, diff --git a/tenant-platform/src/views/apps/AppDetailView.vue b/tenant-platform/src/views/apps/AppDetailView.vue index cc9979d..ad5b675 100644 --- a/tenant-platform/src/views/apps/AppDetailView.vue +++ b/tenant-platform/src/views/apps/AppDetailView.vue @@ -25,6 +25,7 @@ {{ app.description ?? '-' }} 下载 + 重新生成 @@ -240,6 +241,7 @@ const submittingVerify = ref(false) const showActivationDialog = ref(false) const submittingActivation = ref(false) const activationForm = ref({ platform: '', serviceType: '', reason: '' }) +const regenerating = ref(false) function isServiceEnabled(svcType: string) { return services.value.some(s => s.serviceType === svcType && s.enabled) @@ -369,6 +371,29 @@ async function downloadConfigFile() { URL.revokeObjectURL(url) } +async function regenerateConfigFile() { + const current = app.value + if (!current) return + try { + await ElMessageBox.confirm('重新生成后,旧的 Config 文件将失效,需要重新下载并替换到项目中。确定继续?', '重新生成 Config 文件', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + }) + } catch { + return + } + regenerating.value = true + try { + await appApi.regenerateConfigFile(current.appKey) + ElMessage.success('Config 文件已重新生成,请重新下载') + } catch (e: any) { + ElMessage.error(e?.response?.data?.message || '重新生成失败') + } finally { + regenerating.value = false + } +} + function parseFilename(disposition?: string) { if (!disposition) return null const encoded = disposition.match(/filename\*=UTF-8''([^;]+)/i)?.[1]