feat(app): 添加重新生成应用配置文件功能
- 在AppController中新增regenerateConfigFile接口 - 在AppService中实现重新生成配置文件的业务逻辑 - 记录重新生成配置文件的操作日志 - 在前端API中添加重新生成功能调用方法 - 在应用详情页面添加重新生成按钮和确认对话框 - 实现重新生成配置文件的前端交互逻辑
这个提交包含在:
父节点
348c04ba72
当前提交
cd39c7fb30
@ -199,6 +199,9 @@ export const appApi = {
|
||||
downloadConfigFile: (appKey: string) =>
|
||||
client.get<Blob>(`/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 },
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
<el-descriptions-item label="简述" :span="2">{{ app.description ?? '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="Config 文件">
|
||||
<el-button size="small" type="primary" plain @click="downloadConfigFile">下载</el-button>
|
||||
<el-button size="small" plain @click="regenerateConfigFile" :loading="regenerating">重新生成</el-button>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-card>
|
||||
@ -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]
|
||||
|
||||
正在加载...
在新工单中引用
屏蔽一个用户