移动工程
This commit is contained in:
@@ -0,0 +1 @@
|
||||
@import (reference) '~antd/es/style/themes/index';
|
||||
@@ -0,0 +1,114 @@
|
||||
import { deleteFile, file } from '@/services/files/api';
|
||||
import type { ActionType, ProColumns } from '@ant-design/pro-components';
|
||||
import {
|
||||
PageContainer,
|
||||
ProFormText,
|
||||
ProTable,
|
||||
QueryFilter,
|
||||
} from '@ant-design/pro-components';
|
||||
import { Typography, message, Popconfirm } from 'antd';
|
||||
import React, { useRef, useState } from 'react';
|
||||
|
||||
const { Link } = Typography;
|
||||
|
||||
const handleDelete = async (deletefile: FILES.File) => {
|
||||
const hide = message.loading('正在删除');
|
||||
try {
|
||||
const result = await deleteFile(deletefile.id);
|
||||
hide();
|
||||
if (result.resp_code === 0) {
|
||||
message.success('删除File成功');
|
||||
return true;
|
||||
} else {
|
||||
message.error(result.resp_msg);
|
||||
return false;
|
||||
}
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('删除File失败');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
const TableList: React.FC = () => {
|
||||
const actionRef = useRef<ActionType>();
|
||||
const [params, setParams] = useState<Record<string, string | number>>({ });
|
||||
const columns: ProColumns<FILES.File>[] = [
|
||||
{
|
||||
dataIndex: 'index',
|
||||
valueType: 'indexBorder',
|
||||
},
|
||||
{
|
||||
title: '流媒体名称',
|
||||
dataIndex: 'name',
|
||||
},
|
||||
{
|
||||
title: '文件大小(B)',
|
||||
dataIndex: 'size',
|
||||
valueType: 'digit',
|
||||
},
|
||||
{
|
||||
title: '媒体类型',
|
||||
dataIndex: 'contentType',
|
||||
},
|
||||
{
|
||||
title: '文件系统',
|
||||
dataIndex: 'grantType',
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
valueType: 'dateTime',
|
||||
},
|
||||
{
|
||||
title: '内容',
|
||||
dataIndex: 'accountType',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
render: (_, entity) => <Popconfirm
|
||||
title={`确认删除文件[${entity.name}]?`}
|
||||
onConfirm={async () => {
|
||||
const success = await handleDelete(entity);
|
||||
if (success) {
|
||||
if (actionRef.current) {
|
||||
actionRef.current.reload();
|
||||
}
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Link>删除</Link>
|
||||
</Popconfirm>,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<PageContainer header={{ subTitle: '管理文件' }}>
|
||||
<QueryFilter
|
||||
defaultCollapsed
|
||||
split
|
||||
span={6}
|
||||
className="query-filter"
|
||||
onFinish={async (values) => setParams(values)}
|
||||
>
|
||||
<ProFormText name="name" label="搜索" placeholder="输入关键字" />
|
||||
</QueryFilter>
|
||||
<ProTable<FILES.File>
|
||||
rowKey="id"
|
||||
headerTitle="文件管理"
|
||||
request={file}
|
||||
actionRef={actionRef}
|
||||
columns={columns}
|
||||
search={false}
|
||||
params={params}
|
||||
pagination={{
|
||||
showSizeChanger: true,
|
||||
showQuickJumper: true,
|
||||
}}
|
||||
/>
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
|
||||
export default TableList;
|
||||
@@ -0,0 +1 @@
|
||||
@import (reference) '~antd/es/style/themes/index';
|
||||
@@ -0,0 +1,122 @@
|
||||
import { auditlog } from '@/services/search/api';
|
||||
import type { ProColumns } from '@ant-design/pro-components';
|
||||
import {
|
||||
PageContainer,
|
||||
ProFormText,
|
||||
ProTable,
|
||||
QueryFilter,
|
||||
ProFormSelect,
|
||||
} from '@ant-design/pro-components';
|
||||
import React, { useState } from 'react';
|
||||
import moment from 'moment';
|
||||
|
||||
const AuditLog: React.FC = () => {
|
||||
const [params, setParams] = useState<Record<string, string | number>>();
|
||||
|
||||
const columns: ProColumns<SEARCH.AuditLog>[] = [
|
||||
{
|
||||
dataIndex: 'index',
|
||||
valueType: 'indexBorder',
|
||||
width: 20,
|
||||
},
|
||||
{
|
||||
title: '日志时间',
|
||||
key: 'timestamp',
|
||||
width: 75,
|
||||
render(_, entity) {
|
||||
return moment(entity.timestamp).format('YYYY-MM-DD HH:mm:SS');
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '用户id',
|
||||
dataIndex: 'userId',
|
||||
width: 30,
|
||||
},
|
||||
{
|
||||
title: '用户名',
|
||||
dataIndex: 'userName',
|
||||
width: 40,
|
||||
},
|
||||
{
|
||||
title: '租户id',
|
||||
dataIndex: 'clientId',
|
||||
width: 50,
|
||||
},
|
||||
{
|
||||
title: '操作信息',
|
||||
dataIndex: 'operation',
|
||||
width: 150,
|
||||
ellipsis: true,
|
||||
render: (_, entity) =>
|
||||
entity.operation && <span dangerouslySetInnerHTML={{ __html: entity.operation }} />,
|
||||
},
|
||||
{
|
||||
title: '应用名',
|
||||
dataIndex: 'appName',
|
||||
width: 50,
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '类名',
|
||||
dataIndex: 'className',
|
||||
width: 150,
|
||||
ellipsis: true,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<PageContainer header={{ subTitle: '查看系统日志' }}>
|
||||
<QueryFilter
|
||||
defaultCollapsed
|
||||
split
|
||||
span={8}
|
||||
className="query-filter"
|
||||
onFinish={async (values) => {
|
||||
let queryStr = '';
|
||||
const { searchKey, searchValue } = values;
|
||||
if (searchKey && searchValue) {
|
||||
if (searchKey === 'none') {
|
||||
queryStr = searchValue;
|
||||
} else {
|
||||
queryStr = `${searchKey}:${searchValue}`;
|
||||
}
|
||||
}
|
||||
setParams({ ...params, queryStr });
|
||||
}}
|
||||
// onReset={() => setParams({})}
|
||||
>
|
||||
<ProFormSelect
|
||||
name="searchKey"
|
||||
label="搜索"
|
||||
valueEnum={{
|
||||
none: '全文搜索',
|
||||
appName: '应用名',
|
||||
classname: '类别',
|
||||
methodName: '方法名',
|
||||
userId: '用户ID',
|
||||
userName: '用户名',
|
||||
clientId: '租户ID',
|
||||
operation: '操作信息',
|
||||
}}
|
||||
/>
|
||||
<ProFormText name="searchValue" />
|
||||
</QueryFilter>
|
||||
<ProTable<SEARCH.AuditLog>
|
||||
className="audit-log"
|
||||
rowKey="id"
|
||||
headerTitle="系统日志"
|
||||
request={auditlog}
|
||||
columns={columns}
|
||||
search={false}
|
||||
params={params}
|
||||
size="small"
|
||||
pagination={{
|
||||
showSizeChanger: true,
|
||||
showQuickJumper: true,
|
||||
}}
|
||||
/>
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
|
||||
export default AuditLog;
|
||||
@@ -0,0 +1 @@
|
||||
@import (reference) '~antd/es/style/themes/index';
|
||||
@@ -0,0 +1,104 @@
|
||||
import { slowQueryLog } from '@/services/search/api';
|
||||
import type { ProColumns } from '@ant-design/pro-components';
|
||||
import {
|
||||
PageContainer,
|
||||
ProFormText,
|
||||
ProTable,
|
||||
QueryFilter,
|
||||
ProFormSelect,
|
||||
} from '@ant-design/pro-components';
|
||||
import React, { useState } from 'react';
|
||||
|
||||
const SlowSqlLog: React.FC = () => {
|
||||
const [params, setParams] = useState<Record<string, string | number>>();
|
||||
|
||||
const columns: ProColumns<SEARCH.SlowSqlLog>[] = [
|
||||
{
|
||||
dataIndex: 'index',
|
||||
valueType: 'indexBorder',
|
||||
width: 20,
|
||||
},
|
||||
{
|
||||
title: '日志时间',
|
||||
key: 'timestamp',
|
||||
width: 75,
|
||||
},
|
||||
{
|
||||
title: '查询语句',
|
||||
dataIndex: 'userId',
|
||||
width: 30,
|
||||
},
|
||||
{
|
||||
title: '查询时间(ms)',
|
||||
dataIndex: 'userName',
|
||||
width: 40,
|
||||
},
|
||||
{
|
||||
title: '锁等待时间(ms)',
|
||||
dataIndex: 'clientId',
|
||||
width: 50,
|
||||
},
|
||||
{
|
||||
title: '返回行数',
|
||||
dataIndex: 'operation',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '优化器扫描行数',
|
||||
dataIndex: 'appName',
|
||||
width: 50,
|
||||
ellipsis: true,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<PageContainer header={{ subTitle: '查看慢查询日志' }}>
|
||||
<QueryFilter
|
||||
defaultCollapsed
|
||||
split
|
||||
span={8}
|
||||
className="query-filter"
|
||||
onFinish={async (values) => {
|
||||
let queryStr = '';
|
||||
const { searchKey, searchValue } = values;
|
||||
if (searchKey && searchValue) {
|
||||
if (searchKey === 'none') {
|
||||
queryStr = searchValue;
|
||||
} else {
|
||||
queryStr = `${searchKey}:${searchValue}`;
|
||||
}
|
||||
}
|
||||
setParams({ ...params, queryStr });
|
||||
}}
|
||||
// onReset={() => setParams({})}
|
||||
>
|
||||
<ProFormSelect
|
||||
name="searchKey"
|
||||
label="搜索"
|
||||
initialValue={['全文搜索']}
|
||||
valueEnum={{
|
||||
none: '全文搜索',
|
||||
query_str: '查询语句',
|
||||
}}
|
||||
/>
|
||||
<ProFormText name="searchValue" />
|
||||
</QueryFilter>
|
||||
<ProTable<SEARCH.SlowSqlLog>
|
||||
className="audit-log"
|
||||
rowKey="id"
|
||||
headerTitle="慢查询日志"
|
||||
request={slowQueryLog}
|
||||
columns={columns}
|
||||
search={false}
|
||||
params={params}
|
||||
size="small"
|
||||
pagination={{
|
||||
showSizeChanger: true,
|
||||
showQuickJumper: true,
|
||||
}}
|
||||
/>
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
|
||||
export default SlowSqlLog;
|
||||
@@ -0,0 +1,76 @@
|
||||
import { Button, Modal, Table } from 'antd';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { tracelog } from '@/services/search/api';
|
||||
import styles from '../index.less';
|
||||
import type { TableColumnType } from 'antd';
|
||||
import { treeify } from 'treeify-js';
|
||||
import { NodeIndexOutlined } from '@ant-design/icons';
|
||||
|
||||
type IndexViewProps = {
|
||||
traceId?: string;
|
||||
onCancel: () => void;
|
||||
open: boolean;
|
||||
};
|
||||
|
||||
const TraceView: React.FC<IndexViewProps> = (props) => {
|
||||
const [traces, setTraces] = useState<SEARCH.TraceLog[]>();
|
||||
const { traceId } = props;
|
||||
|
||||
const columns: TableColumnType<SEARCH.TraceLog>[] = [
|
||||
{
|
||||
title: '应用名',
|
||||
dataIndex: 'appName',
|
||||
},
|
||||
{
|
||||
title: 'spanId',
|
||||
dataIndex: 'spanId',
|
||||
},
|
||||
{
|
||||
title: '服务ip',
|
||||
dataIndex: 'serverIp',
|
||||
},
|
||||
{
|
||||
title: '服务端口',
|
||||
dataIndex: 'serverPort',
|
||||
},
|
||||
];
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
if (traceId) {
|
||||
const data = (await tracelog(traceId)) ?? [];
|
||||
const treeData = treeify(data, { id: 'spanId', root: '-1', multi: true });
|
||||
setTraces(treeData);
|
||||
}
|
||||
})();
|
||||
}, [traceId]);
|
||||
|
||||
return (
|
||||
<Modal
|
||||
title={
|
||||
<>
|
||||
<NodeIndexOutlined />
|
||||
日志链路
|
||||
</>
|
||||
}
|
||||
className={styles.viewModal}
|
||||
width={800}
|
||||
open={props.open}
|
||||
onCancel={props.onCancel}
|
||||
footer={
|
||||
<Button type="primary" onClick={props.onCancel}>
|
||||
关闭
|
||||
</Button>
|
||||
}
|
||||
>
|
||||
<Table<SEARCH.TraceLog>
|
||||
columns={columns}
|
||||
dataSource={traces}
|
||||
pagination={false}
|
||||
size="small"
|
||||
/>
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
export default TraceView;
|
||||
@@ -0,0 +1,12 @@
|
||||
@import (reference) '~antd/es/style/themes/index';
|
||||
|
||||
.view {
|
||||
height: 400px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.viewModal {
|
||||
.ant-modal-body {
|
||||
padding: @padding-md;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
import { syslog } from '@/services/search/api';
|
||||
import type { ProColumns } from '@ant-design/pro-components';
|
||||
import {
|
||||
PageContainer,
|
||||
ProFormText,
|
||||
ProTable,
|
||||
QueryFilter,
|
||||
ProFormSelect,
|
||||
} from '@ant-design/pro-components';
|
||||
import React, { useState } from 'react';
|
||||
import moment from 'moment';
|
||||
import TraceView from './components/TraceView';
|
||||
import { Typography } from 'antd';
|
||||
|
||||
type TraceViewProps = {
|
||||
traceId?: string;
|
||||
open: boolean;
|
||||
};
|
||||
|
||||
const { Link } = Typography;
|
||||
|
||||
const TableList: React.FC = () => {
|
||||
const [params, setParams] = useState<Record<string, string | number>>({
|
||||
sortCol: 'timestamp',
|
||||
isHighlighter: 'true',
|
||||
});
|
||||
const [traceView, setTraceView] = useState<TraceViewProps>({ open: false });
|
||||
|
||||
const columns: ProColumns<SEARCH.SysLog>[] = [
|
||||
{
|
||||
dataIndex: 'index',
|
||||
valueType: 'indexBorder',
|
||||
width: 20,
|
||||
},
|
||||
{
|
||||
title: '时间',
|
||||
key: 'timestamp',
|
||||
width: 75,
|
||||
render(_, entity) {
|
||||
return moment(entity.timestamp).format('YYYY-MM-DD HH:mm:SS');
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '日志信息',
|
||||
dataIndex: 'message',
|
||||
ellipsis: true,
|
||||
width: 200,
|
||||
},
|
||||
{
|
||||
title: '日志级别',
|
||||
dataIndex: 'logLevel',
|
||||
width: 40,
|
||||
},
|
||||
{
|
||||
title: '应用名',
|
||||
dataIndex: 'appName',
|
||||
width: 50,
|
||||
},
|
||||
{
|
||||
title: '追踪id',
|
||||
key: 'traceId',
|
||||
width: 80,
|
||||
render(_, entity) {
|
||||
return (
|
||||
<Link
|
||||
onClick={() => {
|
||||
setTraceView({ traceId: entity.traceId, open: true });
|
||||
}}
|
||||
>
|
||||
{entity.traceId}
|
||||
</Link>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'spanId',
|
||||
dataIndex: 'spanId',
|
||||
width: 40,
|
||||
},
|
||||
{
|
||||
title: '类名',
|
||||
dataIndex: 'classname',
|
||||
width: 110,
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '线程名',
|
||||
dataIndex: 'threadName',
|
||||
width: 50,
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '服务ip',
|
||||
dataIndex: 'serverIp',
|
||||
width: 50,
|
||||
},
|
||||
{
|
||||
title: '服务端口',
|
||||
dataIndex: 'serverPort',
|
||||
width: 35,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<PageContainer header={{ subTitle: '查看系统日志' }}>
|
||||
<QueryFilter
|
||||
defaultCollapsed
|
||||
split
|
||||
span={8}
|
||||
className="query-filter"
|
||||
onFinish={async (values) => {
|
||||
let queryStr = '';
|
||||
const { searchKey, searchValue } = values;
|
||||
if (searchKey && searchValue) {
|
||||
if (searchKey === 'none') {
|
||||
queryStr = searchValue;
|
||||
} else {
|
||||
queryStr = `${searchKey}:${searchValue}`;
|
||||
}
|
||||
}
|
||||
setParams({ ...params, queryStr });
|
||||
}}
|
||||
// onReset={() => setParams({})}
|
||||
>
|
||||
<ProFormSelect
|
||||
name="searchKey"
|
||||
label="搜索"
|
||||
valueEnum={{
|
||||
none: '全文搜索',
|
||||
message: '日志信息',
|
||||
logLevel: '日志级别',
|
||||
appName: '应用名',
|
||||
classname: '类别',
|
||||
traceId: '链路追踪ID',
|
||||
}}
|
||||
/>
|
||||
<ProFormText name="searchValue" />
|
||||
</QueryFilter>
|
||||
<ProTable<SEARCH.SysLog>
|
||||
rowKey="id"
|
||||
headerTitle="系统日志"
|
||||
request={syslog}
|
||||
columns={columns}
|
||||
search={false}
|
||||
params={params}
|
||||
size="small"
|
||||
pagination={{
|
||||
showSizeChanger: true,
|
||||
showQuickJumper: true,
|
||||
}}
|
||||
scroll={{ x: 1600 }}
|
||||
/>
|
||||
<TraceView {...traceView} onCancel={() => setTraceView({ open: false })} />
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
|
||||
export default TableList;
|
||||
@@ -0,0 +1,50 @@
|
||||
@import (reference) '~antd/es/style/themes/index';
|
||||
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
overflow: auto;
|
||||
background: @layout-body-background;
|
||||
}
|
||||
|
||||
.lang {
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
line-height: 44px;
|
||||
text-align: right;
|
||||
:global(.ant-dropdown-trigger) {
|
||||
margin-right: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
flex: 1;
|
||||
padding: 32px 0;
|
||||
}
|
||||
|
||||
@media (min-width: @screen-md-min) {
|
||||
.container {
|
||||
background-image: url('https://gw.alipayobjects.com/zos/rmsportal/TVYTbAXWheQpRcWDaDMu.svg');
|
||||
background-repeat: no-repeat;
|
||||
background-position: center 110px;
|
||||
background-size: 100%;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 32px 0 24px;
|
||||
}
|
||||
}
|
||||
|
||||
.icon {
|
||||
margin-left: 8px;
|
||||
color: rgba(0, 0, 0, 0.2);
|
||||
font-size: 24px;
|
||||
vertical-align: middle;
|
||||
cursor: pointer;
|
||||
transition: color 0.3s;
|
||||
|
||||
&:hover {
|
||||
color: @primary-color;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
import Footer from '@/components/Footer';
|
||||
import { login } from '@/services/login/api';
|
||||
import { InfoCircleOutlined, LockOutlined, UserOutlined } from '@ant-design/icons';
|
||||
import { LoginForm, ProFormCaptcha, ProFormText } from '@ant-design/pro-components';
|
||||
import { message, Tooltip } from 'antd';
|
||||
import React, { useState } from 'react';
|
||||
import { FormattedMessage, history, useIntl, useModel } from 'umi';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import styles from './index.less';
|
||||
|
||||
const Login: React.FC = () => {
|
||||
const [uuid, setUuid] = useState<string>(uuidv4());
|
||||
const { initialState, setInitialState } = useModel('@@initialState');
|
||||
|
||||
const intl = useIntl();
|
||||
|
||||
const fetchUserInfo = async () => {
|
||||
const userInfo = await initialState?.fetchUserInfo?.();
|
||||
if (userInfo) {
|
||||
await setInitialState((s) => ({
|
||||
...s,
|
||||
currentUser: userInfo,
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
const handleSubmit = async (values: API.LoginParams) => {
|
||||
try {
|
||||
// 登录
|
||||
const msg = await login({ ...values });
|
||||
if (msg.resp_code === 0) {
|
||||
const defaultLoginSuccessMessage = intl.formatMessage({
|
||||
id: 'pages.login.success',
|
||||
defaultMessage: '登录成功!',
|
||||
});
|
||||
const loginResult = msg.datas;
|
||||
if (loginResult && loginResult.access_token)
|
||||
sessionStorage.setItem('access_token', loginResult.access_token);
|
||||
message.success(defaultLoginSuccessMessage);
|
||||
await fetchUserInfo();
|
||||
/** 此方法会跳转到 redirect 参数所在的位置 */
|
||||
if (!history) return;
|
||||
const { query } = history.location;
|
||||
const { redirect } = query as { redirect: string };
|
||||
history.push(redirect || '/');
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果失败去设置用户错误信息
|
||||
} catch (error) {
|
||||
const defaultLoginFailureMessage = intl.formatMessage({
|
||||
id: 'pages.login.failure',
|
||||
defaultMessage: '登录失败,请重试!',
|
||||
});
|
||||
message.error(defaultLoginFailureMessage);
|
||||
}
|
||||
};
|
||||
|
||||
const captchaUrl = `/api-uaa/validata/code/${uuid}`;
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<div className={styles.content}>
|
||||
<LoginForm
|
||||
logo={<img alt="logo" src="./logo.png" />}
|
||||
title="microservices-platform"
|
||||
subTitle={intl.formatMessage({ id: 'pages.layouts.userLayout.title' })}
|
||||
initialValues={{
|
||||
autoLogin: true,
|
||||
}}
|
||||
onFinish={async (values) => {
|
||||
await handleSubmit({ ...values, deviceId: uuid } as API.LoginParams);
|
||||
}}
|
||||
>
|
||||
<>
|
||||
<ProFormText
|
||||
name="username"
|
||||
fieldProps={{
|
||||
size: 'large',
|
||||
prefix: <UserOutlined className={styles.prefixIcon} />,
|
||||
}}
|
||||
placeholder={intl.formatMessage({
|
||||
id: 'pages.login.username.placeholder',
|
||||
defaultMessage: '账号',
|
||||
})}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: (
|
||||
<FormattedMessage
|
||||
id="pages.login.username.required"
|
||||
defaultMessage="请输入账号!"
|
||||
/>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<ProFormText.Password
|
||||
name="password"
|
||||
fieldProps={{
|
||||
size: 'large',
|
||||
prefix: <LockOutlined className={styles.prefixIcon} />,
|
||||
}}
|
||||
placeholder={intl.formatMessage({
|
||||
id: 'pages.login.password.placeholder',
|
||||
defaultMessage: '密码',
|
||||
})}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: (
|
||||
<FormattedMessage
|
||||
id="pages.login.password.required"
|
||||
defaultMessage="请输入密码!"
|
||||
/>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<ProFormCaptcha
|
||||
name="validCode"
|
||||
fieldProps={{
|
||||
size: 'large',
|
||||
prefix: <LockOutlined className={'prefixIcon'} />,
|
||||
suffix: (
|
||||
<Tooltip title="不区分大小写">
|
||||
<InfoCircleOutlined style={{ color: 'rgba(0,0,0,.45)' }} />
|
||||
</Tooltip>
|
||||
),
|
||||
}}
|
||||
captchaProps={{
|
||||
size: 'large',
|
||||
style: { padding: '0 2px' },
|
||||
}}
|
||||
placeholder={'验证码'}
|
||||
captchaTextRender={() => (
|
||||
<span onClick={() => setUuid(uuidv4())}>
|
||||
<img src={captchaUrl} alt="验证码" />
|
||||
</span>
|
||||
)}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: '请输入验证码!',
|
||||
},
|
||||
]}
|
||||
onGetCaptcha={async () => {}}
|
||||
/>
|
||||
</>
|
||||
</LoginForm>
|
||||
</div>
|
||||
<Footer />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Login;
|
||||
@@ -0,0 +1,20 @@
|
||||
// @ts-ignore
|
||||
/* eslint-disable */
|
||||
import { request } from 'umi';
|
||||
|
||||
export async function file(params?: { [key: string]: string | number }) {
|
||||
const { current, pageSize, ...rest } = params ?? {};
|
||||
const result = await request<SYSTEM.Page<FILES.File>>('/api-file/files', {
|
||||
method: 'GET',
|
||||
params: { page: current, limit: pageSize, ...rest },
|
||||
});
|
||||
return { data: result.data, total: result.count };
|
||||
}
|
||||
|
||||
export async function deleteFile(id: string) {
|
||||
const url = `/api-file/files/${id}`;
|
||||
const result = await request<API.Result<void>>(url, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// @ts-ignore
|
||||
/* eslint-disable */
|
||||
// API 更新时间:
|
||||
// API 唯一标识:
|
||||
import * as api from './api';
|
||||
export default {
|
||||
api,
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
// @ts-ignore
|
||||
/* eslint-disable */
|
||||
|
||||
declare namespace FILES {
|
||||
|
||||
type File = {
|
||||
id: string;
|
||||
name?: string;
|
||||
isImg: boolean;
|
||||
url?: string;
|
||||
contentType?: string;
|
||||
size?: number;
|
||||
path?: string;
|
||||
source?: string;
|
||||
createTime?: string;
|
||||
tenantId?: string;
|
||||
updateTime?: string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
// @ts-ignore
|
||||
/* eslint-disable */
|
||||
import { request } from 'umi';
|
||||
|
||||
export async function currentUser(options?: { [key: string]: any }) {
|
||||
return request<API.OptionalResult<API.CurrentUser>>('/api-user/users/current', {
|
||||
method: 'GET',
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
export async function currentUser2(options?: { [key: string]: any }) {
|
||||
const result = await request<API.OptionalResult<API.CurrentUser>>('/api-user/users/current', {
|
||||
method: 'GET',
|
||||
...(options || {}),
|
||||
});
|
||||
return result.datas ?? {};
|
||||
}
|
||||
|
||||
export async function fetchMenuData(options?: { [key: string]: any }) {
|
||||
return request<API.Menu[]>('/api-user/menus/current', {
|
||||
method: 'GET',
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 退出登录接口 POST /api/login/outLogin */
|
||||
export async function outLogin(options?: { [key: string]: any }) {
|
||||
return request<Record<string, any>>('/api/login/outLogin', {
|
||||
method: 'POST',
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
export async function login(body: API.LoginParams, options?: { [key: string]: any }) {
|
||||
return request<API.OptionalResult<API.LoginResult>>('/api-uaa/oauth/token', {
|
||||
method: 'POST',
|
||||
requestType: 'form',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
Authorization: 'Basic d2ViQXBwOndlYkFwcA==',
|
||||
},
|
||||
data: { ...body, grant_type: 'password_code' },
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// @ts-ignore
|
||||
/* eslint-disable */
|
||||
// API 更新时间:
|
||||
// API 唯一标识:
|
||||
import * as api from './api';
|
||||
export default {
|
||||
api,
|
||||
};
|
||||
@@ -0,0 +1,54 @@
|
||||
// @ts-ignore
|
||||
/* eslint-disable */
|
||||
|
||||
declare namespace API {
|
||||
type Result<T> = {
|
||||
resp_code?: number;
|
||||
resp_msg?: number;
|
||||
datas?: T[];
|
||||
};
|
||||
|
||||
type OptionalResult<T> = {
|
||||
resp_code?: number;
|
||||
resp_msg?: number;
|
||||
datas?: T;
|
||||
};
|
||||
|
||||
type CurrentUser = SYSTEM.User & {
|
||||
permissions: string[];
|
||||
};
|
||||
|
||||
type Menu = {
|
||||
id?: number;
|
||||
name?: string;
|
||||
path?: string;
|
||||
url?: string;
|
||||
css?: string;
|
||||
subMenus?: Menu[];
|
||||
};
|
||||
|
||||
type LoginResult = {
|
||||
access_token?: string;
|
||||
token_type?: string;
|
||||
refresh_token?: string;
|
||||
expires_in?: number;
|
||||
scope?: string;
|
||||
account_type?: string;
|
||||
};
|
||||
|
||||
type LoginParams = {
|
||||
username?: string;
|
||||
password?: string;
|
||||
validCode?: string;
|
||||
deviceId?: string;
|
||||
};
|
||||
|
||||
type ErrorResponse = {
|
||||
/** 业务约定的错误码 */
|
||||
errorCode: string;
|
||||
/** 业务上的错误信息 */
|
||||
errorMessage?: string;
|
||||
/** 业务上的请求是否成功 */
|
||||
success?: boolean;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
// @ts-ignore
|
||||
/* eslint-disable */
|
||||
import { request } from 'umi';
|
||||
|
||||
export async function indice(params?: { [key: string]: string | number }) {
|
||||
const { current, pageSize, ...rest } = params ?? {};
|
||||
const result = await request<SYSTEM.Page<SEARCH.Indice>>('/api-search/admin/indices', {
|
||||
method: 'GET',
|
||||
params: { page: current, limit: pageSize, ...rest },
|
||||
});
|
||||
return { data: result.data };
|
||||
}
|
||||
|
||||
export async function index(indexName: string) {
|
||||
const result = await request<API.OptionalResult<any>>('/api-search/admin/index', {
|
||||
method: 'GET',
|
||||
params: { indexName },
|
||||
});
|
||||
return result.datas;
|
||||
}
|
||||
|
||||
export async function syslog(params?: { [key: string]: string | number }) {
|
||||
const { current, pageSize, ...rest } = params ?? {};
|
||||
const result = await request<SYSTEM.Page<SEARCH.SysLog>>('/api-log/sysLog', {
|
||||
method: 'GET',
|
||||
params: { page: current, limit: pageSize, ...rest },
|
||||
});
|
||||
return { data: result.data, total: result.count };
|
||||
}
|
||||
|
||||
export async function tracelog(traceId: string) {
|
||||
const params = { queryStr: `traceId:${traceId}`, sortCol: 'timestamp', sortOrder: 'ASC' };
|
||||
const result = await request<SYSTEM.Page<SEARCH.TraceLog>>('/api-log/traceLog', {
|
||||
method: 'GET',
|
||||
params,
|
||||
});
|
||||
return result.data;
|
||||
}
|
||||
|
||||
export async function auditlog(params?: { [key: string]: string | number }) {
|
||||
const { current, pageSize, ...rest } = params ?? {};
|
||||
const result = await request<SYSTEM.Page<SEARCH.TraceLog>>('/api-log/auditLog', {
|
||||
method: 'GET',
|
||||
params: { page: current, limit: pageSize, ...rest },
|
||||
});
|
||||
return { data: result.data, total: result.count };
|
||||
}
|
||||
|
||||
export async function slowQueryLog(params?: { [key: string]: string | number }) {
|
||||
const { current, pageSize, ...rest } = params ?? {};
|
||||
const result = await request<SYSTEM.Page<SEARCH.SlowSqlLog>>('/api-log/slowQueryLog', {
|
||||
method: 'GET',
|
||||
params: { page: current, limit: pageSize, ...rest },
|
||||
});
|
||||
return { data: result.data, total: result.count };
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// @ts-ignore
|
||||
/* eslint-disable */
|
||||
// API 更新时间:
|
||||
// API 唯一标识:
|
||||
import * as api from './api';
|
||||
export default {
|
||||
api,
|
||||
};
|
||||
@@ -0,0 +1,62 @@
|
||||
// @ts-ignore
|
||||
/* eslint-disable */
|
||||
|
||||
declare namespace SEARCH {
|
||||
type Indice = {
|
||||
docsCount?: string;
|
||||
docsDeleted?: string;
|
||||
health?: string;
|
||||
index?: string;
|
||||
status?: string;
|
||||
storeSize?: string;
|
||||
};
|
||||
|
||||
type SysLog = {
|
||||
id?: string;
|
||||
'@timestamp'?: Date;
|
||||
agent?: { name?: string; type?: string; id?: string; version?: string };
|
||||
appName?: string;
|
||||
classname?: string;
|
||||
id?: string;
|
||||
logLevel?: string;
|
||||
serverIp?: string;
|
||||
serverPort?: string;
|
||||
timestamp?: string;
|
||||
message?: string;
|
||||
traceId?: string;
|
||||
spanId?: string;
|
||||
threadName?: string;
|
||||
};
|
||||
|
||||
type TraceLog = {
|
||||
appName?: string;
|
||||
parentId?: string;
|
||||
serverIp?: string;
|
||||
serverPort?: string;
|
||||
spanId?: string;
|
||||
};
|
||||
|
||||
type AuditLog = {
|
||||
id?: string;
|
||||
appName?: string;
|
||||
className?: string;
|
||||
clientId?: string;
|
||||
methodName?: string;
|
||||
operation?: string;
|
||||
timestamp?: string;
|
||||
userId?: string;
|
||||
userName?: string;
|
||||
};
|
||||
|
||||
type SlowSqlLog = {
|
||||
id?: string;
|
||||
timestamp?: string;
|
||||
query_str?: string;
|
||||
query_time?: string;
|
||||
lock_time?: string;
|
||||
rows_sent?: string;
|
||||
rows_examined?: string;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user