From 6f37a959532194ee71c1c9658a9741d9f6699a5b Mon Sep 17 00:00:00 2001 From: wang_yp <357754663@qq.com> Date: Sun, 16 Mar 2025 00:02:24 +0800 Subject: [PATCH] add animation --- config/webpack.config.js | 284 +++++++++--------- package-lock.json | 16 +- package.json | 1 + src/components/dilog/dilog.less | 59 ---- src/components/dilog/index.tsx | 64 ---- src/components/layout/layout.tsx | 5 +- src/components/layout/layout_config.ts | 43 ++- src/pages/dashbord/index.tsx | 12 +- src/pages/login/login.less | 139 ++++----- src/pages/login/login.tsx | 4 +- src/pages/rbac/index.tsx | 11 + .../{menu/menu.tsx => rbac/menu/index.tsx} | 0 src/pages/{ => rbac}/menu/menu.less | 0 src/pages/{ => rbac}/menu/menu_config.tsx | 0 .../{role/role.tsx => rbac/role/index.tsx} | 0 src/pages/{ => rbac}/role/role.less | 0 src/pages/{ => rbac}/role/role_config.tsx | 0 src/pages/sku/brand/index.tsx | 9 + src/pages/sku/cat/index.tsx | 9 + src/pages/sku/index.tsx | 11 + src/pages/sku/spec/index.tsx | 9 + src/pages/source/source.less | 8 - src/pages/source/source.tsx | 50 --- src/pages/source/source_config.tsx | 22 -- src/router/index.tsx | 22 +- src/router/routers/rbac_router.tsx | 21 ++ src/router/routers/sku_router.tsx | 33 ++ src/service/base.ts | 13 +- src/service/source_config.ts | 10 - src/service/user_config.ts | 2 +- src/store/index.ts | 2 - src/store/source.ts | 41 --- src/util/config.ts | 3 +- 33 files changed, 387 insertions(+), 516 deletions(-) delete mode 100644 src/components/dilog/dilog.less delete mode 100644 src/components/dilog/index.tsx create mode 100644 src/pages/rbac/index.tsx rename src/pages/{menu/menu.tsx => rbac/menu/index.tsx} (100%) rename src/pages/{ => rbac}/menu/menu.less (100%) rename src/pages/{ => rbac}/menu/menu_config.tsx (100%) rename src/pages/{role/role.tsx => rbac/role/index.tsx} (100%) rename src/pages/{ => rbac}/role/role.less (100%) rename src/pages/{ => rbac}/role/role_config.tsx (100%) create mode 100644 src/pages/sku/brand/index.tsx create mode 100644 src/pages/sku/cat/index.tsx create mode 100644 src/pages/sku/index.tsx create mode 100644 src/pages/sku/spec/index.tsx delete mode 100644 src/pages/source/source.less delete mode 100644 src/pages/source/source.tsx delete mode 100644 src/pages/source/source_config.tsx create mode 100644 src/router/routers/rbac_router.tsx create mode 100644 src/router/routers/sku_router.tsx delete mode 100644 src/service/source_config.ts delete mode 100644 src/store/source.ts diff --git a/config/webpack.config.js b/config/webpack.config.js index 2d168b9..d223956 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -122,11 +122,11 @@ module.exports = function (webpackEnv) { options: cssOptions, }, { - loader:'less-loader', + loader: 'less-loader', // loader: require.resolve('less-loader') options: { lessOptions: { - javascriptEnabled: true, + javascriptEnabled: true, } } }, @@ -143,34 +143,34 @@ module.exports = function (webpackEnv) { config: false, plugins: !useTailwind ? [ - 'postcss-flexbugs-fixes', - [ - 'postcss-preset-env', - { - autoprefixer: { - flexbox: 'no-2009', - }, - stage: 3, + 'postcss-flexbugs-fixes', + [ + 'postcss-preset-env', + { + autoprefixer: { + flexbox: 'no-2009', }, - ], - // Adds PostCSS Normalize as the reset css with default options, - // so that it honors browserslist config in package.json - // which in turn let's users customize the target behavior as per their needs. - 'postcss-normalize', - ] - : [ - 'tailwindcss', - 'postcss-flexbugs-fixes', - [ - 'postcss-preset-env', - { - autoprefixer: { - flexbox: 'no-2009', - }, - stage: 3, - }, - ], + stage: 3, + }, ], + // Adds PostCSS Normalize as the reset css with default options, + // so that it honors browserslist config in package.json + // which in turn let's users customize the target behavior as per their needs. + 'postcss-normalize', + ] + : [ + 'tailwindcss', + 'postcss-flexbugs-fixes', + [ + 'postcss-preset-env', + { + autoprefixer: { + flexbox: 'no-2009', + }, + stage: 3, + }, + ], + ], }, sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment, }, @@ -233,11 +233,11 @@ module.exports = function (webpackEnv) { // Point sourcemap entries to original disk location (format as URL on Windows) devtoolModuleFilenameTemplate: isEnvProduction ? info => - path - .relative(paths.appSrc, info.absoluteResourcePath) - .replace(/\\/g, '/') + path + .relative(paths.appSrc, info.absoluteResourcePath) + .replace(/\\/g, '/') : isEnvDevelopment && - (info => path.resolve(info.absoluteResourcePath).replace(/\\/g, '/')), + (info => path.resolve(info.absoluteResourcePath).replace(/\\/g, '/')), }, cache: { type: 'filesystem', @@ -320,7 +320,7 @@ module.exports = function (webpackEnv) { .map(ext => `.${ext}`) .filter(ext => useTypeScript || !ext.includes('ts')), alias: { - '@':path.join(__dirname,'../src/'), + '@': path.join(__dirname, '../src/'), // Support React Native Web // https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/ 'react-native': 'react-native-web', @@ -430,11 +430,11 @@ module.exports = function (webpackEnv) { }, ], ], - + plugins: [ isEnvDevelopment && - shouldUseReactRefresh && - require.resolve('react-refresh/babel'), + shouldUseReactRefresh && + require.resolve('react-refresh/babel'), ].filter(Boolean), // This is a feature of `babel-loader` for webpack (not Babel itself). // It enables caching results in ./node_modules/.cache/babel-loader/ @@ -464,7 +464,7 @@ module.exports = function (webpackEnv) { cacheDirectory: true, // See #6846 for context on why cacheCompression is disabled cacheCompression: false, - + // Babel sourcemaps are needed for debugging into node_modules // code. Without the options below, debuggers like VSCode // show incorrect code and set breakpoints on the wrong lines. @@ -605,19 +605,19 @@ module.exports = function (webpackEnv) { }, isEnvProduction ? { - minify: { - removeComments: true, - collapseWhitespace: true, - removeRedundantAttributes: true, - useShortDoctype: true, - removeEmptyAttributes: true, - removeStyleLinkTypeAttributes: true, - keepClosingSlash: true, - minifyJS: true, - minifyCSS: true, - minifyURLs: true, - }, - } + minify: { + removeComments: true, + collapseWhitespace: true, + removeRedundantAttributes: true, + useShortDoctype: true, + removeEmptyAttributes: true, + removeStyleLinkTypeAttributes: true, + keepClosingSlash: true, + minifyJS: true, + minifyCSS: true, + minifyURLs: true, + }, + } : undefined ) ), @@ -625,8 +625,8 @@ module.exports = function (webpackEnv) { // a network request. // https://github.com/facebook/create-react-app/issues/5358 isEnvProduction && - shouldInlineRuntimeChunk && - new InlineChunkHtmlPlugin(HtmlWebpackPlugin, [/runtime-.+[.]js/]), + shouldInlineRuntimeChunk && + new InlineChunkHtmlPlugin(HtmlWebpackPlugin, [/runtime-.+[.]js/]), // Makes some environment variables available in index.html. // The public URL is available as %PUBLIC_URL% in index.html, e.g.: // @@ -645,21 +645,21 @@ module.exports = function (webpackEnv) { // Experimental hot reloading for React . // https://github.com/facebook/react/tree/main/packages/react-refresh isEnvDevelopment && - shouldUseReactRefresh && - new ReactRefreshWebpackPlugin({ - overlay: false, - }), + shouldUseReactRefresh && + new ReactRefreshWebpackPlugin({ + overlay: false, + }), // Watcher doesn't work well if you mistype casing in a path so we use // a plugin that prints an error when you attempt to do this. // See https://github.com/facebook/create-react-app/issues/240 isEnvDevelopment && new CaseSensitivePathsPlugin(), isEnvProduction && - new MiniCssExtractPlugin({ - // Options similar to the same options in webpackOptions.output - // both options are optional - filename: 'static/css/[name].[contenthash:8].css', - chunkFilename: 'static/css/[name].[contenthash:8].chunk.css', - }), + new MiniCssExtractPlugin({ + // Options similar to the same options in webpackOptions.output + // both options are optional + filename: 'static/css/[name].[contenthash:8].css', + chunkFilename: 'static/css/[name].[contenthash:8].chunk.css', + }), // Generate an asset manifest file with the following content: // - "files" key: Mapping of all asset filenames to their corresponding // output file so that tools can pick it up without having to parse @@ -696,92 +696,100 @@ module.exports = function (webpackEnv) { // Generate a service worker script that will precache, and keep up to date, // the HTML & assets that are part of the webpack build. isEnvProduction && - fs.existsSync(swSrc) && - new WorkboxWebpackPlugin.InjectManifest({ - swSrc, - dontCacheBustURLsMatching: /\.[0-9a-f]{8}\./, - exclude: [/\.map$/, /asset-manifest\.json$/, /LICENSE/], - // Bump up the default maximum size (2mb) that's precached, - // to make lazy-loading failure scenarios less likely. - // See https://github.com/cra-template/pwa/issues/13#issuecomment-722667270 - maximumFileSizeToCacheInBytes: 5 * 1024 * 1024, - }), + fs.existsSync(swSrc) && + new WorkboxWebpackPlugin.InjectManifest({ + swSrc, + dontCacheBustURLsMatching: /\.[0-9a-f]{8}\./, + exclude: [/\.map$/, /asset-manifest\.json$/, /LICENSE/], + // Bump up the default maximum size (2mb) that's precached, + // to make lazy-loading failure scenarios less likely. + // See https://github.com/cra-template/pwa/issues/13#issuecomment-722667270 + maximumFileSizeToCacheInBytes: 5 * 1024 * 1024, + }), // TypeScript type checking useTypeScript && - new ForkTsCheckerWebpackPlugin({ - async: isEnvDevelopment, - typescript: { - typescriptPath: resolve.sync('typescript', { - basedir: paths.appNodeModules, - }), - configOverwrite: { - compilerOptions: { - sourceMap: isEnvProduction - ? shouldUseSourceMap - : isEnvDevelopment, - skipLibCheck: true, - inlineSourceMap: false, - declarationMap: false, - noEmit: true, - incremental: true, - tsBuildInfoFile: paths.appTsBuildInfoFile, - }, + new ForkTsCheckerWebpackPlugin({ + async: isEnvDevelopment, + typescript: { + typescriptPath: resolve.sync('typescript', { + basedir: paths.appNodeModules, + }), + configOverwrite: { + compilerOptions: { + sourceMap: isEnvProduction + ? shouldUseSourceMap + : isEnvDevelopment, + skipLibCheck: true, + inlineSourceMap: false, + declarationMap: false, + noEmit: true, + incremental: true, + tsBuildInfoFile: paths.appTsBuildInfoFile, }, - context: paths.appPath, - diagnosticOptions: { - syntactic: true, - }, - mode: 'write-references', - // profile: true, }, - issue: { - // This one is specifically to match during CI tests, - // as micromatch doesn't match - // '../cra-template-typescript/template/src/App.tsx' - // otherwise. - include: [ - { file: '../**/src/**/*.{ts,tsx}' }, - { file: '**/src/**/*.{ts,tsx}' }, - ], - exclude: [ - { file: '**/src/**/__tests__/**' }, - { file: '**/src/**/?(*.){spec|test}.*' }, - { file: '**/src/setupProxy.*' }, - { file: '**/src/setupTests.*' }, - ], + context: paths.appPath, + diagnosticOptions: { + syntactic: true, }, - logger: { - infrastructure: 'silent', - }, - }), + mode: 'write-references', + // profile: true, + }, + issue: { + // This one is specifically to match during CI tests, + // as micromatch doesn't match + // '../cra-template-typescript/template/src/App.tsx' + // otherwise. + include: [ + { file: '../**/src/**/*.{ts,tsx}' }, + { file: '**/src/**/*.{ts,tsx}' }, + ], + exclude: [ + { file: '**/src/**/__tests__/**' }, + { file: '**/src/**/?(*.){spec|test}.*' }, + { file: '**/src/setupProxy.*' }, + { file: '**/src/setupTests.*' }, + ], + }, + logger: { + infrastructure: 'silent', + }, + }), !disableESLintPlugin && - new ESLintPlugin({ - // Plugin options - extensions: ['js', 'mjs', 'jsx', 'ts', 'tsx'], - formatter: require.resolve('react-dev-utils/eslintFormatter'), - eslintPath: require.resolve('eslint'), - failOnError: !(isEnvDevelopment && emitErrorsAsWarnings), - context: paths.appSrc, - cache: true, - cacheLocation: path.resolve( - paths.appNodeModules, - '.cache/.eslintcache' - ), - // ESLint class options - cwd: paths.appPath, - resolvePluginsRelativeTo: __dirname, - baseConfig: { - extends: [require.resolve('eslint-config-react-app/base')], - rules: { - ...(!hasJsxRuntime && { - 'react/react-in-jsx-scope': 'error', - }), - }, + new ESLintPlugin({ + // Plugin options + extensions: ['js', 'mjs', 'jsx', 'ts', 'tsx'], + formatter: require.resolve('react-dev-utils/eslintFormatter'), + eslintPath: require.resolve('eslint'), + failOnError: !(isEnvDevelopment && emitErrorsAsWarnings), + context: paths.appSrc, + cache: true, + cacheLocation: path.resolve( + paths.appNodeModules, + '.cache/.eslintcache' + ), + // ESLint class options + cwd: paths.appPath, + resolvePluginsRelativeTo: __dirname, + baseConfig: { + extends: [require.resolve('eslint-config-react-app/base')], + rules: { + ...(!hasJsxRuntime && { + 'react/react-in-jsx-scope': 'error', + }), }, - }), + }, + }), ].filter(Boolean), // Turn off performance processing because we utilize // our own hints via the FileSizeReporter performance: false, + devServer: { + proxy: [ + { + context: ['/api'], + target: 'http://127.0.0.1:12215', + }, + ], + } }; }; diff --git a/package-lock.json b/package-lock.json index 92f0221..c15cc8f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "ball_admin", + "name": "store", "version": "0.1.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "ball_admin", + "name": "store", "version": "0.1.0", "dependencies": { "@amap/amap-jsapi-loader": "^1.0.1", @@ -7637,9 +7637,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001660", - "resolved": "https://registry.npmmirror.com/caniuse-lite/-/caniuse-lite-1.0.30001660.tgz", - "integrity": "sha512-GacvNTTuATm26qC74pt+ad1fW15mlQ/zuTzzY1ZoIzECTP8HURDfF43kNxPgf7H1jmelCBQTTbBNxdSXOA7Bqg==", + "version": "1.0.30001704", + "resolved": "https://registry.npmmirror.com/caniuse-lite/-/caniuse-lite-1.0.30001704.tgz", + "integrity": "sha512-+L2IgBbV6gXB4ETf0keSvLr7JUrRVbIaB/lrQ1+z8mRcQiisG5k+lG6O4n6Y5q6f5EuNfaYXKgymucphlEXQew==", "funding": [ { "type": "opencollective", @@ -39394,9 +39394,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001660", - "resolved": "https://registry.npmmirror.com/caniuse-lite/-/caniuse-lite-1.0.30001660.tgz", - "integrity": "sha512-GacvNTTuATm26qC74pt+ad1fW15mlQ/zuTzzY1ZoIzECTP8HURDfF43kNxPgf7H1jmelCBQTTbBNxdSXOA7Bqg==" + "version": "1.0.30001704", + "resolved": "https://registry.npmmirror.com/caniuse-lite/-/caniuse-lite-1.0.30001704.tgz", + "integrity": "sha512-+L2IgBbV6gXB4ETf0keSvLr7JUrRVbIaB/lrQ1+z8mRcQiisG5k+lG6O4n6Y5q6f5EuNfaYXKgymucphlEXQew==" }, "canvg": { "version": "3.0.10", diff --git a/package.json b/package.json index 41f7fbd..8f6bfb6 100644 --- a/package.json +++ b/package.json @@ -94,6 +94,7 @@ "build": "node scripts/build.js", "test": "node scripts/test.js" }, + "proxy": "http://127.0.0.1:12215/", "eslintConfig": { "extends": [ "react-app", diff --git a/src/components/dilog/dilog.less b/src/components/dilog/dilog.less deleted file mode 100644 index 3b99d0a..0000000 --- a/src/components/dilog/dilog.less +++ /dev/null @@ -1,59 +0,0 @@ -.modal { - width: 100%; - height: 100%; - position: fixed; - left: 0; - top: 0; - text-align: center; - z-index: 9999; - background: rgba(0, 0, 0, .45); - display: flex; - align-items: center; - justify-content: center; - animation-name: mode_animation; - animation-duration: .2s; - .modal-content { - min-width: 600px; - min-height: 300px; - background-color: white; - border-radius: 10px; - padding: 10px; - display: flex; - flex-direction: column; - .modal-header { - display: flex; - align-items: flex-end; - justify-content: flex-end; - .close-btn{ - font-size: 20px; - font-weight: 800; - } - } - .model-cont{ - flex-grow: 1; - } - .modal-footer{ - display: flex; - border-top: 1px solid #ccc; - justify-content: space-around; - } - } -} - -@keyframes mode_animation { - 0% { - background: rgba(0, 0, 0, 0); - } - 25% { - background: rgba(0, 0, 0, 0.1); - } - 50% { - background: rgba(0, 0, 0, 0.25); - } - 75% { - background: rgba(0, 0, 0, 0.35); - } - 100% { - background: rgba(0, 0, 0, 0.45); - } -} \ No newline at end of file diff --git a/src/components/dilog/index.tsx b/src/components/dilog/index.tsx deleted file mode 100644 index 5e734a1..0000000 --- a/src/components/dilog/index.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import React, { ReactNode, useEffect, useState } from "react"; -// 使用ReactDOM.createPortal 动态创建弹窗 -// 可以插入到dom任意节点,不限于父节点 -import { CloseOutlined } from "@ant-design/icons"; -import ReactDOM from "react-dom"; -import "./dilog.less"; -interface DilogModel { - show: boolean; - close: Function; - children: ReactNode; - maskClosable: boolean; - title?: string; - okText?: string; -} -const Dilog = (props: DilogModel) => { - const [isShow, showState] = useState(false); - useEffect(() => { - showState(props.show); - const onClick = (ev:MouseEvent) => { - if (ev.target === document.getElementsByClassName("modal")[0]) { - showState(false); - props.close(); - } - }; - const handleKeyword = (e:KeyboardEvent) => { - if (e.eventPhase === 27) { - showState(false); - props.close(); - } - }; - document.documentElement.addEventListener("click", onClick); - document.documentElement.addEventListener("keydown", handleKeyword); - return () => { - document.documentElement.removeEventListener("click", onClick); - document.documentElement.removeEventListener("keydown", handleKeyword); - }; - }, [props.show]); - const handleClose = () => { - showState(false); - props.close(); - }; - const childrens = ( -