1:运营中心后台系统前端开发项目搭建;2:项目导航框架路由搭建
27 files added
1 files modified
| | |
| | | <!-- |
| | | * @Author: ldh |
| | | * @Date: 2022-02-14 11:39:13 |
| | | * @LastEditTime: 2022-02-14 11:39:14 |
| | | * @LastEditTime: 2022-02-14 17:03:02 |
| | | * @LastEditors: ldh |
| | | * @Description: |
| | | * @Description: 项目说明 |
| | | --> |
| | | # 多元化2.0项目说明 |
| | | |
| | | ## 文件说明 |
| | | |
| | | ``` |
| | | src |
| | | api - api代码文件 |
| | | assets - 公共资源文件(图片,字体等) |
| | | images - 图片资源文件 |
| | | components - 公共组件 |
| | | router - 路由文件 |
| | | styles - 公共css文件 |
| | | utils - js资源文件 |
| | | views - 页面 |
| | | ``` |
| | | |
| | | ## 目录文件说明 |
| | | |
| | | - huge_dyh2.0_operation - 多元化2.0运营中心项目 |
New file |
| | |
| | | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. |
| | | |
| | | # dependencies |
| | | /node_modules |
| | | /.pnp |
| | | .pnp.js |
| | | |
| | | # testing |
| | | /coverage |
| | | |
| | | # production |
| | | /build |
| | | |
| | | # misc |
| | | .DS_Store |
| | | .env.local |
| | | .env.development.local |
| | | .env.test.local |
| | | .env.production.local |
| | | |
| | | npm-debug.log* |
| | | yarn-debug.log* |
| | | yarn-error.log* |
New file |
| | |
| | | # Getting Started with Create React App |
| | | |
| | | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). |
| | | |
| | | ## Available Scripts |
| | | |
| | | In the project directory, you can run: |
| | | |
| | | ### `npm start` |
| | | |
| | | Runs the app in the development mode.\ |
| | | Open [http://localhost:3000](http://localhost:3000) to view it in your browser. |
| | | |
| | | The page will reload when you make changes.\ |
| | | You may also see any lint errors in the console. |
| | | |
| | | ### `npm test` |
| | | |
| | | Launches the test runner in the interactive watch mode.\ |
| | | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. |
| | | |
| | | ### `npm run build` |
| | | |
| | | Builds the app for production to the `build` folder.\ |
| | | It correctly bundles React in production mode and optimizes the build for the best performance. |
| | | |
| | | The build is minified and the filenames include the hashes.\ |
| | | Your app is ready to be deployed! |
| | | |
| | | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. |
| | | |
| | | ### `npm run eject` |
| | | |
| | | **Note: this is a one-way operation. Once you `eject`, you can't go back!** |
| | | |
| | | If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. |
| | | |
| | | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own. |
| | | |
| | | You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it. |
| | | |
| | | ## Learn More |
| | | |
| | | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). |
| | | |
| | | To learn React, check out the [React documentation](https://reactjs.org/). |
| | | |
| | | ### Code Splitting |
| | | |
| | | This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) |
| | | |
| | | ### Analyzing the Bundle Size |
| | | |
| | | This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) |
| | | |
| | | ### Making a Progressive Web App |
| | | |
| | | This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) |
| | | |
| | | ### Advanced Configuration |
| | | |
| | | This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) |
| | | |
| | | ### Deployment |
| | | |
| | | This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) |
| | | |
| | | ### `npm run build` fails to minify |
| | | |
| | | This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) |
New file |
| | |
| | | /* |
| | | * @Author: ldh |
| | | * @Date: 2022-02-14 14:20:11 |
| | | * @LastEditTime: 2022-02-14 14:20:12 |
| | | * @LastEditors: ldh |
| | | * @Description: antd配置 |
| | | */ |
| | | const CracoLessPlugin = require('craco-less'); |
| | | |
| | | module.exports = { |
| | | plugins: [ |
| | | { |
| | | plugin: CracoLessPlugin, |
| | | options: { |
| | | lessLoaderOptions: { |
| | | lessOptions: { |
| | | modifyVars: { '@primary-color': '#ee1d22' }, |
| | | javascriptEnabled: true, |
| | | }, |
| | | }, |
| | | }, |
| | | }, |
| | | ], |
| | | }; |
New file |
| | |
| | | { |
| | | "name": "huge_dyh2.0_operation", |
| | | "version": "0.1.0", |
| | | "private": true, |
| | | "dependencies": { |
| | | "@ant-design/icons": "^4.7.0", |
| | | "@craco/craco": "^6.4.3", |
| | | "@testing-library/jest-dom": "^5.16.2", |
| | | "@testing-library/react": "^12.1.2", |
| | | "@testing-library/user-event": "^13.5.0", |
| | | "@types/react-router-dom": "^5.3.3", |
| | | "antd": "^4.18.6", |
| | | "axios": "^0.26.0", |
| | | "craco-less": "^2.0.0", |
| | | "prop-types": "^15.8.1", |
| | | "react": "^17.0.2", |
| | | "react-dom": "^17.0.2", |
| | | "react-router-dom": "^6.2.1", |
| | | "react-scripts": "5.0.0", |
| | | "web-vitals": "^2.1.4" |
| | | }, |
| | | "scripts": { |
| | | "start": "craco start", |
| | | "build": "craco build", |
| | | "test": "craco test", |
| | | "eject": "react-scripts eject" |
| | | }, |
| | | "eslintConfig": { |
| | | "extends": [ |
| | | "react-app", |
| | | "react-app/jest" |
| | | ] |
| | | }, |
| | | "browserslist": { |
| | | "production": [ |
| | | ">0.2%", |
| | | "not dead", |
| | | "not op_mini all" |
| | | ], |
| | | "development": [ |
| | | "last 1 chrome version", |
| | | "last 1 firefox version", |
| | | "last 1 safari version" |
| | | ] |
| | | } |
| | | } |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html lang="en"> |
| | | <head> |
| | | <meta charset="utf-8" /> |
| | | <link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> |
| | | <meta name="viewport" content="width=device-width, initial-scale=1" /> |
| | | <meta name="theme-color" content="#000000" /> |
| | | <meta |
| | | name="description" |
| | | content="Web site created using create-react-app" |
| | | /> |
| | | <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> |
| | | <!-- |
| | | manifest.json provides metadata used when your web app is installed on a |
| | | user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/ |
| | | --> |
| | | <link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> |
| | | <!-- |
| | | Notice the use of %PUBLIC_URL% in the tags above. |
| | | It will be replaced with the URL of the `public` folder during the build. |
| | | Only files inside the `public` folder can be referenced from the HTML. |
| | | |
| | | Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will |
| | | work correctly both with client-side routing and a non-root public URL. |
| | | Learn how to configure a non-root public URL by running `npm run build`. |
| | | --> |
| | | <title>运营中心</title> |
| | | </head> |
| | | <body> |
| | | <noscript>You need to enable JavaScript to run this app.</noscript> |
| | | <div id="root"></div> |
| | | <!-- |
| | | This HTML file is a template. |
| | | If you open it directly in the browser, you will see an empty page. |
| | | |
| | | You can add webfonts, meta tags, or analytics to this file. |
| | | The build step will place the bundled scripts into the <body> tag. |
| | | |
| | | To begin the development, run `npm start` or `yarn start`. |
| | | To create a production bundle, use `npm run build` or `yarn build`. |
| | | --> |
| | | </body> |
| | | </html> |
New file |
| | |
| | | { |
| | | "short_name": "React App", |
| | | "name": "Create React App Sample", |
| | | "icons": [ |
| | | { |
| | | "src": "favicon.ico", |
| | | "sizes": "64x64 32x32 24x24 16x16", |
| | | "type": "image/x-icon" |
| | | }, |
| | | { |
| | | "src": "logo192.png", |
| | | "type": "image/png", |
| | | "sizes": "192x192" |
| | | }, |
| | | { |
| | | "src": "logo512.png", |
| | | "type": "image/png", |
| | | "sizes": "512x512" |
| | | } |
| | | ], |
| | | "start_url": ".", |
| | | "display": "standalone", |
| | | "theme_color": "#000000", |
| | | "background_color": "#ffffff" |
| | | } |
New file |
| | |
| | | # https://www.robotstxt.org/robotstxt.html |
| | | User-agent: * |
| | | Disallow: |
New file |
| | |
| | | /* |
| | | * @Company: hugeInfo |
| | | * @Author: ldh |
| | | * @Date: 2022-02-16 11:28:12 |
| | | * @LastEditTime: 2022-02-17 11:18:51 |
| | | * @LastEditors: ldh |
| | | * @Version: 1.0.0 |
| | | * @Description: axios处理方法 |
| | | */ |
| | | import axios from 'axios'; |
| | | import appUrl from './appUrl'; |
| | | |
| | | export const ax = axios; |
| | | |
| | | export function request(value = {}) { |
| | | let local = localStorage.getItem('operationToken'); |
| | | |
| | | let token = !local ? null : JSON.parse(local); |
| | | |
| | | // 无token时 |
| | | if (!token) { |
| | | return {}; |
| | | } |
| | | |
| | | axios.defaults.baseURL = appUrl.web; |
| | | |
| | | axios.defaults.headers.common['Authorization'] = token; |
| | | |
| | | if (value.type == 'get') { |
| | | return ax |
| | | .get(value.url, { params: value.data }) |
| | | .then((response) => { |
| | | return response; |
| | | }) |
| | | .catch(() => { |
| | | return {}; |
| | | }); |
| | | } else { |
| | | return ax |
| | | .post(value.url, value.data) |
| | | .then((response) => { |
| | | return response; |
| | | }) |
| | | .catch(() => { |
| | | return {}; |
| | | }); |
| | | } |
| | | } |
New file |
| | |
| | | /* |
| | | * @Company: hugeInfo |
| | | * @Author: ldh |
| | | * @Date: 2022-02-16 11:25:57 |
| | | * @LastEditTime: 2022-02-17 11:19:10 |
| | | * @LastEditors: ldh |
| | | * @Version: 1.0.0 |
| | | * @Description: api地址 |
| | | */ |
| | | const apiObj = { |
| | | // 项目api |
| | | debug: '', |
| | | web: '', // 正式版 |
| | | }; |
| | | |
| | | export default apiObj; |
New file |
| | |
| | | /* |
| | | * @Company: hugeInfo |
| | | * @Author: ldh |
| | | * @Date: 2022-02-14 14:22:07 |
| | | * @LastEditTime: 2022-02-17 15:12:00 |
| | | * @LastEditors: ldh |
| | | * @Version: 1.0.0 |
| | | * @Description: 导航菜单 |
| | | */ |
| | | import React from 'react'; |
| | | import { useLocation, Outlet, Link } from 'react-router-dom'; |
| | | import { Menu, Badge, Avatar, Dropdown } from 'antd'; |
| | | import { |
| | | TeamOutlined, |
| | | ShoppingCartOutlined, |
| | | SafetyCertificateOutlined, |
| | | DeploymentUnitOutlined, |
| | | QuestionCircleOutlined, |
| | | BellOutlined, |
| | | UserOutlined, |
| | | LogoutOutlined, |
| | | } from '@ant-design/icons'; |
| | | import './index.less'; |
| | | |
| | | // 头部导航菜单 |
| | | const headerMenu = [ |
| | | { |
| | | key: 'operation', |
| | | title: '运营中心', |
| | | }, |
| | | ]; |
| | | |
| | | const userMenu = ( |
| | | <Menu> |
| | | <Menu.Item key="loginOut"> |
| | | <Link to="/login"> |
| | | <LogoutOutlined style={{ marginRight: '8px' }} /> |
| | | 退出登录 |
| | | </Link> |
| | | </Menu.Item> |
| | | </Menu> |
| | | ); |
| | | |
| | | function urlString(str) { |
| | | let arr = str.split('/'); |
| | | return arr[arr.length - 1]; |
| | | } |
| | | |
| | | const Navigation = () => { |
| | | const location = useLocation() || {}; |
| | | |
| | | let menuKey = urlString(location.pathname); |
| | | |
| | | return ( |
| | | <div className="layout"> |
| | | <div className="layout-header"> |
| | | <div className="layout-header-logo">logo</div> |
| | | <div className="layout-header-menu"> |
| | | {headerMenu.map((x, t) => { |
| | | return ( |
| | | <div className={`layout-header-menu-item ${location.pathname?.indexOf(x.key) != -1 ? 'layout-header-menu-active' : ''}`} key={x.key}> |
| | | {x.title} |
| | | </div> |
| | | ); |
| | | })} |
| | | </div> |
| | | <div className="layout-header-user"> |
| | | <div className="layout-header-user-item"> |
| | | <QuestionCircleOutlined /> |
| | | </div> |
| | | <div className="layout-header-user-item"> |
| | | <Badge> |
| | | <BellOutlined /> |
| | | </Badge> |
| | | </div> |
| | | <Dropdown overlay={userMenu}> |
| | | <div className="layout-header-user-avatar"> |
| | | <Avatar style={{ backgroundColor: '#1089ff' }} icon={<UserOutlined />} /> |
| | | <div> |
| | | <div className="layout-header-user-name">xxxx</div> |
| | | <div className="layout-header-user-unit">某某某单位</div> |
| | | </div> |
| | | </div> |
| | | </Dropdown> |
| | | </div> |
| | | </div> |
| | | <div className="layout-main"> |
| | | <nav className="layout-nva"> |
| | | <Menu style={{ width: '200px' }} mode="inline" selectedKeys={[menuKey]}> |
| | | <Menu.Item key="customer" icon={<TeamOutlined />}> |
| | | 客户管理 |
| | | </Menu.Item> |
| | | <Menu.Item key="edition" icon={<ShoppingCartOutlined />}> |
| | | 版本管理 |
| | | </Menu.Item> |
| | | <Menu.Item key="power" icon={<SafetyCertificateOutlined />}> |
| | | 功能管理 |
| | | </Menu.Item> |
| | | <Menu.Item key="equipment" icon={<DeploymentUnitOutlined />}> |
| | | 设备管理 |
| | | </Menu.Item> |
| | | </Menu> |
| | | </nav> |
| | | <main className="layout-child"> |
| | | <Outlet /> |
| | | </main> |
| | | </div> |
| | | </div> |
| | | ); |
| | | }; |
| | | |
| | | export default Navigation; |
New file |
| | |
| | | @import '../../styles/public.less'; |
| | | |
| | | .layout { |
| | | position: relative; |
| | | width: 100%; |
| | | height: 100%; |
| | | |
| | | &-header { |
| | | height: 48px; |
| | | min-height: 48px; |
| | | background-color: #ffffff; |
| | | display: flex; |
| | | |
| | | &-logo { |
| | | padding: 0 24px; |
| | | min-width: 200px; |
| | | text-align: center; |
| | | line-height: 48px; |
| | | } |
| | | |
| | | &-menu { |
| | | flex: 1; |
| | | display: flex; |
| | | |
| | | &-item { |
| | | padding: 0 24px; |
| | | height: 48px; |
| | | line-height: 48px; |
| | | } |
| | | |
| | | &-active { |
| | | background-color: @red-1; |
| | | color: @main-color; |
| | | } |
| | | } |
| | | |
| | | &-user { |
| | | display: flex; |
| | | padding-right: 24px; |
| | | |
| | | &-item { |
| | | padding: 0 16px; |
| | | height: 48px; |
| | | line-height: 48px; |
| | | |
| | | svg { |
| | | font-size: 16px; |
| | | } |
| | | |
| | | &:hover { |
| | | background-color: @red-1; |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | |
| | | &-avatar { |
| | | display: flex; |
| | | align-items: center; |
| | | padding: 0 16px; |
| | | height: 48px; |
| | | |
| | | &:hover { |
| | | background-color: @red-1; |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | |
| | | &-name, |
| | | &-unit { |
| | | margin-left: 8px; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | white-space: nowrap; |
| | | } |
| | | |
| | | &-name { |
| | | width: 80px; |
| | | } |
| | | |
| | | &-unit { |
| | | width: 100px; |
| | | font-size: 12px; |
| | | line-height: 20px; |
| | | color: @second-text-color; |
| | | } |
| | | } |
| | | } |
| | | |
| | | &-main { |
| | | display: flex; |
| | | position: absolute; |
| | | top: 49px; |
| | | bottom: 0; |
| | | left: 0; |
| | | right: 0; |
| | | } |
| | | |
| | | &-nva { |
| | | height: 100%; |
| | | background-color: #ffffff; |
| | | } |
| | | |
| | | &-child { |
| | | flex: 1; |
| | | position: relative; |
| | | } |
| | | } |
New file |
| | |
| | | /* |
| | | * @Company: hugeInfo |
| | | * @Author: ldh |
| | | * @Date: 2022-02-16 15:23:40 |
| | | * @LastEditTime: 2022-02-17 14:27:11 |
| | | * @LastEditors: ldh |
| | | * @Version: 1.0.0 |
| | | * @Description: 面包屑 |
| | | */ |
| | | import React from 'react'; |
| | | import PropTypes from 'prop-types'; |
| | | import { Link } from 'react-router-dom'; |
| | | import './index.less'; |
| | | import { Breadcrumb } from 'antd'; |
| | | |
| | | const PageHead = ({ breadcrumbData = [], title, titleButton = [], otherLayout }) => { |
| | | return ( |
| | | <div className="pageHead"> |
| | | {breadcrumbData.length != 0 && ( |
| | | <div className="pageHead-breadcrumb"> |
| | | <Breadcrumb> |
| | | {breadcrumbData.map((x, t) => { |
| | | return <Breadcrumb.Item key={t}>{x.url ? <Link to={x.url}>{x.title}</Link> : <span>{x.title}</span>}</Breadcrumb.Item>; |
| | | })} |
| | | </Breadcrumb> |
| | | </div> |
| | | )} |
| | | <div className="pageHead-title"> |
| | | <div className="pageHead-title-h">{title}</div> |
| | | <div className="pageHead-title-button"> |
| | | {titleButton.map((x, t) => { |
| | | return ( |
| | | <div className="pageHead-title-button-item" key={t}> |
| | | {x} |
| | | </div> |
| | | ); |
| | | })} |
| | | </div> |
| | | </div> |
| | | {otherLayout ? otherLayout : null} |
| | | </div> |
| | | ); |
| | | }; |
| | | |
| | | PageHead.propTypes = { |
| | | breadcrumbData: PropTypes.array, |
| | | title: PropTypes.string, |
| | | titleButton: PropTypes.any, |
| | | otherLayout: PropTypes.any, |
| | | }; |
| | | |
| | | export default PageHead; |
New file |
| | |
| | | .pageHead { |
| | | width: 100%; |
| | | background-color: #ffffff; |
| | | padding: 0 24px; |
| | | |
| | | &-breadcrumb { |
| | | padding: 16px 0 0 0; |
| | | } |
| | | |
| | | &-title { |
| | | padding: 16px 0; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | |
| | | &-h { |
| | | font-size: 20px; |
| | | line-height: 32px; |
| | | font-weight: 500; |
| | | } |
| | | |
| | | &-button { |
| | | display: flex; |
| | | |
| | | &-item { |
| | | margin-right: 16px; |
| | | |
| | | &:last-child { |
| | | margin-right: 0; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | /* |
| | | * @Company: hugeInfo |
| | | * @Author: ldh |
| | | * @Date: 2022-02-14 11:54:07 |
| | | * @LastEditTime: 2022-02-17 11:20:21 |
| | | * @LastEditors: ldh |
| | | * @Version: 1.0.0 |
| | | * @Description: 入口文件 |
| | | */ |
| | | import React from 'react'; |
| | | import ReactDOM from 'react-dom'; |
| | | import reportWebVitals from './reportWebVitals'; |
| | | import Routers from './router/router'; |
| | | |
| | | ReactDOM.render( |
| | | <React.StrictMode> |
| | | <Routers /> |
| | | </React.StrictMode>, |
| | | document.getElementById('root') |
| | | ); |
| | | |
| | | // If you want to start measuring performance in your app, pass a function |
| | | // to log results (for example: reportWebVitals(console.log)) |
| | | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals |
| | | reportWebVitals(); |
New file |
| | |
| | | const reportWebVitals = onPerfEntry => { |
| | | if (onPerfEntry && onPerfEntry instanceof Function) { |
| | | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { |
| | | getCLS(onPerfEntry); |
| | | getFID(onPerfEntry); |
| | | getFCP(onPerfEntry); |
| | | getLCP(onPerfEntry); |
| | | getTTFB(onPerfEntry); |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | export default reportWebVitals; |
New file |
| | |
| | | /* |
| | | * @Company: hugeInfo |
| | | * @Author: ldh |
| | | * @Date: 2022-02-14 15:48:51 |
| | | * @LastEditTime: 2022-02-17 15:17:04 |
| | | * @LastEditors: ldh |
| | | * @Version: 1.0.0 |
| | | * @Description: 路由 |
| | | */ |
| | | import React from 'react'; |
| | | import { HashRouter as Router, Route, Routes, Navigate } from 'react-router-dom'; |
| | | import Navigation from '../components/Navigation'; |
| | | |
| | | import Login from '../views/login'; |
| | | import Customer from '../views/customer'; |
| | | |
| | | const Routers = () => { |
| | | return ( |
| | | <Router> |
| | | <Routes> |
| | | <Route path="/login" exact element={<Login />} /> |
| | | <Route path="/operation" element={<Navigation />}> |
| | | <Route path="customer" element={<Customer />} /> |
| | | </Route> |
| | | <Route path="*" element={<Navigate to="/operation/customer" />} /> |
| | | </Routes> |
| | | </Router> |
| | | ); |
| | | }; |
| | | |
| | | export default Routers; |
New file |
| | |
| | | // jest-dom adds custom jest matchers for asserting on DOM nodes. |
| | | // allows you to do things like: |
| | | // expect(element).toHaveTextContent(/react/i) |
| | | // learn more: https://github.com/testing-library/jest-dom |
| | | import '@testing-library/jest-dom'; |
New file |
| | |
| | | @import '~antd/dist/antd.less'; |
| | | |
| | | @main-color: #ee1d22; // 主色 |
| | | @adorn-color1: #f07b1d; // 点缀色 |
| | | @adorn-color2: #bf1779; // 点缀色 |
| | | @complementary-color: #20c318; // 互补色 |
| | | |
| | | @text-color: rgba(0, 0, 0, 0.85); // 正文颜色,一级字体颜色 |
| | | @one-text-color: rgba(0, 0, 0, 0.85); // 一级字体颜色 |
| | | @second-text-color: rgba(0, 0, 0, 0.65); // 二级字体颜色 |
| | | @three-text-color: rgba(0, 0, 0, 0.45); // 三级字体颜色 |
| | | |
| | | @border-color: #e6e6e6; // 分割线 |
| | | |
| | | // 间距 |
| | | @padding-small: 8px; |
| | | @padding-middle: 16px; |
| | | @padding-big: 24px; |
| | | |
| | | @borderRadius: 2px; // 圆角 |
| | | |
| | | // 提示性颜色 |
| | | @loading-color: #1089ff; // 进行中 |
| | | @success-color: #52c41a; // 成功,完成 |
| | | @danger-color: #f5222d; // 失败,危险 |
| | | @warn-color: #faad14; // 警告 |
| | | |
| | | @bg-color: #f0f2f5; // 背景色 |
| | | |
| | | @red-1: #fff1f0; |
| | | |
| | | html, |
| | | body { |
| | | margin: 0; |
| | | padding: 0; |
| | | height: 100%; |
| | | width: 100%; |
| | | overflow: hidden; |
| | | } |
| | | |
| | | #root { |
| | | font-family: Avenir, Helvetica, Arial, sans-serif; |
| | | -webkit-font-smoothing: antialiased; |
| | | -moz-osx-font-smoothing: grayscale; |
| | | font-size: 14px; |
| | | line-height: 22px; |
| | | color: @text-color; |
| | | height: 100%; |
| | | width: 100%; |
| | | background-color: @bg-color; |
| | | } |
| | | |
| | | h1, |
| | | h2, |
| | | h3, |
| | | h4 { |
| | | font-weight: 500; |
| | | color: @one-text-color; |
| | | } |
| | | |
| | | h1 { |
| | | font-size: 30px; |
| | | line-height: 38px; |
| | | } |
| | | |
| | | h2 { |
| | | font-size: 24px; |
| | | line-height: 32px; |
| | | } |
| | | |
| | | h3 { |
| | | font-size: 18px; |
| | | line-height: 26px; |
| | | } |
| | | |
| | | h4 { |
| | | font-size: 16px; |
| | | line-height: 24px; |
| | | } |
New file |
| | |
| | | /* |
| | | * @Company: hugeInfo |
| | | * @Author: ldh |
| | | * @Date: 2022-02-16 11:57:54 |
| | | * @LastEditTime: 2022-02-17 11:19:54 |
| | | * @LastEditors: ldh |
| | | * @Version: 1.0.0 |
| | | * @Description: 公共模块方法 |
| | | */ |
| | | import { Modal, message } from 'antd'; |
| | | |
| | | export const edition = '1.0.0'; // 版本号 |
| | | |
| | | // 缓存 |
| | | export function setLocalStorage(value) { |
| | | localStorage.setItem('operationData', JSON.stringify(value)); |
| | | } |
| | | |
| | | export function getLocalStorage() { |
| | | let useData = localStorage.getItem('operationData'); |
| | | return !useData ? {} : JSON.parse(useData); |
| | | } |
| | | |
| | | export function setLocal(name, value) { |
| | | localStorage.setItem(name, JSON.stringify(value)); |
| | | } |
| | | |
| | | export function getLocal(name) { |
| | | let data = localStorage.getItem(name); |
| | | return !data ? null : JSON.parse(data); |
| | | } |
| | | |
| | | export function clearLocal(name) { |
| | | return name ? localStorage.removeItem(name) : localStorage.clear(); |
| | | } |
| | | |
| | | // 地址栏截取 |
| | | export function getQueryString(name) { |
| | | let result = window.location.href.match(new RegExp('[?&]' + name + '=([^&]+)', 'i')); |
| | | if (!result || result.length < 1) { |
| | | return null; |
| | | } |
| | | return decodeURI(result[1]); |
| | | } |
| | | |
| | | // api错误提示 |
| | | let errorNum = false; // 控制错误信息不重复弹出 |
| | | export function catchApiError({ content }) { |
| | | if (errorNum) { |
| | | return false; |
| | | } |
| | | errorNum = true; |
| | | const handleOkFunc = () => (errorNum = false); |
| | | return Modal.error({ title: '错误提示', okText: '知道了', cancelText: null, onOk: handleOkFunc, content }); |
| | | } |
| | | |
| | | // 全局提示 |
| | | export function info(value) { |
| | | return message[value.type](value.content, value.duration || 3, value.onClose); |
| | | } |
| | | |
| | | export function infoSuccess({ content }) { |
| | | return info({ type: 'success', content }); |
| | | } |
New file |
| | |
| | | /* |
| | | * @Company: hugeInfo |
| | | * @Author: ldh |
| | | * @Date: 2022-02-16 14:54:34 |
| | | * @LastEditTime: 2022-02-17 14:32:40 |
| | | * @LastEditors: ldh |
| | | * @Version: 1.0.0 |
| | | * @Description: 客户管理 |
| | | */ |
| | | import React, { Component } from 'react'; |
| | | import './index.less'; |
| | | import PageHead from '../../components/PageHead'; |
| | | import { Button } from 'antd'; |
| | | |
| | | class Customer extends Component { |
| | | render() { |
| | | return ( |
| | | <> |
| | | <PageHead |
| | | // breadcrumbData={[ |
| | | // { url: '/operation/customer', title: '客户管理' }, |
| | | // { url: '', title: '新增客户' }, |
| | | // ]} |
| | | title="客户管理" |
| | | /> |
| | | </> |
| | | ); |
| | | } |
| | | } |
| | | |
| | | export default Customer; |
New file |
| | |
| | | /* |
| | | * @Company: hugeInfo |
| | | * @Author: ldh |
| | | * @Date: 2022-02-14 15:51:55 |
| | | * @LastEditTime: 2022-02-17 11:20:06 |
| | | * @LastEditors: ldh |
| | | * @Version: 1.0.0 |
| | | * @Description: 登录页面 |
| | | */ |
| | | import React from 'react'; |
| | | // import './index.less'; |
| | | |
| | | const Login = () => { |
| | | return <div>login</div>; |
| | | }; |
| | | |
| | | export default Login; |