默认封面
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
<template>
|
||||
<div class="article-card" @click="handleClick">
|
||||
<div class="article-image">
|
||||
<img v-if="resource?.coverImage" :src="FILE_DOWNLOAD_URL + resource.coverImage" :alt="resource.title" />
|
||||
<div v-else class="image-placeholder"></div>
|
||||
<img :src="resource?.coverImage ? (FILE_DOWNLOAD_URL + resource.coverImage) : defaultArticleImg" :alt="resource.title" />
|
||||
<div class="article-tag">精选文章</div>
|
||||
</div>
|
||||
<div class="article-content">
|
||||
@@ -27,6 +26,7 @@ import { useRouter } from 'vue-router';
|
||||
import { Document } from '@element-plus/icons-vue';
|
||||
import type { ResourceRecommendVO } from '@/types';
|
||||
import { FILE_DOWNLOAD_URL } from '@/config';
|
||||
import defaultArticleImg from '@/assets/imgs/article-default.png';
|
||||
|
||||
const props = defineProps<{
|
||||
resource?: ResourceRecommendVO;
|
||||
@@ -82,20 +82,6 @@ function handleClick() {
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.image-placeholder {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: url('data:image/svg+xml,<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse"><path d="M 40 0 L 0 0 0 40" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="1"/></pattern></defs><rect width="100%" height="100%" fill="url(%23grid)" /></svg>');
|
||||
}
|
||||
}
|
||||
|
||||
.article-tag {
|
||||
position: absolute;
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
<template>
|
||||
<div class="ideological-card" @click="handleClick">
|
||||
<div class="card-image">
|
||||
<img v-if="resource?.coverImage" :src="FILE_DOWNLOAD_URL + resource.coverImage" :alt="resource.title" />
|
||||
<div v-else class="image-placeholder"></div>
|
||||
<img :src="resource?.coverImage ? (FILE_DOWNLOAD_URL + resource.coverImage) : defaultArticleImg" :alt="resource.title" />
|
||||
</div>
|
||||
<div class="date-box" v-if="publishDate">
|
||||
<div class="day">{{ publishDate.day }}</div>
|
||||
@@ -22,6 +21,7 @@ import { computed } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import type { ResourceRecommendVO } from '@/types';
|
||||
import { FILE_DOWNLOAD_URL } from '@/config';
|
||||
import defaultArticleImg from '@/assets/imgs/article-default.png';
|
||||
|
||||
const props = defineProps<{
|
||||
resource?: ResourceRecommendVO;
|
||||
@@ -81,20 +81,6 @@ function handleClick() {
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.image-placeholder {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: url('data:image/svg+xml,<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="dots" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="1.5" fill="rgba(255,255,255,0.2)"/></pattern></defs><rect width="100%" height="100%" fill="url(%23dots)" /></svg>');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.date-box {
|
||||
|
||||
Reference in New Issue
Block a user