118 lines
2.6 KiB
Vue
118 lines
2.6 KiB
Vue
<template>
|
|
<div v-if="files.length > 0" class="file-list">
|
|
<el-card
|
|
v-for="file in files"
|
|
:key="file.id"
|
|
shadow="hover"
|
|
class="file-item"
|
|
:class="{ 'private-note': file.isPrivate === 1 }"
|
|
>
|
|
<div @click="$emit('preview', file)" class="file-content">
|
|
<div class="file-title-wrapper">
|
|
<el-icon class="file-icon"><Document /></el-icon>
|
|
<span class="file-title-text">{{ file.title }}</span>
|
|
</div>
|
|
<div class="file-meta">
|
|
<span class="file-group-name">{{ file.groupingName }}</span>
|
|
<el-icon v-if="file.isPrivate === 1 && !isUserLoggedIn" class="lock-icon"><Lock /></el-icon>
|
|
</div>
|
|
</div>
|
|
</el-card>
|
|
</div>
|
|
<el-empty v-else description="暂无笔记,请创建或上传" />
|
|
</template>
|
|
|
|
<script setup>
|
|
import { Lock, Document } from '@element-plus/icons-vue';
|
|
|
|
const props = defineProps({
|
|
files: {
|
|
type: Array,
|
|
required: true,
|
|
},
|
|
isUserLoggedIn: {
|
|
type: Boolean,
|
|
required: true,
|
|
}
|
|
});
|
|
|
|
defineEmits(['preview']);
|
|
</script>
|
|
|
|
<style scoped>
|
|
.file-list {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
|
|
gap: 1.5rem;
|
|
}
|
|
|
|
.file-item {
|
|
cursor: pointer;
|
|
border-radius: 12px; /* Increased border radius */
|
|
border: 1px solid var(--border-color);
|
|
transition: all var(--transition-duration) ease;
|
|
background-color: #ffffff; /* Explicitly set to white for light theme */
|
|
box-shadow: 0 2px 8px rgba(0,0,0,0.05);
|
|
overflow: hidden; /* Ensure content respects border radius */
|
|
}
|
|
|
|
.dark-theme .file-item {
|
|
background-color: #161b22; /* A darker card color for dark theme */
|
|
border-color: var(--border-color-dark);
|
|
}
|
|
|
|
.file-item:hover {
|
|
transform: translateY(-5px);
|
|
box-shadow: var(--box-shadow-lifted);
|
|
border-color: var(--primary-color);
|
|
}
|
|
|
|
.file-content {
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: space-between;
|
|
padding: 1rem 1.2rem;
|
|
min-height: 80px; /* Give some consistent height */
|
|
}
|
|
|
|
.file-title-wrapper {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.75rem;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.file-icon {
|
|
font-size: 1.2rem;
|
|
color: var(--text-color-secondary);
|
|
}
|
|
|
|
.file-title-text {
|
|
font-weight: 600;
|
|
color: var(--text-color);
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
|
|
.file-meta {
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.file-group-name {
|
|
font-size: 0.75rem;
|
|
font-weight: 500;
|
|
color: var(--primary-color);
|
|
background-color: var(--primary-color-light);
|
|
padding: 0.25rem 0.6rem;
|
|
border-radius: var(--border-radius-full);
|
|
}
|
|
|
|
.lock-icon {
|
|
color: var(--el-color-warning);
|
|
}
|
|
</style>
|