feat:首页开发
|
@ -0,0 +1,16 @@
|
|||
# http://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
|
@ -1,3 +0,0 @@
|
|||
module.exports = {
|
||||
extends: require.resolve('@umijs/max/eslint'),
|
||||
};
|
|
@ -1,13 +1,20 @@
|
|||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.env.local
|
||||
/.umirc.local.ts
|
||||
/config/config.local.ts
|
||||
/npm-debug.log*
|
||||
/yarn-error.log
|
||||
/yarn.lock
|
||||
/package-lock.json
|
||||
|
||||
# production
|
||||
/dist
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
|
||||
# umi
|
||||
/src/.umi
|
||||
/src/.umi-production
|
||||
/src/.umi-test
|
||||
/.umi
|
||||
/.umi-production
|
||||
/.umi-test
|
||||
/dist
|
||||
/.mfsu
|
||||
.swc
|
||||
/.env.local
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
npx --no-install max verify-commit $1
|
|
@ -1 +0,0 @@
|
|||
npx --no-install lint-staged --quiet
|
|
@ -1,17 +0,0 @@
|
|||
{
|
||||
"*.{md,json}": [
|
||||
"prettier --cache --write"
|
||||
],
|
||||
"*.{js,jsx}": [
|
||||
"max lint --fix --eslint-only",
|
||||
"prettier --cache --write"
|
||||
],
|
||||
"*.{css,less}": [
|
||||
"max lint --fix --stylelint-only",
|
||||
"prettier --cache --write"
|
||||
],
|
||||
"*.ts?(x)": [
|
||||
"max lint --fix --eslint-only",
|
||||
"prettier --cache --parser=typescript --write"
|
||||
]
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
node_modules
|
||||
.umi
|
||||
.umi-production
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"printWidth": 80,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all",
|
||||
"proseWrap": "never",
|
||||
"overrides": [{ "files": ".prettierrc", "options": { "parser": "json" } }],
|
||||
"plugins": ["prettier-plugin-organize-imports", "prettier-plugin-packagejson"]
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
module.exports = {
|
||||
extends: require.resolve('@umijs/max/stylelint'),
|
||||
};
|
37
.umirc.ts
|
@ -1,35 +1,10 @@
|
|||
import { defineConfig } from '@umijs/max';
|
||||
import { defineConfig } from 'umi';
|
||||
|
||||
export default defineConfig({
|
||||
antd: {},
|
||||
access: {},
|
||||
model: {},
|
||||
initialState: {},
|
||||
request: {},
|
||||
layout: {
|
||||
title: '@umijs/max',
|
||||
hash: true,
|
||||
nodeModulesTransform: {
|
||||
type: 'none',
|
||||
},
|
||||
routes: [
|
||||
{
|
||||
path: '/',
|
||||
redirect: '/home',
|
||||
},
|
||||
{
|
||||
name: '首页',
|
||||
path: '/home',
|
||||
component: './Home',
|
||||
},
|
||||
{
|
||||
name: '权限演示',
|
||||
path: '/access',
|
||||
component: './Access',
|
||||
},
|
||||
{
|
||||
name: ' CRUD 示例',
|
||||
path: '/table',
|
||||
component: './Table',
|
||||
},
|
||||
],
|
||||
npmClient: 'yarn',
|
||||
fastRefresh: {},
|
||||
proxy: {},
|
||||
});
|
||||
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
const users = [
|
||||
{ id: 0, name: 'Umi', nickName: 'U', gender: 'MALE' },
|
||||
{ id: 1, name: 'Fish', nickName: 'B', gender: 'FEMALE' },
|
||||
];
|
||||
|
||||
export default {
|
||||
'GET /api/v1/queryUserList': (req: any, res: any) => {
|
||||
res.json({
|
||||
success: true,
|
||||
data: { list: users },
|
||||
errorCode: 0,
|
||||
});
|
||||
},
|
||||
'PUT /api/v1/user/': (req: any, res: any) => {
|
||||
res.json({
|
||||
success: true,
|
||||
errorCode: 0,
|
||||
});
|
||||
},
|
||||
};
|
50
package.json
|
@ -1,29 +1,39 @@
|
|||
{
|
||||
"private": true,
|
||||
"author": "刘晓茹 <1019216585@qq.com>",
|
||||
"scripts": {
|
||||
"dev": "max dev",
|
||||
"build": "max build",
|
||||
"format": "prettier --cache --write .",
|
||||
"prepare": "husky",
|
||||
"postinstall": "max setup",
|
||||
"setup": "max setup",
|
||||
"start": "npm run dev"
|
||||
"start": "SET NODE_OPTIONS=--openssl-legacy-provider&&umi dev",
|
||||
"build": "SET NODE_OPTIONS=--openssl-legacy-provider&&umi build",
|
||||
"postinstall": "umi generate tmp",
|
||||
"prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'",
|
||||
"test": "umi-test",
|
||||
"test:coverage": "umi-test --coverage"
|
||||
},
|
||||
"gitHooks": {
|
||||
"pre-commit": "lint-staged"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,jsx,less,md,json}": [
|
||||
"prettier --write"
|
||||
],
|
||||
"*.ts?(x)": [
|
||||
"prettier --parser=typescript --write"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@ant-design/icons": "^5.0.1",
|
||||
"@ant-design/pro-components": "^2.4.4",
|
||||
"@umijs/max": "^4.3.28",
|
||||
"antd": "^5.4.0"
|
||||
"@ant-design/pro-layout": "^6.5.0",
|
||||
"@umijs/preset-react": "1.x",
|
||||
"antd": "^4.14.0",
|
||||
"umi": "^3.3.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^18.0.33",
|
||||
"@types/react-dom": "^18.0.11",
|
||||
"husky": "^9",
|
||||
"lint-staged": "^13.2.0",
|
||||
"prettier": "^2.8.7",
|
||||
"prettier-plugin-organize-imports": "^3.2.2",
|
||||
"prettier-plugin-packagejson": "^2.4.3",
|
||||
"typescript": "^5.0.3"
|
||||
"@types/react": "^17.0.0",
|
||||
"@types/react-dom": "^17.0.0",
|
||||
"@umijs/test": "^3.3.9",
|
||||
"lint-staged": "^10.0.7",
|
||||
"prettier": "^2.2.0",
|
||||
"react": "17.x",
|
||||
"react-dom": "17.x",
|
||||
"typescript": "^4.1.2",
|
||||
"yorkie": "^2.0.0"
|
||||
}
|
||||
}
|
||||
|
|
16
readme.md
|
@ -1,3 +1,15 @@
|
|||
# README
|
||||
# umi project
|
||||
|
||||
`@umijs/max` 模板项目,更多功能参考 [Umi Max 简介](https://umijs.org/docs/max/introduce)
|
||||
## Getting Started
|
||||
|
||||
Install dependencies,
|
||||
|
||||
```bash
|
||||
$ yarn
|
||||
```
|
||||
|
||||
Start the dev server,
|
||||
|
||||
```bash
|
||||
$ yarn start
|
||||
```
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
export default (initialState: API.UserInfo) => {
|
||||
// 在这里按照初始化数据定义项目中的权限,统一管理
|
||||
// 参考文档 https://umijs.org/docs/max/access
|
||||
const canSeeAdmin = !!(
|
||||
initialState && initialState.name !== 'dontHaveAccess'
|
||||
);
|
||||
return {
|
||||
canSeeAdmin,
|
||||
};
|
||||
};
|
16
src/app.ts
|
@ -1,16 +0,0 @@
|
|||
// 运行时配置
|
||||
|
||||
// 全局初始化数据配置,用于 Layout 用户信息和权限初始化
|
||||
// 更多信息见文档:https://umijs.org/docs/api/runtime-config#getinitialstate
|
||||
export async function getInitialState(): Promise<{ name: string }> {
|
||||
return { name: '@umijs/max' };
|
||||
}
|
||||
|
||||
export const layout = () => {
|
||||
return {
|
||||
logo: 'https://img.alicdn.com/tfs/TB1YHEpwUT1gK0jSZFhXXaAtVXa-28-27.svg',
|
||||
menu: {
|
||||
locale: false,
|
||||
},
|
||||
};
|
||||
};
|
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 933 KiB |
After Width: | Height: | Size: 444 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 2.4 MiB |
After Width: | Height: | Size: 720 KiB |
After Width: | Height: | Size: 3.6 MiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 2.4 MiB |
After Width: | Height: | Size: 178 KiB |
After Width: | Height: | Size: 627 KiB |
After Width: | Height: | Size: 20 KiB |
|
@ -1,4 +0,0 @@
|
|||
.title {
|
||||
margin: 0 auto;
|
||||
font-weight: 200;
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
import { Layout, Row, Typography } from 'antd';
|
||||
import React from 'react';
|
||||
import styles from './Guide.less';
|
||||
|
||||
interface Props {
|
||||
name: string;
|
||||
}
|
||||
|
||||
// 脚手架示例组件
|
||||
const Guide: React.FC<Props> = (props) => {
|
||||
const { name } = props;
|
||||
return (
|
||||
<Layout>
|
||||
<Row>
|
||||
<Typography.Title level={3} className={styles.title}>
|
||||
欢迎使用 <strong>{name}</strong> !
|
||||
</Typography.Title>
|
||||
</Row>
|
||||
</Layout>
|
||||
);
|
||||
};
|
||||
|
||||
export default Guide;
|
|
@ -1,2 +0,0 @@
|
|||
import Guide from './Guide';
|
||||
export default Guide;
|
|
@ -0,0 +1,13 @@
|
|||
/**
|
||||
* 放一些配置数据
|
||||
*/
|
||||
|
||||
const config = {
|
||||
type: 'xxx',
|
||||
storagePrefix: '__webdemo__',
|
||||
errCode: 0, // 后端业务正常返回码
|
||||
errRedirectCode: -1, // 约定需要跳转到登录页面的errCode值 默认是-1
|
||||
errRedirectURL: '', // 当需要重新登录的时候的登录页面URL
|
||||
};
|
||||
|
||||
export default config;
|
|
@ -1 +0,0 @@
|
|||
export const DEFAULT_NAME = 'Umi Max';
|
|
@ -0,0 +1 @@
|
|||
/* add your global js here */
|
|
@ -0,0 +1,50 @@
|
|||
/**
|
||||
* author: liu.yang
|
||||
* date: 2018-05-17 11:46:47
|
||||
*
|
||||
* 用于存放全局变量
|
||||
* 比如 边框颜色 不同类型的字体颜色 大小
|
||||
*/
|
||||
|
||||
// 一下为全局样式
|
||||
html,
|
||||
body {
|
||||
//height: 100%;
|
||||
min-width: 1280px;
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC,
|
||||
Hiragino Sans GB, Microsoft YaHei, Helvetica Neue, Helvetica, Arial,
|
||||
sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol !important;
|
||||
}
|
||||
#root {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
html {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: inherit;
|
||||
}
|
||||
|
||||
canvas {
|
||||
display: block;
|
||||
}
|
||||
|
||||
body {
|
||||
text-rendering: optimizeLegibility;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
.text-center {
|
||||
text-align: center;
|
||||
}
|
|
@ -0,0 +1,130 @@
|
|||
import React from "react";
|
||||
import { ConfigProvider, Layout, message, Menu, Dropdown } from "antd";
|
||||
import { router } from "umi";
|
||||
import zhCN from "antd/es/locale/zh_CN";
|
||||
import enUS from "antd/es/locale/en_US";
|
||||
import BaseHeader from "./components/BaseHeader";
|
||||
import TopMenu from "./components/TopMenu";
|
||||
import Footer from "./components/Footer";
|
||||
import headMenuData from "./menuData";
|
||||
import yuyanImg from "../assets/icon_yuyan@3x.png";
|
||||
import { getLocale } from "../utils";
|
||||
import styles from "./BaseLayout.less";
|
||||
// import zhCNConfig from "../locales/zh_CN";
|
||||
// import enUSConfig from "../locales/en_US ";
|
||||
|
||||
const { Header, Content } = Layout;
|
||||
|
||||
const findPrefixSelectedKey = (topMenu, key = "") => {
|
||||
for (let i = 0; i < topMenu.length; i += 1) {
|
||||
const item = topMenu[i];
|
||||
if (item.key !== "/" && key.startsWith(item.key)) {
|
||||
return item.key;
|
||||
}
|
||||
}
|
||||
return key;
|
||||
};
|
||||
|
||||
const localeConfig = getLocale();
|
||||
class BaseLayout extends React.Component {
|
||||
state = {
|
||||
locale: localStorage.getItem("language") || "中文",
|
||||
};
|
||||
|
||||
handleLocaleChange = (val) => {
|
||||
if (val !== this.state.locale) {
|
||||
this.setState({ locale: val });
|
||||
localStorage.setItem("language", val);
|
||||
window.location.reload();
|
||||
}
|
||||
};
|
||||
|
||||
localeMenu = (
|
||||
<Menu>
|
||||
<Menu.Item
|
||||
onClick={() => {
|
||||
this.handleLocaleChange("中文");
|
||||
}}
|
||||
>
|
||||
<span style={{ padding: "26px 50px" }}>中文</span>
|
||||
</Menu.Item>
|
||||
<Menu.Item
|
||||
onClick={() => {
|
||||
this.handleLocaleChange("English");
|
||||
}}
|
||||
>
|
||||
<span style={{ padding: "16px 50px" }}>English</span>
|
||||
</Menu.Item>
|
||||
</Menu>
|
||||
);
|
||||
handleSideMenuClick = (item) => {
|
||||
const { history } = this.props;
|
||||
if (item.key) {
|
||||
history.push(item.key);
|
||||
}
|
||||
};
|
||||
|
||||
componentDidCatch(error) {
|
||||
if (process.env.NODE_ENV !== "development") {
|
||||
const { location } = this.props;
|
||||
message.error({
|
||||
content: `非常抱歉,您当前访问的页面:${location.pathname}因为意外的错误崩溃了`,
|
||||
duration: 2,
|
||||
key: "error",
|
||||
});
|
||||
router.replace("/exception/500");
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const { children, location = {} } = this.props;
|
||||
const { pathname = "" } = location;
|
||||
const arr = ["/home"];
|
||||
|
||||
const { locale } = this.state;
|
||||
// const localeConfig = locale === "中文" ? zhCNConfig : enUSConfig;
|
||||
|
||||
return (
|
||||
<ConfigProvider locale={locale === "中文" ? zhCN : enUS}>
|
||||
<Layout className={styles.root}>
|
||||
{/* 顶栏 */}
|
||||
<Header className={styles.header}>
|
||||
<BaseHeader>
|
||||
<div className={styles.headerTitle}>
|
||||
{/* <Logo /> */}
|
||||
<div>{localeConfig.headTitle}</div>
|
||||
<div>
|
||||
<div className={styles.yuyanBox}>
|
||||
{localeConfig.headTel}0523-86818628
|
||||
<div>
|
||||
<img src={yuyanImg} width="28" height="28" />
|
||||
<Dropdown overlay={this.localeMenu}>
|
||||
<span onClick={(e) => e.preventDefault()}>
|
||||
{locale}
|
||||
</span>
|
||||
</Dropdown>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<TopMenu
|
||||
selectedKeys={[
|
||||
findPrefixSelectedKey(headMenuData, location.pathname),
|
||||
]}
|
||||
data={headMenuData}
|
||||
onClick={this.handleSideMenuClick}
|
||||
isInherit={arr.includes(pathname)}
|
||||
/>
|
||||
</BaseHeader>
|
||||
</Header>
|
||||
<Content>{children}</Content>
|
||||
<Footer localeConfig={localeConfig} />
|
||||
</Layout>
|
||||
</ConfigProvider>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default BaseLayout;
|
|
@ -0,0 +1,38 @@
|
|||
.root {
|
||||
height: 100vh;
|
||||
overflow-y: auto;
|
||||
display: block;
|
||||
:global {
|
||||
.ant-layout-content {
|
||||
// padding: 0 10%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.header {
|
||||
height: 59px;
|
||||
height: auto;
|
||||
color: white;
|
||||
padding: 0;
|
||||
.headerTitle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
background-color: #2bb2a8;
|
||||
padding: 0 10%;
|
||||
font-size: 18px;
|
||||
.yuyanBox {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
img {
|
||||
margin: 0 12px 0 50px;
|
||||
}
|
||||
|
||||
:global {
|
||||
.ant-dropdown-trigger {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
import React from 'react';
|
||||
|
||||
|
||||
const LocalContext = React.createContext()
|
||||
|
||||
export const LocaleProvider = LocalContext.Provider
|
||||
export const LocalConsumer = LocalContext.Consumer
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Dropdown, Menu } from 'antd';
|
||||
import people from './user.svg';
|
||||
import styles from './Avatar.less';
|
||||
|
||||
const menu = (
|
||||
<Menu theme="dark">
|
||||
<Menu.Item>退出登录</Menu.Item>
|
||||
</Menu>
|
||||
);
|
||||
|
||||
const Avatar = (props) => {
|
||||
const { className, ...otherProps } = props;
|
||||
return (
|
||||
<Dropdown overlay={menu}>
|
||||
<div className={`${styles.root} ${className}`} {...otherProps}>
|
||||
<img alt="people" src={people} />
|
||||
</div>
|
||||
</Dropdown>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Avatar.propTypes = {
|
||||
className: PropTypes.string,
|
||||
style: PropTypes.object,
|
||||
};
|
||||
|
||||
Avatar.defaultProps = {
|
||||
className: '',
|
||||
style: {},
|
||||
};
|
||||
|
||||
export default Avatar;
|
|
@ -0,0 +1,14 @@
|
|||
.root {
|
||||
transition: background-color 300ms;
|
||||
background-color: rgba(255, 255, 255, 0);
|
||||
cursor: pointer;
|
||||
padding: 0 12px;
|
||||
|
||||
&:hover {
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
img {
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
import Avatar from './Avatar';
|
||||
|
||||
export default Avatar;
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="28px" height="28px" viewBox="0 0 28 28" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>uers 2</title>
|
||||
<g id="组件" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" opacity="0.45">
|
||||
<g id="_top/2" transform="translate(-1397.000000, -11.000000)" fill="#FFFFFF">
|
||||
<g id="用户" transform="translate(1391.000000, 5.000000)">
|
||||
<g id="uers-2" transform="translate(6.000000, 6.000000)">
|
||||
<path d="M14,28 C6.2680135,28 5.32907052e-15,21.7319865 5.32907052e-15,14 C5.32907052e-15,6.2680135 6.2680135,0 14,0 C21.7319865,0 28,6.2680135 28,14 C28,21.7319865 21.7319865,28 14,28 Z M6.00075,21.6545 C6.00075,21.6545 21.99925,21.6545 21.99925,21.69475 L21.99925,17.437 C21.99925,15.1445 16.667,14 14,14 C11.333,14 6.00075,15.14625 6.00075,17.437 L6.00075,21.6545 Z M14,11.99975 C15.4488717,12.0300584 16.8008452,11.2744324 17.5341717,10.0244804 C18.2674983,8.77452849 18.2674983,7.22572151 17.5341717,5.97576956 C16.8008452,4.72581762 15.4488717,3.9701916 14,4.0005 C11.8236669,4.0460259 10.0831667,5.82331578 10.0831667,8.000125 C10.0831667,10.1769342 11.8236669,11.9542241 14,11.99975 L14,11.99975 Z" id="uers"></path>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.3 KiB |
|
@ -0,0 +1,67 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import logo from './logo.jpg';
|
||||
import styles from './BaseHeader.less';
|
||||
|
||||
const Logo = (props) => {
|
||||
const { className = '', src = logo, ...otherProps } = props;
|
||||
return (
|
||||
<div className={`${styles.logo} ${className}`} {...otherProps}>
|
||||
<img alt="logo" src={src} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const Title = (props) => {
|
||||
const { className = '', ...otherProps } = props;
|
||||
return <div className={`${styles.title} ${className}`} {...otherProps} />;
|
||||
};
|
||||
|
||||
const HSpace = (props) => {
|
||||
const { size, ...otherProps } = props;
|
||||
return <div style={{ width: size || 0 }} {...otherProps} />;
|
||||
};
|
||||
|
||||
const Item = (props) => {
|
||||
const {
|
||||
className = '',
|
||||
text = false,
|
||||
hPadding = 12,
|
||||
style = {},
|
||||
...otherProps
|
||||
} = props;
|
||||
return (
|
||||
<div
|
||||
className={`${style.item} ${text ? style.textLink : ''} ${className}`}
|
||||
style={{
|
||||
paddingLeft: hPadding,
|
||||
paddingRight: hPadding,
|
||||
...style,
|
||||
}}
|
||||
{...otherProps}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
const BaseHeader = (props) => {
|
||||
const { className, children, ...otherProps } = props;
|
||||
return (
|
||||
<div className={`${styles.root} ${className}`} {...otherProps}>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
BaseHeader.propTypes = {
|
||||
className: PropTypes.string,
|
||||
style: PropTypes.object,
|
||||
};
|
||||
|
||||
BaseHeader.defaultProps = {
|
||||
className: '',
|
||||
style: {},
|
||||
};
|
||||
|
||||
export { Logo, Title, HSpace, Item };
|
||||
|
||||
export default BaseHeader;
|
|
@ -0,0 +1,44 @@
|
|||
.root {
|
||||
position: relative;
|
||||
height: 100%;
|
||||
|
||||
.logo {
|
||||
margin-right: 10px;
|
||||
img {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 100px;
|
||||
}
|
||||
}
|
||||
|
||||
.title {
|
||||
white-space: nowrap;
|
||||
font-size: 20px;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.menu {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.item {
|
||||
height: 100%;
|
||||
line-height: 46px;
|
||||
}
|
||||
|
||||
.search-content {
|
||||
padding: 0 12px;
|
||||
}
|
||||
|
||||
.textLink {
|
||||
color: rgba(255, 255, 255, 0.45);
|
||||
padding: 0 12px;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
transition: color 300ms, background-color 300ms;
|
||||
|
||||
&:hover {
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
import BaseHeader from './BaseHeader';
|
||||
|
||||
export * from './BaseHeader';
|
||||
|
||||
export default BaseHeader;
|
After Width: | Height: | Size: 425 KiB |
|
@ -0,0 +1,52 @@
|
|||
import React from "react";
|
||||
import { Dropdown, Menu } from "antd";
|
||||
import img1 from "../../../assets/img_logo_2@3x.png";
|
||||
import img2 from "../../../assets/img_erqeima@3x.png";
|
||||
|
||||
import styles from "./Footer.less";
|
||||
|
||||
const Footer = (props) => {
|
||||
const { className, localeConfig, ...otherProps } = props;
|
||||
const {
|
||||
footerMenu1,
|
||||
footerMenu2,
|
||||
footerMenu3,
|
||||
footerMenu4,
|
||||
footerMenu5,
|
||||
footerMenu6,
|
||||
} = localeConfig;
|
||||
const menmus1 = [footerMenu1, footerMenu2, footerMenu3, footerMenu4];
|
||||
const menmus2 = [footerMenu5, footerMenu6];
|
||||
return (
|
||||
<div className={styles.root}>
|
||||
<div className={styles.content}>
|
||||
<div>
|
||||
<img src={img1} width={266} height={70} />
|
||||
</div>
|
||||
<div className={styles.menuBox}>
|
||||
<div>
|
||||
{menmus1.map((item, index) => (
|
||||
<div className={styles.menuItem} key={`footer-menu1-${index}`}>
|
||||
{item}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<div>
|
||||
{menmus2.map((item, index) => (
|
||||
<div className={styles.menuItem} key={`footer-menu2-${index}`}>
|
||||
{item}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<img src={img2} width={140} height={140} />
|
||||
<div style={{ marginTop: 10 }}>{localeConfig.footerScan}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className={styles.info}>{localeConfig.footerInfo}</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Footer;
|
|
@ -0,0 +1,32 @@
|
|||
.root {
|
||||
background-color: #333333;
|
||||
height: 378px;
|
||||
padding: 44px;
|
||||
font-family: Source Han Sans SC;
|
||||
font-weight: 400;
|
||||
font-size: 20px;
|
||||
color: #ffffff;
|
||||
line-height: 34px;
|
||||
|
||||
.content {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
.menuBox {
|
||||
// flex: 1;
|
||||
display: grid;
|
||||
grid-template-columns: auto auto 1fr;
|
||||
grid-column-gap: 200px;
|
||||
.menuItem {
|
||||
margin-bottom: 10px;
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
color: #2bb2a8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.info {
|
||||
margin-top: 90px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
import Footer from './Footer';
|
||||
|
||||
export default Footer;
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="28px" height="28px" viewBox="0 0 28 28" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>uers 2</title>
|
||||
<g id="组件" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" opacity="0.45">
|
||||
<g id="_top/2" transform="translate(-1397.000000, -11.000000)" fill="#FFFFFF">
|
||||
<g id="用户" transform="translate(1391.000000, 5.000000)">
|
||||
<g id="uers-2" transform="translate(6.000000, 6.000000)">
|
||||
<path d="M14,28 C6.2680135,28 5.32907052e-15,21.7319865 5.32907052e-15,14 C5.32907052e-15,6.2680135 6.2680135,0 14,0 C21.7319865,0 28,6.2680135 28,14 C28,21.7319865 21.7319865,28 14,28 Z M6.00075,21.6545 C6.00075,21.6545 21.99925,21.6545 21.99925,21.69475 L21.99925,17.437 C21.99925,15.1445 16.667,14 14,14 C11.333,14 6.00075,15.14625 6.00075,17.437 L6.00075,21.6545 Z M14,11.99975 C15.4488717,12.0300584 16.8008452,11.2744324 17.5341717,10.0244804 C18.2674983,8.77452849 18.2674983,7.22572151 17.5341717,5.97576956 C16.8008452,4.72581762 15.4488717,3.9701916 14,4.0005 C11.8236669,4.0460259 10.0831667,5.82331578 10.0831667,8.000125 C10.0831667,10.1769342 11.8236669,11.9542241 14,11.99975 L14,11.99975 Z" id="uers"></path>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.3 KiB |
|
@ -0,0 +1,65 @@
|
|||
import React from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import logoImg from "../../../assets/logo.png";
|
||||
import { Icon, Menu } from "antd";
|
||||
import styles from "./TopMenu.less";
|
||||
|
||||
const { SubMenu } = Menu;
|
||||
|
||||
const renderMenuList = (menuList) =>
|
||||
menuList.map((item) => {
|
||||
const { key, icon, text, children, render } = item;
|
||||
const isArray = Array.isArray(children);
|
||||
|
||||
const renderItem = () =>
|
||||
typeof render === "function" ? (
|
||||
render()
|
||||
) : (
|
||||
<span>
|
||||
{icon && (React.isValidElement(icon) ? icon : <Icon type={icon} />)}
|
||||
<span>{text}</span>
|
||||
</span>
|
||||
);
|
||||
|
||||
if (isArray) {
|
||||
/* subMenu */
|
||||
return (
|
||||
<SubMenu key={key} popupClassName={styles.popup} title={renderItem()}>
|
||||
{renderMenuList(children)}
|
||||
</SubMenu>
|
||||
);
|
||||
}
|
||||
|
||||
return <Menu.Item key={key}>{renderItem()}</Menu.Item>;
|
||||
});
|
||||
|
||||
const TopMenu = (props) => {
|
||||
const { className, data, isInherit, ...otherProps } = props;
|
||||
return (
|
||||
<div className={` ${isInherit ? styles.root2 : styles.root1} ${className}`}>
|
||||
<img src={logoImg} height="40" />
|
||||
<Menu
|
||||
theme="dark"
|
||||
defaultSelectedKeys={["1"]}
|
||||
mode="horizontal"
|
||||
{...otherProps}
|
||||
>
|
||||
{renderMenuList(data)}
|
||||
</Menu>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
TopMenu.propTypes = {
|
||||
className: PropTypes.string,
|
||||
style: PropTypes.object,
|
||||
data: PropTypes.arrayOf(PropTypes.shape({})),
|
||||
};
|
||||
|
||||
TopMenu.defaultProps = {
|
||||
className: "",
|
||||
style: {},
|
||||
data: [],
|
||||
};
|
||||
|
||||
export default TopMenu;
|
|
@ -0,0 +1,53 @@
|
|||
.root {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
background-color: white !important;
|
||||
padding: 45px 10%;
|
||||
|
||||
img {
|
||||
width: 266px;
|
||||
height: 70px;
|
||||
}
|
||||
|
||||
:global {
|
||||
.ant-menu-dark .ant-menu-item:hover {
|
||||
color: #2bb2a8;
|
||||
}
|
||||
.ant-menu.ant-menu-dark,
|
||||
.ant-menu-dark .ant-menu-sub,
|
||||
.ant-menu.ant-menu-dark .ant-menu-sub {
|
||||
color: #131313;
|
||||
font-size: 26px;
|
||||
background-color: white !important;
|
||||
text-align: right;
|
||||
}
|
||||
.ant-menu-item:not(:last-child),
|
||||
.ant-menu-item {
|
||||
margin-bottom: 0;
|
||||
margin-top: 0;
|
||||
color: #131313;
|
||||
background-color: white !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
.root2 {
|
||||
.root;
|
||||
background-color: rgba(0, 0, 0, 0) !important;
|
||||
position: absolute;
|
||||
z-index: 99;
|
||||
left: 0;
|
||||
right: 0;
|
||||
:global {
|
||||
.ant-menu.ant-menu-dark,
|
||||
.ant-menu-dark .ant-menu-sub,
|
||||
.ant-menu.ant-menu-dark .ant-menu-sub,
|
||||
.ant-menu-item:not(:last-child),
|
||||
.ant-menu-item {
|
||||
background-color: rgba(0, 0, 0, 0) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
.root1 {
|
||||
.root;
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
import TopMenu from './TopMenu';
|
||||
|
||||
export default TopMenu;
|
|
@ -0,0 +1,3 @@
|
|||
import BaseLayout from './BaseLayout';
|
||||
|
||||
export default BaseLayout;
|
|
@ -0,0 +1,22 @@
|
|||
export default [
|
||||
{
|
||||
key: '/home',
|
||||
text: '首页',
|
||||
},
|
||||
{
|
||||
key: '/about-us',
|
||||
text: '关于我们',
|
||||
},
|
||||
{
|
||||
key: '/product-center',
|
||||
text: '产品中心',
|
||||
},
|
||||
{
|
||||
key: '/technical-support',
|
||||
text: '技术支持',
|
||||
},
|
||||
{
|
||||
key: '/contact-us',
|
||||
text: '联系我们',
|
||||
},
|
||||
];
|
|
@ -0,0 +1,4 @@
|
|||
export default {
|
||||
headTitle: 'headTitle',
|
||||
headTel:'客服热线:'
|
||||
};
|
|
@ -0,0 +1,20 @@
|
|||
export default {
|
||||
headTitle: "欢迎浏览宝锐生物科技泰州有限公司官方网站",
|
||||
headTel: "客服热线:",
|
||||
cpzx: "产品中心",
|
||||
cpms:
|
||||
"为实现血型检测的标准化、自动化、数字化而倾心付出 忠诚服务“输血安全”事业是我们矢志不渝的追求",
|
||||
gywm: "ABOUT US",
|
||||
gywmjj: "宝锐生物科技 · 公司简介",
|
||||
jjInfo:
|
||||
"宝锐生物科技泰州有限公司座落于美丽的江苏省泰州市,是一家以研发为基础,集研、产、销为一体的高科技型企业。",
|
||||
jjBtn: "了解更多",
|
||||
footerInfo: "Copyright © 2016 宝锐生物科技泰州有限公司 苏ICP备09064458号",
|
||||
footerScan: "公众号二维码",
|
||||
footerMenu1: "关于我们",
|
||||
footerMenu2: "产品中心",
|
||||
footerMenu3: "技术支持",
|
||||
footerMenu4: "联系我们",
|
||||
footerMenu5: "免责声明",
|
||||
footerMenu6: "隐私政策",
|
||||
};
|
|
@ -1,13 +0,0 @@
|
|||
// 全局共享数据示例
|
||||
import { DEFAULT_NAME } from '@/constants';
|
||||
import { useState } from 'react';
|
||||
|
||||
const useUser = () => {
|
||||
const [name, setName] = useState<string>(DEFAULT_NAME);
|
||||
return {
|
||||
name,
|
||||
setName,
|
||||
};
|
||||
};
|
||||
|
||||
export default useUser;
|
|
@ -1,21 +0,0 @@
|
|||
import { PageContainer } from '@ant-design/pro-components';
|
||||
import { Access, useAccess } from '@umijs/max';
|
||||
import { Button } from 'antd';
|
||||
|
||||
const AccessPage: React.FC = () => {
|
||||
const access = useAccess();
|
||||
return (
|
||||
<PageContainer
|
||||
ghost
|
||||
header={{
|
||||
title: '权限示例',
|
||||
}}
|
||||
>
|
||||
<Access accessible={access.canSeeAdmin}>
|
||||
<Button>只有 Admin 可以看到这个按钮</Button>
|
||||
</Access>
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
|
||||
export default AccessPage;
|
|
@ -0,0 +1,54 @@
|
|||
import React from "react";
|
||||
import { Button, Carousel, Image } from "antd";
|
||||
import bg1 from "../../assets/img_guanyu@3x.png";
|
||||
import bg2 from "../../assets/img_guanyu_2@3x.png";
|
||||
import bg3 from "../../assets/img_qiye@3x.png";
|
||||
import bg4 from "../../assets/img_rongyu@3x.png";
|
||||
import bg5 from "../../assets/img_banner@3x.png";
|
||||
|
||||
import { getLocale } from "../../utils";
|
||||
|
||||
import styles from "./index.less";
|
||||
|
||||
const IndexPage = (props) => {
|
||||
console.log(props);
|
||||
const locale = getLocale();
|
||||
|
||||
return (
|
||||
<div className={styles.root}>
|
||||
<div className={styles.content}>
|
||||
<div className={styles.lbBox}>
|
||||
<Carousel autoplay={true} adaptiveHeight={true}>
|
||||
<img src={bg5} />
|
||||
<img src={bg5} />
|
||||
<img src={bg5} />
|
||||
</Carousel>
|
||||
</div>
|
||||
<div className={styles.cpBox}>
|
||||
<div className={styles.titleBox}>
|
||||
<div className={styles.title}>{locale.cpzx}</div>
|
||||
<span className={styles.info}>{locale.cpms}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className={styles.gywmBox}>
|
||||
<img src={bg1} width="100%" height="469" />
|
||||
<span className={styles.whiteTitle}>{locale.gywm}</span>
|
||||
<img src={bg2} width="100%" height="353" />
|
||||
<div className={styles.jjBox}>
|
||||
<div className={styles.jjTitle}>{locale.gywmjj}</div>
|
||||
<div className={styles.jjInfo}>{locale.jjInfo}</div>
|
||||
<Button type="primary">{locale.jjBtn}</Button>
|
||||
</div>
|
||||
<div className={styles.qywhBox}>
|
||||
<img src={bg3} width="368" height="311" />
|
||||
</div>
|
||||
<div className={styles.zzryBox}>
|
||||
<img src={bg4} width="368" height="311" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default IndexPage;
|
|
@ -1,3 +1,92 @@
|
|||
.container {
|
||||
padding-top: 80px;
|
||||
.root {
|
||||
background-image: url(../../assets/img_chanpin_bg@3x.png);
|
||||
background-size: 100% 100%;
|
||||
background-repeat: no-repeat;
|
||||
min-height: 100%;
|
||||
.content {
|
||||
.lbBox {
|
||||
text-align: center;
|
||||
:global {
|
||||
.ant-carousel {
|
||||
}
|
||||
img {
|
||||
width: 100vw !important;
|
||||
height: auto;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.ant-carousel .slick-dots li.slick-active {
|
||||
opacity: 1;
|
||||
}
|
||||
.ant-carousel .slick-dots li.slick-active button {
|
||||
display: none;
|
||||
}
|
||||
.ant-carousel .slick-dots li {
|
||||
width: 30px !important;
|
||||
height: 10px;
|
||||
background: #2bb2a8;
|
||||
border-radius: 5px;
|
||||
opacity: 0.2;
|
||||
}
|
||||
}
|
||||
}
|
||||
.cpBox {
|
||||
padding: 130px 10% 80px;
|
||||
.titleBox {
|
||||
text-align: center;
|
||||
margin-bottom: 70px;
|
||||
.title {
|
||||
font-size: 48px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.info {
|
||||
width: 550px;
|
||||
display: inline-block;
|
||||
margin-top: 30px;
|
||||
font-size: 22px;
|
||||
color: #595a61;
|
||||
line-height: 40px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.gywmBox {
|
||||
position: relative;
|
||||
.whiteTitle {
|
||||
position: absolute;
|
||||
color: white;
|
||||
font-size: 80px;
|
||||
font-weight: bold;
|
||||
top: 205px;
|
||||
left: calc(50% - 25px);
|
||||
}
|
||||
.jjBox {
|
||||
position: absolute;
|
||||
bottom: 111px;
|
||||
left: 10%;
|
||||
width: 486px;
|
||||
.jjTitle {
|
||||
font-weight: bold;
|
||||
font-size: 24px;
|
||||
color: #000000;
|
||||
margin-bottom: 26px;
|
||||
}
|
||||
.jjInfo {
|
||||
font-weight: 300;
|
||||
font-size: 16px;
|
||||
color: #595a61;
|
||||
line-height: 32px;
|
||||
}
|
||||
}
|
||||
.qywhBox {
|
||||
position: absolute;
|
||||
right: 20%;
|
||||
bottom: 111px;
|
||||
}
|
||||
.zzryBox {
|
||||
position: absolute;
|
||||
right: 10%;
|
||||
bottom: 111px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
import Guide from '@/components/Guide';
|
||||
import { trim } from '@/utils/format';
|
||||
import { PageContainer } from '@ant-design/pro-components';
|
||||
import { useModel } from '@umijs/max';
|
||||
import styles from './index.less';
|
||||
|
||||
const HomePage: React.FC = () => {
|
||||
const { name } = useModel('global');
|
||||
return (
|
||||
<PageContainer ghost>
|
||||
<div className={styles.container}>
|
||||
<Guide name={trim(name)} />
|
||||
</div>
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
|
||||
export default HomePage;
|
|
@ -1,26 +0,0 @@
|
|||
import { Modal } from 'antd';
|
||||
import React, { PropsWithChildren } from 'react';
|
||||
|
||||
interface CreateFormProps {
|
||||
modalVisible: boolean;
|
||||
onCancel: () => void;
|
||||
}
|
||||
|
||||
const CreateForm: React.FC<PropsWithChildren<CreateFormProps>> = (props) => {
|
||||
const { modalVisible, onCancel } = props;
|
||||
|
||||
return (
|
||||
<Modal
|
||||
destroyOnClose
|
||||
title="新建"
|
||||
width={420}
|
||||
open={modalVisible}
|
||||
onCancel={() => onCancel()}
|
||||
footer={null}
|
||||
>
|
||||
{props.children}
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
export default CreateForm;
|
|
@ -1,138 +0,0 @@
|
|||
import {
|
||||
ProFormDateTimePicker,
|
||||
ProFormRadio,
|
||||
ProFormSelect,
|
||||
ProFormText,
|
||||
ProFormTextArea,
|
||||
StepsForm,
|
||||
} from '@ant-design/pro-components';
|
||||
import { Modal } from 'antd';
|
||||
import React from 'react';
|
||||
|
||||
export interface FormValueType extends Partial<API.UserInfo> {
|
||||
target?: string;
|
||||
template?: string;
|
||||
type?: string;
|
||||
time?: string;
|
||||
frequency?: string;
|
||||
}
|
||||
|
||||
export interface UpdateFormProps {
|
||||
onCancel: (flag?: boolean, formVals?: FormValueType) => void;
|
||||
onSubmit: (values: FormValueType) => Promise<void>;
|
||||
updateModalVisible: boolean;
|
||||
values: Partial<API.UserInfo>;
|
||||
}
|
||||
|
||||
const UpdateForm: React.FC<UpdateFormProps> = (props) => (
|
||||
<StepsForm
|
||||
stepsProps={{
|
||||
size: 'small',
|
||||
}}
|
||||
stepsFormRender={(dom, submitter) => {
|
||||
return (
|
||||
<Modal
|
||||
width={640}
|
||||
bodyStyle={{ padding: '32px 40px 48px' }}
|
||||
destroyOnClose
|
||||
title="规则配置"
|
||||
open={props.updateModalVisible}
|
||||
footer={submitter}
|
||||
onCancel={() => props.onCancel()}
|
||||
>
|
||||
{dom}
|
||||
</Modal>
|
||||
);
|
||||
}}
|
||||
onFinish={props.onSubmit}
|
||||
>
|
||||
<StepsForm.StepForm
|
||||
initialValues={{
|
||||
name: props.values.name,
|
||||
nickName: props.values.nickName,
|
||||
}}
|
||||
title="基本信息"
|
||||
>
|
||||
<ProFormText
|
||||
width="md"
|
||||
name="name"
|
||||
label="规则名称"
|
||||
rules={[{ required: true, message: '请输入规则名称!' }]}
|
||||
/>
|
||||
<ProFormTextArea
|
||||
name="desc"
|
||||
width="md"
|
||||
label="规则描述"
|
||||
placeholder="请输入至少五个字符"
|
||||
rules={[
|
||||
{ required: true, message: '请输入至少五个字符的规则描述!', min: 5 },
|
||||
]}
|
||||
/>
|
||||
</StepsForm.StepForm>
|
||||
<StepsForm.StepForm
|
||||
initialValues={{
|
||||
target: '0',
|
||||
template: '0',
|
||||
}}
|
||||
title="配置规则属性"
|
||||
>
|
||||
<ProFormSelect
|
||||
width="md"
|
||||
name="target"
|
||||
label="监控对象"
|
||||
valueEnum={{
|
||||
0: '表一',
|
||||
1: '表二',
|
||||
}}
|
||||
/>
|
||||
<ProFormSelect
|
||||
width="md"
|
||||
name="template"
|
||||
label="规则模板"
|
||||
valueEnum={{
|
||||
0: '规则模板一',
|
||||
1: '规则模板二',
|
||||
}}
|
||||
/>
|
||||
<ProFormRadio.Group
|
||||
name="type"
|
||||
width="md"
|
||||
label="规则类型"
|
||||
options={[
|
||||
{
|
||||
value: '0',
|
||||
label: '强',
|
||||
},
|
||||
{
|
||||
value: '1',
|
||||
label: '弱',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</StepsForm.StepForm>
|
||||
<StepsForm.StepForm
|
||||
initialValues={{
|
||||
type: '1',
|
||||
frequency: 'month',
|
||||
}}
|
||||
title="设定调度周期"
|
||||
>
|
||||
<ProFormDateTimePicker
|
||||
name="time"
|
||||
label="开始时间"
|
||||
rules={[{ required: true, message: '请选择开始时间!' }]}
|
||||
/>
|
||||
<ProFormSelect
|
||||
name="frequency"
|
||||
label="监控对象"
|
||||
width="xs"
|
||||
valueEnum={{
|
||||
month: '月',
|
||||
week: '周',
|
||||
}}
|
||||
/>
|
||||
</StepsForm.StepForm>
|
||||
</StepsForm>
|
||||
);
|
||||
|
||||
export default UpdateForm;
|
|
@ -1,270 +0,0 @@
|
|||
import services from '@/services/demo';
|
||||
import {
|
||||
ActionType,
|
||||
FooterToolbar,
|
||||
PageContainer,
|
||||
ProDescriptions,
|
||||
ProDescriptionsItemProps,
|
||||
ProTable,
|
||||
} from '@ant-design/pro-components';
|
||||
import { Button, Divider, Drawer, message } from 'antd';
|
||||
import React, { useRef, useState } from 'react';
|
||||
import CreateForm from './components/CreateForm';
|
||||
import UpdateForm, { FormValueType } from './components/UpdateForm';
|
||||
|
||||
const { addUser, queryUserList, deleteUser, modifyUser } =
|
||||
services.UserController;
|
||||
|
||||
/**
|
||||
* 添加节点
|
||||
* @param fields
|
||||
*/
|
||||
const handleAdd = async (fields: API.UserInfo) => {
|
||||
const hide = message.loading('正在添加');
|
||||
try {
|
||||
await addUser({ ...fields });
|
||||
hide();
|
||||
message.success('添加成功');
|
||||
return true;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('添加失败请重试!');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 更新节点
|
||||
* @param fields
|
||||
*/
|
||||
const handleUpdate = async (fields: FormValueType) => {
|
||||
const hide = message.loading('正在配置');
|
||||
try {
|
||||
await modifyUser(
|
||||
{
|
||||
userId: fields.id || '',
|
||||
},
|
||||
{
|
||||
name: fields.name || '',
|
||||
nickName: fields.nickName || '',
|
||||
email: fields.email || '',
|
||||
},
|
||||
);
|
||||
hide();
|
||||
|
||||
message.success('配置成功');
|
||||
return true;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('配置失败请重试!');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 删除节点
|
||||
* @param selectedRows
|
||||
*/
|
||||
const handleRemove = async (selectedRows: API.UserInfo[]) => {
|
||||
const hide = message.loading('正在删除');
|
||||
if (!selectedRows) return true;
|
||||
try {
|
||||
await deleteUser({
|
||||
userId: selectedRows.find((row) => row.id)?.id || '',
|
||||
});
|
||||
hide();
|
||||
message.success('删除成功,即将刷新');
|
||||
return true;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('删除失败,请重试');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
const TableList: React.FC<unknown> = () => {
|
||||
const [createModalVisible, handleModalVisible] = useState<boolean>(false);
|
||||
const [updateModalVisible, handleUpdateModalVisible] =
|
||||
useState<boolean>(false);
|
||||
const [stepFormValues, setStepFormValues] = useState({});
|
||||
const actionRef = useRef<ActionType>();
|
||||
const [row, setRow] = useState<API.UserInfo>();
|
||||
const [selectedRowsState, setSelectedRows] = useState<API.UserInfo[]>([]);
|
||||
const columns: ProDescriptionsItemProps<API.UserInfo>[] = [
|
||||
{
|
||||
title: '名称',
|
||||
dataIndex: 'name',
|
||||
tip: '名称是唯一的 key',
|
||||
formItemProps: {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '名称为必填项',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '昵称',
|
||||
dataIndex: 'nickName',
|
||||
valueType: 'text',
|
||||
},
|
||||
{
|
||||
title: '性别',
|
||||
dataIndex: 'gender',
|
||||
hideInForm: true,
|
||||
valueEnum: {
|
||||
0: { text: '男', status: 'MALE' },
|
||||
1: { text: '女', status: 'FEMALE' },
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'option',
|
||||
valueType: 'option',
|
||||
render: (_, record) => (
|
||||
<>
|
||||
<a
|
||||
onClick={() => {
|
||||
handleUpdateModalVisible(true);
|
||||
setStepFormValues(record);
|
||||
}}
|
||||
>
|
||||
配置
|
||||
</a>
|
||||
<Divider type="vertical" />
|
||||
<a href="">订阅警报</a>
|
||||
</>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<PageContainer
|
||||
header={{
|
||||
title: 'CRUD 示例',
|
||||
}}
|
||||
>
|
||||
<ProTable<API.UserInfo>
|
||||
headerTitle="查询表格"
|
||||
actionRef={actionRef}
|
||||
rowKey="id"
|
||||
search={{
|
||||
labelWidth: 120,
|
||||
}}
|
||||
toolBarRender={() => [
|
||||
<Button
|
||||
key="1"
|
||||
type="primary"
|
||||
onClick={() => handleModalVisible(true)}
|
||||
>
|
||||
新建
|
||||
</Button>,
|
||||
]}
|
||||
request={async (params, sorter, filter) => {
|
||||
const { data, success } = await queryUserList({
|
||||
...params,
|
||||
// FIXME: remove @ts-ignore
|
||||
// @ts-ignore
|
||||
sorter,
|
||||
filter,
|
||||
});
|
||||
return {
|
||||
data: data?.list || [],
|
||||
success,
|
||||
};
|
||||
}}
|
||||
columns={columns}
|
||||
rowSelection={{
|
||||
onChange: (_, selectedRows) => setSelectedRows(selectedRows),
|
||||
}}
|
||||
/>
|
||||
{selectedRowsState?.length > 0 && (
|
||||
<FooterToolbar
|
||||
extra={
|
||||
<div>
|
||||
已选择{' '}
|
||||
<a style={{ fontWeight: 600 }}>{selectedRowsState.length}</a>{' '}
|
||||
项
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<Button
|
||||
onClick={async () => {
|
||||
await handleRemove(selectedRowsState);
|
||||
setSelectedRows([]);
|
||||
actionRef.current?.reloadAndRest?.();
|
||||
}}
|
||||
>
|
||||
批量删除
|
||||
</Button>
|
||||
<Button type="primary">批量审批</Button>
|
||||
</FooterToolbar>
|
||||
)}
|
||||
<CreateForm
|
||||
onCancel={() => handleModalVisible(false)}
|
||||
modalVisible={createModalVisible}
|
||||
>
|
||||
<ProTable<API.UserInfo, API.UserInfo>
|
||||
onSubmit={async (value) => {
|
||||
const success = await handleAdd(value);
|
||||
if (success) {
|
||||
handleModalVisible(false);
|
||||
if (actionRef.current) {
|
||||
actionRef.current.reload();
|
||||
}
|
||||
}
|
||||
}}
|
||||
rowKey="id"
|
||||
type="form"
|
||||
columns={columns}
|
||||
/>
|
||||
</CreateForm>
|
||||
{stepFormValues && Object.keys(stepFormValues).length ? (
|
||||
<UpdateForm
|
||||
onSubmit={async (value) => {
|
||||
const success = await handleUpdate(value);
|
||||
if (success) {
|
||||
handleUpdateModalVisible(false);
|
||||
setStepFormValues({});
|
||||
if (actionRef.current) {
|
||||
actionRef.current.reload();
|
||||
}
|
||||
}
|
||||
}}
|
||||
onCancel={() => {
|
||||
handleUpdateModalVisible(false);
|
||||
setStepFormValues({});
|
||||
}}
|
||||
updateModalVisible={updateModalVisible}
|
||||
values={stepFormValues}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
<Drawer
|
||||
width={600}
|
||||
open={!!row}
|
||||
onClose={() => {
|
||||
setRow(undefined);
|
||||
}}
|
||||
closable={false}
|
||||
>
|
||||
{row?.name && (
|
||||
<ProDescriptions<API.UserInfo>
|
||||
column={2}
|
||||
title={row?.name}
|
||||
request={async () => ({
|
||||
data: row || {},
|
||||
})}
|
||||
params={{
|
||||
id: row?.name,
|
||||
}}
|
||||
columns={columns}
|
||||
/>
|
||||
)}
|
||||
</Drawer>
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
|
||||
export default TableList;
|
|
@ -0,0 +1,14 @@
|
|||
import styles from "./index.less";
|
||||
import { LocalConsumer } from "../../layouts/MyContext";
|
||||
import React, { useContext } from "react";
|
||||
|
||||
const IndexPage = (props) => {
|
||||
console.log(props);
|
||||
return (
|
||||
<div>
|
||||
<h1 className={styles.title}>Page index</h1>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default IndexPage;
|
|
@ -0,0 +1,3 @@
|
|||
.title {
|
||||
background: rgb(121, 242, 157);
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
import styles from "./index.less";
|
||||
import { LocalConsumer } from "../../layouts/MyContext";
|
||||
import React, { useContext } from "react";
|
||||
|
||||
const IndexPage = (props) => {
|
||||
console.log(props);
|
||||
return (
|
||||
<div>
|
||||
<h1 className={styles.title}>Page index</h1>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default IndexPage;
|
|
@ -0,0 +1,3 @@
|
|||
.title {
|
||||
background: rgb(121, 242, 157);
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
import styles from "./index.less";
|
||||
import { LocalConsumer } from "../../layouts/MyContext";
|
||||
import React, { useContext } from "react";
|
||||
|
||||
const IndexPage = (props) => {
|
||||
console.log(props);
|
||||
return (
|
||||
<div>
|
||||
<h1 className={styles.title}>Page index</h1>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default IndexPage;
|
|
@ -0,0 +1,3 @@
|
|||
.title {
|
||||
background: rgb(121, 242, 157);
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
import styles from "./index.less";
|
||||
import { LocalConsumer } from "../../layouts/MyContext";
|
||||
import React, { useContext } from "react";
|
||||
|
||||
const IndexPage = (props) => {
|
||||
console.log(props);
|
||||
return (
|
||||
<div>
|
||||
<h1 className={styles.title}>Page index</h1>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default IndexPage;
|
|
@ -0,0 +1,3 @@
|
|||
.title {
|
||||
background: rgb(121, 242, 157);
|
||||
}
|
|
@ -1,96 +0,0 @@
|
|||
/* eslint-disable */
|
||||
// 该文件由 OneAPI 自动生成,请勿手动修改!
|
||||
import { request } from '@umijs/max';
|
||||
|
||||
/** 此处后端没有提供注释 GET /api/v1/queryUserList */
|
||||
export async function queryUserList(
|
||||
params: {
|
||||
// query
|
||||
/** keyword */
|
||||
keyword?: string;
|
||||
/** current */
|
||||
current?: number;
|
||||
/** pageSize */
|
||||
pageSize?: number;
|
||||
},
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.Result_PageInfo_UserInfo__>('/api/v1/queryUserList', {
|
||||
method: 'GET',
|
||||
params: {
|
||||
...params,
|
||||
},
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 此处后端没有提供注释 POST /api/v1/user */
|
||||
export async function addUser(
|
||||
body?: API.UserInfoVO,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.Result_UserInfo_>('/api/v1/user', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 此处后端没有提供注释 GET /api/v1/user/${param0} */
|
||||
export async function getUserDetail(
|
||||
params: {
|
||||
// path
|
||||
/** userId */
|
||||
userId?: string;
|
||||
},
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
const { userId: param0 } = params;
|
||||
return request<API.Result_UserInfo_>(`/api/v1/user/${param0}`, {
|
||||
method: 'GET',
|
||||
params: { ...params },
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 此处后端没有提供注释 PUT /api/v1/user/${param0} */
|
||||
export async function modifyUser(
|
||||
params: {
|
||||
// path
|
||||
/** userId */
|
||||
userId?: string;
|
||||
},
|
||||
body?: API.UserInfoVO,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
const { userId: param0 } = params;
|
||||
return request<API.Result_UserInfo_>(`/api/v1/user/${param0}`, {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
params: { ...params },
|
||||
data: body,
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 此处后端没有提供注释 DELETE /api/v1/user/${param0} */
|
||||
export async function deleteUser(
|
||||
params: {
|
||||
// path
|
||||
/** userId */
|
||||
userId?: string;
|
||||
},
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
const { userId: param0 } = params;
|
||||
return request<API.Result_string_>(`/api/v1/user/${param0}`, {
|
||||
method: 'DELETE',
|
||||
params: { ...params },
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
/* eslint-disable */
|
||||
// 该文件由 OneAPI 自动生成,请勿手动修改!
|
||||
|
||||
import * as UserController from './UserController';
|
||||
export default {
|
||||
UserController,
|
||||
};
|
|
@ -1,68 +0,0 @@
|
|||
/* eslint-disable */
|
||||
// 该文件由 OneAPI 自动生成,请勿手动修改!
|
||||
|
||||
declare namespace API {
|
||||
interface PageInfo {
|
||||
/**
|
||||
1 */
|
||||
current?: number;
|
||||
pageSize?: number;
|
||||
total?: number;
|
||||
list?: Array<Record<string, any>>;
|
||||
}
|
||||
|
||||
interface PageInfo_UserInfo_ {
|
||||
/**
|
||||
1 */
|
||||
current?: number;
|
||||
pageSize?: number;
|
||||
total?: number;
|
||||
list?: Array<UserInfo>;
|
||||
}
|
||||
|
||||
interface Result {
|
||||
success?: boolean;
|
||||
errorMessage?: string;
|
||||
data?: Record<string, any>;
|
||||
}
|
||||
|
||||
interface Result_PageInfo_UserInfo__ {
|
||||
success?: boolean;
|
||||
errorMessage?: string;
|
||||
data?: PageInfo_UserInfo_;
|
||||
}
|
||||
|
||||
interface Result_UserInfo_ {
|
||||
success?: boolean;
|
||||
errorMessage?: string;
|
||||
data?: UserInfo;
|
||||
}
|
||||
|
||||
interface Result_string_ {
|
||||
success?: boolean;
|
||||
errorMessage?: string;
|
||||
data?: string;
|
||||
}
|
||||
|
||||
type UserGenderEnum = 'MALE' | 'FEMALE';
|
||||
|
||||
interface UserInfo {
|
||||
id?: string;
|
||||
name?: string;
|
||||
/** nick */
|
||||
nickName?: string;
|
||||
/** email */
|
||||
email?: string;
|
||||
gender?: UserGenderEnum;
|
||||
}
|
||||
|
||||
interface UserInfoVO {
|
||||
name?: string;
|
||||
/** nick */
|
||||
nickName?: string;
|
||||
/** email */
|
||||
email?: string;
|
||||
}
|
||||
|
||||
type definitions_0 = null;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
import zhCNConfig from "./locales/zh_CN";
|
||||
import enUSConfig from "./locales/en_US ";
|
||||
|
||||
export const getLocale = () => {
|
||||
const local = localStorage.getItem("language") || "中文";
|
||||
return local === "中文" ? zhCNConfig : enUSConfig;
|
||||
};
|
|
@ -1,4 +0,0 @@
|
|||
// 示例方法,没有实际意义
|
||||
export function trim(str: string) {
|
||||
return str.trim();
|
||||
}
|
|
@ -1,3 +1,36 @@
|
|||
{
|
||||
"extends": "./src/.umi/tsconfig.json"
|
||||
"compilerOptions": {
|
||||
"target": "esnext",
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"importHelpers": true,
|
||||
"jsx": "react-jsx",
|
||||
"esModuleInterop": true,
|
||||
"sourceMap": true,
|
||||
"baseUrl": "./",
|
||||
"strict": true,
|
||||
"paths": {
|
||||
"@/*": ["src/*"],
|
||||
"@@/*": ["src/.umi/*"]
|
||||
},
|
||||
"allowSyntheticDefaultImports": true
|
||||
},
|
||||
"include": [
|
||||
"mock/**/*",
|
||||
"src/**/*",
|
||||
"config/**/*",
|
||||
".umirc.ts",
|
||||
"typings.d.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"lib",
|
||||
"es",
|
||||
"dist",
|
||||
"typings",
|
||||
"**/__test__",
|
||||
"test",
|
||||
"docs",
|
||||
"tests"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1 +1,8 @@
|
|||
import '@umijs/max/typings';
|
||||
declare module '*.css';
|
||||
declare module '*.less';
|
||||
declare module '*.png';
|
||||
declare module '*.svg' {
|
||||
export function ReactComponent(props: React.SVGProps<SVGSVGElement>): React.ReactElement
|
||||
const url: string
|
||||
export default url
|
||||
}
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
Arguments:
|
||||
D:\toolInstall\node\node.exe C:\Users\Eileen\AppData\Roaming\npm\node_modules\yarn\bin\yarn.js
|
||||
|
||||
PATH:
|
||||
C:\Users\Eileen\AppData\Local\Temp\yarn--1730305872246-0.4444674796037764;C:\Users\Eileen\AppData\Local\Yarn\Data\global\node_modules\.bin;C:\Users\Eileen\AppData\Local\Yarn\Data\link\node_modules\.bin;C:\Users\Eileen\AppData\Local\Yarn\bin;D:\toolInstall\libexec\lib\node_modules\npm\bin\node-gyp-bin;D:\toolInstall\lib\node_modules\npm\bin\node-gyp-bin;D:\toolInstall\node\node_modules\npm\bin\node-gyp-bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;D:\toolInstall\Git\cmd;D:\toolInstall\微信web开发者工具\dll;D:\toolInstall\node\node_global\;D:\toolInstall\node\;C:\Users\Eileen\AppData\Local\Microsoft\WindowsApps;D:\toolInstall\Microsoft VS Code\bin;C:\Users\Eileen\AppData\Roaming\npm;D:\toolInstall\node\node_global\;D:\toolInstall\node\;
|
||||
|
||||
Yarn version:
|
||||
1.22.4
|
||||
|
||||
Node version:
|
||||
21.7.3
|
||||
|
||||
Platform:
|
||||
win32 x64
|
||||
|
||||
Trace:
|
||||
Error: EPERM: operation not permitted, open 'C:\Users\Eileen\AppData\Local\Yarn\Cache\v6\npm-regenerator-runtime-0.14.1-356ade10263f685dda125100cd862c1db895327f-integrity\node_modules\regenerator-runtime\.yarn-tarball.tgz'
|
||||
|
||||
npm manifest:
|
||||
{
|
||||
"private": true,
|
||||
"author": "刘晓茹 <1019216585@qq.com>",
|
||||
"scripts": {
|
||||
"dev": "max dev",
|
||||
"build": "max build",
|
||||
"format": "prettier --cache --write .",
|
||||
"prepare": "husky",
|
||||
"postinstall": "max setup",
|
||||
"setup": "max setup",
|
||||
"start": "npm run dev"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ant-design/icons": "^5.0.1",
|
||||
"@ant-design/pro-components": "^2.4.4",
|
||||
"@umijs/max": "^4.3.28",
|
||||
"antd": "^5.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^18.0.33",
|
||||
"@types/react-dom": "^18.0.11",
|
||||
"husky": "^9",
|
||||
"lint-staged": "^13.2.0",
|
||||
"prettier": "^2.8.7",
|
||||
"prettier-plugin-organize-imports": "^3.2.2",
|
||||
"prettier-plugin-packagejson": "^2.4.3",
|
||||
"typescript": "^5.0.3"
|
||||
}
|
||||
}
|
||||
|
||||
yarn manifest:
|
||||
No manifest
|
||||
|
||||
Lockfile:
|
||||
No lockfile
|