统一图标导入方式

This commit is contained in:
jxxghp
2025-09-11 15:03:12 +08:00
parent c2e97bf191
commit 28afe2a922
18 changed files with 166 additions and 111 deletions

View File

@@ -5,7 +5,7 @@ import api from '@/api'
import type { Plugin } from '@/api/types'
import NoDataFound from '@/components/NoDataFound.vue'
import PluginAppCard from '@/components/cards/PluginAppCard.vue'
import noImage from '@images/logos/plugin.png'
import { getLogoUrl } from '@/utils/imageUtils'
import { useDisplay } from 'vuetify'
import { isNullOrEmptyObject } from '@/@core/utils'
import { getPluginTabs } from '@/router/i18n-menu'
@@ -675,7 +675,7 @@ function pluginIconError(item: Plugin) {
// 插件图标地址
function pluginIcon(item: Plugin) {
// 如果图片加载错误
if (pluginIconLoaded.value[item.id || '0'] === false) return noImage
if (pluginIconLoaded.value[item.id || '0'] === false) return getLogoUrl('plugin')
// 如果是网络图片则使用代理后返回
if (item?.plugin_icon?.startsWith('http'))
return `${import.meta.env.VITE_API_BASE_URL}system/img/1?imgurl=${encodeURIComponent(item?.plugin_icon)}&cache=true`

View File

@@ -1,6 +1,7 @@
<script lang="ts" setup>
import { useI18n } from 'vue-i18n'
import { useSetupWizard } from '@/composables/useSetupWizard'
import { getLogoUrl } from '@/utils/imageUtils'
const { t } = useI18n()
const { wizardData, selectDownloader, validationErrors } = useSetupWizard()
@@ -34,7 +35,7 @@ const { wizardData, selectDownloader, validationErrors } = useSetupWizard()
@click="selectDownloader('qbittorrent')"
>
<VCardText class="text-center">
<VImg src="/src/assets/images/logos/qbittorrent.png" height="48" width="48" class="mx-auto mb-2" />
<VImg :src="getLogoUrl('qbittorrent')" height="48" width="48" class="mx-auto mb-2" />
<div class="text-h6">qBittorrent</div>
</VCardText>
</VCard>
@@ -47,7 +48,7 @@ const { wizardData, selectDownloader, validationErrors } = useSetupWizard()
@click="selectDownloader('transmission')"
>
<VCardText class="text-center">
<VImg src="/src/assets/images/logos/transmission.png" height="48" width="48" class="mx-auto mb-2" />
<VImg :src="getLogoUrl('transmission')" height="48" width="48" class="mx-auto mb-2" />
<div class="text-h6">Transmission</div>
</VCardText>
</VCard>

View File

@@ -2,6 +2,7 @@
import { useI18n } from 'vue-i18n'
import { useSetupWizard } from '@/composables/useSetupWizard'
import api from '@/api'
import { getLogoUrl } from '@/utils/imageUtils'
const { t } = useI18n()
const { wizardData, selectMediaServer, validationErrors } = useSetupWizard()
@@ -96,7 +97,7 @@ watch(
@click="selectMediaServerWithLibrary('emby')"
>
<VCardText class="text-center">
<VImg src="/src/assets/images/logos/emby.png" height="48" width="48" class="mx-auto mb-2" />
<VImg :src="getLogoUrl('emby')" height="48" width="48" class="mx-auto mb-2" />
<div class="text-h6">Emby</div>
</VCardText>
</VCard>
@@ -109,7 +110,7 @@ watch(
@click="selectMediaServerWithLibrary('jellyfin')"
>
<VCardText class="text-center">
<VImg src="/src/assets/images/logos/jellyfin.png" height="48" width="48" class="mx-auto mb-2" />
<VImg :src="getLogoUrl('jellyfin')" height="48" width="48" class="mx-auto mb-2" />
<div class="text-h6">Jellyfin</div>
</VCardText>
</VCard>
@@ -122,7 +123,7 @@ watch(
@click="selectMediaServerWithLibrary('plex')"
>
<VCardText class="text-center">
<VImg src="/src/assets/images/logos/plex.png" height="48" width="48" class="mx-auto mb-2" />
<VImg :src="getLogoUrl('plex')" height="48" width="48" class="mx-auto mb-2" />
<div class="text-h6">Plex</div>
</VCardText>
</VCard>
@@ -135,7 +136,7 @@ watch(
@click="selectMediaServerWithLibrary('trimemedia')"
>
<VCardText class="text-center">
<VImg src="/src/assets/images/logos/trimemedia.png" height="48" width="48" class="mx-auto mb-2" />
<VImg :src="getLogoUrl('trimemedia')" height="48" width="48" class="mx-auto mb-2" />
<div class="text-h6">飞牛影视</div>
</VCardText>
</VCard>

View File

@@ -1,6 +1,7 @@
<script lang="ts" setup>
import { useI18n } from 'vue-i18n'
import { useSetupWizard } from '@/composables/useSetupWizard'
import { getLogoUrl } from '@/utils/imageUtils'
const { t } = useI18n()
const { wizardData, selectNotification, validationErrors } = useSetupWizard()
@@ -46,7 +47,7 @@ const notificationTypes = [
@click="selectNotification('wechat')"
>
<VCardText class="text-center">
<VImg src="/src/assets/images/logos/wechat.png" height="48" width="48" class="mx-auto mb-2" />
<VImg :src="getLogoUrl('wechat')" height="48" width="48" class="mx-auto mb-2" />
<div class="text-h6">微信</div>
</VCardText>
</VCard>
@@ -59,7 +60,7 @@ const notificationTypes = [
@click="selectNotification('telegram')"
>
<VCardText class="text-center">
<VImg src="/src/assets/images/logos/telegram.webp" height="48" width="48" class="mx-auto mb-2" />
<VImg :src="getLogoUrl('telegram')" height="48" width="48" class="mx-auto mb-2" />
<div class="text-h6">Telegram</div>
</VCardText>
</VCard>
@@ -72,7 +73,7 @@ const notificationTypes = [
@click="selectNotification('slack')"
>
<VCardText class="text-center">
<VImg src="/src/assets/images/logos/slack.webp" height="48" width="48" class="mx-auto mb-2" />
<VImg :src="getLogoUrl('slack')" height="48" width="48" class="mx-auto mb-2" />
<div class="text-h6">Slack</div>
</VCardText>
</VCard>
@@ -85,7 +86,7 @@ const notificationTypes = [
@click="selectNotification('synologychat')"
>
<VCardText class="text-center">
<VImg src="/src/assets/images/logos/synologychat.png" height="48" width="48" class="mx-auto mb-2" />
<VImg :src="getLogoUrl('synologychat')" height="48" width="48" class="mx-auto mb-2" />
<div class="text-h6">Synology Chat</div>
</VCardText>
</VCard>
@@ -98,7 +99,7 @@ const notificationTypes = [
@click="selectNotification('vocechat')"
>
<VCardText class="text-center">
<VImg src="/src/assets/images/logos/vocechat.png" height="48" width="48" class="mx-auto mb-2" />
<VImg :src="getLogoUrl('vocechat')" height="48" width="48" class="mx-auto mb-2" />
<div class="text-h6">VoceChat</div>
</VCardText>
</VCard>

View File

@@ -1,14 +1,7 @@
<script setup lang="ts">
import api from '@/api'
import douban from '@images/logos/douban.png'
import github from '@images/logos/github.png'
import slack from '@images/logos/slack.webp'
import telegram from '@images/logos/telegram.webp'
import tmdb from '@images/logos/tmdb.png'
import wechat from '@images/logos/wechat.png'
import fanart from '@images/logos/fanart.webp'
import { getLogoUrl } from '@/utils/imageUtils'
import tvdb from '@images/logos/thetvdb.jpeg'
import python from '@images/logos/python.png'
import { useI18n } from 'vue-i18n'
// 国际化
@@ -36,7 +29,7 @@ interface Address {
// 测试集
const targets = ref<Address[]>([
{
image: tmdb,
image: getLogoUrl('tmdb'),
name: 'api.themoviedb.org',
url: 'https://api.themoviedb.org/3/movie/550?api_key={TMDBAPIKEY}',
proxy: true,
@@ -46,7 +39,7 @@ const targets = ref<Address[]>([
btndisable: false,
},
{
image: tmdb,
image: getLogoUrl('tmdb'),
name: 'api.tmdb.org',
url: 'https://api.tmdb.org/3/movie/550?api_key={TMDBAPIKEY}',
proxy: true,
@@ -56,7 +49,7 @@ const targets = ref<Address[]>([
btndisable: false,
},
{
image: tmdb,
image: getLogoUrl('tmdb'),
name: 'www.themoviedb.org',
url: 'https://www.themoviedb.org',
proxy: true,
@@ -76,7 +69,7 @@ const targets = ref<Address[]>([
btndisable: false,
},
{
image: fanart,
image: getLogoUrl('fanart'),
name: 'webservice.fanart.tv',
url: 'https://webservice.fanart.tv',
proxy: true,
@@ -86,7 +79,7 @@ const targets = ref<Address[]>([
btndisable: false,
},
{
image: telegram,
image: getLogoUrl('telegram'),
name: 'api.telegram.org',
url: 'https://api.telegram.org',
proxy: true,
@@ -96,7 +89,7 @@ const targets = ref<Address[]>([
btndisable: false,
},
{
image: wechat,
image: getLogoUrl('wechat'),
name: 'qyapi.weixin.qq.com',
url: 'https://qyapi.weixin.qq.com/cgi-bin/gettoken',
proxy: false,
@@ -106,7 +99,7 @@ const targets = ref<Address[]>([
btndisable: false,
},
{
image: douban,
image: getLogoUrl('douban'),
name: 'frodo.douban.com',
url: 'https://frodo.douban.com',
proxy: false,
@@ -116,7 +109,7 @@ const targets = ref<Address[]>([
btndisable: false,
},
{
image: slack,
image: getLogoUrl('slack'),
name: 'slack.com',
url: 'https://slack.com',
proxy: false,
@@ -126,7 +119,7 @@ const targets = ref<Address[]>([
btndisable: false,
},
{
image: python,
image: getLogoUrl('python'),
name: 'pypi.org',
url: '{PIP_PROXY}rsa/',
proxy: true,
@@ -137,7 +130,7 @@ const targets = ref<Address[]>([
include: 'pypi:repository-version',
},
{
image: github,
image: getLogoUrl('github'),
name: 'github.com',
url: '{GITHUB_PROXY}https://github.com/jxxghp/MoviePilot/blob/v2/README.md',
proxy: true,
@@ -148,7 +141,7 @@ const targets = ref<Address[]>([
include: 'MoviePilot',
},
{
image: github,
image: getLogoUrl('github'),
name: 'codeload.github.com',
url: 'https://codeload.github.com',
proxy: true,
@@ -158,7 +151,7 @@ const targets = ref<Address[]>([
btndisable: false,
},
{
image: github,
image: getLogoUrl('github'),
name: 'api.github.com',
url: 'https://api.github.com',
proxy: true,
@@ -168,7 +161,7 @@ const targets = ref<Address[]>([
btndisable: false,
},
{
image: github,
image: getLogoUrl('github'),
name: 'raw.githubusercontent.com',
url: '{GITHUB_PROXY}https://raw.githubusercontent.com/jxxghp/MoviePilot/v2/README.md',
proxy: true,
@@ -188,7 +181,7 @@ const resolveStatusColor: Status = {
}
const abortControllers = new Set<AbortController>()
const isUnmounting = ref(false);
const isUnmounting = ref(false)
// 调用API测试网络连接
async function netTest(index: number) {
@@ -229,17 +222,16 @@ async function netTest(index: number) {
// 加载时测试所有连接
onMounted(async () => {
isUnmounting.value = false;
for (let i = 0; !isUnmounting.value && i < targets.value.length; i++)
await netTest(i)
isUnmounting.value = false
for (let i = 0; !isUnmounting.value && i < targets.value.length; i++) await netTest(i)
})
onBeforeUnmount(() => {
isUnmounting.value = true;
isUnmounting.value = true
for (const controller of abortControllers) {
controller.abort()
}
abortControllers.clear()
});
})
</script>
<template>