fix:优化前端图片展示添加默认图片

This commit is contained in:
jiangrui
2025-03-12 15:23:11 +08:00
parent bc38acded3
commit bf2d7c70c7
7 changed files with 32 additions and 46 deletions

View File

@@ -12,12 +12,8 @@
<div class="detail-cover">
<el-image
class="cover-image"
:src="
userStore.imagesSource === 'proxy'
? `/tele-images/?url=${encodeURIComponent(currentResource.image as string)}`
: currentResource.image
"
fit="cover"
:src="getProxyImageUrl(currentResource.image as string)"
:fit="currentResource.image ? 'cover' : 'contain'"
/>
<el-tag
class="cloud-type"
@@ -78,14 +74,10 @@
@click.stop
>
<el-image
:src="
userStore.imagesSource === 'proxy'
? `/tele-images/?url=${encodeURIComponent(group.channelInfo.channelLogo)}`
: group.channelInfo.channelLogo
"
:src="getProxyImageUrl(group.channelInfo.channelLogo)"
:fit="group.channelInfo.channelLogo ? 'cover' : 'contain'"
class="channel-logo"
scroll-container="#pc-resources-content"
fit="cover"
loading="lazy"
/>
<span>{{ group.channelInfo.name }}</span>
@@ -101,7 +93,7 @@
</el-tooltip>
</div>
<div v-show="group.displayList" class="group-content">
<div v-if="group.displayList" class="group-content">
<div class="card-grid">
<el-card
v-for="resource in group.list"
@@ -114,12 +106,8 @@
<el-image
loading="lazy"
class="cover-image"
:src="
userStore.imagesSource === 'proxy'
? `/tele-images/?url=${encodeURIComponent(resource.image as string)}`
: resource.image
"
fit="cover"
:src="getProxyImageUrl(resource.image as string)"
:fit="resource.image ? 'cover' : 'contain'"
:alt="resource.title"
@click="showResourceDetail(resource)"
/>
@@ -194,9 +182,8 @@ import { useResourceStore } from "@/stores/resource";
import { ref } from "vue";
import type { ResourceItem, TagColor } from "@/types";
import { ArrowDown, Plus } from "@element-plus/icons-vue";
import { useUserSettingStore } from "@/stores/userSetting";
import { getProxyImageUrl } from "@/utils/image";
const userStore = useUserSettingStore();
const store = useResourceStore();
const showDetail = ref(false);

View File

@@ -15,26 +15,14 @@
<el-image
v-if="row.image"
class="table-item-image"
:src="
userStore.imagesSource === 'proxy'
? `/tele-images/?url=${encodeURIComponent(row.image as string)}`
: row.image
"
:src="getProxyImageUrl(row.image as string)"
:fit="row.image ? 'cover' : 'contain'"
hide-on-click-modal
:preview-src-list="[
`${location.origin}${
userStore.imagesSource === 'proxy'
? '/tele-images/?url=' + encodeURIComponent(row.image as string)
: row.image
}`,
]"
:zoom-rate="1.2"
:max-scale="7"
:min-scale="0.2"
:initial-index="4"
preview-teleported
:z-index="999"
fit="cover"
width="60"
height="90"
/>
@@ -94,13 +82,9 @@
<template #default="{ row }">
<div class="group-header">
<el-image
:src="
userStore.imagesSource === 'proxy'
? `/tele-images/?url=${encodeURIComponent(row.channelInfo.channelLogo as string)}`
: row.channelInfo.channelLogo
"
:src="getProxyImageUrl(row.channelInfo.channelLogo as string)"
class="channel-logo"
fit="cover"
:fit="row.channelInfo.channelLogo ? 'cover' : 'contain'"
lazy
/>
<span>{{ row.channelInfo.name }}</span>
@@ -115,8 +99,7 @@
import { useResourceStore } from "@/stores/resource";
import type { Resource, TagColor } from "@/types";
import { computed } from "vue";
import { useUserSettingStore } from "@/stores/userSetting";
const userStore = useUserSettingStore();
import { getProxyImageUrl } from "@/utils/image";
const store = useResourceStore();
const emit = defineEmits(["save", "loadMore", "searchMovieforTag", "jump"]);

View File

@@ -6,8 +6,8 @@
<!-- 左侧图片 -->
<div class="content__image">
<van-image
:src="`/tele-images/?url=${encodeURIComponent(item.image as string)}`"
fit="cover"
:src="getProxyImageUrl(item.image as string)"
:fit="item.image ? 'cover' : 'contain'"
lazy-load
/>
<!-- 来源标签移到图片左上角 -->
@@ -74,6 +74,7 @@ import { computed, ref } from "vue";
import { useResourceStore } from "@/stores/resource";
import { showNotify } from "vant";
import type { ResourceItem } from "@/types";
import { getProxyImageUrl } from "@/utils/image";
// Props 定义
const props = defineProps<{