chore: Format Code
This commit is contained in:
parent
8cf15ad837
commit
ddb35dd857
@ -46,9 +46,8 @@ export const AvatarDropdown: React.FC<GlobalHeaderRightProps> = ({ menu, childre
|
|||||||
await userLogoutUsingPost();
|
await userLogoutUsingPost();
|
||||||
const { search, pathname } = window.location;
|
const { search, pathname } = window.location;
|
||||||
const urlParams = new URL(window.location.href).searchParams;
|
const urlParams = new URL(window.location.href).searchParams;
|
||||||
/** 此方法会跳转到 redirect 参数所在的位置 */
|
/** redirect */
|
||||||
const redirect = urlParams.get('redirect');
|
const redirect = urlParams.get('redirect');
|
||||||
// Note: There may be security issues, please note
|
|
||||||
if (window.location.pathname !== '/user/login' && !redirect) {
|
if (window.location.pathname !== '/user/login' && !redirect) {
|
||||||
history.replace({
|
history.replace({
|
||||||
pathname: '/user/login',
|
pathname: '/user/login',
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { PageContainer } from '@ant-design/pro-components';
|
import { PageContainer } from '@ant-design/pro-components';
|
||||||
import { InboxOutlined, CopyOutlined, DownloadOutlined } from '@ant-design/icons';
|
import { CopyOutlined, DownloadOutlined } from '@ant-design/icons';
|
||||||
import { Upload, Card, Button, Tabs, message, Input, Spin, Radio, Space, Tooltip } from 'antd';
|
import { Upload, Card, Button, Tabs, message, Radio, Space, Tooltip } from 'antd';
|
||||||
import type { UploadFile } from 'antd/es/upload/interface';
|
import type { UploadFile } from 'antd/es/upload/interface';
|
||||||
import ReactECharts from 'echarts-for-react';
|
|
||||||
import Mermaid from '@/components/Mermaid';
|
import Mermaid from '@/components/Mermaid';
|
||||||
import MonacoEditor from '@/components/MonacoEditor';
|
import MonacoEditor from '@/components/MonacoEditor';
|
||||||
|
|
||||||
const { Dragger } = Upload;
|
const { Dragger } = Upload;
|
||||||
const { TabPane } = Tabs;
|
const { TabPane } = Tabs;
|
||||||
const { TextArea } = Input;
|
|
||||||
|
|
||||||
interface AnalysisResponse {
|
interface AnalysisResponse {
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -7,13 +7,11 @@ import {
|
|||||||
Button,
|
Button,
|
||||||
List,
|
List,
|
||||||
Avatar,
|
Avatar,
|
||||||
Spin,
|
|
||||||
Upload,
|
Upload,
|
||||||
message,
|
message,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
Space,
|
Space,
|
||||||
Tag,
|
Tag,
|
||||||
Divider,
|
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
import {
|
import {
|
||||||
SendOutlined,
|
SendOutlined,
|
||||||
@ -31,7 +29,6 @@ import styles from './index.less';
|
|||||||
import * as XLSX from 'xlsx';
|
import * as XLSX from 'xlsx';
|
||||||
import { marked } from 'marked';
|
import { marked } from 'marked';
|
||||||
|
|
||||||
const { Option } = Select;
|
|
||||||
const { Dragger } = Upload;
|
const { Dragger } = Upload;
|
||||||
const { TextArea } = Input;
|
const { TextArea } = Input;
|
||||||
|
|
||||||
@ -262,7 +259,8 @@ const AnalysisCenter: React.FC = () => {
|
|||||||
const assistantMessage: Message = {
|
const assistantMessage: Message = {
|
||||||
type: 'assistant',
|
type: 'assistant',
|
||||||
content: marked(result.choices[0].message.content
|
content: marked(result.choices[0].message.content
|
||||||
.replace(/```json\n[\s\S]*?\n```/g, '') // 先移除 JSON 代码块
|
// 移除 JSON 代码块
|
||||||
|
.replace(/```json\n[\s\S]*?\n```/g, '')
|
||||||
.trim()
|
.trim()
|
||||||
),
|
),
|
||||||
timestamp: Date.now(),
|
timestamp: Date.now(),
|
||||||
@ -286,15 +284,7 @@ const AnalysisCenter: React.FC = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const generateMockResponse = (type: string) => {
|
|
||||||
const responses: { [key: string]: string } = {
|
|
||||||
predictive: '根据历史数据分析,预计未来三个月的销售增长率将达到15%,主要增长点来自新市场的开拓。',
|
|
||||||
descriptive: '数据集中包含1000条记录,平均值为45.6,标准差为12.3,分布呈现正态分布特征。',
|
|
||||||
anomaly: '检测到3个异常值点,主要出现在数据的边缘区域,建议进行进一步核实。',
|
|
||||||
quality: '数据完整性为98.5%,存在少量缺失值,建议对缺失数据进行适当的填充处理。',
|
|
||||||
};
|
|
||||||
return responses[type] || '分析完成';
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageContainer
|
<PageContainer
|
||||||
|
@ -2,7 +2,6 @@ import React, { useState } from 'react';
|
|||||||
import { Card, List, Tag, Space, Input, Button, Select, Badge } from 'antd';
|
import { Card, List, Tag, Space, Input, Button, Select, Badge } from 'antd';
|
||||||
import { history } from '@umijs/max';
|
import { history } from '@umijs/max';
|
||||||
import {
|
import {
|
||||||
SearchOutlined,
|
|
||||||
PlusOutlined,
|
PlusOutlined,
|
||||||
EyeOutlined,
|
EyeOutlined,
|
||||||
MessageOutlined,
|
MessageOutlined,
|
||||||
@ -139,14 +138,14 @@ const ForumList: React.FC = () => {
|
|||||||
key={item.id}
|
key={item.id}
|
||||||
className={styles.postItem}
|
className={styles.postItem}
|
||||||
actions={[
|
actions={[
|
||||||
<Space className={styles.postStats}>
|
<Space key={"actions"} className={styles.postStats}>
|
||||||
<span className={styles.statItem}>
|
<span key="views" className={styles.statItem}>
|
||||||
<EyeOutlined /> {item.views}
|
<EyeOutlined /> {item.views}
|
||||||
</span>
|
</span>
|
||||||
<span className={styles.statItem}>
|
<span key="comments" className={styles.statItem}>
|
||||||
<MessageOutlined /> {item.comments}
|
<MessageOutlined /> {item.comments}
|
||||||
</span>
|
</span>
|
||||||
<span className={styles.statItem}>
|
<span key="likes" className={styles.statItem}>
|
||||||
<LikeOutlined /> {item.likes}
|
<LikeOutlined /> {item.likes}
|
||||||
</span>
|
</span>
|
||||||
</Space>,
|
</Space>,
|
||||||
|
@ -21,7 +21,7 @@ const ForumPublish: React.FC = () => {
|
|||||||
const handleSubmit = async (values: any) => {
|
const handleSubmit = async (values: any) => {
|
||||||
setSubmitting(true);
|
setSubmitting(true);
|
||||||
try {
|
try {
|
||||||
// 这里处理表单提交
|
// 处理表单提交
|
||||||
console.log('提交数据:', values);
|
console.log('提交数据:', values);
|
||||||
message.success('发布成功');
|
message.success('发布成功');
|
||||||
history.push('/forum/list');
|
history.push('/forum/list');
|
||||||
|
@ -26,7 +26,7 @@ const HomePage: React.FC = () => {
|
|||||||
avgGenerationTime: 2.5,
|
avgGenerationTime: 2.5,
|
||||||
});
|
});
|
||||||
|
|
||||||
// 图表类型分布 - 用于显示图标的数据
|
// 图表类型分布
|
||||||
const chartTypes = [
|
const chartTypes = [
|
||||||
{ value: 35, name: '折线图', icon: <LineChartOutlined /> },
|
{ value: 35, name: '折线图', icon: <LineChartOutlined /> },
|
||||||
{ value: 30, name: '柱状图', icon: <BarChartOutlined /> },
|
{ value: 30, name: '柱状图', icon: <BarChartOutlined /> },
|
||||||
@ -34,7 +34,7 @@ const HomePage: React.FC = () => {
|
|||||||
{ value: 15, name: '散点图', icon: <DotChartOutlined /> },
|
{ value: 15, name: '散点图', icon: <DotChartOutlined /> },
|
||||||
];
|
];
|
||||||
|
|
||||||
// 为ECharts准备的数据,不包含React组件
|
// ECharts准备的数据
|
||||||
const chartTypesForEcharts = chartTypes.map(({ value, name }) => ({ value, name }));
|
const chartTypesForEcharts = chartTypes.map(({ value, name }) => ({ value, name }));
|
||||||
|
|
||||||
const chartOptions = {
|
const chartOptions = {
|
||||||
@ -130,7 +130,7 @@ const HomePage: React.FC = () => {
|
|||||||
labelLine: {
|
labelLine: {
|
||||||
show: false,
|
show: false,
|
||||||
},
|
},
|
||||||
// 这里使用过滤后的数据,不包含React组件
|
// 使用过滤后的数据
|
||||||
data: chartTypesForEcharts,
|
data: chartTypesForEcharts,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { PageContainer } from '@ant-design/pro-components';
|
import { PageContainer } from '@ant-design/pro-components';
|
||||||
import { InboxOutlined, FileExcelOutlined, BarChartOutlined, FileWordOutlined } from '@ant-design/icons';
|
import { InboxOutlined, FileExcelOutlined, BarChartOutlined, FileWordOutlined } from '@ant-design/icons';
|
||||||
import { Upload, Card, Button, Steps, message, Input, Spin, Result, Space, Progress, Alert, Typography } from 'antd';
|
import { Upload, Card, Button, Steps, message, Input, Spin, Result, Progress, Alert, Typography } from 'antd';
|
||||||
import type { UploadFile } from 'antd/es/upload/interface';
|
import type { UploadFile } from 'antd/es/upload/interface';
|
||||||
import ReactECharts from 'echarts-for-react';
|
|
||||||
import { marked } from 'marked';
|
import { marked } from 'marked';
|
||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
import { Document, Packer, Paragraph as DocxParagraph, TextRun } from 'docx';
|
import { Document, Packer, Paragraph as DocxParagraph, TextRun } from 'docx';
|
||||||
|
@ -22,7 +22,7 @@ import {
|
|||||||
UploadOutlined,
|
UploadOutlined,
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import { useModel } from '@umijs/max';
|
import { useModel } from '@umijs/max';
|
||||||
import type { RcFile, UploadProps } from 'antd/es/upload';
|
import type { UploadProps } from 'antd/es/upload';
|
||||||
|
|
||||||
const { TabPane } = Tabs;
|
const { TabPane } = Tabs;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user