重构 PluginCard 组件,替换 DynamicRender 为 FormRender;在 ForkSubscribeDialog 组件中添加处理状态以优化用户体验;删除不再使用的 DynamicRender 组件

This commit is contained in:
jxxghp
2025-01-12 16:40:33 +08:00
parent 211b05c643
commit 235e014542
3 changed files with 16 additions and 9 deletions

View File

@@ -3,7 +3,7 @@ import { useToast } from 'vue-toast-notification'
import { useConfirm } from 'vuetify-use-dialog'
import api from '@/api'
import type { Plugin } from '@/api/types'
import DynamicRender from '@/components/render/DynamicRender.vue'
import FormRender from '@/components/render/FormRender.vue'
import PageRender from '@/components/render/PageRender.vue'
import VersionHistory from '@/components/misc/VersionHistory.vue'
import { isNullOrEmptyObject } from '@core/utils'
@@ -490,12 +490,7 @@ watch(
<DialogCloseBtn v-model="pluginConfigDialog" />
<VDivider />
<VCardText>
<DynamicRender
v-for="(item, index) in pluginFormItems"
:key="index"
:config="item"
:model="pluginConfigForm"
/>
<FormRender v-for="(item, index) in pluginFormItems" :key="index" :config="item" :model="pluginConfigForm" />
</VCardText>
<VCardActions class="pt-3">
<VBtn v-if="pluginPageItems.length > 0" @click="showPluginInfo" variant="outlined" color="info">

View File

@@ -20,6 +20,9 @@ const globalSettings: any = inject('globalSettings')
// 提示框
const $toast = useToast()
// 处理中
const processing = ref(false)
// 计算海报图片地址
const posterUrl = computed(() => {
const url = props.media?.poster
@@ -45,9 +48,9 @@ async function doFork() {
// 开始处理
startNProgress()
try {
processing.value = true
// 请求API
const result: { [key: string]: any } = await api.post('subscribe/fork', props.media)
// 订阅状态
if (result.success) {
$toast.success(`${props.media?.share_title} 添加订阅成功!`)
@@ -59,6 +62,7 @@ async function doFork() {
} catch (error) {
console.error(error)
} finally {
processing.value = false
doneNProgress()
}
}
@@ -113,7 +117,15 @@ async function doFork() {
</VListItem>
</VList>
<div class="text-center text-md-left">
<VBtn color="primary" @click="doFork" prepend-icon="mdi-heart">添加到我的订阅</VBtn>
<VBtn
color="primary"
:disabled="processing"
@click="doFork"
prepend-icon="mdi-heart"
:loading="processing"
>
添加到我的订阅
</VBtn>
</div>
</VCardItem>
</div>