From 5c8c2b4b855f13bb01eb0f5401f1dfbf0bc103ec Mon Sep 17 00:00:00 2001 From: bqy_fe <1743369777@qq.com> Date: Tue, 4 Jan 2022 01:16:28 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20:sparkles:=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .editorconfig | 16 + CHANGELOG.md | 36 + README.md | 4 + package.json | 12 +- src/App.vue | 24 +- src/assets/icons/locale.svg | 14 + src/components/SuspenseWithError.vue | 23 - src/components/a-custom-modal/index.ts | 1 - src/components/basic/README.md | 6 + .../{BasicHelp.vue => basic-help/index.vue} | 0 src/components/{ => basic}/button/button.vue | 4 +- src/components/{ => basic}/button/index.ts | 0 .../{ => basic}/button/styles/index.less | 0 .../button/styles/setButtonColor.less | 4 +- .../{ => basic}/button/styles/success.less | 0 .../{ => basic}/button/styles/warning.less | 0 .../{ => basic}/check-box/index.vue | 0 .../{ => basic}/context-menu/index.vue | 0 .../{ => basic}/context-menu/props.ts | 0 .../{ => basic}/context-menu/types.ts | 0 .../{ => basic}/iconfont/icon-font.tsx | 0 src/components/{ => basic}/iconfont/index.ts | 0 .../{ => basic}/icons-select/icons.json | 0 .../{ => basic}/icons-select/index.vue | 2 +- .../{ => basic}/image-preview/index.tsx | 0 src/components/basic/locale-picker/index.ts | 1 + src/components/basic/locale-picker/index.vue | 60 ++ .../{ => basic}/lockscreen/huawei-charge.vue | 0 .../{ => basic}/lockscreen/index.ts | 0 .../{ => basic}/lockscreen/index.vue | 0 .../{ => basic}/lockscreen/lockscreen.vue | 0 .../{ => basic}/lockscreen/xiaomi-charge.vue | 0 src/components/{ => basic}/progress/index.vue | 0 .../{ => basic}/split-panel/index.ts | 0 .../{ => basic}/split-panel/index.vue | 0 src/components/{ => basic}/svg-icon/index.ts | 0 src/components/basic/svg-icon/svg-icon.vue | 51 ++ src/components/basic/title-i18n/index.ts | 1 + src/components/basic/title-i18n/index.vue | 27 + src/components/business/README.md | 3 + src/components/core/README.md | 7 + src/components/core/draggable-modal/index.ts | 1 + .../draggable-modal}/index.vue | 0 .../dynamic-table/components/index.ts | 0 .../components/query-form/index.vue | 4 +- .../dynamic-table/components/table-action.vue | 0 .../table-settings/column-setting.vue | 2 +- .../components/table-settings/index.vue | 0 .../table-settings/refresh-setting.vue | 0 .../table-settings/size-setting.vue | 0 .../components/tool-bar/index.vue | 2 +- .../dynamic-table/dynamic-table.vue | 0 .../{ => core}/dynamic-table/hooks/index.ts | 0 .../dynamic-table/hooks/useExpandLoading.ts | 0 .../dynamic-table/hooks/usePagination.ts | 0 .../dynamic-table/hooks/useTableContext.ts | 0 .../{ => core}/dynamic-table/index.ts | 0 .../{ => core}/dynamic-table/props.ts | 0 .../dynamic-table/types/tableAction.ts | 0 .../{ => core}/dynamic-table/typing.ts | 2 +- .../schema-form}/componentMap.ts | 0 .../schema-form}/helper.ts | 2 +- .../schema-form}/hooks/useLabelWidth.ts | 0 .../schema-form}/index.ts | 0 .../schema-form}/schema-form-item.vue | 2 +- .../schema-form}/schema-form.vue | 0 .../schema-form}/types/form.ts | 0 .../schema-form}/types/formItem.ts | 0 .../schema-form}/types/hooks.ts | 0 .../schema-form}/types/index.ts | 0 src/components/preview-modal.vue | 237 ------- src/components/svg-icon/svg-icon.vue | 51 -- src/enums/cacheEnum.ts | 3 + src/hooks/functions/useContextMenu.ts | 4 +- src/hooks/useI18n.ts | 27 + src/hooks/useModal/modal.tsx | 10 +- src/hooks/useModal/useFormModal.tsx | 4 +- .../header/components/fullscreen/index.vue | 24 + src/layout/header/components/index.ts | 5 +- src/layout/header/components/search/index.vue | 83 +-- src/layout/header/index.vue | 126 +--- src/layout/index.vue | 2 +- src/layout/menu/menu-item.vue | 10 +- src/layout/tabs/tabs-view.vue | 7 +- src/locales/config.ts | 21 + src/locales/helper.ts | 37 + src/locales/index.ts | 38 ++ src/locales/lang/en-US/common.ts | 20 + src/locales/lang/en-US/layout.ts | 115 ++++ src/locales/lang/en-US/routes/basic.ts | 4 + src/locales/lang/en-US/routes/dashboard.ts | 6 + src/locales/lang/en-US/routes/demo.ts | 16 + src/locales/lang/en_US.ts | 13 + src/locales/lang/zh-CN/common.ts | 20 + src/locales/lang/zh-CN/layout.ts | 115 ++++ src/locales/lang/zh-CN/routes/basic.ts | 4 + src/locales/lang/zh-CN/routes/dashboard.ts | 6 + src/locales/lang/zh-CN/routes/demo.ts | 16 + src/locales/lang/zh_CN.ts | 11 + src/locales/useLocale.ts | 68 ++ src/main.ts | 4 + src/plugins/antd.ts | 2 +- src/plugins/customComponents.ts | 4 +- src/router/generator-router.tsx | 6 +- src/router/outsideLayout.ts | 2 +- src/router/router-guards.ts | 1 - src/router/staticModules/dashboard.ts | 9 +- src/router/staticModules/demos.ts | 42 +- src/router/staticModules/error.ts | 4 +- src/store/modules/keepAlive.ts | 7 +- src/store/modules/locale.ts | 32 + src/store/modules/lockscreen.ts | 5 + src/store/modules/tabsView.ts | 6 + src/store/modules/user.ts | 6 + src/store/modules/ws.ts | 6 + .../{shared => }/dashboard/welcome/index.vue | 0 src/views/{shared => }/demos/button.vue | 8 +- src/views/{shared => }/demos/custom-modal.vue | 10 +- .../demos/form/basic-form/form-schema.ts | 2 +- .../demos/form/basic-form/index.vue | 2 +- .../demos/form/rule-form/form-schema.ts | 2 +- .../demos/form/rule-form/index.vue | 2 +- .../{shared => }/demos/icons/Iconfont.vue | 23 +- .../demos/tables/lol-table/columns.tsx | 4 +- .../demos/tables/lol-table/heroInfo.vue | 0 .../demos/tables/lol-table/index.vue | 2 +- .../demos/tables/wzry-table/columns.tsx | 4 +- .../demos/tables/wzry-table/index.vue | 2 +- src/views/{shared => }/error/404.vue | 0 src/views/{shared => }/login/index.vue | 4 +- src/views/shared/icons/icons.ts | 357 ---------- src/views/shared/icons/index.vue | 60 -- src/views/system/monitor/login-log/index.vue | 2 +- src/views/system/monitor/online/index.vue | 2 +- src/views/system/monitor/req-log/index.vue | 2 +- src/views/system/monitor/serve/index.vue | 6 +- src/views/system/permission/menu/columns.tsx | 2 +- .../system/permission/menu/formSchemas.ts | 4 +- src/views/system/permission/menu/index.vue | 2 +- src/views/system/permission/role/columns.tsx | 2 +- .../system/permission/role/formSchemas.ts | 2 +- src/views/system/permission/role/index.vue | 2 +- src/views/system/permission/user/columns.tsx | 2 +- .../system/permission/user/formSchemas.ts | 2 +- src/views/system/permission/user/index.vue | 8 +- src/views/system/schedule/log/index.vue | 2 +- src/views/system/schedule/task/columns.tsx | 2 +- src/views/system/schedule/task/formSchemas.ts | 2 +- src/views/system/schedule/task/index.vue | 2 +- tsconfig.json | 5 +- types/utils.d.ts | 1 + types/vue-router.d.ts | 8 +- vue.config.js | 17 +- yarn.lock | 635 +++++++++++++++++- 154 files changed, 1693 insertions(+), 1051 deletions(-) create mode 100644 .editorconfig create mode 100644 CHANGELOG.md create mode 100644 src/assets/icons/locale.svg delete mode 100644 src/components/SuspenseWithError.vue delete mode 100644 src/components/a-custom-modal/index.ts create mode 100644 src/components/basic/README.md rename src/components/basic/{BasicHelp.vue => basic-help/index.vue} (100%) rename src/components/{ => basic}/button/button.vue (94%) rename src/components/{ => basic}/button/index.ts (100%) rename src/components/{ => basic}/button/styles/index.less (100%) rename src/components/{ => basic}/button/styles/setButtonColor.less (89%) rename src/components/{ => basic}/button/styles/success.less (100%) rename src/components/{ => basic}/button/styles/warning.less (100%) rename src/components/{ => basic}/check-box/index.vue (100%) rename src/components/{ => basic}/context-menu/index.vue (100%) rename src/components/{ => basic}/context-menu/props.ts (100%) rename src/components/{ => basic}/context-menu/types.ts (100%) rename src/components/{ => basic}/iconfont/icon-font.tsx (100%) rename src/components/{ => basic}/iconfont/index.ts (100%) rename src/components/{ => basic}/icons-select/icons.json (100%) rename src/components/{ => basic}/icons-select/index.vue (96%) rename src/components/{ => basic}/image-preview/index.tsx (100%) create mode 100644 src/components/basic/locale-picker/index.ts create mode 100644 src/components/basic/locale-picker/index.vue rename src/components/{ => basic}/lockscreen/huawei-charge.vue (100%) rename src/components/{ => basic}/lockscreen/index.ts (100%) rename src/components/{ => basic}/lockscreen/index.vue (100%) rename src/components/{ => basic}/lockscreen/lockscreen.vue (100%) rename src/components/{ => basic}/lockscreen/xiaomi-charge.vue (100%) rename src/components/{ => basic}/progress/index.vue (100%) rename src/components/{ => basic}/split-panel/index.ts (100%) rename src/components/{ => basic}/split-panel/index.vue (100%) rename src/components/{ => basic}/svg-icon/index.ts (100%) create mode 100644 src/components/basic/svg-icon/svg-icon.vue create mode 100644 src/components/basic/title-i18n/index.ts create mode 100644 src/components/basic/title-i18n/index.vue create mode 100644 src/components/business/README.md create mode 100644 src/components/core/README.md create mode 100644 src/components/core/draggable-modal/index.ts rename src/components/{a-custom-modal => core/draggable-modal}/index.vue (100%) rename src/components/{ => core}/dynamic-table/components/index.ts (100%) rename src/components/{ => core}/dynamic-table/components/query-form/index.vue (96%) rename src/components/{ => core}/dynamic-table/components/table-action.vue (100%) rename src/components/{ => core}/dynamic-table/components/table-settings/column-setting.vue (98%) rename src/components/{ => core}/dynamic-table/components/table-settings/index.vue (100%) rename src/components/{ => core}/dynamic-table/components/table-settings/refresh-setting.vue (100%) rename src/components/{ => core}/dynamic-table/components/table-settings/size-setting.vue (100%) rename src/components/{ => core}/dynamic-table/components/tool-bar/index.vue (93%) rename src/components/{ => core}/dynamic-table/dynamic-table.vue (100%) rename src/components/{ => core}/dynamic-table/hooks/index.ts (100%) rename src/components/{ => core}/dynamic-table/hooks/useExpandLoading.ts (100%) rename src/components/{ => core}/dynamic-table/hooks/usePagination.ts (100%) rename src/components/{ => core}/dynamic-table/hooks/useTableContext.ts (100%) rename src/components/{ => core}/dynamic-table/index.ts (100%) rename src/components/{ => core}/dynamic-table/props.ts (100%) rename src/components/{ => core}/dynamic-table/types/tableAction.ts (100%) rename src/components/{ => core}/dynamic-table/typing.ts (94%) rename src/components/{JSON-schema-form => core/schema-form}/componentMap.ts (100%) rename src/components/{JSON-schema-form => core/schema-form}/helper.ts (97%) rename src/components/{JSON-schema-form => core/schema-form}/hooks/useLabelWidth.ts (100%) rename src/components/{JSON-schema-form => core/schema-form}/index.ts (100%) rename src/components/{JSON-schema-form => core/schema-form}/schema-form-item.vue (99%) rename src/components/{JSON-schema-form => core/schema-form}/schema-form.vue (100%) rename src/components/{JSON-schema-form => core/schema-form}/types/form.ts (100%) rename src/components/{JSON-schema-form => core/schema-form}/types/formItem.ts (100%) rename src/components/{JSON-schema-form => core/schema-form}/types/hooks.ts (100%) rename src/components/{JSON-schema-form => core/schema-form}/types/index.ts (100%) delete mode 100644 src/components/preview-modal.vue delete mode 100644 src/components/svg-icon/svg-icon.vue create mode 100644 src/hooks/useI18n.ts create mode 100644 src/layout/header/components/fullscreen/index.vue create mode 100644 src/locales/config.ts create mode 100644 src/locales/helper.ts create mode 100644 src/locales/index.ts create mode 100644 src/locales/lang/en-US/common.ts create mode 100644 src/locales/lang/en-US/layout.ts create mode 100644 src/locales/lang/en-US/routes/basic.ts create mode 100644 src/locales/lang/en-US/routes/dashboard.ts create mode 100644 src/locales/lang/en-US/routes/demo.ts create mode 100644 src/locales/lang/en_US.ts create mode 100644 src/locales/lang/zh-CN/common.ts create mode 100644 src/locales/lang/zh-CN/layout.ts create mode 100644 src/locales/lang/zh-CN/routes/basic.ts create mode 100644 src/locales/lang/zh-CN/routes/dashboard.ts create mode 100644 src/locales/lang/zh-CN/routes/demo.ts create mode 100644 src/locales/lang/zh_CN.ts create mode 100644 src/locales/useLocale.ts create mode 100644 src/store/modules/locale.ts rename src/views/{shared => }/dashboard/welcome/index.vue (100%) rename src/views/{shared => }/demos/button.vue (83%) rename src/views/{shared => }/demos/custom-modal.vue (82%) rename src/views/{shared => }/demos/form/basic-form/form-schema.ts (98%) rename src/views/{shared => }/demos/form/basic-form/index.vue (94%) rename src/views/{shared => }/demos/form/rule-form/form-schema.ts (98%) rename src/views/{shared => }/demos/form/rule-form/index.vue (94%) rename src/views/{shared => }/demos/icons/Iconfont.vue (79%) rename src/views/{shared => }/demos/tables/lol-table/columns.tsx (88%) rename src/views/{shared => }/demos/tables/lol-table/heroInfo.vue (100%) rename src/views/{shared => }/demos/tables/lol-table/index.vue (92%) rename src/views/{shared => }/demos/tables/wzry-table/columns.tsx (88%) rename src/views/{shared => }/demos/tables/wzry-table/index.vue (96%) rename src/views/{shared => }/error/404.vue (100%) rename src/views/{shared => }/login/index.vue (97%) delete mode 100644 src/views/shared/icons/icons.ts delete mode 100644 src/views/shared/icons/index.vue create mode 100644 types/utils.d.ts diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..7e3649acc --- /dev/null +++ b/.editorconfig @@ -0,0 +1,16 @@ +# http://editorconfig.org +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false + +[Makefile] +indent_style = tab diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..df911439e --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,36 @@ +## 0.1.1 (2022-01-03) + +### Bug Fixes + +- :art: fix some css style ([7b7f17a](https://github.com/buqiyuan/vue3-antd-admin/commit/7b7f17a0b1b7dd8ce0bc8c5022d2328d7544f5da)) +- :bug: router navigation bug ([15aec11](https://github.com/buqiyuan/vue3-antd-admin/commit/15aec11c78aedf482473a17867aaf261905afdf6)) +- :bug:角色管理权限勾选问题 ([760f21a](https://github.com/buqiyuan/vue3-antd-admin/commit/760f21a5e7cb989e456c294d80b80b4a27bec758)) +- :bug:生成路由出错问题 ([e164bf1](https://github.com/buqiyuan/vue3-antd-admin/commit/e164bf17b6a9f905c5c78b51b2a46b54ff554077)) +- :bug:修复某些权限码传参错误 ([e3a5893](https://github.com/buqiyuan/vue3-antd-admin/commit/e3a5893411ee31f8bd34b337055b09cdd656d8f4)) +- 面包屑导航和弹窗拖拽后宽度问题 ([f4a24ef](https://github.com/buqiyuan/vue3-antd-admin/commit/f4a24ef4171f1d477a50c723aeaadf66823fe686)) +- 删除一些多余的旧代码 ([16042d2](https://github.com/buqiyuan/vue3-antd-admin/commit/16042d2897acb84cf58cdb955fc16b20d4c23735)) +- 删除一些冗余的旧代码 ([ddedca2](https://github.com/buqiyuan/vue3-antd-admin/commit/ddedca2179f2740affbbd1414bd67fb290784d9a)) +- 修复菜单为目录类型时路由报错 ([7dcec87](https://github.com/buqiyuan/vue3-antd-admin/commit/7dcec87be9460c73b5651384083702257a4c9291)) +- 一些依赖版本问题 ([9494edf](https://github.com/buqiyuan/vue3-antd-admin/commit/9494edf997df84d86d2b49bacc6a3ccdbebac491)) +- **component:** :bug:修复 dynamicTable ts 类型错误 ([00fa173](https://github.com/buqiyuan/vue3-antd-admin/commit/00fa1732904c2accfc8b1917b7a428a630b8cee5)) +- mock 数据在生产环境无法使用 ([c154d1e](https://github.com/buqiyuan/vue3-antd-admin/commit/c154d1e67afa088360e5f62d2c78626c8a3c38a9)) +- **projects:** 修复搜索菜单时 title 可能为空的情况 ([377a416](https://github.com/buqiyuan/vue3-antd-admin/commit/377a41646ee5361e9e378e3f6361e1f43afa8f4f)) +- remove useModal.tsx ([24dff4e](https://github.com/buqiyuan/vue3-antd-admin/commit/24dff4e0d9654926c987c8e85ca8cb6338e1f610)) +- **request.ts:** baseUrl 错误 ([3818cb2](https://github.com/buqiyuan/vue3-antd-admin/commit/3818cb2753249aef220e21139ea32083ba4aa71e)) +- **request.ts:** baseUrl 错误 ([36a1346](https://github.com/buqiyuan/vue3-antd-admin/commit/36a1346b57f5f477ab3c68f4753117f5e833f317)) +- **request.ts:** baseUrl 路径替换正则错误 ([39c61e3](https://github.com/buqiyuan/vue3-antd-admin/commit/39c61e3fba2fe2611410f5b2072663d0ce299407)) +- rootadmin 假退出登录,避免其他人被迫下线 ([4fc62a9](https://github.com/buqiyuan/vue3-antd-admin/commit/4fc62a940dffa05511b524865bf50e9cab2eaaf6)) + +### Features + +- 表格列设置工具栏 ([061c6ed](https://github.com/buqiyuan/vue3-antd-admin/commit/061c6edff076c36f3cc074eba96c5ba89d106a8f)) +- 定时任务 ([ae2615d](https://github.com/buqiyuan/vue3-antd-admin/commit/ae2615df1758e181c1a264af81a6b4d8bd804ea1)) +- 服务监控页面 ([b2bbfad](https://github.com/buqiyuan/vue3-antd-admin/commit/b2bbfadc690873cafb7ab242b32614fea1710737)) +- 全局挂载 Reflect 反射对象 ([e5ba20a](https://github.com/buqiyuan/vue3-antd-admin/commit/e5ba20ac57131e070074154fbb874e3d97720888)) +- 新增按钮权限 ([f65c95c](https://github.com/buqiyuan/vue3-antd-admin/commit/f65c95cb5282a2c64154d8cdc276bf4868e1ba38)) +- 新增国际化 ([216b32c](https://github.com/buqiyuan/vue3-antd-admin/commit/216b32ccbeb911105db86924be91ad8641cc6c7b)) +- 新增在线用户管理 ([cff7647](https://github.com/buqiyuan/vue3-antd-admin/commit/cff76475708c290086e2f25cf58c39549f8b32a8)) +- **env.d.ts:** 增加环境变量类型声明文件 ([96489b1](https://github.com/buqiyuan/vue3-antd-admin/commit/96489b15ebe82a2af3071ff7a5c4ab5425fba0b0)) +- **projects:** 全局搜索菜单功能 ([b4c9ba9](https://github.com/buqiyuan/vue3-antd-admin/commit/b4c9ba941110b1358bd16dd128208243588317ab)) +- **projects:** 搜索菜单增加大小写转换 ([7ec9777](https://github.com/buqiyuan/vue3-antd-admin/commit/7ec977795de144fbd208540d3ee14fa8868ddd9b)) +- **projects:** 图片预览,SuspenseWithError,operate-row 组件重构为 setup 语法以及引入 dayjs 中文包 ([f7aceff](https://github.com/buqiyuan/vue3-antd-admin/commit/f7aceffa9f4eaf5159f4c3d24589bdfc610613eb)) diff --git a/README.md b/README.md index 9ad8d7ff1..aa65166e3 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,10 @@ yarn install yarn --frozen-lockfile ``` +## 更新日志 + +[CHANGELOG](./CHANGELOG.md) + ### 赞赏 如果你觉得这个项目对你有帮助,你可以帮作者买一杯咖啡表示支持! diff --git a/package.json b/package.json index cfebc7320..c4844896a 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,8 @@ "lint:prettier": "prettier --write \"src/**/*.{js,json,tsx,css,less,scss,vue,html,md}\"", "lint:stylelint": "stylelint --cache --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/", "prepare": "husky install", + "version": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md", + "postversion": "git push && git push origin --tags", "test prod cors": "npx http-server dist --cors --gzip -P http://29135jo738.zicp.vip", "test prod gzip": "npx http-server dist --cors --gzip -c-1" }, @@ -34,13 +36,16 @@ "socket.io-client": "4.4.0", "sortablejs": "^1.14.0", "vue": "^3.2.26", - "vue-router": "^4.0.12" + "vue-i18n": "^9.2.0-beta.26", + "vue-router": "^4.0.12", + "xlsx": "^0.17.4" }, "devDependencies": { "@commitlint/cli": "^16.0.1", "@commitlint/config-conventional": "^16.0.0", + "@intlify/vue-i18n-loader": "^4.1.0", "@types/lodash": "^4.14.178", - "@types/node": "^17.0.6", + "@types/node": "^17.0.7", "@types/webpack-env": "^1.16.3", "@typescript-eslint/eslint-plugin": "^5.8.1", "@typescript-eslint/parser": "^5.8.1", @@ -56,6 +61,7 @@ "babel-plugin-lodash": "^3.3.4", "commitizen": "^4.2.4", "compression-webpack-plugin": "^9.2.0", + "conventional-changelog-cli": "^2.2.2", "eslint": "^8.6.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-prettier": "^4.0.0", @@ -63,7 +69,7 @@ "husky": "^7.0.4", "less": "^4.1.2", "less-loader": "10.2.0", - "lint-staged": "^12.1.4", + "lint-staged": "^12.1.5", "lodash-webpack-plugin": "^0.11.6", "path-browserify": "^1.0.1", "postcss-html": "^1.3.0", diff --git a/src/App.vue b/src/App.vue index bf25504f0..bf5ae3f9e 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,19 +1,29 @@ diff --git a/src/assets/icons/locale.svg b/src/assets/icons/locale.svg new file mode 100644 index 000000000..c7b268350 --- /dev/null +++ b/src/assets/icons/locale.svg @@ -0,0 +1,14 @@ + diff --git a/src/components/SuspenseWithError.vue b/src/components/SuspenseWithError.vue deleted file mode 100644 index 6b69507d1..000000000 --- a/src/components/SuspenseWithError.vue +++ /dev/null @@ -1,23 +0,0 @@ - - - diff --git a/src/components/a-custom-modal/index.ts b/src/components/a-custom-modal/index.ts deleted file mode 100644 index 03ad8dfff..000000000 --- a/src/components/a-custom-modal/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default as CustomAModal } from './index.vue'; diff --git a/src/components/basic/README.md b/src/components/basic/README.md new file mode 100644 index 000000000..cb18e0484 --- /dev/null +++ b/src/components/basic/README.md @@ -0,0 +1,6 @@ +### 基础组件(目录说明) + +| 组件名称 | 描述 | 是否全局组件 | 使用建议 | +| --- | --- | --- | --- | +| button | `按钮组件`基于 a-button 二次封装,主要扩展了按钮的颜色,基本使用方式与 antdv 的 a-button 保持一致 | 是 | -- | +| check-box | `复选框`基于 a-checkbox 二次封装,基本使用方式与 antdv 的 a-checkbox 保持一致 | 否 | -- | diff --git a/src/components/basic/BasicHelp.vue b/src/components/basic/basic-help/index.vue similarity index 100% rename from src/components/basic/BasicHelp.vue rename to src/components/basic/basic-help/index.vue diff --git a/src/components/button/button.vue b/src/components/basic/button/button.vue similarity index 94% rename from src/components/button/button.vue rename to src/components/basic/button/button.vue index 851d5716e..35f697077 100644 --- a/src/components/button/button.vue +++ b/src/components/basic/button/button.vue @@ -35,9 +35,9 @@ diff --git a/src/components/button/index.ts b/src/components/basic/button/index.ts similarity index 100% rename from src/components/button/index.ts rename to src/components/basic/button/index.ts diff --git a/src/components/button/styles/index.less b/src/components/basic/button/styles/index.less similarity index 100% rename from src/components/button/styles/index.less rename to src/components/basic/button/styles/index.less diff --git a/src/components/button/styles/setButtonColor.less b/src/components/basic/button/styles/setButtonColor.less similarity index 89% rename from src/components/button/styles/setButtonColor.less rename to src/components/basic/button/styles/setButtonColor.less index b563f6f3a..3e11949fa 100644 --- a/src/components/button/styles/setButtonColor.less +++ b/src/components/basic/button/styles/setButtonColor.less @@ -1,5 +1,5 @@ -@import '~ant-design-vue/lib/style/themes/default'; -@import '~ant-design-vue/es/button/style/mixin'; +@import '../../../../../node_modules/ant-design-vue/lib/style/themes/default'; +@import '../../../../../node_modules/ant-design-vue/es/button/style/mixin'; .button-variant(@color; @background) { .button-color(@color; @background; @background); diff --git a/src/components/button/styles/success.less b/src/components/basic/button/styles/success.less similarity index 100% rename from src/components/button/styles/success.less rename to src/components/basic/button/styles/success.less diff --git a/src/components/button/styles/warning.less b/src/components/basic/button/styles/warning.less similarity index 100% rename from src/components/button/styles/warning.less rename to src/components/basic/button/styles/warning.less diff --git a/src/components/check-box/index.vue b/src/components/basic/check-box/index.vue similarity index 100% rename from src/components/check-box/index.vue rename to src/components/basic/check-box/index.vue diff --git a/src/components/context-menu/index.vue b/src/components/basic/context-menu/index.vue similarity index 100% rename from src/components/context-menu/index.vue rename to src/components/basic/context-menu/index.vue diff --git a/src/components/context-menu/props.ts b/src/components/basic/context-menu/props.ts similarity index 100% rename from src/components/context-menu/props.ts rename to src/components/basic/context-menu/props.ts diff --git a/src/components/context-menu/types.ts b/src/components/basic/context-menu/types.ts similarity index 100% rename from src/components/context-menu/types.ts rename to src/components/basic/context-menu/types.ts diff --git a/src/components/iconfont/icon-font.tsx b/src/components/basic/iconfont/icon-font.tsx similarity index 100% rename from src/components/iconfont/icon-font.tsx rename to src/components/basic/iconfont/icon-font.tsx diff --git a/src/components/iconfont/index.ts b/src/components/basic/iconfont/index.ts similarity index 100% rename from src/components/iconfont/index.ts rename to src/components/basic/iconfont/index.ts diff --git a/src/components/icons-select/icons.json b/src/components/basic/icons-select/icons.json similarity index 100% rename from src/components/icons-select/icons.json rename to src/components/basic/icons-select/icons.json diff --git a/src/components/icons-select/index.vue b/src/components/basic/icons-select/index.vue similarity index 96% rename from src/components/icons-select/index.vue rename to src/components/basic/icons-select/index.vue index e9d485e17..4c26969b8 100644 --- a/src/components/icons-select/index.vue +++ b/src/components/basic/icons-select/index.vue @@ -24,7 +24,7 @@ diff --git a/src/components/lockscreen/huawei-charge.vue b/src/components/basic/lockscreen/huawei-charge.vue similarity index 100% rename from src/components/lockscreen/huawei-charge.vue rename to src/components/basic/lockscreen/huawei-charge.vue diff --git a/src/components/lockscreen/index.ts b/src/components/basic/lockscreen/index.ts similarity index 100% rename from src/components/lockscreen/index.ts rename to src/components/basic/lockscreen/index.ts diff --git a/src/components/lockscreen/index.vue b/src/components/basic/lockscreen/index.vue similarity index 100% rename from src/components/lockscreen/index.vue rename to src/components/basic/lockscreen/index.vue diff --git a/src/components/lockscreen/lockscreen.vue b/src/components/basic/lockscreen/lockscreen.vue similarity index 100% rename from src/components/lockscreen/lockscreen.vue rename to src/components/basic/lockscreen/lockscreen.vue diff --git a/src/components/lockscreen/xiaomi-charge.vue b/src/components/basic/lockscreen/xiaomi-charge.vue similarity index 100% rename from src/components/lockscreen/xiaomi-charge.vue rename to src/components/basic/lockscreen/xiaomi-charge.vue diff --git a/src/components/progress/index.vue b/src/components/basic/progress/index.vue similarity index 100% rename from src/components/progress/index.vue rename to src/components/basic/progress/index.vue diff --git a/src/components/split-panel/index.ts b/src/components/basic/split-panel/index.ts similarity index 100% rename from src/components/split-panel/index.ts rename to src/components/basic/split-panel/index.ts diff --git a/src/components/split-panel/index.vue b/src/components/basic/split-panel/index.vue similarity index 100% rename from src/components/split-panel/index.vue rename to src/components/basic/split-panel/index.vue diff --git a/src/components/svg-icon/index.ts b/src/components/basic/svg-icon/index.ts similarity index 100% rename from src/components/svg-icon/index.ts rename to src/components/basic/svg-icon/index.ts diff --git a/src/components/basic/svg-icon/svg-icon.vue b/src/components/basic/svg-icon/svg-icon.vue new file mode 100644 index 000000000..4df60b8ad --- /dev/null +++ b/src/components/basic/svg-icon/svg-icon.vue @@ -0,0 +1,51 @@ + + + + + diff --git a/src/components/basic/title-i18n/index.ts b/src/components/basic/title-i18n/index.ts new file mode 100644 index 000000000..3382ba125 --- /dev/null +++ b/src/components/basic/title-i18n/index.ts @@ -0,0 +1 @@ +export { default as TitleI18n } from './index.vue'; diff --git a/src/components/basic/title-i18n/index.vue b/src/components/basic/title-i18n/index.vue new file mode 100644 index 000000000..2cf6504c6 --- /dev/null +++ b/src/components/basic/title-i18n/index.vue @@ -0,0 +1,27 @@ + + + diff --git a/src/components/business/README.md b/src/components/business/README.md new file mode 100644 index 000000000..403b3c2ee --- /dev/null +++ b/src/components/business/README.md @@ -0,0 +1,3 @@ +### 业务组件(目录说明) + +#### 与业务强耦合的组件可以放这里 diff --git a/src/components/core/README.md b/src/components/core/README.md new file mode 100644 index 000000000..e7ad511cd --- /dev/null +++ b/src/components/core/README.md @@ -0,0 +1,7 @@ +### 核心组件(目录说明) + +| 组件名称 | 描述 | 是否全局组件 | 使用建议 | +| --- | --- | --- | --- | +| draggable-modal | `可拖拽弹窗`基于 a-modal 二次封装的可拖拽模态框,基本使用方式与 antdv 的 a-modal 保持一致 | 否 | 有弹窗拖拽需求的可以使用此组件 | +| dynamic-table | `动态表格`基于 a-table 二次封装的表格,基本使用方式与 antdv 的 a-table 保持一致 | 否 | 根据自己需求调整,建议全局使用统一的表格封装组件 | +| schema-form | `动态表单`基于 a-form 二次封装。通过 JSON schema 的方式配置使用 | 否 | 定制性不高的表单都可以考虑使用 | diff --git a/src/components/core/draggable-modal/index.ts b/src/components/core/draggable-modal/index.ts new file mode 100644 index 000000000..96898a972 --- /dev/null +++ b/src/components/core/draggable-modal/index.ts @@ -0,0 +1 @@ +export { default as DraggableModal } from './index.vue'; diff --git a/src/components/a-custom-modal/index.vue b/src/components/core/draggable-modal/index.vue similarity index 100% rename from src/components/a-custom-modal/index.vue rename to src/components/core/draggable-modal/index.vue diff --git a/src/components/dynamic-table/components/index.ts b/src/components/core/dynamic-table/components/index.ts similarity index 100% rename from src/components/dynamic-table/components/index.ts rename to src/components/core/dynamic-table/components/index.ts diff --git a/src/components/dynamic-table/components/query-form/index.vue b/src/components/core/dynamic-table/components/query-form/index.vue similarity index 96% rename from src/components/dynamic-table/components/query-form/index.vue rename to src/components/core/dynamic-table/components/query-form/index.vue index 0fd1c9520..8b7f78ce2 100644 --- a/src/components/dynamic-table/components/query-form/index.vue +++ b/src/components/core/dynamic-table/components/query-form/index.vue @@ -23,8 +23,8 @@ import { defineComponent, reactive, toRefs, computed, ref } from 'vue'; import { DownOutlined } from '@ant-design/icons-vue'; import type { TableColumn } from '../../typing'; - import SchemaForm from '@/components/JSON-schema-form/schema-form.vue'; - import type { FormItemSchema, FormProps } from '@/components/JSON-schema-form/types/form'; + import SchemaForm from '@/components/core/schema-form/schema-form.vue'; + import type { FormItemSchema, FormProps } from '@/components/core/schema-form/types/form'; export default defineComponent({ name: 'QueryForm', diff --git a/src/components/dynamic-table/components/table-action.vue b/src/components/core/dynamic-table/components/table-action.vue similarity index 100% rename from src/components/dynamic-table/components/table-action.vue rename to src/components/core/dynamic-table/components/table-action.vue diff --git a/src/components/dynamic-table/components/table-settings/column-setting.vue b/src/components/core/dynamic-table/components/table-settings/column-setting.vue similarity index 98% rename from src/components/dynamic-table/components/table-settings/column-setting.vue rename to src/components/core/dynamic-table/components/table-settings/column-setting.vue index 256c74ab8..e988ed383 100644 --- a/src/components/dynamic-table/components/table-settings/column-setting.vue +++ b/src/components/core/dynamic-table/components/table-settings/column-setting.vue @@ -74,7 +74,7 @@ } from '@ant-design/icons-vue'; import { useTableContext } from '../../hooks/useTableContext'; import { cloneDeep } from 'lodash'; - import Checkbox from '@/components/check-box/index.vue'; + import Checkbox from '@/components/basic/check-box/index.vue'; import type { TableColumn } from '../../typing'; import { useSortable } from '@/hooks/useSortable'; import { isNullAndUnDef } from '@/utils/is'; diff --git a/src/components/dynamic-table/components/table-settings/index.vue b/src/components/core/dynamic-table/components/table-settings/index.vue similarity index 100% rename from src/components/dynamic-table/components/table-settings/index.vue rename to src/components/core/dynamic-table/components/table-settings/index.vue diff --git a/src/components/dynamic-table/components/table-settings/refresh-setting.vue b/src/components/core/dynamic-table/components/table-settings/refresh-setting.vue similarity index 100% rename from src/components/dynamic-table/components/table-settings/refresh-setting.vue rename to src/components/core/dynamic-table/components/table-settings/refresh-setting.vue diff --git a/src/components/dynamic-table/components/table-settings/size-setting.vue b/src/components/core/dynamic-table/components/table-settings/size-setting.vue similarity index 100% rename from src/components/dynamic-table/components/table-settings/size-setting.vue rename to src/components/core/dynamic-table/components/table-settings/size-setting.vue diff --git a/src/components/dynamic-table/components/tool-bar/index.vue b/src/components/core/dynamic-table/components/tool-bar/index.vue similarity index 93% rename from src/components/dynamic-table/components/tool-bar/index.vue rename to src/components/core/dynamic-table/components/tool-bar/index.vue index a5665f7e3..da49a38ec 100644 --- a/src/components/dynamic-table/components/tool-bar/index.vue +++ b/src/components/core/dynamic-table/components/tool-bar/index.vue @@ -17,7 +17,7 @@ - - diff --git a/src/components/svg-icon/svg-icon.vue b/src/components/svg-icon/svg-icon.vue deleted file mode 100644 index fa5741c12..000000000 --- a/src/components/svg-icon/svg-icon.vue +++ /dev/null @@ -1,51 +0,0 @@ - - - - diff --git a/src/enums/cacheEnum.ts b/src/enums/cacheEnum.ts index e91012748..adc7fc5ec 100644 --- a/src/enums/cacheEnum.ts +++ b/src/enums/cacheEnum.ts @@ -1,6 +1,9 @@ // 用户token export const ACCESS_TOKEN_KEY = 'ACCESS_TOKEN'; +// 国际化 +export const LOCALE_KEY = 'LOCALE__'; + // 用户信息 export const USER_INFO_KEY = 'USER__INFO__'; diff --git a/src/hooks/functions/useContextMenu.ts b/src/hooks/functions/useContextMenu.ts index ad65535d9..ec0d11000 100644 --- a/src/hooks/functions/useContextMenu.ts +++ b/src/hooks/functions/useContextMenu.ts @@ -1,8 +1,8 @@ import { createApp, h, App } from 'vue'; -import { Props } from '@/components/context-menu/types'; +import { Props } from '@/components/basic/context-menu/types'; -import ContentMenu from '@/components/context-menu/index.vue'; +import ContentMenu from '@/components/basic/context-menu/index.vue'; let ContentMenuInstance: App | null = null; let wrapperEl: HTMLElement | null = null; diff --git a/src/hooks/useI18n.ts b/src/hooks/useI18n.ts new file mode 100644 index 000000000..f726121f0 --- /dev/null +++ b/src/hooks/useI18n.ts @@ -0,0 +1,27 @@ +import { i18n } from '@/locales'; +import { Title18n } from 'types/vue-router'; + +/** + * 国际化转换工具函数,主要用于处理动态路由的title + * @param {string | Title18n} message message + * @param isI18n 默认为true,获取对应的翻译文本,否则返回本身 + * @returns message + */ +export function transformI18n(message: string | Title18n = '', isI18n = true) { + if (!message) { + return ''; + } + + // 处理动态路由的title, 格式 {zh_CN:"",en_US:""} + if (typeof message === 'object') { + return message[i18n.global?.locale]; + } + + if (isI18n && typeof message === 'string') { + return i18n.global.t(message); + } + return message; +} + +// 主要用于配合vscode i18nn ally插件的提示。此功能仅用于路由和菜单。请在其他地方使用 vue-i18n 的 useI18n +export const t = (key: string) => key; diff --git a/src/hooks/useModal/modal.tsx b/src/hooks/useModal/modal.tsx index dd9cf9e97..fab265e15 100644 --- a/src/hooks/useModal/modal.tsx +++ b/src/hooks/useModal/modal.tsx @@ -1,16 +1,16 @@ -import CustomAModal from '@/components/a-custom-modal/index.vue'; +import { DraggableModal } from '@/components/core/draggable-modal'; import { defineComponent, reactive, watchEffect, watch, ref } from 'vue'; import type { HookModalProps } from './types'; import { isFunction } from '@/utils/is'; -import zhCN from 'ant-design-vue/es/locale/zh_CN'; import { ConfigProvider } from 'ant-design-vue'; import { omit } from 'lodash'; +import { useLocale } from '@/locales/useLocale'; export const MyModal = defineComponent({ - components: { modal: CustomAModal }, + components: { modal: DraggableModal }, setup(props: HookModalProps) { const confirmLoading = ref(false); - + const { getAntdLocale } = useLocale(); const state = reactive({ visible: props.visible, }); @@ -43,7 +43,7 @@ export const MyModal = defineComponent({ return () => { return ( - + + + + + + + + + diff --git a/src/layout/header/components/index.ts b/src/layout/header/components/index.ts index e9cc94f79..2ad0d7e0f 100644 --- a/src/layout/header/components/index.ts +++ b/src/layout/header/components/index.ts @@ -1,3 +1,2 @@ -import SearchModal from './search/index.vue'; - -export { SearchModal }; +export { default as Search } from './search/index.vue'; +export { default as FullScreen } from './fullscreen/index.vue'; diff --git a/src/layout/header/components/search/index.vue b/src/layout/header/components/search/index.vue index abae075fe..3beb5dc20 100644 --- a/src/layout/header/components/search/index.vue +++ b/src/layout/header/components/search/index.vue @@ -1,55 +1,51 @@