feat: 完成插件管理系统产品化P0闭环落地
此提交实现完整的插件管理产品化闭环: 1. 中心机新增Ed25519密钥、审计/运行上报表、插件扩展字段,实现票据/管控清单签发、鉴权下载能力 2. 部署端新增设备级单活调度器、用户私有插件库、离线/联网校验链、插件下载安装流程 3. 控制面与部署前端同步更新UI与接口适配,新增审计页、插件管理增强功能 4. 修复两个工作流脚本的过滤与Excel导出问题,优化打包依赖与日志面板 5. 新增完整架构设计与实施文档
This commit is contained in:
+888
-33
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -350,6 +350,120 @@
|
||||
('copy',
|
||||
'C:\\Users\\admin\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\copy.py',
|
||||
'PYMODULE'),
|
||||
('cryptography',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\__init__.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.__about__',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\__about__.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.exceptions',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\exceptions.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\__init__.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat._oid',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\_oid.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.backends',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\backends\\__init__.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.backends.openssl',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\backends\\openssl\\__init__.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.backends.openssl.backend',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\backends\\openssl\\backend.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.bindings',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\bindings\\__init__.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.bindings.openssl',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\bindings\\openssl\\__init__.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.bindings.openssl._conditional',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\bindings\\openssl\\_conditional.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.bindings.openssl.binding',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\bindings\\openssl\\binding.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.decrepit',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\decrepit\\__init__.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.decrepit.ciphers',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\decrepit\\ciphers\\__init__.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.decrepit.ciphers.algorithms',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\decrepit\\ciphers\\algorithms.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.decrepit.ciphers.modes',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\decrepit\\ciphers\\modes.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.primitives',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\primitives\\__init__.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.primitives._asymmetric',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\primitives\\_asymmetric.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.primitives._cipheralgorithm',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\primitives\\_cipheralgorithm.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.primitives._modes',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\primitives\\_modes.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.primitives._serialization',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\primitives\\_serialization.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.primitives.asymmetric',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\primitives\\asymmetric\\__init__.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.primitives.asymmetric.dh',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\primitives\\asymmetric\\dh.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.primitives.asymmetric.dsa',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\primitives\\asymmetric\\dsa.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.primitives.asymmetric.ec',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\primitives\\asymmetric\\ec.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.primitives.asymmetric.ed25519',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\primitives\\asymmetric\\ed25519.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.primitives.asymmetric.padding',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\primitives\\asymmetric\\padding.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.primitives.asymmetric.rsa',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\primitives\\asymmetric\\rsa.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.primitives.asymmetric.utils',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\primitives\\asymmetric\\utils.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.primitives.ciphers',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\primitives\\ciphers\\__init__.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.primitives.ciphers.algorithms',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\primitives\\ciphers\\algorithms.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.primitives.ciphers.base',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\primitives\\ciphers\\base.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.primitives.ciphers.modes',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\primitives\\ciphers\\modes.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.primitives.hashes',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\primitives\\hashes.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.primitives.serialization',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\primitives\\serialization\\__init__.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.primitives.serialization.base',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\primitives\\serialization\\base.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.hazmat.primitives.serialization.ssh',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\hazmat\\primitives\\serialization\\ssh.py',
|
||||
'PYMODULE'),
|
||||
('cryptography.utils',
|
||||
'D:\\work\\code\\37duAutomation\\.venv\\Lib\\site-packages\\cryptography\\utils.py',
|
||||
'PYMODULE'),
|
||||
('csv',
|
||||
'C:\\Users\\admin\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\csv.py',
|
||||
'PYMODULE'),
|
||||
|
||||
Binary file not shown.
@@ -25,7 +25,7 @@ missing module named termios - imported by click._termui_impl (conditional), tty
|
||||
missing module named 'java.lang' - imported by platform (delayed, optional), xml.sax._exceptions (conditional)
|
||||
missing module named multiprocessing.BufferTooShort - imported by multiprocessing (top-level), multiprocessing.connection (top-level)
|
||||
missing module named multiprocessing.AuthenticationError - imported by multiprocessing (top-level), multiprocessing.connection (top-level)
|
||||
missing module named posix - imported by os (conditional, optional), posixpath (optional), shutil (conditional), importlib._bootstrap_external (conditional)
|
||||
missing module named posix - imported by posixpath (optional), shutil (conditional), importlib._bootstrap_external (conditional), os (conditional, optional)
|
||||
missing module named resource - imported by posix (top-level)
|
||||
missing module named _frozen_importlib_external - imported by importlib._bootstrap (delayed), importlib (optional), importlib.abc (optional), zipimport (top-level)
|
||||
excluded module named _frozen_importlib - imported by importlib (optional), importlib.abc (optional), zipimport (top-level)
|
||||
@@ -63,6 +63,7 @@ missing module named a2wsgi - imported by uvicorn.middleware.wsgi (optional)
|
||||
missing module named uvloop - imported by anyio._backends._asyncio (delayed, conditional), uvicorn.loops.auto (delayed, optional), uvicorn.loops.uvloop (top-level)
|
||||
missing module named 'IPython.core' - imported by dotenv.ipython (top-level)
|
||||
missing module named IPython - imported by dotenv.ipython (top-level)
|
||||
missing module named bcrypt - imported by cryptography.hazmat.primitives.serialization.ssh (optional)
|
||||
missing module named pydantic.BaseModel - imported by pydantic (conditional), pydantic._internal._typing_extra (conditional), pydantic._internal._core_utils (delayed), pydantic._internal._import_utils (delayed, conditional), pydantic.deprecated.copy_internals (delayed, conditional), fastapi.exceptions (top-level), fastapi.types (top-level), fastapi._compat.shared (top-level), fastapi._compat.v2 (top-level), fastapi.openapi.models (top-level), fastapi.security.http (top-level), fastapi.dependencies.utils (top-level), fastapi.encoders (top-level), fastapi.sse (top-level), fastapi.openapi.utils (top-level), D:\work\code\37duAutomation\controlplane\app.py (top-level)
|
||||
missing module named cython - imported by pydantic.v1.version (optional)
|
||||
missing module named email_validator - imported by pydantic.networks (delayed, conditional, optional), pydantic.v1.networks (delayed, conditional, optional), fastapi.openapi.models (optional), pydantic.v1._hypothesis_plugin (optional)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Generated
+167
@@ -10,6 +10,7 @@
|
||||
"dependencies": {
|
||||
"@element-plus/icons-vue": "^2.3.2",
|
||||
"element-plus": "^2.14.5",
|
||||
"naive-ui": "^2.45.3",
|
||||
"vue": "^3.5.13"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -63,6 +64,24 @@
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@css-render/plugin-bem": {
|
||||
"version": "0.15.14",
|
||||
"resolved": "https://registry.npmjs.org/@css-render/plugin-bem/-/plugin-bem-0.15.14.tgz",
|
||||
"integrity": "sha512-QK513CJ7yEQxm/P3EwsI+d+ha8kSOcjGvD6SevM41neEMxdULE+18iuQK6tEChAWMOQNQPLG/Rw3Khb69r5neg==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"css-render": "~0.15.14"
|
||||
}
|
||||
},
|
||||
"node_modules/@css-render/vue3-ssr": {
|
||||
"version": "0.15.14",
|
||||
"resolved": "https://registry.npmjs.org/@css-render/vue3-ssr/-/vue3-ssr-0.15.14.tgz",
|
||||
"integrity": "sha512-//8027GSbxE9n3QlD73xFY6z4ZbHbvrOVB7AO6hsmrEzGbg+h2A09HboUyDgu+xsmj7JnvJD39Irt+2D0+iV8g==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"vue": "^3.0.11"
|
||||
}
|
||||
},
|
||||
"node_modules/@ctrl/tinycolor": {
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@ctrl/tinycolor/-/tinycolor-4.2.1.tgz",
|
||||
@@ -81,6 +100,12 @@
|
||||
"vue": "^3.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@emotion/hash": {
|
||||
"version": "0.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.8.0.tgz",
|
||||
"integrity": "sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@esbuild/aix-ppc64": {
|
||||
"version": "0.25.12",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz",
|
||||
@@ -554,6 +579,12 @@
|
||||
"integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@juggle/resize-observer": {
|
||||
"version": "3.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@juggle/resize-observer/-/resize-observer-3.4.0.tgz",
|
||||
"integrity": "sha512-dfLbk+PwWvFzSxwk3n5ySL0hfBog779o8h68wK/7/APo/7cgyWp5jcXockbxdk5kFRkbeXWm4Fbi9FrdN381sA==",
|
||||
"license": "Apache-2.0"
|
||||
},
|
||||
"node_modules/@napi-rs/lzma-linux-x64-gnu": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.5.1.tgz",
|
||||
@@ -1158,12 +1189,47 @@
|
||||
"integrity": "sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/css-render": {
|
||||
"version": "0.15.14",
|
||||
"resolved": "https://registry.npmjs.org/css-render/-/css-render-0.15.14.tgz",
|
||||
"integrity": "sha512-9nF4PdUle+5ta4W5SyZdLCCmFd37uVimSjg1evcTqKJCyvCEEj12WKzOSBNak6r4im4J4iYXKH1OWpUV5LBYFg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@emotion/hash": "~0.8.0",
|
||||
"csstype": "~3.0.5"
|
||||
}
|
||||
},
|
||||
"node_modules/css-render/node_modules/csstype": {
|
||||
"version": "3.0.11",
|
||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.11.tgz",
|
||||
"integrity": "sha512-sa6P2wJ+CAbgyy4KFssIb/JNMLxFvKF1pCYCSXS8ZMuqZnMsrxqI2E5sPyoTpxoPU/gVZMzr2zjOfg8GIZOMsw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/csstype": {
|
||||
"version": "3.2.3",
|
||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
|
||||
"integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/date-fns": {
|
||||
"version": "4.4.0",
|
||||
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-4.4.0.tgz",
|
||||
"integrity": "sha512-+1UMbeh68lH1SegH83CGWwpb6OHHbpSgr3+s5Eww5M4CAgswBpoWS0AjTOfEJ33HiYKz1hdj/KTFprzXHmq/6w==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/kossnocorp"
|
||||
}
|
||||
},
|
||||
"node_modules/date-fns-tz": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/date-fns-tz/-/date-fns-tz-3.2.0.tgz",
|
||||
"integrity": "sha512-sg8HqoTEulcbbbVXeg84u5UnlsQa8GS5QXMqjjYIhS4abEVVKIUwe0/l/UhrZdKaL/W5eWZNlbTeEIiOXTcsBQ==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"date-fns": "^3.0.0 || ^4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/dayjs": {
|
||||
"version": "1.11.23",
|
||||
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.23.tgz",
|
||||
@@ -1256,6 +1322,12 @@
|
||||
"integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/evtd": {
|
||||
"version": "0.2.4",
|
||||
"resolved": "https://registry.npmjs.org/evtd/-/evtd-0.2.4.tgz",
|
||||
"integrity": "sha512-qaeGN5bx63s/AXgQo8gj6fBkxge+OoLddLniox5qtLAEY5HSnuSlISXVPxnSae1dWblvTh4/HoMIB+mbMsvZzw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/fdir": {
|
||||
"version": "6.5.0",
|
||||
"resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
|
||||
@@ -1289,6 +1361,15 @@
|
||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/highlight.js": {
|
||||
"version": "11.12.0",
|
||||
"resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.12.0.tgz",
|
||||
"integrity": "sha512-nbfWpyRMcMrPMmDwJB+dhX/eiaPKtc2RB+0QZskqJ3WjRA/FDS0e9hZrx8EC/lbEv8gXy98FcDbNa/dspAaJMg==",
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/lodash": {
|
||||
"version": "4.18.1",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz",
|
||||
@@ -1327,6 +1408,38 @@
|
||||
"integrity": "sha512-rkpe71W0N0c0Xz6QD0eJETuWAJGnJ9afsl1srmwPrI+yBCkge5EycXXbYRyvL29zZVUWQCY7InPRCv3GDXuZNw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/naive-ui": {
|
||||
"version": "2.45.3",
|
||||
"resolved": "https://registry.npmjs.org/naive-ui/-/naive-ui-2.45.3.tgz",
|
||||
"integrity": "sha512-D83gJ+6zUdkQ5DuUbmlfyaM1t8pV5WMPa6KmL9mByqQuiL12qBdA0n/iEIth4dQw1x/duNGpOS2anpt5FKO1kw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@css-render/plugin-bem": "^0.15.14",
|
||||
"@css-render/vue3-ssr": "^0.15.14",
|
||||
"@types/lodash": "^4.17.20",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"async-validator": "^4.2.5",
|
||||
"css-render": "^0.15.14",
|
||||
"csstype": "^3.1.3",
|
||||
"date-fns": "^4.1.0",
|
||||
"date-fns-tz": "^3.2.0",
|
||||
"evtd": "^0.2.4",
|
||||
"highlight.js": "^11.8.0",
|
||||
"lodash": "^4.17.21",
|
||||
"lodash-es": "^4.17.21",
|
||||
"seemly": "^0.3.10",
|
||||
"treemate": "^0.3.11",
|
||||
"vdirs": "^0.1.8",
|
||||
"vooks": "^0.2.12",
|
||||
"vueuc": "^0.4.66"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vue": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/nanoid": {
|
||||
"version": "3.3.18",
|
||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.18.tgz",
|
||||
@@ -1444,6 +1557,12 @@
|
||||
"fsevents": "~2.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/seemly": {
|
||||
"version": "0.3.10",
|
||||
"resolved": "https://registry.npmjs.org/seemly/-/seemly-0.3.10.tgz",
|
||||
"integrity": "sha512-2+SMxtG1PcsL0uyhkumlOU6Qo9TAQ/WyH7tthnPIOQB05/12jz9naq6GZ6iZ6ApVsO3rr2gsnTf3++OV63kE1Q==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/source-map-js": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
|
||||
@@ -1470,6 +1589,24 @@
|
||||
"url": "https://github.com/sponsors/SuperchupuDev"
|
||||
}
|
||||
},
|
||||
"node_modules/treemate": {
|
||||
"version": "0.3.11",
|
||||
"resolved": "https://registry.npmjs.org/treemate/-/treemate-0.3.11.tgz",
|
||||
"integrity": "sha512-M8RGFoKtZ8dF+iwJfAJTOH/SM4KluKOKRJpjCMhI8bG3qB74zrFoArKZ62ll0Fr3mqkMJiQOmWYkdYgDeITYQg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/vdirs": {
|
||||
"version": "0.1.8",
|
||||
"resolved": "https://registry.npmjs.org/vdirs/-/vdirs-0.1.8.tgz",
|
||||
"integrity": "sha512-H9V1zGRLQZg9b+GdMk8MXDN2Lva0zx72MPahDKc30v+DtwKjfyOSXWRIX4t2mhDubM1H09gPhWeth/BJWPHGUw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"evtd": "^0.2.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vue": "^3.0.11"
|
||||
}
|
||||
},
|
||||
"node_modules/vite": {
|
||||
"version": "6.4.3",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-6.4.3.tgz",
|
||||
@@ -1545,6 +1682,18 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/vooks": {
|
||||
"version": "0.2.12",
|
||||
"resolved": "https://registry.npmjs.org/vooks/-/vooks-0.2.12.tgz",
|
||||
"integrity": "sha512-iox0I3RZzxtKlcgYaStQYKEzWWGAduMmq+jS7OrNdQo1FgGfPMubGL3uGHOU9n97NIvfFDBGnpSvkWyb/NSn/Q==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"evtd": "^0.2.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vue": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/vue": {
|
||||
"version": "3.5.42",
|
||||
"resolved": "https://registry.npmjs.org/vue/-/vue-3.5.42.tgz",
|
||||
@@ -1571,6 +1720,24 @@
|
||||
"resolved": "https://registry.npmjs.org/vue-component-type-helpers/-/vue-component-type-helpers-3.3.11.tgz",
|
||||
"integrity": "sha512-LwcxzeliO9fkQcpJG0PoX8X5kmAhKmH9wkpDLxNabwzkQ9Zeib2YVHwFV4pcWmMLfXVfjr/dSV+DaJ3cIPgSNA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/vueuc": {
|
||||
"version": "0.4.66",
|
||||
"resolved": "https://registry.npmjs.org/vueuc/-/vueuc-0.4.66.tgz",
|
||||
"integrity": "sha512-hHrZl+0AsrUvqYPBXSXQ2QaSrO3razjeUseLAhJWlOS/Hdfw/Y2MU05fOTP1qn1A3121gMxsHLaEz2V6CkWdTg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@css-render/vue3-ssr": "^0.15.10",
|
||||
"@juggle/resize-observer": "^3.3.1",
|
||||
"css-render": "^0.15.10",
|
||||
"evtd": "^0.2.4",
|
||||
"seemly": "^0.3.6",
|
||||
"vdirs": "^0.1.4",
|
||||
"vooks": "^0.2.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vue": "^3.0.11"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
"dependencies": {
|
||||
"@element-plus/icons-vue": "^2.3.2",
|
||||
"element-plus": "^2.14.5",
|
||||
"naive-ui": "^2.45.3",
|
||||
"vue": "^3.5.13"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,94 +1,112 @@
|
||||
<template>
|
||||
<LoginPage v-if="!store.current" :app-name="store.appName" @ok="onLogin" />
|
||||
<el-container class="console" v-else>
|
||||
<el-header class="topbar" height="56px">
|
||||
<div class="brand">
|
||||
<span class="logo">37</span>
|
||||
<div class="brand-meta">
|
||||
<strong>{{ store.appName }}</strong>
|
||||
<span>中心机控制面</span>
|
||||
<n-config-provider :theme-overrides="themeOverrides" :locale="zhCN" :date-locale="dateZhCN">
|
||||
<LoginPage v-if="!store.current" :app-name="store.appName" @ok="onLogin" />
|
||||
<div class="console" v-else>
|
||||
<header class="topbar">
|
||||
<div class="brand">
|
||||
<span class="logo">37</span>
|
||||
<div class="brand-meta">
|
||||
<strong>{{ store.appName }}</strong>
|
||||
<span>中心机 · 控制面</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="spacer"></div>
|
||||
<n-dropdown trigger="click" :options="acctOptions" @select="onCommand">
|
||||
<div class="acct">
|
||||
<span class="avatar">{{ initial }}</span>
|
||||
<span class="acct-name">{{ store.current }}</span>
|
||||
<n-tag v-if="store.isAdmin" size="small" round :bordered="false" type="primary" class="admin-tag">管理员</n-tag>
|
||||
<n-icon class="caret" :size="13"><ArrowDown /></n-icon>
|
||||
</div>
|
||||
</n-dropdown>
|
||||
</header>
|
||||
|
||||
<div class="body">
|
||||
<aside class="aside">
|
||||
<div class="aside-inner">
|
||||
<n-menu class="menu" :value="activeKey" :options="menuOptions" :root-indent="0" @update:value="onMenu" />
|
||||
</div>
|
||||
<div class="aside-foot">
|
||||
<span>37du 自动化</span>
|
||||
<span class="ver">v0.1.0</span>
|
||||
</div>
|
||||
</aside>
|
||||
<main class="main">
|
||||
<component :is="viewComp" :key="route" />
|
||||
</main>
|
||||
</div>
|
||||
<div class="spacer"></div>
|
||||
<el-dropdown trigger="click" @command="onCommand">
|
||||
<span class="acct">
|
||||
<el-icon><UserFilled /></el-icon>
|
||||
{{ store.current }}
|
||||
<el-tag v-if="store.isAdmin" size="small" type="primary" effect="light" round>管理员</el-tag>
|
||||
<el-icon class="caret"><ArrowDown /></el-icon>
|
||||
</span>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="pwd">修改密码</el-dropdown-item>
|
||||
<el-dropdown-item command="logout" divided>退出登录</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-header>
|
||||
|
||||
<el-container class="body">
|
||||
<el-aside width="180px" class="aside">
|
||||
<el-menu :default-active="route" router class="menu" @select="onMenu">
|
||||
<el-menu-item index="#/overview">
|
||||
<el-icon><Odometer /></el-icon><span>概览</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="#/plugins">
|
||||
<el-icon><Box /></el-icon><span>插件管理</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="#/accounts">
|
||||
<el-icon><User /></el-icon><span>账号管理</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="#/grants">
|
||||
<el-icon><Key /></el-icon><span>权限授权</span>
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
</el-aside>
|
||||
<el-main class="main">
|
||||
<component :is="viewComp" :key="route" />
|
||||
</el-main>
|
||||
</el-container>
|
||||
</el-container>
|
||||
|
||||
<PasswordDialog v-model="pwdOpen" />
|
||||
</div>
|
||||
<PasswordDialog v-model="pwdOpen" />
|
||||
</n-config-provider>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { UserFilled, ArrowDown, Odometer, Box, User, Key } from '@element-plus/icons-vue'
|
||||
import { ArrowDown } from '@element-plus/icons-vue'
|
||||
import { themeOverrides, zhCN, dateZhCN, message } from './naive'
|
||||
import LoginPage from './components/LoginPage.vue'
|
||||
import PasswordDialog from './components/PasswordDialog.vue'
|
||||
import OverviewView from './views/OverviewView.vue'
|
||||
import PluginManageView from './views/PluginManageView.vue'
|
||||
import AccountManageView from './views/AccountManageView.vue'
|
||||
import GrantManageView from './views/GrantManageView.vue'
|
||||
import StatsView from './views/StatsView.vue'
|
||||
import AuditView from './views/AuditView.vue'
|
||||
import { store, clearSession } from './store'
|
||||
import { adminMe } from './api'
|
||||
|
||||
const menuOptions = [
|
||||
{ label: '概览', key: 'overview' },
|
||||
{ label: '数据看板', key: 'stats' },
|
||||
{ label: '插件管理', key: 'plugins' },
|
||||
{ label: '账号管理', key: 'accounts' },
|
||||
{ label: '权限授权', key: 'grants' },
|
||||
{ label: '审计报表', key: 'audit' },
|
||||
]
|
||||
const acctOptions = [
|
||||
{ label: '修改密码', key: 'pwd' },
|
||||
{ type: 'divider', key: 'd1' },
|
||||
{ label: '退出登录', key: 'logout' },
|
||||
]
|
||||
|
||||
// 轻量 hash 路由:StaticFiles(html=True) 下刷新安全,零后端改动
|
||||
const route = ref(location.hash && VIEWS[location.hash] ? location.hash : '#/overview')
|
||||
const KEY = {
|
||||
'#/overview': 'overview',
|
||||
'#/stats': 'stats',
|
||||
'#/plugins': 'plugins',
|
||||
'#/accounts': 'accounts',
|
||||
'#/grants': 'grants',
|
||||
'#/audit': 'audit',
|
||||
}
|
||||
const VIEWS = {
|
||||
'#/overview': OverviewView,
|
||||
'#/stats': StatsView,
|
||||
'#/plugins': PluginManageView,
|
||||
'#/accounts': AccountManageView,
|
||||
'#/grants': GrantManageView,
|
||||
'#/audit': AuditView,
|
||||
}
|
||||
const route = ref(VIEWS[location.hash] ? location.hash : '#/overview')
|
||||
window.addEventListener('hashchange', () => {
|
||||
if (VIEWS[location.hash]) route.value = location.hash
|
||||
})
|
||||
const viewComp = computed(() => VIEWS[route.value] || OverviewView)
|
||||
const activeKey = computed(() => KEY[route.value] || 'overview')
|
||||
|
||||
function onMenu(index) {
|
||||
location.hash = index
|
||||
route.value = index
|
||||
function onMenu(key) {
|
||||
const h = '#/' + key
|
||||
location.hash = h
|
||||
route.value = h
|
||||
}
|
||||
|
||||
const initial = computed(() => (store.current || '')[0]?.toUpperCase() || '?')
|
||||
|
||||
const pwdOpen = ref(false)
|
||||
function onCommand(cmd) {
|
||||
if (cmd === 'pwd') pwdOpen.value = true
|
||||
else if (cmd === 'logout') {
|
||||
clearSession()
|
||||
ElMessage.success('已退出登录')
|
||||
message.success('已退出登录')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,23 +127,89 @@ onMounted(async () => {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.console { height: 100vh; background: #f5f7fa; }
|
||||
.topbar { display: flex; align-items: center; gap: 16px; background: #fff;
|
||||
border-bottom: 1px solid var(--el-border-color-light); }
|
||||
.brand { display: flex; align-items: center; gap: 11px; }
|
||||
.logo { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
|
||||
background: var(--el-color-primary); color: #fff; font-size: 13px; font-weight: 800; }
|
||||
.brand-meta { display: flex; flex-direction: column; line-height: 1.25; }
|
||||
.brand-meta strong { font-size: 14px; color: var(--el-text-color-primary); }
|
||||
.brand-meta span { font-size: 11px; color: var(--el-text-color-secondary); }
|
||||
.spacer { flex: 1; }
|
||||
.acct { display: inline-flex; align-items: center; gap: 6px; font-size: 13px;
|
||||
color: var(--el-text-color-primary); cursor: pointer; outline: none; }
|
||||
.acct .caret { font-size: 12px; color: var(--el-text-color-secondary); }
|
||||
.console { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
|
||||
|
||||
.body { min-height: 0; }
|
||||
.aside { background: #fff; border-right: 1px solid var(--el-border-color-light); padding-top: 10px; }
|
||||
.menu { border-right: none; }
|
||||
.menu .el-menu-item { height: 44px; }
|
||||
.main { padding: 18px 20px; overflow: auto; }
|
||||
/* ---------- 顶栏:磨砂玻璃 ---------- */
|
||||
.topbar {
|
||||
height: 64px; flex-shrink: 0;
|
||||
display: flex; align-items: center; gap: 16px;
|
||||
padding: 0 24px;
|
||||
background: rgba(255, 255, 255, .72);
|
||||
backdrop-filter: blur(16px);
|
||||
-webkit-backdrop-filter: blur(16px);
|
||||
border-bottom: 1px solid var(--cp-border);
|
||||
position: relative; z-index: 20;
|
||||
}
|
||||
.topbar::after {
|
||||
content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
|
||||
background: linear-gradient(90deg, transparent, rgba(59, 108, 255, .35), rgba(34, 199, 232, .35), transparent);
|
||||
}
|
||||
.brand { display: flex; align-items: center; gap: 12px; }
|
||||
.logo {
|
||||
width: 38px; height: 38px; border-radius: 12px;
|
||||
display: grid; place-items: center; position: relative;
|
||||
background: linear-gradient(135deg, #3b6cff 0%, #22c7e8 130%);
|
||||
color: #fff; font-size: 14px; font-weight: 800; letter-spacing: .5px;
|
||||
box-shadow: 0 6px 16px -6px rgba(59, 108, 255, .6);
|
||||
}
|
||||
.logo::after { content: ''; position: absolute; inset: 2px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .28); }
|
||||
.brand-meta { display: flex; flex-direction: column; line-height: 1.25; }
|
||||
.brand-meta strong { font-size: 15px; color: var(--cp-ink); letter-spacing: .2px; }
|
||||
.brand-meta span { font-size: 11px; color: var(--cp-ink-3); letter-spacing: .4px; }
|
||||
.spacer { flex: 1; }
|
||||
|
||||
.acct {
|
||||
display: flex; align-items: center; gap: 9px; cursor: pointer;
|
||||
padding: 6px 10px; border-radius: 12px; transition: background .18s;
|
||||
}
|
||||
.acct:hover { background: rgba(59, 108, 255, .07); }
|
||||
.avatar {
|
||||
width: 30px; height: 30px; border-radius: 50%;
|
||||
display: grid; place-items: center;
|
||||
background: linear-gradient(135deg, #3b6cff, #22c7e8);
|
||||
color: #fff; font-size: 13px; font-weight: 700;
|
||||
}
|
||||
.acct-name { font-size: 13px; font-weight: 600; color: var(--cp-ink); }
|
||||
.admin-tag { margin-left: 2px; }
|
||||
.caret { color: var(--cp-ink-3); }
|
||||
|
||||
/* ---------- 主体:悬浮侧栏 + 内容区 ---------- */
|
||||
.body { flex: 1; display: flex; gap: 18px; padding: 18px 24px 24px; min-height: 0; }
|
||||
.aside {
|
||||
width: 208px; flex-shrink: 0;
|
||||
display: flex; flex-direction: column;
|
||||
background: rgba(255, 255, 255, .78);
|
||||
backdrop-filter: blur(14px);
|
||||
-webkit-backdrop-filter: blur(14px);
|
||||
border: 1px solid var(--cp-border);
|
||||
border-radius: 18px;
|
||||
box-shadow: var(--cp-card-shadow);
|
||||
padding: 14px 10px;
|
||||
}
|
||||
.aside-inner { flex: 1; }
|
||||
.aside-foot {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
padding: 12px 12px 4px; margin-top: 8px;
|
||||
border-top: 1px dashed var(--cp-border);
|
||||
font-size: 11px; color: var(--cp-ink-3);
|
||||
}
|
||||
.main { flex: 1; min-width: 0; overflow: auto; padding: 4px 4px 8px; }
|
||||
|
||||
/* 页面切换过渡:轻微上浮淡入 */
|
||||
.view-fade-enter-active { transition: opacity .22s ease, transform .22s ease; }
|
||||
.view-fade-leave-active { transition: opacity .12s ease; }
|
||||
.view-fade-enter-from { opacity: 0; transform: translateY(8px); }
|
||||
.view-fade-leave-to { opacity: 0; }
|
||||
|
||||
/* ---------- 侧栏菜单:干净的标准导航,配色由 naive 主题统一控制 ---------- */
|
||||
.menu { padding: 2px; }
|
||||
.menu :deep(.n-menu-item) { margin-bottom: 4px; }
|
||||
.menu :deep(.n-menu-item-content) {
|
||||
/* 无图标时 naive 给 `padding-left:0` 的内联样式,需 !important 压过,
|
||||
否则文字贴左边界、跑出圆角底色区域 */
|
||||
padding-left: 16px !important;
|
||||
padding-right: 16px !important;
|
||||
border-radius: 10px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -36,6 +36,9 @@ export async function adminMe() {
|
||||
export async function adminOverview() {
|
||||
return req('/api/admin/overview', { headers: adminHeaders() })
|
||||
}
|
||||
export async function adminPlatforms() {
|
||||
return req('/api/admin/platforms', { headers: adminHeaders() })
|
||||
}
|
||||
export async function adminGrant(body) {
|
||||
return req('/api/admin/account_plugins', {
|
||||
method: 'POST',
|
||||
@@ -88,6 +91,23 @@ export async function adminPluginDelete(body) {
|
||||
body: JSON.stringify(body)
|
||||
})
|
||||
}
|
||||
export async function adminPluginPatch(pluginId, body) {
|
||||
const qs = new URLSearchParams({ plugin_id: pluginId })
|
||||
return req('/api/admin/plugin/patch?' + qs.toString(), {
|
||||
method: 'POST',
|
||||
headers: adminHeaders({ 'Content-Type': 'application/json' }),
|
||||
body: JSON.stringify(body)
|
||||
})
|
||||
}
|
||||
export async function adminAudit(limit = 300) {
|
||||
return req('/api/admin/audit?limit=' + limit, { headers: adminHeaders() })
|
||||
}
|
||||
export async function adminReports(limit = 300) {
|
||||
return req('/api/admin/reports?limit=' + limit, { headers: adminHeaders() })
|
||||
}
|
||||
export async function adminStats() {
|
||||
return req('/api/admin/stats', { headers: adminHeaders() })
|
||||
}
|
||||
export async function adminUpload(pluginId, name, version, file) {
|
||||
const fd = new FormData()
|
||||
fd.append('upload', file)
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
<template>
|
||||
<div class="login-wrap">
|
||||
<el-card class="card" shadow="always">
|
||||
<div class="orb orb-a"></div>
|
||||
<div class="orb orb-b"></div>
|
||||
<div class="orb orb-c"></div>
|
||||
<div class="grid-mask"></div>
|
||||
|
||||
<n-card class="card" :bordered="false">
|
||||
<div class="brand">
|
||||
<span class="logo">37</span>
|
||||
<div class="brand-meta">
|
||||
@@ -8,28 +13,34 @@
|
||||
<span>中心机统一账户登录</span>
|
||||
</div>
|
||||
</div>
|
||||
<el-form label-position="top" @keyup.enter="doLogin">
|
||||
<el-form-item label="账号">
|
||||
<el-input v-model="account" placeholder="请输入账号" size="large" :prefix-icon="User" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="密码">
|
||||
<el-input v-model="password" type="password" placeholder="请输入密码" size="large"
|
||||
:prefix-icon="Lock" show-password />
|
||||
</el-form-item>
|
||||
<el-button type="primary" size="large" class="login-btn" :loading="busy" @click="doLogin">
|
||||
|
||||
<n-form label-placement="top" @keydown.enter="doLogin">
|
||||
<n-form-item label="账号">
|
||||
<n-input v-model:value="account" placeholder="请输入账号" size="large">
|
||||
<template #prefix><n-icon><User /></n-icon></template>
|
||||
</n-input>
|
||||
</n-form-item>
|
||||
<n-form-item label="密码">
|
||||
<n-input v-model:value="password" type="password" show-password-on="click" placeholder="请输入密码" size="large">
|
||||
<template #prefix><n-icon><Lock /></n-icon></template>
|
||||
</n-input>
|
||||
</n-form-item>
|
||||
<n-button type="primary" size="large" block class="login-btn" :loading="busy" @click="doLogin">
|
||||
{{ busy ? '校验中…' : '登 录' }}
|
||||
</el-button>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</n-button>
|
||||
</n-form>
|
||||
|
||||
<div class="foot">内网管理面 · 请使用管理员账号登录</div>
|
||||
</n-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { User, Lock } from '@element-plus/icons-vue'
|
||||
import { adminLogin } from '../api'
|
||||
import { store } from '../store.js'
|
||||
import { message } from '../naive'
|
||||
|
||||
const props = defineProps({ appName: { type: String, default: '37du 内网插件控制面' } })
|
||||
const emit = defineEmits(['ok'])
|
||||
@@ -41,7 +52,7 @@ const busy = ref(false)
|
||||
async function doLogin() {
|
||||
if (busy.value) return
|
||||
const acct = account.value.trim()
|
||||
if (!acct || !password.value) { ElMessage.warning('请输入账号与密码'); return }
|
||||
if (!acct || !password.value) { message.warning('请输入账号与密码'); return }
|
||||
busy.value = true
|
||||
try {
|
||||
const r = await adminLogin(acct, password.value)
|
||||
@@ -51,10 +62,10 @@ async function doLogin() {
|
||||
store.token = r.token || ''
|
||||
store.isAdmin = true
|
||||
try { localStorage.setItem('cp_account', acct); localStorage.setItem('cp_token', store.token) } catch (_) {}
|
||||
ElMessage.success(`欢迎,${acct}`)
|
||||
message.success(`欢迎,${acct}`)
|
||||
emit('ok', r)
|
||||
} catch (e) {
|
||||
ElMessage.error(e.message || String(e))
|
||||
message.error(e.message || String(e))
|
||||
} finally {
|
||||
busy.value = false
|
||||
}
|
||||
@@ -62,14 +73,61 @@ async function doLogin() {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.login-wrap { height: 100vh; display: grid; place-items: center;
|
||||
background: linear-gradient(160deg, #eef2fb 0%, #f7f9fd 60%, #eaf1f8 100%); }
|
||||
.card { width: 360px; }
|
||||
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
|
||||
.logo { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center;
|
||||
background: var(--el-color-primary); color: #fff; font-size: 15px; font-weight: 800; }
|
||||
.login-wrap {
|
||||
height: 100vh; position: relative; overflow: hidden;
|
||||
display: grid; place-items: center;
|
||||
background:
|
||||
radial-gradient(1000px 520px at 85% -10%, rgba(59, 108, 255, .16), transparent 60%),
|
||||
radial-gradient(900px 480px at 0% 110%, rgba(34, 199, 232, .14), transparent 55%),
|
||||
radial-gradient(700px 420px at 60% 120%, rgba(139, 92, 246, .10), transparent 60%),
|
||||
linear-gradient(180deg, #f4f7fd 0%, #e9eefb 100%);
|
||||
}
|
||||
.orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5; pointer-events: none; }
|
||||
.orb-a { width: 360px; height: 360px; top: -120px; right: -60px; background: radial-gradient(circle, rgba(59, 108, 255, .35), transparent 70%); }
|
||||
.orb-b { width: 300px; height: 300px; bottom: -100px; left: -80px; background: radial-gradient(circle, rgba(34, 199, 232, .32), transparent 70%); }
|
||||
.orb-c { width: 260px; height: 260px; bottom: 80px; right: 12%; background: radial-gradient(circle, rgba(139, 92, 246, .22), transparent 70%); }
|
||||
.grid-mask {
|
||||
position: absolute; inset: 0; pointer-events: none;
|
||||
background-image:
|
||||
linear-gradient(rgba(59, 108, 255, .05) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(59, 108, 255, .05) 1px, transparent 1px);
|
||||
background-size: 44px 44px;
|
||||
mask-image: radial-gradient(circle at 50% 42%, rgba(0, 0, 0, .5), transparent 75%);
|
||||
-webkit-mask-image: radial-gradient(circle at 50% 42%, rgba(0, 0, 0, .5), transparent 75%);
|
||||
}
|
||||
|
||||
.card {
|
||||
width: 380px; position: relative; z-index: 2;
|
||||
border-radius: 20px;
|
||||
background: rgba(255, 255, 255, .82);
|
||||
backdrop-filter: blur(18px);
|
||||
-webkit-backdrop-filter: blur(18px);
|
||||
border: 1px solid var(--cp-border);
|
||||
box-shadow: 0 24px 60px -24px rgba(43, 64, 132, .35);
|
||||
animation: cp-rise .6s cubic-bezier(.22, .61, .36, 1) both;
|
||||
}
|
||||
.brand { display: flex; align-items: center; gap: 13px; margin-bottom: 24px; }
|
||||
.logo {
|
||||
width: 46px; height: 46px; border-radius: 14px; position: relative;
|
||||
display: grid; place-items: center;
|
||||
background: linear-gradient(135deg, #3b6cff 0%, #22c7e8 130%);
|
||||
color: #fff; font-size: 16px; font-weight: 800; letter-spacing: .5px;
|
||||
box-shadow: 0 10px 22px -8px rgba(59, 108, 255, .6);
|
||||
}
|
||||
.logo::after { content: ''; position: absolute; inset: 2px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .28); }
|
||||
.brand-meta { display: flex; flex-direction: column; line-height: 1.3; }
|
||||
.brand-meta strong { font-size: 15px; color: var(--el-text-color-primary); }
|
||||
.brand-meta span { font-size: 12px; color: var(--el-text-color-secondary); }
|
||||
.login-btn { width: 100%; margin-top: 4px; }
|
||||
.brand-meta strong { font-size: 16px; color: var(--cp-ink); letter-spacing: .2px; }
|
||||
.brand-meta span { font-size: 12px; color: var(--cp-ink-3); }
|
||||
|
||||
/* 登录按钮:与 logo / 侧栏选中态统一的品牌渐变 */
|
||||
.login-btn {
|
||||
margin-top: 6px;
|
||||
background: linear-gradient(135deg, #3b6cff 0%, #22b0e8 130%);
|
||||
border: none;
|
||||
box-shadow: 0 10px 22px -10px rgba(59, 108, 255, .55);
|
||||
transition: box-shadow .2s, transform .2s;
|
||||
}
|
||||
.login-btn:hover { box-shadow: 0 14px 26px -10px rgba(59, 108, 255, .65); transform: translateY(-1px); }
|
||||
.login-btn:active { transform: translateY(0); }
|
||||
.foot { margin-top: 18px; text-align: center; font-size: 11.5px; color: var(--cp-ink-3); }
|
||||
</style>
|
||||
|
||||
@@ -1,29 +1,31 @@
|
||||
<template>
|
||||
<el-dialog v-model="visible" title="修改密码" width="380px" :close-on-click-modal="false" @closed="reset">
|
||||
<el-alert v-if="store.current" :title="`当前账号:${store.current}`" type="info" :closable="false" class="acct-tip" />
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-position="top">
|
||||
<el-form-item label="原密码" prop="oldPwd">
|
||||
<el-input v-model="form.oldPwd" type="password" show-password placeholder="请输入原密码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="新密码" prop="newPwd">
|
||||
<el-input v-model="form.newPwd" type="password" show-password placeholder="至少 6 位,不与原密码相同" />
|
||||
</el-form-item>
|
||||
<el-form-item label="确认新密码" prop="newPwd2">
|
||||
<el-input v-model="form.newPwd2" type="password" show-password placeholder="再次输入新密码" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<n-modal v-model:show="visible" preset="card" title="修改密码" :style="{ width: '420px' }" :bordered="false" @after-leave="reset">
|
||||
<n-alert v-if="store.current" type="info" :bordered="false" class="acct-tip">当前账号:{{ store.current }}</n-alert>
|
||||
<n-form ref="formRef" :model="form" :rules="rules" label-placement="top">
|
||||
<n-form-item label="原密码" path="oldPwd">
|
||||
<n-input v-model:value="form.oldPwd" type="password" show-password-on="click" placeholder="请输入原密码" />
|
||||
</n-form-item>
|
||||
<n-form-item label="新密码" path="newPwd">
|
||||
<n-input v-model:value="form.newPwd" type="password" show-password-on="click" placeholder="至少 6 位,不与原密码相同" />
|
||||
</n-form-item>
|
||||
<n-form-item label="确认新密码" path="newPwd2">
|
||||
<n-input v-model:value="form.newPwd2" type="password" show-password-on="click" placeholder="再次输入新密码" />
|
||||
</n-form-item>
|
||||
</n-form>
|
||||
<template #footer>
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="busy" @click="submit">保存</el-button>
|
||||
<n-space justify="end">
|
||||
<n-button @click="visible = false">取消</n-button>
|
||||
<n-button type="primary" :loading="busy" @click="submit">保存</n-button>
|
||||
</n-space>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</n-modal>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, reactive, ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { reactive, ref } from 'vue'
|
||||
import { store } from '../store'
|
||||
import { adminPassword } from '../api'
|
||||
import { message } from '../naive'
|
||||
|
||||
const visible = defineModel({ type: Boolean, default: false })
|
||||
const formRef = ref()
|
||||
@@ -31,32 +33,32 @@ const busy = ref(false)
|
||||
const form = reactive({ oldPwd: '', newPwd: '', newPwd2: '' })
|
||||
|
||||
const rules = {
|
||||
oldPwd: [{ required: true, message: '请输入原密码', trigger: 'blur' }],
|
||||
oldPwd: { required: true, message: '请输入原密码' },
|
||||
newPwd: [
|
||||
{ required: true, message: '请输入新密码', trigger: 'blur' },
|
||||
{ min: 6, message: '新密码至少 6 位', trigger: 'blur' },
|
||||
{ validator: (_, v, cb) => (v && v === form.oldPwd ? cb(new Error('新密码不能与原密码相同')) : cb()), trigger: 'blur' },
|
||||
{ required: true, message: '请输入新密码' },
|
||||
{ min: 6, message: '新密码至少 6 位' },
|
||||
{ validator: (_r, v) => (v && v === form.oldPwd ? new Error('新密码不能与原密码相同') : true), message: '新密码不能与原密码相同' },
|
||||
],
|
||||
newPwd2: [
|
||||
{ required: true, message: '请再次输入新密码', trigger: 'blur' },
|
||||
{ validator: (_, v, cb) => (v !== form.newPwd ? cb(new Error('两次输入的密码不一致')) : cb()), trigger: 'blur' },
|
||||
{ required: true, message: '请再次输入新密码' },
|
||||
{ validator: (_r, v) => (v !== form.newPwd ? new Error('两次输入的密码不一致') : true), message: '两次输入的密码不一致' },
|
||||
],
|
||||
}
|
||||
|
||||
function reset() {
|
||||
form.oldPwd = form.newPwd = form.newPwd2 = ''
|
||||
formRef.value?.clearValidate()
|
||||
formRef.value?.restoreValidation()
|
||||
}
|
||||
|
||||
async function submit() {
|
||||
await formRef.value.validate().catch(() => Promise.reject())
|
||||
try { await formRef.value.validate() } catch (_) { return }
|
||||
busy.value = true
|
||||
try {
|
||||
await adminPassword({ account: store.current, old_password: form.oldPwd, new_password: form.newPwd })
|
||||
ElMessage.success('密码已修改,下次登录请使用新密码')
|
||||
message.success('密码已修改,下次登录请使用新密码')
|
||||
visible.value = false
|
||||
} catch (e) {
|
||||
ElMessage.error('修改失败:' + (e.message || e))
|
||||
message.error('修改失败:' + (e.message || e))
|
||||
} finally {
|
||||
busy.value = false
|
||||
}
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
import { createApp } from 'vue'
|
||||
import ElementPlus from 'element-plus'
|
||||
import zhCn from 'element-plus/es/locale/lang/zh-cn'
|
||||
import 'element-plus/dist/index.css'
|
||||
import naive from 'naive-ui'
|
||||
// 图标沿用 @element-plus/icons-vue(纯 SVG 组件,与 UI 框架解耦)
|
||||
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
||||
import App from './App.vue'
|
||||
import './style.css'
|
||||
|
||||
createApp(App).use(ElementPlus, { locale: zhCn }).mount('#app')
|
||||
const app = createApp(App)
|
||||
// 全量注册图标,模板中可直接用图标名,概览页卡片动态渲染需要
|
||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||
app.component(key, component)
|
||||
}
|
||||
app.use(naive).mount('#app')
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
// Naive UI 主题与离散式反馈(message/dialog 无需 Provider 包裹即可调用)
|
||||
import { createDiscreteApi, zhCN, dateZhCN } from 'naive-ui'
|
||||
|
||||
export const themeOverrides = {
|
||||
common: {
|
||||
primaryColor: '#3b6cff',
|
||||
primaryColorHover: '#5e84ff',
|
||||
primaryColorPressed: '#2f56d6',
|
||||
primaryColorSuppl: '#4c79ff',
|
||||
infoColor: '#3b6cff',
|
||||
successColor: '#22b07a',
|
||||
warningColor: '#eab308',
|
||||
errorColor: '#e5484d',
|
||||
borderRadius: '10px',
|
||||
borderRadiusSmall: '8px',
|
||||
fontFamily:
|
||||
'"HarmonyOS Sans SC","Microsoft YaHei UI","PingFang SC",-apple-system,"Segoe UI",sans-serif',
|
||||
},
|
||||
Card: {
|
||||
borderRadius: '16px',
|
||||
},
|
||||
Button: {
|
||||
borderRadiusMedium: '10px',
|
||||
borderRadiusLarge: '12px',
|
||||
},
|
||||
Menu: {
|
||||
itemHeight: '46px',
|
||||
itemBorderRadius: '10px',
|
||||
itemTextColor: '#3a4660',
|
||||
itemTextColorHover: '#3b6cff',
|
||||
itemTextColorActive: '#3b6cff',
|
||||
itemTextColorActiveHover: '#2f56d6',
|
||||
itemColorHover: 'rgba(31, 45, 80, .05)',
|
||||
itemColorActive: 'rgba(59, 108, 255, .10)',
|
||||
itemColorActiveHover: 'rgba(59, 108, 255, .15)',
|
||||
iconColor: '#7b8aa8',
|
||||
iconColorHover: '#3b6cff',
|
||||
iconColorActive: '#3b6cff',
|
||||
iconColorActiveHover: '#2f56d6',
|
||||
},
|
||||
DataTable: {
|
||||
thColor: '#f5f8fe',
|
||||
thTextColor: '#5b6b8c',
|
||||
thFontWeight: '600',
|
||||
tdColor: 'transparent',
|
||||
tdColorHover: 'rgba(59,108,255,.06)',
|
||||
borderColor: 'rgba(88,113,183,.10)',
|
||||
borderRadius: '12px',
|
||||
},
|
||||
Dialog: {
|
||||
borderRadius: '16px',
|
||||
},
|
||||
}
|
||||
|
||||
export const { message, dialog, notification } = createDiscreteApi(
|
||||
['message', 'dialog', 'notification'],
|
||||
{
|
||||
configProviderProps: { themeOverrides, locale: zhCN, dateLocale: dateZhCN },
|
||||
}
|
||||
)
|
||||
|
||||
export { zhCN, dateZhCN }
|
||||
@@ -1,16 +1,77 @@
|
||||
/* ============ 37du 内网插件控制面 全局基础样式(组件样式由 Element Plus 提供) ============ */
|
||||
/* ============ 37du 内网插件控制面 全局基础样式(组件由 Naive UI 提供) ============ */
|
||||
:root {
|
||||
/* 设计令牌:文字 / 边框 / 表面 / 品牌色 / 投影 */
|
||||
--cp-ink: #141c33;
|
||||
--cp-ink-2: #5b6b8c;
|
||||
--cp-ink-3: #94a3c4;
|
||||
--cp-border: rgba(88, 113, 183, .14);
|
||||
--cp-surface: rgba(255, 255, 255, .82);
|
||||
--cp-blue: #3b6cff;
|
||||
--cp-cyan: #22c7e8;
|
||||
--cp-violet: #8b5cf6;
|
||||
--cp-card-shadow: 0 10px 30px -14px rgba(43, 64, 132, .20);
|
||||
--cp-card-shadow-hover: 0 18px 44px -18px rgba(59, 108, 255, .30);
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
html, body, #app { height: 100%; margin: 0; }
|
||||
|
||||
body {
|
||||
font-family: "Inter", "Microsoft YaHei UI", "PingFang SC", -apple-system, sans-serif;
|
||||
font-family: "HarmonyOS Sans SC", "Microsoft YaHei UI", "PingFang SC", -apple-system, "Segoe UI", sans-serif;
|
||||
font-size: 13px;
|
||||
color: #1f2633;
|
||||
color: var(--cp-ink);
|
||||
-webkit-font-smoothing: antialiased;
|
||||
background: #f5f7fa;
|
||||
background-color: #eaf0fb;
|
||||
/* 浅色极光画布:三层低透明光晕 + 渐变底 */
|
||||
background-image:
|
||||
radial-gradient(1100px 520px at 88% -10%, rgba(59, 108, 255, .14), transparent 60%),
|
||||
radial-gradient(900px 480px at -8% 108%, rgba(34, 199, 232, .12), transparent 55%),
|
||||
radial-gradient(760px 420px at 55% 118%, rgba(139, 92, 246, .10), transparent 60%),
|
||||
linear-gradient(180deg, #f4f7fd 0%, #e9eefb 100%);
|
||||
background-attachment: fixed;
|
||||
}
|
||||
|
||||
::selection { background: rgba(59, 108, 255, .18); }
|
||||
|
||||
::-webkit-scrollbar { width: 10px; height: 10px; }
|
||||
::-webkit-scrollbar-thumb { background: #d4dae8; border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
|
||||
::-webkit-scrollbar-thumb:hover { background: #c1c9dc; background-clip: content-box; border: 2px solid transparent; }
|
||||
::-webkit-scrollbar-thumb { background: #c8d2e8; border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
|
||||
::-webkit-scrollbar-thumb:hover { background: #b3c0de; background-clip: content-box; border: 2px solid transparent; }
|
||||
::-webkit-scrollbar-track { background: transparent; }
|
||||
|
||||
/* ---------- Naive 组件统一质感 ---------- */
|
||||
.n-card {
|
||||
--n-border-color: var(--cp-border);
|
||||
--n-color: rgba(255, 255, 255, .82);
|
||||
backdrop-filter: blur(12px);
|
||||
-webkit-backdrop-filter: blur(12px);
|
||||
box-shadow: var(--cp-card-shadow);
|
||||
}
|
||||
.n-data-table {
|
||||
--n-border-color: rgba(88, 113, 183, .10);
|
||||
}
|
||||
|
||||
/* ---------- 共享页面工具类 ---------- */
|
||||
.page { max-width: 1280px; margin: 0 auto; }
|
||||
.page-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
|
||||
.page-head h3 { margin: 0 0 6px; font-size: 20px; font-weight: 700; letter-spacing: .2px; color: var(--cp-ink); display: flex; align-items: center; gap: 10px; }
|
||||
.page-head h3 .badge {
|
||||
font-size: 11px; font-weight: 600; color: var(--cp-blue); letter-spacing: .6px;
|
||||
background: rgba(59, 108, 255, .10); border: 1px solid rgba(59, 108, 255, .18);
|
||||
padding: 2px 9px; border-radius: 20px;
|
||||
}
|
||||
.page-head p { margin: 0; font-size: 12.5px; color: var(--cp-ink-3); }
|
||||
.block { margin-bottom: 16px; }
|
||||
.dim { color: var(--cp-ink-3); }
|
||||
.who { color: var(--cp-blue); font-weight: 600; }
|
||||
|
||||
/* 卡片标题前的小渐变竖条 */
|
||||
.card-title { font-size: 15px; font-weight: 700; color: var(--cp-ink); display: flex; align-items: center; gap: 8px; }
|
||||
.card-title::before { content: ''; width: 4px; height: 14px; border-radius: 3px; background: linear-gradient(180deg, #3b6cff, #22c7e8); }
|
||||
|
||||
/* 表格单元格通用 */
|
||||
.cell-strong { font-weight: 700; color: var(--cp-ink); }
|
||||
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
|
||||
|
||||
/* ---------- 动效 ---------- */
|
||||
@keyframes cp-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
|
||||
.cp-rise { animation: cp-rise .5s cubic-bezier(.22, .61, .36, 1) both; }
|
||||
|
||||
@@ -1,164 +1,240 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="page-head">
|
||||
<div class="page">
|
||||
<div class="page-head cp-rise">
|
||||
<div>
|
||||
<h3>账号管理</h3>
|
||||
<h3>账号管理 <span class="badge">Accounts</span></h3>
|
||||
<p>建号 · 部门 / 管理员维护 · 密码重置(不能操作自己的账号)</p>
|
||||
</div>
|
||||
<div>
|
||||
<el-button :icon="Refresh" :loading="overviewBusy" @click="refresh">刷新</el-button>
|
||||
<el-button type="primary" :icon="Plus" @click="openCreate">新建账号</el-button>
|
||||
</div>
|
||||
<n-space :size="10">
|
||||
<n-button :loading="overviewBusy" @click="refresh">
|
||||
<template #icon><n-icon><Refresh /></n-icon></template>刷新
|
||||
</n-button>
|
||||
<n-button type="primary" @click="openCreate">
|
||||
<template #icon><n-icon><Plus /></n-icon></template>新建账号
|
||||
</n-button>
|
||||
</n-space>
|
||||
</div>
|
||||
|
||||
<el-card shadow="never">
|
||||
<el-table :data="accounts" v-loading="overviewBusy" empty-text="暂无账号">
|
||||
<el-table-column prop="account" label="账号" min-width="120">
|
||||
<template #default="{ row }"><b>{{ row.account }}</b></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="部门" min-width="150">
|
||||
<template #default="{ row }">
|
||||
<el-input v-if="row.account === editing" v-model="deptDraft" size="small" style="width: 120px"
|
||||
@keyup.enter="saveDept(row)" @blur="saveDept(row)" />
|
||||
<span v-else class="dept" @click="startEditDept(row)" title="点击编辑">
|
||||
{{ row.dept || '—' }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="管理员" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-switch :model-value="!!row.is_admin" :disabled="row.account === current"
|
||||
@change="toggleAdmin(row)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="已授权插件" min-width="160">
|
||||
<template #default="{ row }">
|
||||
<el-tag v-for="p in row.plugins" :key="p" size="small" effect="plain" class="tag">{{ p }}</el-tag>
|
||||
<span v-if="!row.plugins?.length" class="dim">—</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="已授权平台" min-width="120">
|
||||
<template #default="{ row }">
|
||||
<el-tag v-for="pf in row.platforms" :key="pf" size="small" type="success" effect="plain" class="tag">{{ pf }}</el-tag>
|
||||
<span v-if="!row.platforms?.length" class="dim">—</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="150" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="resetPwd(row)">重置密码</el-button>
|
||||
<el-button link type="danger" :disabled="row.account === current" @click="delAccount(row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
<n-card class="cp-rise" :bordered="false">
|
||||
<n-data-table
|
||||
:columns="columns"
|
||||
:data="accounts"
|
||||
:loading="overviewBusy"
|
||||
:row-key="r => r.account"
|
||||
:single-line="false"
|
||||
/>
|
||||
</n-card>
|
||||
|
||||
<el-dialog v-model="createOpen" title="新建账号" width="400px" @closed="resetCreate">
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-position="top">
|
||||
<el-form-item label="账号" prop="account">
|
||||
<el-input v-model="form.account" placeholder="登录账号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="初始密码" prop="password">
|
||||
<el-input v-model="form.password" type="password" show-password placeholder="至少 6 位" />
|
||||
</el-form-item>
|
||||
<el-form-item label="部门">
|
||||
<el-input v-model="form.dept" placeholder="如 财务部 / IT" />
|
||||
</el-form-item>
|
||||
<el-form-item label="管理员">
|
||||
<el-switch v-model="form.is_admin" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- 新建账号 -->
|
||||
<n-modal v-model:show="createOpen" preset="card" title="新建账号" :style="{ width: '420px' }" :bordered="false" @after-leave="resetCreate">
|
||||
<n-form ref="formRef" :model="form" :rules="rules" label-placement="top">
|
||||
<n-form-item label="账号" path="account">
|
||||
<n-input v-model:value="form.account" placeholder="登录账号" />
|
||||
</n-form-item>
|
||||
<n-form-item label="昵称">
|
||||
<n-input v-model:value="form.nickname" placeholder="真实姓名,方便识别(可填钉钉名)" />
|
||||
</n-form-item>
|
||||
<n-form-item label="初始密码" path="password">
|
||||
<n-input v-model:value="form.password" type="password" show-password-on="click" placeholder="至少 6 位" />
|
||||
</n-form-item>
|
||||
<n-form-item label="部门">
|
||||
<n-input v-model:value="form.dept" placeholder="如 财务部 / IT" />
|
||||
</n-form-item>
|
||||
<n-form-item label="管理员">
|
||||
<n-switch v-model:value="form.is_admin" />
|
||||
</n-form-item>
|
||||
</n-form>
|
||||
<template #footer>
|
||||
<el-button @click="createOpen = false">取消</el-button>
|
||||
<el-button type="primary" :loading="creating" @click="createAccount">建号</el-button>
|
||||
<n-space justify="end">
|
||||
<n-button @click="createOpen = false">取消</n-button>
|
||||
<n-button type="primary" :loading="creating" @click="createAccount">建号</n-button>
|
||||
</n-space>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</n-modal>
|
||||
|
||||
<!-- 重置密码 -->
|
||||
<n-modal v-model:show="resetOpen" preset="card" title="重置密码" :style="{ width: '400px' }" :bordered="false">
|
||||
<n-alert v-if="resetTarget" type="info" :bordered="false" style="margin-bottom: 14px">
|
||||
为账号 <b>{{ resetTarget }}</b> 设置新密码(至少 6 位)
|
||||
</n-alert>
|
||||
<n-input v-model:value="resetPwdVal" type="password" show-password-on="click" placeholder="新密码(至少 6 位)" @keydown.enter="confirmReset" />
|
||||
<template #footer>
|
||||
<n-space justify="end">
|
||||
<n-button @click="resetOpen = false">取消</n-button>
|
||||
<n-button type="primary" :loading="resetting" @click="confirmReset">确认重置</n-button>
|
||||
</n-space>
|
||||
</template>
|
||||
</n-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import { computed, h, onMounted, reactive, ref } from 'vue'
|
||||
import { NButton, NInput, NSwitch, NTag } from 'naive-ui'
|
||||
import { Refresh, Plus } from '@element-plus/icons-vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { store, overview, overviewBusy, loadOverview } from '../store'
|
||||
import { adminAccountCreate, adminAccountUpdate, adminAccountReset, adminAccountDelete } from '../api'
|
||||
import { message, dialog } from '../naive'
|
||||
|
||||
const current = computed(() => store.current || '')
|
||||
const accounts = computed(() => overview.value?.accounts || [])
|
||||
|
||||
const createOpen = ref(false)
|
||||
const creating = ref(false)
|
||||
const formRef = ref()
|
||||
const form = reactive({ account: '', password: '', dept: '', is_admin: false })
|
||||
const rules = {
|
||||
account: [{ required: true, message: '请输入账号', trigger: 'blur' }],
|
||||
password: [
|
||||
{ required: true, message: '请输入初始密码', trigger: 'blur' },
|
||||
{ min: 6, message: '密码至少 6 位', trigger: 'blur' },
|
||||
],
|
||||
}
|
||||
function openCreate() { createOpen.value = true }
|
||||
function resetCreate() { form.account = form.password = form.dept = ''; form.is_admin = false; formRef.value?.clearValidate() }
|
||||
|
||||
// 部门行内编辑
|
||||
const editing = ref('')
|
||||
const deptDraft = ref('')
|
||||
function startEditDept(row) {
|
||||
// ---------- 部门 / 昵称 行内编辑 ----------
|
||||
const editing = ref('') // 正在编辑的账号
|
||||
const editField = ref('') // 'dept' | 'nickname'
|
||||
const editDraft = ref('')
|
||||
function startEdit(row, field) {
|
||||
if (row.account === current.value) return
|
||||
editing.value = row.account
|
||||
deptDraft.value = row.dept || ''
|
||||
editField.value = field
|
||||
editDraft.value = row[field] || ''
|
||||
}
|
||||
async function saveDept(row) {
|
||||
async function saveEdit(row) {
|
||||
if (editing.value !== row.account) return
|
||||
const field = editField.value
|
||||
editing.value = ''
|
||||
const dept = deptDraft.value.trim()
|
||||
if (dept === (row.dept || '')) return
|
||||
try { await adminAccountUpdate({ account: row.account, dept }); ElMessage.success(`已更新 ${row.account} 部门`) }
|
||||
catch (e) { ElMessage.error(e.message || e) }
|
||||
const val = (editDraft.value || '').trim()
|
||||
if (val === (row[field] || '')) return
|
||||
try {
|
||||
await adminAccountUpdate({ account: row.account, [field]: val })
|
||||
message.success(`已更新 ${row.account} 的${field === 'nickname' ? '昵称' : '部门'}`)
|
||||
} catch (e) { message.error(e.message || e) }
|
||||
}
|
||||
function inlineInput(row, field) {
|
||||
if (row.account === editing.value && editField.value === field) {
|
||||
return h(NInput, {
|
||||
value: editDraft.value,
|
||||
size: 'small',
|
||||
style: 'width: 140px',
|
||||
onUpdateValue: v => (editDraft.value = v),
|
||||
onKeyup: (e) => { if (e.key === 'Enter') saveEdit(row) },
|
||||
onBlur: () => saveEdit(row),
|
||||
})
|
||||
}
|
||||
return h('span', { class: 'dept', onClick: () => startEdit(row, field) },
|
||||
row[field] || '—')
|
||||
}
|
||||
async function toggleAdmin(row) {
|
||||
try { await adminAccountUpdate({ account: row.account, is_admin: !row.is_admin }); await refresh() }
|
||||
catch (e) { ElMessage.error(e.message || e) }
|
||||
catch (e) { message.error(e.message || e) }
|
||||
}
|
||||
async function resetPwd(row) {
|
||||
let newp
|
||||
try {
|
||||
({ value: newp } = await ElMessageBox.prompt(`为账号 ${row.account} 设置新密码(至少 6 位)`, '重置密码', {
|
||||
inputType: 'password', inputPattern: /^.{6,}$/, inputErrorMessage: '密码至少 6 位',
|
||||
}))
|
||||
} catch (_) { return }
|
||||
try { await adminAccountReset({ account: row.account, new_password: newp }); ElMessage.success(`已重置 ${row.account} 密码`) }
|
||||
catch (e) { ElMessage.error(e.message || e) }
|
||||
|
||||
function renderTags(list, kind) {
|
||||
if (!list || !list.length) return h('span', { class: 'dim' }, '—')
|
||||
return h('div', { class: 'tags' }, list.map(t => h(NTag, {
|
||||
size: 'small', round: true, bordered: false,
|
||||
type: kind === 'platform' ? 'success' : 'primary',
|
||||
}, { default: () => t })))
|
||||
}
|
||||
async function delAccount(row) {
|
||||
try {
|
||||
await ElMessageBox.confirm(`确认删除账号 ${row.account}?其插件授权将一并清除`, '删除账号', { type: 'warning' })
|
||||
} catch (_) { return }
|
||||
try { await adminAccountDelete({ account: row.account }); ElMessage.success(`已删除 ${row.account}`); await refresh() }
|
||||
catch (e) { ElMessage.error(e.message || e) }
|
||||
|
||||
const columns = computed(() => [
|
||||
{ title: '账号', key: 'account', width: 140, render: r => h('b', { class: 'cell-strong' }, r.account) },
|
||||
{ title: '昵称', key: 'nickname', width: 150, render: r => inlineInput(r, 'nickname') },
|
||||
{
|
||||
title: '部门', key: 'dept', width: 160,
|
||||
render: (row) => inlineInput(row, 'dept'),
|
||||
},
|
||||
{
|
||||
title: '管理员', key: 'is_admin', width: 100,
|
||||
render: (row) => h(NSwitch, {
|
||||
value: !!row.is_admin,
|
||||
disabled: row.account === current.value,
|
||||
onUpdateValue: () => toggleAdmin(row),
|
||||
}),
|
||||
},
|
||||
{ title: '已授权插件', key: 'plugins', minWidth: 180, render: r => renderTags(r.plugins, 'plugin') },
|
||||
{ title: '已授权平台', key: 'platforms', minWidth: 140, render: r => renderTags(r.platforms, 'platform') },
|
||||
{
|
||||
title: '操作', key: 'actions', width: 170,
|
||||
render: (row) => h('div', { class: 'ops' }, [
|
||||
h(NButton, { text: true, type: 'primary', onClick: () => resetPwd(row) }, { default: () => '重置密码' }),
|
||||
h(NButton, {
|
||||
text: true, type: 'error',
|
||||
disabled: row.account === current.value,
|
||||
onClick: () => delAccount(row),
|
||||
}, { default: () => '删除' }),
|
||||
]),
|
||||
},
|
||||
])
|
||||
|
||||
// ---------- 新建账号 ----------
|
||||
const createOpen = ref(false)
|
||||
const creating = ref(false)
|
||||
const formRef = ref()
|
||||
const form = reactive({ account: '', password: '', dept: '', nickname: '', is_admin: false })
|
||||
const rules = {
|
||||
account: { required: true, message: '请输入账号' },
|
||||
password: [
|
||||
{ required: true, message: '请输入初始密码' },
|
||||
{ min: 6, message: '密码至少 6 位' },
|
||||
],
|
||||
}
|
||||
async function refresh() {
|
||||
try { await loadOverview(true) } catch (e) { ElMessage.error('读取失败:' + (e.message || e)) }
|
||||
function openCreate() { createOpen.value = true }
|
||||
function resetCreate() {
|
||||
form.account = form.password = form.dept = form.nickname = ''
|
||||
form.is_admin = false
|
||||
formRef.value?.restoreValidation()
|
||||
}
|
||||
async function createAccount() {
|
||||
await formRef.value.validate().catch(() => Promise.reject())
|
||||
try { await formRef.value.validate() } catch (_) { return }
|
||||
creating.value = true
|
||||
try {
|
||||
await adminAccountCreate({ ...form, account: form.account.trim() })
|
||||
ElMessage.success(`已建号 ${form.account.trim()}`)
|
||||
message.success(`已建号 ${form.account.trim()}`)
|
||||
createOpen.value = false
|
||||
await refresh()
|
||||
} catch (e) { ElMessage.error('建号失败:' + (e.message || e)) }
|
||||
} catch (e) { message.error('建号失败:' + (e.message || e)) }
|
||||
finally { creating.value = false }
|
||||
}
|
||||
|
||||
// ---------- 重置密码 ----------
|
||||
const resetOpen = ref(false)
|
||||
const resetTarget = ref('')
|
||||
const resetPwdVal = ref('')
|
||||
const resetting = ref(false)
|
||||
function resetPwd(row) {
|
||||
resetTarget.value = row.account
|
||||
resetPwdVal.value = ''
|
||||
resetOpen.value = true
|
||||
}
|
||||
async function confirmReset() {
|
||||
const p = resetPwdVal.value
|
||||
if (p.length < 6) { message.warning('密码至少 6 位'); return }
|
||||
resetting.value = true
|
||||
try {
|
||||
await adminAccountReset({ account: resetTarget.value, new_password: p })
|
||||
message.success(`已重置 ${resetTarget.value} 密码`)
|
||||
resetOpen.value = false
|
||||
} catch (e) { message.error(e.message || e) }
|
||||
finally { resetting.value = false }
|
||||
}
|
||||
|
||||
function delAccount(row) {
|
||||
dialog.warning({
|
||||
title: '删除账号',
|
||||
content: `确认删除账号 ${row.account}?其插件授权将一并清除`,
|
||||
positiveText: '删除',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: async () => {
|
||||
try { await adminAccountDelete({ account: row.account }); message.success(`已删除 ${row.account}`); await refresh() }
|
||||
catch (e) { message.error(e.message || e) }
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
async function refresh() {
|
||||
try { await loadOverview(true) } catch (e) { message.error('读取失败:' + (e.message || e)) }
|
||||
}
|
||||
onMounted(refresh)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
|
||||
.page-head h3 { margin: 0 0 4px; font-size: 17px; }
|
||||
.page-head p { margin: 0; font-size: 12px; color: var(--el-text-color-secondary); }
|
||||
.dept { cursor: pointer; }
|
||||
.dept:hover { color: var(--el-color-primary); }
|
||||
.tag { margin-right: 5px; }
|
||||
.dim { color: var(--el-text-color-placeholder); }
|
||||
.dept { cursor: pointer; border-bottom: 1px dashed transparent; transition: border-color .15s; }
|
||||
.dept:hover { color: var(--cp-blue); border-bottom-color: rgba(59, 108, 255, .4); }
|
||||
</style>
|
||||
|
||||
<!-- 列 render 中由 naive-ui 动态渲染的节点不继承 scoped scopeId,须用全局样式 -->
|
||||
<style>
|
||||
.ops { display: flex; align-items: center; gap: 16px; }
|
||||
.ops .n-button { padding: 0 4px; }
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
<div class="page-head cp-rise">
|
||||
<div>
|
||||
<h3>审计与运行报表 <span class="badge">Audit</span></h3>
|
||||
<p>操作审计 · 部署端运行上报记录(最新在前)</p>
|
||||
</div>
|
||||
<n-button :loading="busy" @click="refresh">
|
||||
<template #icon><n-icon><Refresh /></n-icon></template>刷新
|
||||
</n-button>
|
||||
</div>
|
||||
|
||||
<n-tabs type="line" class="block cp-rise" :value="tab" @update:value="v => tab = v" justify-content="space-evenly">
|
||||
<n-tab-pane name="audit" tab="操作审计">
|
||||
<n-data-table :columns="auditCols" :data="audits" size="small" :loading="busy" :row-key="r => r.id" :single-line="false" />
|
||||
</n-tab-pane>
|
||||
<n-tab-pane name="report" tab="运行上报">
|
||||
<n-data-table :columns="reportCols" :data="reports" size="small" :loading="busy" :row-key="r => r.id" :single-line="false" />
|
||||
</n-tab-pane>
|
||||
</n-tabs>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { h } from 'vue'
|
||||
import { NTag } from 'naive-ui'
|
||||
import { Refresh } from '@element-plus/icons-vue'
|
||||
import { adminAudit, adminReports } from '../api'
|
||||
import { message } from '../naive'
|
||||
|
||||
const tab = ref('audit')
|
||||
const busy = ref(false)
|
||||
const audits = ref([])
|
||||
const reports = ref([])
|
||||
|
||||
const DETAIL_LABEL = {
|
||||
grant: '授权', 'revoke-grant': '撤销授权', 'plugin-patch': '更新插件',
|
||||
'download-ticket': '下载', 'upload-pkg': '上传', 'account-create': '建号',
|
||||
'account-update': '改号', 'account-reset': '重置密码', 'account-delete': '删除',
|
||||
'platform-grant': '平台授权', login: '登录',
|
||||
}
|
||||
function actTag(a) {
|
||||
const map = { grant: 'info', 'revoke-grant': 'error', 'plugin-patch': 'warning',
|
||||
'download-ticket': 'success', 'upload-pkg': 'success', login: 'info', }
|
||||
return h(NTag, { size: 'small', bordered: false, type: map[a] || 'default', round: true },
|
||||
{ default: () => DETAIL_LABEL[a] || a })
|
||||
}
|
||||
function acctCell(r) {
|
||||
const nn = r.nickname
|
||||
if (!r.account && !nn) return h('span', { class: 'dim' }, '—')
|
||||
if (!nn) return h('span', null, r.account || '—')
|
||||
return h('div', { class: 'acct' }, [
|
||||
h('div', { class: 'ann' }, r.account || '—'),
|
||||
h('div', { class: 'anick' }, nn || ''),
|
||||
])
|
||||
}
|
||||
function statusTag(s) {
|
||||
const map = { start: 'info', running: 'info', done: 'success', error: 'error' }
|
||||
return h(NTag, { size: 'small', bordered: false, type: map[s] || 'default', round: true },
|
||||
{ default: () => s || '—' })
|
||||
}
|
||||
|
||||
const auditCols = [
|
||||
{ title: '时间', key: 'at', width: 170 },
|
||||
{ title: '操作', key: 'action', width: 130, render: r => actTag(r.action) },
|
||||
{ title: '账号', key: 'account', width: 130, render: r => acctCell(r) },
|
||||
{ title: '对象', key: 'target', width: 140, ellipsis: { tooltip: true } },
|
||||
{ title: '详情', key: 'detail', minWidth: 220, ellipsis: { tooltip: true } },
|
||||
]
|
||||
const reportCols = [
|
||||
{ title: '时间', key: 'at', width: 170 },
|
||||
{ title: '状态', key: 'status', width: 100, render: r => statusTag(r.status) },
|
||||
{ title: '账号', key: 'account', width: 130, render: r => acctCell(r) },
|
||||
{ title: '设备', key: 'device_id', width: 110, render: r => r.device_id || h('span', { class: 'dim' }, '—') },
|
||||
{ title: '插件', key: 'plugin_id', width: 140, ellipsis: { tooltip: true } },
|
||||
{ title: '版本', key: 'version', width: 90 },
|
||||
{ title: '时长', key: 'duration_sec', width: 90, render: r => typeof r.duration_sec === 'number' ? fmtDur(r.duration_sec) : '—' },
|
||||
{ title: '消息', key: 'msg', minWidth: 200, ellipsis: { tooltip: true } },
|
||||
]
|
||||
function fmtDur(sec) {
|
||||
sec = +sec || 0
|
||||
if (sec < 60) return sec + 's'
|
||||
const m = Math.floor(sec / 60), s = sec % 60
|
||||
if (m < 60) return `${m}m${s ? s + 's' : ''}`
|
||||
return `${Math.floor(m / 60)}h${m % 60}m`
|
||||
}
|
||||
|
||||
async function refresh() {
|
||||
busy.value = true
|
||||
try {
|
||||
const [a, r] = await Promise.all([adminAudit(), adminReports()])
|
||||
audits.value = a.auditlogs || []
|
||||
reports.value = r.reports || []
|
||||
} catch (e) { message.error('读取失败:' + (e.message || e)) }
|
||||
finally { busy.value = false }
|
||||
}
|
||||
onMounted(refresh)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.dim { color: var(--cp-ink-3); }
|
||||
</style>
|
||||
<style>
|
||||
.acct { line-height: 1.25; }
|
||||
.acct .ann { font-size: 13px; color: var(--cp-ink-1); }
|
||||
.acct .anick { font-size: 11px; color: var(--cp-ink-3); }
|
||||
</style>
|
||||
@@ -1,137 +1,227 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="page-head">
|
||||
<div class="page">
|
||||
<div class="page-head cp-rise">
|
||||
<div>
|
||||
<h3>权限授权</h3>
|
||||
<h3>权限授权 <span class="badge">Grants</span></h3>
|
||||
<p>按账号勾选可用插件与可登录平台,保存时仅提交差异项</p>
|
||||
</div>
|
||||
<el-button :icon="Refresh" :loading="overviewBusy" @click="refresh">刷新</el-button>
|
||||
<n-button :loading="overviewBusy" @click="refresh">
|
||||
<template #icon><n-icon><Refresh /></n-icon></template>刷新
|
||||
</n-button>
|
||||
</div>
|
||||
|
||||
<el-card shadow="never" class="block">
|
||||
<el-form inline>
|
||||
<el-form-item label="选择账号">
|
||||
<el-select v-model="account" placeholder="选择账号…" style="width: 240px" filterable>
|
||||
<el-option v-for="a in accounts" :key="a.account" :value="a.account"
|
||||
:label="a.dept ? `${a.account} · ${a.dept}` : a.account" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="account">
|
||||
<el-text type="info" size="small">
|
||||
{{ account }} · 已授权 {{ checked.length }} 个插件 / {{ platChecked.length }} 个平台
|
||||
</el-text>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<n-card class="block cp-rise" :bordered="false">
|
||||
<n-form inline>
|
||||
<n-form-item label="选择账号">
|
||||
<n-select
|
||||
v-model:value="account"
|
||||
:options="accountOptions"
|
||||
placeholder="选择账号…"
|
||||
style="width: 240px"
|
||||
filterable
|
||||
clearable
|
||||
/>
|
||||
</n-form-item>
|
||||
<n-form-item v-if="account">
|
||||
<span class="sel-hint">{{ account }} · 已授权 {{ grantedIds.length }} 个插件 / {{ platChecked.length }} 个平台</span>
|
||||
</n-form-item>
|
||||
</n-form>
|
||||
</n-card>
|
||||
|
||||
<template v-if="account">
|
||||
<el-card shadow="never" class="block">
|
||||
<n-card class="block cp-rise" :bordered="false">
|
||||
<template #header>
|
||||
<div class="card-head"><b>插件授权</b>
|
||||
<el-button type="primary" size="small" :loading="saving" @click="saveGrant">保存插件授权</el-button>
|
||||
<div class="card-head">
|
||||
<b>插件授权</b>
|
||||
<n-button type="primary" size="small" :loading="saving" @click="saveGrant">保存插件授权</n-button>
|
||||
</div>
|
||||
</template>
|
||||
<el-checkbox-group v-model="checked" v-if="plugins.length">
|
||||
<el-checkbox v-for="p in plugins" :key="p.id" :value="p.id" class="ck">
|
||||
{{ p.id }}<span class="dim">({{ p.name }})</span>
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
<el-empty description="暂无插件,请先在「插件管理」上传" :image-size="60" v-else />
|
||||
</el-card>
|
||||
<n-checkbox-group v-model:value="grantedIds" v-if="plugins.length">
|
||||
<div class="ck-grid">
|
||||
<n-checkbox v-for="p in plugins" :key="p.id" :value="p.id" class="ck">
|
||||
<span class="ck-main">
|
||||
<span>{{ p.id }}<span class="dim">({{ p.name }})</span></span>
|
||||
<span class="ck-sub" v-if="grantState[p.id]?.granted">
|
||||
<n-switch size="small" :value="grantState[p.id].canRun"
|
||||
@update:value="v => setGrant(p.id, { canRun: v })">
|
||||
<template #checked>可运行</template>
|
||||
<template #unchecked>禁运行</template>
|
||||
</n-switch>
|
||||
<n-switch size="small" :value="grantState[p.id].canDownload"
|
||||
@update:value="v => setGrant(p.id, { canDownload: v })">
|
||||
<template #checked>可下载</template>
|
||||
<template #unchecked>禁下载</template>
|
||||
</n-switch>
|
||||
</span>
|
||||
</span>
|
||||
</n-checkbox>
|
||||
</div>
|
||||
</n-checkbox-group>
|
||||
<n-empty v-else description="暂无插件,请先在「插件管理」上传" size="small" />
|
||||
</n-card>
|
||||
|
||||
<el-card shadow="never" class="block">
|
||||
<n-card class="block cp-rise" :bordered="false">
|
||||
<template #header>
|
||||
<div class="card-head"><b>平台授权</b>
|
||||
<el-button type="primary" size="small" :loading="savingPlat" @click="savePlat">保存平台授权</el-button>
|
||||
<div class="card-head">
|
||||
<b>平台授权</b>
|
||||
<n-button type="primary" size="small" :loading="savingPlat" @click="savePlat">保存平台授权</n-button>
|
||||
</div>
|
||||
</template>
|
||||
<el-checkbox-group v-model="platChecked">
|
||||
<el-checkbox v-for="pf in PLATFORM_OPTS" :key="pf.id" :value="pf.id" class="ck">
|
||||
{{ pf.label }}<span class="dim">({{ pf.id }})</span>
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-card>
|
||||
<n-checkbox-group v-model:value="platChecked">
|
||||
<div class="ck-grid">
|
||||
<n-checkbox v-for="pf in PLATFORM_OPTS" :key="pf.id" :value="pf.id" class="ck">
|
||||
{{ pf.label }}<span class="dim">({{ pf.id }})</span>
|
||||
</n-checkbox>
|
||||
</div>
|
||||
</n-checkbox-group>
|
||||
</n-card>
|
||||
</template>
|
||||
<el-empty v-else description="先在上方选择一个账号" :image-size="90" />
|
||||
|
||||
<n-empty v-else description="先在上方选择一个账号" class="no-acc cp-rise" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, onMounted, ref, watch } from 'vue'
|
||||
import { Refresh } from '@element-plus/icons-vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { overview, overviewBusy, loadOverview } from '../store'
|
||||
import { adminGrant, adminPlatformGrant } from '../api'
|
||||
import { adminGrant, adminPlatformGrant, adminPlatforms } from '../api'
|
||||
import { message } from '../naive'
|
||||
|
||||
const PLATFORM_OPTS = [
|
||||
{ id: 'hr', label: 'HR 系统' },
|
||||
{ id: 'oa', label: 'OA 系统' },
|
||||
]
|
||||
const PLATFORM_OPTS = ref([])
|
||||
|
||||
const plugins = computed(() => overview.value?.plugins || [])
|
||||
const accounts = computed(() => overview.value?.accounts || [])
|
||||
const accountOptions = computed(() => accounts.value.map(a => ({
|
||||
label: a.dept ? `${a.account} · ${a.dept}` : a.account,
|
||||
value: a.account,
|
||||
})))
|
||||
|
||||
const account = ref('')
|
||||
const checked = ref([])
|
||||
const grantedIds = ref([])
|
||||
const grantState = ref({}) // plugin_id -> { granted, canRun, canDownload }
|
||||
const platChecked = ref([])
|
||||
const saving = ref(false)
|
||||
const savingPlat = ref(false)
|
||||
let heldPlugins = new Set()
|
||||
let heldGrantState = {} // 已保存快照,用于差异比对
|
||||
let heldPlatforms = new Set()
|
||||
|
||||
function setGrant(pid, patch) {
|
||||
grantState.value[pid] = { ...grantState.value[pid], ...patch }
|
||||
grantState.value = { ...grantState.value }
|
||||
}
|
||||
|
||||
// 选中账号即自动载入其现有授权
|
||||
watch(account, (acc) => {
|
||||
const a = accounts.value.find(x => x.account === acc)
|
||||
heldPlugins = new Set(a?.plugins || [])
|
||||
const state = {}
|
||||
;(a?.plugins || []).forEach(pid => {
|
||||
const g = a?.grants?.[pid] || {}
|
||||
state[pid] = { granted: true, canRun: g.canRun !== false, canDownload: g.canDownload !== false }
|
||||
})
|
||||
heldGrantState = JSON.parse(JSON.stringify(state))
|
||||
grantState.value = JSON.parse(JSON.stringify(state))
|
||||
grantedIds.value = [...(a?.plugins || [])]
|
||||
heldPlatforms = new Set(a?.platforms || [])
|
||||
checked.value = [...heldPlugins]
|
||||
platChecked.value = [...heldPlatforms]
|
||||
})
|
||||
|
||||
// 勾选/取消勾选插件时同步 granted 状态
|
||||
watch(grantedIds, (ids) => {
|
||||
const state = { ...grantState.value }
|
||||
ids.forEach(pid => {
|
||||
if (!state[pid]) state[pid] = { granted: true, canRun: true, canDownload: true }
|
||||
else state[pid].granted = true
|
||||
})
|
||||
Object.keys(state).forEach(pid => {
|
||||
if (!ids.includes(pid)) state[pid].granted = false
|
||||
})
|
||||
grantState.value = state
|
||||
})
|
||||
|
||||
async function refresh() {
|
||||
try { await loadOverview(true) } catch (e) { ElMessage.error('读取失败:' + (e.message || e)) }
|
||||
try { await loadOverview(true) } catch (e) { message.error('读取失败:' + (e.message || e)) }
|
||||
}
|
||||
// 拉取可授权平台列表(后端只读接口,替代写死 hr/oa)
|
||||
async function loadPlatforms() {
|
||||
try {
|
||||
const r = await adminPlatforms()
|
||||
PLATFORM_OPTS.value = (r.platforms || []).map(p => ({ id: p.id, label: p.label }))
|
||||
} catch (e) { message.error('平台列表读取失败:' + (e.message || e)) }
|
||||
}
|
||||
|
||||
async function saveGrant() {
|
||||
const acc = account.value; if (!acc) return
|
||||
const want = new Set(checked.value)
|
||||
let n = 0
|
||||
saving.value = true
|
||||
for (const pid of new Set([...want, ...heldPlugins])) {
|
||||
const g = want.has(pid)
|
||||
if (g === heldPlugins.has(pid)) continue
|
||||
try { await adminGrant({ account: acc, plugin_id: pid, granted: g }); n++ }
|
||||
catch (e) { ElMessage.error(e.message || e) }
|
||||
}
|
||||
heldPlugins = want
|
||||
saving.value = false
|
||||
await refresh()
|
||||
ElMessage.success(n ? `已更新 ${n} 项插件授权` : '插件授权无需变更')
|
||||
try {
|
||||
const want = {}
|
||||
Object.entries(grantState.value).forEach(([pid, s]) => {
|
||||
if (s.granted) want[pid] = s
|
||||
})
|
||||
const allPids = [...new Set([...Object.keys(want), ...Object.keys(heldGrantState)])]
|
||||
const diff = allPids.filter(pid => {
|
||||
const w = want[pid]; const h = heldGrantState[pid]
|
||||
if (!!w !== !!h) return true
|
||||
if (w && h) return w.canRun !== h.canRun || w.canDownload !== h.canDownload
|
||||
return false
|
||||
})
|
||||
if (!diff.length) { message.info('插件授权无需变更'); return }
|
||||
const results = await Promise.allSettled(diff.map(pid => adminGrant({
|
||||
account: acc, plugin_id: pid, granted: !!want[pid],
|
||||
can_run: want[pid]?.canRun !== false, can_download: want[pid]?.canDownload !== false,
|
||||
})))
|
||||
const failed = results.filter(r => r.status === 'rejected')
|
||||
failed.forEach(r => message.error(r.reason?.message || String(r.reason)))
|
||||
if (failed.length) { message.warning(`插件授权:${diff.length - failed.length} 项成功,${failed.length} 项失败`); return }
|
||||
message.success(`已更新 ${diff.length} 项插件授权`)
|
||||
heldGrantState = JSON.parse(JSON.stringify(grantState.value))
|
||||
await refresh()
|
||||
} finally { saving.value = false }
|
||||
}
|
||||
async function savePlat() {
|
||||
const acc = account.value; if (!acc) return
|
||||
const want = new Set(platChecked.value)
|
||||
let n = 0
|
||||
savingPlat.value = true
|
||||
for (const pf of new Set([...want, ...heldPlatforms])) {
|
||||
const g = want.has(pf)
|
||||
if (g === heldPlatforms.has(pf)) continue
|
||||
try { await adminPlatformGrant({ account: acc, platform_id: pf, granted: g }); n++ }
|
||||
catch (e) { ElMessage.error(e.message || e) }
|
||||
}
|
||||
heldPlatforms = want
|
||||
savingPlat.value = false
|
||||
await refresh()
|
||||
ElMessage.success(n ? `已更新 ${n} 项平台授权` : '平台授权无需变更')
|
||||
try {
|
||||
const want = new Set(platChecked.value)
|
||||
const diff = [...new Set([...want, ...heldPlatforms])].filter(pf => want.has(pf) !== heldPlatforms.has(pf))
|
||||
if (!diff.length) { message.info('平台授权无需变更'); return }
|
||||
const results = await Promise.allSettled(diff.map(pf => adminPlatformGrant({
|
||||
account: acc, platform_id: pf, granted: want.has(pf),
|
||||
})))
|
||||
const failed = results.filter(r => r.status === 'rejected')
|
||||
failed.forEach(r => message.error(r.reason?.message || String(r.reason)))
|
||||
if (failed.length) { message.warning(`平台授权:${diff.length - failed.length} 项成功,${failed.length} 项失败`); return }
|
||||
message.success(`已更新 ${diff.length} 项平台授权`)
|
||||
heldPlatforms = new Set(platChecked.value)
|
||||
await refresh()
|
||||
} finally { savingPlat.value = false }
|
||||
}
|
||||
onMounted(refresh)
|
||||
onMounted(() => { refresh(); loadPlatforms() })
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
|
||||
.page-head h3 { margin: 0 0 4px; font-size: 17px; }
|
||||
.page-head p { margin: 0; font-size: 12px; color: var(--el-text-color-secondary); }
|
||||
.block { margin-bottom: 14px; }
|
||||
.card-head { display: flex; justify-content: space-between; align-items: center; }
|
||||
.ck { margin-right: 18px; }
|
||||
.dim { color: var(--el-text-color-secondary); font-size: 12px; margin-left: 2px; }
|
||||
.sel-hint { font-size: 12px; color: var(--cp-ink-2); }
|
||||
.no-acc { margin-top: 60px; }
|
||||
|
||||
/* 授权项:卡片式勾选 */
|
||||
.ck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
|
||||
.ck-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; line-height: 1.2; }
|
||||
.ck-sub { display: flex; align-items: center; gap: 10px; }
|
||||
:deep(.n-checkbox) {
|
||||
display: flex; align-items: center; margin: 0;
|
||||
width: 100%;
|
||||
padding: 12px 14px;
|
||||
border: 1px solid var(--cp-border);
|
||||
border-radius: 12px;
|
||||
background: rgba(255, 255, 255, .65);
|
||||
transition: border-color .18s, background .18s, box-shadow .18s;
|
||||
}
|
||||
:deep(.n-checkbox:hover) { border-color: rgba(59, 108, 255, .4); }
|
||||
:deep(.n-checkbox.n-checkbox--checked) {
|
||||
border-color: rgba(59, 108, 255, .45);
|
||||
background: linear-gradient(135deg, rgba(59, 108, 255, .08), rgba(34, 199, 232, .06));
|
||||
box-shadow: 0 8px 18px -10px rgba(59, 108, 255, .35);
|
||||
}
|
||||
:deep(.n-checkbox .n-checkbox__label) { padding-left: 4px; flex: 1; min-width: 0; }
|
||||
</style>
|
||||
|
||||
@@ -1,67 +1,112 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="page-head">
|
||||
<div class="page">
|
||||
<div class="page-head cp-rise">
|
||||
<div>
|
||||
<h3>概览</h3>
|
||||
<p>中心机 · 插件分发与账号权限 · 当前账号 {{ store.current }}</p>
|
||||
<h3>概览 <span class="badge">Dashboard</span></h3>
|
||||
<p>中心机 · 插件分发与账号权限 · 当前账号 <b class="who">{{ store.current }}</b></p>
|
||||
</div>
|
||||
<el-button :icon="Refresh" :loading="overviewBusy" @click="refresh">刷新</el-button>
|
||||
<n-button :loading="overviewBusy" @click="refresh">
|
||||
<template #icon><n-icon><Refresh /></n-icon></template>刷新
|
||||
</n-button>
|
||||
</div>
|
||||
|
||||
<el-row :gutter="14" v-if="ov">
|
||||
<el-col :span="5" v-for="s in stats" :key="s.label">
|
||||
<el-card shadow="never" class="stat-card">
|
||||
<div class="stat-num">{{ s.value }}</div>
|
||||
<div class="stat-grid" v-if="ov">
|
||||
<div class="stat-card" v-for="(s, i) in stats" :key="s.label" :style="{ animationDelay: i * 60 + 'ms' }">
|
||||
<div class="stat-ic" :style="{ background: s.bg, color: s.color }">
|
||||
<n-icon :size="20"><component :is="s.icon" /></n-icon>
|
||||
</div>
|
||||
<div class="stat-meta">
|
||||
<div class="stat-num" :class="{ sm: s.small }">{{ s.value }}</div>
|
||||
<div class="stat-label">{{ s.label }}</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-skeleton :rows="2" animated v-else-if="overviewBusy" />
|
||||
</div>
|
||||
<span class="stat-glow" :style="{ background: s.color }"></span>
|
||||
</div>
|
||||
</div>
|
||||
<n-skeleton v-else-if="overviewBusy" text :repeat="3" style="margin-top: 20px" />
|
||||
|
||||
<el-card shadow="never" class="tip-card">
|
||||
<template #header><b>使用说明</b></template>
|
||||
<el-text type="info" size="small">
|
||||
「插件管理」上传与发布插件包(每插件保留最近 3 个版本);「账号管理」建号与账号维护;
|
||||
「权限授权」按账号勾选可用的插件与平台。部署机(webhost)仅在启动与手动刷新时拉取插件,
|
||||
授权变更后需在部署机刷新生效。
|
||||
</el-text>
|
||||
</el-card>
|
||||
<div class="tip-card cp-rise">
|
||||
<div class="tip-ic"><n-icon :size="18"><InfoFilled /></n-icon></div>
|
||||
<div class="tip-body">
|
||||
<b>使用说明</b>
|
||||
<p>「插件管理」上传与发布插件包(每插件保留最近 3 个版本);「账号管理」建号与账号维护;「权限授权」按账号勾选可用的插件与平台。部署机(webhost)仅在启动与手动刷新时拉取插件,授权变更后需在部署机刷新生效。</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, onMounted } from 'vue'
|
||||
import { Refresh } from '@element-plus/icons-vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Refresh, InfoFilled } from '@element-plus/icons-vue'
|
||||
import { store, overview, overviewBusy, loadOverview } from '../store'
|
||||
import { message } from '../naive'
|
||||
|
||||
const ov = computed(() => overview.value)
|
||||
const stats = computed(() => {
|
||||
const plugins = ov.value?.plugins || []
|
||||
return [
|
||||
{ label: '插件', value: plugins.length },
|
||||
{ label: '版本总数', value: plugins.reduce((n, p) => n + (p.versions?.length || 0), 0) },
|
||||
{ label: '账号', value: (ov.value?.accounts || []).length },
|
||||
{ label: '管理员', value: (ov.value?.admins || []).length },
|
||||
{ label: '最近上传', value: latest() },
|
||||
{ label: '插件', value: plugins.length, icon: 'Box', color: '#3b6cff', bg: 'linear-gradient(135deg,#eef2ff,#dbe6ff)' },
|
||||
{ label: '版本总数', value: plugins.reduce((n, p) => n + (p.versions?.length || 0), 0), icon: 'Collection', color: '#7c5cff', bg: 'linear-gradient(135deg,#f2edff,#e6dcff)' },
|
||||
{ label: '账号', value: (ov.value?.accounts || []).length, icon: 'User', color: '#12a4d8', bg: 'linear-gradient(135deg,#e7f6fb,#d3effa)' },
|
||||
{ label: '管理员', value: (ov.value?.admins || []).length, icon: 'UserFilled', color: '#22b07a', bg: 'linear-gradient(135deg,#e6f7f0,#d2f1e4)' },
|
||||
{ label: '最近上传', value: latest(), icon: 'UploadFilled', color: '#d99a1b', bg: 'linear-gradient(135deg,#fbf3e2,#f6e8c8)', small: true },
|
||||
]
|
||||
})
|
||||
function latest() {
|
||||
const all = (ov.value?.plugins || []).flatMap(p => p.versions || []).map(v => v.uploaded_at).filter(Boolean)
|
||||
return all.length ? all.sort().at(-1) : '—'
|
||||
if (!all.length) return '—'
|
||||
// ISO 时间转友好格式:2026-09-10T12:51:33 → 2026-09-10 12:51
|
||||
return all.sort().at(-1).replace('T', ' ').slice(0, 16)
|
||||
}
|
||||
async function refresh() {
|
||||
try { await loadOverview(true) } catch (e) { ElMessage.error('读取失败:' + (e.message || e)) }
|
||||
try { await loadOverview(true) } catch (e) { message.error('读取失败:' + (e.message || e)) }
|
||||
}
|
||||
onMounted(refresh)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
|
||||
.page-head h3 { margin: 0 0 4px; font-size: 17px; }
|
||||
.page-head p { margin: 0; font-size: 12px; color: var(--el-text-color-secondary); }
|
||||
.stat-card { text-align: left; }
|
||||
.stat-num { font-size: 24px; font-weight: 700; color: var(--el-text-color-primary); line-height: 1.2; }
|
||||
.stat-label { font-size: 12px; color: var(--el-text-color-secondary); margin-top: 4px; }
|
||||
.tip-card { margin-top: 14px; }
|
||||
.stat-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
.stat-card {
|
||||
position: relative; overflow: hidden;
|
||||
display: flex; align-items: center; gap: 14px;
|
||||
background: var(--cp-surface);
|
||||
border: 1px solid var(--cp-border);
|
||||
border-radius: 18px;
|
||||
padding: 18px;
|
||||
box-shadow: var(--cp-card-shadow);
|
||||
transition: transform .22s ease, box-shadow .22s ease;
|
||||
animation: cp-rise .5s cubic-bezier(.22, .61, .36, 1) both;
|
||||
}
|
||||
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--cp-card-shadow-hover); }
|
||||
.stat-ic {
|
||||
width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0;
|
||||
display: grid; place-items: center;
|
||||
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .6);
|
||||
}
|
||||
.stat-meta { min-width: 0; }
|
||||
.stat-num { font-size: 26px; font-weight: 800; letter-spacing: .3px; line-height: 1.15; color: var(--cp-ink); font-variant-numeric: tabular-nums; }
|
||||
.stat-num.sm { font-size: 13px; font-weight: 600; word-break: break-all; line-height: 1.4; }
|
||||
.stat-label { font-size: 12px; color: var(--cp-ink-3); margin-top: 3px; }
|
||||
.stat-glow { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; border-radius: 0 6px 6px 0; opacity: .9; }
|
||||
|
||||
.tip-card {
|
||||
margin-top: 18px;
|
||||
display: flex; gap: 14px;
|
||||
background: linear-gradient(135deg, rgba(59, 108, 255, .06), rgba(34, 199, 232, .05)), rgba(255, 255, 255, .7);
|
||||
border: 1px solid rgba(59, 108, 255, .16);
|
||||
border-radius: 16px;
|
||||
padding: 18px 20px;
|
||||
}
|
||||
.tip-ic {
|
||||
width: 38px; height: 38px; border-radius: 12px; flex-shrink: 0;
|
||||
display: grid; place-items: center;
|
||||
background: linear-gradient(135deg, #3b6cff, #22c7e8);
|
||||
color: #fff;
|
||||
box-shadow: 0 6px 14px -6px rgba(59, 108, 255, .55);
|
||||
}
|
||||
.tip-body b { display: block; font-size: 14px; color: var(--cp-ink); margin-bottom: 4px; }
|
||||
.tip-body p { margin: 0; font-size: 12.5px; line-height: 1.7; color: var(--cp-ink-2); }
|
||||
</style>
|
||||
|
||||
@@ -1,112 +1,241 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="page-head">
|
||||
<div class="page">
|
||||
<div class="page-head cp-rise">
|
||||
<div>
|
||||
<h3>插件管理</h3>
|
||||
<h3>插件管理 <span class="badge">Plugins</span></h3>
|
||||
<p>上传发布插件包 · 每插件保留最近 3 个版本,超出自动清理</p>
|
||||
</div>
|
||||
<el-button :icon="Refresh" :loading="overviewBusy" @click="refresh">刷新</el-button>
|
||||
<n-button :loading="overviewBusy" @click="refresh">
|
||||
<template #icon><n-icon><Refresh /></n-icon></template>刷新
|
||||
</n-button>
|
||||
</div>
|
||||
|
||||
<el-card shadow="never" class="block">
|
||||
<template #header><b>上传插件包</b></template>
|
||||
<el-form inline>
|
||||
<el-form-item label="插件 ID">
|
||||
<el-input v-model="pid" placeholder="如 seal_check" style="width: 150px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="名称">
|
||||
<el-input v-model="pname" placeholder="插件显示名" style="width: 150px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版本">
|
||||
<el-input v-model="pver" placeholder="如 1.1.0" style="width: 110px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="包文件">
|
||||
<el-select v-if="pfile" :model-value="pfile.name" style="width: 240px" allow-create filterable>
|
||||
<el-option :label="pfile.name" :value="pfile.name" />
|
||||
</el-select>
|
||||
<el-upload :show-file-list="false" :auto-upload="false" accept=".zip"
|
||||
:on-change="f => (pfile = f.raw)">
|
||||
<el-button :icon="UploadFilled">{{ pfile ? '重新选择' : '选择 ZIP 包' }}</el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" :loading="uploading" @click="upload">上传发布</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-text type="info" size="small">
|
||||
包根目录需含 plugin.json / main.py / requirements.txt,ZIP 完整性校验通过才会发布。
|
||||
</el-text>
|
||||
</el-card>
|
||||
<n-card class="block cp-rise" :bordered="false">
|
||||
<template #header><span class="card-title">上传插件包</span></template>
|
||||
<n-form inline>
|
||||
<n-form-item label="插件 ID">
|
||||
<n-input v-model:value="pid" placeholder="如 seal_check" style="width: 150px" />
|
||||
</n-form-item>
|
||||
<n-form-item label="名称">
|
||||
<n-input v-model:value="pname" placeholder="插件显示名" style="width: 150px" />
|
||||
</n-form-item>
|
||||
<n-form-item label="版本">
|
||||
<n-input v-model:value="pver" placeholder="如 1.1.0" style="width: 110px" />
|
||||
</n-form-item>
|
||||
<n-form-item label="包文件">
|
||||
<n-space align="center" :size="8">
|
||||
<n-upload :default-upload="false" :show-file-list="false" accept=".zip" @change="onFileChange">
|
||||
<n-button :type="pfile ? 'info' : 'default'">
|
||||
<template #icon><n-icon><UploadFilled /></n-icon></template>
|
||||
{{ pfile ? '重新选择' : '选择 ZIP 包' }}
|
||||
</n-button>
|
||||
</n-upload>
|
||||
<n-tag v-if="pfile" size="small" round type="info" :bordered="false">{{ pfile.name }}</n-tag>
|
||||
</n-space>
|
||||
</n-form-item>
|
||||
<n-form-item>
|
||||
<n-button type="primary" :loading="uploading" @click="upload">
|
||||
<template #icon v-if="!uploading"><n-icon><UploadFilled /></n-icon></template>上传发布
|
||||
</n-button>
|
||||
</n-form-item>
|
||||
</n-form>
|
||||
<div class="hint">包根目录需含 plugin.json / main.py / requirements.txt,ZIP 完整性校验通过才会发布。</div>
|
||||
</n-card>
|
||||
|
||||
<el-card shadow="never" class="block">
|
||||
<template #header><b>插件列表</b></template>
|
||||
<el-table :data="plugins" v-loading="overviewBusy" empty-text="暂无插件,请先上传">
|
||||
<el-table-column prop="id" label="插件 ID" min-width="130">
|
||||
<template #default="{ row }"><b>{{ row.id }}</b></template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="name" label="名称" min-width="140" />
|
||||
<el-table-column prop="latest_version" label="最新版" width="90" />
|
||||
<el-table-column label="版本历史" min-width="200">
|
||||
<template #default="{ row }">
|
||||
<el-tag v-for="v in row.versions" :key="v.version" size="small"
|
||||
:type="v.version === row.latest_version ? 'primary' : 'info'"
|
||||
effect="plain" class="ver-tag">{{ v.version }}</el-tag>
|
||||
<span v-if="!row.versions?.length" class="dim">—</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="授权账号" min-width="140">
|
||||
<template #default="{ row }">{{ row.accounts?.join('、') || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="90" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="danger" @click="delPlugin(row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
<n-card class="block cp-rise" :bordered="false">
|
||||
<template #header><span class="card-title">插件列表</span></template>
|
||||
<n-data-table
|
||||
:columns="columns"
|
||||
:data="plugins"
|
||||
:loading="overviewBusy"
|
||||
:row-key="r => r.id"
|
||||
:single-line="false"
|
||||
:row-props="rowProps"
|
||||
/>
|
||||
</n-card>
|
||||
|
||||
<n-modal v-model:show="editShow" preset="card" :bordered="false" style="width: 560px" :title="`编辑插件 · ${edit.pid}`">
|
||||
<n-form label-placement="top">
|
||||
<n-form-item label="名称">
|
||||
<n-input v-model:value="edit.name" placeholder="插件显示名" />
|
||||
</n-form-item>
|
||||
<n-form-item label="分类">
|
||||
<n-input v-model:value="edit.category" placeholder="如 薪酬 / 考勤 / 社保" />
|
||||
</n-form-item>
|
||||
<n-form-item label="描述">
|
||||
<n-input v-model:value="edit.description" type="textarea" :rows="2" placeholder="插件用途说明" />
|
||||
</n-form-item>
|
||||
<n-form-item label="状态">
|
||||
<n-radio-group v-model:value="edit.status">
|
||||
<n-radio-button value="published">正常发布</n-radio-button>
|
||||
<n-radio-button value="disabled">禁用(停止分发)</n-radio-button>
|
||||
<n-radio-button value="revoked">下架(禁止运行)</n-radio-button>
|
||||
</n-radio-group>
|
||||
</n-form-item>
|
||||
<n-form-item label="强制更新(留空表示不强制)" :show-feedback="false">
|
||||
<div class="force-row">
|
||||
<n-input v-model:value="edit.force_min" placeholder="最低版本,如 1.2.0" style="width: 180px" />
|
||||
<n-input v-model:value="edit.force_dl" type="datetime-local" placeholder="截止时间" style="width: 200px" />
|
||||
<span class="hint">到达截止时间后,未升级到该版本的部署机会被禁止启动</span>
|
||||
</div>
|
||||
</n-form-item>
|
||||
</n-form>
|
||||
<template #footer>
|
||||
<div class="modal-foot">
|
||||
<n-button @click="editShow = false">取消</n-button>
|
||||
<n-button type="primary" :loading="saving" @click="saveEdit">保存</n-button>
|
||||
</div>
|
||||
</template>
|
||||
</n-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { computed, h, onMounted, reactive, ref } from 'vue'
|
||||
import { NButton, NTag } from 'naive-ui'
|
||||
import { Refresh, UploadFilled } from '@element-plus/icons-vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { overview, overviewBusy, loadOverview } from '../store'
|
||||
import { adminUpload, adminPluginDelete } from '../api'
|
||||
import { adminUpload, adminPluginDelete, adminPluginPatch } from '../api'
|
||||
import { message, dialog } from '../naive'
|
||||
|
||||
const plugins = computed(() => overview.value?.plugins || [])
|
||||
const pid = ref(''); const pname = ref(''); const pver = ref(''); const pfile = ref(null)
|
||||
const uploading = ref(false)
|
||||
|
||||
// 状态徽标文案与配色
|
||||
const STATUS_META = {
|
||||
published: { label: '正常', type: 'success' },
|
||||
disabled: { label: '禁用', type: 'warning' },
|
||||
revoked: { label: '已下架', type: 'error' },
|
||||
}
|
||||
function renderStatus(row) {
|
||||
const s = STATUS_META[row.status] || { label: row.status || '—', type: 'default' }
|
||||
return h(NTag, { size: 'small', round: true, bordered: false, type: s.type }, { default: () => s.label })
|
||||
}
|
||||
|
||||
function onFileChange(e) {
|
||||
pfile.value = e?.file?.file || null
|
||||
}
|
||||
|
||||
function renderVersions(row) {
|
||||
const list = row.versions || []
|
||||
if (!list.length) return h('span', { class: 'dim' }, '—')
|
||||
return h('div', { class: 'tags' }, list.map(v => h(NTag, {
|
||||
size: 'small', round: true, bordered: false,
|
||||
type: v.version === row.latest_version ? 'primary' : 'default',
|
||||
}, { default: () => v.version })))
|
||||
}
|
||||
|
||||
// —— 编辑弹窗状态 ——
|
||||
const editShow = ref(false)
|
||||
const saving = ref(false)
|
||||
const edit = reactive({ pid: '', name: '', category: '', description: '', status: 'published', force_min: '', force_dl: '' })
|
||||
function openEdit(row) {
|
||||
edit.pid = row.id
|
||||
edit.name = row.name || ''
|
||||
edit.category = row.category || ''
|
||||
edit.description = row.description || ''
|
||||
edit.status = row.status || 'published'
|
||||
edit.force_min = row.force_min_version || ''
|
||||
edit.force_dl = toLocalInput(row.force_deadline)
|
||||
editShow.value = true
|
||||
}
|
||||
// ISO 时间 → datetime-local 输入框可识别的本地格式
|
||||
function toLocalInput(iso) {
|
||||
if (!iso) return ''
|
||||
const d = new Date(iso.endsWith('Z') ? iso : iso + 'Z')
|
||||
return isNaN(d) ? '' : `${String(d.getFullYear()).padStart(4, '0')}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}T${String(d.getHours()).padStart(2, '0')}:${String(d.getMinutes()).padStart(2, '0')}`
|
||||
}
|
||||
async function saveEdit() {
|
||||
if (!edit.pid) return
|
||||
saving.value = true
|
||||
try {
|
||||
const body = { name: edit.name, category: edit.category, description: edit.description, status: edit.status }
|
||||
// 强制更新:min 与 deadline 均填则成对下发;否则清除强制更新
|
||||
body.force_min_version = edit.force_min || null
|
||||
body.force_deadline = edit.force_dl ? new Date(edit.force_dl).toISOString() : null
|
||||
body.clear_force = !(edit.force_min && edit.force_dl)
|
||||
await adminPluginPatch(edit.pid, body)
|
||||
message.success(`已更新插件 ${edit.pid}`)
|
||||
editShow.value = false
|
||||
await refresh()
|
||||
} catch (e) { message.error('保存失败:' + (e.message || e)) }
|
||||
finally { saving.value = false }
|
||||
}
|
||||
|
||||
const columns = computed(() => [
|
||||
{ title: '插件 ID', key: 'id', width: 150, render: r => h('b', { class: 'cell-strong' }, r.id) },
|
||||
{ title: '名称', key: 'name', width: 130, ellipsis: { tooltip: true } },
|
||||
{ title: '分类', key: 'category', width: 90, render: r => r.category ? h(NTag, { size: 'small', bordered: false, type: 'info' }, { default: () => r.category }) : h('span', { class: 'dim' }, '—') },
|
||||
{
|
||||
title: '能力 / 表单', key: 'caps', minWidth: 130,
|
||||
render: r => h('div', { class: 'tags' }, [
|
||||
...(r.capabilities?.length ? r.capabilities.map(c => h(NTag, { size: 'small', bordered: false, type: 'default' }, { default: () => c })) : [h('span', { class: 'dim' }, '—')]),
|
||||
h(NTag, { size: 'small', bordered: false, type: 'info', style: 'margin-left:2px' }, { default: () => `${r.field_count || 0} 字段` }),
|
||||
]),
|
||||
},
|
||||
{ title: '状态', key: 'status', width: 80, render: renderStatus },
|
||||
{ title: '最新版', key: 'latest_version', width: 90 },
|
||||
{ title: '版本历史', key: 'versions', minWidth: 200, render: renderVersions },
|
||||
{
|
||||
title: '授权账号', key: 'accounts', minWidth: 130,
|
||||
render: r => (r.accounts?.length ? r.accounts.join('、') : h('span', { class: 'dim' }, '—')),
|
||||
ellipsis: { tooltip: true },
|
||||
},
|
||||
{
|
||||
title: '操作', key: 'actions', width: 120,
|
||||
render: r => h('div', { class: 'row-acts' }, [
|
||||
h(NButton, { size: 'small', text: true, type: 'primary', onClick: () => openEdit(r) }, { default: () => '编辑' }),
|
||||
h(NButton, { size: 'small', text: true, type: 'error', onClick: () => delPlugin(r) }, { default: () => '删除' }),
|
||||
]),
|
||||
},
|
||||
])
|
||||
function rowProps() {
|
||||
return { style: 'cursor:default' }
|
||||
}
|
||||
|
||||
async function refresh() {
|
||||
try { await loadOverview(true) } catch (e) { ElMessage.error('读取失败:' + (e.message || e)) }
|
||||
try { await loadOverview(true) } catch (e) { message.error('读取失败:' + (e.message || e)) }
|
||||
}
|
||||
async function upload() {
|
||||
if (!pid.value || !pver.value || !pfile.value) { ElMessage.warning('请填写插件 ID / 版本并选择 ZIP 包'); return }
|
||||
if (!pid.value || !pver.value || !pfile.value) { message.warning('请填写插件 ID / 版本并选择 ZIP 包'); return }
|
||||
uploading.value = true
|
||||
try {
|
||||
await adminUpload(pid.value, pname.value || pid.value, pver.value, pfile.value)
|
||||
ElMessage.success(`已发布 ${pid.value}@${pver.value}`)
|
||||
message.success(`已发布 ${pid.value}@${pver.value}`)
|
||||
pid.value = ''; pname.value = ''; pver.value = ''; pfile.value = null
|
||||
await refresh()
|
||||
} catch (e) { ElMessage.error('上传失败:' + (e.message || e)) }
|
||||
} catch (e) { message.error('上传失败:' + (e.message || e)) }
|
||||
finally { uploading.value = false }
|
||||
}
|
||||
async function delPlugin(p) {
|
||||
try {
|
||||
await ElMessageBox.confirm(`确认删除插件 ${p.id}?其全部版本与授权将一并清除`, '删除插件', { type: 'warning' })
|
||||
} catch (_) { return }
|
||||
try { await adminPluginDelete({ plugin_id: p.id }); ElMessage.success(`已删除插件 ${p.id}`); await refresh() }
|
||||
catch (e) { ElMessage.error(e.message || e) }
|
||||
function delPlugin(p) {
|
||||
dialog.warning({
|
||||
title: '删除插件',
|
||||
content: `确认删除插件 ${p.id}?其全部版本与授权将一并清除`,
|
||||
positiveText: '删除',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: async () => {
|
||||
try { await adminPluginDelete({ plugin_id: p.id }); message.success(`已删除插件 ${p.id}`); await refresh() }
|
||||
catch (e) { message.error(e.message || e) }
|
||||
},
|
||||
})
|
||||
}
|
||||
onMounted(refresh)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
|
||||
.page-head h3 { margin: 0 0 4px; font-size: 17px; }
|
||||
.page-head p { margin: 0; font-size: 12px; color: var(--el-text-color-secondary); }
|
||||
.block { margin-bottom: 14px; }
|
||||
.ver-tag { margin-right: 5px; }
|
||||
.dim { color: var(--el-text-color-placeholder); }
|
||||
.hint { font-size: 12px; color: var(--cp-ink-3); margin-top: 4px; }
|
||||
.force-row { display: flex; flex-direction: column; gap: 8px; width: 100%; }
|
||||
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; }
|
||||
</style>
|
||||
|
||||
<!-- 以下类用于 n-data-table 列 render 中由 naive-ui 作用域动态渲染的节点,
|
||||
它们不继承本组件 scoped scopeId,必须用全局(非 scoped)样式才生效。 -->
|
||||
<style>
|
||||
.dim { color: var(--cp-ink-3); }
|
||||
.cell-strong { font-weight: 600; color: var(--cp-ink-1); }
|
||||
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
|
||||
.row-acts { display: flex; align-items: center; gap: 14px; white-space: nowrap; }
|
||||
.row-acts .n-button { --n-padding: 0; }
|
||||
.row-acts .n-button + .n-button { margin-left: 0; }
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
<div class="page-head cp-rise">
|
||||
<div>
|
||||
<h3>运行统计 <span class="badge">Stats</span></h3>
|
||||
<p>账号 · 插件规模 · 执行次数/时长/成败 · 近 14 天趋势</p>
|
||||
</div>
|
||||
<n-button :loading="busy" @click="refresh">
|
||||
<template #icon><n-icon><Refresh /></n-icon></template>刷新
|
||||
</n-button>
|
||||
</div>
|
||||
|
||||
<template v-if="st">
|
||||
<!-- 指标卡 -->
|
||||
<div class="kpis cp-rise">
|
||||
<div class="kpi"><span class="num" style="color:var(--cp-blue)">{{ st.users.total }}</span><span class="lab">用户总数</span></div>
|
||||
<div class="kpi"><span class="num">{{ st.plugins.total }}</span><span class="lab">插件总数</span></div>
|
||||
<div class="kpi"><span class="num">{{ st.runs.total }}</span><span class="lab">累计执行</span></div>
|
||||
<div class="kpi"><span class="num" style="color:#34a853">{{ st.runs.success }}</span><span class="lab">成功</span></div>
|
||||
<div class="kpi"><span class="num" style="color:#e5484d">{{ st.runs.failed }}</span><span class="lab">失败</span></div>
|
||||
<div class="kpi"><span class="num">{{ fmtDur(st.runs.durationSec) }}</span><span class="lab">总运行时长</span></div>
|
||||
</div>
|
||||
|
||||
<div class="grid cp-rise">
|
||||
<!-- 近 14 天趋势 -->
|
||||
<div class="card">
|
||||
<div class="card-title">近 14 天运行趋势</div>
|
||||
<div class="trend">
|
||||
<div class="tcol" v-for="d in st.trend" :key="d.day" :title="`${d.day} · ${d.runs} 次(成功 ${d.success} / 失败 ${d.failed})`">
|
||||
<div class="tstack">
|
||||
<div class="tbar failed" :style="{ height: pct(d.failed, maxRuns) + '%' }"></div>
|
||||
<div class="tbar success" :style="{ height: pct(d.success, maxRuns) + '%' }"></div>
|
||||
</div>
|
||||
<span class="tday">{{ d.day }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 插件 / 用户排行 -->
|
||||
<div class="rank-wrap">
|
||||
<div class="card">
|
||||
<div class="card-title">插件排行(按运行次数)</div>
|
||||
<ul class="rank">
|
||||
<li v-for="(p, i) in st.topPlugins" :key="p.pluginId">
|
||||
<span class="rk">{{ i + 1 }}</span>
|
||||
<div class="rbody">
|
||||
<div class="rhead"><span class="rname">{{ p.name || p.pluginId }}</span><em>{{ p.runs }} 次</em></div>
|
||||
<div class="rbar"><i :style="{ width: pct(p.runs, rankMax(st.topPlugins)) + '%' }"></i></div>
|
||||
</div>
|
||||
</li>
|
||||
<li v-if="!st.topPlugins.length" class="empty">暂无运行记录</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-title">活跃用户</div>
|
||||
<ul class="rank">
|
||||
<li v-for="(u, i) in st.topUsers" :key="u.account">
|
||||
<span class="rk">{{ i + 1 }}</span>
|
||||
<div class="rbody">
|
||||
<div class="rhead"><span class="rname">{{ u.account }}</span><em>{{ u.runs }} 次</em></div>
|
||||
</div>
|
||||
</li>
|
||||
<li v-if="!st.topUsers.length" class="empty">暂无运行记录</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 最近运行 -->
|
||||
<div class="page-head sub cp-rise">
|
||||
<div><h4>最近运行</h4></div>
|
||||
</div>
|
||||
<n-card class="cp-rise" :bordered="false" size="small">
|
||||
<n-data-table :columns="recentCols" :data="st.recent" size="small" :row-key="r => r.at + r.pluginId" :single-line="false" />
|
||||
</n-card>
|
||||
</template>
|
||||
|
||||
<n-skeleton v-else-if="busy" text :repeat="4" style="margin-top: 20px" />
|
||||
<div v-else class="empty-tip cp-rise">加载失败或暂无数据</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { h } from 'vue'
|
||||
import { NTag } from 'naive-ui'
|
||||
import { Refresh } from '@element-plus/icons-vue'
|
||||
import { adminStats } from '../api'
|
||||
import { message } from '../naive'
|
||||
|
||||
const busy = ref(false)
|
||||
const st = ref(null)
|
||||
|
||||
function statusTag(s) {
|
||||
const map = { done: 'success', success: 'success', error: 'error', failed: 'error', running: 'info', start: 'info' }
|
||||
return h(NTag, { size: 'small', bordered: false, type: map[s] || 'default', round: true },
|
||||
{ default: () => (s === 'done' || s === 'success' ? '成功' : s === 'error' || s === 'failed' ? '失败' : s) })
|
||||
}
|
||||
function acctCell(r) {
|
||||
const nn = r.nickname
|
||||
if (!nn) return h('span', null, r.account || '—')
|
||||
return h('div', { class: 'acct' }, [
|
||||
h('div', { class: 'ann' }, r.account || '—'),
|
||||
h('div', { class: 'anick' }, nn || ''),
|
||||
])
|
||||
}
|
||||
function fmtDur(sec) {
|
||||
sec = +sec || 0
|
||||
if (sec < 60) return sec + 's'
|
||||
const m = Math.floor(sec / 60), s = sec % 60
|
||||
if (m < 60) return `${m}m${s ? s + 's' : ''}`
|
||||
const hh = Math.floor(m / 60)
|
||||
return `${hh}h${m % 60}m`
|
||||
}
|
||||
const recentCols = [
|
||||
{ title: '时间', key: 'at', width: 165 },
|
||||
{ title: '状态', key: 'status', width: 90, render: r => statusTag(r.status) },
|
||||
{ title: '账号', key: 'account', width: 110, render: r => acctCell(r) },
|
||||
{ title: '插件', key: 'pluginId', width: 150, ellipsis: { tooltip: true } },
|
||||
{ title: '版本', key: 'version', width: 90 },
|
||||
{ title: '时长', key: 'durationSec', width: 90, render: r => fmtDur(r.durationSec) },
|
||||
{ title: '信息', key: 'msg', minWidth: 220, ellipsis: { tooltip: true }, render: r => r.msg || h('span', { class: 'dim' }, '—') },
|
||||
]
|
||||
const maxRuns = () => Math.max(1, ...(st.value?.trend || []).map(t => t.runs || 0))
|
||||
const pct = (n, max) => Math.max(1, Math.round((n || 0) / (max || 1) * 100))
|
||||
const rankMax = list => Math.max(1, ...(list || []).map(x => x.runs || 1))
|
||||
|
||||
async function refresh() {
|
||||
busy.value = true
|
||||
try {
|
||||
const r = await adminStats()
|
||||
st.value = {
|
||||
users: r.users || {}, plugins: r.plugins || {}, runs: r.runs || {},
|
||||
trend: r.trend || [], topPlugins: r.topPlugins || [], topUsers: r.topUsers || [],
|
||||
recent: r.recent || [],
|
||||
}
|
||||
} catch (e) { message.error('读取失败:' + (e.message || e)) }
|
||||
finally { busy.value = false }
|
||||
}
|
||||
onMounted(refresh)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 16px; }
|
||||
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
|
||||
.kpi .num { font-size: 26px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
|
||||
.kpi .lab { font-size: 12px; color: var(--cp-ink-3); }
|
||||
.grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-bottom: 16px; }
|
||||
.rank-wrap { display: flex; flex-direction: column; gap: 16px; }
|
||||
.card { padding: 18px 20px; }
|
||||
.card-title { font-size: 14px; font-weight: 600; color: var(--cp-ink-1); margin-bottom: 14px; }
|
||||
.trend { display: flex; gap: 4px; height: 160px; align-items: stretch; }
|
||||
.tcol { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
|
||||
.tstack { flex: 1; display: flex; align-items: flex-end; gap: 1px; width: 100%; }
|
||||
.tbar { flex: 1; border-radius: 1px 1px 0 0; }
|
||||
.tbar.success { background: #34a853; }
|
||||
.tbar.failed { background: #e5484d; }
|
||||
.tday { font-size: 10px; color: var(--cp-ink-3); }
|
||||
.rank { list-style: none; margin: 0; padding: 0; }
|
||||
.rank li { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
|
||||
.rank .rk { width: 20px; height: 20px; flex: none; border-radius: 6px; background: var(--cp-bg-2); color: var(--cp-ink-3); font-size: 12px; display: flex; align-items: center; justify-content: center; }
|
||||
.rank li:nth-child(1) .rk { background: rgba(59,108,255,.12); color: var(--cp-blue); }
|
||||
.rank .rbody { flex: 1; min-width: 0; }
|
||||
.rhead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
|
||||
.rname { font-size: 13px; color: var(--cp-ink-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.rhead em { font-style: normal; font-size: 12px; color: var(--cp-ink-3); }
|
||||
.rbar { height: 5px; border-radius: 3px; background: var(--cp-bg-2); overflow: hidden; }
|
||||
.rbar i { display: block; height: 100%; background: var(--cp-blue); border-radius: 3px; }
|
||||
.page-head.sub h4 { margin: 0; font-size: 15px; }
|
||||
.empty { color: var(--cp-ink-3); font-size: 12px; justify-content: center; padding: 16px 0 !important; }
|
||||
.empty-tip { padding: 30px; text-align: center; color: var(--cp-ink-3); }
|
||||
</style>
|
||||
|
||||
<style>
|
||||
.dim { color: var(--cp-ink-3); }
|
||||
</style>
|
||||
@@ -0,0 +1,3 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MC4CAQAwBQYDK2VwBCIEIMsL5NSDmTeZ3xyxeQ9/XO58CMTSgkfRgtG+W3OOfyPS
|
||||
-----END PRIVATE KEY-----
|
||||
@@ -0,0 +1,3 @@
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MCowBQYDK2VwAyEAVLjHamfNRcKyUwFWD3S36poIyeHuRToO2Ib/zK8JLgA=
|
||||
-----END PUBLIC KEY-----
|
||||
Reference in New Issue
Block a user