From 5c13362db242d241a71e4328770618667cb4d8dc Mon Sep 17 00:00:00 2001 From: jxxghp Date: Thu, 25 Apr 2024 09:48:12 +0800 Subject: [PATCH] fix fullscreen --- src/components/cards/PluginCard.vue | 236 ++++++------------ src/components/cards/SiteCard.vue | 204 ++++----------- src/components/dialog/ReorganizeDialog.vue | 124 +++------ src/components/dialog/SiteAddEditDialog.vue | 125 ++-------- src/components/dialog/SubscribeEditDialog.vue | 174 ++++--------- .../dialog/SubscribeHistoryDialog.vue | 81 ++---- src/layouts/components/ShortcutBar.vue | 16 +- src/pages/dashboard.vue | 110 ++------ src/views/plugin/PluginCardListView.vue | 6 +- src/views/reorganize/TransferHistoryView.vue | 1 + src/views/system/ModuleTestView.vue | 17 +- 11 files changed, 304 insertions(+), 790 deletions(-) diff --git a/src/components/cards/PluginCard.vue b/src/components/cards/PluginCard.vue index 64e3de37..1bf1cc5a 100644 --- a/src/components/cards/PluginCard.vue +++ b/src/components/cards/PluginCard.vue @@ -14,7 +14,7 @@ import store from '@/store' import { useDisplay } from 'vuetify' // 显示器宽度 -const displayWidth = useDisplay().width +const display = useDisplay() // 输入参数 const props = defineProps({ @@ -74,12 +74,15 @@ const imageLoadError = ref(false) const releaseDialog = ref(false) // 监听动作标识,如为true则打开详情 -watch(() => props.action, (newAction, oldAction) => { - if (newAction && !oldAction) { - openPluginDetail() - emit('actionDone') - } -}) +watch( + () => props.action, + (newAction, oldAction) => { + if (newAction && !oldAction) { + openPluginDetail() + emit('actionDone') + } + }, +) // 图片加载完成 async function imageLoaded() { @@ -94,7 +97,7 @@ function showUpdateHistory() { // 检查当前版本是否有更新日志 if (isNullOrEmptyObject(props.plugin?.history)) { updatePlugin() - } else{ + } else { releaseDialog.value = true } } @@ -114,11 +117,10 @@ async function uninstallPlugin() { }, }) - if (!isConfirmed) - return + if (!isConfirmed) return try { - // 显示等待提示框 + // 显示等待提示框 progressDialog.value = true progressText.value = `正在卸载 ${props.plugin?.plugin_name} ...` const result: { [key: string]: any } = await api.delete(`plugin/${props.plugin?.id}`) @@ -129,12 +131,10 @@ async function uninstallPlugin() { // 通知父组件刷新 emit('remove') - } - else { + } else { $toast.error(`插件 ${props.plugin?.plugin_name} 卸载失败:${result.message}}`) } - } - catch (error) { + } catch (error) { console.error(error) } } @@ -145,11 +145,9 @@ async function loadPluginForm() { const result: { [key: string]: any } = await api.get(`plugin/form/${props.plugin?.id}`) if (result) { pluginFormItems = result.conf - if (result.model) - pluginConfigForm.value = result.model + if (result.model) pluginConfigForm.value = result.model } - } - catch (error) { + } catch (error) { console.error(error) } } @@ -158,10 +156,8 @@ async function loadPluginForm() { async function loadPluginPage() { try { const result: [] = await api.get(`plugin/page/${props.plugin?.id}`) - if (result) - pluginPageItems = result - } - catch (error) { + if (result) pluginPageItems = result + } catch (error) { console.error(error) } } @@ -170,10 +166,8 @@ async function loadPluginPage() { async function loadPluginConf() { try { const result: { [key: string]: any } = await api.get(`plugin/${props.plugin?.id}`) - if (!isNullOrEmptyObject(result)) - pluginConfigForm.value = result - } - catch (error) { + if (!isNullOrEmptyObject(result)) pluginConfigForm.value = result + } catch (error) { console.error(error) } } @@ -191,13 +185,11 @@ async function savePluginConf() { $toast.success(`插件 ${props.plugin?.plugin_name} 配置已保存`) // 通知父组件刷新 emit('save') - } - else { + } else { progressDialog.value = false $toast.error(`插件 ${props.plugin?.plugin_name} 配置保存失败:${result.message}}`) } - } - catch (error) { + } catch (error) { console.error(error) } } @@ -223,8 +215,7 @@ async function showPluginConfig() { // 计算图标路径 const iconPath: Ref = computed(() => { - if (imageLoadError.value) - return noImage + if (imageLoadError.value) return noImage // 如果是网络图片则使用代理后返回 if (props.plugin?.plugin_icon?.startsWith('http')) return `${import.meta.env.VITE_API_BASE_URL}system/img/1?imgurl=${encodeURIComponent(props.plugin?.plugin_icon)}` @@ -247,8 +238,7 @@ async function resetPlugin() { }, }) - if (!isConfirmed) - return + if (!isConfirmed) return try { const result: { [key: string]: any } = await api.get(`plugin/reset/${props.plugin?.id}`) @@ -256,12 +246,10 @@ async function resetPlugin() { $toast.success(`插件 ${props.plugin?.plugin_name} 数据已重置`) // 通知父组件刷新 emit('save') - } - else { + } else { $toast.error(`插件 ${props.plugin?.plugin_name} 重置失败:${result.message}}`) } - } - catch (error) { + } catch (error) { console.error(error) } } @@ -274,15 +262,12 @@ async function updatePlugin() { 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: true, - }, + const result: { [key: string]: any } = await api.get(`plugin/install/${props.plugin?.id}`, { + params: { + repo_url: props.plugin?.repo_url, + force: true, }, - ) + }) // 隐藏等待提示框 progressDialog.value = false @@ -292,12 +277,10 @@ async function updatePlugin() { // 通知父组件刷新 emit('save') - } - else { + } else { $toast.error(`插件 ${props.plugin?.plugin_name} 更新失败:${result.message}`) } - } - catch (error) { + } catch (error) { console.error(error) } } @@ -310,16 +293,16 @@ function visitAuthorPage() { // 查看日志URL function openLoggerWindow() { const token = store.state.auth.token - const url = `${import.meta.env.VITE_API_BASE_URL}system/logging?token=${token}&length=-1&logfile=plugins/${props.plugin?.id?.toLowerCase()}.log` + const url = `${ + import.meta.env.VITE_API_BASE_URL + }system/logging?token=${token}&length=-1&logfile=plugins/${props.plugin?.id?.toLowerCase()}.log` window.open(url, '_blank') } // 打开插件详情 function openPluginDetail() { - if (props.plugin?.has_page) - showPluginInfo() - else - showPluginConfig() + if (props.plugin?.has_page) showPluginInfo() + else showPluginConfig() } // 弹出菜单 @@ -395,41 +378,26 @@ const dropdownItems = ref([ ]) // 监听插件状态变化 -watch(() => props.plugin?.has_update, (newHasUpdate, oldHasUpdate) => { - const updateItemIndex = dropdownItems.value.findIndex(item => item.value === 3) - if (updateItemIndex !== -1) - dropdownItems.value[updateItemIndex].show = newHasUpdate -}) +watch( + () => props.plugin?.has_update, + (newHasUpdate, oldHasUpdate) => { + const updateItemIndex = dropdownItems.value.findIndex(item => item.value === 3) + if (updateItemIndex !== -1) dropdownItems.value[updateItemIndex].show = newHasUpdate + }, +)