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 = ( -
-
-
- -
-
{props.children}
-
- - -
-
-
- ); - return isShow - ? ReactDOM.createPortal( - childrens, - document.getElementById("root") as Element - ) - : null; -}; - -export default Dilog; diff --git a/src/components/layout/layout.tsx b/src/components/layout/layout.tsx index 0ee1fdb..b69fb62 100644 --- a/src/components/layout/layout.tsx +++ b/src/components/layout/layout.tsx @@ -45,9 +45,9 @@ const LayOut = (props: Store) => {
logo
- + {/* */} } /> - + {/* */}
{ style={{ height: "100%", borderRight: 0 }} items={items} onClick={(e) => { - console.log(e); nav(e.key); }} /> diff --git a/src/components/layout/layout_config.ts b/src/components/layout/layout_config.ts index d4d9ef4..0ec7db3 100644 --- a/src/components/layout/layout_config.ts +++ b/src/components/layout/layout_config.ts @@ -1,4 +1,7 @@ -export const items = [ +import { ItemType, MenuItemType } from 'antd/es/menu/interface'; + + +export const items:ItemType[] = [ { key: "/", label: `首页看板`, @@ -11,25 +14,49 @@ export const items = [ ], }, { - key: "/source", - label: `数据管理`, + key: "/sku", + label: `商品管理`, children: [ - { label: "数据管理", key: "/source/list" }, + { key: "/sku/list", label: `商品列表` }, + { key: "/sku/cat", label: `商品分类` }, + { key: "/sku/spec", label: `商品规格` }, + { key: "/sku/brand", label: `商品品牌` }, ], }, { - key: "/permission", + key: "/order", + label: `订单管理`, + children: [ + { key: "/order/list", label: `订单列表` }, + ], + }, + { + key: "/rbac", label: `权限管理`, children: [ - { label: `角色管理`, key: "/permission/role" }, - { label: `菜单管理`, key: "/permission/menu" }, + { label: `角色管理`, key: "/rbac/role" }, + { label: `菜单管理`, key: "/rbac/menu" }, + { label: `部门管理`, key: "/rbac/dep" }, + { label: `机构管理`, key: "/rbac/org" }, + { label: `员工管理`, key: "/rbac/org1" }, + ], + }, + { + key: "/city", + label: `区域管理`, + children: [ + { label: `区域列表`, key: "/city/list" }, ], }, { key: "/sys", label: `系统管理`, children: [ - { label: `部门管理`, key: "/dep" }, + { label: `部门管理`, key: "/sys/dep" }, + { label: `数据字典`, key: "/sys/keywod" }, + { label: `版本管理`, key: "/sys/version" }, + { label: `捐赠管理`, key: "/sys/don" }, + { label: `通告管理`, key: "/sys/notic" }, ], }, ]; \ No newline at end of file diff --git a/src/pages/dashbord/index.tsx b/src/pages/dashbord/index.tsx index 8014209..7c67bf3 100644 --- a/src/pages/dashbord/index.tsx +++ b/src/pages/dashbord/index.tsx @@ -1,4 +1,4 @@ -import { Button, Space } from "antd"; +import { Space } from "antd"; import { inject, observer } from "mobx-react"; import { Store } from "antd/lib/form/interface"; import React from "react"; @@ -7,11 +7,11 @@ import "./index.less"; const Dashbord = (props: Store) => { return (
- - - +
); }; diff --git a/src/pages/login/login.less b/src/pages/login/login.less index fc56354..2a0ed9a 100644 --- a/src/pages/login/login.less +++ b/src/pages/login/login.less @@ -1,74 +1,75 @@ .login_model { + width: 100%; + height: 100%; + background-size: 100% 100%; + display: flex; + align-items: center; + justify-content: center; + .login_box { + text-align: right; width: 100%; height: 100%; - background-repeat: no-repeat; - background-size: 100% 100%; - display: flex; - align-items: center; - justify-content: center; - .login_box { - text-align: right; - width: 100%; - height: 100%; - #login_basic { - width: 100%; - } - .container { - height: 100%; - } - .login-wrapper { - background-color: #fff; - width: 35%; - height: 400px; - border-radius: 15px; - padding: 0 50px; - position: relative; - left: 50%; - top: 50%; - transform: translate(-50%, -50%); - } - - .header { - font-size: 38px; - font-weight: bold; - text-align: center; - line-height: 180px; - } - - .input-item { - display: block; - width: 100%; - margin-bottom: 20px; - border: 0; - padding: 10px; - font-size: 15px; - outline: none; - } - - .input-item:placeholder { - text-transform: uppercase; - } - - .btn { - text-align: center; - cursor: pointer; - background-color: red; - color: #fff; - padding: 10px; - border-radius: 10px; - width: 100%; - margin-top: 40px; - } - - .msg { - text-align: center; - line-height: 88px; - } - - a { - text-decoration-line: none; - color: #abc1ee; - } + #login_basic { + width: 100%; } -} \ No newline at end of file + .container { + height: 100%; + } + .login-wrapper { + background-color: #ececec; + width: 40%; + border-radius: 15px; + padding: 50px; + position: relative; + left: 50%; + top: 50%; + transform: translate(-50%, -50%); + display: flex; + flex-direction: column; + align-items: center; + } + + .header { + font-size: 38px; + font-weight: bold; + text-align: center; + line-height: 180px; + } + + .input-item { + display: block; + width: 100%; + margin-bottom: 20px; + border: 0; + padding: 10px; + font-size: 15px; + outline: none; + } + + .input-item:placeholder { + text-transform: uppercase; + } + + .btn { + text-align: center; + cursor: pointer; + background-color: blue; + color: #fff; + padding: 10px; + border-radius: 10px; + width: 300px; + margin-top: 40px; + } + + .msg { + text-align: center; + line-height: 88px; + } + + a { + text-decoration-line: none; + color: #abc1ee; + } + } +} diff --git a/src/pages/login/login.tsx b/src/pages/login/login.tsx index a667ac5..874a1b8 100644 --- a/src/pages/login/login.tsx +++ b/src/pages/login/login.tsx @@ -9,13 +9,15 @@ const Login = (props) => { const formRef = React.useRef(null); const navigate = useNavigate(); const onFinish = async (values: any) => { + navigate("/", { replace: true }); + return; let status = await usrStore.login({ userName: values.account, passWord: values.password, }); if (status) { usrStore.closeLoginDilog(); - navigate("/user/list", { replace: true }); + navigate("/", { replace: true }); } }; const onFinishFailed = () => {}; diff --git a/src/pages/rbac/index.tsx b/src/pages/rbac/index.tsx new file mode 100644 index 0000000..3440f2b --- /dev/null +++ b/src/pages/rbac/index.tsx @@ -0,0 +1,11 @@ +import { Outlet } from "react-router"; + +const Rbac = () => { + return ( +
+ +
+ ); +}; + +export default Rbac; diff --git a/src/pages/menu/menu.tsx b/src/pages/rbac/menu/index.tsx similarity index 100% rename from src/pages/menu/menu.tsx rename to src/pages/rbac/menu/index.tsx diff --git a/src/pages/menu/menu.less b/src/pages/rbac/menu/menu.less similarity index 100% rename from src/pages/menu/menu.less rename to src/pages/rbac/menu/menu.less diff --git a/src/pages/menu/menu_config.tsx b/src/pages/rbac/menu/menu_config.tsx similarity index 100% rename from src/pages/menu/menu_config.tsx rename to src/pages/rbac/menu/menu_config.tsx diff --git a/src/pages/role/role.tsx b/src/pages/rbac/role/index.tsx similarity index 100% rename from src/pages/role/role.tsx rename to src/pages/rbac/role/index.tsx diff --git a/src/pages/role/role.less b/src/pages/rbac/role/role.less similarity index 100% rename from src/pages/role/role.less rename to src/pages/rbac/role/role.less diff --git a/src/pages/role/role_config.tsx b/src/pages/rbac/role/role_config.tsx similarity index 100% rename from src/pages/role/role_config.tsx rename to src/pages/rbac/role/role_config.tsx diff --git a/src/pages/sku/brand/index.tsx b/src/pages/sku/brand/index.tsx new file mode 100644 index 0000000..91bd459 --- /dev/null +++ b/src/pages/sku/brand/index.tsx @@ -0,0 +1,9 @@ +const Brand = () => { + return ( +
+ cat +
+ ); +}; + +export default Brand; diff --git a/src/pages/sku/cat/index.tsx b/src/pages/sku/cat/index.tsx new file mode 100644 index 0000000..fc0a703 --- /dev/null +++ b/src/pages/sku/cat/index.tsx @@ -0,0 +1,9 @@ +const Cat = () => { + return ( +
+ cat +
+ ); +}; + +export default Cat; diff --git a/src/pages/sku/index.tsx b/src/pages/sku/index.tsx new file mode 100644 index 0000000..ef4a7db --- /dev/null +++ b/src/pages/sku/index.tsx @@ -0,0 +1,11 @@ +import { Outlet } from "react-router"; + +const Sku = () => { + return ( +
+ +
+ ); +}; + +export default Sku; diff --git a/src/pages/sku/spec/index.tsx b/src/pages/sku/spec/index.tsx new file mode 100644 index 0000000..1fb3d29 --- /dev/null +++ b/src/pages/sku/spec/index.tsx @@ -0,0 +1,9 @@ +const Spec = () => { + return ( +
+ cat +
+ ); +}; + +export default Spec; diff --git a/src/pages/source/source.less b/src/pages/source/source.less deleted file mode 100644 index 4a4054f..0000000 --- a/src/pages/source/source.less +++ /dev/null @@ -1,8 +0,0 @@ -.contentBox{ - overflow-y: auto; - height: 100%; - .tableName{ - height: 100%; - overflow-y: auto; - } -} \ No newline at end of file diff --git a/src/pages/source/source.tsx b/src/pages/source/source.tsx deleted file mode 100644 index 87763e8..0000000 --- a/src/pages/source/source.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import React, { useEffect, useState } from "react"; -import { Space } from "antd"; -import { Store } from "antd/lib/form/interface"; -import { inject, observer } from "mobx-react"; -import BTable from "@/components/b_table"; -import "./source.less"; -const Source = (props: Store) => { - const { sourceStore } = props; - const [coloums,setColumns] = useState([]) - const [content,setContent] = useState([]) - // 获取列表数据 - useEffect(() => { - sourceStore.getHead().then((res)=>{ - res.forEach(element => { - element.dataIndex = "dbs_"+element.identity.toLowerCase() - element.title = element.data_name - }); - setColumns(res) - }); - sourceStore.geContent().then((res)=>{ - res.forEach(element => { - element.key = "dbs_"+element.identity - }); - setContent(res) - }); - }, [sourceStore]); - - return ( -
- - { - sourceStore.deleteItem(id); - }} - actionCloumn={(e)=>{ - - }} - editCallback={(record) => { - }} - /> - -
- ); -}; - -export default inject("sourceStore")(observer(Source)); diff --git a/src/pages/source/source_config.tsx b/src/pages/source/source_config.tsx deleted file mode 100644 index 1ad6646..0000000 --- a/src/pages/source/source_config.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { FormType } from "@/components/form/interface"; -import { UserDataType } from "@/model/userModel"; -import { ColumnsType } from "antd/lib/table"; -import dayjs from "dayjs"; - -export const defaultConfig = [ - { - type: FormType.input, - label: "数据集名称", - name: "resource_name", - value: "", - rules: [{ required: true, message: "请输入用户名称!" }], - }, -]; - -export const columns: ColumnsType = [ - { - title: "数据集名称", - dataIndex: "resource_name", - width: 200, - }, -]; diff --git a/src/router/index.tsx b/src/router/index.tsx index c1c2eb1..4294931 100644 --- a/src/router/index.tsx +++ b/src/router/index.tsx @@ -3,9 +3,8 @@ import LayOut from "@/components/layout/layout"; import Login from "@/pages/login/login"; import User from "@/pages/user/user"; import Dashbord from "@/pages/dashbord"; -import Source from "@/pages/source/source"; -import Menu from "@/pages/menu/menu"; -import Role from "@/pages/role/role"; +import { rbac } from "./routers/rbac_router"; +import { sku } from "./routers/sku_router"; const routers = createHashRouter([ { @@ -22,21 +21,8 @@ const routers = createHashRouter([ index: true, element: , }, - { - path: "/source/list", - index: true, - element: , - }, - { - path: "/permission/menu", - index: true, - element: , - }, - { - path: "/permission/role", - index: true, - element: , - }, + ...rbac, + ...sku ], }, { diff --git a/src/router/routers/rbac_router.tsx b/src/router/routers/rbac_router.tsx new file mode 100644 index 0000000..3807be6 --- /dev/null +++ b/src/router/routers/rbac_router.tsx @@ -0,0 +1,21 @@ +import Rbac from "@/pages/rbac"; +import Menu from "@/pages/rbac/menu"; +import Role from "@/pages/rbac/role"; +export const rbac = [ + { + path: "/rbac", + element: , + children: [ + { + path: "/rbac/menu", + index: true, + element: , + }, + { + path: "/rbac/role", + index: true, + element: , + }, + ], + }, +]; diff --git a/src/router/routers/sku_router.tsx b/src/router/routers/sku_router.tsx new file mode 100644 index 0000000..bc9dd6b --- /dev/null +++ b/src/router/routers/sku_router.tsx @@ -0,0 +1,33 @@ +import Menu from "@/pages/rbac/menu"; +import Sku from "@/pages/sku"; +import Brand from "@/pages/sku/brand"; +import Cat from "@/pages/sku/cat"; +import Spec from "@/pages/sku/spec"; +export const sku = [ + { + path: "/sku", + element: , + children: [ + { + path: "/sku/list", + index: true, + element: , + }, + { + path: "/sku/cat", + index: true, + element: , + }, + { + path: "/sku/spec", + index: true, + element: , + }, + { + path: "/sku/brand", + index: true, + element: , + }, + ], + }, +]; diff --git a/src/service/base.ts b/src/service/base.ts index d3acc62..1987361 100644 --- a/src/service/base.ts +++ b/src/service/base.ts @@ -1,7 +1,6 @@ import store from "@/store"; import Config from "@/util/config"; import axios, { AxiosResponse } from "axios"; -// import { baseHttp } from '@/service/base'; // 添加请求拦截器 axios.defaults.headers.common["Content-Type"] = "application/json; charset=utf8"; axios.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest"; @@ -19,16 +18,16 @@ axios.interceptors.request.use((config) => { // 添加响应拦截器 axios.interceptors.response.use((res: AxiosResponse) => { if (res.data?.status === 401) { - store.usrStore.openLoginDilog() - store.usrStore.logOut() - window.location.href = '#/login' + // store.usrStore.openLoginDilog() + // store.usrStore.logOut() + // window.location.href = '#/login' } return res; }, (err) => { if (err.status === 401) { - store.usrStore.openLoginDilog() - store.usrStore.logOut() - window.location.href = '#/login' + // store.usrStore.openLoginDilog() + // store.usrStore.logOut() + // window.location.href = '#/login' } return Promise.reject(err); }); diff --git a/src/service/source_config.ts b/src/service/source_config.ts deleted file mode 100644 index c9fcf6c..0000000 --- a/src/service/source_config.ts +++ /dev/null @@ -1,10 +0,0 @@ -class SourceConfig { - static ADD: string = "/desc"; - static EDIT: string = "/desc"; - static LIST: string = "/desc/content"; - static DELETE: string = "/desc"; - static Headers: string = "/desc/header"; - static Content: string = "/desc/content"; -} - -export default SourceConfig; \ No newline at end of file diff --git a/src/service/user_config.ts b/src/service/user_config.ts index 4cbf863..49a774b 100644 --- a/src/service/user_config.ts +++ b/src/service/user_config.ts @@ -1,5 +1,5 @@ class UserConfig { - static LOGINURI: string = "/anth/login/pc" + static LOGINURI: string = "/anth/login" static ADD: string = "/user"; static EDIT: string = "/user"; static LIST: string = "/user/list"; diff --git a/src/store/index.ts b/src/store/index.ts index b413a34..dfe0f9d 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -1,9 +1,7 @@ import usrStore from '@/store/user' -import sourceStore from '@/store/source'; const store = { usrStore, - sourceStore }; export default store; \ No newline at end of file diff --git a/src/store/source.ts b/src/store/source.ts deleted file mode 100644 index 7fd9362..0000000 --- a/src/store/source.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { action, makeObservable, observable } from "mobx"; -import BaseStore from "./baseStore"; -import { UserDataType } from "@/model/userModel"; -import SourceConfig from "@/service/source_config"; -import { base } from "@/service/base"; -import { message } from "antd"; - -class SourceStore extends BaseStore { - headlist =[] - contentList =[] - constructor() { - super(SourceConfig) - makeObservable(this, { - getHead:action, - - headlist:observable, - contentList:observable - }) - } - async getHead(){ - let res = await base.get(SourceConfig.Headers, {}) - if (res.code !== 200) { - message.error(res.msg) - return false - } - this.headlist = res.data.record; - return res.data.record; - } - - async geContent(){ - let res = await base.get(SourceConfig.Content, {}) - if (res.code !== 0) { - message.error(res.msg) - return false - } - this.contentList = res.data; - return res.data; - } -} -const sourceStore = new SourceStore(); -export default sourceStore; \ No newline at end of file diff --git a/src/util/config.ts b/src/util/config.ts index 9acf9f9..287632e 100644 --- a/src/util/config.ts +++ b/src/util/config.ts @@ -1,4 +1,5 @@ class Config { - static baseUrl = "http://127.0.0.1:12214/v1"; + static baseUrl = "/v1"; + // static baseUrl = "http://127.0.0.1:12215/v1"; } export default Config;