feat 插件跳转Github

This commit is contained in:
jxxghp
2023-11-30 16:57:01 +08:00
parent 366fe34d6f
commit 5566ef87f8
3 changed files with 87 additions and 11 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "moviepilot", "name": "moviepilot",
"version": "1.4.7-1", "version": "1.4.8",
"private": true, "private": true,
"bin": "dist/service.js", "bin": "dist/service.js",
"scripts": { "scripts": {
+63 -1
View File
@@ -89,6 +89,45 @@ const iconPath: Ref<string> = computed(() => {
return `/plugin_icon/${props.plugin?.plugin_icon}` return `/plugin_icon/${props.plugin?.plugin_icon}`
}) })
// 访问插件页面
function visitPluginPage() {
// 将raw.githubusercontent.com转换为项目地址
let repoUrl = props.plugin?.repo_url
if (repoUrl) {
if (repoUrl.includes('raw.githubusercontent.com')) {
if (!repoUrl.endsWith('/'))
repoUrl += '/'
if (repoUrl.split('/').length < 6)
repoUrl = `${repoUrl}main/`
try {
const [user, repo] = repoUrl.split('/').slice(-4, -2)
repoUrl = `https://github.com/${user}/${repo}`
}
catch (error) {
return
}
}
}
else {
repoUrl = props.plugin?.author_url
}
window.open(repoUrl, '_blank')
}
// 弹出菜单
const dropdownItems = ref([
{
title: '查看详情',
value: 1,
props: {
prependIcon: 'mdi-information-outline',
click: visitPluginPage,
},
},
])
</script> </script>
<template> <template>
@@ -101,9 +140,32 @@ const iconPath: Ref<string> = computed(() => {
class="relative pa-4 text-center card-cover-blurred" class="relative pa-4 text-center card-cover-blurred"
:style="{ background: `${backgroundColor}` }" :style="{ background: `${backgroundColor}` }"
> >
<div class="me-n3 absolute top-0 right-3">
<IconBtn>
<VIcon icon="mdi-dots-vertical" class="text-white" />
<VMenu
activator="parent"
close-on-content-click
>
<VList>
<VListItem
v-for="(item, i) in dropdownItems"
:key="i"
variant="plain"
@click="item.props.click"
>
<template #prepend>
<VIcon :icon="item.props.prependIcon" />
</template>
<VListItemTitle v-text="item.title" />
</VListItem>
</VList>
</VMenu>
</IconBtn>
</div>
<div <div
v-if="props.plugin?.has_update" v-if="props.plugin?.has_update"
class="me-n3 absolute top-0 right-5" class="me-n3 absolute top-0 left-1"
> >
<VIcon <VIcon
icon="mdi-new-box" icon="mdi-new-box"
+23 -9
View File
@@ -43,10 +43,10 @@ const pluginConfigForm = ref({})
// 插件表单配置项 // 插件表单配置项
let pluginFormItems = reactive([]) let pluginFormItems = reactive([])
// 插件详情页面 // 插件数据页面
const pluginInfoDialog = ref(false) const pluginInfoDialog = ref(false)
// 插件详情页面配置项 // 插件数据页面配置项
let pluginPageItems = reactive([]) let pluginPageItems = reactive([])
// 图片是否加载完成 // 图片是否加载完成
@@ -113,7 +113,7 @@ async function loadPluginForm() {
} }
} }
// 调用API读取详情页面 // 调用API读取数据页面
async function loadPluginPage() { async function loadPluginPage() {
try { try {
const result: [] = await api.get(`plugin/page/${props.plugin?.id}`) const result: [] = await api.get(`plugin/page/${props.plugin?.id}`)
@@ -156,9 +156,9 @@ async function savePluginConf() {
} }
} }
// 显示插件详情 // 显示插件数据
async function showPluginInfo() { async function showPluginInfo() {
// 加载详情 // 加载数据
await loadPluginPage() await loadPluginPage()
pluginConfigDialog.value = false pluginConfigDialog.value = false
pluginInfoDialog.value = true pluginInfoDialog.value = true
@@ -220,10 +220,15 @@ async function resetPlugin() {
} }
} }
// 访问作者主页
function visitAuthorPage() {
window.open(props.plugin?.author_url, '_blank')
}
// 弹出菜单 // 弹出菜单
const dropdownItems = ref([ const dropdownItems = ref([
{ {
title: '查看详情', title: '查看数据',
value: 1, value: 1,
show: props.plugin?.has_page, show: props.plugin?.has_page,
props: { props: {
@@ -232,7 +237,7 @@ const dropdownItems = ref([
}, },
}, },
{ {
title: '置', title: '置',
value: 2, value: 2,
show: true, show: true,
props: { props: {
@@ -260,6 +265,15 @@ const dropdownItems = ref([
click: uninstallPlugin, click: uninstallPlugin,
}, },
}, },
{
title: '作者主页',
value: 4,
show: true,
props: {
prependIcon: 'mdi-home-circle-outline',
click: visitAuthorPage,
},
},
]) ])
</script> </script>
@@ -350,7 +364,7 @@ const dropdownItems = ref([
</VCardText> </VCardText>
<VCardActions> <VCardActions>
<VBtn v-if="pluginPageItems.length > 0" @click="showPluginInfo"> <VBtn v-if="pluginPageItems.length > 0" @click="showPluginInfo">
查看详情 查看数据
</VBtn> </VBtn>
<VSpacer /> <VSpacer />
<VBtn <VBtn
@@ -363,7 +377,7 @@ const dropdownItems = ref([
</VCard> </VCard>
</VDialog> </VDialog>
<!-- 插件详情页面 --> <!-- 插件数据页面 -->
<VDialog <VDialog
v-model="pluginInfoDialog" v-model="pluginInfoDialog"
scrollable scrollable