From c6127f440e6a2b2411d5b15089fdd10781af42f7 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Sat, 13 Apr 2024 18:36:01 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E6=9B=B4=E6=96=B0=E6=97=B6=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B=E6=9B=B4=E6=96=B0=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/cards/PluginCard.vue | 41 ++++++++++++++++++++++++- src/views/plugin/PluginCardListView.vue | 1 + 2 files changed, 41 insertions(+), 1 deletion(-) 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 }} 更新说明 + + + + + 更新到最新版本 + + + +