perf: 优化依赖与首屏加载
This commit is contained in:
+19
-21
@@ -31,18 +31,16 @@ import { useActualTheme } from '../../context/Theme';
|
||||
import { marked } from 'marked';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Link, useNavigate } from 'react-router-dom';
|
||||
import {
|
||||
Moonshot,
|
||||
OpenAI,
|
||||
Zhipu,
|
||||
Claude,
|
||||
Gemini,
|
||||
Wenxin,
|
||||
Spark,
|
||||
DeepSeek,
|
||||
Qwen,
|
||||
Midjourney,
|
||||
} from '@lobehub/icons';
|
||||
import Moonshot from '@lobehub/icons/es/Moonshot/components/Mono';
|
||||
import OpenAI from '@lobehub/icons/es/OpenAI/components/Mono';
|
||||
import Zhipu from '@lobehub/icons/es/Zhipu/components/Color';
|
||||
import Claude from '@lobehub/icons/es/Claude/components/Color';
|
||||
import Gemini from '@lobehub/icons/es/Gemini/components/Color';
|
||||
import Wenxin from '@lobehub/icons/es/Wenxin/components/Color';
|
||||
import Spark from '@lobehub/icons/es/Spark/components/Color';
|
||||
import DeepSeek from '@lobehub/icons/es/DeepSeek/components/Color';
|
||||
import Qwen from '@lobehub/icons/es/Qwen/components/Color';
|
||||
import Midjourney from '@lobehub/icons/es/Midjourney/components/Mono';
|
||||
import {
|
||||
Cpu,
|
||||
Server,
|
||||
@@ -299,15 +297,15 @@ const Home = () => {
|
||||
// 模型列表
|
||||
const modelIcons = [
|
||||
{ Icon: OpenAI, name: 'OpenAI' },
|
||||
{ Icon: Claude.Color, name: 'Claude' },
|
||||
{ Icon: Gemini.Color, name: 'Gemini' },
|
||||
{ Icon: Claude, name: 'Claude' },
|
||||
{ Icon: Gemini, name: 'Gemini' },
|
||||
{ Icon: Midjourney, name: 'Midjourney' },
|
||||
{ Icon: Qwen.Color, name: 'Qwen' },
|
||||
{ Icon: DeepSeek.Color, name: 'DeepSeek' },
|
||||
{ Icon: Zhipu.Color, name: 'ChatGLM' },
|
||||
{ Icon: Qwen, name: 'Qwen' },
|
||||
{ Icon: DeepSeek, name: 'DeepSeek' },
|
||||
{ Icon: Zhipu, name: 'ChatGLM' },
|
||||
{ Icon: Moonshot, name: 'Moonshot' },
|
||||
{ Icon: Spark.Color, name: 'Spark' },
|
||||
{ Icon: Wenxin.Color, name: 'Wenxin' },
|
||||
{ Icon: Spark, name: 'Spark' },
|
||||
{ Icon: Wenxin, name: 'Wenxin' },
|
||||
];
|
||||
|
||||
// Enterprise Style CSS
|
||||
@@ -498,10 +496,10 @@ const Home = () => {
|
||||
<OpenAI size={24} />
|
||||
</div>
|
||||
<div className='w-12 h-12 rounded-xl bg-white dark:bg-slate-800 flex items-center justify-center shadow-md border border-slate-200 dark:border-slate-700 hover:scale-110 transition-transform'>
|
||||
<Claude.Color size={24} />
|
||||
<Claude size={24} />
|
||||
</div>
|
||||
<div className='w-12 h-12 rounded-xl bg-white dark:bg-slate-800 flex items-center justify-center shadow-md border border-slate-200 dark:border-slate-700 hover:scale-110 transition-transform'>
|
||||
<Gemini.Color size={24} />
|
||||
<Gemini size={24} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -18,7 +18,6 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import React, { useEffect, useState, useMemo, useCallback } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import * as XLSX from 'xlsx';
|
||||
import {
|
||||
RefreshCw,
|
||||
Receipt,
|
||||
@@ -161,7 +160,7 @@ const EXPORT_FIELDS = [
|
||||
];
|
||||
|
||||
// 将选中字段组装成一个 worksheet(含表头、列宽)
|
||||
function buildWorksheet(rows, fields, header) {
|
||||
function buildWorksheet(XLSX, rows, fields, header) {
|
||||
const aoa = [header, ...rows.map((r) => fields.map((f) => f.value(r)))];
|
||||
const ws = XLSX.utils.aoa_to_sheet(aoa);
|
||||
ws['!cols'] = fields.map((f) => ({ wch: f.width || 14 }));
|
||||
@@ -455,6 +454,7 @@ const OrgLogs = ({ orgId, orgRole, isDeptManager = false }) => {
|
||||
}
|
||||
|
||||
const header = fields.map((f) => t(f.label));
|
||||
const XLSX = await import('xlsx');
|
||||
const wb = XLSX.utils.book_new();
|
||||
|
||||
if (exportMode === 'perUser') {
|
||||
@@ -535,7 +535,7 @@ const OrgLogs = ({ orgId, orgRole, isDeptManager = false }) => {
|
||||
);
|
||||
|
||||
for (const { name, rows } of groups.values()) {
|
||||
const ws = buildWorksheet(rows, fields, header);
|
||||
const ws = buildWorksheet(XLSX, rows, fields, header);
|
||||
XLSX.utils.book_append_sheet(
|
||||
wb,
|
||||
ws,
|
||||
@@ -544,7 +544,7 @@ const OrgLogs = ({ orgId, orgRole, isDeptManager = false }) => {
|
||||
}
|
||||
} else {
|
||||
// 汇总:所有记录放在一个 sheet 页
|
||||
const ws = buildWorksheet(allLogs, fields, header);
|
||||
const ws = buildWorksheet(XLSX, allLogs, fields, header);
|
||||
XLSX.utils.book_append_sheet(
|
||||
wb,
|
||||
ws,
|
||||
|
||||
Reference in New Issue
Block a user