mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-07 00:36:41 +08:00
feat 更新时查看更新说明
This commit is contained in:
@@ -6,6 +6,7 @@ import api from '@/api'
|
|||||||
import type { Plugin } from '@/api/types'
|
import type { Plugin } from '@/api/types'
|
||||||
import FormRender from '@/components/render/FormRender.vue'
|
import FormRender from '@/components/render/FormRender.vue'
|
||||||
import PageRender from '@/components/render/PageRender.vue'
|
import PageRender from '@/components/render/PageRender.vue'
|
||||||
|
import VersionHistory from '@/components/misc/VersionHistory.vue'
|
||||||
import { isNullOrEmptyObject } from '@core/utils'
|
import { isNullOrEmptyObject } from '@core/utils'
|
||||||
import noImage from '@images/logos/plugin.png'
|
import noImage from '@images/logos/plugin.png'
|
||||||
import { getDominantColor } from '@/@core/utils/image'
|
import { getDominantColor } from '@/@core/utils/image'
|
||||||
@@ -65,6 +66,9 @@ const isImageLoaded = ref(false)
|
|||||||
// 图片是否加载失败
|
// 图片是否加载失败
|
||||||
const imageLoadError = ref(false)
|
const imageLoadError = ref(false)
|
||||||
|
|
||||||
|
// 更新日志弹窗
|
||||||
|
const releaseDialog = ref(false)
|
||||||
|
|
||||||
// 监听动作标识,如为true则打开详情
|
// 监听动作标识,如为true则打开详情
|
||||||
watch(() => props.action, (newAction, oldAction) => {
|
watch(() => props.action, (newAction, oldAction) => {
|
||||||
if (newAction && !oldAction) {
|
if (newAction && !oldAction) {
|
||||||
@@ -81,6 +85,16 @@ async function imageLoaded() {
|
|||||||
backgroundColor.value = await getDominantColor(imageElement)
|
backgroundColor.value = await getDominantColor(imageElement)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 显示更新日志
|
||||||
|
function showUpdateHistory() {
|
||||||
|
// 检查当前版本是否有更新日志
|
||||||
|
if (isNullOrEmptyObject(props.plugin?.history)) {
|
||||||
|
updatePlugin()
|
||||||
|
} else{
|
||||||
|
releaseDialog.value = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 调用API卸载插件
|
// 调用API卸载插件
|
||||||
async function uninstallPlugin() {
|
async function uninstallPlugin() {
|
||||||
const isConfirmed = await createConfirm({
|
const isConfirmed = await createConfirm({
|
||||||
@@ -251,6 +265,7 @@ async function resetPlugin() {
|
|||||||
// 更新插件
|
// 更新插件
|
||||||
async function updatePlugin() {
|
async function updatePlugin() {
|
||||||
try {
|
try {
|
||||||
|
releaseDialog.value = false
|
||||||
// 显示等待提示框
|
// 显示等待提示框
|
||||||
progressDialog.value = true
|
progressDialog.value = true
|
||||||
progressText.value = `正在更新 ${props.plugin?.plugin_name} ...`
|
progressText.value = `正在更新 ${props.plugin?.plugin_name} ...`
|
||||||
@@ -330,7 +345,7 @@ const dropdownItems = ref([
|
|||||||
props: {
|
props: {
|
||||||
prependIcon: 'mdi-arrow-up-circle-outline',
|
prependIcon: 'mdi-arrow-up-circle-outline',
|
||||||
color: 'success',
|
color: 'success',
|
||||||
click: updatePlugin,
|
click: showUpdateHistory,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -544,6 +559,30 @@ watch(() => props.plugin?.has_update, (newHasUpdate, oldHasUpdate) => {
|
|||||||
</VCardText>
|
</VCardText>
|
||||||
</VCard>
|
</VCard>
|
||||||
</VDialog>
|
</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" />
|
||||||
|
<VCardText>
|
||||||
|
<VBtn
|
||||||
|
@click="updatePlugin"
|
||||||
|
block
|
||||||
|
>
|
||||||
|
<template #prepend>
|
||||||
|
<VIcon icon="mdi-arrow-up-circle-outline" />
|
||||||
|
</template>
|
||||||
|
更新到最新版本
|
||||||
|
</VBtn>
|
||||||
|
</VCardText>
|
||||||
|
</VCard>
|
||||||
|
</VDialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@@ -167,6 +167,7 @@ async function fetchUninstalledPlugins() {
|
|||||||
if (uninstalled.id === data.id) {
|
if (uninstalled.id === data.id) {
|
||||||
data.has_update = true
|
data.has_update = true
|
||||||
data.repo_url = uninstalled.repo_url
|
data.repo_url = uninstalled.repo_url
|
||||||
|
data.history = uninstalled.history
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user