修改一下
This commit is contained in:
23
index.html
23
index.html
@@ -1,13 +1,16 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>My Google AI Studio App</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="icon" type="image/x-icon" href="./src/assets/logo.png" />
|
||||
<title>机器人智慧服务系统</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
314
package-lock.json
generated
314
package-lock.json
generated
@@ -13,12 +13,13 @@
|
||||
"@tailwindcss/vite": "^4.1.14",
|
||||
"@vitejs/plugin-react": "^5.0.4",
|
||||
"antd": "^5.24.1",
|
||||
"axios": "^1.15.0",
|
||||
"axios": "^1.15.1",
|
||||
"clsx": "^2.1.1",
|
||||
"dotenv": "^17.2.3",
|
||||
"express": "^4.21.2",
|
||||
"lucide-react": "^0.546.0",
|
||||
"motion": "^12.23.24",
|
||||
"qrcode": "^1.5.4",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0",
|
||||
"react-router-dom": "^7.14.1",
|
||||
@@ -2058,6 +2059,30 @@
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/ansi-regex": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
||||
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/ansi-styles": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"color-convert": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/antd": {
|
||||
"version": "5.24.1",
|
||||
"resolved": "https://registry.npmjs.org/antd/-/antd-5.24.1.tgz",
|
||||
@@ -2214,9 +2239,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/axios": {
|
||||
"version": "1.15.0",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.15.0.tgz",
|
||||
"integrity": "sha512-wWyJDlAatxk30ZJer+GeCWS209sA42X+N5jU2jy6oHTp7ufw8uzUTVFBX9+wTfAlhiJXGS0Bq7X6efruWjuK9Q==",
|
||||
"version": "1.15.1",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.15.1.tgz",
|
||||
"integrity": "sha512-WOG+Jj8ZOvR0a3rAn+Tuf1UQJRxw5venr6DgdbJzngJE3qG7X0kL83CZGpdHMxEm+ZK3seAbvFsw4FfOfP9vxg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.15.11",
|
||||
@@ -2381,6 +2406,15 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/camelcase": {
|
||||
"version": "5.3.1",
|
||||
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
|
||||
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/caniuse-lite": {
|
||||
"version": "1.0.30001788",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001788.tgz",
|
||||
@@ -2407,6 +2441,17 @@
|
||||
"integrity": "sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/cliui": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz",
|
||||
"integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"string-width": "^4.2.0",
|
||||
"strip-ansi": "^6.0.0",
|
||||
"wrap-ansi": "^6.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/clsx": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",
|
||||
@@ -2416,6 +2461,24 @@
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/color-convert": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"color-name": "~1.1.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/color-name": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/combined-stream": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||
@@ -2644,6 +2707,15 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/decamelize": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
|
||||
"integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/decimal.js-light": {
|
||||
"version": "2.5.1",
|
||||
"resolved": "https://registry.npmjs.org/decimal.js-light/-/decimal.js-light-2.5.1.tgz",
|
||||
@@ -2687,6 +2759,12 @@
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/dijkstrajs": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.3.tgz",
|
||||
"integrity": "sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/dotenv": {
|
||||
"version": "17.4.2",
|
||||
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.4.2.tgz",
|
||||
@@ -2734,6 +2812,12 @@
|
||||
"integrity": "sha512-908qahOGocRMinT2nM3ajCEM99H4iPdv84eagPP3FfZy/1ZGeOy2CZYzjhms81ckOPCXPlW7LkY4XpxD8r1DrA==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/emoji-regex": {
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/encodeurl": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
|
||||
@@ -3023,6 +3107,19 @@
|
||||
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/find-up": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
|
||||
"integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"locate-path": "^5.0.0",
|
||||
"path-exists": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/follow-redirects": {
|
||||
"version": "1.16.0",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.0.tgz",
|
||||
@@ -3190,6 +3287,15 @@
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/get-caller-file": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
|
||||
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": "6.* || 8.* || >= 10.*"
|
||||
}
|
||||
},
|
||||
"node_modules/get-intrinsic": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
|
||||
@@ -3402,6 +3508,15 @@
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/is-fullwidth-code-point": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
|
||||
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/is-mobile": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-mobile/-/is-mobile-5.0.0.tgz",
|
||||
@@ -3735,6 +3850,18 @@
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/locate-path": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
|
||||
"integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"p-locate": "^4.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/long": {
|
||||
"version": "5.3.2",
|
||||
"resolved": "https://registry.npmjs.org/long/-/long-5.3.2.tgz",
|
||||
@@ -3979,6 +4106,33 @@
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/p-limit": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
|
||||
"integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"p-try": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/p-locate": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
|
||||
"integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"p-limit": "^2.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/p-retry": {
|
||||
"version": "4.6.2",
|
||||
"resolved": "https://registry.npmjs.org/p-retry/-/p-retry-4.6.2.tgz",
|
||||
@@ -3992,6 +4146,15 @@
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/p-try": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
|
||||
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/parseurl": {
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
||||
@@ -4001,6 +4164,15 @@
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/path-exists": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
|
||||
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/path-to-regexp": {
|
||||
"version": "0.1.13",
|
||||
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.13.tgz",
|
||||
@@ -4025,6 +4197,15 @@
|
||||
"url": "https://github.com/sponsors/jonschlinkert"
|
||||
}
|
||||
},
|
||||
"node_modules/pngjs": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pngjs/-/pngjs-5.0.0.tgz",
|
||||
"integrity": "sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10.13.0"
|
||||
}
|
||||
},
|
||||
"node_modules/postcss": {
|
||||
"version": "8.5.10",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.10.tgz",
|
||||
@@ -4106,6 +4287,23 @@
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/qrcode": {
|
||||
"version": "1.5.4",
|
||||
"resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.4.tgz",
|
||||
"integrity": "sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"dijkstrajs": "^1.0.1",
|
||||
"pngjs": "^5.0.0",
|
||||
"yargs": "^15.3.1"
|
||||
},
|
||||
"bin": {
|
||||
"qrcode": "bin/qrcode"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.13.0"
|
||||
}
|
||||
},
|
||||
"node_modules/qs": {
|
||||
"version": "6.14.2",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.14.2.tgz",
|
||||
@@ -4913,6 +5111,21 @@
|
||||
"redux": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/require-directory": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
|
||||
"integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/require-main-filename": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
|
||||
"integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/reselect": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/reselect/-/reselect-5.1.1.tgz",
|
||||
@@ -5092,6 +5305,12 @@
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/set-blocking": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
|
||||
"integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/set-cookie-parser": {
|
||||
"version": "2.7.2",
|
||||
"resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.2.tgz",
|
||||
@@ -5200,6 +5419,32 @@
|
||||
"integrity": "sha512-u/1tdPl4yQnPBjnVrmdLo9gtuLvELKsAoRapekWggdiQNvvvum+jYF329d84NAa660KQw7pB2n36KrIKVoXa3A==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/string-width": {
|
||||
"version": "4.2.3",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
|
||||
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"emoji-regex": "^8.0.0",
|
||||
"is-fullwidth-code-point": "^3.0.0",
|
||||
"strip-ansi": "^6.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/strip-ansi": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
||||
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ansi-regex": "^5.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/stylis": {
|
||||
"version": "4.3.6",
|
||||
"resolved": "https://registry.npmjs.org/stylis/-/stylis-4.3.6.tgz",
|
||||
@@ -5968,6 +6213,26 @@
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/which-module": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz",
|
||||
"integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/wrap-ansi": {
|
||||
"version": "6.2.0",
|
||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
|
||||
"integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ansi-styles": "^4.0.0",
|
||||
"string-width": "^4.1.0",
|
||||
"strip-ansi": "^6.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/ws": {
|
||||
"version": "8.20.0",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.20.0.tgz",
|
||||
@@ -5989,11 +6254,52 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/y18n": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz",
|
||||
"integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/yallist": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
|
||||
"integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/yargs": {
|
||||
"version": "15.4.1",
|
||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz",
|
||||
"integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cliui": "^6.0.0",
|
||||
"decamelize": "^1.2.0",
|
||||
"find-up": "^4.1.0",
|
||||
"get-caller-file": "^2.0.1",
|
||||
"require-directory": "^2.1.1",
|
||||
"require-main-filename": "^2.0.0",
|
||||
"set-blocking": "^2.0.0",
|
||||
"string-width": "^4.2.0",
|
||||
"which-module": "^2.0.0",
|
||||
"y18n": "^4.0.0",
|
||||
"yargs-parser": "^18.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/yargs-parser": {
|
||||
"version": "18.1.3",
|
||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz",
|
||||
"integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"camelcase": "^5.0.0",
|
||||
"decamelize": "^1.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,12 +16,13 @@
|
||||
"@tailwindcss/vite": "^4.1.14",
|
||||
"@vitejs/plugin-react": "^5.0.4",
|
||||
"antd": "^5.24.1",
|
||||
"axios": "^1.15.0",
|
||||
"axios": "^1.15.1",
|
||||
"clsx": "^2.1.1",
|
||||
"dotenv": "^17.2.3",
|
||||
"express": "^4.21.2",
|
||||
"lucide-react": "^0.546.0",
|
||||
"motion": "^12.23.24",
|
||||
"qrcode": "^1.5.4",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0",
|
||||
"react-router-dom": "^7.14.1",
|
||||
|
||||
BIN
src/assets/logo.png
Normal file
BIN
src/assets/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 MiB |
@@ -1,150 +1,151 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { Outlet, useNavigate, useLocation } from 'react-router-dom';
|
||||
import {
|
||||
Layout,
|
||||
Menu,
|
||||
Button,
|
||||
Avatar,
|
||||
Space,
|
||||
ConfigProvider,
|
||||
theme,
|
||||
Breadcrumb,
|
||||
Badge
|
||||
import {
|
||||
Layout,
|
||||
Menu,
|
||||
Button,
|
||||
Avatar,
|
||||
Space,
|
||||
ConfigProvider,
|
||||
theme,
|
||||
Breadcrumb,
|
||||
Badge
|
||||
} from 'antd';
|
||||
import {
|
||||
DashboardOutlined,
|
||||
ExperimentOutlined,
|
||||
VideoCameraOutlined,
|
||||
BellOutlined,
|
||||
DownloadOutlined,
|
||||
UserOutlined,
|
||||
LogoutOutlined,
|
||||
MenuUnfoldOutlined,
|
||||
MenuFoldOutlined,
|
||||
GlobalOutlined,
|
||||
TeamOutlined
|
||||
import {
|
||||
DashboardOutlined,
|
||||
ExperimentOutlined,
|
||||
VideoCameraOutlined,
|
||||
BellOutlined,
|
||||
DownloadOutlined,
|
||||
UserOutlined,
|
||||
LogoutOutlined,
|
||||
MenuUnfoldOutlined,
|
||||
MenuFoldOutlined,
|
||||
GlobalOutlined,
|
||||
TeamOutlined
|
||||
} from '@ant-design/icons';
|
||||
import { MOCK_USER } from '../constants';
|
||||
|
||||
import logo from '../assets/logo.png';
|
||||
const { Header, Sider, Content } = Layout;
|
||||
|
||||
export default function AppLayout() {
|
||||
const [collapsed, setCollapsed] = useState(false);
|
||||
const [time, setTime] = useState(new Date().toLocaleString());
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const [collapsed, setCollapsed] = useState(false);
|
||||
const [time, setTime] = useState(new Date().toLocaleString());
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
|
||||
// 从 localStorage 获取真实用户信息
|
||||
const userJson = localStorage.getItem('user');
|
||||
const user = userJson ? JSON.parse(userJson) : MOCK_USER;
|
||||
// 从 localStorage 获取真实用户信息
|
||||
const userJson = localStorage.getItem('user');
|
||||
const user = userJson ? JSON.parse(userJson) : MOCK_USER;
|
||||
|
||||
useEffect(() => {
|
||||
const timer = setInterval(() => setTime(new Date().toLocaleString()), 1000);
|
||||
return () => clearInterval(timer);
|
||||
}, []);
|
||||
useEffect(() => {
|
||||
const timer = setInterval(() => setTime(new Date().toLocaleString()), 1000);
|
||||
return () => clearInterval(timer);
|
||||
}, []);
|
||||
|
||||
const handleLogout = () => {
|
||||
localStorage.removeItem('isAuthenticated');
|
||||
localStorage.removeItem('user');
|
||||
localStorage.removeItem('token');
|
||||
navigate('/login');
|
||||
};
|
||||
const handleLogout = () => {
|
||||
localStorage.removeItem('isAuthenticated');
|
||||
localStorage.removeItem('user');
|
||||
localStorage.removeItem('token');
|
||||
navigate('/login');
|
||||
};
|
||||
|
||||
const menuItems = [
|
||||
{ key: '/', icon: <DashboardOutlined />, label: '概览控制台', roles: ['admin', 'operator', 'viewer'] },
|
||||
{ key: '/devices', icon: <ExperimentOutlined />, label: '设备管理', roles: ['admin', 'operator'] },
|
||||
{ key: '/video', icon: <VideoCameraOutlined />, label: '在线视频', roles: ['admin', 'operator', 'viewer'] },
|
||||
{ key: '/alerts', icon: <BellOutlined />, label: '警报中心', roles: ['admin', 'operator'] },
|
||||
{ key: '/downloads', icon: <DownloadOutlined />, label: '视频下载', roles: ['admin', 'operator'] },
|
||||
{ key: '/users', icon: <TeamOutlined />, label: '用户管理', roles: ['admin'] },
|
||||
{ key: '/roles', icon: <UserOutlined />, label: '角色权限', roles: ['admin'] },
|
||||
];
|
||||
const menuItems = [
|
||||
{ key: '/', icon: <DashboardOutlined />, label: '概览控制台', roles: ['admin', 'operator', 'viewer'] },
|
||||
{ key: '/devices', icon: <ExperimentOutlined />, label: '设备管理', roles: ['admin', 'operator'] },
|
||||
{ key: '/video', icon: <VideoCameraOutlined />, label: '在线视频', roles: ['admin', 'operator', 'viewer'] },
|
||||
{ key: '/alerts', icon: <BellOutlined />, label: '警报中心', roles: ['admin', 'operator'] },
|
||||
{ key: '/downloads', icon: <DownloadOutlined />, label: '视频下载', roles: ['admin', 'operator'] },
|
||||
{ key: '/users', icon: <TeamOutlined />, label: '用户管理', roles: ['admin'] },
|
||||
{ key: '/roles', icon: <UserOutlined />, label: '角色权限', roles: ['admin'] },
|
||||
{ key: '/serialNumGenerate', icon: <UserOutlined />, label: '序列号生成', roles: ['admin'] },
|
||||
];
|
||||
|
||||
const filteredMenu = menuItems.filter(item => item.roles.includes(user.role));
|
||||
const filteredMenu = menuItems.filter(item => item.roles.includes(user.role));
|
||||
|
||||
const currentPathLabel = menuItems.find(i => i.key === location.pathname)?.label || '概览控制台';
|
||||
const currentPathLabel = menuItems.find(i => i.key === location.pathname)?.label || '概览控制台';
|
||||
|
||||
return (
|
||||
<ConfigProvider
|
||||
theme={{
|
||||
algorithm: theme.defaultAlgorithm,
|
||||
token: {
|
||||
colorPrimary: '#1890ff',
|
||||
borderRadius: 2,
|
||||
},
|
||||
components: {
|
||||
Layout: {
|
||||
headerBg: '#fff',
|
||||
siderBg: '#001529',
|
||||
},
|
||||
Menu: {
|
||||
darkItemBg: '#001529',
|
||||
darkItemSelectedBg: '#1890ff',
|
||||
}
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Layout style={{ minHeight: '100vh' }}>
|
||||
<Sider trigger={null} collapsible collapsed={collapsed} width={200} theme="dark">
|
||||
<div className="h-16 flex items-center justify-center border-b border-white/10 overflow-hidden">
|
||||
<Space size="small" className="px-2">
|
||||
<GlobalOutlined style={{ fontSize: 24, color: '#1890ff' }} />
|
||||
{!collapsed && <span className="text-white font-bold text-lg whitespace-nowrap">RobotMaster AI</span>}
|
||||
</Space>
|
||||
</div>
|
||||
<Menu
|
||||
theme="dark"
|
||||
mode="inline"
|
||||
selectedKeys={[location.pathname]}
|
||||
items={filteredMenu}
|
||||
onClick={({ key }) => navigate(key)}
|
||||
/>
|
||||
{!collapsed && (
|
||||
<div className="absolute bottom-4 left-4 right-4 p-2 bg-white/5 rounded text-[12px] text-gray-400">
|
||||
当前权限: <span className="text-white font-bold">{user.role === 'admin' ? '系统管理员' : user.role === 'operator' ? '操作员' : '观察员'}</span>
|
||||
</div>
|
||||
)}
|
||||
</Sider>
|
||||
<Layout>
|
||||
<Header className="px-6 flex items-center justify-between shadow-sm border-b border-gray-100 h-16 bg-white shrink-0 z-10">
|
||||
<div className="flex items-center gap-4">
|
||||
<Button
|
||||
type="text"
|
||||
icon={collapsed ? <MenuUnfoldOutlined /> : <MenuFoldOutlined />}
|
||||
onClick={() => setCollapsed(!collapsed)}
|
||||
style={{ fontSize: '16px', width: 40, height: 40 }}
|
||||
/>
|
||||
<Breadcrumb
|
||||
items={[
|
||||
{ title: '系统首页' },
|
||||
{ title: currentPathLabel }
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
return (
|
||||
<ConfigProvider
|
||||
theme={{
|
||||
algorithm: theme.defaultAlgorithm,
|
||||
token: {
|
||||
colorPrimary: '#1890ff',
|
||||
borderRadius: 2,
|
||||
},
|
||||
components: {
|
||||
Layout: {
|
||||
headerBg: '#fff',
|
||||
siderBg: '#001529',
|
||||
},
|
||||
Menu: {
|
||||
darkItemBg: '#001529',
|
||||
darkItemSelectedBg: '#1890ff',
|
||||
}
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Layout style={{ minHeight: '100vh' }}>
|
||||
<Sider trigger={null} collapsible collapsed={collapsed} width={220} theme="dark">
|
||||
<div className="h-16 flex items-center justify-center border-b border-white/10 overflow-hidden">
|
||||
<Space size="small" className="px-2">
|
||||
<img src={logo} alt="Logo" style={{ width: "24px", height: "24px" }} />
|
||||
{!collapsed && <span className="text-white font-bold text-lg whitespace-nowrap">机器人智慧服务系统</span>}
|
||||
</Space>
|
||||
</div>
|
||||
<Menu
|
||||
theme="dark"
|
||||
mode="inline"
|
||||
selectedKeys={[location.pathname]}
|
||||
items={filteredMenu}
|
||||
onClick={({ key }) => navigate(key)}
|
||||
/>
|
||||
{!collapsed && (
|
||||
<div className="absolute bottom-4 left-4 right-4 p-2 bg-white/5 rounded text-[12px] text-gray-400">
|
||||
当前权限: <span className="text-white font-bold">{user.role === 'admin' ? '系统管理员' : user.role === 'operator' ? '操作员' : '观察员'}</span>
|
||||
</div>
|
||||
)}
|
||||
</Sider>
|
||||
<Layout>
|
||||
<Header className="px-6 flex items-center justify-between shadow-sm border-b border-gray-100 h-16 bg-white shrink-0 z-10">
|
||||
<div className="flex items-center gap-4">
|
||||
<Button
|
||||
type="text"
|
||||
icon={collapsed ? <MenuUnfoldOutlined /> : <MenuFoldOutlined />}
|
||||
onClick={() => setCollapsed(!collapsed)}
|
||||
style={{ fontSize: '16px', width: 40, height: 40 }}
|
||||
/>
|
||||
<Breadcrumb
|
||||
items={[
|
||||
{ title: '系统首页' },
|
||||
{ title: currentPathLabel }
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-6">
|
||||
<div className="flex items-center gap-3 pr-6 border-r border-gray-100">
|
||||
<span className="text-gray-400 font-mono text-[13px]">{time}</span>
|
||||
<Badge status="success" />
|
||||
<span className="text-gray-800 font-medium">{user.name}</span>
|
||||
<Avatar src={user.avatar} size="small" icon={<UserOutlined />} />
|
||||
</div>
|
||||
<Button
|
||||
type="text"
|
||||
danger
|
||||
icon={<LogoutOutlined />}
|
||||
onClick={handleLogout}
|
||||
className="font-bold text-[12px] uppercase"
|
||||
>
|
||||
退出登录
|
||||
</Button>
|
||||
</div>
|
||||
</Header>
|
||||
<Content className="p-4 overflow-y-auto bg-[#f4f7f9] min-h-0">
|
||||
<Outlet />
|
||||
</Content>
|
||||
</Layout>
|
||||
</Layout>
|
||||
</ConfigProvider>
|
||||
);
|
||||
<div className="flex items-center gap-6">
|
||||
<div className="flex items-center gap-3 pr-6 border-r border-gray-100">
|
||||
<span className="text-gray-400 font-mono text-[13px]">{time}</span>
|
||||
<Badge status="success" />
|
||||
<span className="text-gray-800 font-medium">{user.name}</span>
|
||||
<Avatar src={user.avatar} size="small" icon={<UserOutlined />} />
|
||||
</div>
|
||||
<Button
|
||||
type="text"
|
||||
danger
|
||||
icon={<LogoutOutlined />}
|
||||
onClick={handleLogout}
|
||||
className="font-bold text-[12px] uppercase"
|
||||
>
|
||||
退出登录
|
||||
</Button>
|
||||
</div>
|
||||
</Header>
|
||||
<Content className="p-4 overflow-y-auto bg-[#f4f7f9] min-h-0">
|
||||
<Outlet />
|
||||
</Content>
|
||||
</Layout>
|
||||
</Layout>
|
||||
</ConfigProvider>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
import React, { useState } from 'react';
|
||||
import {
|
||||
Table,
|
||||
Input,
|
||||
Button,
|
||||
Tag,
|
||||
Progress,
|
||||
Space,
|
||||
Typography,
|
||||
Row,
|
||||
Col,
|
||||
Statistic,
|
||||
Descriptions,
|
||||
Tabs,
|
||||
Card
|
||||
import {
|
||||
Table,
|
||||
Input,
|
||||
Button,
|
||||
Tag,
|
||||
Progress,
|
||||
Space,
|
||||
Typography,
|
||||
Row,
|
||||
Col,
|
||||
Statistic,
|
||||
Descriptions,
|
||||
Tabs,
|
||||
Card
|
||||
} from 'antd';
|
||||
import {
|
||||
SearchOutlined,
|
||||
PlusOutlined,
|
||||
SettingOutlined,
|
||||
PoweroffOutlined,
|
||||
ClusterOutlined,
|
||||
ArrowRightOutlined,
|
||||
CloseOutlined,
|
||||
DashboardOutlined,
|
||||
HeatMapOutlined,
|
||||
InfoCircleOutlined,
|
||||
LineChartOutlined,
|
||||
ThunderboltOutlined
|
||||
import {
|
||||
SearchOutlined,
|
||||
PlusOutlined,
|
||||
SettingOutlined,
|
||||
PoweroffOutlined,
|
||||
ClusterOutlined,
|
||||
ArrowRightOutlined,
|
||||
CloseOutlined,
|
||||
DashboardOutlined,
|
||||
HeatMapOutlined,
|
||||
InfoCircleOutlined,
|
||||
LineChartOutlined,
|
||||
ThunderboltOutlined
|
||||
} from '@ant-design/icons';
|
||||
import { DEVICES } from '../constants';
|
||||
import { motion, AnimatePresence } from 'motion/react';
|
||||
@@ -34,239 +34,256 @@ import { motion, AnimatePresence } from 'motion/react';
|
||||
const { Text, Title } = Typography;
|
||||
|
||||
export default function Devices() {
|
||||
const [selectedDeviceId, setSelectedDeviceId] = useState<string | null>(null);
|
||||
const selectedDevice = DEVICES.find(d => d.id === selectedDeviceId);
|
||||
const [selectedDeviceId, setSelectedDeviceId] = useState<string | null>(null);
|
||||
const selectedDevice = DEVICES.find(d => d.id === selectedDeviceId);
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: '节点身份',
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
render: (text: string, record: any) => (
|
||||
<Space direction="vertical" size={0}>
|
||||
<Text strong style={{ fontSize: 13 }}>{text}</Text>
|
||||
<Text type="secondary" style={{ fontSize: 10, fontFamily: 'monospace' }}>{record.id} | {record.type}</Text>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '负载/状态',
|
||||
key: 'status',
|
||||
render: (record: any) => (
|
||||
<Space direction="vertical" size={0}>
|
||||
<Text
|
||||
strong
|
||||
italic
|
||||
style={{
|
||||
fontSize: 10,
|
||||
color: record.status === 'online' ? '#52c41a' : record.status === 'alert' ? '#f5222d' : '#bfbfbf'
|
||||
}}
|
||||
>
|
||||
{record.status.toUpperCase()}
|
||||
</Text>
|
||||
<Space size="small">
|
||||
<ClusterOutlined style={{ fontSize: 10, color: 'rgba(0,0,0,0.25)' }} />
|
||||
<Text type="secondary" style={{ fontSize: 11, fontFamily: 'monospace' }}>{record.cpu}%</Text>
|
||||
</Space>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '能量效率',
|
||||
dataIndex: 'battery',
|
||||
key: 'battery',
|
||||
render: (percent: number) => (
|
||||
<Space size="middle">
|
||||
<Progress
|
||||
percent={percent}
|
||||
size={[60, 4]}
|
||||
showInfo={false}
|
||||
status={percent < 20 ? 'exception' : 'active'}
|
||||
strokeColor={percent < 20 ? '#f5222d' : percent < 50 ? '#faad14' : '#52c41a'}
|
||||
/>
|
||||
<Text style={{ fontSize: 11, fontFamily: 'monospace' }}>{percent}%</Text>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '管理',
|
||||
key: 'action',
|
||||
align: 'right' as const,
|
||||
render: () => (
|
||||
<Space>
|
||||
<Button type="text" size="small" icon={<SettingOutlined />} />
|
||||
<Button type="text" size="small" danger icon={<PoweroffOutlined />} />
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
];
|
||||
const columns = [
|
||||
{
|
||||
title: '节点身份',
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
render: (text: string, record: any) => (
|
||||
<Space direction="vertical" size={0}>
|
||||
<Text strong style={{ fontSize: 13 }}>{text}</Text>
|
||||
<Text type="secondary" style={{ fontSize: 10, fontFamily: 'monospace' }}>{record.id} | {record.type}</Text>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '负载/状态',
|
||||
key: 'status',
|
||||
render: (record: any) => (
|
||||
<Space direction="vertical" size={0}>
|
||||
<Text
|
||||
strong
|
||||
italic
|
||||
style={{
|
||||
fontSize: 10,
|
||||
color: record.status === 'online' ? '#52c41a' : record.status === 'alert' ? '#f5222d' : '#bfbfbf'
|
||||
}}
|
||||
>
|
||||
{record.status.toUpperCase()}
|
||||
</Text>
|
||||
<Space size="small">
|
||||
<ClusterOutlined style={{ fontSize: 10, color: 'rgba(0,0,0,0.25)' }} />
|
||||
<Text type="secondary" style={{ fontSize: 11, fontFamily: 'monospace' }}>{record.cpu}%</Text>
|
||||
</Space>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '能量效率',
|
||||
dataIndex: 'battery',
|
||||
key: 'battery',
|
||||
render: (percent: number) => (
|
||||
<Space size="middle">
|
||||
<Progress
|
||||
percent={percent}
|
||||
size={[60, 4]}
|
||||
showInfo={false}
|
||||
status={percent < 20 ? 'exception' : 'active'}
|
||||
strokeColor={percent < 20 ? '#f5222d' : percent < 50 ? '#faad14' : '#52c41a'}
|
||||
/>
|
||||
<Text style={{ fontSize: 11, fontFamily: 'monospace' }}>{percent}%</Text>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '类型',
|
||||
dataIndex: 'battery',
|
||||
key: 'battery',
|
||||
render: (percent: number) => (
|
||||
<Space size="middle">
|
||||
<Progress
|
||||
percent={percent}
|
||||
size={[60, 4]}
|
||||
showInfo={false}
|
||||
status={percent < 20 ? 'exception' : 'active'}
|
||||
strokeColor={percent < 20 ? '#f5222d' : percent < 50 ? '#faad14' : '#52c41a'}
|
||||
/>
|
||||
<Text style={{ fontSize: 11, fontFamily: 'monospace' }}>{percent}%</Text>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '管理',
|
||||
key: 'action',
|
||||
align: 'right' as const,
|
||||
render: () => (
|
||||
<Space>
|
||||
<Button type="text" size="small" icon={<SettingOutlined />} />
|
||||
<Button type="text" size="small" danger icon={<PoweroffOutlined />} />
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="flex flex-col h-full gap-4">
|
||||
<div className="flex items-center justify-between">
|
||||
<Title level={5} style={{ margin: 0 }}>核心资产管理系统</Title>
|
||||
<Space>
|
||||
<Input
|
||||
prefix={<SearchOutlined style={{ color: 'rgba(0,0,0,0.25)' }} />}
|
||||
placeholder="搜索节点、ID或类型..."
|
||||
style={{ width: 250, borderRadius: 2 }}
|
||||
/>
|
||||
<Button type="primary" icon={<PlusOutlined />} style={{ borderRadius: 2 }}>
|
||||
接入新节点
|
||||
</Button>
|
||||
</Space>
|
||||
</div>
|
||||
return (
|
||||
<div className="flex flex-col h-full gap-4">
|
||||
<div className="flex items-center justify-between">
|
||||
<Title level={5} style={{ margin: 0 }}>核心资产管理系统</Title>
|
||||
<Space>
|
||||
<Input
|
||||
prefix={<SearchOutlined style={{ color: 'rgba(0,0,0,0.25)' }} />}
|
||||
placeholder="搜索节点、ID或类型..."
|
||||
style={{ width: 250, borderRadius: 2 }}
|
||||
/>
|
||||
<Button type="primary" icon={<PlusOutlined />} style={{ borderRadius: 2 }}>
|
||||
接入新节点
|
||||
</Button>
|
||||
</Space>
|
||||
</div>
|
||||
|
||||
<Row gutter={16} className="flex-1 overflow-hidden" style={{ minHeight: 0 }}>
|
||||
<Col flex="auto" className="h-full overflow-hidden">
|
||||
<Card styles={{ body: { padding: 0 } }} className="h-full overflow-hidden flex flex-col">
|
||||
<Table
|
||||
size="small"
|
||||
columns={columns}
|
||||
dataSource={DEVICES.map(d => ({ ...d, key: d.id }))}
|
||||
pagination={false}
|
||||
sticky
|
||||
scroll={{ y: 'calc(100vh - 250px)' }}
|
||||
onRow={(record) => ({
|
||||
onClick: () => setSelectedDeviceId(record.id),
|
||||
className: selectedDeviceId === record.id ? 'bg-blue-50' : '',
|
||||
style: { cursor: 'pointer' }
|
||||
})}
|
||||
/>
|
||||
</Card>
|
||||
</Col>
|
||||
<Row gutter={16} className="flex-1 " style={{ minHeight: 0, flexWrap: 'nowrap', }}>
|
||||
<Col flex="auto" className="h-full overflow-hidden">
|
||||
<Card styles={{ body: { padding: 0 } }} className="h-full overflow-hidden flex flex-col">
|
||||
<Table
|
||||
size="small"
|
||||
columns={columns}
|
||||
dataSource={DEVICES.map(d => ({ ...d, key: d.id }))}
|
||||
pagination={false}
|
||||
sticky
|
||||
scroll={{ y: 'calc(100vh - 250px)' }}
|
||||
onRow={(record) => ({
|
||||
onClick: () => setSelectedDeviceId(record.id),
|
||||
className: selectedDeviceId === record.id ? 'bg-blue-50' : '',
|
||||
style: { cursor: 'pointer' }
|
||||
})}
|
||||
/>
|
||||
</Card>
|
||||
</Col>
|
||||
|
||||
<AnimatePresence>
|
||||
{selectedDevice && (
|
||||
<Col flex="0 0 340px" className="h-full">
|
||||
<motion.div
|
||||
initial={{ x: 340, opacity: 0 }}
|
||||
animate={{ x: 0, opacity: 1 }}
|
||||
exit={{ x: 340, opacity: 0 }}
|
||||
className="h-full"
|
||||
>
|
||||
<Card
|
||||
className="h-full overflow-hidden"
|
||||
styles={{ body: { padding: 0, height: '100%', display: 'flex', flexDirection: 'column' } }}
|
||||
>
|
||||
<div className="p-4 border-b border-gray-100 flex justify-between items-start bg-gray-50">
|
||||
<div>
|
||||
<Text type="secondary" style={{ fontSize: 10, letterSpacing: 2, textTransform: 'uppercase', display: 'block' }}>
|
||||
Asset Intelligence / v4.0
|
||||
</Text>
|
||||
<Title level={4} style={{ margin: '4px 0' }}>{selectedDevice.name}</Title>
|
||||
<Space>
|
||||
<Tag color="blue" bordered={false} style={{ fontSize: 10, fontWeight: 'bold' }}>{selectedDevice.type}</Tag>
|
||||
<Text type="secondary" style={{ fontSize: 11, fontFamily: 'monospace' }}>ID: {selectedDevice.id}</Text>
|
||||
</Space>
|
||||
</div>
|
||||
<Button
|
||||
type="text"
|
||||
icon={<CloseOutlined />}
|
||||
onClick={() => setSelectedDeviceId(null)}
|
||||
/>
|
||||
</div>
|
||||
<AnimatePresence>
|
||||
{selectedDevice && (
|
||||
<Col flex="0 0 340px" className="h-full">
|
||||
<motion.div
|
||||
initial={{ x: 340, opacity: 0 }}
|
||||
animate={{ x: 0, opacity: 1 }}
|
||||
exit={{ x: 340, opacity: 0 }}
|
||||
className="h-full"
|
||||
>
|
||||
<Card
|
||||
className="h-full overflow-hidden"
|
||||
styles={{ body: { padding: 0, height: '100%', display: 'flex', flexDirection: 'column' } }}
|
||||
>
|
||||
<div className="p-4 border-b border-gray-100 flex justify-between items-start bg-gray-50">
|
||||
<div>
|
||||
<Text type="secondary" style={{ fontSize: 10, letterSpacing: 2, textTransform: 'uppercase', display: 'block' }}>
|
||||
Asset Intelligence / v4.0
|
||||
</Text>
|
||||
<Title level={4} style={{ margin: '4px 0' }}>{selectedDevice.name}</Title>
|
||||
<Space>
|
||||
<Tag color="blue" bordered={false} style={{ fontSize: 10, fontWeight: 'bold' }}>{selectedDevice.type}</Tag>
|
||||
<Text type="secondary" style={{ fontSize: 11, fontFamily: 'monospace' }}>ID: {selectedDevice.id}</Text>
|
||||
</Space>
|
||||
</div>
|
||||
<Button
|
||||
type="text"
|
||||
icon={<CloseOutlined />}
|
||||
onClick={() => setSelectedDeviceId(null)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex-1 overflow-y-auto">
|
||||
<Tabs
|
||||
defaultActiveKey="1"
|
||||
className="px-4"
|
||||
items={[
|
||||
{
|
||||
key: '1',
|
||||
label: '基本信息',
|
||||
children: (
|
||||
<div className="space-y-6 pt-4 pb-4">
|
||||
<Descriptions column={1} size="small" bordered>
|
||||
<Descriptions.Item label="设备名称">{selectedDevice.name}</Descriptions.Item>
|
||||
<Descriptions.Item label="设备 ID">{selectedDevice.id}</Descriptions.Item>
|
||||
<Descriptions.Item label="设备类型">{selectedDevice.type}</Descriptions.Item>
|
||||
<Descriptions.Item label="最后心跳">{selectedDevice.lastUpdate}</Descriptions.Item>
|
||||
<Descriptions.Item label="固件版本">FW_2.5.4_REL</Descriptions.Item>
|
||||
<Descriptions.Item label="接入协议">MQTT_SSL</Descriptions.Item>
|
||||
</Descriptions>
|
||||
<div className="flex-1 overflow-y-auto">
|
||||
<Tabs
|
||||
defaultActiveKey="1"
|
||||
className="px-4"
|
||||
items={[
|
||||
{
|
||||
key: '1',
|
||||
label: '基本信息',
|
||||
children: (
|
||||
<div className="space-y-6 pt-4 pb-4">
|
||||
<Descriptions column={1} size="small" bordered>
|
||||
<Descriptions.Item label="设备名称">{selectedDevice.name}</Descriptions.Item>
|
||||
<Descriptions.Item label="设备 ID">{selectedDevice.id}</Descriptions.Item>
|
||||
<Descriptions.Item label="设备类型">{selectedDevice.type}</Descriptions.Item>
|
||||
<Descriptions.Item label="最后心跳">{selectedDevice.lastUpdate}</Descriptions.Item>
|
||||
<Descriptions.Item label="固件版本">FW_2.5.4_REL</Descriptions.Item>
|
||||
<Descriptions.Item label="接入协议">MQTT_SSL</Descriptions.Item>
|
||||
</Descriptions>
|
||||
|
||||
<div className="p-3 bg-blue-50 border border-blue-100 rounded">
|
||||
<Space size="small" align="start">
|
||||
<InfoCircleOutlined style={{ color: '#1890ff', marginTop: 3 }} />
|
||||
<Text type="secondary" style={{ fontSize: 11 }}>
|
||||
该设备目前运行正常,已通过节点身份验证,正在进行全量数据透传。
|
||||
</Text>
|
||||
</Space>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
},
|
||||
{
|
||||
key: '2',
|
||||
label: '运行状态',
|
||||
children: (
|
||||
<div className="space-y-6 pt-4 pb-4">
|
||||
<Row gutter={[12, 12]}>
|
||||
<Col span={12}>
|
||||
<Card size="small" bordered styles={{ body: { padding: 12 } }} style={{ backgroundColor: '#fafafa' }}>
|
||||
<Statistic title={<Space><ClusterOutlined />负载率</Space>} value={selectedDevice.cpu} suffix="%" valueStyle={{ fontSize: 16, fontFamily: 'monospace' }} />
|
||||
</Card>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Card size="small" bordered styles={{ body: { padding: 12 } }} style={{ backgroundColor: '#fafafa' }}>
|
||||
<Statistic title={<Space><HeatMapOutlined />核心温度</Space>} value={selectedDevice.temp} suffix="°C" valueStyle={{ fontSize: 16, fontFamily: 'monospace', color: '#f5222d' }} />
|
||||
</Card>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Card size="small" bordered styles={{ body: { padding: 12 } }} style={{ backgroundColor: '#fafafa' }}>
|
||||
<Statistic title={<Space><ThunderboltOutlined />剩余能量</Space>} value={selectedDevice.battery} suffix="%" valueStyle={{ fontSize: 16, fontFamily: 'monospace', color: '#52c41a' }} />
|
||||
</Card>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Card size="small" bordered styles={{ body: { padding: 12 } }} style={{ backgroundColor: '#fafafa' }}>
|
||||
<Statistic title={<Space><DashboardOutlined />系统健康</Space>} value={98.2} suffix="%" valueStyle={{ fontSize: 16, fontFamily: 'monospace' }} />
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
<div className="p-3 bg-blue-50 border border-blue-100 rounded">
|
||||
<Space size="small" align="start">
|
||||
<InfoCircleOutlined style={{ color: '#1890ff', marginTop: 3 }} />
|
||||
<Text type="secondary" style={{ fontSize: 11 }}>
|
||||
该设备目前运行正常,已通过节点身份验证,正在进行全量数据透传。
|
||||
</Text>
|
||||
</Space>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
},
|
||||
{
|
||||
key: '2',
|
||||
label: '运行状态',
|
||||
children: (
|
||||
<div className="space-y-6 pt-4 pb-4">
|
||||
<Row gutter={[12, 12]}>
|
||||
<Col span={12}>
|
||||
<Card size="small" bordered styles={{ body: { padding: 12 } }} style={{ backgroundColor: '#fafafa' }}>
|
||||
<Statistic title={<Space><ClusterOutlined />负载率</Space>} value={selectedDevice.cpu} suffix="%" valueStyle={{ fontSize: 16, fontFamily: 'monospace' }} />
|
||||
</Card>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Card size="small" bordered styles={{ body: { padding: 12 } }} style={{ backgroundColor: '#fafafa' }}>
|
||||
<Statistic title={<Space><HeatMapOutlined />核心温度</Space>} value={selectedDevice.temp} suffix="°C" valueStyle={{ fontSize: 16, fontFamily: 'monospace', color: '#f5222d' }} />
|
||||
</Card>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Card size="small" bordered styles={{ body: { padding: 12 } }} style={{ backgroundColor: '#fafafa' }}>
|
||||
<Statistic title={<Space><ThunderboltOutlined />剩余能量</Space>} value={selectedDevice.battery} suffix="%" valueStyle={{ fontSize: 16, fontFamily: 'monospace', color: '#52c41a' }} />
|
||||
</Card>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Card size="small" bordered styles={{ body: { padding: 12 } }} style={{ backgroundColor: '#fafafa' }}>
|
||||
<Statistic title={<Space><DashboardOutlined />系统健康</Space>} value={98.2} suffix="%" valueStyle={{ fontSize: 16, fontFamily: 'monospace' }} />
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<div className="pt-2 border-t border-gray-100">
|
||||
<Text strong type="secondary" style={{ fontSize: 11, textTransform: 'uppercase', display: 'block', marginBottom: 12 }}>
|
||||
实时动态 (SIGNAL)
|
||||
</Text>
|
||||
<Space direction="vertical" className="w-full" size="small">
|
||||
<div className="flex justify-between items-center bg-gray-50 p-2 rounded">
|
||||
<Text type="secondary" style={{ fontSize: 11 }}>上行链路速率</Text>
|
||||
<Text style={{ fontFamily: 'monospace', fontSize: 11 }}>1.2 Mbps</Text>
|
||||
</div>
|
||||
<div className="flex justify-between items-center bg-gray-50 p-2 rounded">
|
||||
<Text type="secondary" style={{ fontSize: 11 }}>下行链路速率</Text>
|
||||
<Text style={{ fontFamily: 'monospace', fontSize: 11 }}>0.4 Mbps</Text>
|
||||
</div>
|
||||
<div className="flex justify-between items-center bg-gray-50 p-2 rounded">
|
||||
<Text type="secondary" style={{ fontSize: 11 }}>当前信号强度</Text>
|
||||
<Tag color="success" style={{ margin: 0, fontSize: 10 }}>EXCELLENT</Tag>
|
||||
</div>
|
||||
</Space>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
<div className="pt-2 border-t border-gray-100">
|
||||
<Text strong type="secondary" style={{ fontSize: 11, textTransform: 'uppercase', display: 'block', marginBottom: 12 }}>
|
||||
实时动态 (SIGNAL)
|
||||
</Text>
|
||||
<Space direction="vertical" className="w-full" size="small">
|
||||
<div className="flex justify-between items-center bg-gray-50 p-2 rounded">
|
||||
<Text type="secondary" style={{ fontSize: 11 }}>上行链路速率</Text>
|
||||
<Text style={{ fontFamily: 'monospace', fontSize: 11 }}>1.2 Mbps</Text>
|
||||
</div>
|
||||
<div className="flex justify-between items-center bg-gray-50 p-2 rounded">
|
||||
<Text type="secondary" style={{ fontSize: 11 }}>下行链路速率</Text>
|
||||
<Text style={{ fontFamily: 'monospace', fontSize: 11 }}>0.4 Mbps</Text>
|
||||
</div>
|
||||
<div className="flex justify-between items-center bg-gray-50 p-2 rounded">
|
||||
<Text type="secondary" style={{ fontSize: 11 }}>当前信号强度</Text>
|
||||
<Tag color="success" style={{ margin: 0, fontSize: 10 }}>EXCELLENT</Tag>
|
||||
</div>
|
||||
</Space>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="p-4 border-t border-gray-100 bg-gray-50">
|
||||
<Space direction="vertical" className="w-full" size="small">
|
||||
<Button type="primary" block icon={<ArrowRightOutlined />} style={{ borderRadius: 2 }}>
|
||||
发起远程诊断
|
||||
</Button>
|
||||
<Button block icon={<LineChartOutlined />} style={{ borderRadius: 2 }}>
|
||||
同步设备策略
|
||||
</Button>
|
||||
</Space>
|
||||
</div>
|
||||
</Card>
|
||||
</motion.div>
|
||||
</Col>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
</Row>
|
||||
</div>
|
||||
);
|
||||
<div className="p-4 border-t border-gray-100 bg-gray-50">
|
||||
<Space direction="vertical" className="w-full" size="small">
|
||||
<Button type="primary" block icon={<ArrowRightOutlined />} style={{ borderRadius: 2 }}>
|
||||
发起远程诊断
|
||||
</Button>
|
||||
<Button block icon={<LineChartOutlined />} style={{ borderRadius: 2 }}>
|
||||
同步设备策略
|
||||
</Button>
|
||||
</Space>
|
||||
</div>
|
||||
</Card>
|
||||
</motion.div>
|
||||
</Col>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
</Row>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,150 +1,150 @@
|
||||
import React from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import {
|
||||
Form,
|
||||
Input,
|
||||
Button,
|
||||
Checkbox,
|
||||
Typography,
|
||||
Space,
|
||||
Card,
|
||||
message
|
||||
import {
|
||||
Form,
|
||||
Input,
|
||||
Button,
|
||||
Checkbox,
|
||||
Typography,
|
||||
Space,
|
||||
Card,
|
||||
message
|
||||
} from 'antd';
|
||||
import {
|
||||
UserOutlined,
|
||||
LockOutlined,
|
||||
RocketOutlined,
|
||||
SafetyCertificateOutlined,
|
||||
ArrowRightOutlined
|
||||
import {
|
||||
UserOutlined,
|
||||
LockOutlined,
|
||||
RocketOutlined,
|
||||
SafetyCertificateOutlined,
|
||||
ArrowRightOutlined
|
||||
} from '@ant-design/icons';
|
||||
import { motion } from 'motion/react';
|
||||
|
||||
const { Text, Title } = Typography;
|
||||
|
||||
export default function Login() {
|
||||
const navigate = useNavigate();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const onFinish = (values: any) => {
|
||||
// 模拟登录逻辑
|
||||
console.log('Login attempt:', values);
|
||||
|
||||
// 根据用户名模拟不同的角色用于演示
|
||||
let role = 'viewer';
|
||||
let name = '观察员';
|
||||
|
||||
if (values.username === 'admin') {
|
||||
role = 'admin';
|
||||
name = '系统管理员';
|
||||
} else if (values.username === 'operator') {
|
||||
role = 'operator';
|
||||
name = '操作员';
|
||||
}
|
||||
const onFinish = (values: any) => {
|
||||
// 模拟登录逻辑
|
||||
console.log('Login attempt:', values);
|
||||
|
||||
// 存储用户信息
|
||||
const userInfo = {
|
||||
username: values.username,
|
||||
name: name,
|
||||
role: role,
|
||||
avatar: `https://api.dicebear.com/7.x/avataaars/svg?seed=${values.username}`
|
||||
};
|
||||
// 根据用户名模拟不同的角色用于演示
|
||||
let role = 'viewer';
|
||||
let name = '观察员';
|
||||
|
||||
localStorage.setItem('isAuthenticated', 'true');
|
||||
localStorage.setItem('token', 'mock_token_' + Date.now()); // 模拟 Token
|
||||
localStorage.setItem('user', JSON.stringify(userInfo));
|
||||
if (values.username === 'admin') {
|
||||
role = 'admin';
|
||||
name = '系统管理员';
|
||||
} else if (values.username === 'operator') {
|
||||
role = 'operator';
|
||||
name = '操作员';
|
||||
}
|
||||
|
||||
message.success(`欢迎回来, ${name}`);
|
||||
navigate('/');
|
||||
};
|
||||
// 存储用户信息
|
||||
const userInfo = {
|
||||
username: values.username,
|
||||
name: name,
|
||||
role: role,
|
||||
avatar: `https://api.dicebear.com/7.x/avataaars/svg?seed=${values.username}`
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-[#001529] flex items-center justify-center p-4 relative overflow-hidden">
|
||||
{/* Background Decor */}
|
||||
<div className="absolute inset-0 overflow-hidden pointer-events-none opacity-20">
|
||||
<div className="absolute top-0 left-0 w-full h-full bg-[radial-gradient(circle_at_50%_50%,#1890ff_0%,transparent_50%)] opacity-20" />
|
||||
</div>
|
||||
localStorage.setItem('isAuthenticated', 'true');
|
||||
localStorage.setItem('token', 'mock_token_' + Date.now()); // 模拟 Token
|
||||
localStorage.setItem('user', JSON.stringify(userInfo));
|
||||
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
style={{ width: '100%', maxWidth: 400 }}
|
||||
>
|
||||
<Card
|
||||
bordered={false}
|
||||
className="shadow-2xl overflow-hidden"
|
||||
styles={{ body: { padding: 0 } }}
|
||||
>
|
||||
{/* Header */}
|
||||
<div className="bg-[#001529] p-8 text-center border-b border-white/10">
|
||||
<div className="inline-flex items-center justify-center w-12 h-12 rounded bg-blue-500/10 text-[#1890ff] mb-4 border border-blue-500/20">
|
||||
<RocketOutlined style={{ fontSize: 24 }} />
|
||||
</div>
|
||||
<Title level={4} style={{ color: '#fff', margin: 0, letterSpacing: 1 }}>RobotMaster AI</Title>
|
||||
<Text style={{ color: 'rgba(255,255,255,0.45)', fontSize: 10, marginTop: 4, display: 'block', letterSpacing: 2 }}>机器人智慧服务系统</Text>
|
||||
</div>
|
||||
message.success(`欢迎回来, ${name}`);
|
||||
navigate('/');
|
||||
};
|
||||
|
||||
{/* Form */}
|
||||
<div className="p-8">
|
||||
<Form
|
||||
name="login"
|
||||
layout="vertical"
|
||||
onFinish={onFinish}
|
||||
autoComplete="off"
|
||||
size="large"
|
||||
>
|
||||
<Form.Item
|
||||
label={<Text strong type="secondary" style={{ fontSize: 11, textTransform: 'uppercase' }}><UserOutlined style={{ color: '#1890ff', marginRight: 8 }} />账号名称</Text>}
|
||||
name="username"
|
||||
rules={[{ required: true, message: '请输入管理员账号' }]}
|
||||
>
|
||||
<Input placeholder="请输入管理员账号" style={{ borderRadius: 2 }} />
|
||||
</Form.Item>
|
||||
return (
|
||||
<div className="min-h-screen bg-[#001529] flex items-center justify-center p-4 relative overflow-hidden">
|
||||
{/* Background Decor */}
|
||||
<div className="absolute inset-0 overflow-hidden pointer-events-none opacity-20">
|
||||
<div className="absolute top-0 left-0 w-full h-full bg-[radial-gradient(circle_at_50%_50%,#1890ff_0%,transparent_50%)] opacity-20" />
|
||||
</div>
|
||||
|
||||
<Form.Item
|
||||
label={<Text strong type="secondary" style={{ fontSize: 11, textTransform: 'uppercase' }}><LockOutlined style={{ color: '#1890ff', marginRight: 8 }} />访问令牌 / 密码</Text>}
|
||||
name="password"
|
||||
rules={[{ required: true, message: '请输入密码' }]}
|
||||
>
|
||||
<Input.Password placeholder="••••••••" style={{ borderRadius: 2 }} />
|
||||
</Form.Item>
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
style={{ width: '100%', maxWidth: 400 }}
|
||||
>
|
||||
<Card
|
||||
bordered={false}
|
||||
className="shadow-2xl overflow-hidden"
|
||||
styles={{ body: { padding: 0 } }}
|
||||
>
|
||||
{/* Header */}
|
||||
<div className="bg-[#001529] p-8 text-center border-b border-white/10">
|
||||
<div className="inline-flex items-center justify-center w-12 h-12 rounded bg-blue-500/10 text-[#1890ff] mb-4 border border-blue-500/20">
|
||||
<RocketOutlined style={{ fontSize: 24 }} />
|
||||
</div>
|
||||
<Title level={4} style={{ color: '#fff', margin: 0, letterSpacing: 1 }}>机器人智慧服务系统</Title>
|
||||
<Text style={{ color: 'rgba(255,255,255,0.45)', fontSize: 10, marginTop: 4, display: 'block', letterSpacing: 2 }}>机器人智慧服务系统</Text>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-between mb-6">
|
||||
<Form.Item name="remember" valuePropName="checked" noStyle>
|
||||
<Checkbox><Text type="secondary" style={{ fontSize: 12 }}>记住会话</Text></Checkbox>
|
||||
</Form.Item>
|
||||
<Button type="link" size="small" style={{ fontSize: 12 }}>找回凭据?</Button>
|
||||
</div>
|
||||
{/* Form */}
|
||||
<div className="p-8">
|
||||
<Form
|
||||
name="login"
|
||||
layout="vertical"
|
||||
onFinish={onFinish}
|
||||
autoComplete="off"
|
||||
size="large"
|
||||
>
|
||||
<Form.Item
|
||||
label={<Text strong type="secondary" style={{ fontSize: 11, textTransform: 'uppercase' }}><UserOutlined style={{ color: '#1890ff', marginRight: 8 }} />账号名称</Text>}
|
||||
name="username"
|
||||
rules={[{ required: true, message: '请输入管理员账号' }]}
|
||||
>
|
||||
<Input placeholder="请输入管理员账号" style={{ borderRadius: 2 }} />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item>
|
||||
<Button
|
||||
type="primary"
|
||||
htmlType="submit"
|
||||
block
|
||||
icon={<SafetyCertificateOutlined />}
|
||||
style={{ borderRadius: 2, height: 44, fontWeight: 'bold', fontSize: 14 }}
|
||||
>
|
||||
核验并进入系统 <ArrowRightOutlined />
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</div>
|
||||
<Form.Item
|
||||
label={<Text strong type="secondary" style={{ fontSize: 11, textTransform: 'uppercase' }}><LockOutlined style={{ color: '#1890ff', marginRight: 8 }} />访问令牌 / 密码</Text>}
|
||||
name="password"
|
||||
rules={[{ required: true, message: '请输入密码' }]}
|
||||
>
|
||||
<Input.Password placeholder="••••••••" style={{ borderRadius: 2 }} />
|
||||
</Form.Item>
|
||||
|
||||
{/* Footer */}
|
||||
<div className="px-8 py-4 bg-gray-50 border-t border-gray-100 flex justify-between items-center">
|
||||
<Text type="secondary" style={{ fontSize: 10, fontFamily: 'monospace' }}>System Version: v4.2.1-stable</Text>
|
||||
<Space size={4}>
|
||||
<div className="w-1.5 h-1.5 rounded-full bg-green-500 animate-pulse" />
|
||||
<Text strong type="secondary" style={{ fontSize: 10, textTransform: 'uppercase' }}>Server Online</Text>
|
||||
</Space>
|
||||
</div>
|
||||
</Card>
|
||||
</motion.div>
|
||||
<div className="flex items-center justify-between mb-6">
|
||||
<Form.Item name="remember" valuePropName="checked" noStyle>
|
||||
<Checkbox><Text type="secondary" style={{ fontSize: 12 }}>记住会话</Text></Checkbox>
|
||||
</Form.Item>
|
||||
<Button type="link" size="small" style={{ fontSize: 12 }}>找回凭据?</Button>
|
||||
</div>
|
||||
|
||||
{/* Security Notice */}
|
||||
<div className="absolute bottom-8 text-center w-full px-4">
|
||||
<Text strong style={{ color: 'rgba(255,255,255,0.2)', fontSize: 10, letterSpacing: 4 }}>
|
||||
AUTHORIZED PERSONNEL ONLY | ENCRYPTED LINK | TRACE ENABLED
|
||||
</Text>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
<Form.Item>
|
||||
<Button
|
||||
type="primary"
|
||||
htmlType="submit"
|
||||
block
|
||||
icon={<SafetyCertificateOutlined />}
|
||||
style={{ borderRadius: 2, height: 44, fontWeight: 'bold', fontSize: 14 }}
|
||||
>
|
||||
核验并进入系统 <ArrowRightOutlined />
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</div>
|
||||
|
||||
{/* Footer */}
|
||||
<div className="px-8 py-4 bg-gray-50 border-t border-gray-100 flex justify-between items-center">
|
||||
<Text type="secondary" style={{ fontSize: 10, fontFamily: 'monospace' }}>System Version: v4.2.1-stable</Text>
|
||||
<Space size={4}>
|
||||
<div className="w-1.5 h-1.5 rounded-full bg-green-500 animate-pulse" />
|
||||
<Text strong type="secondary" style={{ fontSize: 10, textTransform: 'uppercase' }}>Server Online</Text>
|
||||
</Space>
|
||||
</div>
|
||||
</Card>
|
||||
</motion.div>
|
||||
|
||||
{/* Security Notice */}
|
||||
<div className="absolute bottom-8 text-center w-full px-4">
|
||||
<Text strong style={{ color: 'rgba(255,255,255,0.2)', fontSize: 10, letterSpacing: 4 }}>
|
||||
AUTHORIZED PERSONNEL ONLY | ENCRYPTED LINK | TRACE ENABLED
|
||||
</Text>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
260
src/pages/SerialNumGenerate.jsx
Normal file
260
src/pages/SerialNumGenerate.jsx
Normal file
@@ -0,0 +1,260 @@
|
||||
import React, { useState, useRef } from 'react';
|
||||
import { Form, Select, Input, Button, Space, message, Card, Typography, Row, Col } from 'antd';
|
||||
import QRCode from 'qrcode';
|
||||
import axios from 'axios';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
const SerialNumGenerate = () => {
|
||||
const [form] = Form.useForm();
|
||||
const [qrUrl, setQrUrl] = useState('');
|
||||
const [qrText, setQrText] = useState('');
|
||||
const [loading, setLoading] = useState(false);
|
||||
const qrRef = useRef(null);
|
||||
|
||||
// 查询状态
|
||||
const [queryCode, setQueryCode] = useState('');
|
||||
const [queryLoading, setQueryLoading] = useState(false);
|
||||
|
||||
const initialValues = {
|
||||
model: 'MC700',
|
||||
config: 'AIR',
|
||||
country: '中国',
|
||||
province: '江苏',
|
||||
code: '',
|
||||
type: 'mower',
|
||||
};
|
||||
|
||||
// 生成二维码(纯字符串+显示明文)
|
||||
const generateQRCode = async () => {
|
||||
try {
|
||||
const values = await form.validateFields();
|
||||
const timestamp = new Date().getTime();
|
||||
const qrContent = `${values.model}-${values.config}-${values.type}-${values.country}-${values.province}-${values.code}-${timestamp}`;
|
||||
|
||||
const url = await QRCode.toDataURL(qrContent);
|
||||
setQrUrl(url);
|
||||
setQrText(qrContent);
|
||||
message.success('二维码生成成功!');
|
||||
} catch (error) {
|
||||
message.error('请完善信息');
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
// 保存到数据库
|
||||
const saveToDatabase = async () => {
|
||||
if (!qrUrl) {
|
||||
message.warning('先生成二维码');
|
||||
return;
|
||||
}
|
||||
setLoading(true);
|
||||
try {
|
||||
const values = await form.validateFields();
|
||||
const timestamp = new Date().getTime();
|
||||
const data = { ...values, timestamp, qrCode: qrUrl, qrText: qrText };
|
||||
await axios.post('/api/save-qrcode', data);
|
||||
message.success('已保存到数据库!');
|
||||
} catch (err) {
|
||||
message.error('保存失败');
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
// 查询二维码
|
||||
const handleQueryQRCode = async () => {
|
||||
if (!queryCode) {
|
||||
message.warning('请输入编号');
|
||||
return;
|
||||
}
|
||||
setQueryLoading(true);
|
||||
try {
|
||||
const res = await axios.get('/api/query-qrcode', { params: { code: queryCode } });
|
||||
if (res.data?.qrCode) {
|
||||
setQrUrl(res.data.qrCode);
|
||||
setQrText(res.data.qrText || '');
|
||||
message.success('查询成功!');
|
||||
} else {
|
||||
message.warning('未找到该编号的二维码');
|
||||
}
|
||||
} catch (err) {
|
||||
message.error('查询失败');
|
||||
} finally {
|
||||
setQueryLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div style={{ padding: '40px 20px', background: '#f0f2f5', minHeight: '100vh' }}>
|
||||
<Card
|
||||
title="序列号二维码生成器"
|
||||
style={{
|
||||
maxWidth: 900,
|
||||
margin: '0 auto',
|
||||
borderRadius: 12,
|
||||
boxShadow: '0 4px 20px rgba(0,0,0,0.08)',
|
||||
padding: '20px',
|
||||
}}
|
||||
headStyle={{
|
||||
fontSize: '20px',
|
||||
fontWeight: 600,
|
||||
textAlign: 'center',
|
||||
borderBottom: '1px solid #f0f0f0',
|
||||
paddingBottom: 16,
|
||||
}}
|
||||
>
|
||||
{/* 核心:Row+Col 左右分栏布局 */}
|
||||
<Row gutter={[32, 24]}>
|
||||
{/* 左侧:表单区域 */}
|
||||
<Col xs={24} md={14}>
|
||||
<Form
|
||||
form={form}
|
||||
initialValues={initialValues}
|
||||
labelCol={{ md: 5 }}
|
||||
wrapperCol={{ md: 19 }}
|
||||
size="large"
|
||||
>
|
||||
<Form.Item name="model" label="型号" rules={[{ required: true, message: '请选择型号' }]}>
|
||||
<Select placeholder="选择型号">
|
||||
<Select.Option value="MC700">MC700</Select.Option>
|
||||
<Select.Option value="MC800">MC800</Select.Option>
|
||||
<Select.Option value="MC900">MC900</Select.Option>
|
||||
</Select>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item name="config" label="配置" rules={[{ required: true, message: '请选择配置' }]}>
|
||||
<Select placeholder="选择配置">
|
||||
<Select.Option value="AIR">AIR</Select.Option>
|
||||
<Select.Option value="PRO">PRO</Select.Option>
|
||||
<Select.Option value="MAX">MAX</Select.Option>
|
||||
</Select>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item name="type" label="类型" rules={[{ required: true, message: '请选择类型' }]}>
|
||||
<Select placeholder="选择类型">
|
||||
<Select.Option value="mower">割草机</Select.Option>
|
||||
<Select.Option value="vacuum">巡检机</Select.Option>
|
||||
</Select>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item name="country" label="国家" rules={[{ required: true, message: '请选择国家' }]}>
|
||||
<Select placeholder="选择国家">
|
||||
<Select.Option value="中国">中国</Select.Option>
|
||||
<Select.Option value="美国">美国</Select.Option>
|
||||
<Select.Option value="日本">日本</Select.Option>
|
||||
</Select>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item name="province" label="省份" rules={[{ required: true, message: '请选择省份' }]}>
|
||||
<Select placeholder="选择省份">
|
||||
<Select.Option value="江苏">江苏</Select.Option>
|
||||
<Select.Option value="浙江">浙江</Select.Option>
|
||||
<Select.Option value="广东">广东</Select.Option>
|
||||
</Select>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item name="code" label="编号" rules={[{ required: true, message: '请输入编号' }]}>
|
||||
<Input placeholder="请输入唯一编号" />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item wrapperCol={{ offset: 5 }} style={{ marginTop: 10 }}>
|
||||
<Button type="primary" onClick={generateQRCode} block>
|
||||
生成二维码(带时间戳)
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
|
||||
{/* 查询区域(放在左侧底部) */}
|
||||
<div style={{
|
||||
marginTop: 20,
|
||||
padding: '16px',
|
||||
background: '#f9fbfc',
|
||||
borderRadius: 8,
|
||||
border: '1px solid #e8e8e8'
|
||||
}}>
|
||||
<div style={{ marginBottom: 10, fontWeight: 500, color: '#1677ff' }}>
|
||||
🔍 查询历史二维码
|
||||
</div>
|
||||
<Space.Compact style={{ width: '100%' }}>
|
||||
<Input
|
||||
placeholder="输入编号查询"
|
||||
value={queryCode}
|
||||
onChange={(e) => setQueryCode(e.target.value)}
|
||||
/>
|
||||
<Button type="primary" loading={queryLoading} onClick={handleQueryQRCode}>
|
||||
查询二维码
|
||||
</Button>
|
||||
</Space.Compact>
|
||||
</div>
|
||||
</Col>
|
||||
|
||||
{/* 右侧:二维码内容+图片区域(固定在右侧,不拉长页面) */}
|
||||
<Col xs={24} md={10}>
|
||||
<div style={{
|
||||
height: '100%',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
padding: '20px',
|
||||
background: '#fafafa',
|
||||
borderRadius: 12,
|
||||
border: '1px dashed #d9d9d9',
|
||||
minHeight: 480,
|
||||
}}>
|
||||
{/* 二维码内容文字(右侧顶部) */}
|
||||
{qrText && (
|
||||
<div style={{
|
||||
padding: '12px 16px',
|
||||
background: '#e6f7ff',
|
||||
borderRadius: 8,
|
||||
marginBottom: 20,
|
||||
width: '100%',
|
||||
textAlign: 'center',
|
||||
}}>
|
||||
<Text strong style={{ fontSize: 14, color: '#0050b3', wordBreak: 'break-all' }}>
|
||||
二维码内容:{qrText}
|
||||
</Text>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 二维码图片(右侧中间) */}
|
||||
{qrUrl ? (
|
||||
<div style={{ textAlign: 'center' }}>
|
||||
<img
|
||||
ref={qrRef}
|
||||
src={qrUrl}
|
||||
alt="二维码"
|
||||
style={{
|
||||
width: 240,
|
||||
height: 240,
|
||||
borderRadius: 8,
|
||||
boxShadow: '0 2px 12px rgba(0,0,0,0.1)',
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<div style={{ color: '#999', textAlign: 'center', padding: '60px 0' }}>
|
||||
请先生成二维码
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 操作按钮(右侧底部) */}
|
||||
<Space size="middle" style={{ marginTop: 24 }}>
|
||||
<Button onClick={() => qrRef.current && window.open(qrRef.current.src)}>
|
||||
下载二维码
|
||||
</Button>
|
||||
<Button type="primary" loading={loading} onClick={saveToDatabase}>
|
||||
保存到数据库
|
||||
</Button>
|
||||
</Space>
|
||||
</div>
|
||||
</Col>
|
||||
</Row>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default SerialNumGenerate;
|
||||
@@ -10,53 +10,58 @@ import Alerts from '../pages/Alerts';
|
||||
import Downloads from '../pages/Downloads';
|
||||
import Roles from '../pages/Roles';
|
||||
import Users from '../pages/Users';
|
||||
import SerialNumGenerate from '../pages/SerialNumGenerate';
|
||||
|
||||
export const router = createBrowserRouter([
|
||||
{
|
||||
path: '/login',
|
||||
element: <Login />,
|
||||
},
|
||||
{
|
||||
element: <ProtectedRoute />,
|
||||
children: [
|
||||
{
|
||||
path: '/',
|
||||
element: <Layout />,
|
||||
children: [
|
||||
{
|
||||
index: true,
|
||||
element: <Home />,
|
||||
},
|
||||
{
|
||||
path: 'devices',
|
||||
element: <Devices />,
|
||||
},
|
||||
{
|
||||
path: 'video',
|
||||
element: <VideoControl />,
|
||||
},
|
||||
{
|
||||
path: 'alerts',
|
||||
element: <Alerts />,
|
||||
},
|
||||
{
|
||||
path: 'downloads',
|
||||
element: <Downloads />,
|
||||
},
|
||||
{
|
||||
path: 'roles',
|
||||
element: <Roles />,
|
||||
},
|
||||
{
|
||||
path: 'users',
|
||||
element: <Users />,
|
||||
},
|
||||
{
|
||||
path: '*',
|
||||
element: <div className="p-10 text-center font-bold text-gray-400">模块开发中...</div>,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
element: <Login />,
|
||||
},
|
||||
{
|
||||
element: <ProtectedRoute />,
|
||||
children: [
|
||||
{
|
||||
path: '/',
|
||||
element: <Layout />,
|
||||
children: [
|
||||
{
|
||||
index: true,
|
||||
element: <Home />,
|
||||
},
|
||||
{
|
||||
path: 'devices',
|
||||
element: <Devices />,
|
||||
},
|
||||
{
|
||||
path: 'video',
|
||||
element: <VideoControl />,
|
||||
},
|
||||
{
|
||||
path: 'alerts',
|
||||
element: <Alerts />,
|
||||
},
|
||||
{
|
||||
path: 'downloads',
|
||||
element: <Downloads />,
|
||||
},
|
||||
{
|
||||
path: 'roles',
|
||||
element: <Roles />,
|
||||
},
|
||||
{
|
||||
path: 'users',
|
||||
element: <Users />,
|
||||
},
|
||||
{
|
||||
path: 'serialNumGenerate',
|
||||
element: <SerialNumGenerate />,
|
||||
},
|
||||
{
|
||||
path: '*',
|
||||
element: <div className="p-10 text-center font-bold text-gray-400">模块开发中...</div>,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user