Files
ai-gateway-go/web/apps/admin/src/views/system/license/index.vue
T
superidou c22669c31d 0.11.0: 旗舰版功能补齐(License/登录记录/会话管理/角色管理/门户定时任务/模型配额/输出脱敏/供应链扫描/记忆管理/AI助手/真实概览)
- 新增迁移 000031-000034(登录日志/角色/模型配额/记忆)
- 新增包: license/memory/modelquota/assistant,扫描引擎
- 全部功能后端+前端+端到端验证通过(25 包单测)
2026-08-13 11:37:18 +08:00

110 lines
3.4 KiB
Vue

<template>
<div class="page-content">
<div class="mb-5 flex items-center justify-between gap-4">
<div>
<h2 class="text-xl font-semibold">License 授权</h2>
<p class="text-g-500 mt-1 text-sm">平台版本账号数上限与授权有效期管控</p>
</div>
<ElButton type="primary" :loading="uploading" @click="openUpload">上传 License</ElButton>
</div>
<ElAlert
v-if="!info.licensed"
class="mb-4"
type="warning"
:closable="false"
title="当前为社区版 Free(账号上限 3 个)。上传有效 License 后可启用专业版/旗舰版能力与更多账号。"
/>
<ElDescriptions v-loading="loading" :column="2" border class="mb-4">
<ElDescriptionsItem label="当前版本">{{ info.edition_name }}</ElDescriptionsItem>
<ElDescriptionsItem label="版本标识">{{ info.edition }}</ElDescriptionsItem>
<ElDescriptionsItem label="授权对象">{{ info.issued_to || '—' }}</ElDescriptionsItem>
<ElDescriptionsItem label="账号数上限">
{{ info.max_accounts === 0 ? '不限' : info.max_accounts + ' 个' }}
</ElDescriptionsItem>
<ElDescriptionsItem label="有效期至">{{ info.expires }}</ElDescriptionsItem>
<ElDescriptionsItem label="License 文件">{{ info.file || '未配置' }}</ElDescriptionsItem>
<ElDescriptionsItem label="授权特性" :span="2">
{{ info.features?.length ? info.features.join('、') : '—' }}
</ElDescriptionsItem>
</ElDescriptions>
<ElDialog v-model="dialogVisible" title="上传 License" width="560px">
<ElInput
v-model="content"
type="textarea"
:rows="10"
placeholder="粘贴 License 文件完整内容(JSON,含 signature 字段)"
/>
<template #footer>
<ElButton @click="dialogVisible = false">取消</ElButton>
<ElButton type="primary" :loading="uploading" @click="submit">保存并生效</ElButton>
</template>
</ElDialog>
</div>
</template>
<script setup lang="ts">
import { ElMessage, ElMessageBox } from 'element-plus'
import request from '@/utils/http'
interface LicenseInfo {
edition: string
edition_name: string
issued_to?: string
max_accounts: number
features: string[]
expires: string
file: string
licensed: boolean
}
const loading = ref(false)
const uploading = ref(false)
const dialogVisible = ref(false)
const content = ref('')
const info = ref<LicenseInfo>({
edition: 'free',
edition_name: '社区版 Free',
max_accounts: 3,
features: [],
expires: '永久',
file: '',
licensed: false
})
async function load() {
loading.value = true
try {
info.value = await request.get<LicenseInfo>({ url: '/api/v1/admin/license' })
} finally {
loading.value = false
}
}
function openUpload() {
content.value = ''
dialogVisible.value = true
}
async function submit() {
if (!content.value.trim()) {
ElMessage.warning('请粘贴 License 内容')
return
}
uploading.value = true
try {
const result = await request.post<LicenseInfo>({ url: '/api/v1/admin/license', params: { content: content.value } })
info.value = result
dialogVisible.value = false
ElMessage.success('License 已生效')
await load()
} finally {
uploading.value = false
}
}
onMounted(load)
</script>