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 }} + + + +