From a9dcbc2578583aa7d57603e705a13138930bb885 Mon Sep 17 00:00:00 2001 From: kjqwer <2990346238@qq.com> Date: Thu, 25 Sep 2025 11:06:49 +0800 Subject: [PATCH] =?UTF-8?q?svg=E7=BB=9F=E4=B8=80=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/App.vue | 18 ++-- ui/src/assets/icons/actions.ts | 24 ++++++ ui/src/assets/icons/brand.ts | 6 ++ ui/src/assets/icons/index.ts | 29 +++++++ ui/src/assets/icons/navigation.ts | 20 +++++ ui/src/components/artwork/ArtworkCard.vue | 10 +-- .../components/artwork/ArtworkInfoPanel.vue | 31 ++----- .../common/DownloadProgressWidget.vue | 16 +--- ui/src/components/common/ErrorMessage.vue | 8 +- ui/src/components/common/SettingsWidget.vue | 16 +--- ui/src/components/common/SvgIcon.vue | 25 ++++++ ui/src/components/common/UpdateChecker.vue | 34 ++------ ui/src/components/common/WatchlistWidget.vue | 82 +++++-------------- .../components/home/RandomRecommendations.vue | 5 +- .../components/ranking/RankingPagination.vue | 8 +- ui/src/components/search/ArtistSearch.vue | 10 +-- ui/src/main.ts | 2 + ui/src/views/ArtistView.vue | 20 ++--- ui/src/views/ArtistsView.vue | 28 ++----- ui/src/views/BookmarksView.vue | 5 +- ui/src/views/DownloadsView.vue | 23 ++---- ui/src/views/HomeView.vue | 31 ++----- ui/src/views/LoginView.vue | 5 +- ui/src/views/RankingView.vue | 4 +- ui/src/views/SearchView.vue | 15 +--- 25 files changed, 193 insertions(+), 282 deletions(-) create mode 100644 ui/src/assets/icons/actions.ts create mode 100644 ui/src/assets/icons/brand.ts create mode 100644 ui/src/assets/icons/index.ts create mode 100644 ui/src/assets/icons/navigation.ts create mode 100644 ui/src/components/common/SvgIcon.vue diff --git a/ui/src/App.vue b/ui/src/App.vue index 0591f5f..f207b06 100644 --- a/ui/src/App.vue +++ b/ui/src/App.vue @@ -25,13 +25,13 @@ const showDownloadWidget = computed(() => { onMounted(async () => { await authStore.fetchLoginStatus() - + // 如果已登录,初始化下载store和检查更新 if (authStore.isLoggedIn) { await downloadStore.fetchTasks() // 启动定期刷新 downloadStore.startRefreshInterval() - + // 自动检查更新(静默) setTimeout(() => { updateStore.autoCheckUpdate() @@ -47,10 +47,7 @@ onMounted(async () => { @@ -101,10 +95,10 @@ onMounted(async () => { - + - + diff --git a/ui/src/assets/icons/actions.ts b/ui/src/assets/icons/actions.ts new file mode 100644 index 0000000..c770d1e --- /dev/null +++ b/ui/src/assets/icons/actions.ts @@ -0,0 +1,24 @@ +// 操作相关图标 +export const actionIcons = { + 'download': 'M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z', + 'settings': 'M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z', + 'user': 'M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z', + 'edit': 'M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z', + 'delete': 'M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z', + 'save': 'M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7l-4-4zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3zm3-10H5V5h10v4z', + 'close': 'M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z', + 'success': 'M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z', + 'check-circle': 'M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z', + 'arrow-left': 'M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z', + 'arrow-left2': 'M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z', + 'arrow-next': 'M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z', + 'arrow-right': 'M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z', + 'error': 'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z', + 'sort-desc': 'M3 12l2-2 7 7 10-10 2 2L12 21z', + 'sort-asc': 'M12 3l10 10-2 2-7-7-7 7-2-2z', + 'empty': 'M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-5 14H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z', + 'empty2': 'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z', + 'refresh': 'M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z', + 'cleanup': 'M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z', + +} \ No newline at end of file diff --git a/ui/src/assets/icons/brand.ts b/ui/src/assets/icons/brand.ts new file mode 100644 index 0000000..c657474 --- /dev/null +++ b/ui/src/assets/icons/brand.ts @@ -0,0 +1,6 @@ +// 品牌相关图标 +export const brandIcons = { + 'home2': 'M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zM7 12h2v5H7zm4-3h2v8h-2zm4-3h2v11h-2z', + 'home3': 'M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V8h16v10z', + 'github': 'M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z' +} \ No newline at end of file diff --git a/ui/src/assets/icons/index.ts b/ui/src/assets/icons/index.ts new file mode 100644 index 0000000..e88bfbe --- /dev/null +++ b/ui/src/assets/icons/index.ts @@ -0,0 +1,29 @@ +// 导入各类图标 +import { brandIcons } from './brand' +import { navigationIcons } from './navigation' +import { actionIcons } from './actions' + +// 自动合并所有分类图标到统一注册表 +export const iconRegistry: Record = { + ...brandIcons, + ...navigationIcons, + ...actionIcons +} + +// 类型定义 +export type IconName = keyof typeof iconRegistry + +// 添加新图标的辅助函数 +export const addIcon = (name: string, pathData: string) => { + iconRegistry[name] = pathData +} + +// 检查图标是否存在 +export const hasIcon = (name: string): boolean => { + return name in iconRegistry +} + +// 获取所有图标名称 +export const getAllIconNames = (): string[] => { + return Object.keys(iconRegistry) +} \ No newline at end of file diff --git a/ui/src/assets/icons/navigation.ts b/ui/src/assets/icons/navigation.ts new file mode 100644 index 0000000..11eeaa3 --- /dev/null +++ b/ui/src/assets/icons/navigation.ts @@ -0,0 +1,20 @@ +// 导航相关图标 +export const navigationIcons = { + 'home': 'M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z', + 'search': 'M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z', + 'ranking': 'M16 6l2.29 2.29-4.88 4.88-4-4L2 16.59 3.41 18l6-6 4 4 6.3-6.29L22 12V6z', + 'bookmark': 'M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z', + 'bookmark-empty': 'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z', + 'eye': 'M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z', + 'folder': 'M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14z', + 'settings': 'M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z', + 'update': 'M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z', + 'update-spinning': 'M12,4V2A10,10 0 0,0 2,12H4A8,8 0 0,1 12,4Z', + 'info': 'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z', + 'watchlist': 'M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM10 17l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z', + 'watchlist-update': 'M12 6v3l4-4-4-4v3c-4.42 0-8 3.58-8 8 0 1.57.46 3.03 1.24 4.26L6.7 14.8c-.45-.83-.7-1.79-.7-2.8 0-3.31 2.69-6 6-6zm6.76 1.74L17.3 9.2c.44.84.7 1.79.7 2.8 0 3.31-2.69 6-6 6v-3l-4 4 4 4v-3c4.42 0 8-3.58 8-8 0-1.57-.46-3.03-1.24-4.26z', + 'add': 'M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z', + 'cleanup-history': 'M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z', + 'cleanup-history2': 'M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z', + 'loading': 'M12 6v3l4-4-4-4v3c-4.42 0-8 3.58-8 8 0 1.57.46 3.03 1.24 4.26L6.7 14.8c-.45-.83-.7-1.79-.7-2.8 0-3.31 2.69-6 6-6zm6.76 1.74L17.3 9.2c.44.84.7 1.79.7 2.8 0 3.31-2.69 6-6 6v-3l-4 4 4 4v-3c4.42 0 8-3.58 8-8 0-1.57-.46-3.03-1.24-4.26z', +} \ No newline at end of file diff --git a/ui/src/components/artwork/ArtworkCard.vue b/ui/src/components/artwork/ArtworkCard.vue index f3673ae..7b77568 100644 --- a/ui/src/components/artwork/ArtworkCard.vue +++ b/ui/src/components/artwork/ArtworkCard.vue @@ -25,17 +25,11 @@
- - - + {{ artwork.total_bookmarks }} - - - + {{ artwork.total_view }}
diff --git a/ui/src/components/artwork/ArtworkInfoPanel.vue b/ui/src/components/artwork/ArtworkInfoPanel.vue index 6c00be3..993c6d6 100644 --- a/ui/src/components/artwork/ArtworkInfoPanel.vue +++ b/ui/src/components/artwork/ArtworkInfoPanel.vue @@ -22,9 +22,7 @@
- - - + 已下载到本地
@@ -50,49 +48,34 @@
- - - + {{ artwork.total_bookmarks }}
- - - + {{ artwork.total_view }}
- - - + {{ artwork.width }} × {{ artwork.height }}
diff --git a/ui/src/components/common/DownloadProgressWidget.vue b/ui/src/components/common/DownloadProgressWidget.vue index 0c9512b..4af6b93 100644 --- a/ui/src/components/common/DownloadProgressWidget.vue +++ b/ui/src/components/common/DownloadProgressWidget.vue @@ -3,12 +3,8 @@
- - - - - - + +
{{ activeTasks.length }}
@@ -18,9 +14,7 @@

下载进度

@@ -31,9 +25,7 @@
- - - + 暂无下载任务
diff --git a/ui/src/components/common/ErrorMessage.vue b/ui/src/components/common/ErrorMessage.vue index a14ae91..f2f5ec6 100644 --- a/ui/src/components/common/ErrorMessage.vue +++ b/ui/src/components/common/ErrorMessage.vue @@ -1,18 +1,14 @@ diff --git a/ui/src/components/common/SettingsWidget.vue b/ui/src/components/common/SettingsWidget.vue index e94e6bc..620ceea 100644 --- a/ui/src/components/common/SettingsWidget.vue +++ b/ui/src/components/common/SettingsWidget.vue @@ -2,10 +2,7 @@
@@ -13,12 +10,9 @@

设置

-
+
@@ -36,9 +30,7 @@
- - - + {{ successMessage }}
diff --git a/ui/src/components/common/SvgIcon.vue b/ui/src/components/common/SvgIcon.vue new file mode 100644 index 0000000..e273a66 --- /dev/null +++ b/ui/src/components/common/SvgIcon.vue @@ -0,0 +1,25 @@ + + + \ No newline at end of file diff --git a/ui/src/components/common/UpdateChecker.vue b/ui/src/components/common/UpdateChecker.vue index 0d0620d..a0b6dff 100644 --- a/ui/src/components/common/UpdateChecker.vue +++ b/ui/src/components/common/UpdateChecker.vue @@ -5,13 +5,8 @@ :class="{ 'has-update': hasUpdate, 'checking': isChecking }" :title="hasUpdate ? '发现新版本!' : '检查更新'"> - - - - - - + + {{ isChecking ? '检查中...' : '检查更新' }} 有新版本 @@ -22,17 +17,11 @@