feat(app-detail): 下载 license 文件移至应用信息卡片,附 SDK 接入引导
- 授权管理页不再显示下载入口 - 应用信息卡片新增 "SDK 接入文件" 行(LICENSE 开通后可见), 包含下载按钮和 autoInitialize 使用说明 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
这个提交包含在:
父节点
ef0876fc5d
当前提交
3c98850a36
@ -23,6 +23,15 @@
|
||||
<el-button link type="warning" @click="openVerifyDialog('RESET_SECRET')">重置</el-button>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="简述" :span="2">{{ app.description ?? '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item v-if="isServiceEnabled('LICENSE')" label="SDK 接入文件" :span="2">
|
||||
<div style="display:flex;align-items:center;gap:12px;flex-wrap:wrap">
|
||||
<span style="color:#6b7280;font-size:13px">
|
||||
将 license 文件放入应用的 <code style="background:#f3f4f6;padding:1px 5px;border-radius:3px">assets/xuqm/</code> 目录,
|
||||
调用 <code style="background:#f3f4f6;padding:1px 5px;border-radius:3px">XuqmSDK.autoInitialize(context)</code> 即可完成初始化
|
||||
</span>
|
||||
<el-button size="small" type="primary" @click="downloadLicenseFile">下载 license.xuqm</el-button>
|
||||
</div>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-card>
|
||||
|
||||
@ -154,9 +163,6 @@
|
||||
<el-button v-if="isServiceEnabled('LICENSE')" size="small" type="primary" plain @click="$router.push(`/apps/${app.appKey}/license`)">
|
||||
授权管理 →
|
||||
</el-button>
|
||||
<el-button v-if="isServiceEnabled('LICENSE')" size="small" @click="downloadLicenseFile">
|
||||
下载 License 文件
|
||||
</el-button>
|
||||
<el-button v-else size="small" type="primary" plain @click="openActivationRequest('LICENSE')">
|
||||
申请开通
|
||||
</el-button>
|
||||
|
||||
@ -70,7 +70,6 @@
|
||||
</div>
|
||||
|
||||
<div class="toolbar responsive-toolbar">
|
||||
<el-button v-if="appKey" @click="downloadLicenseFile">下载 License 文件</el-button>
|
||||
<el-button @click="loadData" :loading="loading">刷新</el-button>
|
||||
</div>
|
||||
|
||||
@ -230,30 +229,6 @@ async function reactivateDevice(row: LicenseDevice) {
|
||||
loadData()
|
||||
}
|
||||
|
||||
async function downloadLicenseFile() {
|
||||
const key = appKey.value
|
||||
if (!key) return
|
||||
const res = await appApi.downloadLicenseFile(key)
|
||||
const disposition = res.headers['content-disposition'] as string | undefined
|
||||
const filename = parseFilename(disposition) ?? `${appName.value || key}.xuqmlicense`
|
||||
const url = URL.createObjectURL(res.data)
|
||||
const link = document.createElement('a')
|
||||
link.href = url
|
||||
link.download = filename
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
link.remove()
|
||||
URL.revokeObjectURL(url)
|
||||
}
|
||||
|
||||
function parseFilename(disposition?: string) {
|
||||
if (!disposition) return null
|
||||
const encoded = disposition.match(/filename\*=UTF-8''([^;]+)/i)?.[1]
|
||||
if (encoded) return decodeURIComponent(encoded)
|
||||
const plain = disposition.match(/filename="?([^";]+)"?/i)?.[1]
|
||||
return plain ? decodeURIComponent(plain) : null
|
||||
}
|
||||
|
||||
async function checkServiceEnabled(key: string) {
|
||||
checkingService.value = true
|
||||
serviceEnabled.value = null
|
||||
|
||||
正在加载...
在新工单中引用
屏蔽一个用户