From c44b20bae3cbb4b54b6bb975ad51848690e98e61 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Mon, 6 May 2024 17:37:47 +0800 Subject: [PATCH] Update confirmation dialog styles and props in UserProfile.vue, FileList.vue, PluginCard.vue, and dashboard.vue --- src/components/cards/PluginCard.vue | 16 -- src/components/cards/TorrentCard.vue | 145 ++-------- src/components/cards/TorrentItem.vue | 127 ++------- src/components/filebrowser/FileList.vue | 8 - src/components/table/SiteTorrentTable.vue | 69 +---- src/layouts/components/UserProfile.vue | 8 - src/main.ts | 28 +- src/pages/dashboard.vue | 22 +- src/views/setting/AccountSettingAccount.vue | 287 +++++--------------- 9 files changed, 179 insertions(+), 531 deletions(-) diff --git a/src/components/cards/PluginCard.vue b/src/components/cards/PluginCard.vue index ba390c6e..d07d13af 100644 --- a/src/components/cards/PluginCard.vue +++ b/src/components/cards/PluginCard.vue @@ -108,14 +108,6 @@ async function uninstallPlugin() { const isConfirmed = await createConfirm({ title: '确认', content: `是否确认卸载插件 ${props.plugin?.plugin_name} ?`, - confirmationText: '确认', - cancellationText: '取消', - dialogProps: { - maxWidth: '50rem', - }, - confirmationButtonProps: { - variant: 'tonal', - }, }) if (!isConfirmed) return @@ -229,14 +221,6 @@ async function resetPlugin() { const isConfirmed = await createConfirm({ title: '确认', content: `是否确认重置插件 ${props.plugin?.plugin_name} 的配置数据?`, - confirmationText: '确认', - cancellationText: '取消', - dialogProps: { - maxWidth: '50rem', - }, - confirmationButtonProps: { - variant: 'tonal', - }, }) if (!isConfirmed) return diff --git a/src/components/cards/TorrentCard.vue b/src/components/cards/TorrentCard.vue index 96ebf4dc..3abbe04b 100644 --- a/src/components/cards/TorrentCard.vue +++ b/src/components/cards/TorrentCard.vue @@ -43,16 +43,13 @@ const downloaded = ref([]) async function getSiteIcon() { try { siteIcon.value = (await api.get(`site/icon/${torrent?.value?.site}`)).data.icon - } - catch (error) { + } catch (error) { console.error(error) } } // 询问并添加下载 -async function handleAddDownload(_site: any = undefined, - _media: any = undefined, - _torrent: any = undefined) { +async function handleAddDownload(_site: any = undefined, _media: any = undefined, _torrent: any = undefined) { if (!_media || !_torrent || !_site) { _site = torrent.value?.site_name _media = media.value @@ -62,18 +59,9 @@ async function handleAddDownload(_site: any = undefined, const isConfirmed = await createConfirm({ title: '确认', content: `是否确认下载【${_site}】${_torrent?.title} ?`, - confirmationText: '确认', - cancellationText: '取消', - dialogProps: { - maxWidth: '50rem', - }, - confirmationButtonProps: { - variant: 'tonal', - }, }) - if (!isConfirmed) - return + if (!isConfirmed) return addDownload(_media, _torrent) } @@ -91,13 +79,11 @@ async function addDownload(_media: MediaInfo, _torrent: TorrentInfo) { // 添加下载成功 $toast.success(`${_torrent?.site_name} ${_torrent?.title} 添加下载成功!`) downloaded.value.push(_torrent?.enclosure || '') - } - else { + } else { // 添加下载失败 $toast.error(`${_torrent?.site_name} ${_torrent?.title} 添加下载失败!`) } - } - catch (error) { + } catch (error) { console.error(error) } doneNProgress() @@ -115,14 +101,10 @@ async function downloadTorrentFile() { // 促销Chip类 function getVolumeFactorClass(downloadVolume: number, uploadVolume: number) { - if (downloadVolume === 0) - return 'text-white bg-lime-500' - else if (downloadVolume < 1) - return 'text-white bg-green-500' - else if (uploadVolume !== 1) - return 'text-white bg-sky-500' - else - return 'text-white bg-gray-500' + if (downloadVolume === 0) return 'text-white bg-lime-500' + else if (downloadVolume < 1) return 'text-white bg-green-500' + else if (uploadVolume !== 1) return 'text-white bg-sky-500' + else return 'text-white bg-gray-500' } // 装载时查询站点图标 @@ -138,15 +120,8 @@ onMounted(() => { :variant="downloaded.includes(torrent?.enclosure || '') ? 'outlined' : 'elevated'" @click="handleAddDownload" > -