From 177bda9d9918d8f11e91526973256b2c6925f2e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9A=93=E6=9C=88=E5=BD=92=E5=B0=98?= Date: Sat, 22 Feb 2025 00:22:38 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=90=8C=E6=AD=A5=E8=BF=91=E6=9C=9F?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +- locales/en.yaml | 9 +++- locales/zh-CN.yaml | 10 ++++- public/platform-config.json | 8 ++-- src/api/file.ts | 17 +++++++ src/api/i18n.ts | 39 ++++++---------- src/components/ReFlicker/index.css | 39 ++++++++++++++++ src/components/ReFlicker/index.ts | 44 +++++++++++++++++++ src/layout/components/lay-navbar/index.vue | 4 +- .../components/lay-sidebar/NavHorizontal.vue | 4 +- src/layout/components/lay-sidebar/NavMix.vue | 4 +- src/layout/hooks/useNav.ts | 2 +- src/views/account-settings/index.vue | 3 +- src/views/login/components/LoginRegist.vue | 2 +- src/views/login/components/LoginUpdate.vue | 2 +- src/views/login/index.vue | 16 +++---- src/views/monitor/login/utils/hook.tsx | 3 +- src/views/monitor/operation/hook.tsx | 3 +- src/views/system/config/utils/hook.tsx | 3 +- src/views/system/department/index.vue | 2 +- src/views/system/department/utils/hook.tsx | 2 +- src/views/system/i18n/hook.tsx | 3 +- src/views/system/role/utils/hook.tsx | 3 +- src/views/system/user/utils/hook.tsx | 7 +-- 24 files changed, 170 insertions(+), 62 deletions(-) create mode 100644 src/api/file.ts create mode 100644 src/components/ReFlicker/index.css create mode 100644 src/components/ReFlicker/index.ts diff --git a/.gitignore b/.gitignore index 423ed2b..4605a63 100644 --- a/.gitignore +++ b/.gitignore @@ -19,4 +19,5 @@ tests/**/coverage/ *.ntvs* *.njsproj *.sln -tsconfig.tsbuildinfo \ No newline at end of file +tsconfig.tsbuildinfo +.hintrc diff --git a/locales/en.yaml b/locales/en.yaml index 81e6365..24abd55 100644 --- a/locales/en.yaml +++ b/locales/en.yaml @@ -26,6 +26,11 @@ buttons:Add: Add buttons:Update: Update buttons:Delete: Delete buttons:Export: Export +buttons:Import: Import +buttons:DownLoded: DownLoded +buttons:DownLodedTemplate: DownLoded Template +buttons:Hide: Hide +buttons:ConfirmUpload: Confirm Upload buttons:Save: Save buttons:Permission: Permission buttons:ExpandOrCollapse: Expand Or Collapse @@ -34,6 +39,8 @@ buttons:Linked: Linked buttons:More: More buttons:Deselect: Deselect buttons:DeleteInBatches: Delete In Batches +buttons:ExportInBatches: Export In Batches +buttons:ExportAll: Export All buttons:UploadAvatar: Upload Avatar buttons:ResetPassword: Reset Password buttons:RoleAllocation: Role Allocation @@ -97,7 +104,7 @@ menus:LoginLog: Login Log menus:OperationLog: Operation Log menus:CacheMonitor: Cache Monitor menus:CacheList: Cache List -menus:ServerMonitor: Server Monitor +menus:PropertyMonitor: Property Monitor menus:Abnormal: Abnormal Page menus:FourZeroFour: "404" menus:FourZeroOne: "403" diff --git a/locales/zh-CN.yaml b/locales/zh-CN.yaml index 5dc004d..acd1796 100644 --- a/locales/zh-CN.yaml +++ b/locales/zh-CN.yaml @@ -26,6 +26,11 @@ buttons:Add: 添加 buttons:Update: 修改 buttons:Delete: 删除 buttons:Export: 导出 +buttons:Import: 导入 +buttons:DownLoded: 下载 +buttons:DownLodedTemplate: 下载模版 +buttons:Hide: 隐藏 +buttons:ConfirmUpload: 确认上传 buttons:Save: 保存 buttons:Permission: 权限 buttons:ExpandOrCollapse: 展开或折叠 @@ -34,6 +39,8 @@ buttons:Linked: 联动 buttons:More: 更多 buttons:Deselect: 取消选择 buttons:DeleteInBatches: 批量删除 +buttons:ExportInBatches: 批量导出 +buttons:ExportAll: 全部导出 buttons:UploadAvatar: 上传头像 buttons:ResetPassword: 重置密码 buttons:RoleAllocation: 角色分配 @@ -97,7 +104,7 @@ menus:LoginLog: 登录日志 menus:OperationLog: 操作日志 menus:CacheMonitor: 缓存监控 menus:CacheList: 缓存列表 -menus:ServerMonitor: 服务监控 +menus:PropertyMonitor: 性能监控 menus:Abnormal: 异常页面 menus:FourZeroFour: "404" menus:FourZeroOne: "403" @@ -162,4 +169,3 @@ logout:message: 是否退出当前系统? logout:success: 退出成功 logout:fail: 退出失败 logout:cancel: 退出取消 - diff --git a/public/platform-config.json b/public/platform-config.json index c6688e6..f05c523 100644 --- a/public/platform-config.json +++ b/public/platform-config.json @@ -1,9 +1,9 @@ { - "Version": "5.9.0", - "Period":"2024-present", + "Version": "1.0.0", + "Period": "2024-present", "FixedHeader": true, "HiddenSideBar": false, - "MultiTagsCache": false, + "MultiTagsCache": true, "KeepAlive": true, "Locale": "zh", "Layout": "vertical", @@ -18,7 +18,7 @@ "SidebarStatus": true, "EpThemeColor": "#409EFF", "ShowLogo": true, - "ShowModel": "smart", + "ShowModel": "chrome", "MenuArrowIconNoTransition": false, "CachingAsyncRoutes": false, "TooltipEffect": "light", diff --git a/src/api/file.ts b/src/api/file.ts new file mode 100644 index 0000000..5652a2b --- /dev/null +++ b/src/api/file.ts @@ -0,0 +1,17 @@ +import { http } from "@/utils/http"; +import type { FileInfo } from "types/file"; + +/**上传文件 */ +export const postUploadFileAPI = (data: { file: Blob }) => { + return http.request("post", "/api/file/upload", { + data, + headers: { + "Content-Type": "multipart/form-data" + } + }); +}; + +/**删除文件 */ +export const deleteFileAPI = (id: string) => { + return http.request("delete", `/api/file/delete/${id}`); +}; diff --git a/src/api/i18n.ts b/src/api/i18n.ts index 8128632..272e7a6 100644 --- a/src/api/i18n.ts +++ b/src/api/i18n.ts @@ -59,18 +59,14 @@ type GetLoacleListParams = { code?: string; }; -type GetLocaleListResult = { - /**语言列表 */ - result: LanguageInfo[]; - /**总条数 */ - total: number; - /**页码 */ - page: number; -}; export const getLocaleListAPI = (params: GetLoacleListParams) => { - return http.request("get", "/api/i18n/locale/list", { - params - }); + return http.request>( + "get", + "/api/i18n/locale/list", + { + params + } + ); }; /** @@ -111,17 +107,6 @@ type GetI18nListParams = { /**翻译内容 */ translation?: string; }; -/** - * 获取翻译列表 - */ -type GetI18nListResult = { - /**翻译列表 */ - result: TranslationInfo[]; - /**总条数 */ - total: number; - /**页码 */ - page: number; -}; /** * 获取翻译列表 @@ -129,9 +114,13 @@ type GetI18nListResult = { * @returns */ export const getI18nListAPI = (params: GetI18nListParams) => { - return http.request("get", "/api/i18n/list", { - params - }); + return http.request>( + "get", + "/api/i18n/list", + { + params + } + ); }; /** diff --git a/src/components/ReFlicker/index.css b/src/components/ReFlicker/index.css new file mode 100644 index 0000000..4c40af4 --- /dev/null +++ b/src/components/ReFlicker/index.css @@ -0,0 +1,39 @@ +.point { + width: var(--point-width); + height: var(--point-height); + background: var(--point-background); + position: relative; + border-radius: var(--point-border-radius); +} + +.point-flicker:after { + background: var(--point-background); +} + +.point-flicker:before, +.point-flicker:after { + content: ""; + width: 100%; + height: 100%; + top: 0; + left: 0; + position: absolute; + border-radius: var(--point-border-radius); + animation: flicker 1.2s ease-out infinite; +} + +@keyframes flicker { + 0% { + transform: scale(0.5); + opacity: 1; + } + + 30% { + opacity: 1; + } + + 100% { + transform: scale(var(--point-scale)); + opacity: 0; + } +} diff --git a/src/components/ReFlicker/index.ts b/src/components/ReFlicker/index.ts new file mode 100644 index 0000000..b829323 --- /dev/null +++ b/src/components/ReFlicker/index.ts @@ -0,0 +1,44 @@ +import "./index.css"; +import { type Component, h, defineComponent } from "vue"; + +export interface attrsType { + width?: string; + height?: string; + borderRadius?: number | string; + background?: string; + scale?: number | string; +} + +/** + * 圆点、方形闪烁动画组件 + * @param width 可选 string 宽 + * @param height 可选 string 高 + * @param borderRadius 可选 number | string 传0为方形、传50%或者不传为圆形 + * @param background 可选 string 闪烁颜色 + * @param scale 可选 number | string 闪烁范围,默认2,值越大闪烁范围越大 + * @returns Component + */ +export function useRenderFlicker(attrs?: attrsType): Component { + return defineComponent({ + name: "ReFlicker", + render() { + return h( + "div", + { + class: "point point-flicker", + style: { + "--point-width": attrs?.width ?? "12px", + "--point-height": attrs?.height ?? "12px", + "--point-background": + attrs?.background ?? "var(--el-color-primary)", + "--point-border-radius": attrs?.borderRadius ?? "50%", + "--point-scale": attrs?.scale ?? "2" + } + }, + { + default: () => [] + } + ); + } + }); +} diff --git a/src/layout/components/lay-navbar/index.vue b/src/layout/components/lay-navbar/index.vue index 4188cae..97ac190 100644 --- a/src/layout/components/lay-navbar/index.vue +++ b/src/layout/components/lay-navbar/index.vue @@ -1,7 +1,7 @@