Feat/new UI (#1422)

* Remove console autofill hippo4j username and password logic (#1246)

* feat:更改网址

* feat: submit new-ui
pull/1427/head
GRL-bxy 11 months ago committed by GitHub
parent de703cfca1
commit a49a1b2fff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,3 +1,5 @@
const { off } = require("process");
module.exports = {
env: {
browser: true,
@ -20,6 +22,7 @@ module.exports = {
eqeqeq: 2,
'no-alert': 2,
'no-undef': 2,
'prefer-const': 0,
'no-use-before-define': 2,
'react-hooks/exhaustive-deps': 2,
'@typescript-eslint/no-explicit-any': 0,

@ -9,7 +9,7 @@
/coverage
# production
/build
# /build
# misc
.DS_Store

File diff suppressed because it is too large Load Diff

@ -1,21 +1,16 @@
{
"name": "hippo4j-ui-new",
"name": "threadpool-console",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^27.5.2",
"@types/node": "^16.18.26",
"@types/react": "^18.2.6",
"@types/react-dom": "^18.2.4",
"antd": "^5.4.7",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.11.1",
"react-scripts": "5.0.1",
"typescript": "^4.9.5",
"web-vitals": "^2.1.4"
},
"scripts": {
@ -46,9 +41,14 @@
},
"devDependencies": {
"@craco/craco": "^7.1.0",
"@types/jest": "^27.5.2",
"@types/node": "^16.18.26",
"@types/react": "^18.2.6",
"@types/react-dom": "^18.2.4",
"@typescript-eslint/eslint-plugin": "^5.59.2",
"@typescript-eslint/parser": "^5.59.2",
"babel-eslint": "^10.1.0",
"craco-alias": "^3.0.1",
"craco-css-modules": "^1.0.5",
"craco-less": "^2.0.0",
"craco-sass-resources-loader": "^1.1.0",
@ -61,7 +61,9 @@
"husky": "^8.0.0",
"less-loader": "^11.1.0",
"lint-staged": "^13.2.2",
"prettier": "^2.8.8"
"prettier": "^2.8.8",
"styled-components": "^6.0.0-rc.1",
"typescript": "^4.9.5"
},
"cracoConfig": "./build/craco.config.js",
"lint-staged": {

@ -1,29 +1,8 @@
import { Layout } from 'antd';
import { Routes, Route, Link } from 'react-router-dom';
import Home from './page/home';
import About from './page/about';
import style from './index.module.less';
const { Header, Sider, Content } = Layout;
import React from 'react';
import LayoutCom from './components/layout-com';
function App() {
return (
<div className={style.container}>
<Header className={style.header}>header</Header>
<Layout>
<Sider className={style.sider}>
<Link to="/home">home</Link>
<Link to="/about">about</Link>
</Sider>
<Content className={style.content}>
<Routes>
<Route path="/home" Component={Home}></Route>
<Route path="/about" Component={About}></Route>
</Routes>
</Content>
</Layout>
</div>
);
return <LayoutCom></LayoutCom>;
}
export default App;

@ -0,0 +1,99 @@
"use strict";
exports.__esModule = true;
var react_1 = require("react");
var styled_components_1 = require("styled-components");
var antd_1 = require("antd");
var react_router_dom_1 = require("react-router-dom");
var home_1 = require("@/page/home");
var about_1 = require("@/page/about");
var login_1 = require("@/page/login");
var index_module_less_1 = require("./index.module.less");
var table_1 = require("../table");
var search_1 = require("@/page/search");
var icons_1 = require("@ant-design/icons");
var themeContext_1 = require("@/context/themeContext");
var Header = antd_1.Layout.Header, Sider = antd_1.Layout.Sider, Content = antd_1.Layout.Content;
var items = [
{
label: react_1["default"].createElement("a", { href: "/about" }, "Navigation One"),
key: 'mail',
icon: react_1["default"].createElement(icons_1.MailOutlined, null)
},
{
label: 'Navigation Two',
key: 'app',
icon: react_1["default"].createElement(icons_1.AppstoreOutlined, null),
disabled: true
},
{
label: react_1["default"].createElement("a", { href: "/about" }, "Navigation One"),
key: 'app',
icon: react_1["default"].createElement(icons_1.AppstoreOutlined, null)
},
{
label: 'Navigation Three - Submenu',
key: 'SubMenu',
icon: react_1["default"].createElement(icons_1.SettingOutlined, null),
children: [
{
type: 'group',
label: 'Item 1',
children: [
{
label: 'Option 1',
key: 'setting:1'
},
{
label: 'Option 2',
key: 'setting:2'
},
]
},
{
type: 'group',
label: 'Item 2',
children: [
{
label: 'Option 3',
key: 'setting:3'
},
{
label: 'Option 4',
key: 'setting:4'
},
]
},
]
},
{
label: (react_1["default"].createElement("a", { href: "https://ant.design", target: "_blank", rel: "noopener noreferrer" }, "Navigation Four - Link")),
key: 'alipay'
},
];
var LayoutCom = function () {
var myThemes = react_1.useContext(styled_components_1.ThemeContext);
var _a = react_1.useContext(themeContext_1.MyThemeContext), themeName = _a.themeName, setThemeName = _a.setThemeName;
var _b = react_1.useState('mail'), current = _b[0], setCurrent = _b[1];
var onClick = function (e) {
console.log('click ', e);
setCurrent(e.key);
};
var _c = react_1.useState(false), isDark = _c[0], setIsDark = _c[1];
react_1.useEffect(function () {
isDark ? setThemeName(themeContext_1.THEME_NAME.DARK) : setThemeName(themeContext_1.THEME_NAME.DEFAULT);
}, [isDark, setThemeName]);
return (react_1["default"].createElement("main", { className: index_module_less_1["default"].container, style: { backgroundColor: myThemes.backgroundColor.bg1 } },
react_1["default"].createElement(Header, { className: index_module_less_1["default"].header, style: { backgroundColor: myThemes.backgroundColor.bg1 } },
react_1["default"].createElement(antd_1.Button, { onClick: function () { return setIsDark(function (pre) { return !pre; }); } }, "\u5207\u6362\u4E3B\u9898")),
react_1["default"].createElement(antd_1.Layout, null,
react_1["default"].createElement(Sider, { className: index_module_less_1["default"].sider, style: { backgroundColor: myThemes.backgroundColor.bg1 } },
react_1["default"].createElement(antd_1.Menu, { onClick: onClick, selectedKeys: [current], mode: "inline", items: items })),
react_1["default"].createElement(Content, { className: index_module_less_1["default"].content },
react_1["default"].createElement(react_router_dom_1.Routes, null,
react_1["default"].createElement(react_router_dom_1.Route, { path: "/Search", Component: search_1["default"] }),
react_1["default"].createElement(react_router_dom_1.Route, { path: "/Table", Component: table_1["default"] }),
react_1["default"].createElement(react_router_dom_1.Route, { path: "/Login", Component: login_1["default"] }),
react_1["default"].createElement(react_router_dom_1.Route, { path: "/home", Component: home_1["default"] }),
react_1["default"].createElement(react_router_dom_1.Route, { path: "/about", Component: about_1["default"] }))))));
};
exports["default"] = LayoutCom;

@ -0,0 +1,19 @@
.container {
width: 100vw;
height: 100vh;
background-color: #eee;
color: #fff;
.header {
height: 48px;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.01), 0 3px 6px 3px rgba(0, 0, 0, 0.01), 0 2px 6px 0 rgba(0, 0, 0, 0.03);
}
.sider {
height: calc(100vh - 48px);
display: flex;
flex-direction: column;
justify-content: center;
}
.content {
margin: 24px;
}
}

@ -0,0 +1,121 @@
import React, { useEffect, useState, useContext } from 'react';
import { DefaultTheme, ThemeContext } from 'styled-components';
import { Layout, Button, Menu, Table } from 'antd';
import { Routes, Route, Link } from 'react-router-dom';
import Home from '@/page/home';
import About from '@/page/about';
import Login from '@/page/login';
import style from './index.module.less';
import TableBox from '../table';
import Search from '@/page/search';
import { AppstoreOutlined, MailOutlined, SettingOutlined } from '@ant-design/icons';
import { THEME_NAME, MyThemeContext } from '@/context/themeContext';
const { Header, Sider, Content } = Layout;
interface ThemeProps {
children: React.ReactNode;
}
const items = [
{
label: <a href="/about">Navigation One</a>,
key: 'mail',
icon: <MailOutlined />,
},
{
label: 'Navigation Two',
key: 'app',
icon: <AppstoreOutlined />,
disabled: true,
},
{
label: <a href="/about">Navigation One</a>,
key: 'app',
icon: <AppstoreOutlined />,
},
{
label: 'Navigation Three - Submenu',
key: 'SubMenu',
icon: <SettingOutlined />,
children: [
{
type: 'group',
label: 'Item 1',
children: [
{
label: 'Option 1',
key: 'setting:1',
},
{
label: 'Option 2',
key: 'setting:2',
},
],
},
{
type: 'group',
label: 'Item 2',
children: [
{
label: 'Option 3',
key: 'setting:3',
},
{
label: 'Option 4',
key: 'setting:4',
},
],
},
],
},
{
label: (
<a href="https://ant.design" target="_blank" rel="noopener noreferrer">
Navigation Four - Link
</a>
),
key: 'alipay',
},
];
const LayoutCom = () => {
const myThemes: DefaultTheme = useContext<any>(ThemeContext);
const { themeName, setThemeName } = useContext<any>(MyThemeContext);
const [current, setCurrent] = useState('mail');
const onClick = (e: any) => {
console.log('click ', e);
setCurrent(e.key);
};
const [isDark, setIsDark] = useState(false);
useEffect(() => {
isDark ? setThemeName(THEME_NAME.DARK) : setThemeName(THEME_NAME.DEFAULT);
}, [isDark, setThemeName]);
return (
<main className={style.container} style={{ backgroundColor: myThemes.backgroundColor.bg1 }}>
<Header className={style.header} style={{ backgroundColor: myThemes.backgroundColor.bg1 }}>
<Button onClick={() => setIsDark(pre => !pre)}></Button>
</Header>
<Layout>
<Sider className={style.sider} style={{ backgroundColor: myThemes.backgroundColor.bg1 }}>
<Menu onClick={onClick} selectedKeys={[current]} mode="inline" items={items} />
</Sider>
<Content className={style.content}>
<Routes>
<Route path="/Search" Component={Search}></Route>
<Route path="/Table" Component={TableBox}></Route>
<Route path="/Login" Component={Login}></Route>
<Route path="/home" Component={Home}></Route>
<Route path="/about" Component={About}></Route>
</Routes>
</Content>
</Layout>
</main>
);
};
export default LayoutCom;

@ -0,0 +1,71 @@
"use strict";
exports.__esModule = true;
var react_1 = require("react");
var antd_1 = require("antd");
var columns = [
{
title: 'Name',
dataIndex: 'name',
key: 'name',
render: function (text) { return react_1["default"].createElement("a", null, text); }
},
{
title: 'Age',
dataIndex: 'age',
key: 'age'
},
{
title: 'Address',
dataIndex: 'address',
key: 'address'
},
{
title: 'Tags',
key: 'tags',
dataIndex: 'tags',
render: function (_, _a) {
var tags = _a.tags;
return (react_1["default"].createElement(react_1["default"].Fragment, null, tags.map(function (tag) {
var color = tag.length > 5 ? 'geekblue' : 'green';
if (tag === 'loser') {
color = 'volcano';
}
return (react_1["default"].createElement(antd_1.Tag, { color: color, key: tag }, tag.toUpperCase()));
})));
}
},
{
title: 'Action',
key: 'action',
render: function (_, record) { return (react_1["default"].createElement(antd_1.Space, { size: "middle" },
react_1["default"].createElement("a", null,
"Invite ",
record.name),
react_1["default"].createElement("a", null, "Delete"))); }
},
];
var data = [
{
key: '1',
name: 'John Brown',
age: 32,
address: 'New York No. 1 Lake Park',
tags: ['nice', 'developer']
},
{
key: '2',
name: 'Jim Green',
age: 42,
address: 'London No. 1 Lake Park',
tags: ['loser']
},
{
key: '3',
name: 'Joe Black',
age: 32,
address: 'Sydney No. 1 Lake Park',
tags: ['cool', 'teacher']
},
];
var TableBox = function () { return react_1["default"].createElement(antd_1.Table, { columns: columns, dataSource: data }); };
exports["default"] = TableBox;

@ -0,0 +1,88 @@
import React from 'react';
import { Space, Table, Tag } from 'antd';
import type { ColumnsType } from 'antd/es/table';
interface DataType {
key: string;
name: string;
age: number;
address: string;
tags: string[];
}
const columns: ColumnsType<DataType> = [
{
title: 'Name',
dataIndex: 'name',
key: 'name',
render: text => <a>{text}</a>,
},
{
title: 'Age',
dataIndex: 'age',
key: 'age',
},
{
title: 'Address',
dataIndex: 'address',
key: 'address',
},
{
title: 'Tags',
key: 'tags',
dataIndex: 'tags',
render: (_, { tags }) => (
<>
{tags.map(tag => {
let color = tag.length > 5 ? 'geekblue' : 'green';
if (tag === 'loser') {
color = 'volcano';
}
return (
<Tag color={color} key={tag}>
{tag.toUpperCase()}
</Tag>
);
})}
</>
),
},
{
title: 'Action',
key: 'action',
render: (_, record) => (
<Space size="middle">
<a>Invite {record.name}</a>
<a>Delete</a>
</Space>
),
},
];
const data: DataType[] = [
{
key: '1',
name: 'John Brown',
age: 32,
address: 'New York No. 1 Lake Park',
tags: ['nice', 'developer'],
},
{
key: '2',
name: 'Jim Green',
age: 42,
address: 'London No. 1 Lake Park',
tags: ['loser'],
},
{
key: '3',
name: 'Joe Black',
age: 32,
address: 'Sydney No. 1 Lake Park',
tags: ['cool', 'teacher'],
},
];
const TableBox: React.FC = () => <Table columns={columns} dataSource={data} />;
export default TableBox;

@ -0,0 +1,42 @@
import React, { useContext, useEffect, useState } from 'react';
import { DefaultTheme, ThemeProvider, useTheme } from 'styled-components';
import { ConfigProvider, theme } from 'antd';
import { darkAlgorithm } from '../../theme/dark-algorithm';
import { defaultAlgorithm } from '../../theme/default-algnorithm';
import { lightDefaultTheme, darkDefaultTheme } from '../../theme';
import { MyThemeContext, THEME_NAME } from '../../context/themeContext';
import zhCN from 'antd/es/locale/zh_CN';
interface ThemeProps {
children: React.ReactNode;
}
const ThemeComponent = ({ children }: ThemeProps) => {
const [themes, setThemes] = useState(defaultAlgorithm);
const [myThemes, setMyThemes] = useState<DefaultTheme>(lightDefaultTheme);
const { themeName } = useContext<any>(MyThemeContext);
const changeColor = (themeName: THEME_NAME) => {
if (themeName === THEME_NAME.DARK) {
darkAlgorithm.algorithm = theme.darkAlgorithm;
setThemes(darkAlgorithm);
setMyThemes(darkDefaultTheme);
} else {
defaultAlgorithm.algorithm = theme.defaultAlgorithm;
setThemes(defaultAlgorithm);
setMyThemes(lightDefaultTheme);
}
};
useEffect(() => {
changeColor(themeName);
}, [themeName]);
return (
<ConfigProvider locale={zhCN} theme={themes}>
<ThemeProvider theme={myThemes}>{children}</ThemeProvider>
</ConfigProvider>
);
};
export default ThemeComponent;

@ -0,0 +1,17 @@
import React, { createContext, useState, ReactNode } from 'react';
export enum THEME_NAME {
DEFAULT = 'default',
DARK = 'dark',
}
export const MyThemeContext = createContext<{ themeName: string; setThemeName: (name: THEME_NAME) => void } | null>(
null
);
export const ThemeStore: React.FC<{
children: ReactNode;
}> = ({ children }) => {
const [themeName, setThemeName] = useState<string>(THEME_NAME.DEFAULT);
return <MyThemeContext.Provider value={{ themeName, setThemeName }}>{children}</MyThemeContext.Provider>;
};

@ -0,0 +1,15 @@
"use strict";
exports.__esModule = true;
var react_1 = require("react");
var client_1 = require("react-dom/client");
var App_1 = require("./App");
var react_router_dom_1 = require("react-router-dom");
var themeContext_1 = require("./context/themeContext");
var theme_com_1 = require("./components/theme-com");
require("antd/dist/reset.css");
var root = client_1["default"].createRoot(document.getElementById('root'));
root.render(react_1["default"].createElement(react_1["default"].StrictMode, null,
react_1["default"].createElement(react_router_dom_1.BrowserRouter, null,
react_1["default"].createElement(themeContext_1.ThemeStore, null,
react_1["default"].createElement(theme_com_1["default"], null,
react_1["default"].createElement(App_1["default"], null))))));

@ -4,16 +4,16 @@
background-color: #eee;
color: #fff;
.header {
height: 64px;
color: #fff;
height: 48px;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.01), 0 3px 6px 3px rgba(0, 0, 0, 0.01), 0 2px 6px 0 rgba(0, 0, 0, 0.03);
}
.sider {
width: 120px;
height: calc(100vh - 64px);
color: #fff;
height: calc(100vh - 48px);
display: flex;
flex-direction: column;
justify-content: center;
}
.content {
margin: 24px;
color: #fff;
}
}

@ -2,6 +2,8 @@ import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
import { BrowserRouter } from 'react-router-dom';
import { ThemeStore } from './context/themeContext';
import ThemeComponent from './components/theme-com';
import 'antd/dist/reset.css';
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
@ -9,7 +11,11 @@ const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement)
root.render(
<React.StrictMode>
<BrowserRouter>
<App />
<ThemeStore>
<ThemeComponent>
<App />
</ThemeComponent>
</ThemeStore>
</BrowserRouter>
</React.StrictMode>
);

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>

Before

Width:  |  Height:  |  Size: 2.6 KiB

@ -0,0 +1,6 @@
"use strict";
exports.__esModule = true;
var About = function () {
return React.createElement("div", { style: { color: 'red' } }, "About");
};
exports["default"] = About;

@ -1,8 +1,9 @@
import { Button } from 'antd';
import { Button, Card } from 'antd';
const Home = () => {
return (
<div style={{ color: 'red' }}>
<Button>jjjjj</Button>
<Card></Card>
</div>
);
};

@ -0,0 +1,65 @@
"use strict";
exports.__esModule = true;
var react_1 = require("react");
var antd_1 = require("antd");
var Login = function () {
var form = antd_1.Form.useForm()[0];
var data = {
passwordType: 'password',
capsTooltip: false,
loading: false,
showDialog: false,
redirect: undefined,
otherQuery: {},
loginForm: {
username: '',
password: ''
},
loginRules: {
// username: [{ required: true, trigger: 'blur', validator: validateUsername }],
// password: [{ required: true, trigger: 'blur', validator: this.validatePassword }],
}
};
var validatePassword = function (rule, value, callback) {
if (value.length < 6) {
callback(new Error('The password can not be less than 6 digits'));
}
else if (value.length > 72) {
callback(new Error('The password can not be greater than 72 digits'));
}
else {
// callback();
}
};
var onFinish = function () {
var loginParams = {
username: form.getFieldValue('username'),
password: form.getFieldValue('password'),
rememberMe: 1
};
data.loginForm.username = form.getFieldValue('username');
console.log('hhhhhh', loginParams);
};
var showPwd = function () {
if (data.passwordType === 'password') {
data.passwordType = '';
}
else {
data.passwordType = 'password';
}
// $nextTick(() => {
// $refs.password.focus();
// });
};
return (react_1["default"].createElement("div", { className: "login-container" },
react_1["default"].createElement(antd_1.Form, { name: "loginForm", form: form, onFinish: onFinish, style: { maxWidth: 600 } },
react_1["default"].createElement("div", { className: "title-container" },
react_1["default"].createElement("h3", { className: "title" }, "\u4F60\u597D\u5440")),
react_1["default"].createElement(antd_1.Form.Item, { name: "username", label: "\u7528\u6237\u540D", rules: [{ required: true, message: 'Username is required' }] },
react_1["default"].createElement(antd_1.Input, { placeholder: "\u7528\u6237\u540D" })),
react_1["default"].createElement(antd_1.Form.Item, { name: "password", label: "\u5BC6\u7801", rules: [{ required: true, message: 'Street is required' }] },
react_1["default"].createElement(antd_1.Input, { placeholder: "\u5BC6\u7801" })),
react_1["default"].createElement(antd_1.Form.Item, { name: "submit" },
react_1["default"].createElement(antd_1.Button, { type: "primary", htmlType: "submit", className: "login-button" }, "\u767B\u5F55")))));
};
exports["default"] = Login;

@ -0,0 +1,85 @@
import React, { useEffect, useState, useContext } from 'react';
import { DefaultTheme, ThemeContext } from 'styled-components';
import { Form, Tooltip, Input, Button } from 'antd';
import { Routes, Route, Link } from 'react-router-dom';
import style from './index.module.less';
import { AppstoreOutlined, MailOutlined, SettingOutlined } from '@ant-design/icons';
import { THEME_NAME, MyThemeContext } from '@/context/themeContext';
const Login = () => {
const [form] = Form.useForm();
const data = {
passwordType: 'password',
capsTooltip: false,
loading: false,
showDialog: false,
redirect: undefined,
otherQuery: {},
loginForm: {
username: '',
password: '',
},
loginRules: {
// username: [{ required: true, trigger: 'blur', validator: validateUsername }],
// password: [{ required: true, trigger: 'blur', validator: this.validatePassword }],
},
};
const validatePassword = (rule: any, value: string | any[], callback: (arg0: Error | undefined) => void) => {
if (value.length < 6) {
callback(new Error('The password can not be less than 6 digits'));
} else if (value.length > 72) {
callback(new Error('The password can not be greater than 72 digits'));
} else {
// callback();
}
};
const onFinish = () => {
let loginParams = {
username: form.getFieldValue('username'),
password: form.getFieldValue('password'),
rememberMe: 1,
};
data.loginForm.username = form.getFieldValue('username');
console.log('hhhhhh', loginParams);
};
const showPwd = () => {
if (data.passwordType === 'password') {
data.passwordType = '';
} else {
data.passwordType = 'password';
}
// $nextTick(() => {
// $refs.password.focus();
// });
};
return (
<div className="login-container">
<Form name="loginForm" form={form} onFinish={onFinish}
style={{ maxWidth: 600 }}>
<div className="title-container">
<h3 className="title"></h3>
{/* <h3 className="title">{{ $t('system.login') }}</h3> */}
</div>
<Form.Item name="username" label="用户名"
rules={[{ required: true, message: 'Username is required' }]}
>
<Input placeholder="用户名" />
</Form.Item>
<Form.Item name="password" label="密码"
rules={[{ required: true, message: 'Street is required' }]}
>
<Input placeholder="密码" />
</Form.Item>
<Form.Item name="submit">
<Button type="primary" htmlType="submit" className="login-button"></Button>
</Form.Item>
</Form>
</div>
);
};
export default Login;

@ -0,0 +1,16 @@
"use strict";
exports.__esModule = true;
var react_1 = require("react");
var icons_1 = require("@ant-design/icons");
var antd_1 = require("antd");
var Search = function () {
var _a = react_1["default"].useState(false), passwordVisible = _a[0], setPasswordVisible = _a[1];
return (react_1["default"].createElement(antd_1.Space, { direction: "vertical" },
react_1["default"].createElement(antd_1.Input.Password, { placeholder: "input password" }),
react_1["default"].createElement(antd_1.Input.Password, { placeholder: "input password", iconRender: function (visible) { return (visible ? react_1["default"].createElement(icons_1.EyeTwoTone, null) : react_1["default"].createElement(icons_1.EyeInvisibleOutlined, null)); } }),
react_1["default"].createElement(antd_1.Space, { direction: "horizontal" },
react_1["default"].createElement(antd_1.Input.Password, { placeholder: "input password", visibilityToggle: { visible: passwordVisible, onVisibleChange: setPasswordVisible } }),
react_1["default"].createElement(antd_1.Button, { style: { width: 80 }, onClick: function () { return setPasswordVisible(function (prevState) { return !prevState; }); } }, passwordVisible ? 'Hide' : 'Show'),
react_1["default"].createElement(antd_1.Button, { style: { width: 80 }, onClick: function () { return setPasswordVisible(function (prevState) { return !prevState; }); } }, passwordVisible ? 'Hide' : 'Show'))));
};
exports["default"] = Search;

@ -0,0 +1,31 @@
import React from 'react';
import { EyeInvisibleOutlined, EyeTwoTone } from '@ant-design/icons';
import { Button, Input, Space } from 'antd';
const Search: React.FC = () => {
const [passwordVisible, setPasswordVisible] = React.useState(false);
return (
<Space direction="vertical">
<Input.Password placeholder="input password" />
<Input.Password
placeholder="input password"
iconRender={visible => (visible ? <EyeTwoTone /> : <EyeInvisibleOutlined />)}
/>
<Space direction="horizontal">
<Input.Password
placeholder="input password"
visibilityToggle={{ visible: passwordVisible, onVisibleChange: setPasswordVisible }}
/>
<Button style={{ width: 80 }} onClick={() => setPasswordVisible(prevState => !prevState)}>
{passwordVisible ? 'Hide' : 'Show'}
</Button>
<Button style={{ width: 80 }} onClick={() => setPasswordVisible(prevState => !prevState)}>
{passwordVisible ? 'Hide' : 'Show'}
</Button>
</Space>
</Space>
);
};
export default Search;

@ -1,2 +1,88 @@
/// <reference types="react-scripts" />
declare module '*.less';
// import { DefaultTheme } from 'styled-components'
// export const lightDefaultTheme: DefaultTheme = {
// primary: "#3495EE",
// baseColor: {
// // 前两个是固定的,用于,有颜色按钮 字体颜色等固定不会变的颜色值
// bc1: "#fff",
// bc2: "#000000",
// bc3: "#ED2D00",
// bc4: "#10CC55",
// bc5: "#3094f1",
// },
// fontColor: {
// fc1: "#333",
// fc2: "#000",
// fc3: "#666",
// fc4: '#D2E0F4',
// fc5: "#000000",
// fc6: "#FFFFFF",
// },
// borderColor: {
// bl1: "#E2E2E2",
// bl2: "#d8dbe2",
// bl3: "#B5BDCE",
// },
// backgroundColor: {
// bg1: "#FFFFFF",
// bg2: "#EEEFF4",
// // title的及表格头部背景极
// bg3: "#EDEDED",
// bg5: "#F8F8F8",
// bg4: "#F6F6F6",
// bg6: "rgba(0, 0, 0, 0.70)",
// },
// hoverColor: {
// hc1: 'rgba(24, 144, 255, 0)',
// // 表格的hover及选 中
// hc2: '#F5F8FA'
// }
// }
// export const darkDefaultTheme: DefaultTheme = {
// primary: "#177DDC",
// baseColor: {
// bc1: "#fff",
// bc2: "#000000",
// bc3: "#FF3D3D",
// bc4: "#10CC55",
// bc5: "#3094f1",
// // 固定为白色,有颜色按钮文字颜色 fixedcolor
// },
// fontColor: {
// fc1: "#ffffff",
// fc2: "#B4B6B8",
// fc3: "#555555",
// fc4: '#666666',
// fc5: "#FFFFFF",
// fc6: "#FFFFFF",
// },
// borderColor: {
// bl1: "#6A6A6A",
// bl2: "#4A4B51",
// bl3: "#424242",
// },
// backgroundColor: {
// // 大面积色
// bg1: "#1C1D21",
// // tab顶部颜色
// bg2: "#323337",
// // title 颜色
// bg3: "#2A2B2E",
// bg5: "#4A4B51",
// // 菜单选中
// bg4: "#0F3C66",
// // 锁定背景色
// bg6: "rgba(255, 255, 255, 0.70)",
// // bg3: "rgba(255, 255, 255, 0.70)",
// // bg4: "rgba(250, 250, 250, 1)",
// },
// hoverColor: {
// hc1: 'rgba(24, 144, 255, 0)',
// hc2: '#2A2B2E'
// }
// }

@ -0,0 +1,5 @@
import React from 'react';
const Fc = () => {
return <div>hhh</div>;
};

@ -0,0 +1,33 @@
import { theme } from 'antd';
import { darkDefaultTheme } from '.';
export const darkAlgorithm = {
token: {
borderRadius: 2,
colorPrimary: darkDefaultTheme.primary,
fontSize: 14,
},
components: {
Button: {
fontSize: 14,
},
Table: {
borderRadius: 0,
borderRadiusLG: 0,
padding: 10,
paddingXS: 5,
margin: 0,
fontSize: 14,
colorBorderSecondary: darkDefaultTheme.borderColor.bl1,
paddingContentVerticalLG: 4,
},
Modal: {
borderRadiusLG: 2,
borderRadiusSM: 2,
colorText: darkDefaultTheme.fontColor.fc3,
borderRadius: 2,
paddingContentHorizontalLG: 0,
paddingMD: 0,
},
},
algorithm: theme.darkAlgorithm,
};

@ -0,0 +1,34 @@
import { theme } from 'antd';
import { lightDefaultTheme } from '.';
export const defaultAlgorithm = {
token: {
borderRadius: 2,
colorPrimary: lightDefaultTheme.primary,
fontSize: 14,
// colorBgBase: lightDefaultTheme.backgroundColor.bg1,
},
components: {
Button: {
fontSize: 14,
},
Table: {
borderRadius: 0,
borderRadiusLG: 0,
padding: 10,
paddingXS: 5,
margin: 0,
fontSize: 14,
colorBorderSecondary: lightDefaultTheme.borderColor.bl1,
paddingContentVerticalLG: 4,
},
Modal: {
borderRadiusLG: 2,
borderRadiusSM: 2,
colorText: lightDefaultTheme.fontColor.fc3,
borderRadius: 2,
paddingContentHorizontalLG: 0,
paddingMD: 0,
},
},
algorithm: theme.defaultAlgorithm,
};

@ -0,0 +1,44 @@
import 'styled-components';
// and extend them!
declare module 'styled-components' {
export interface DefaultTheme {
primary: string;
// 基本固定颜色,如有颜色按钮,文字颜色
baseColor: {
bc1: string;
bc2: string;
bc3: string;
bc4: string;
bc5: string;
};
// 字体颜色
fontColor: {
fc1: string;
fc2: string;
fc3: string;
fc4: string;
fc5: string;
fc6: string;
};
// 边框颜色 line
borderColor: {
bl1: string;
bl2: string;
bl3: string;
};
// 背景色
backgroundColor: {
bg1: string;
bg2: string;
bg3: string;
bg4: string;
bg5: string;
bg6: string;
};
hoverColor: {
hc1: string;
hc2: string;
};
}
}

@ -0,0 +1,85 @@
import { DefaultTheme } from 'styled-components';
export const lightDefaultTheme: DefaultTheme = {
primary: '#0d68a8',
baseColor: {
// 前两个是固定的,用于,有颜色按钮 字体颜色等固定不会变的颜色值
bc1: '#fff',
bc2: '#000000',
bc3: '#ED2D00',
bc4: '#10CC55',
bc5: '#3094f1',
},
fontColor: {
fc1: '#333',
fc2: '#000',
fc3: '#666',
fc4: '#D2E0F4',
fc5: '#000000',
fc6: '#FFFFFF',
},
borderColor: {
bl1: '#E2E2E2',
bl2: '#d8dbe2',
bl3: '#B5BDCE',
},
backgroundColor: {
bg1: '#FFFFFF',
bg2: '#EEEFF4',
// title的及表格头部背景极
bg3: '#EDEDED',
bg5: '#F8F8F8',
bg4: '#F6F6F6',
bg6: 'rgba(0, 0, 0, 0.70)',
},
hoverColor: {
hc1: 'rgba(24, 144, 255, 0)',
// 表格的hover及选 中
hc2: '#F5F8FA',
},
};
export const darkDefaultTheme: DefaultTheme = {
primary: '#0d68a8',
baseColor: {
bc1: '#fff',
bc2: '#000000',
bc3: '#FF3D3D',
bc4: '#10CC55',
bc5: '#3094f1',
// 固定为白色,有颜色按钮文字颜色 fixedcolor
},
fontColor: {
fc1: '#ffffff',
fc2: '#B4B6B8',
fc3: '#555555',
fc4: '#666666',
fc5: '#FFFFFF',
fc6: '#FFFFFF',
},
borderColor: {
bl1: '#6A6A6A',
bl2: '#4A4B51',
bl3: '#424242',
},
backgroundColor: {
// 大面积色
bg1: '#141414',
// tab顶部颜色
bg2: '#323337',
// title 颜色
bg3: '#2A2B2E',
bg5: '#4A4B51',
// 菜单选中
bg4: '#0F3C66',
// 锁定背景色
bg6: 'rgba(255, 255, 255, 0.70)',
// bg3: "rgba(255, 255, 255, 0.70)",
// bg4: "rgba(250, 250, 250, 1)",
},
hoverColor: {
hc1: 'rgba(24, 144, 255, 0)',
hc2: '#2A2B2E',
},
};

@ -1,11 +1,7 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
@ -18,9 +14,12 @@
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
"jsx": "react-jsx",
"baseUrl": "./",
"paths": {
// baseUrl
"@/*": ["src/*"],
}
},
"include": [
"src"
]
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx"]
}

@ -70,6 +70,7 @@ service.interceptors.response.use(
})
})
}
console.log(res)
return Promise.reject(new Error(res.message || 'Error'))
} else {
const { data } = response

@ -35,7 +35,7 @@ module.exports = {
},
proxy: {
'/hippo4j/v1/cs': {
target: `http://127.0.0.1:6691/hippo4j/v1/cs`,
target: `http://console.hippo4j.cn:6691/hippo4j/v1/cs`,
changOrigin: true,
secure: false,
pathRewrite: {

Loading…
Cancel
Save