From a8db0519aeebdedc1023d0affa872e59134967ca Mon Sep 17 00:00:00 2001 From: XuqmGroup Date: Fri, 22 May 2026 18:38:17 +0800 Subject: [PATCH] feat(security-center): add license file parser - SecurityCenterView: add license file upload/parse card with ElUpload and ElDescriptions - appApi: add parseLicenseFile() calling POST /api/apps/license/parse Co-Authored-By: Claude Opus 4.7 --- tenant-platform/src/api/app.ts | 6 ++ .../src/views/security/SecurityCenterView.vue | 84 +++++++++++++++++++ 2 files changed, 90 insertions(+) diff --git a/tenant-platform/src/api/app.ts b/tenant-platform/src/api/app.ts index 5b59236..913e978 100644 --- a/tenant-platform/src/api/app.ts +++ b/tenant-platform/src/api/app.ts @@ -203,4 +203,10 @@ export const appApi = { client.post<{ data: null }>(`/apps/${appKey}/services/request-activation`, null, { params: { platform: 'ANDROID', serviceType, applyReason: reason }, }), + + parseLicenseFile: (content: string) => + client.post<{ data: { appKey: string; appName: string; packageName: string; iosBundleId: string; harmonyBundleName: string; baseUrl: string; serverUrl: string } }>( + '/apps/license/parse', + { content }, + ), } diff --git a/tenant-platform/src/views/security/SecurityCenterView.vue b/tenant-platform/src/views/security/SecurityCenterView.vue index bac8004..72a6ffe 100644 --- a/tenant-platform/src/views/security/SecurityCenterView.vue +++ b/tenant-platform/src/views/security/SecurityCenterView.vue @@ -67,6 +67,43 @@ + + + +

+ 上传已下载的 License 文件(.xuqmlicense),解析并验证文件内容。 +

+ +
+ + 选择 License 文件 + + 解析 + 清除 +
+ + {{ licenseParseResult.appKey }} + {{ licenseParseResult.appName || '-' }} + {{ licenseParseResult.packageName || '-' }} + {{ licenseParseResult.iosBundleId || '-' }} + {{ licenseParseResult.harmonyBundleName || '-' }} + {{ licenseParseResult.serverUrl || licenseParseResult.baseUrl || '-' }} + +
+ @@ -241,6 +278,53 @@ const selectedApp = ref(null) const dialogMode = ref<'REVEAL_SECRET' | 'RESET_SECRET'>('REVEAL_SECRET') const secretResult = ref('') +// License file parse +const licenseFileContent = ref('') +const parsingLicense = ref(false) +const licenseParseResult = ref<{ + appKey: string + appName: string + packageName: string + iosBundleId: string + harmonyBundleName: string + baseUrl: string + serverUrl: string +} | null>(null) +const licenseUploadRef = ref(null) + +function handleLicenseFileChange(file: any) { + const reader = new FileReader() + reader.onload = (e) => { + licenseFileContent.value = (e.target?.result as string) || '' + } + reader.readAsText(file.raw) +} + +async function parseLicense() { + if (!licenseFileContent.value.trim()) { + ElMessage.warning('请输入或上传 License 文件内容') + return + } + parsingLicense.value = true + try { + const res = await appApi.parseLicenseFile(licenseFileContent.value.trim()) + licenseParseResult.value = res.data.data + ElMessage.success('解析成功') + } catch (e: any) { + ElMessage.error(e?.response?.data?.message || '解析失败,请检查文件内容') + } finally { + parsingLicense.value = false + } +} + +function clearLicenseParse() { + licenseFileContent.value = '' + licenseParseResult.value = null + if (licenseUploadRef.value) { + licenseUploadRef.value.clearFiles() + } +} + async function loadData() { loading.value = true try {