feat: 统一系统图标渲染方式并优化代码生成预览

- 将操作系统和浏览器图标从自定义组件改为使用 Iconify 类名,简化渲染逻辑
- 在登录信息和在线用户表格中,将操作系统图标与文本并排显示,提升可读性
- 重构代码生成预览功能,将图标配置移至独立文件,提高可维护性
- 更新 GitHub 图标引用,使用 Ant Design Vue 的 GithubOutlined 组件
This commit is contained in:
dap
2026-01-23 11:12:26 +08:00
parent 052d7d5cdd
commit d475b29e9f
8 changed files with 55 additions and 137 deletions

View File

@@ -1,29 +1,22 @@
<script setup lang="ts">
import type { Key } from 'antdv-next/es/vc-tree/interface';
import type { Key } from 'antdv-next/dist/table/interface';
import type { Component } from 'vue';
import type { LanguageSupport } from '@vben/common-ui';
import type { Recordable } from '@vben/types';
import { markRaw, ref } from 'vue';
import { ref } from 'vue';
import { CodeMirror, useVbenModal } from '@vben/common-ui';
import {
DefaultFileIcon,
FolderIcon,
JavaIcon,
SqlIcon,
TsIcon,
VueIcon,
XmlIcon,
} from '@vben/icons';
import { useClipboard } from '@vueuse/core';
import { Alert, Skeleton, Tree } from 'antdv-next';
import { previewCode } from '#/api/tool/gen';
import { defaultFileIcon, defaultFolderIcon, iconMap } from './data';
interface TreeNode {
children: TreeNode[];
title: string;
@@ -97,17 +90,7 @@ function convertToTree(paths: string[]): TreeNode[] {
return tree;
}
const iconMap = [
{ key: 'java', value: markRaw(JavaIcon) },
{ key: 'xml', value: markRaw(XmlIcon) },
{ key: 'sql', value: markRaw(SqlIcon) },
{ key: 'ts', value: markRaw(TsIcon) },
{ key: 'vue', value: markRaw(VueIcon) },
{ key: 'folder', value: markRaw(FolderIcon) },
];
function findIcon(path: string) {
const defaultFileIcon = DefaultFileIcon;
const defaultFolderIcon = FolderIcon;
if (path.endsWith('.vm')) {
const realPath = path.slice(0, -3);
// 是否为指定拓展名
@@ -178,7 +161,7 @@ const { copy } = useClipboard({ legacy: true });
default-expand-all
@select="handleSelect"
>
<template #title="{ title, icon }">
<template #titleRender="{ title, icon }">
<div class="flex items-center gap-[16px]">
<component :is="icon" />
<span>{{ title }}</span>