feat(components): 新增创建分类和笔记对话框及头部组件
- 新增 CreateGroupDialog 组件用于创建分类 - 新增 CreateNoteDialog 组件用于创建笔记 - 新增 HomeHeader 组件用于显示主页头部信息 - 对话框组件使用 Element Plus 样式- 头部组件包含用户操作按钮和搜索功能
This commit is contained in:
80
biji-qianduan/src/components/home/NoteList.vue
Normal file
80
biji-qianduan/src/components/home/NoteList.vue
Normal file
@@ -0,0 +1,80 @@
|
||||
<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-title">
|
||||
<span>{{ file.title }}</span>
|
||||
<span class="file-group-name">{{ file.groupingName }}</span>
|
||||
<el-icon v-if="file.isPrivate === 1 && !isUserLoggedIn" class="lock-icon"><Lock /></el-icon>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
<el-empty v-else description="暂无笔记,请创建或上传" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { Lock } 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: var(--border-radius);
|
||||
border: 1px solid transparent;
|
||||
transition: all var(--transition-duration) ease;
|
||||
background-color: rgba(255, 255, 255, 0.8);
|
||||
}
|
||||
|
||||
.dark-theme .file-item {
|
||||
background-color: rgba(30, 30, 47, 0.8);
|
||||
}
|
||||
|
||||
.file-item:hover {
|
||||
transform: translateY(-4px);
|
||||
box-shadow: var(--box-shadow);
|
||||
border-color: var(--primary-color);
|
||||
}
|
||||
|
||||
.file-title {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.file-group-name {
|
||||
font-size: 0.75rem;
|
||||
color: var(--text-color-secondary);
|
||||
background-color: var(--bg-color-secondary);
|
||||
padding: 0.2rem 0.5rem;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.lock-icon {
|
||||
color: var(--text-color-secondary);
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user