Merge branch 'shiy' into awen

This commit is contained in:
2025-04-11 18:46:01 +08:00
18 changed files with 3298 additions and 371 deletions
+7 -1
View File
@@ -49,6 +49,12 @@ export function Sidebar({ onToggle, collapsed }: SidebarProps) {
path:'/documents',
icon:'ri-file-list-3-line'
}
// {
// id:'documents-edit',
// title:'文档编辑',
// path:'/documents/edit',
// icon:'ri-file-edit-line'
// }
]
},
{
@@ -110,7 +116,7 @@ export function Sidebar({ onToggle, collapsed }: SidebarProps) {
{
id: 'document-types',
title: '文档类型',
path: '/doc-types',
path: '/document-types',
icon: 'ri-file-list-line'
},
{
+32 -1
View File
@@ -14,6 +14,7 @@ interface FileTypeTagProps {
className?: string;
size?: 'default' | 'sm' | 'lg';
showIcon?: boolean;
fileType?: string;
}
export function links() {
@@ -28,13 +29,15 @@ export function links() {
* @param className 额外的类名
* @param size 尺寸:default, sm, lg
* @param showIcon 是否显示图标,默认为true
* @param fileType 文件类型,不提供则使用文档类型决定样式
*/
export function FileTypeTag({
type,
text,
className = '',
size = 'default',
showIcon = true
showIcon = true,
fileType
}: FileTypeTagProps) {
// 文档类型对应的图标
const getTypeIcon = () => {
@@ -64,9 +67,37 @@ export function FileTypeTag({
// 获取文档类型对应的类名
const getTypeClass = () => {
// 如果有文件类型,优先使用文件类型决定样式
if (fileType) {
const fileTypeClass = getFileTypeClass(fileType);
if (fileTypeClass) {
return `file-type-tag ${fileTypeClass}`;
}
}
return `file-type-tag file-type-${type}`;
};
// 根据文件扩展名获取对应的样式类名
const getFileTypeClass = (ext: string) => {
ext = ext.toLowerCase();
if (ext === 'pdf') {
return 'file-type-tag-pdf';
} else if (ext === 'doc' || ext === 'docx') {
return 'file-type-tag-doc';
} else if (ext === 'xls' || ext === 'xlsx') {
return 'file-type-tag-xls';
} else if (ext === 'ppt' || ext === 'pptx') {
return 'file-type-tag-ppt';
} else if (ext === 'zip' || ext === 'rar') {
return 'file-type-tag-zip';
} else if (ext === 'jpg' || ext === 'jpeg' || ext === 'png' || ext === 'gif') {
return 'file-type-tag-img';
} else if (ext === 'txt') {
return 'file-type-tag-txt';
}
return null;
};
// 获取尺寸类名
const getSizeClass = () => {
return size !== 'default' ? `file-type-tag-${size}` : '';