From 21bc8edbd8883476b18a3b6cee3bffdd114e9848 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Wed, 1 Nov 2023 21:05:31 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E5=9C=A8=E7=BA=BF=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E5=B8=82=E5=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/api/types.ts | 9 +++++ src/components/cards/PluginAppCard.vue | 47 ++++++++++++++++++++++++++ src/components/cards/PluginCard.vue | 2 +- 4 files changed, 58 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index a29fd3c9..cab02d2d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "moviepilot", - "version": "1.3.9-1", + "version": "1.3.9-2", "private": true, "bin": "dist/service.js", "scripts": { diff --git a/src/api/types.ts b/src/api/types.ts index c8b59797..b4244512 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -541,6 +541,15 @@ export interface Plugin { // 是否有详情页面 has_page?: boolean + + // 是否有新版本 + has_update?: boolean + + // 是否本地插件 + is_local?: boolean + + // 插件仓库地址 + repo_url?: string } // 种子信息 diff --git a/src/components/cards/PluginAppCard.vue b/src/components/cards/PluginAppCard.vue index c8e28233..7fe1c0fd 100644 --- a/src/components/cards/PluginAppCard.vue +++ b/src/components/cards/PluginAppCard.vue @@ -16,16 +16,35 @@ const emit = defineEmits(['install']) // 提示框 const $toast = useToast() +// 进度框 +const progressDialog = ref(false) + +// 进度框文本 +const progressText = ref('正在安装插件...') + // 图片是否加载完成 const isImageLoaded = ref(false) // 安装插件 async function installPlugin() { try { + // 显示等待提示框 + progressDialog.value = true + progressText.value = `正在安装 ${props.plugin?.plugin_name} 插件...` + const result: { [key: string]: any } = await api.get( `plugin/install/${props.plugin?.id}`, + { + params: { + repo_url: props.plugin?.repo_url, + force: props.plugin?.has_update, + }, + }, ) + // 隐藏等待提示框 + progressDialog.value = false + if (result.success) { $toast.success(`插件 ${props.plugin?.plugin_name} 安装成功!`) @@ -52,6 +71,15 @@ async function installPlugin() { class="relative pa-4 text-center card-cover-blurred" :style="{ background: `${props.plugin?.plugin_color}` }" > +
+ +
+ + + + + {{ progressText }} + + + +