From 3e5a60089b228ae6921d92e4a24b673beed8e92f Mon Sep 17 00:00:00 2001 From: sunlei Date: Sun, 17 May 2026 12:32:25 +0800 Subject: [PATCH] =?UTF-8?q?chore(admin):=20=E7=B2=BE=E7=AE=80=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E6=A8=A1=E6=9D=BF=E5=B9=B6=E9=9A=90=E8=97=8F=E6=9C=AA?= =?UTF-8?q?=E6=8E=A5=E5=85=A5=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/README.md | 5 - .changeset/config.json | 18 - .commitlintrc.js | 1 - .gitpod.yml | 6 - .husky/commit-msg | 2 +- README.ja-JP.md | 157 -- README.md | 198 +- README.zh-CN.md | 157 -- apps/web-antdv-next/src/api/core/menu.ts | 45 +- apps/web-antdv-next/src/api/system/menu.ts | 30 +- apps/web-antdv-next/src/layouts/basic.vue | 143 +- apps/web-antdv-next/src/preferences.ts | 5 + .../web-antdv-next/src/router/routes/index.ts | 3 +- cspell.json | 81 - deploy/nginx-admin.conf | 35 + .../commit}/validate-commit-msg.mjs | 0 .../lint-configs/commitlint-config/index.mjs | 153 - .../commitlint-config/package.json | 33 - .../eslint-config/src/configs/ignores.ts | 1 - .../eslint-config/src/configs/jsonc.ts | 16 - .../eslint-config/src/configs/node.ts | 5 +- .../eslint-config/src/configs/unicorn.ts | 5 +- .../eslint-config/src/custom-config.ts | 2 +- internal/node-utils/package.json | 1 - internal/node-utils/src/git.ts | 2 - internal/node-utils/src/index.ts | 1 - package.json | 60 +- pnpm-lock.yaml | 2451 +---------------- pnpm-workspace.yaml | 16 - scripts/clean.mjs | 141 - scripts/deploy/Dockerfile | 37 - scripts/deploy/build-local-docker-image.sh | 55 - scripts/deploy/nginx.conf | 75 - scripts/turbo-run/README.md | 59 - scripts/turbo-run/bin/turbo-run.mjs | 3 - scripts/turbo-run/build.config.ts | 7 - scripts/turbo-run/package.json | 29 - scripts/turbo-run/src/index.ts | 29 - scripts/turbo-run/src/run.ts | 67 - scripts/turbo-run/tsconfig.json | 6 - scripts/vsh/README.md | 56 - scripts/vsh/bin/vsh.mjs | 3 - scripts/vsh/build.config.ts | 7 - scripts/vsh/package.json | 31 - scripts/vsh/src/check-circular/index.ts | 170 -- scripts/vsh/src/check-dep/index.ts | 193 -- scripts/vsh/src/code-workspace/index.ts | 78 - scripts/vsh/src/index.ts | 74 - scripts/vsh/src/lint/index.ts | 48 - scripts/vsh/src/publint/index.ts | 185 -- scripts/vsh/tsconfig.json | 6 - skills/SKILL.md | 2 +- skills/references/deployment/deploy.md | 34 - tea.yaml | 6 - turbo.json | 4 +- vben-admin.code-workspace | 152 - 56 files changed, 189 insertions(+), 5000 deletions(-) delete mode 100644 .changeset/README.md delete mode 100644 .changeset/config.json delete mode 100644 .commitlintrc.js delete mode 100644 .gitpod.yml delete mode 100644 README.ja-JP.md delete mode 100644 README.zh-CN.md delete mode 100644 cspell.json create mode 100644 deploy/nginx-admin.conf rename {scripts => internal/commit}/validate-commit-msg.mjs (100%) delete mode 100644 internal/lint-configs/commitlint-config/index.mjs delete mode 100644 internal/lint-configs/commitlint-config/package.json delete mode 100644 scripts/clean.mjs delete mode 100644 scripts/deploy/Dockerfile delete mode 100644 scripts/deploy/build-local-docker-image.sh delete mode 100644 scripts/deploy/nginx.conf delete mode 100644 scripts/turbo-run/README.md delete mode 100644 scripts/turbo-run/bin/turbo-run.mjs delete mode 100644 scripts/turbo-run/build.config.ts delete mode 100644 scripts/turbo-run/package.json delete mode 100644 scripts/turbo-run/src/index.ts delete mode 100644 scripts/turbo-run/src/run.ts delete mode 100644 scripts/turbo-run/tsconfig.json delete mode 100644 scripts/vsh/README.md delete mode 100644 scripts/vsh/bin/vsh.mjs delete mode 100644 scripts/vsh/build.config.ts delete mode 100644 scripts/vsh/package.json delete mode 100644 scripts/vsh/src/check-circular/index.ts delete mode 100644 scripts/vsh/src/check-dep/index.ts delete mode 100644 scripts/vsh/src/code-workspace/index.ts delete mode 100644 scripts/vsh/src/index.ts delete mode 100644 scripts/vsh/src/lint/index.ts delete mode 100644 scripts/vsh/src/publint/index.ts delete mode 100644 scripts/vsh/tsconfig.json delete mode 100644 tea.yaml delete mode 100644 vben-admin.code-workspace diff --git a/.changeset/README.md b/.changeset/README.md deleted file mode 100644 index 5654e89..0000000 --- a/.changeset/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Changesets - -Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works with multi-package repos, or single-package repos to help you version and publish your code. You can find the full documentation for it [in our repository](https://github.com/changesets/changesets) - -We have a quick list of common questions to get you started engaging with this project in [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) diff --git a/.changeset/config.json b/.changeset/config.json deleted file mode 100644 index f954fb4..0000000 --- a/.changeset/config.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json", - "changelog": [ - "@changesets/changelog-github", - { "repo": "vbenjs/vue-vben-admin" } - ], - "commit": false, - "fixed": [["@vben-core/*", "@vben/*"]], - "snapshot": { - "prereleaseTemplate": "{tag}-{datetime}" - }, - "privatePackages": { "version": true, "tag": true }, - "linked": [], - "access": "public", - "baseBranch": "main", - "updateInternalDependencies": "patch", - "ignore": [] -} diff --git a/.commitlintrc.js b/.commitlintrc.js deleted file mode 100644 index 02e33fa..0000000 --- a/.commitlintrc.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from '@vben/commitlint-config'; diff --git a/.gitpod.yml b/.gitpod.yml deleted file mode 100644 index 5fda2cf..0000000 --- a/.gitpod.yml +++ /dev/null @@ -1,6 +0,0 @@ -ports: - - port: 5555 - onOpen: open-preview -tasks: - - init: npm i -g corepack && pnpm install - command: pnpm run dev:play diff --git a/.husky/commit-msg b/.husky/commit-msg index 5c056bb..27a0ed0 100644 --- a/.husky/commit-msg +++ b/.husky/commit-msg @@ -1 +1 @@ -node scripts/validate-commit-msg.mjs "$1" +node internal/commit/validate-commit-msg.mjs "$1" diff --git a/README.ja-JP.md b/README.ja-JP.md deleted file mode 100644 index 4ce285a..0000000 --- a/README.ja-JP.md +++ /dev/null @@ -1,157 +0,0 @@ -
- - VbenAdmin Logo - -
-
- -[![license](https://img.shields.io/github/license/anncwb/vue-vben-admin.svg)](LICENSE) - -

Vue Vben Admin

-
- -[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=vbenjs_vue-vben-admin&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=vbenjs_vue-vben-admin) ![codeql](https://github.com/vbenjs/vue-vben-admin/actions/workflows/codeql.yml/badge.svg) ![build](https://github.com/vbenjs/vue-vben-admin/actions/workflows/build.yml/badge.svg) ![ci](https://github.com/vbenjs/vue-vben-admin/actions/workflows/ci.yml/badge.svg) ![deploy](https://github.com/vbenjs/vue-vben-admin/actions/workflows/deploy.yml/badge.svg) - -**日本語** | [English](./README.md) | [中文](./README.zh-CN.md) - -## 紹介 - -Vue Vben Adminは、最新の`vue3`、`vite`、`TypeScript`などの主流技術を使用して開発された、無料でオープンソースの中・後端テンプレートです。すぐに使える中・後端のフロントエンドソリューションとして、学習の参考にもなります。 - -## アップグレード通知 - -これは最新バージョン `5.0` であり、以前のバージョンとは互換性がありません。新しいプロジェクトを開始する場合は、最新バージョンを使用することをお勧めします。古いバージョンを表示したい場合は、[v2ブランチ](https://github.com/vbenjs/vue-vben-admin/tree/v2)を使用してください。 - -## 特徴 - -- **最新技術スタック**:Vue 3やViteなどの最先端フロントエンド技術で開発 -- **TypeScript**:アプリケーション規模のJavaScriptのための言語 -- **テーマ**:複数のテーマカラーが利用可能で、カスタマイズオプションも豊富 -- **国際化**:完全な内蔵国際化サポート -- **権限管理**:動的ルートベースの権限生成ソリューションを内蔵 - -## プレビュー - -- [Vben Admin](https://vben.pro/) - フルバージョンの中国語サイト - -テストアカウント:vben/123456 - -
- VbenAdmin Logo - VbenAdmin Logo - VbenAdmin Logo -
- -### Gitpodを使用 - -Gitpod(GitHub用の無料オンライン開発環境)でプロジェクトを開き、すぐにコーディングを開始します。 - -[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/vbenjs/vue-vben-admin) - -## ドキュメント - -[ドキュメント](https://doc.vben.pro/) - -## インストールと使用 - -1. プロジェクトコードを取得 - -```bash -git clone https://github.com/vbenjs/vue-vben-admin.git -``` - -2. 依存関係のインストール - -```bash -cd vue-vben-admin -npm i -g corepack -pnpm install -``` - -3. 実行 - -```bash -pnpm dev -``` - -4. ビルド - -```bash -pnpm build -``` - -## 変更ログ - -[CHANGELOG](https://github.com/vbenjs/vue-vben-admin/releases) - -## 貢献方法 - -ご参加をお待ちしております![Issueを提出](https://github.com/anncwb/vue-vben-admin/issues/new/choose)するか、Pull Requestを送信してください。 - -**Pull Request プロセス:** - -1. コードをフォーク -2. 自分のブランチを作成:`git checkout -b feat/xxxx` -3. 変更をコミット:`git commit -am 'feat(function): add xxxxx'` -4. ブランチをプッシュ:`git push origin feat/xxxx` -5. `pull request`を送信 - -## Git貢献提出規則 - -参考 [vue](https://github.com/vuejs/vue/blob/dev/.github/COMMIT_CONVENTION.md) 規則 ([Angular](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular)) - -- `feat` 新機能の追加 -- `fix` 問題/バグの修正 -- `style` コードスタイルに関連し、実行結果に影響しない -- `perf` 最適化/パフォーマンス向上 -- `refactor` リファクタリング -- `revert` 変更の取り消し -- `test` テスト関連 -- `docs` ドキュメント/注釈 -- `chore` 依存関係の更新/スキャフォールディング設定の変更など -- `ci` 継続的インテグレーション -- `types` 型定義ファイルの変更 - -## ブラウザサポート - -ローカル開発には `Chrome 80+` ブラウザを推奨します - -モダンブラウザをサポートし、IEはサポートしません - -| [Edge](http://godban.github.io/browsers-support-badges/)
Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | -| :-: | :-: | :-: | :-: | -| 最新2バージョン | 最新2バージョン | 最新2バージョン | 最新2バージョン | - -## メンテナー - -[@Vben](https://github.com/anncwb) - -## スター歴史 - -[![Star History Chart](https://api.star-history.com/svg?repos=vbenjs/vue-vben-admin&type=Date)](https://star-history.com/#vbenjs/vue-vben-admin&Date) - -## 寄付 - -このプロジェクトが役に立つと思われた場合、作者にコーヒーを一杯おごってサポートを示すことができます! - -![donate](https://unpkg.com/@vbenjs/static-source@0.1.7/source/sponsor.png) - -Paypal Me - -## 貢献者 - - - Contribution Leaderboard - - - - Contributors - - -## Discord - -- [Github Discussions](https://github.com/anncwb/vue-vben-admin/discussions) - -## ライセンス - -[MIT © Vben-2020](./LICENSE) diff --git a/README.md b/README.md index ce8e897..a684c0a 100644 --- a/README.md +++ b/README.md @@ -1,157 +1,67 @@ -
- - VbenAdmin Logo - -
-
+# KT Template Admin -[![license](https://img.shields.io/github/license/anncwb/vue-vben-admin.svg)](LICENSE) +`kt-template-admin` 是 KT 后台管理端项目,基于 Vben 5.6.0 精简后只保留 `antdv-next` 应用,接口统一接入 `kt-template-online-api`,生产发布走 Jenkins 静态构建和 Nginx 反向代理。 -

Vue Vben Admin

-
+## 项目结构 -[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=vbenjs_vue-vben-admin&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=vbenjs_vue-vben-admin) [![codeql](https://github.com/vbenjs/vue-vben-admin/actions/workflows/codeql.yml/badge.svg)](https://github.com/vbenjs/vue-vben-admin/actions/workflows/codeql.yml) [![build](https://github.com/vbenjs/vue-vben-admin/actions/workflows/build.yml/badge.svg)](https://github.com/vbenjs/vue-vben-admin/actions/workflows/build.yml) [![ci](https://github.com/vbenjs/vue-vben-admin/actions/workflows/ci.yml/badge.svg)](https://github.com/vbenjs/vue-vben-admin/actions/workflows/ci.yml) [![deploy](https://github.com/vbenjs/vue-vben-admin/actions/workflows/deploy.yml/badge.svg)](https://github.com/vbenjs/vue-vben-admin/actions/workflows/deploy.yml) - -**English** | [中文](./README.zh-CN.md) | [日本語](./README.ja-JP.md) - -## Introduction - -Vue Vben Admin is a free and open source middle and back-end template. Using the latest `vue3`, `vite`, `TypeScript` and other mainstream technology development, the out-of-the-box middle and back-end front-end solutions can also be used for learning reference. - -## Upgrade Notice - -This is the latest version, 5.0, and it is not compatible with previous versions. If you are starting a new project, it is recommended to use the latest version. If you wish to view the old version, please use the [v2 branch](https://github.com/vbenjs/vue-vben-admin/tree/v2). - -## Features - -- **Latest Technology Stack**: Developed with cutting-edge front-end technologies like Vue 3 and Vite -- **TypeScript**: A language for application-scale JavaScript -- **Themes**: Multiple theme colors available with customizable options -- **Internationalization**: Comprehensive built-in internationalization support -- **Permissions**: Built-in solution for dynamic route-based permission generation - -## Preview - -- [Vben Admin](https://vben.pro/) - Full version Chinese site - -Test Account: vben/123456 - -
- VbenAdmin Logo - VbenAdmin Logo - VbenAdmin Logo -
- -### Use Gitpod - -Open the project in Gitpod (free online dev environment for GitHub) and start coding immediately. - -[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/vbenjs/vue-vben-admin) - -## Documentation - -[Document](https://doc.vben.pro/) - -## Install and Use - -1. Get the project code - -```bash -git clone https://github.com/vbenjs/vue-vben-admin.git +```text +apps/web-antdv-next 后台管理端入口 +internal 构建、Vite、Lint 等内部配置包 +packages Vben 运行时依赖的核心包和组件包 +deploy/nginx-admin.conf Admin 静态站点和后端 /api 反向代理配置 +Jenkinsfile Jenkins 静态发布流水线 ``` -2. Install dependencies +## 环境要求 + +- Node.js `22.22.0` +- pnpm `10.28.2` + +建议通过 Corepack 固定 pnpm 版本: + +```bash +corepack enable +corepack prepare pnpm@10.28.2 --activate +``` + +## 常用命令 ```bash -cd vue-vben-admin -npm i -g corepack pnpm install +pnpm run dev +pnpm run verify:commit +pnpm run build:antdv-next ``` -3. Run +## 环境变量 -```bash -pnpm dev +本地开发和 Jenkins 构建主要使用: + +- `VITE_GLOB_API_URL`:后端 API 前缀,本地和生产默认使用 `/api` +- `VITE_BASE`:Vite base,默认 `/` +- `VITE_ROUTER_HISTORY`:路由模式,可选 `hash` 或 `html5` +- `VITE_COMPRESS`:构建压缩方式,可选 `none`、`gzip`、`brotli` + +真实环境变量不提交,示例配置以 `.env.example` 为准。 + +## 部署说明 + +Jenkins 使用 `Jenkinsfile` 执行: + +1. 安装依赖 +2. `pnpm run verify:commit` +3. `pnpm run build:antdv-next` +4. 将 `apps/web-antdv-next/dist` 原子发布到 Nginx 挂载的 Admin 静态目录 + +Nginx 配置见 `deploy/nginx-admin.conf`,默认监听 `5999`,静态根目录为 `/usr/share/nginx/html/admin`,并将浏览器侧 `/api/*` 转发到后端 `192.168.31.224:48085`。配置保留 gzip、静态资源长缓存、入口 HTML 不缓存和 SPA 回退。 + +## 提交规范 + +Husky 会在提交前执行 lint 和类型校验,并在 `commit-msg` 阶段校验提交信息格式: + +```text +feat(admin): 增加后台菜单配置 +fix(api): 修复登录态刷新 ``` -4. Build - -```bash -pnpm build -``` - -## Change Log - -[CHANGELOG](https://github.com/vbenjs/vue-vben-admin/releases) - -## How to Contribute - -You are very welcome to join! [Raise an issue](https://github.com/anncwb/vue-vben-admin/issues/new/choose) or submit a Pull Request. - -**Pull Request Process:** - -1. Fork the code -2. Create your branch: `git checkout -b feat/xxxx` -3. Submit your changes: `git commit -am 'feat(function): add xxxxx'` -4. Push your branch: `git push origin feat/xxxx` -5. Submit `pull request` - -## Git Contribution Submission Specification - -Reference [vue](https://github.com/vuejs/vue/blob/dev/.github/COMMIT_CONVENTION.md) specification ([Angular](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular)) - -- `feat` Add new features -- `fix` Fix the problem/BUG -- `style` The code style is related and does not affect the running result -- `perf` Optimization/performance improvement -- `refactor` Refactor -- `revert` Undo edit -- `test` Test related -- `docs` Documentation/notes -- `chore` Dependency update/scaffolding configuration modification etc. -- `ci` Continuous integration -- `types` Type definition file changes - -## Browser Support - -The `Chrome 80+` browser is recommended for local development - -Support modern browsers, not IE - -| [Edge](http://godban.github.io/browsers-support-badges/)
Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | -| :-: | :-: | :-: | :-: | -| last 2 versions | last 2 versions | last 2 versions | last 2 versions | - -## Maintainer - -[@Vben](https://github.com/anncwb) - -## Star History - -[![Star History Chart](https://api.star-history.com/svg?repos=vbenjs/vue-vben-admin&type=Date)](https://star-history.com/#vbenjs/vue-vben-admin&Date) - -## Donate - -If you think this project is helpful to you, you can help the author buy a cup of coffee to show your support! - -![donate](https://unpkg.com/@vbenjs/static-source@0.1.7/source/sponsor.png) - -Paypal Me - -## Contributors - - - Contribution Leaderboard - - - - Contributors - - -## Discord - -- [Github Discussions](https://github.com/anncwb/vue-vben-admin/discussions) - -## License - -[MIT © Vben-2020](./LICENSE) +要求使用英文类型前缀,描述部分包含中文。 diff --git a/README.zh-CN.md b/README.zh-CN.md deleted file mode 100644 index d3193ef..0000000 --- a/README.zh-CN.md +++ /dev/null @@ -1,157 +0,0 @@ -
- - VbenAdmin Logo - -
-
- -[![license](https://img.shields.io/github/license/anncwb/vue-vben-admin.svg)](LICENSE) - -

Vue Vben Admin

-
- -[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=vbenjs_vue-vben-admin&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=vbenjs_vue-vben-admin) ![codeql](https://github.com/vbenjs/vue-vben-admin/actions/workflows/codeql.yml/badge.svg) ![build](https://github.com/vbenjs/vue-vben-admin/actions/workflows/build.yml/badge.svg) ![ci](https://github.com/vbenjs/vue-vben-admin/actions/workflows/ci.yml/badge.svg) ![deploy](https://github.com/vbenjs/vue-vben-admin/actions/workflows/deploy.yml/badge.svg) - -**中文** | [English](./README.md) | [日本語](./README.ja-JP.md) - -## 简介 - -Vue Vben Admin 是 Vue Vben Admin 的升级版本。作为一个免费开源的中后台模板,它采用了最新的 Vue 3、Vite、TypeScript 等主流技术开发,开箱即用,可用于中后台前端开发,也适合学习参考。 - -## 升级提示 - -该版本为最新版本 `5.0`,与其他版本不兼容,如果你是新项目,建议使用最新版本。如果你想查看旧版本,请使用 [v2 分支](https://github.com/vbenjs/vue-vben-admin/tree/v2) - -## 特性 - -- **最新技术栈**:使用 Vue3/vite 等前端前沿技术开发 -- **TypeScript**:应用程序级 JavaScript 的语言 -- **主题**:提供多套主题色彩,可配置自定义主题 -- **国际化**:内置完善的国际化方案 -- **权限**:内置完善的动态路由权限生成方案 - -## 预览 - -- [Vben Admin](https://vben.pro/) - 完整版中文站点 - -测试账号:vben/123456 - -
- VbenAdmin Logo - VbenAdmin Logo - VbenAdmin Logo -
- -### 使用 Gitpod - -在 Gitpod(适用于 GitHub 的免费在线开发环境)中打开项目,并立即开始编码。 - -[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/vbenjs/vue-vben-admin) - -## 文档 - -[文档地址](https://doc.vben.pro/) - -## 安装使用 - -1. 获取项目代码 - -```bash -git clone https://github.com/vbenjs/vue-vben-admin.git -``` - -2. 安装依赖 - -```bash -cd vue-vben-admin -npm i -g corepack -pnpm install -``` - -3. 运行 - -```bash -pnpm dev -``` - -4. 打包 - -```bash -pnpm build -``` - -## 更新日志 - -[CHANGELOG](https://github.com/vbenjs/vue-vben-admin/releases) - -## 如何贡献 - -非常欢迎你的加入![提一个 Issue](https://github.com/anncwb/vue-vben-admin/issues/new/choose) 或者提交一个 Pull Request。 - -**Pull Request 流程:** - -1. Fork 代码 -2. 创建自己的分支:`git checkout -b feature/xxxx` -3. 提交你的修改:`git commit -am 'feat(function): add xxxxx'` -4. 推送您的分支:`git push origin feature/xxxx` -5. 提交 `pull request` - -## Git 贡献提交规范 - -参考 [vue](https://github.com/vuejs/vue/blob/dev/.github/COMMIT_CONVENTION.md) 规范 ([Angular](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular)) - -- `feat` 增加新功能 -- `fix` 修复问题/BUG -- `style` 代码风格相关无影响运行结果的 -- `perf` 优化/性能提升 -- `refactor` 重构 -- `revert` 撤销修改 -- `test` 测试相关 -- `docs` 文档/注释 -- `chore` 依赖更新/脚手架配置修改等 -- `ci` 持续集成 -- `types` 类型定义文件更改 - -## 浏览器支持 - -本地开发推荐使用 `Chrome 80+` 浏览器 - -支持现代浏览器,不支持 IE - -| [Edge](http://godban.github.io/browsers-support-badges/)
Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | -| :-: | :-: | :-: | :-: | -| last 2 versions | last 2 versions | last 2 versions | last 2 versions | - -## 维护者 - -[@Vben](https://github.com/anncwb) - -## Star 历史 - -[![Star History Chart](https://api.star-history.com/svg?repos=vbenjs/vue-vben-admin&type=Date)](https://star-history.com/#vbenjs/vue-vben-admin&Date) - -## 捐赠 - -如果你觉得这个项目对你有帮助,你可以帮作者买一杯咖啡表示支持! - -![donate](https://unpkg.com/@vbenjs/static-source@0.1.7/source/sponsor.png) - -Paypal Me - -## 贡献者 - - - Contribution Leaderboard - - - - Contributors - - -## Discord - -- [Github Discussions](https://github.com/anncwb/vue-vben-admin/discussions) - -## 许可证 - -[MIT © Vben-2020](./LICENSE) diff --git a/apps/web-antdv-next/src/api/core/menu.ts b/apps/web-antdv-next/src/api/core/menu.ts index 9ef60b1..c151b9f 100644 --- a/apps/web-antdv-next/src/api/core/menu.ts +++ b/apps/web-antdv-next/src/api/core/menu.ts @@ -2,9 +2,52 @@ import type { RouteRecordStringComponent } from '@vben/types'; import { requestClient } from '#/api/request'; +const SUPPORTED_ADMIN_MENU_NAMES = new Set([ + 'System', + 'SystemDept', + 'SystemDeptCreate', + 'SystemDeptDelete', + 'SystemDeptEdit', + 'SystemMenu', + 'SystemMenuCreate', + 'SystemMenuDelete', + 'SystemMenuEdit', + 'SystemRole', + 'SystemRoleCreate', + 'SystemRoleDelete', + 'SystemRoleEdit', +]); + +export function isSupportedAdminMenuName(name?: null | string | symbol) { + return typeof name === 'string' && SUPPORTED_ADMIN_MENU_NAMES.has(name); +} + +function filterSupportedAdminMenus( + menus: RouteRecordStringComponent[], +): RouteRecordStringComponent[] { + return menus + .map((menu) => { + const children = menu.children + ? filterSupportedAdminMenus(menu.children) + : undefined; + + return { + ...menu, + ...(children && children.length > 0 ? { children } : {}), + }; + }) + .filter( + (menu) => isSupportedAdminMenuName(menu.name) || !!menu.children?.length, + ); +} + /** * 获取用户所有菜单 */ export async function getAllMenusApi() { - return requestClient.get('/menu/all'); + const menus = + await requestClient.get('/menu/all'); + + // 只暴露当前后端真实接口已经支撑的后台菜单,模板演示入口等后续补接口后再放开。 + return filterSupportedAdminMenus(menus); } diff --git a/apps/web-antdv-next/src/api/system/menu.ts b/apps/web-antdv-next/src/api/system/menu.ts index 507a5ae..de4e7d7 100644 --- a/apps/web-antdv-next/src/api/system/menu.ts +++ b/apps/web-antdv-next/src/api/system/menu.ts @@ -2,6 +2,8 @@ import type { Recordable } from '@vben/types'; import { requestClient } from '#/api/request'; +import { isSupportedAdminMenuName } from '../core/menu'; + export namespace SystemMenuApi { /** 徽标颜色集合 */ export const BadgeVariants = [ @@ -90,13 +92,35 @@ export namespace SystemMenuApi { } } +function filterSupportedSystemMenus( + menus: SystemMenuApi.SystemMenu[], +): SystemMenuApi.SystemMenu[] { + return menus + .map((menu) => { + const children = menu.children + ? filterSupportedSystemMenus(menu.children) + : undefined; + + return { + ...menu, + ...(children && children.length > 0 ? { children } : {}), + }; + }) + .filter( + (menu) => isSupportedAdminMenuName(menu.name) || !!menu.children?.length, + ); +} + /** * 获取菜单数据列表 */ async function getMenuList() { - return requestClient.get>( - '/system/menu/list', - ); + const menus = + await requestClient.get>( + '/system/menu/list', + ); + + return filterSupportedSystemMenus(menus); } async function isMenuNameExists( diff --git a/apps/web-antdv-next/src/layouts/basic.vue b/apps/web-antdv-next/src/layouts/basic.vue index 2531849..2266288 100644 --- a/apps/web-antdv-next/src/layouts/basic.vue +++ b/apps/web-antdv-next/src/layouts/basic.vue @@ -1,24 +1,12 @@