feat:支持查看插件更新记录

This commit is contained in:
jxxghp
2024-04-10 16:45:17 +08:00
parent 77ab0ccae2
commit 62ddd703f1
3 changed files with 59 additions and 1 deletions

View File

@@ -612,6 +612,9 @@ export interface Plugin {
// 插件仓库地址
repo_url?: string
// 变更历史
history?: { [key: string]: string }
}
// 种子信息

View File

@@ -4,6 +4,8 @@ import api from '@/api'
import type { Plugin } from '@/api/types'
import noImage from '@images/logos/plugin.png'
import { getDominantColor } from '@/@core/utils/image'
import VersionHistory from '../misc/VersionHistory.vue'
import { isNullOrEmptyObject } from '@/@core/utils'
// 输入参数
const props = defineProps({
@@ -37,6 +39,9 @@ const isImageLoaded = ref(false)
// 图片是否加载失败
const imageLoadError = ref(false)
// 更新日志弹窗
const releaseDialog = ref(false)
// 图片加载完成
async function imageLoaded() {
isImageLoaded.value = true
@@ -118,15 +123,29 @@ function visitPluginPage() {
window.open(repoUrl, '_blank')
}
// 显示更新日志
function showUpdateHistory() {
releaseDialog.value = true
}
// 弹出菜单
const dropdownItems = ref([
{
title: '查看详情',
title: '项目主页',
value: 1,
show: true,
props: {
prependIcon: 'mdi-information-outline',
click: visitPluginPage,
},
},{
title: '更新说明',
value: 2,
show: !isNullOrEmptyObject(props.plugin?.history || {}),
props: {
prependIcon: 'mdi-update',
click: showUpdateHistory,
},
},
])
</script>
@@ -151,6 +170,7 @@ const dropdownItems = ref([
<VList>
<VListItem
v-for="(item, i) in dropdownItems"
v-show="item.show"
:key="i"
variant="plain"
@click="item.props.click"
@@ -221,6 +241,19 @@ const dropdownItems = ref([
</VCardText>
</VCard>
</VDialog>
<!-- 更新日志 -->
<VDialog
v-if="releaseDialog"
v-model="releaseDialog"
width="600"
scrollable
>
<VCard>
<DialogCloseBtn @click="releaseDialog = false" />
<VCardTitle>{{ props.plugin?.plugin_name }} 变更说明</VCardTitle>
<VersionHistory :history="props.plugin?.history" />
</VCard>
</VDialog>
</template>
<style lang="scss" scoped>

View File

@@ -0,0 +1,22 @@
<script lang="ts" setup>
import { PropType } from 'vue';
// 输入参数
const props = defineProps({
history: Object as PropType<{ [key: string]: string }>,
})
</script>
<template>
<VCardItem>
<VList>
<VListItem
v-for="(value, key) in props.history"
:key="key"
>
<VListItemTitle>{{ key }}</VListItemTitle>
<VListItemSubtitle>{{ value }}</VListItemSubtitle>
</VListItem>
</VList>
</VCardItem>
</template>