diff --git a/src/components/cards/PluginCard.vue b/src/components/cards/PluginCard.vue index 2a4a3b82..e9489ac7 100644 --- a/src/components/cards/PluginCard.vue +++ b/src/components/cards/PluginCard.vue @@ -6,6 +6,7 @@ import api from '@/api' import type { Plugin } from '@/api/types' import FormRender from '@/components/render/FormRender.vue' import PageRender from '@/components/render/PageRender.vue' +import VersionHistory from '@/components/misc/VersionHistory.vue' import { isNullOrEmptyObject } from '@core/utils' import noImage from '@images/logos/plugin.png' import { getDominantColor } from '@/@core/utils/image' @@ -65,6 +66,9 @@ const isImageLoaded = ref(false) // 图片是否加载失败 const imageLoadError = ref(false) +// 更新日志弹窗 +const releaseDialog = ref(false) + // 监听动作标识,如为true则打开详情 watch(() => props.action, (newAction, oldAction) => { if (newAction && !oldAction) { @@ -81,6 +85,16 @@ async function imageLoaded() { backgroundColor.value = await getDominantColor(imageElement) } +// 显示更新日志 +function showUpdateHistory() { + // 检查当前版本是否有更新日志 + if (isNullOrEmptyObject(props.plugin?.history)) { + updatePlugin() + } else{ + releaseDialog.value = true + } +} + // 调用API卸载插件 async function uninstallPlugin() { const isConfirmed = await createConfirm({ @@ -251,6 +265,7 @@ async function resetPlugin() { // 更新插件 async function updatePlugin() { try { + releaseDialog.value = false // 显示等待提示框 progressDialog.value = true progressText.value = `正在更新 ${props.plugin?.plugin_name} ...` @@ -330,7 +345,7 @@ const dropdownItems = ref([ props: { prependIcon: 'mdi-arrow-up-circle-outline', color: 'success', - click: updatePlugin, + click: showUpdateHistory, }, }, { @@ -544,6 +559,30 @@ watch(() => props.plugin?.has_update, (newHasUpdate, oldHasUpdate) => { + + + + + {{ props.plugin?.plugin_name }} 更新说明 + + + + + 更新到最新版本 + + + +