From 25bc7c4b3c4e74fe8d7ac3267aedc3d882118b28 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Tue, 2 Jun 2026 07:16:05 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8E=86=E5=8F=B2=E5=8A=9F=E8=83=BD=E5=8F=8A?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E5=9B=BD=E9=99=85=E5=8C=96=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/cards/PluginCard.vue | 30 ++++---- .../dialog/PluginVersionHistoryDialog.vue | 72 +++++++++++++++++-- src/locales/en-US.ts | 2 + src/locales/zh-CN.ts | 2 + src/locales/zh-TW.ts | 2 + 5 files changed, 91 insertions(+), 17 deletions(-) diff --git a/src/components/cards/PluginCard.vue b/src/components/cards/PluginCard.vue index 0ae3ba6f..ff4341ed 100644 --- a/src/components/cards/PluginCard.vue +++ b/src/components/cards/PluginCard.vue @@ -3,7 +3,6 @@ import { useToast } from 'vue-toastification' import { useConfirm } from '@/composables/useConfirm' import api from '@/api' import type { Plugin } from '@/api/types' -import { isNullOrEmptyObject } from '@core/utils' import { getLogoUrl } from '@/utils/imageUtils' import { getDominantColor } from '@/@core/utils/image' import { formatDownloadCount } from '@/@core/utils/formatters' @@ -104,17 +103,12 @@ async function imageLoaded() { // 显示更新日志 function showUpdateHistory() { - // 检查当前版本是否有更新日志 - if (isNullOrEmptyObject(props.plugin?.history)) { - updatePlugin() - } else { - openSharedDialog( - PluginVersionHistoryDialog, - { plugin: props.plugin, showUpdateAction: true }, - { update: updatePlugin }, - { closeOn: ['close', 'update', 'update:modelValue'] }, - ) - } + openSharedDialog( + PluginVersionHistoryDialog, + { plugin: props.plugin, showUpdateAction: true }, + { update: updatePlugin }, + { closeOn: ['close', 'update', 'update:modelValue'] }, + ) } // 调用API卸载插件 @@ -377,6 +371,15 @@ const dropdownItems = ref([ props: { prependIcon: 'mdi-arrow-up-circle-outline', color: 'success', + click: updatePlugin, + }, + }, + { + title: t('plugin.updateHistory'), + value: 9, + show: !props.plugin?.has_update, + props: { + prependIcon: 'mdi-update', click: showUpdateHistory, }, }, @@ -428,6 +431,9 @@ watch( (newHasUpdate, _) => { const updateItemIndex = dropdownItems.value.findIndex(item => item.value === 3) if (updateItemIndex !== -1) dropdownItems.value[updateItemIndex].show = newHasUpdate + + const updateHistoryItemIndex = dropdownItems.value.findIndex(item => item.value === 9) + if (updateHistoryItemIndex !== -1) dropdownItems.value[updateHistoryItemIndex].show = !newHasUpdate }, ) diff --git a/src/components/dialog/PluginVersionHistoryDialog.vue b/src/components/dialog/PluginVersionHistoryDialog.vue index a4742882..e9aac3a7 100644 --- a/src/components/dialog/PluginVersionHistoryDialog.vue +++ b/src/components/dialog/PluginVersionHistoryDialog.vue @@ -1,4 +1,5 @@