feat(frontend): 重构登录页面并新增插件强制更新功能
- 替换登录页面为极光背景玻璃拟态设计,移除注册/忘记密码页面 - 新增插件强制更新功能,支持设置最低版本和截止时间 - 修复通知账号选择占位文本和拉取失败注释 - 新增审计日志系统用户相关操作类型 - 新增用户菜单头像 fallback 逻辑 - 重构 XQ0037 工作簿写入逻辑,改用 openpyxl 直写避免时区问题 - 更新 XQ0034 脚本参数默认值和注释
This commit is contained in:
@@ -71,6 +71,50 @@ async function setStatus(row: any, status: string) {
|
||||
load()
|
||||
}
|
||||
|
||||
// ---- 强制更新 ----
|
||||
const forceOpen = ref(false)
|
||||
const forceSaving = ref(false)
|
||||
const forceForm = reactive({ plugin_id: '', force_min_version: '', force_deadline: '' })
|
||||
|
||||
function openForce(row: any) {
|
||||
Object.assign(forceForm, {
|
||||
plugin_id: row.id,
|
||||
force_min_version: row.force_min_version || '',
|
||||
force_deadline: row.force_deadline || ''
|
||||
})
|
||||
forceOpen.value = true
|
||||
}
|
||||
|
||||
async function submitForce() {
|
||||
if (!forceForm.force_min_version || !forceForm.force_deadline) {
|
||||
ElMessage.warning('最低版本与截止时间必须同时填写')
|
||||
return
|
||||
}
|
||||
forceSaving.value = true
|
||||
try {
|
||||
await patchPlugin(forceForm.plugin_id, {
|
||||
force_min_version: forceForm.force_min_version,
|
||||
force_deadline: forceForm.force_deadline
|
||||
})
|
||||
ElMessage.success(`已设置强制更新:低于 v${forceForm.force_min_version} 的执行机将在截止时间前强制升级`)
|
||||
forceOpen.value = false
|
||||
load()
|
||||
} finally {
|
||||
forceSaving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function clearForce(row: any) {
|
||||
await ElMessageBox.confirm(`清除插件「${row.id}」的强制更新设置?`, '确认', { type: 'warning' })
|
||||
await patchPlugin(row.id, { clear_force: true })
|
||||
ElMessage.success('已清除强制更新')
|
||||
load()
|
||||
}
|
||||
|
||||
function fmtDeadline(s: string): string {
|
||||
return String(s || '').replace('T', ' ').slice(0, 16)
|
||||
}
|
||||
|
||||
// ---- 删除 ----
|
||||
async function remove(row: any) {
|
||||
await ElMessageBox.confirm(`确认删除插件「${row.id}」?将连带删除版本与授权。`, '删除确认', {
|
||||
@@ -119,7 +163,7 @@ onMounted(load)
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="版本历史" width="220">
|
||||
<el-table-column label="版本历史" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tooltip v-if="row.versions?.length" :content="row.versions.map((v: any) => v.version).join(', ')">
|
||||
<el-tag size="small" type="info">{{ row.versions.length }} 个版本</el-tag>
|
||||
@@ -127,7 +171,20 @@ onMounted(load)
|
||||
<span v-else class="text-gray-400">-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="220" fixed="right">
|
||||
<el-table-column label="强制更新" min-width="170">
|
||||
<template #default="{ row }">
|
||||
<el-tooltip
|
||||
v-if="row.force_min_version"
|
||||
:content="`低于 v${row.force_min_version} 的执行机须在 ${fmtDeadline(row.force_deadline)} 前完成升级`"
|
||||
>
|
||||
<el-tag size="small" type="danger" effect="light">
|
||||
≥v{{ row.force_min_version }} · 至 {{ fmtDeadline(row.force_deadline) }}
|
||||
</el-tag>
|
||||
</el-tooltip>
|
||||
<span v-else class="text-gray-300 text-xs">未设置</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="250" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
v-if="row.status === 'disabled'"
|
||||
@@ -144,6 +201,8 @@ onMounted(load)
|
||||
link type="danger"
|
||||
@click="setStatus(row, 'revoked')"
|
||||
>下架</el-button>
|
||||
<el-button link type="warning" @click="openForce(row)">强制更新</el-button>
|
||||
<el-button v-if="row.force_min_version" link type="info" @click="clearForce(row)">清除</el-button>
|
||||
<el-button link type="danger" @click="remove(row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -180,5 +239,31 @@ onMounted(load)
|
||||
<el-button type="primary" :loading="uploading" @click="submitUpload">发布</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<!-- 强制更新弹窗 -->
|
||||
<el-dialog v-model="forceOpen" :title="`强制更新 — ${forceForm.plugin_id}`" width="480px">
|
||||
<el-form label-width="100px">
|
||||
<el-form-item label="最低版本" required>
|
||||
<el-input v-model="forceForm.force_min_version" placeholder="如 1.3.0(低于该版本将强制升级)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="截止时间" required>
|
||||
<el-date-picker
|
||||
v-model="forceForm.force_deadline"
|
||||
type="datetime"
|
||||
placeholder="选择强制升级截止时间"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<div class="px-1 text-xs text-gray-400 leading-5">
|
||||
设置后:客户端 /api/plugins 将下发 force_min_version 与 force_deadline,
|
||||
执行机壳子对低于最低版本的插件在截止时间前强制升级(旧版本不可继续运行)。
|
||||
</div>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="forceOpen = false">取消</el-button>
|
||||
<el-button type="primary" :loading="forceSaving" @click="submitForce">设置</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user