Merge branch 'main' into fixBug

This commit is contained in:
xiaoming 2024-04-17 18:15:23 +08:00 committed by GitHub
commit 0ab75ad4ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
354 changed files with 33249 additions and 4345 deletions

View File

@ -1,13 +0,0 @@
public
dist
*.d.ts
/src/assets
package.json
eslint.config.js
.prettierrc.js
commitlint.config.js
postcss.config.js
tailwind.config.ts
stylelint.config.js
src/components/ReSplitPane/iconfont
src/components/ReFlowChart/src/assets/iconfont

View File

@ -13,14 +13,14 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Install Node.js - name: Install Node.js
uses: actions/setup-node@v3 uses: actions/setup-node@v4
with: with:
node-version: 18 node-version: 20
- uses: pnpm/action-setup@v2 - uses: pnpm/action-setup@v3
name: Install pnpm name: Install pnpm
id: pnpm-install id: pnpm-install
with: with:
@ -33,7 +33,7 @@ jobs:
run: | run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3 - uses: actions/cache@v4
name: Setup pnpm cache name: Setup pnpm cache
with: with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}

View File

@ -7,10 +7,14 @@
"prettier --cache --write--parser json" "prettier --cache --write--parser json"
], ],
"package.json": ["prettier --cache --write"], "package.json": ["prettier --cache --write"],
"*.vue": ["prettier --write", "eslint --cache --fix", "stylelint --fix"], "*.vue": [
"prettier --write",
"eslint --cache --fix",
"stylelint --fix --allow-empty-input"
],
"*.{css,scss,html}": [ "*.{css,scss,html}": [
"prettier --cache --ignore-unknown --write", "prettier --cache --ignore-unknown --write",
"stylelint --fix" "stylelint --fix --allow-empty-input"
], ],
"*.md": ["prettier --cache --ignore-unknown --write"] "*.md": ["prettier --cache --ignore-unknown --write"]
} }

2
.nvmrc
View File

@ -1 +1 @@
v20.11.0 v20.12.2

1
.prettierignore Normal file
View File

@ -0,0 +1 @@
src/views/system/menu/README.md

10
.vscode/settings.json vendored
View File

@ -35,5 +35,13 @@
"i18n-ally.sourceLanguage": "en", "i18n-ally.sourceLanguage": "en",
"i18n-ally.displayLanguage": "zh-CN", "i18n-ally.displayLanguage": "zh-CN",
"i18n-ally.enabledFrameworks": ["vue"], "i18n-ally.enabledFrameworks": ["vue"],
"iconify.excludes": ["el"] "iconify.excludes": ["el"],
"vsmqtt.brokerProfiles": [
{
"name": "broker.emqx.io",
"host": "broker.emqx.io/mqtt",
"port": 1883,
"clientId": "vsmqtt_client_db34"
}
]
} }

View File

@ -1,3 +1,165 @@
# 5.3.0 (2024-03-28)
### ✔️ refactor
- Reconstruct internationalized file naming conventions and demo pages with code location hints
### 🎫 Feat
- Add `MQTT` example
- Added `docx` and `excel` file preview examples
- The `ReSegmented` segmented controller has a new `size` attribute, which can set three sizes
- The `RePureTableBar` component and `pure-admin-table` support international switching of table headers
# 5.2.0 (2024-03-22)
### ✔️ refactor
- Place the full screen button at the top to make it visible and easy to operate
### 🎫 Feat
- Added `v-ripple` command (water ripple effect)
- Add global `Stretch` configuration to the content area to customize compact pages and easily find the required information
- Added roaming guidance based on `ElTour`
- Improve role management-menu permission function, novel interactive experience
- Add system monitoring-online users
- Add system monitoring-login log
- Add system monitoring-operation log
- Add system monitoring-system log
- Add more more convenient `pure-admin-table` editable table examples (overall editing, single row editing, cell editing)
- The `ReSegmented` component has a new `block` attribute to make it fit the width of the parent element
- Add [vue-flow](https://vueflow.dev/) flow chart example
- Add virtual table example
- Added Gantt chart example
- Add graphic verification code example
- Add form examples, which can be generated through `JSON` format configuration (basic form, pop-up form, drawer form, step-by-step form, search form)
- Add a folding and expanding menu function on the middle right side of the left menu
### 🐞 Bug fixes
- Fixed the scroll bar issue when clicking on the registration page under `windwos`
- Fixed the problem of scroll bars appearing in the content area when switching pages under `windows`
- Fixed the problem of status style disappearing in `pure-table` with status table under dark overall style
- Fixed the problem of turning on the gray mode and dark overall style in the project configuration and refreshing the overall style of the page.
### 🍏 Perf
- All pages of system management and system monitoring are compatible with mobile terminals
# 5.1.0 (2024-03-02)
### ✔️ refactor
- Reconstruct the tab page `UI` to make it more convenient to click the close button
### 🎫 Feat
- Added multi-select card example
- The menu supports all browser behaviors of right-clicking on the `a` tag (opening links in new tabs, new windows, dragging and dropping to open in new tabs, etc.)
- Added search history and collection functions to menu search
### 🐞 Bug fixes
- Fixed the problem of scroll bars appearing on the login page under `windows` system
### 🍏 Perf
- Standardize the naming rules when registering local icons to better match the icon selector
# 5.0.0 (2024-02-26)
Totally `ESM` version
### ✔️ refactor
- Upgrade `vite` to `v5` version, specify `node` version `>18.18.0`, `pnpm` version `>=8.6.10`
- Use [vite-plugin-fake-server](https://www.npmjs.com/package/vite-plugin-fake-server) to replace [vite-plugin-mock](https://www.npmjs.com/package/vite-plugin-mock), use [@faker-js/faker](https://www.npmjs.com/package/@faker-js/faker) to replace [mockjs](https://www.npmjs.com/package/mockjs)
- Rename `tailwind.config.js` to `tailwind.config.ts` and update its file to `esm` syntax
- Updated `.prettierrc.js` file to `esm` syntax
- Updated `postcss.config.js` file to `esm` syntax
- Updated `commitlint.config.js` file to `esm` syntax
- Use `eslint.config.js` to replace `.eslintrc.js` and follow `esm` syntax
- Upgrade `stylelint` to `16` version and follow `esm` syntax
- All `search` search icons are uniformly replaced with `@iconify-icons/ri/search-line` which is more commonly used and put into the global offline icon
- Removed the filter effect of `iframe` in dark mode
- Bring a more beautiful and refined homepage
- Cleaner and neater pop-up panel on the right side of project configuration
- Restructure the About page to make it more compact and key information more prominent
### 🎫 Feat
- Add system management-menu management
- Improve system management-user management
- Embedded `iframe` pages support setting `keepAlive` to maintain page status
- Optimized navigation, the pop-up menu is adaptive and scrollable beyond the content area
- Added file upload example
- Added overall style adaptive operating system light, dark, and automatic theme functions
- Add footer
- Supports multi-tab pages to open systems that have already been logged in without logging in again and adds an internal login-free function (users can choose the number of days without login)
- Terminal command line that brings a high-level feel
- Add audio visualization function example
- Added video frame interception - `WebAssembly` version, supports `MP4`, `MOV`, `AVI`, `WebM`, `MKV` and other mainstream formats
- Added methods to block keyboard `F12`, browser default right-click menu, page element selection, and picture default draggability
- The secondary package `localforage` supports setting expiration time and provides complete type prompts
- Add `AnimateCss` selector component `ReAnimateSelector`
- Added `ReText` component, supports automatic omission and display of `Tooltip` function, supports multi-line omission, high reusability
- Add an art drawing board function, which can be used to draw some design idea architecture diagrams, for example
- New component - optional button example
- Add common button examples
- Added color picker component example
- Add date picker component example
- Added datetime picker example
- Added time selector example
- Added statistics component example
- Add label component example
- Added accordion panel component example
- Add progress bar component example
- Upgrade `Swiper 11`
- Add [vite-plugin-router-warn](https://www.npmjs.com/package/vite-plugin-router-warn) plug-in to eliminate unnecessary `vue-router` dynamic routing warning`No match found for location with path`
### 🐞 Bug fixes
- Fixed the problem that in `query` routing parameter passing mode, two `router` jumps will be triggered when clicking the tab page to switch operations.
- Fixed an issue in card tab mode, when passing parameters through the `query` route, the `card-active` attribute still exists after leaving the active tab, resulting in the font color not changing when the mouse `hover`
- Fixed the error in reading and parsing the same name in the `src/layout/components/appMain.vue` file
- Fixed the issue where the height of the embedded page `frameView` does not adapt after hiding the tab page.
- Fixed the problem of invalid routing `meta.transition.name` configuration
- Fixed the problem that the right-click tab page panel cannot be closed when clicking on the `iframe` page and the right-click tab page panel is blocked when on the `iframe` page
- Fixed the problem of missing parameters when clicking on breadcrumbs to jump to the page in routing `query` and `params` modes
### 🍏 Perf
- Optimize theme color
- Tabs can be slid left or right according to the sliding force
- The interface naming rules are unified into `kebab-case` string naming method
- The `label` of `el-form` is consistent with the global `label` style
- `VITE_PUBLIC_PATH` defaults to `/`, which is more friendly to `VITE_ROUTER_HISTORY` in `h5` mode
- Optimize the `transformI18n` function and support unlimited nesting levels for internationalization (of course, the platform still recommends that the fewer nesting levels, the better)
- When initializing the page, load `pinia` first and then `router`, which is compatible with more usage scenarios.
- Optimize the judgment logic of request whitelist
- The navigation style of the left menu has been adjusted to optimize the different display methods on PC and mobile when there is no logo.
- Upgrade code specification style related libraries to the latest
- Optimize login page `loading` judgment
- Optimize the `IconSelect` icon selector component to improve user experience
- Optimize the segmented controller component and add `v-model` support
- Optimize the method of obtaining platform `logo`
- Upgraded `@pureadmin/theme`, bringing more friendly `esm` support
- Optimize some functions in the `build/info.ts` file to make it friendly and support `esm`
- Optimize the column setting pop-up box of the `PureTableBar` component, set the maximum height, and scroll beyond it
- Optimize the functional pop-up component `ReDialog` to retain the closing animation
- Test the Chinese path and delete the `sass-loader` dependency
- The packaged code is changed to the browser that natively supports [ES2015](https://caniuse.com/es6) by default
- Remove the `stylelint` plug-in dependency that will be automatically installed
- Enhance the way `useRenderIcon` uses local `svg`
- Optimize the style of the expand and collapse buttons in the lower left corner of the left menu under the bright white theme color scheme
- Optimize all `description` contents of `el-empty`. Add `el-empty` when the icon selector content is empty
- The `tooltip` theme after the left menu is collapsed is consistent with the overall menu
- Update `svgo` command to `svgo -f . -r` (compress all `SVG` files in the current directory)
- Optimize project construction related functions
- Enhanced `ReTypeit` component to support slots and all `typeit` configuration items
- Optimize internationalization-related processing logic and add cache during initialization to avoid unnecessary performance consumption
# 4.5.0 (2023-06-26) # 4.5.0 (2023-06-26)
### ✔️ refactor ### ✔️ refactor

View File

@ -1,3 +1,165 @@
# 5.3.0 (2024-03-28)
### ✔️ refactor
- Reconstruct internationalized file naming conventions and demo pages with code location hints
### 🎫 Feat
- Add `MQTT` example
- Added `docx` and `excel` file preview examples
- The `ReSegmented` segmented controller has a new `size` attribute, which can set three sizes
- The `RePureTableBar` component and `pure-admin-table` support international switching of table headers
# 5.2.0 (2024-03-22)
### ✔️ refactor
- Place the full screen button at the top to make it visible and easy to operate
### 🎫 Feat
- Added `v-ripple` command (water ripple effect)
- Add global `Stretch` configuration to the content area to customize compact pages and easily find the required information
- Added roaming guidance based on `ElTour`
- Improve role management-menu permission function, novel interactive experience
- Add system monitoring-online users
- Add system monitoring-login log
- Add system monitoring-operation log
- Add system monitoring-system log
- Add more more convenient `pure-admin-table` editable table examples (overall editing, single row editing, cell editing)
- The `ReSegmented` component has a new `block` attribute to make it fit the width of the parent element
- Add [vue-flow](https://vueflow.dev/) flow chart example
- Add virtual table example
- Added Gantt chart example
- Add graphic verification code example
- Add form examples, which can be generated through `JSON` format configuration (basic form, pop-up form, drawer form, step-by-step form, search form)
- Add a folding and expanding menu function on the middle right side of the left menu
### 🐞 Bug fixes
- Fixed the scroll bar issue when clicking on the registration page under `windwos`
- Fixed the problem of scroll bars appearing in the content area when switching pages under `windows`
- Fixed the problem of status style disappearing in `pure-table` with status table under dark overall style
- Fixed the problem of turning on the gray mode and dark overall style in the project configuration and refreshing the overall style of the page.
### 🍏 Perf
- All pages of system management and system monitoring are compatible with mobile terminals
# 5.1.0 (2024-03-02)
### ✔️ refactor
- Reconstruct the tab page `UI` to make it more convenient to click the close button
### 🎫 Feat
- Added multi-select card example
- The menu supports all browser behaviors of right-clicking on the `a` tag (opening links in new tabs, new windows, dragging and dropping to open in new tabs, etc.)
- Added search history and collection functions to menu search
### 🐞 Bug fixes
- Fixed the problem of scroll bars appearing on the login page under `windows` system
### 🍏 Perf
- Standardize the naming rules when registering local icons to better match the icon selector
# 5.0.0 (2024-02-26)
Totally `ESM` version
### ✔️ refactor
- Upgrade `vite` to `v5` version, specify `node` version `>18.18.0`, `pnpm` version `>=8.6.10`
- Use [vite-plugin-fake-server](https://www.npmjs.com/package/vite-plugin-fake-server) to replace [vite-plugin-mock](https://www.npmjs.com/package/vite-plugin-mock), use [@faker-js/faker](https://www.npmjs.com/package/@faker-js/faker) to replace [mockjs](https://www.npmjs.com/package/mockjs)
- Rename `tailwind.config.js` to `tailwind.config.ts` and update its file to `esm` syntax
- Updated `.prettierrc.js` file to `esm` syntax
- Updated `postcss.config.js` file to `esm` syntax
- Updated `commitlint.config.js` file to `esm` syntax
- Use `eslint.config.js` to replace `.eslintrc.js` and follow `esm` syntax
- Upgrade `stylelint` to `16` version and follow `esm` syntax
- All `search` search icons are uniformly replaced with `@iconify-icons/ri/search-line` which is more commonly used and put into the global offline icon
- Removed the filter effect of `iframe` in dark mode
- Bring a more beautiful and refined homepage
- Cleaner and neater pop-up panel on the right side of project configuration
- Restructure the About page to make it more compact and key information more prominent
### 🎫 Feat
- Add system management-menu management
- Improve system management-user management
- Embedded `iframe` pages support setting `keepAlive` to maintain page status
- Optimized navigation, the pop-up menu is adaptive and scrollable beyond the content area
- Added file upload example
- Added overall style adaptive operating system light, dark, and automatic theme functions
- Add footer
- Supports multi-tab pages to open systems that have already been logged in without logging in again and adds an internal login-free function (users can choose the number of days without login)
- Terminal command line that brings a high-level feel
- Add audio visualization function example
- Added video frame interception - `WebAssembly` version, supports `MP4`, `MOV`, `AVI`, `WebM`, `MKV` and other mainstream formats
- Added methods to block keyboard `F12`, browser default right-click menu, page element selection, and picture default draggability
- The secondary package `localforage` supports setting expiration time and provides complete type prompts
- Add `AnimateCss` selector component `ReAnimateSelector`
- Added `ReText` component, supports automatic omission and display of `Tooltip` function, supports multi-line omission, high reusability
- Add an art drawing board function, which can be used to draw some design idea architecture diagrams, for example
- New component - optional button example
- Add common button examples
- Added color picker component example
- Add date picker component example
- Added datetime picker example
- Added time selector example
- Added statistics component example
- Add label component example
- Added accordion panel component example
- Add progress bar component example
- Upgrade `Swiper 11`
- Add [vite-plugin-router-warn](https://www.npmjs.com/package/vite-plugin-router-warn) plug-in to eliminate unnecessary `vue-router` dynamic routing warning`No match found for location with path`
### 🐞 Bug fixes
- Fixed the problem that in `query` routing parameter passing mode, two `router` jumps will be triggered when clicking the tab page to switch operations.
- Fixed an issue in card tab mode, when passing parameters through the `query` route, the `card-active` attribute still exists after leaving the active tab, resulting in the font color not changing when the mouse `hover`
- Fixed the error in reading and parsing the same name in the `src/layout/components/appMain.vue` file
- Fixed the issue where the height of the embedded page `frameView` does not adapt after hiding the tab page.
- Fixed the problem of invalid routing `meta.transition.name` configuration
- Fixed the problem that the right-click tab page panel cannot be closed when clicking on the `iframe` page and the right-click tab page panel is blocked when on the `iframe` page
- Fixed the problem of missing parameters when clicking on breadcrumbs to jump to the page in routing `query` and `params` modes
### 🍏 Perf
- Optimize theme color
- Tabs can be slid left or right according to the sliding force
- The interface naming rules are unified into `kebab-case` string naming method
- The `label` of `el-form` is consistent with the global `label` style
- `VITE_PUBLIC_PATH` defaults to `/`, which is more friendly to `VITE_ROUTER_HISTORY` in `h5` mode
- Optimize the `transformI18n` function and support unlimited nesting levels for internationalization (of course, the platform still recommends that the fewer nesting levels, the better)
- When initializing the page, load `pinia` first and then `router`, which is compatible with more usage scenarios.
- Optimize the judgment logic of request whitelist
- The navigation style of the left menu has been adjusted to optimize the different display methods on PC and mobile when there is no logo.
- Upgrade code specification style related libraries to the latest
- Optimize login page `loading` judgment
- Optimize the `IconSelect` icon selector component to improve user experience
- Optimize the segmented controller component and add `v-model` support
- Optimize the method of obtaining platform `logo`
- Upgraded `@pureadmin/theme`, bringing more friendly `esm` support
- Optimize some functions in the `build/info.ts` file to make it friendly and support `esm`
- Optimize the column setting pop-up box of the `PureTableBar` component, set the maximum height, and scroll beyond it
- Optimize the functional pop-up component `ReDialog` to retain the closing animation
- Test the Chinese path and delete the `sass-loader` dependency
- The packaged code is changed to the browser that natively supports [ES2015](https://caniuse.com/es6) by default
- Remove the `stylelint` plug-in dependency that will be automatically installed
- Enhance the way `useRenderIcon` uses local `svg`
- Optimize the style of the expand and collapse buttons in the lower left corner of the left menu under the bright white theme color scheme
- Optimize all `description` contents of `el-empty`. Add `el-empty` when the icon selector content is empty
- The `tooltip` theme after the left menu is collapsed is consistent with the overall menu
- Update `svgo` command to `svgo -f . -r` (compress all `SVG` files in the current directory)
- Optimize project construction related functions
- Enhanced `ReTypeit` component to support slots and all `typeit` configuration items
- Optimize internationalization-related processing logic and add cache during initialization to avoid unnecessary performance consumption
# 4.5.0 (2023-06-26) # 4.5.0 (2023-06-26)
### ✔️ refactor ### ✔️ refactor

View File

@ -1,3 +1,165 @@
# 5.3.0 (2024-03-28)
### ✔️ refactor
- 重构国际化文件命名规范以及演示页加上代码位置提示
### 🎫 Feat
- 添加`MQTT`示例
- 添加`docx``excel`文件预览示例
- `ReSegmented`分段控制器新增`size`属性,可设置三种尺寸
- `RePureTableBar`组件搭配`pure-admin-table`支持表头国际化切换
# 5.2.0 (2024-03-22)
### ✔️ refactor
- 将全屏按钮置于顶部,使其显眼且易于操作
### 🎫 Feat
- 新增`v-ripple`指令(水波纹效果)
- 内容区添加全局`Stretch`配置,可自定义紧凑页面,轻松找到所需信息
- 添加基于`ElTour`实现的漫游式引导
- 完善角色管理-菜单权限功能,新颖的交互体验
- 添加系统监控-在线用户
- 添加系统监控-登录日志
- 添加系统监控-操作日志
- 添加系统监控-系统日志
- 添加更多更方便的`pure-admin-table`可编辑表格示例(整体编辑、单行编辑、单元格编辑)
- `ReSegmented`组件新增`block`属性,可使其适合父元素宽度
- 添加 [vue-flow](https://vueflow.dev/) 流程图示例
- 添加虚拟表格示例
- 添加甘特图示例
- 添加图形验证码示例
- 添加表单示例,可通过`JSON`格式配置生成(基础表单、弹框表单、抽屉表单、分步表单、搜索表单)
- 在左侧菜单右中侧再加一个折叠展开菜单的功能
### 🐞 Bug fixes
- 修复`windwos`下点击注册页面会出现滚动条问题
- 修复`windows`下页面切换,内容区会出现滚动条问题
- 修复`pure-table`带状态表格在深色整体风格下状态样式消失的问题
- 修复系统配置中开启灰色模式和深色整体风格,刷新页面整体风格异常
### 🍏 Perf
- 系统管理、系统监控的所有页面兼容移动端
# 5.1.0 (2024-03-02)
### ✔️ refactor
- 重构标签页`UI`,点击关闭按钮更方便
### 🎫 Feat
- 添加多选卡片示例
- 菜单支持`a`标签右键的所有浏览器行为(在新标签页中、新窗口中打开链接,拖拽到新标签页打开等)
- 菜单搜索新增搜索历史和收藏功能
### 🐞 Bug fixes
- 修复`windows`系统下登录页出现滚动条的问题
### 🍏 Perf
- 规范注册本地图标时的命名规则,使其更好地配合图标选择器
# 5.0.0 (2024-02-26)
全面`ESM`版本
### ✔️ refactor
- 升级`vite``v5`版本,规定`node`版本`>18.18.0``pnpm`版本`>=8.6.10`
- 使用 [vite-plugin-fake-server](https://www.npmjs.com/package/vite-plugin-fake-server) 替换 [vite-plugin-mock](https://www.npmjs.com/package/vite-plugin-mock),使用 [@faker-js/faker](https://www.npmjs.com/package/@faker-js/faker) 替换 [mockjs](https://www.npmjs.com/package/mockjs)
- 重命名`tailwind.config.js``tailwind.config.ts`并更新其文件为`esm`语法
- 更新`.prettierrc.js`文件为`esm`语法
- 更新`postcss.config.js`文件为`esm`语法
- 更新`commitlint.config.js`文件为`esm`语法
- 使用`eslint.config.js`替换`.eslintrc.js`并遵循`esm`语法
- 升级`stylelint``16`版本并遵循`esm`语法
- 所有`search`搜索图标统一替换为`@iconify-icons/ri/search-line`它比较常用将其放入全局离线图标中
- 移除`iframe`在暗模式下的滤镜效果
- 带来更美观精致的首页
- 更干净整洁的系统配置右侧弹出面板
- 重构关于页面,整体更紧致,关键信息更突出
### 🎫 Feat
- 添加系统管理-菜单管理
- 完善系统管理-用户管理
- 内嵌`iframe`页支持设置`keepAlive`,保持页面状态
- 优化导航,弹出的菜单超出内容区自适应且可滚动
- 添加文件上传示例
- 添加整体风格自适应操作系统浅色、深色、自动主题功能
- 添加页脚
- 支持多标签页打开已经登录的系统后无需再登录并添加内免登录功能(用户可选择免登录的天数)
- 带来高级感的终端命令行
- 添加音频可视化功能示例
- 添加视频帧截取-`WebAssembly`版,支持`MP4``MOV``AVI``WebM``MKV`等主流格式
- 添加阻止键盘`F12`、浏览器默认右键菜单、页面元素选中、图片默认可拖动方法
- 二次封装`localforage`支持设置过期时间,提供完整的类型提示
- 添加`AnimateCss`选择器组件`ReAnimateSelector`
- 添加`ReText`组件,支持自动省略显示`Tooltip`功能, 支持多行省略, 高可复用性
- 添加艺术画板功能,比如可以用来绘制一些设计思想架构图
- 新增组件-可选按钮示例
- 添加常用按钮示例
- 添加颜色选择器组件示例
- 添加日期选择器组件示例
- 添加日期时间选择器示例
- 添加时间选择(器)示例
- 添加统计组件示例
- 添加标签组件示例
- 添加折叠面板组件示例
- 添加进度条组件示例
- 升级`Swiper 11`
- 添加 [vite-plugin-router-warn](https://www.npmjs.com/package/vite-plugin-router-warn) 插件,根治非必要的`vue-router`动态路由警告`No match found for location with path`
### 🐞 Bug fixes
- 修复`query`路由传参模式下,点击标签页进行切换操作时会触发两次`router`跳转问题
- 修复卡片标签页模式下,通过`query`路由传参时,离开激活的标签后仍存在`card-active`属性,导致鼠标`hover`时字体颜色未改变
- 修复`src/layout/components/appMain.vue`文件中同名词读取解析错误
- 修复内嵌页面`frameView`在隐藏标签页后高度没有自适应
- 修复路由`meta.transition.name`配置无效的问题
- 修复点击`iframe`页面无法关闭右键标签页面板以及在`iframe`页面时右键标签页面板被遮挡的问题
- 修复在路由`query``params`模式下点击面包屑跳转页面少参问题
### 🍏 Perf
- 优化主题色
- 标签页可按滑动力度进行左右滑动
- 接口命名规则统一为`kebab-case`串式命名法
- `el-form``label`和全局的`label`样式保持一致
- `VITE_PUBLIC_PATH`默认还原为 `/``VITE_ROUTER_HISTORY``h5`模式更友好
- 优化`transformI18n`函数,国际化支持无限嵌套级别(当然平台还是推荐嵌套层级越少越好)
- 页面初始化时先加载`pinia`再加载`router`,兼容更多使用场景
- 优化请求白名单的判断逻辑
- 左侧菜单导航样式调整,优化有无`logo``pc`端和移动端不同的展示方式
- 升级代码规范风格相关库至最新
- 优化登录页`loading`判断
- 优化`IconSelect`图标选择器组件,提升用户体验
- 优化分段控制器组件,添加`v-model`支持
- 优化平台`logo`获取方式
- 升级`@pureadmin/theme`,带来了更友好的`esm`支持
- 优化`build/info.ts`文件中的一些函数,使其友好支持`esm`
- 优化`PureTableBar`组件的列设置弹出框,设置最大高度,超出可滚动
- 优化函数式弹框组件`ReDialog`保留关闭动画
- 对中文路径做测试,删除`sass-loader`依赖
- 打包后的代码改为默认原生支持 [ES2015](https://caniuse.com/es6) 的浏览器
- 删除会自动安装的`stylelint`插件依赖
- 增强`useRenderIcon`使用本地`svg`的方式
- 优化左侧菜单最左下角的展开、折叠按钮在亮白主题配色下的样式
- 优化所有`el-empty``description`内容。图标选择器内容为空时加上`el-empty`
- 左侧菜单折叠后的`tooltip`主题与整体菜单保持统一
- 更新`svgo`命令为`svgo -f . -r`(压缩当前目录下的所有`SVG`文件)
- 优化项目构建相关函数
- 增强`ReTypeit`组件,支持插槽以及所有`typeit`配置项
- 优化国际化相关处理逻辑,初始化时添加缓存以避免不必要的性能消耗
# 4.5.0 (2023-06-26) # 4.5.0 (2023-06-26)
### ✔️ refactor ### ✔️ refactor

View File

@ -10,6 +10,12 @@
`vue-pure-admin` is an open source, free and out-of-the-box middle and backend management system template. Completely adopts `ECMAScript` module (`ESM`) specifications to write and organize code, using the latest `Vue3`, `Vite`, `Element-Plus`, `TypeScript`, `Pinia`, `Tailwindcss` and other mainstream technologies develop `vue-pure-admin` is an open source, free and out-of-the-box middle and backend management system template. Completely adopts `ECMAScript` module (`ESM`) specifications to write and organize code, using the latest `Vue3`, `Vite`, `Element-Plus`, `TypeScript`, `Pinia`, `Tailwindcss` and other mainstream technologies develop
## Sponsors
<a class="logo" href="https://ai-tools.cn/resume/start" target="_blank" rel="sponsored noopener">
<img src="./public/sponsors/aitools.svg" alt="aitools">
</a>
## Thin version (offering non-internationalized and internationalized versions) ## Thin version (offering non-internationalized and internationalized versions)
The simplified version is based on the shelf extracted from [vue-pure-admin](https://github.com/pure-admin/vue-pure-admin), which contains main functions and is more suitable for actual project development. The packaged size is introduced globally [element-plus](https://element-plus.org) is still below `2.3MB`, and the full version of the code will be permanently synchronized. After enabling `brotli` compression and `cdn` to replace the local library mode, the package size is less than `350kb` The simplified version is based on the shelf extracted from [vue-pure-admin](https://github.com/pure-admin/vue-pure-admin), which contains main functions and is more suitable for actual project development. The packaged size is introduced globally [element-plus](https://element-plus.org) is still below `2.3MB`, and the full version of the code will be permanently synchronized. After enabling `brotli` compression and `cdn` to replace the local library mode, the package size is less than `350kb`
@ -17,15 +23,19 @@ The simplified version is based on the shelf extracted from [vue-pure-admin](htt
[Click to view the non-internationalized version](https://github.com/pure-admin/pure-admin-thin) [Click to view the non-internationalized version](https://github.com/pure-admin/pure-admin-thin)
[Click to view Internationalization version](https://github.com/pure-admin/pure-admin-thin/tree/i18n) [Click to view Internationalization version](https://github.com/pure-admin/pure-admin-thin/tree/i18n)
## Supporting Video ## Supporting video
[Click Watch Tutorial](https://www.bilibili.com/video/BV1kg411v7QT) [Click me to view UI design](https://www.bilibili.com/video/BV17g411T7rq)
[Click Watch UI Design](https://www.bilibili.com/video/BV17g411T7rq) [Click me to view the rapid development tutorial](https://www.bilibili.com/video/BV1kg411v7QT)
## Docs ## Nanny-level documents
[View vue-pure-admin documentation](https://yiming_chang.gitee.io/pure-admin-doc) [Click me to view vue-pure-admin documentation](https://yiming_chang.gitee.io/pure-admin-doc)
[View @pureadmin/utils documentation](https://pure-admin-utils.netlify.app) [Click me to view @pureadmin/utils documentation](https://pure-admin-utils.netlify.app)
## Quality service, software outsourcing, sponsorship support
[Click me for details](https://yiming_chang.gitee.io/pure-admin-doc/pages/service/)
## Tauri ## Tauri
@ -160,6 +170,21 @@ You are very welcome to join[Raise an issue](https://github.com/pure-admin/vu
4. Push your branch: `git push origin feat/xxxx` 4. Push your branch: `git push origin feat/xxxx`
5. submit`pull request` 5. submit`pull request`
## Special code contributions
Thank you very much for your in-depth understanding of the source code and your outstanding contributions to the `pure-admin` organization ❤️
| **Contributor** | **SpecificCode** |
| :---------------------------------------------: | :------------------------------------------------------------------------------: |
| [hb0730](https://github.com/hb0730) | [code](https://github.com/pure-admin/vue-pure-admin/commits?author=hb0730) |
| [o-cc](https://github.com/o-cc) | [code](https://github.com/pure-admin/vue-pure-admin/commits?author=o-cc) |
| [yj-liuzepeng](https://github.com/yj-liuzepeng) | [code](https://github.com/pure-admin/vue-pure-admin/commits?author=yj-liuzepeng) |
| [skyline523](https://github.com/skyline523) | [code](https://github.com/pure-admin/vue-pure-admin/commits?author=skyline523) |
| [shark-lajiao](https://github.com/shark-lajiao) | [code](https://github.com/pure-admin/vue-pure-admin/commits?author=shark-lajiao) |
| [WitMiao](https://github.com/WitMiao) | [code](https://github.com/pure-admin/vue-pure-admin/commits?author=WitMiao) |
| [QFifteen](https://github.com/QFifteen) | [code](https://github.com/pure-admin/vue-pure-admin/commits?author=QFifteen) |
| [edgexie](https://github.com/edgexie) | [code](https://github.com/pure-admin/vue-pure-admin/commits?author=edgexie) |
## Git Contribution submission specification ## 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)) 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))

View File

@ -8,7 +8,14 @@
## 简介 ## 简介
`vue-pure-admin` 是一款开源免费且开箱即用的中后台管理系统模版。完全采用 `ECMAScript` 模块(`ESM`)规范来编写和组织代码,使用了最新的 `Vue3``Vite``Element-Plus``TypeScript``Pinia``Tailwindcss` 等主流技术开发 `vue-pure-admin` 是一款开源免费且开箱即用的中后台管理系统模版。完全采用 `ECMAScript` 模块(`ESM`)规范来编写和组织代码,使用了最新的 `Vue3`
`Vite``Element-Plus``TypeScript``Pinia``Tailwindcss` 等主流技术开发
## 赞助商
<a class="logo" href="https://ai-tools.cn/resume/start" target="_blank" rel="sponsored noopener">
<img src="./public/sponsors/aitools.svg" alt="aitools">
</a>
## 精简版本(实际项目开发请用精简版本,提供 `非国际化``国际化` 两个版本选择) ## 精简版本(实际项目开发请用精简版本,提供 `非国际化``国际化` 两个版本选择)
@ -19,13 +26,17 @@
## 配套视频 ## 配套视频
[点我查看快速开发教程](https://www.bilibili.com/video/BV1kg411v7QT) [点我查看 UI 设计](https://www.bilibili.com/video/BV17g411T7rq)
[点我查看 UI 设计](https://www.bilibili.com/video/BV17g411T7rq) [点我查看快速开发教程](https://www.bilibili.com/video/BV1kg411v7QT)
## 配套保姆级文档 ## 配套保姆级文档
[查看 vue-pure-admin 文档](https://yiming_chang.gitee.io/pure-admin-doc) [点我查看 vue-pure-admin 文档](https://yiming_chang.gitee.io/pure-admin-doc)
[查看 @pureadmin/utils 文档](https://pure-admin-utils.netlify.app) [点我查看 @pureadmin/utils 文档](https://pure-admin-utils.netlify.app)
## 优质服务、软件外包、赞助支持
[点我查看详情](https://yiming_chang.gitee.io/pure-admin-doc/pages/service/)
## `Tauri` 版本 ## `Tauri` 版本
@ -37,7 +48,7 @@
## 预览 ## 预览
[查看预览](https://yiming_chang.gitee.io/vue-pure-admin) [点我查看预览](https://yiming_chang.gitee.io/vue-pure-admin)
`PC` `PC`
@ -160,6 +171,21 @@ docker run -dp 8080:80 --name pure-admin vue-pure-admin
4. 推送您的分支: `git push origin feat/xxxx` 4. 推送您的分支: `git push origin feat/xxxx`
5. 提交`pull request` 5. 提交`pull request`
## 特别代码贡献
非常感谢你们能深入了解源码并对 `pure-admin` 组织作出优秀贡献 ❤️
| **贡献人** | **具体代码** |
| :---------------------------------------------: | :------------------------------------------------------------------------------: |
| [hb0730](https://github.com/hb0730) | [代码](https://github.com/pure-admin/vue-pure-admin/commits?author=hb0730) |
| [o-cc](https://github.com/o-cc) | [代码](https://github.com/pure-admin/vue-pure-admin/commits?author=o-cc) |
| [yj-liuzepeng](https://github.com/yj-liuzepeng) | [代码](https://github.com/pure-admin/vue-pure-admin/commits?author=yj-liuzepeng) |
| [skyline523](https://github.com/skyline523) | [代码](https://github.com/pure-admin/vue-pure-admin/commits?author=skyline523) |
| [shark-lajiao](https://github.com/shark-lajiao) | [代码](https://github.com/pure-admin/vue-pure-admin/commits?author=shark-lajiao) |
| [WitMiao](https://github.com/WitMiao) | [代码](https://github.com/pure-admin/vue-pure-admin/commits?author=WitMiao) |
| [QFifteen](https://github.com/QFifteen) | [代码](https://github.com/pure-admin/vue-pure-admin/commits?author=QFifteen) |
| [edgexie](https://github.com/edgexie) | [代码](https://github.com/pure-admin/vue-pure-admin/commits?author=edgexie) |
## `Git` 贡献提交规范 ## `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)) 参考 [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))

View File

@ -7,7 +7,7 @@ import boxen, { type Options as BoxenOptions } from "boxen";
dayjs.extend(duration); dayjs.extend(duration);
const welcomeMessage = gradientString("cyan", "magenta").multiline( const welcomeMessage = gradientString("cyan", "magenta").multiline(
`Hello! 欢迎使用 vue-pure-admin\n我们为您精心准备了下面两个贴心的保姆级文档\nhttps://yiming_chang.gitee.io/pure-admin-doc\nhttps://pure-admin-utils.netlify.app` `您好! 欢迎使用 pure-admin 开源项目\n我们为您精心准备了下面两个贴心的保姆级文档\nhttps://yiming_chang.gitee.io/pure-admin-doc\nhttps://pure-admin-utils.netlify.app`
); );
const boxenOptions: BoxenOptions = { const boxenOptions: BoxenOptions = {

View File

@ -16,6 +16,7 @@ const include = [
"qrcode", "qrcode",
"intro.js", "intro.js",
"vue-i18n", "vue-i18n",
"vxe-table",
"vue-types", "vue-types",
"js-cookie", "js-cookie",
"vue-tippy", "vue-tippy",
@ -35,14 +36,18 @@ const include = [
"vue-json-pretty", "vue-json-pretty",
"@logicflow/core", "@logicflow/core",
"@pureadmin/utils", "@pureadmin/utils",
"@vue-office/docx",
"@vue-office/excel",
"@wangeditor/editor", "@wangeditor/editor",
"responsive-storage", "responsive-storage",
"plus-pro-components",
"@howdyjs/mouse-menu", "@howdyjs/mouse-menu",
"@logicflow/extension", "@logicflow/extension",
"vue-virtual-scroller", "vue-virtual-scroller",
"@amap/amap-jsapi-loader", "@amap/amap-jsapi-loader",
"el-table-infinite-scroll", "el-table-infinite-scroll",
"vue-waterfall-plugin-next", "vue-waterfall-plugin-next",
"@infectoone/vue-ganttastic",
"@wangeditor/editor-for-vue", "@wangeditor/editor-for-vue",
"vuedraggable/src/vuedraggable" "vuedraggable/src/vuedraggable"
]; ];

View File

@ -24,8 +24,7 @@ export function getPluginsList(
// jsx、tsx语法支持 // jsx、tsx语法支持
vueJsx(), vueJsx(),
VueI18nPlugin({ VueI18nPlugin({
runtimeOnly: true, jitCompilation: false,
compositionOnly: true,
include: [pathResolve("../locales/**")] include: [pathResolve("../locales/**")]
}), }),
viteBuildInfo(), viteBuildInfo(),

View File

@ -10,7 +10,14 @@ import pluginTypeScript from "@typescript-eslint/eslint-plugin";
export default defineFlatConfig([ export default defineFlatConfig([
{ {
...js.configs.recommended, ...js.configs.recommended,
ignores: ["src/assets/**", "src/**/iconfont/**"], ignores: [
"**/.*",
"dist/*",
"*.d.ts",
"public/*",
"src/assets/**",
"src/**/iconfont/**"
],
languageOptions: { languageOptions: {
globals: { globals: {
// index.d.ts // index.d.ts

View File

@ -1,169 +1,229 @@
buttons: buttons:
hsLoginOut: LoginOut pureAccountSettings: Account
hsfullscreen: FullScreen pureLoginOut: LoginOut
hsexitfullscreen: ExitFullscreen pureLogin: Login
hsrefreshRoute: RefreshRoute pureOpenSystemSet: Open System Configs
hslogin: Login pureReload: Reload
hsadd: Add pureCloseCurrentTab: Close CurrentTab
hsmark: Mark/Cancel pureCloseLeftTabs: Close LeftTabs
hssave: Save pureCloseRightTabs: Close RightTabs
hssearch: Search pureCloseOtherTabs: Close OtherTabs
hsexpendAll: Expand All pureCloseAllTabs: Close AllTabs
hscollapseAll: Collapse All pureContentFullScreen: Content FullScreen
hssystemSet: Open ProjectConfig pureContentExitFullScreen: Content ExitFullScreen
hsdelete: Delete pureClickCollapse: Collapse
hsreload: Reload pureClickExpand: Expand
hscloseCurrentTab: Close CurrentTab pureConfirm: Confirm
hscloseLeftTabs: Close LeftTabs pureSwitch: Switch
hscloseRightTabs: Close RightTabs pureClose: Close
hscloseOtherTabs: Close OtherTabs pureBackTop: BackTop
hscloseAllTabs: Close AllTabs pureOpenText: Open
hswholeFullScreen: FullScreen pureCloseText: Close
hswholeExitFullScreen: ExitFull search:
hscontentFullScreen: Content FullScreen pureTotal: Total
hscontentExitFullScreen: Content ExitFullScreen pureHistory: History
pureCollect: Collect
pureDragSort: Drag Sort
pureEmpty: Empty
purePlaceholder: Search Menu
panel:
pureSystemSet: System Configs
pureCloseSystemSet: Close System Configs
pureClearCacheAndToLogin: Clear cache and return to login page
pureClearCache: Clear Cache
pureOverallStyle: Overall Style
pureOverallStyleLight: Light
pureOverallStyleLightTip: Set sail freshly and light up the comfortable work interface
pureOverallStyleDark: Dark
pureOverallStyleDarkTip: Moonlight Overture, indulge in the tranquility and elegance of the night
pureOverallStyleSystem: Auto
pureOverallStyleSystemTip: Synchronize time, the interface naturally responds to morning and dusk
pureThemeColor: Theme Color
pureLayoutModel: Layout Model
pureVerticalTip: The menu on the left is familiar and friendly
pureHorizontalTip: Top menu, concise overview
pureMixTip: Mixed menu, flexible
pureStretch: Stretch Page
pureStretchFixed: Fixed
pureStretchFixedTip: Compact pages make it easy to find the information you need
pureStretchCustom: Custom
pureStretchCustomTip: Minimum 1280, maximum 1600
pureTagsStyle: Tags Style
pureTagsStyleSmart: Smart
pureTagsStyleSmartTip: Smart tags add fun and brilliance
pureTagsStyleCard: Card
pureTagsStyleCardTip: Card tags for efficient browsing
pureInterfaceDisplay: Interface Display
pureGreyModel: Grey Model
pureWeakModel: Weak Model
pureHiddenTags: Hidden Tags
pureHiddenFooter: Hidden Footer
pureMultiTagsCache: MultiTags Cache
menus: menus:
hshome: Home pureHome: Home
hslogin: Login pureLogin: Login
hsempty: Empty Page pureEmpty: Empty Page
hssysManagement: System Manage pureTable: Table
hsUser: User Manage pureSysManagement: System Manage
hsRole: Role Manage pureUser: User Manage
hsDept: Dept Manage pureRole: Role Manage
hseditor: Editor pureSystemMenu: Menu Manage
hsabnormal: Abnormal Page pureDept: Dept Manage
hsfourZeroFour: "404" pureSysMonitor: System Monitor
hsfourZeroOne: "403" pureOnlineUser: Online User
hsFive: "500" pureLoginLog: Login Log
hscomponents: Components pureOperationLog: Operation Log
hsdialog: Dialog pureSystemLog: System Log
hsmessage: Message Tips pureEditor: Editor
hsvideo: Video pureAbnormal: Abnormal Page
hssegmented: Segmented pureFourZeroFour: "404"
hswaterfall: Waterfall pureFourZeroOne: "403"
hsmap: Map pureFive: "500"
hsdraggable: Draggable pureComponents: Components
hssplitPane: Split Pane pureDialog: Dialog
hsElButton: Button pureMessage: Message Tips
hsbutton: Button Animation pureVideo: Video
hsCheckButton: Check Button pureSegmented: Segmented
hscropping: Picture Cropping pureWaterfall: Waterfall
hsanimatecss: AnimateCss Selector pureMap: Map
hscountTo: Digital Animation pureDraggable: Draggable
hsselector: Scope Selector pureSplitPane: Split Pane
hsflowChart: Flow Chart pureText: Text Ellipsis
hsseamless: Seamless Scroll pureElButton: Button
hscontextmenu: Context Menu pureButton: Button Animation
hstypeit: Typeit pureCheckButton: Check Button
hsjsoneditor: JSON Editor pureCropping: Picture Cropping
hsColorPicker: Color Picker pureAnimatecss: AnimateCss Selector
hsDatePicker: Date Picker pureCountTo: Digital Animation
hsDateTimePicker: DateTimePicker pureSelector: Scope Selector
hsTimePicker: TimePicker pureFlowChart: Flow Chart
hsTag: Tag pureSeamless: Seamless Scroll
hsStatistic: Statistic pureContextmenu: Context Menu
hsCollapse: Collapse pureTypeit: Typeit
hsProgress: Progress pureJsonEditor: JSON Editor
hsUpload: File Upload pureColorPicker: Color Picker
hsmenus: MultiLevel Menu pureDatePicker: Date Picker
hsmenu1: Menu1 pureDateTimePicker: DateTimePicker
hsmenu1-1: Menu1-1 pureTimePicker: TimePicker
hsmenu1-2: Menu1-2 pureTag: Tag
hsmenu1-2-1: Menu1-2-1 pureStatistic: Statistic
hsmenu1-2-2: Menu1-2-2 pureCollapse: Collapse
hsmenu1-3: Menu1-3 pureGanttastic: Gantt Chart
hsmenu2: Menu2 pureProgress: Progress
permission: Permission Manage pureUpload: File Upload
permissionPage: Page Permission pureCheckCard: CheckCard
permissionButton: Button Permission pureMenus: MultiLevel Menu
hstabs: Tabs Operate pureMenu1: Menu1
hsguide: Guide pureMenu1-1: Menu1-1
hsAble: Able pureMenu1-2: Menu1-2
hsMenuTree: Menu Tree pureMenu1-2-1: Menu1-2-1
hsVideoFrame: Video Frame Capture pureMenu1-2-2: Menu1-2-2
hsWavesurfer: Audio Visualization pureMenu1-3: Menu1-3
hsOptimize: Debounce、Throttle、Copy、Longpress Directives pureMenu2: Menu2
hsWatermark: Water Mark purePermission: Permission Manage
hsPrint: Print purePermissionPage: Page Permission
hsDownload: Download purePermissionButton: Button Permission
hsExternalPage: External Page pureTabs: Tabs Operate
hsExternalDoc: Docs External pureGuide: Guide
hsEmbeddedDoc: Docs Embedded pureAble: Able
externalLink: Vue-Pure-Admin pureMenuTree: Menu Tree
pureutilsLink: Pure-Admin-Utils pureVideoFrame: Video Frame Capture
hsEpDocument: Element-Plus pureWavesurfer: Audio Visualization
hsTailwindcssDocument: Tailwindcss pureRipple: Ripple
hsVueDocument: Vue3 pureMqtt: Mqtt Client
hsViteDocument: Vite pureOptimize: Debounce、Throttle、Copy、Longpress Directives
hsPiniaDocument: Pinia pureVerify: Captcha
hsRouterDocument: Vue-Router pureWatermark: Water Mark
hsAbout: About purePrint: Print
hsResult: Result Page pureDownload: Download
hsSuccess: Success Page pureExternalPage: External Page
hsFail: Fail Page pureExternalDoc: Docs External
hsIconSelect: Icon Select pureEmbeddedDoc: Docs Embedded
hsTimeline: Time Line pureExternalLink: Vue-Pure-Admin
hsLineTree: LineTree pureUtilsLink: Pure-Admin-Utils
hsList: List Page pureColorHuntDoc: ColorHunt
hsListCard: Card List Page pureUiGradients: UiGradients
hsDebounce: Debounce & Throttle pureEpDoc: Element-Plus
hsFormDesign: Form Design pureTailwindcssDoc: Tailwindcss
hsBarcode: Barcode pureVueDoc: Vue3
hsQrcode: Qrcode pureViteDoc: Vite
hsCascader: Area Cascader purePiniaDoc: Pinia
hsSwiper: Swiper Plugin pureRouterDoc: Vue-Router
hsVirtualList: Virtual List pureAbout: About
hsPdf: PDF Preview pureResult: Result Page
hsExcel: Export Excel pureSuccess: Success Page
hsInfiniteScroll: Table Infinite Scroll pureFail: Fail Page
hsSensitive: Sensitive Filter pureIconSelect: Icon Select
hsPinyin: PinYin pureTimeline: Time Line
hsdanmaku: Danmaku pureLineTree: LineTree
hsPureTableBase: Base Usage pureList: List Page
hsPureTableHigh: High Usage pureListCard: Card List Page
hsboard: Paint Board pureDebounce: Debounce & Throttle
hsMenuoverflow: Menu Overflow Show Tooltip Text pureFormDesign: Form Design
hsChildMenuoverflow: Child Menu Overflow Show Tooltip Text pureBarcode: Barcode
pureQrcode: Qrcode
pureCascader: Area Cascader
pureSwiper: Swiper Plugin
pureVirtualList: Virtual List
purePdf: PDF Preview
pureWord: Word Preview
pureExcels: Excel Preview
pureExcel: Export Excel
pureInfiniteScroll: Table Infinite Scroll
pureSensitive: Sensitive Filter
purePinyin: PinYin
pureDanmaku: Danmaku
pureSchemaForm: Form
pureTableBase: Base Usage
pureTableHigh: High Usage
pureTableEdit: Edit Usage
pureVxeTable: Virtual Usage
pureBoard: Paint Board
pureMindMap: Mind Map
pureMenuOverflow: Menu Overflow Show Tooltip Text
pureChildMenuOverflow: Child Menu Overflow Show Tooltip Text
status: status:
hsLoad: Loading... pureLoad: Loading...
pureNoMessage: No Message
login: login:
username: Username pureUsername: Username
password: Password purePassword: Password
verifyCode: VerifyCode pureVerifyCode: VerifyCode
remember: days no need to login pureRemember: days no need to login
rememberInfo: After checking and logging in, will automatically log in to the system without entering your username and password within the specified number of days. pureRememberInfo: After checking and logging in, will automatically log in to the system without entering your username and password within the specified number of days.
sure: Sure Password pureSure: Sure Password
forget: Forget Password? pureForget: Forget Password?
login: Login pureLogin: Login
thirdLogin: Third Login pureThirdLogin: Third Login
phoneLogin: Phone Login purePhoneLogin: Phone Login
qRCodeLogin: QRCode Login pureQRCodeLogin: QRCode Login
register: Register pureRegister: Register
weChatLogin: WeChat Login pureWeChatLogin: WeChat Login
alipayLogin: Alipay Login pureAlipayLogin: Alipay Login
qqLogin: QQ Login pureQQLogin: QQ Login
weiboLogin: Weibo Login pureWeiBoLogin: Weibo Login
phone: Phone purePhone: Phone
smsVerifyCode: SMS VerifyCode pureSmsVerifyCode: SMS VerifyCode
back: Back pureBack: Back
test: Mock Test pureTest: Mock Test
tip: After scanning the code, click "Confirm" to complete the login pureTip: After scanning the code, click "Confirm" to complete the login
definite: Definite pureDefinite: Definite
loginSuccess: Login Success pureLoginSuccess: Login Success
registerSuccess: Regist Success pureLoginFail: Login Fail
tickPrivacy: Please tick Privacy Policy pureRegisterSuccess: Regist Success
readAccept: I have read it carefully and accept pureTickPrivacy: Please tick Privacy Policy
privacyPolicy: Privacy Policy pureReadAccept: I have read it carefully and accept
getVerifyCode: Get VerifyCode purePrivacyPolicy: Privacy Policy
info: Seconds pureGetVerifyCode: Get VerifyCode
usernameReg: Please enter username pureInfo: Seconds
passwordReg: Please enter password pureUsernameReg: Please enter username
verifyCodeReg: Please enter verify code purePassWordReg: Please enter password
verifyCodeCorrectReg: Please enter correct verify code pureVerifyCodeReg: Please enter verify code
verifyCodeSixReg: Please enter a 6-digit verify code pureVerifyCodeCorrectReg: Please enter correct verify code
phoneReg: Please enter the phone pureVerifyCodeSixReg: Please enter a 6-digit verify code
phoneCorrectReg: Please enter the correct phone number format purePhoneReg: Please enter the phone
passwordRuleReg: The password format should be any combination of 8-18 digits purePhoneCorrectReg: Please enter the correct phone number format
passwordSureReg: Please enter confirm password purePassWordRuleReg: The password format should be any combination of 8-18 digits
passwordDifferentReg: The two passwords do not match! purePassWordSureReg: Please enter confirm password
passwordUpdateReg: Password has been updated purePassWordDifferentReg: The two passwords do not match!
purePassWordUpdateReg: Password has been updated

View File

@ -1,169 +1,229 @@
buttons: buttons:
hsLoginOut: 退出系统 pureAccountSettings: 账户设置
hsfullscreen: 全屏 pureLoginOut: 退出系统
hsexitfullscreen: 退出全屏 pureLogin: 登录
hsrefreshRoute: 刷新路由 pureOpenSystemSet: 打开系统配置
hslogin: 登录 pureReload: 重新加载
hsadd: 新增 pureCloseCurrentTab: 关闭当前标签页
hsmark: 标记/取消 pureCloseLeftTabs: 关闭左侧标签页
hssave: 保存 pureCloseRightTabs: 关闭右侧标签页
hssearch: 搜索 pureCloseOtherTabs: 关闭其他标签页
hsexpendAll: 全部展开 pureCloseAllTabs: 关闭全部标签页
hscollapseAll: 全部折叠 pureContentFullScreen: 内容区全屏
hssystemSet: 打开项目配置 pureContentExitFullScreen: 内容区退出全屏
hsdelete: 删除 pureClickCollapse: 点击折叠
hsreload: 重新加载 pureClickExpand: 点击展开
hscloseCurrentTab: 关闭当前标签页 pureConfirm: 确认
hscloseLeftTabs: 关闭左侧标签页 pureSwitch: 切换
hscloseRightTabs: 关闭右侧标签页 pureClose: 关闭
hscloseOtherTabs: 关闭其他标签页 pureBackTop: 回到顶部
hscloseAllTabs: 关闭全部标签页 pureOpenText:
hswholeFullScreen: 全屏 pureCloseText:
hswholeExitFullScreen: 退出全屏 search:
hscontentFullScreen: 内容区全屏 pureTotal:
hscontentExitFullScreen: 内容区退出全屏 pureHistory: 搜索历史
pureCollect: 收藏
pureDragSort: (可拖拽排序)
pureEmpty: 暂无搜索结果
purePlaceholder: 搜索菜单(支持拼音搜索)
panel:
pureSystemSet: 系统配置
pureCloseSystemSet: 关闭配置
pureClearCacheAndToLogin: 清空缓存并返回登录页
pureClearCache: 清空缓存
pureOverallStyle: 整体风格
pureOverallStyleLight: 浅色
pureOverallStyleLightTip: 清新启航,点亮舒适的工作界面
pureOverallStyleDark: 深色
pureOverallStyleDarkTip: 月光序曲,沉醉于夜的静谧雅致
pureOverallStyleSystem: 自动
pureOverallStyleSystemTip: 同步时光,界面随晨昏自然呼应
pureThemeColor: 主题色
pureLayoutModel: 导航模式
pureVerticalTip: 左侧菜单,亲切熟悉
pureHorizontalTip: 顶部菜单,简洁概览
pureMixTip: 混合菜单,灵活多变
pureStretch: 页宽
pureStretchFixed: 固定
pureStretchFixedTip: 紧凑页面,轻松找到所需信息
pureStretchCustom: 自定义
pureStretchCustomTip: 最小1280、最大1600
pureTagsStyle: 页签风格
pureTagsStyleSmart: 灵动
pureTagsStyleSmartTip: 灵动标签,添趣生辉
pureTagsStyleCard: 卡片
pureTagsStyleCardTip: 卡片标签,高效浏览
pureInterfaceDisplay: 界面显示
pureGreyModel: 灰色模式
pureWeakModel: 色弱模式
pureHiddenTags: 隐藏标签页
pureHiddenFooter: 隐藏页脚
pureMultiTagsCache: 页签持久化
menus: menus:
hshome: 首页 pureHome: 首页
hslogin: 登录 pureLogin: 登录
hsempty: 无Layout页 pureEmpty: 无Layout页
hssysManagement: 系统管理 pureTable: 表格
hsUser: 用户管理 pureSysManagement: 系统管理
hsRole: 角色管理 pureUser: 用户管理
hsDept: 部门管理 pureRole: 角色管理
hseditor: 编辑器 pureSystemMenu: 菜单管理
hsabnormal: 异常页面 pureDept: 部门管理
hsfourZeroFour: "404" pureSysMonitor: 系统监控
hsfourZeroOne: "403" pureOnlineUser: 在线用户
hsFive: "500" pureLoginLog: 登录日志
hscomponents: 组件 pureOperationLog: 操作日志
hsdialog: 函数式弹框 pureSystemLog: 系统日志
hsmessage: 消息提示 pureEditor: 编辑器
hsvideo: 视频 pureAbnormal: 异常页面
hssegmented: 分段控制器 pureFourZeroFour: "404"
hswaterfall: 瀑布流无限滚动 pureFourZeroOne: "403"
hsmap: 地图 pureFive: "500"
hsdraggable: 拖拽 pureComponents: 组件
hssplitPane: 切割面板 pureDialog: 函数式弹框
hsElButton: 按钮 pureMessage: 消息提示
hsCheckButton: 可选按钮 pureVideo: 视频
hsbutton: 按钮动效 pureSegmented: 分段控制器
hscropping: 图片裁剪 pureWaterfall: 瀑布流无限滚动
hsanimatecss: animate.css选择器 pureMap: 地图
hscountTo: 数字动画 pureDraggable: 拖拽
hsselector: 范围选择器 pureSplitPane: 切割面板
hsflowChart: 流程图 pureText: 文本省略
hsseamless: 无缝滚动 pureElButton: 按钮
hscontextmenu: 右键菜单 pureCheckButton: 可选按钮
hstypeit: 打字机 pureButton: 按钮动效
hsjsoneditor: JSON编辑器 pureCropping: 图片裁剪
hsColorPicker: 颜色选择器 pureAnimatecss: animate.css选择器
hsDatePicker: 日期选择器 pureCountTo: 数字动画
hsDateTimePicker: 日期时间选择器 pureSelector: 范围选择器
hsTimePicker: 时间选择器 pureFlowChart: 流程图
hsTag: 标签 pureSeamless: 无缝滚动
hsStatistic: 统计组件 pureContextmenu: 右键菜单
hsCollapse: 折叠面板 pureTypeit: 打字机
hsProgress: 进度条 pureJsonEditor: JSON编辑器
hsUpload: 文件上传 pureColorPicker: 颜色选择器
hsmenus: 多级菜单 pureDatePicker: 日期选择器
hsmenu1: 菜单1 pureDateTimePicker: 日期时间选择器
hsmenu1-1: 菜单1-1 pureTimePicker: 时间选择器
hsmenu1-2: 菜单1-2 pureTag: 标签
hsmenu1-2-1: 菜单1-2-1 pureStatistic: 统计组件
hsmenu1-2-2: 菜单1-2-2 pureCollapse: 折叠面板
hsmenu1-3: 菜单1-3 pureGanttastic: 甘特图
hsmenu2: 菜单2 pureProgress: 进度条
permission: 权限管理 pureUpload: 文件上传
permissionPage: 页面权限 pureCheckCard: 多选卡片
permissionButton: 按钮权限 pureMenus: 多级菜单
hstabs: 标签页操作 pureMenu1: 菜单1
hsguide: 引导页 pureMenu1-1: 菜单1-1
hsAble: 功能 pureMenu1-2: 菜单1-2
hsMenuTree: 菜单树结构 pureMenu1-2-1: 菜单1-2-1
hsVideoFrame: 视频帧截取-wasm版 pureMenu1-2-2: 菜单1-2-2
hsWavesurfer: 音频可视化 pureMenu1-3: 菜单1-3
hsOptimize: 防抖、截流、复制、长按指令 pureMenu2: 菜单2
hsWatermark: 水印 purePermission: 权限管理
hsPrint: 打印 purePermissionPage: 页面权限
hsDownload: 下载 purePermissionButton: 按钮权限
hsExternalPage: 外部页面 pureTabs: 标签页操作
hsExternalDoc: 文档外链 pureGuide: 引导页
hsEmbeddedDoc: 文档内嵌 pureAble: 功能
externalLink: vue-pure-admin pureMenuTree: 菜单树结构
pureutilsLink: pure-admin-utils pureVideoFrame: 视频帧截取-wasm版
hsEpDocument: element-plus pureWavesurfer: 音频可视化
hsTailwindcssDocument: tailwindcss pureRipple: 波纹(Ripple)
hsVueDocument: vue3 pureMqtt: MQTT客户端(mqtt)
hsViteDocument: vite pureOptimize: 防抖、截流、复制、长按指令
hsPiniaDocument: pinia pureVerify: 图形验证码
hsRouterDocument: vue-router pureWatermark: 水印
hsAbout: 关于 purePrint: 打印
hsResult: 结果页面 pureDownload: 下载
hsSuccess: 成功页面 pureExternalPage: 外部页面
hsFail: 失败页面 pureExternalDoc: 文档外链
hsIconSelect: 图标选择器 pureEmbeddedDoc: 文档内嵌
hsTimeline: 时间线 pureExternalLink: vue-pure-admin
hsLineTree: 树形连接线 pureUtilsLink: pure-admin-utils
hsList: 列表页 pureColorHuntDoc: 调色板
hsListCard: 卡片列表页 pureUiGradients: 渐变色
hsDebounce: 防抖节流 pureEpDoc: element-plus
hsFormDesign: 表单设计器 pureTailwindcssDoc: tailwindcss
hsBarcode: 条形码 pureVueDoc: vue3
hsQrcode: 二维码 pureViteDoc: vite
hsCascader: 区域级联选择器 purePiniaDoc: pinia
hsSwiper: Swiper插件 pureRouterDoc: vue-router
hsVirtualList: 虚拟列表 pureAbout: 关于
hsPdf: PDF预览 pureResult: 结果页面
hsExcel: 导出Excel pureSuccess: 成功页面
hsInfiniteScroll: 表格无限滚动 pureFail: 失败页面
hsSensitive: 敏感词过滤 pureIconSelect: 图标选择器
hsPinyin: 汉语拼音 pureTimeline: 时间线
hsdanmaku: 弹幕 pureLineTree: 树形连接线
hsPureTableBase: 基础用法23个示例 pureList: 列表页面
hsPureTableHigh: 高级用法11个示例 pureListCard: 卡片列表页
hsboard: 艺术画板 pureDebounce: 防抖节流
hsMenuoverflow: 目录超出显示 Tooltip 文字提示 pureFormDesign: 表单设计器
hsChildMenuoverflow: 菜单超出显示 Tooltip 文字提示 pureBarcode: 条形码
pureQrcode: 二维码
pureCascader: 区域级联选择器
pureSwiper: Swiper插件
pureVirtualList: 虚拟列表
purePdf: PDF预览
pureWord: Word预览
pureExcels: Excel预览
pureExcel: 导出Excel
pureInfiniteScroll: 表格无限滚动
pureSensitive: 敏感词过滤
purePinyin: 汉语拼音
pureDanmaku: 弹幕
pureSchemaForm: 表单
pureTableBase: 基础用法
pureTableHigh: 高级用法
pureTableEdit: 可编辑用法
pureVxeTable: 虚拟滚动
pureBoard: 艺术画板
pureMindMap: 思维导图
pureMenuOverflow: 目录超出显示 Tooltip 文字提示
pureChildMenuOverflow: 菜单超出显示 Tooltip 文字提示
status: status:
hsLoad: 加载中... pureLoad: 加载中...
pureNoMessage: 暂无消息
login: login:
username: 账号 pureUsername: 账号
password: 密码 purePassword: 密码
verifyCode: 验证码 pureVerifyCode: 验证码
remember: 天内免登录 pureRemember: 天内免登录
rememberInfo: 勾选并登录后,规定天数内无需输入用户名和密码会自动登入系统 pureRememberInfo: 勾选并登录后,规定天数内无需输入用户名和密码会自动登入系统
sure: 确认密码 pureSure: 确认密码
forget: 忘记密码? pureForget: 忘记密码?
login: 登录 pureLogin: 登录
thirdLogin: 第三方登录 pureThirdLogin: 第三方登录
phoneLogin: 手机登录 purePhoneLogin: 手机登录
qRCodeLogin: 二维码登录 pureQRCodeLogin: 二维码登录
register: 注册 pureRegister: 注册
weChatLogin: 微信登录 pureWeChatLogin: 微信登录
alipayLogin: 支付宝登录 pureAlipayLogin: 支付宝登录
qqLogin: QQ登录 pureQQLogin: QQ登录
weiboLogin: 微博登录 pureWeiBoLogin: 微博登录
phone: 手机号码 purePhone: 手机号码
smsVerifyCode: 短信验证码 pureSmsVerifyCode: 短信验证码
back: 返回 pureBack: 返回
test: 模拟测试 pureTest: 模拟测试
tip: 扫码后点击"确认",即可完成登录 pureTip: 扫码后点击"确认",即可完成登录
definite: 确定 pureDefinite: 确定
loginSuccess: 登录成功 pureLoginSuccess: 登录成功
registerSuccess: 注册成功 pureLoginFail: 登录失败
tickPrivacy: 请勾选隐私政策 pureRegisterSuccess: 注册成功
readAccept: 我已仔细阅读并接受 pureTickPrivacy: 请勾选隐私政策
privacyPolicy: 《隐私政策》 pureReadAccept: 我已仔细阅读并接受
getVerifyCode: 获取验证码 purePrivacyPolicy: 《隐私政策》
info: 秒后重新获取 pureGetVerifyCode: 获取验证码
usernameReg: 请输入账号 pureInfo: 秒后重新获取
passwordReg: 请输入密码 pureUsernameReg: 请输入账号
verifyCodeReg: 请输入验证码 purePassWordReg: 请输入密码
verifyCodeCorrectReg: 请输入正确的验证码 pureVerifyCodeReg: 请输入验证码
verifyCodeSixReg: 请输入6位数字验证码 pureVerifyCodeCorrectReg: 请输入正确的验证码
phoneReg: 请输入手机号码 pureVerifyCodeSixReg: 请输入6位数字验证码
phoneCorrectReg: 请输入正确的手机号码格式 purePhoneReg: 请输入手机号码
passwordRuleReg: 密码格式应为8-18位数字、字母、符号的任意两种组合 purePhoneCorrectReg: 请输入正确的手机号码格式
passwordSureReg: 请输入确认密码 purePassWordRuleReg: 密码格式应为8-18位数字、字母、符号的任意两种组合
passwordDifferentReg: 两次密码不一致! purePassWordSureReg: 请输入确认密码
passwordUpdateReg: 修改密码成功 purePassWordDifferentReg: 两次密码不一致!
purePassWordUpdateReg: 修改密码成功

View File

@ -1,6 +1,6 @@
// 模拟后端动态生成路由 // 模拟后端动态生成路由
import { defineFakeRoute } from "vite-plugin-fake-server/client"; import { defineFakeRoute } from "vite-plugin-fake-server/client";
import { system, permission, frame, tabs } from "@/router/enums"; import { system, monitor, permission, frame, tabs } from "@/router/enums";
/** /**
* roles "admin""common" * roles "admin""common"
@ -8,11 +8,11 @@ import { system, permission, frame, tabs } from "@/router/enums";
* common * common
*/ */
const systemRouter = { const systemManagementRouter = {
path: "/system", path: "/system",
meta: { meta: {
icon: "setting", icon: "ri:settings-3-line",
title: "menus.hssysManagement", title: "menus.pureSysManagement",
rank: system rank: system
}, },
children: [ children: [
@ -20,8 +20,8 @@ const systemRouter = {
path: "/system/user/index", path: "/system/user/index",
name: "SystemUser", name: "SystemUser",
meta: { meta: {
icon: "flUser", icon: "ri:admin-line",
title: "menus.hsUser", title: "menus.pureUser",
roles: ["admin"] roles: ["admin"]
} }
}, },
@ -29,8 +29,17 @@ const systemRouter = {
path: "/system/role/index", path: "/system/role/index",
name: "SystemRole", name: "SystemRole",
meta: { meta: {
icon: "role", icon: "ri:admin-fill",
title: "menus.hsRole", title: "menus.pureRole",
roles: ["admin"]
}
},
{
path: "/system/menu/index",
name: "SystemMenu",
meta: {
icon: "ep:menu",
title: "menus.pureSystemMenu",
roles: ["admin"] roles: ["admin"]
} }
}, },
@ -38,8 +47,59 @@ const systemRouter = {
path: "/system/dept/index", path: "/system/dept/index",
name: "SystemDept", name: "SystemDept",
meta: { meta: {
icon: "dept", icon: "ri:git-branch-line",
title: "menus.hsDept", title: "menus.pureDept",
roles: ["admin"]
}
}
]
};
const systemMonitorRouter = {
path: "/monitor",
meta: {
icon: "ep:monitor",
title: "menus.pureSysMonitor",
rank: monitor
},
children: [
{
path: "/monitor/online-user",
component: "monitor/online/index",
name: "OnlineUser",
meta: {
icon: "ri:user-voice-line",
title: "menus.pureOnlineUser",
roles: ["admin"]
}
},
{
path: "/monitor/login-logs",
component: "monitor/logs/login/index",
name: "LoginLog",
meta: {
icon: "ri:window-line",
title: "menus.pureLoginLog",
roles: ["admin"]
}
},
{
path: "/monitor/operation-logs",
component: "monitor/logs/operation/index",
name: "OperationLog",
meta: {
icon: "ri:history-fill",
title: "menus.pureOperationLog",
roles: ["admin"]
}
},
{
path: "/monitor/system-logs",
component: "monitor/logs/system/index",
name: "SystemLog",
meta: {
icon: "ri:file-search-line",
title: "menus.pureSystemLog",
roles: ["admin"] roles: ["admin"]
} }
} }
@ -49,8 +109,8 @@ const systemRouter = {
const permissionRouter = { const permissionRouter = {
path: "/permission", path: "/permission",
meta: { meta: {
title: "menus.permission", title: "menus.purePermission",
icon: "lollipop", icon: "ep:lollipop",
rank: permission rank: permission
}, },
children: [ children: [
@ -58,7 +118,7 @@ const permissionRouter = {
path: "/permission/page/index", path: "/permission/page/index",
name: "PermissionPage", name: "PermissionPage",
meta: { meta: {
title: "menus.permissionPage", title: "menus.purePermissionPage",
roles: ["admin", "common"] roles: ["admin", "common"]
} }
}, },
@ -66,9 +126,13 @@ const permissionRouter = {
path: "/permission/button/index", path: "/permission/button/index",
name: "PermissionButton", name: "PermissionButton",
meta: { meta: {
title: "menus.permissionButton", title: "menus.purePermissionButton",
roles: ["admin", "common"], roles: ["admin", "common"],
auths: ["btn_add", "btn_edit", "btn_delete"] auths: [
"permission:btn:add",
"permission:btn:edit",
"permission:btn:delete"
]
} }
} }
] ]
@ -77,30 +141,30 @@ const permissionRouter = {
const frameRouter = { const frameRouter = {
path: "/iframe", path: "/iframe",
meta: { meta: {
icon: "monitor", icon: "ri:links-fill",
title: "menus.hsExternalPage", title: "menus.pureExternalPage",
rank: frame rank: frame
}, },
children: [ children: [
{ {
path: "/iframe/external", path: "/iframe/external",
meta: { meta: {
title: "menus.hsExternalDoc" title: "menus.pureExternalDoc"
}, },
children: [ children: [
{ {
path: "/external", path: "/external",
name: "https://yiming_chang.gitee.io/pure-admin-doc", name: "https://yiming_chang.gitee.io/pure-admin-doc",
meta: { meta: {
title: "menus.externalLink", title: "menus.pureExternalLink",
roles: ["admin", "common"] roles: ["admin", "common"]
} }
}, },
{ {
path: "/pureutilsLink", path: "/pureUtilsLink",
name: "https://pure-admin-utils.netlify.app/", name: "https://pure-admin-utils.netlify.app/",
meta: { meta: {
title: "menus.pureutilsLink", title: "menus.pureUtilsLink",
roles: ["admin", "common"] roles: ["admin", "common"]
} }
} }
@ -109,14 +173,34 @@ const frameRouter = {
{ {
path: "/iframe/embedded", path: "/iframe/embedded",
meta: { meta: {
title: "menus.hsEmbeddedDoc" title: "menus.pureEmbeddedDoc"
}, },
children: [ children: [
{
path: "/iframe/colorhunt",
name: "FrameColorHunt",
meta: {
title: "menus.pureColorHuntDoc",
frameSrc: "https://colorhunt.co/",
keepAlive: true,
roles: ["admin", "common"]
}
},
{
path: "/iframe/uigradients",
name: "FrameUiGradients",
meta: {
title: "menus.pureUiGradients",
frameSrc: "https://uigradients.com/",
keepAlive: true,
roles: ["admin", "common"]
}
},
{ {
path: "/iframe/ep", path: "/iframe/ep",
name: "FrameEp", name: "FrameEp",
meta: { meta: {
title: "menus.hsEpDocument", title: "menus.pureEpDoc",
frameSrc: "https://element-plus.org/zh-CN/", frameSrc: "https://element-plus.org/zh-CN/",
keepAlive: true, keepAlive: true,
roles: ["admin", "common"] roles: ["admin", "common"]
@ -126,7 +210,7 @@ const frameRouter = {
path: "/iframe/tailwindcss", path: "/iframe/tailwindcss",
name: "FrameTailwindcss", name: "FrameTailwindcss",
meta: { meta: {
title: "menus.hsTailwindcssDocument", title: "menus.pureTailwindcssDoc",
frameSrc: "https://tailwindcss.com/docs/installation", frameSrc: "https://tailwindcss.com/docs/installation",
keepAlive: true, keepAlive: true,
roles: ["admin", "common"] roles: ["admin", "common"]
@ -136,7 +220,7 @@ const frameRouter = {
path: "/iframe/vue3", path: "/iframe/vue3",
name: "FrameVue", name: "FrameVue",
meta: { meta: {
title: "menus.hsVueDocument", title: "menus.pureVueDoc",
frameSrc: "https://cn.vuejs.org/", frameSrc: "https://cn.vuejs.org/",
keepAlive: true, keepAlive: true,
roles: ["admin", "common"] roles: ["admin", "common"]
@ -146,7 +230,7 @@ const frameRouter = {
path: "/iframe/vite", path: "/iframe/vite",
name: "FrameVite", name: "FrameVite",
meta: { meta: {
title: "menus.hsViteDocument", title: "menus.pureViteDoc",
frameSrc: "https://cn.vitejs.dev/", frameSrc: "https://cn.vitejs.dev/",
keepAlive: true, keepAlive: true,
roles: ["admin", "common"] roles: ["admin", "common"]
@ -156,7 +240,7 @@ const frameRouter = {
path: "/iframe/pinia", path: "/iframe/pinia",
name: "FramePinia", name: "FramePinia",
meta: { meta: {
title: "menus.hsPiniaDocument", title: "menus.purePiniaDoc",
frameSrc: "https://pinia.vuejs.org/zh/index.html", frameSrc: "https://pinia.vuejs.org/zh/index.html",
keepAlive: true, keepAlive: true,
roles: ["admin", "common"] roles: ["admin", "common"]
@ -166,7 +250,7 @@ const frameRouter = {
path: "/iframe/vue-router", path: "/iframe/vue-router",
name: "FrameRouter", name: "FrameRouter",
meta: { meta: {
title: "menus.hsRouterDocument", title: "menus.pureRouterDoc",
frameSrc: "https://router.vuejs.org/zh/", frameSrc: "https://router.vuejs.org/zh/",
keepAlive: true, keepAlive: true,
roles: ["admin", "common"] roles: ["admin", "common"]
@ -180,8 +264,8 @@ const frameRouter = {
const tabsRouter = { const tabsRouter = {
path: "/tabs", path: "/tabs",
meta: { meta: {
icon: "tag", icon: "ri:bookmark-2-line",
title: "menus.hstabs", title: "menus.pureTabs",
rank: tabs rank: tabs
}, },
children: [ children: [
@ -189,7 +273,7 @@ const tabsRouter = {
path: "/tabs/index", path: "/tabs/index",
name: "Tabs", name: "Tabs",
meta: { meta: {
title: "menus.hstabs", title: "menus.pureTabs",
roles: ["admin", "common"] roles: ["admin", "common"]
} }
}, },
@ -226,7 +310,13 @@ export default defineFakeRoute([
response: () => { response: () => {
return { return {
success: true, success: true,
data: [systemRouter, permissionRouter, frameRouter, tabsRouter] data: [
systemManagementRouter,
systemMonitorRouter,
permissionRouter,
frameRouter,
tabsRouter
]
}; };
} }
} }

View File

@ -10,7 +10,9 @@ export default defineFakeRoute([
return { return {
success: true, success: true,
data: { data: {
avatar: "https://avatars.githubusercontent.com/u/44761321",
username: "admin", username: "admin",
nickname: "小铭",
// 一个用户可能有多个角色 // 一个用户可能有多个角色
roles: ["admin"], roles: ["admin"],
accessToken: "eyJhbGciOiJIUzUxMiJ9.admin", accessToken: "eyJhbGciOiJIUzUxMiJ9.admin",
@ -22,8 +24,9 @@ export default defineFakeRoute([
return { return {
success: true, success: true,
data: { data: {
avatar: "https://avatars.githubusercontent.com/u/52823142",
username: "common", username: "common",
// 一个用户可能有多个角色 nickname: "小林",
roles: ["common"], roles: ["common"],
accessToken: "eyJhbGciOiJIUzUxMiJ9.common", accessToken: "eyJhbGciOiJIUzUxMiJ9.common",
refreshToken: "eyJhbGciOiJIUzUxMiJ9.commonRefresh", refreshToken: "eyJhbGciOiJIUzUxMiJ9.commonRefresh",

59
mock/mine.ts Normal file
View File

@ -0,0 +1,59 @@
import { defineFakeRoute } from "vite-plugin-fake-server/client";
import { faker } from "@faker-js/faker/locale/zh_CN";
export default defineFakeRoute([
// 账户设置-个人信息
{
url: "/mine",
method: "get",
response: () => {
return {
success: true,
data: {
avatar: "https://avatars.githubusercontent.com/u/44761321",
username: "admin",
nickname: "小铭",
email: "pureadmin@163.com",
phone: "15888886789",
description: "一个热爱开源的前端工程师"
}
};
}
},
// 账户设置-个人安全日志
{
url: "/mine-logs",
method: "get",
response: () => {
let list = [
{
id: 1,
ip: faker.internet.ipv4(),
address: "中国河南省信阳市",
system: "macOS",
browser: "Chrome",
summary: "账户登录", // 详情
operatingTime: new Date() // 时间
},
{
id: 2,
ip: faker.internet.ipv4(),
address: "中国广东省深圳市",
system: "Windows",
browser: "Firefox",
summary: "绑定了手机号码",
operatingTime: new Date().setDate(new Date().getDate() - 1)
}
];
return {
success: true,
data: {
list,
total: list.length, // 总条目数
pageSize: 10, // 每页显示条目个数
currentPage: 1 // 当前页数
}
};
}
}
]);

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "vue-pure-admin", "name": "vue-pure-admin",
"version": "4.5.0", "version": "5.3.0",
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {
@ -13,13 +13,12 @@
"preview:build": "pnpm build && vite preview", "preview:build": "pnpm build && vite preview",
"typecheck": "tsc --noEmit && vue-tsc --noEmit --skipLibCheck", "typecheck": "tsc --noEmit && vue-tsc --noEmit --skipLibCheck",
"svgo": "svgo -f . -r", "svgo": "svgo -f . -r",
"cloc": "NODE_OPTIONS=--max-old-space-size=4096 cloc . --exclude-dir=node_modules --exclude-lang=YAML",
"clean:cache": "rimraf .eslintcache && rimraf pnpm-lock.yaml && rimraf node_modules && pnpm store prune && pnpm install", "clean:cache": "rimraf .eslintcache && rimraf pnpm-lock.yaml && rimraf node_modules && pnpm store prune && pnpm install",
"lint:eslint": "eslint --cache --max-warnings 0 \"{src,mock,build}/**/*.{vue,js,ts,tsx}\" --fix", "lint:eslint": "eslint --cache --max-warnings 0 \"{src,mock,build}/**/*.{vue,js,ts,tsx}\" --fix",
"lint:prettier": "prettier --write \"src/**/*.{js,ts,json,tsx,css,scss,vue,html,md}\"", "lint:prettier": "prettier --write \"src/**/*.{js,ts,json,tsx,css,scss,vue,html,md}\"",
"lint:stylelint": "stylelint --cache --fix \"**/*.{html,vue,css,scss}\" --cache-location node_modules/.cache/stylelint/", "lint:stylelint": "stylelint --cache --fix \"**/*.{html,vue,css,scss}\" --cache-location node_modules/.cache/stylelint/",
"lint": "pnpm lint:eslint && pnpm lint:prettier && pnpm lint:stylelint", "lint": "pnpm lint:eslint && pnpm lint:prettier && pnpm lint:stylelint",
"prepare": "husky install", "prepare": "husky",
"preinstall": "npx only-allow pnpm" "preinstall": "npx only-allow pnpm"
}, },
"keywords": [ "keywords": [
@ -49,118 +48,128 @@
}, },
"dependencies": { "dependencies": {
"@amap/amap-jsapi-loader": "^1.0.1", "@amap/amap-jsapi-loader": "^1.0.1",
"@howdyjs/mouse-menu": "2.0.9", "@howdyjs/mouse-menu": "^2.1.3",
"@logicflow/core": "^1.2.18", "@infectoone/vue-ganttastic": "^2.3.2",
"@logicflow/extension": "^1.2.19", "@logicflow/core": "^1.2.26",
"@pureadmin/descriptions": "^1.2.0", "@logicflow/extension": "^1.2.26",
"@pureadmin/table": "^3.0.1", "@pureadmin/descriptions": "^1.2.1",
"@pureadmin/utils": "^2.4.3", "@pureadmin/table": "^3.1.2",
"@vueuse/core": "^10.7.2", "@pureadmin/utils": "^2.4.7",
"@vueuse/motion": "^2.0.0", "@vue-flow/background": "^1.3.0",
"@vue-flow/core": "^1.33.5",
"@vue-office/docx": "^1.6.0",
"@vue-office/excel": "^1.7.6",
"@vueuse/core": "^10.9.0",
"@vueuse/motion": "^2.1.0",
"@wangeditor/editor": "^5.1.23", "@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-vue": "^5.1.12", "@wangeditor/editor-for-vue": "^5.1.12",
"@zxcvbn-ts/core": "^3.0.4", "@zxcvbn-ts/core": "^3.0.4",
"animate.css": "^4.1.1", "animate.css": "^4.1.1",
"axios": "^1.6.5", "axios": "^1.6.8",
"china-area-data": "^5.0.1", "china-area-data": "^5.0.1",
"cropperjs": "^1.6.1", "cropperjs": "^1.6.1",
"dayjs": "^1.11.10", "dayjs": "^1.11.10",
"echarts": "^5.4.3", "echarts": "^5.5.0",
"el-table-infinite-scroll": "^3.0.3", "el-table-infinite-scroll": "^3.0.3",
"element-plus": "^2.5.1", "element-plus": "2.6.3",
"intro.js": "^7.2.0", "intro.js": "^7.2.0",
"js-cookie": "^3.0.5", "js-cookie": "^3.0.5",
"jsbarcode": "^3.11.6", "jsbarcode": "^3.11.6",
"localforage": "^1.10.0", "localforage": "^1.10.0",
"mint-filter": "^4.0.3", "mint-filter": "^4.0.3",
"mitt": "^3.0.1", "mitt": "^3.0.1",
"mqtt": "4.3.7",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"path": "^0.12.7", "path": "^0.12.7",
"pinia": "^2.1.7", "pinia": "^2.1.7",
"pinyin-pro": "^3.19.3", "pinyin-pro": "^3.20.0",
"plus-pro-components": "^0.0.10",
"qrcode": "^1.5.3", "qrcode": "^1.5.3",
"qs": "^6.11.2", "qs": "^6.12.0",
"responsive-storage": "^2.2.0", "responsive-storage": "^2.2.0",
"sortablejs": "^1.15.2", "sortablejs": "^1.15.2",
"swiper": "^11.0.5", "swiper": "^11.1.1",
"typeit": "8.7.1", "typeit": "^8.8.3",
"v-contextmenu": "3.0.0", "v-contextmenu": "^3.2.0",
"v3-infinite-loading": "^1.3.1", "v3-infinite-loading": "^1.3.1",
"version-rocket": "^1.7.1", "version-rocket": "^1.7.1",
"vue": "3.4.14", "vue": "^3.4.21",
"vue-i18n": "^9.9.0", "vue-i18n": "^9.12.0",
"vue-json-pretty": "^2.3.0", "vue-json-pretty": "^2.4.0",
"vue-pdf-embed": "1.2.1", "vue-pdf-embed": "^2.0.3",
"vue-router": "^4.2.5", "vue-router": "^4.3.0",
"vue-tippy": "^6.4.1", "vue-tippy": "^6.4.1",
"vue-types": "^5.1.1", "vue-types": "^5.1.1",
"vue-virtual-scroller": "2.0.0-beta.8", "vue-virtual-scroller": "2.0.0-beta.8",
"vue-waterfall-plugin-next": "^2.3.1", "vue-waterfall-plugin-next": "^2.4.3",
"vue3-danmaku": "^1.6.0", "vue3-danmaku": "^1.6.0",
"vue3-puzzle-vcode": "^1.1.7",
"vuedraggable": "^4.1.0", "vuedraggable": "^4.1.0",
"wavesurfer.js": "^7.6.4", "vxe-table": "^4.5.22",
"xgplayer": "^3.0.11", "wavesurfer.js": "^7.7.10",
"xgplayer": "^3.0.16",
"xlsx": "^0.18.5" "xlsx": "^0.18.5"
}, },
"devDependencies": { "devDependencies": {
"@commitlint/cli": "^18.4.4", "@commitlint/cli": "^19.2.1",
"@commitlint/config-conventional": "^18.4.4", "@commitlint/config-conventional": "^19.1.0",
"@commitlint/types": "^18.4.4", "@commitlint/types": "^19.0.3",
"@eslint/js": "^8.56.0", "@eslint/js": "^9.0.0",
"@faker-js/faker": "^8.3.1", "@faker-js/faker": "^8.4.1",
"@iconify-icons/ep": "^1.2.12", "@iconify-icons/ep": "^1.2.12",
"@iconify-icons/ri": "^1.2.10", "@iconify-icons/ri": "^1.2.10",
"@iconify/vue": "^4.1.1", "@iconify/vue": "^4.1.1",
"@intlify/unplugin-vue-i18n": "^2.0.0", "@intlify/unplugin-vue-i18n": "^4.0.0",
"@pureadmin/theme": "^3.2.0", "@pureadmin/theme": "^3.2.0",
"@types/gradient-string": "^1.1.5", "@types/dagre": "^0.7.52",
"@types/gradient-string": "^1.1.6",
"@types/intro.js": "^5.1.5", "@types/intro.js": "^5.1.5",
"@types/js-cookie": "^3.0.6", "@types/js-cookie": "^3.0.6",
"@types/node": "^20.11.0", "@types/node": "^20.12.7",
"@types/nprogress": "^0.2.3", "@types/nprogress": "^0.2.3",
"@types/qrcode": "^1.5.5", "@types/qrcode": "^1.5.5",
"@types/qs": "^6.9.11", "@types/qs": "^6.9.14",
"@types/sortablejs": "^1.15.7", "@types/sortablejs": "^1.15.8",
"@typescript-eslint/eslint-plugin": "^6.18.1", "@typescript-eslint/eslint-plugin": "^7.6.0",
"@typescript-eslint/parser": "^6.18.1", "@typescript-eslint/parser": "^7.6.0",
"@vitejs/plugin-vue": "^5.0.3", "@vitejs/plugin-vue": "^5.0.4",
"@vitejs/plugin-vue-jsx": "^3.1.0", "@vitejs/plugin-vue-jsx": "^3.1.0",
"autoprefixer": "^10.4.16", "autoprefixer": "^10.4.19",
"boxen": "^7.1.1", "boxen": "^7.1.1",
"cloc": "^2.11.0", "cssnano": "^6.1.2",
"cssnano": "^6.0.3", "dagre": "^0.8.5",
"eslint": "^8.56.0", "eslint": "^9.0.0",
"eslint-config-prettier": "^9.1.0", "eslint-config-prettier": "^9.1.0",
"eslint-define-config": "^2.1.0", "eslint-define-config": "^2.1.0",
"eslint-plugin-prettier": "^5.1.3", "eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-vue": "^9.20.0", "eslint-plugin-vue": "^9.24.1",
"gradient-string": "^2.0.2", "gradient-string": "^2.0.2",
"husky": "^8.0.3", "husky": "^9.0.11",
"lint-staged": "^15.2.0", "lint-staged": "^15.2.2",
"postcss": "^8.4.33", "postcss": "^8.4.38",
"postcss-html": "^1.6.0", "postcss-html": "^1.6.0",
"postcss-import": "^15.1.0", "postcss-import": "^16.1.0",
"postcss-scss": "^4.0.9", "postcss-scss": "^4.0.9",
"prettier": "^3.1.1", "prettier": "^3.2.5",
"rimraf": "^5.0.5", "rimraf": "^5.0.5",
"rollup-plugin-visualizer": "^5.12.0", "rollup-plugin-visualizer": "^5.12.0",
"sass": "^1.69.7", "sass": "^1.75.0",
"stylelint": "^16.1.0", "stylelint": "^16.3.1",
"stylelint-config-recess-order": "^4.4.0", "stylelint-config-recess-order": "^5.0.0",
"stylelint-config-recommended-vue": "^1.5.0", "stylelint-config-recommended-vue": "^1.5.0",
"stylelint-config-standard-scss": "^12.0.0", "stylelint-config-standard-scss": "^13.1.0",
"stylelint-prettier": "^5.0.0", "stylelint-prettier": "^5.0.0",
"svgo": "^3.2.0", "svgo": "^3.2.0",
"tailwindcss": "^3.4.1", "tailwindcss": "^3.4.3",
"typescript": "^5.3.3", "typescript": "^5.4.5",
"vite": "^5.0.12", "vite": "^5.2.8",
"vite-plugin-cdn-import": "^0.3.5", "vite-plugin-cdn-import": "^0.3.5",
"vite-plugin-compression": "^0.5.1", "vite-plugin-compression": "^0.5.1",
"vite-plugin-fake-server": "^2.1.1", "vite-plugin-fake-server": "^2.1.1",
"vite-plugin-remove-console": "^2.2.0", "vite-plugin-remove-console": "^2.2.0",
"vite-plugin-router-warn": "^1.0.0", "vite-plugin-router-warn": "^1.0.0",
"vite-svg-loader": "^5.1.0", "vite-svg-loader": "^5.1.0",
"vue-eslint-parser": "^9.4.0", "vue-eslint-parser": "^9.4.2",
"vue-tsc": "^1.8.27" "vue-tsc": "^1.8.27"
}, },
"engines": { "engines": {
@ -175,6 +184,11 @@
"w3c-hr-time": "*", "w3c-hr-time": "*",
"stable": "*", "stable": "*",
"abab": "*" "abab": "*"
},
"peerDependencyRules": {
"allowedVersions": {
"eslint": "9"
}
} }
} }
} }

4631
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
{ {
"Version": "4.5.0", "Version": "5.3.0",
"Title": "PureAdmin", "Title": "PureAdmin",
"FixedHeader": true, "FixedHeader": true,
"HiddenSideBar": false, "HiddenSideBar": false,
@ -13,7 +13,8 @@
"Grey": false, "Grey": false,
"Weak": false, "Weak": false,
"HideTabs": false, "HideTabs": false,
"HideFooter": true, "HideFooter": false,
"Stretch": false,
"SidebarStatus": true, "SidebarStatus": true,
"EpThemeColor": "#409EFF", "EpThemeColor": "#409EFF",
"ShowLogo": true, "ShowLogo": true,
@ -22,8 +23,9 @@
"CachingAsyncRoutes": false, "CachingAsyncRoutes": false,
"TooltipEffect": "light", "TooltipEffect": "light",
"ResponsiveStorageNameSpace": "responsive-", "ResponsiveStorageNameSpace": "responsive-",
"MenuSearchHistory": 6,
"MapConfigure": { "MapConfigure": {
"amapKey": "97b3248d1553172e81f168cf94ea667e", "amapKey": "adc139d56406f3844c8f1cf1c6b65c41",
"options": { "options": {
"resizeEnable": true, "resizeEnable": true,
"center": [113.6401, 34.72468], "center": [113.6401, 34.72468],

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 80 KiB

View File

@ -9,9 +9,11 @@
import { defineComponent } from "vue"; import { defineComponent } from "vue";
import { checkVersion } from "version-rocket"; import { checkVersion } from "version-rocket";
import { ElConfigProvider } from "element-plus"; import { ElConfigProvider } from "element-plus";
import en from "element-plus/dist/locale/en.mjs";
import { ReDialog } from "@/components/ReDialog"; import { ReDialog } from "@/components/ReDialog";
import zhCn from "element-plus/dist/locale/zh-cn.mjs"; import en from "element-plus/es/locale/lang/en";
import zhCn from "element-plus/es/locale/lang/zh-cn";
import plusEn from "plus-pro-components/es/locale/lang/en";
import plusZhCn from "plus-pro-components/es/locale/lang/zh-cn";
export default defineComponent({ export default defineComponent({
name: "app", name: "app",
@ -21,7 +23,9 @@ export default defineComponent({
}, },
computed: { computed: {
currentLocale() { currentLocale() {
return this.$storage.locale?.locale === "zh" ? zhCn : en; return this.$storage.locale?.locale === "zh"
? { ...zhCn, ...plusZhCn }
: { ...en, ...plusEn };
} }
}, },
beforeCreate() { beforeCreate() {

View File

@ -19,27 +19,67 @@ type ResultTable = {
}; };
}; };
/** 获取用户管理列表 */ /** 获取系统管理-用户管理列表 */
export const getUserList = (data?: object) => { export const getUserList = (data?: object) => {
return http.request<ResultTable>("post", "/user", { data }); return http.request<ResultTable>("post", "/user", { data });
}; };
/** 用户管理-获取所有角色列表 */ /** 系统管理-用户管理-获取所有角色列表 */
export const getAllRoleList = () => { export const getAllRoleList = () => {
return http.request<Result>("get", "/list-all-role"); return http.request<Result>("get", "/list-all-role");
}; };
/** 用户管理-根据userId获取对应角色id列表userId用户id */ /** 系统管理-用户管理-根据userId获取对应角色id列表userId用户id */
export const getRoleIds = (data?: object) => { export const getRoleIds = (data?: object) => {
return http.request<Result>("post", "/list-role-ids", { data }); return http.request<Result>("post", "/list-role-ids", { data });
}; };
/** 获取角色管理列表 */ /** 获取系统管理-角色管理列表 */
export const getRoleList = (data?: object) => { export const getRoleList = (data?: object) => {
return http.request<ResultTable>("post", "/role", { data }); return http.request<ResultTable>("post", "/role", { data });
}; };
/** 获取部门管理列表 */ /** 获取系统管理-菜单管理列表 */
export const getMenuList = (data?: object) => {
return http.request<Result>("post", "/menu", { data });
};
/** 获取系统管理-部门管理列表 */
export const getDeptList = (data?: object) => { export const getDeptList = (data?: object) => {
return http.request<Result>("post", "/dept", { data }); return http.request<Result>("post", "/dept", { data });
}; };
/** 获取系统监控-在线用户列表 */
export const getOnlineLogsList = (data?: object) => {
return http.request<ResultTable>("post", "/online-logs", { data });
};
/** 获取系统监控-登录日志列表 */
export const getLoginLogsList = (data?: object) => {
return http.request<ResultTable>("post", "/login-logs", { data });
};
/** 获取系统监控-操作日志列表 */
export const getOperationLogsList = (data?: object) => {
return http.request<ResultTable>("post", "/operation-logs", { data });
};
/** 获取系统监控-系统日志列表 */
export const getSystemLogsList = (data?: object) => {
return http.request<ResultTable>("post", "/system-logs", { data });
};
/** 获取系统监控-系统日志-根据 id 查日志详情 */
export const getSystemLogsDetail = (data?: object) => {
return http.request<Result>("post", "/system-logs-detail", { data });
};
/** 获取角色管理-权限-菜单权限 */
export const getRoleMenu = (data?: object) => {
return http.request<Result>("post", "/role-menu", { data });
};
/** 获取角色管理-权限-菜单权限-根据角色 id 查对应菜单 */
export const getRoleMenuIds = (data?: object) => {
return http.request<Result>("post", "/role-menu-ids", { data });
};

View File

@ -5,7 +5,7 @@ export type UserResult = {
data: { data: {
/** 用户名 */ /** 用户名 */
username: string; username: string;
/** 当前登用户的角色 */ /** 当前登用户的角色 */
roles: Array<string>; roles: Array<string>;
/** `token` */ /** `token` */
accessToken: string; accessToken: string;
@ -28,12 +28,56 @@ export type RefreshTokenResult = {
}; };
}; };
export type UserInfo = {
/** 头像 */
avatar: string;
/** 用户名 */
username: string;
/** 昵称 */
nickname: string;
/** 邮箱 */
email: string;
/** 联系电话 */
phone: string;
/** 简介 */
description: string;
};
export type UserInfoResult = {
success: boolean;
data: UserInfo;
};
type ResultTable = {
success: boolean;
data?: {
/** 列表数据 */
list: Array<any>;
/** 总条目数 */
total?: number;
/** 每页显示条目个数 */
pageSize?: number;
/** 当前页数 */
currentPage?: number;
};
};
/** 登录 */ /** 登录 */
export const getLogin = (data?: object) => { export const getLogin = (data?: object) => {
return http.request<UserResult>("post", "/login", { data }); return http.request<UserResult>("post", "/login", { data });
}; };
/** 刷新token */ /** 刷新`token` */
export const refreshTokenApi = (data?: object) => { export const refreshTokenApi = (data?: object) => {
return http.request<RefreshTokenResult>("post", "/refresh-token", { data }); return http.request<RefreshTokenResult>("post", "/refresh-token", { data });
}; };
/** 账户设置-个人信息 */
export const getMine = (data?: object) => {
return http.request<UserInfoResult>("get", "/mine", { data });
};
/** 账户设置-个人安全日志 */
export const getMineLogs = (data?: object) => {
return http.request<ResultTable>("get", "/mine-logs", { data });
};

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@ -1,5 +1,5 @@
import reAnimateSelector from "./src/index.vue";
import { withInstall } from "@pureadmin/utils"; import { withInstall } from "@pureadmin/utils";
import reAnimateSelector from "./src/index.vue";
/** [animate.css](https://animate.style/) 选择器组件 */ /** [animate.css](https://animate.style/) 选择器组件 */
export const ReAnimateSelector = withInstall(reAnimateSelector); export const ReAnimateSelector = withInstall(reAnimateSelector);

View File

@ -1,12 +1,19 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed } from "vue";
import { animates } from "./animate"; import { animates } from "./animate";
import { ref, computed, toRef } from "vue";
import { cloneDeep } from "@pureadmin/utils"; import { cloneDeep } from "@pureadmin/utils";
defineOptions({ defineOptions({
name: "ReAnimateSelector" name: "ReAnimateSelector"
}); });
const props = defineProps({
placeholder: {
type: String,
default: "请选择动画"
}
});
const inputValue = defineModel({ type: String }); const inputValue = defineModel({ type: String });
const searchVal = ref(); const searchVal = ref();
@ -74,7 +81,7 @@ function onMouseleave() {
<el-select <el-select
clearable clearable
filterable filterable
placeholder="请选择动画" :placeholder="props.placeholder"
popper-class="pure-animate-popper" popper-class="pure-animate-popper"
:model-value="inputValue" :model-value="inputValue"
:filter-method="filterMethod" :filter-method="filterMethod"

View File

@ -1,5 +1,5 @@
import reBarcode from "./src/index.vue";
import { withInstall } from "@pureadmin/utils"; import { withInstall } from "@pureadmin/utils";
import reBarcode from "./src/index.vue";
/** 条形码组件 */ /** 条形码组件 */
export const ReBarcode = withInstall(reBarcode); export const ReBarcode = withInstall(reBarcode);

View File

@ -1,10 +1,10 @@
import { import {
defineComponent,
reactive,
computed,
watch, watch,
unref,
computed,
reactive,
onMounted, onMounted,
unref defineComponent
} from "vue"; } from "vue";
import { countToProps } from "./props"; import { countToProps } from "./props";
import { isNumber } from "@pureadmin/utils"; import { isNumber } from "@pureadmin/utils";
@ -61,7 +61,7 @@ export default defineComponent({
state.rAF = requestAnimationFrame(count); state.rAF = requestAnimationFrame(count);
} }
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
function pauseResume() { function pauseResume() {
if (state.paused) { if (state.paused) {
resume(); resume();
@ -83,7 +83,7 @@ export default defineComponent({
requestAnimationFrame(count); requestAnimationFrame(count);
} }
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
function reset() { function reset() {
state.startTime = null; state.startTime = null;
cancelAnimationFrame(state.rAF); cancelAnimationFrame(state.rAF);

View File

@ -1,5 +1,6 @@
import type { PropType } from "vue"; import type { PropType } from "vue";
import propTypes from "@/utils/propTypes"; import propTypes from "@/utils/propTypes";
export const countToProps = { export const countToProps = {
startVal: propTypes.number.def(0), startVal: propTypes.number.def(0),
endVal: propTypes.number.def(2020), endVal: propTypes.number.def(2020),

View File

@ -1,9 +1,9 @@
import "./rebound.css"; import "./rebound.css";
import { import {
defineComponent,
ref, ref,
unref, unref,
onBeforeMount, onBeforeMount,
defineComponent,
onBeforeUnmount onBeforeUnmount
} from "vue"; } from "vue";
import { reboundProps } from "./props"; import { reboundProps } from "./props";

View File

@ -1,5 +1,6 @@
import type { PropType } from "vue"; import type { PropType } from "vue";
import propTypes from "@/utils/propTypes"; import propTypes from "@/utils/propTypes";
export const reboundProps = { export const reboundProps = {
delay: propTypes.number.def(1), delay: propTypes.number.def(1),
blur: propTypes.number.def(2), blur: propTypes.number.def(2),

View File

@ -1,4 +1,3 @@
@import "tippy.js/themes/light.css";
@import "cropperjs/dist/cropper.css"; @import "cropperjs/dist/cropper.css";
.re-circled { .re-circled {

View File

@ -2,13 +2,14 @@ import "./circled.css";
import Cropper from "cropperjs"; import Cropper from "cropperjs";
import { ElUpload } from "element-plus"; import { ElUpload } from "element-plus";
import type { CSSProperties } from "vue"; import type { CSSProperties } from "vue";
import { useEventListener } from "@vueuse/core";
import { longpress } from "@/directives/longpress"; import { longpress } from "@/directives/longpress";
import { useTippy, directive as tippy } from "vue-tippy"; import { useTippy, directive as tippy } from "vue-tippy";
import { import {
type PropType,
ref, ref,
unref, unref,
computed, computed,
type PropType,
onMounted, onMounted,
onUnmounted, onUnmounted,
defineComponent defineComponent
@ -66,6 +67,8 @@ const props = {
src: { type: String, required: true }, src: { type: String, required: true },
alt: { type: String }, alt: { type: String },
circled: { type: Boolean, default: false }, circled: { type: Boolean, default: false },
/** 是否可以通过点击裁剪区域关闭右键弹出的功能菜单,默认 `true` */
isClose: { type: Boolean, default: true },
realTimePreview: { type: Boolean, default: true }, realTimePreview: { type: Boolean, default: true },
height: { type: [String, Number], default: "360px" }, height: { type: [String, Number], default: "360px" },
crossorigin: { crossorigin: {
@ -83,10 +86,12 @@ export default defineComponent({
const tippyElRef = ref<ElRef<HTMLImageElement>>(); const tippyElRef = ref<ElRef<HTMLImageElement>>();
const imgElRef = ref<ElRef<HTMLImageElement>>(); const imgElRef = ref<ElRef<HTMLImageElement>>();
const cropper = ref<Nullable<Cropper>>(); const cropper = ref<Nullable<Cropper>>();
const inCircled = ref(props.circled);
const isInClose = ref(props.isClose);
const inSrc = ref(props.src);
const isReady = ref(false); const isReady = ref(false);
const imgBase64 = ref(); const imgBase64 = ref();
const inCircled = ref(props.circled);
const inSrc = ref(props.src);
let scaleX = 1; let scaleX = 1;
let scaleY = 1; let scaleY = 1;
@ -218,6 +223,7 @@ export default defineComponent({
if (event === "scaleX") { if (event === "scaleX") {
scaleX = arg = scaleX === -1 ? 1 : -1; scaleX = arg = scaleX === -1 ? 1 : -1;
} }
if (event === "scaleY") { if (event === "scaleY") {
scaleY = arg = scaleY === -1 ? 1 : -1; scaleY = arg = scaleY === -1 ? 1 : -1;
} }
@ -375,7 +381,7 @@ export default defineComponent({
function onContextmenu(event) { function onContextmenu(event) {
event.preventDefault(); event.preventDefault();
const { show, setProps } = useTippy(tippyElRef, { const { show, setProps, destroy, state } = useTippy(tippyElRef, {
content: menuContent, content: menuContent,
arrow: false, arrow: false,
theme: "light", theme: "light",
@ -383,7 +389,6 @@ export default defineComponent({
interactive: true, interactive: true,
appendTo: "parent", appendTo: "parent",
// hideOnClick: false, // hideOnClick: false,
animation: "perspective",
placement: "bottom-end" placement: "bottom-end"
}); });
@ -399,6 +404,11 @@ export default defineComponent({
}); });
show(); show();
if (isInClose.value) {
if (!state.value.isShown && !state.value.isVisible) return;
useEventListener(tippyElRef, "click", destroy);
}
} }
return { return {

View File

@ -0,0 +1,7 @@
import reCropperPreview from "./src/index.vue";
import { withInstall } from "@pureadmin/utils";
/** 图片裁剪预览组件 */
export const ReCropperPreview = withInstall(reCropperPreview);
export default ReCropperPreview;

View File

@ -3,6 +3,10 @@ import { ref } from "vue";
import ReCropper from "@/components/ReCropper"; import ReCropper from "@/components/ReCropper";
import { formatBytes } from "@pureadmin/utils"; import { formatBytes } from "@pureadmin/utils";
defineOptions({
name: "ReCropperPreview"
});
const props = defineProps({ const props = defineProps({
imgSrc: String imgSrc: String
}); });

View File

@ -51,8 +51,8 @@ const closeAllDialog = () => {
/** 使`addDialog` /** 使`addDialog`
* https://github.com/pure-admin/vue-pure-admin/blob/main/src/App.vue#L4 * https://github.com/pure-admin/vue-pure-admin/blob/main/src/App.vue#L4
* https://github.com/pure-admin/vue-pure-admin/blob/main/src/App.vue#L13 * https://github.com/pure-admin/vue-pure-admin/blob/main/src/App.vue#L12
* https://github.com/pure-admin/vue-pure-admin/blob/main/src/App.vue#L20 * https://github.com/pure-admin/vue-pure-admin/blob/main/src/App.vue#L22
*/ */
const ReDialog = withInstall(reDialog); const ReDialog = withInstall(reDialog);

View File

@ -1,16 +1,20 @@
<script setup lang="ts"> <script setup lang="ts">
import { import {
closeDialog,
dialogStore,
type EventType, type EventType,
type ButtonProps, type ButtonProps,
type DialogOptions type DialogOptions,
closeDialog,
dialogStore
} from "./index"; } from "./index";
import { ref, computed } from "vue"; import { ref, computed } from "vue";
import { isFunction } from "@pureadmin/utils"; import { isFunction } from "@pureadmin/utils";
import Fullscreen from "@iconify-icons/ri/fullscreen-fill"; import Fullscreen from "@iconify-icons/ri/fullscreen-fill";
import ExitFullscreen from "@iconify-icons/ri/fullscreen-exit-fill"; import ExitFullscreen from "@iconify-icons/ri/fullscreen-exit-fill";
defineOptions({
name: "ReDialog"
});
const fullscreen = ref(false); const fullscreen = ref(false);
const footerButtons = computed(() => { const footerButtons = computed(() => {
@ -37,6 +41,7 @@ const footerButtons = computed(() => {
type: "primary", type: "primary",
text: true, text: true,
bg: true, bg: true,
popconfirm: options?.popconfirm,
btnClick: ({ dialog: { options, index } }) => { btnClick: ({ dialog: { options, index } }) => {
const done = () => const done = () =>
closeDialog(options, index, { command: "sure" }); closeDialog(options, index, { command: "sure" });
@ -64,9 +69,10 @@ const fullscreenClass = computed(() => {
function eventsCallBack( function eventsCallBack(
event: EventType, event: EventType,
options: DialogOptions, options: DialogOptions,
index: number index: number,
isClickFullScreen = false
) { ) {
fullscreen.value = options?.fullscreen ?? false; if (!isClickFullScreen) fullscreen.value = options?.fullscreen ?? false;
if (options?.[event] && isFunction(options?.[event])) { if (options?.[event] && isFunction(options?.[event])) {
return options?.[event]({ options, index }); return options?.[event]({ options, index });
} }
@ -90,7 +96,7 @@ function handleClose(
v-model="options.visible" v-model="options.visible"
class="pure-dialog" class="pure-dialog"
:fullscreen="fullscreen ? true : options?.fullscreen ? true : false" :fullscreen="fullscreen ? true : options?.fullscreen ? true : false"
@close="handleClose(options, index)" @closed="handleClose(options, index)"
@opened="eventsCallBack('open', options, index)" @opened="eventsCallBack('open', options, index)"
@openAutoFocus="eventsCallBack('openAutoFocus', options, index)" @openAutoFocus="eventsCallBack('openAutoFocus', options, index)"
@closeAutoFocus="eventsCallBack('closeAutoFocus', options, index)" @closeAutoFocus="eventsCallBack('closeAutoFocus', options, index)"
@ -108,7 +114,17 @@ function handleClose(
<i <i
v-if="!options?.fullscreen" v-if="!options?.fullscreen"
:class="fullscreenClass" :class="fullscreenClass"
@click="fullscreen = !fullscreen" @click="
() => {
fullscreen = !fullscreen;
eventsCallBack(
'fullscreenCallBack',
{ ...options, fullscreen },
index,
true
);
}
"
> >
<IconifyIconOffline <IconifyIconOffline
class="pure-dialog-svg" class="pure-dialog-svg"
@ -138,19 +154,34 @@ function handleClose(
<component :is="options?.footerRenderer({ options, index })" /> <component :is="options?.footerRenderer({ options, index })" />
</template> </template>
<span v-else> <span v-else>
<el-button <template v-for="(btn, key) in footerButtons(options)" :key="key">
v-for="(btn, key) in footerButtons(options)" <el-popconfirm
:key="key" v-if="btn.popconfirm"
v-bind="btn" v-bind="btn.popconfirm"
@click=" @confirm="
btn.btnClick({ btn.btnClick({
dialog: { options, index }, dialog: { options, index },
button: { btn, index: key } button: { btn, index: key }
}) })
" "
> >
{{ btn?.label }} <template #reference>
</el-button> <el-button v-bind="btn">{{ btn?.label }}</el-button>
</template>
</el-popconfirm>
<el-button
v-else
v-bind="btn"
@click="
btn.btnClick({
dialog: { options, index },
button: { btn, index: key }
})
"
>
{{ btn?.label }}
</el-button>
</template>
</span> </span>
</template> </template>
</el-dialog> </el-dialog>

View File

@ -1,11 +1,23 @@
import type { CSSProperties, VNode, Component } from "vue"; import type { CSSProperties, VNode, Component } from "vue";
type DoneFn = (cancel?: boolean) => void; type DoneFn = (cancel?: boolean) => void;
type EventType = "open" | "close" | "openAutoFocus" | "closeAutoFocus"; type EventType =
| "open"
| "close"
| "openAutoFocus"
| "closeAutoFocus"
| "fullscreenCallBack";
type ArgsType = { type ArgsType = {
/** `cancel` 点击取消按钮、`sure` 点击确定按钮、`close` 点击右上角关闭按钮或者空白页 */ /** `cancel` 点击取消按钮、`sure` 点击确定按钮、`close` 点击右上角关闭按钮或空白页或按下了esc键 */
command: "cancel" | "sure" | "close"; command: "cancel" | "sure" | "close";
}; };
type ButtonType =
| "primary"
| "success"
| "warning"
| "danger"
| "info"
| "text";
/** https://element-plus.org/zh-CN/component/dialog.html#attributes */ /** https://element-plus.org/zh-CN/component/dialog.html#attributes */
type DialogProps = { type DialogProps = {
@ -53,6 +65,34 @@ type DialogProps = {
destroyOnClose?: boolean; destroyOnClose?: boolean;
}; };
//element-plus.org/zh-CN/component/popconfirm.html#attributes
type Popconfirm = {
/** 标题 */
title?: string;
/** 确认按钮文字 */
confirmButtonText?: string;
/** 取消按钮文字 */
cancelButtonText?: string;
/** 确认按钮类型,默认 `primary` */
confirmButtonType?: ButtonType;
/** 取消按钮类型,默认 `text` */
cancelButtonType?: ButtonType;
/** 自定义图标,默认 `QuestionFilled` */
icon?: string | Component;
/** `Icon` 颜色,默认 `#f90` */
iconColor?: string;
/** 是否隐藏 `Icon`,默认 `false` */
hideIcon?: boolean;
/** 关闭时的延迟,默认 `200` */
hideAfter?: number;
/** 是否将 `popover` 的下拉列表插入至 `body` 元素,默认 `true` */
teleported?: boolean;
/** 当 `popover` 组件长时间不触发且 `persistent` 属性设置为 `false` 时, `popover` 将会被删除,默认 `false` */
persistent?: boolean;
/** 弹层宽度,最小宽度 `150px`,默认 `150` */
width?: string | number;
};
type BtnClickDialog = { type BtnClickDialog = {
options?: DialogOptions; options?: DialogOptions;
index?: number; index?: number;
@ -81,6 +121,8 @@ type ButtonProps = {
round?: boolean; round?: boolean;
/** 是否为圆形按钮,默认 `false` */ /** 是否为圆形按钮,默认 `false` */
circle?: boolean; circle?: boolean;
/** 确认按钮的 `Popconfirm` 气泡确认框相关配置 */
popconfirm?: Popconfirm;
/** 是否为加载中状态,默认 `false` */ /** 是否为加载中状态,默认 `false` */
loading?: boolean; loading?: boolean;
/** 自定义加载中状态图标组件 */ /** 自定义加载中状态图标组件 */
@ -118,6 +160,8 @@ interface DialogOptions extends DialogProps {
props?: any; props?: any;
/** 是否隐藏 `Dialog` 按钮操作区的内容 */ /** 是否隐藏 `Dialog` 按钮操作区的内容 */
hideFooter?: boolean; hideFooter?: boolean;
/** 确认按钮的 `Popconfirm` 气泡确认框相关配置 */
popconfirm?: Popconfirm;
/** /**
* @description * @description
* @see {@link https://element-plus.org/zh-CN/component/dialog.html#%E8%87%AA%E5%AE%9A%E4%B9%89%E5%A4%B4%E9%83%A8} * @see {@link https://element-plus.org/zh-CN/component/dialog.html#%E8%87%AA%E5%AE%9A%E4%B9%89%E5%A4%B4%E9%83%A8}
@ -157,7 +201,7 @@ interface DialogOptions extends DialogProps {
options: DialogOptions; options: DialogOptions;
index: number; index: number;
}) => void; }) => void;
/** `Dialog` 关闭后的回调(只有点击右上角关闭按钮或空白页关闭页面时才会触发) */ /** `Dialog` 关闭后的回调(只有点击右上角关闭按钮或空白页或按下了esc键关闭页面时才会触发) */
close?: ({ close?: ({
options, options,
index index
@ -165,7 +209,7 @@ interface DialogOptions extends DialogProps {
options: DialogOptions; options: DialogOptions;
index: number; index: number;
}) => void; }) => void;
/** `Dialog` 关闭后的回调。 `args` 返回的 `command` 值解析:`cancel` 点击取消按钮、`sure` 点击确定按钮、`close` 点击右上角关闭按钮或空白页 */ /** `Dialog` 关闭后的回调。 `args` 返回的 `command` 值解析:`cancel` 点击取消按钮、`sure` 点击确定按钮、`close` 点击右上角关闭按钮或空白页或按下了esc键 */
closeCallBack?: ({ closeCallBack?: ({
options, options,
index, index,
@ -175,6 +219,14 @@ interface DialogOptions extends DialogProps {
index: number; index: number;
args: any; args: any;
}) => void; }) => void;
/** 点击全屏按钮时的回调 */
fullscreenCallBack?: ({
options,
index
}: {
options: DialogOptions;
index: number;
}) => void;
/** 输入焦点聚焦在 `Dialog` 内容时的回调 */ /** 输入焦点聚焦在 `Dialog` 内容时的回调 */
openAutoFocus?: ({ openAutoFocus?: ({
options, options,

View File

@ -1,5 +1,5 @@
import "./index.css"; import "./index.css";
import { h, defineComponent, type Component } from "vue"; import { type Component, h, defineComponent } from "vue";
export interface attrsType { export interface attrsType {
width?: string; width?: string;

View File

@ -1,6 +1,6 @@
import { defineComponent, ref } from "vue";
import propTypes from "@/utils/propTypes";
import "./filpper.css"; import "./filpper.css";
import propTypes from "@/utils/propTypes";
import { defineComponent, ref } from "vue";
const props = { const props = {
// front paper text // front paper text

View File

@ -1,6 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, unref, nextTick, onUnmounted } from "vue";
import flippers from "./filpper"; import flippers from "./filpper";
import { ref, unref, nextTick, onUnmounted } from "vue";
defineOptions({
name: "ReFlop"
});
const timer = ref(null); const timer = ref(null);
const flipObjs = ref([]); const flipObjs = ref([]);

View File

@ -105,27 +105,24 @@ onMounted(() => {
@mouseenter.prevent="onEnter(key)" @mouseenter.prevent="onEnter(key)"
@mouseleave.prevent="focusIndex = -1" @mouseleave.prevent="focusIndex = -1"
> >
<el-tooltip <button
:content="item.text" :ref="'controlButton' + key"
:visible="focusIndex === key" v-tippy="{
placement="right" content: item.text
}"
:disabled="item.disabled"
:style="{
cursor: item.disabled === false ? 'pointer' : 'not-allowed',
color: item.disabled === false ? '' : '#00000040',
background: 'transparent'
}"
@click="onControl(item, key)"
> >
<button <span
:ref="'controlButton' + key" :class="'iconfont ' + item.icon"
:disabled="item.disabled" :style="{ fontSize: `${item.size}px` }"
:style="{ />
cursor: item.disabled === false ? 'pointer' : 'not-allowed', </button>
color: item.disabled === false ? '' : '#00000040',
background: 'transparent'
}"
@click="onControl(item, key)"
>
<span
:class="'iconfont ' + item.icon"
:style="{ fontSize: `${item.size}px` }"
/>
</button>
</el-tooltip>
</li> </li>
</ul> </ul>
</div> </div>

View File

@ -1,7 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { IconJson } from "@/components/ReIcon/data"; import { IconJson } from "@/components/ReIcon/data";
import { cloneDeep, isAllEmpty } from "@pureadmin/utils"; import { cloneDeep, isAllEmpty } from "@pureadmin/utils";
import { ref, computed, CSSProperties, toRef, watch } from "vue"; import { ref, computed, CSSProperties, watch } from "vue";
import Search from "@iconify-icons/ri/search-eye-line"; import Search from "@iconify-icons/ri/search-eye-line";
type ParameterCSSProperties = (item?: string) => CSSProperties | undefined; type ParameterCSSProperties = (item?: string) => CSSProperties | undefined;

View File

@ -1,55 +1,70 @@
// 这里存放本地图标,在 src/layout/index.vue 文件中加载,避免在首启动加载
import { addIcon } from "@iconify/vue/dist/offline"; import { addIcon } from "@iconify/vue/dist/offline";
/** // 本地菜单图标,后端在路由的 icon 中返回对应的图标字符串并且前端在此处使用 addIcon 添加即可渲染菜单图标
* src/layout/index.vue // @iconify-icons/ep
*/
// 本地菜单图标后端在路由的icon中返回对应的图标字符串并且前端在此处使用addIcon添加即可渲染菜单图标
import UbuntuFill from "@iconify-icons/ri/ubuntu-fill";
import Menu from "@iconify-icons/ep/menu"; import Menu from "@iconify-icons/ep/menu";
import Edit from "@iconify-icons/ep/edit"; import Edit from "@iconify-icons/ep/edit";
import InformationLine from "@iconify-icons/ri/information-line";
import SetUp from "@iconify-icons/ep/set-up"; import SetUp from "@iconify-icons/ep/set-up";
import TerminalWindowLine from "@iconify-icons/ri/terminal-window-line";
import Guide from "@iconify-icons/ep/guide"; import Guide from "@iconify-icons/ep/guide";
import HomeFilled from "@iconify-icons/ep/home-filled";
import Card from "@iconify-icons/ri/bank-card-line";
import ListCheck from "@iconify-icons/ri/list-check";
import Histogram from "@iconify-icons/ep/histogram";
import Ppt from "@iconify-icons/ri/file-ppt-2-line";
import CheckboxCircleLine from "@iconify-icons/ri/checkbox-circle-line";
import FlUser from "@iconify-icons/ri/admin-line";
import Role from "@iconify-icons/ri/admin-fill";
import Setting from "@iconify-icons/ri/settings-3-line";
import Dept from "@iconify-icons/ri/git-branch-line";
import Search from "@iconify-icons/ri/search-line";
import Lollipop from "@iconify-icons/ep/lollipop";
import Monitor from "@iconify-icons/ep/monitor"; import Monitor from "@iconify-icons/ep/monitor";
import Lollipop from "@iconify-icons/ep/lollipop";
import Histogram from "@iconify-icons/ep/histogram";
import HomeFilled from "@iconify-icons/ep/home-filled";
addIcon("ep:menu", Menu);
addIcon("ep:edit", Edit);
addIcon("ep:set-up", SetUp);
addIcon("ep:guide", Guide);
addIcon("ep:monitor", Monitor);
addIcon("ep:lollipop", Lollipop);
addIcon("ep:histogram", Histogram);
addIcon("ep:home-filled", HomeFilled);
// @iconify-icons/ri
import Tag from "@iconify-icons/ri/bookmark-2-line"; import Tag from "@iconify-icons/ri/bookmark-2-line";
import Table from "@iconify-icons/ri/table-line"; import Ppt from "@iconify-icons/ri/file-ppt-2-line";
import Card from "@iconify-icons/ri/bank-card-line";
import Role from "@iconify-icons/ri/admin-fill";
import Info from "@iconify-icons/ri/file-info-line"; import Info from "@iconify-icons/ri/file-info-line";
import Dept from "@iconify-icons/ri/git-branch-line";
import Table from "@iconify-icons/ri/table-line";
import Links from "@iconify-icons/ri/links-fill";
import Search from "@iconify-icons/ri/search-line";
import FlUser from "@iconify-icons/ri/admin-line";
import Setting from "@iconify-icons/ri/settings-3-line";
import MindMap from "@iconify-icons/ri/mind-map";
import BarChart from "@iconify-icons/ri/bar-chart-horizontal-line";
import LoginLog from "@iconify-icons/ri/window-line";
import Artboard from "@iconify-icons/ri/artboard-line"; import Artboard from "@iconify-icons/ri/artboard-line";
addIcon("ubuntuFill", UbuntuFill); import SystemLog from "@iconify-icons/ri/file-search-line";
addIcon("menu", Menu); import ListCheck from "@iconify-icons/ri/list-check";
addIcon("edit", Edit); import UbuntuFill from "@iconify-icons/ri/ubuntu-fill";
addIcon("informationLine", InformationLine); import OnlineUser from "@iconify-icons/ri/user-voice-line";
addIcon("setUp", SetUp); import EditBoxLine from "@iconify-icons/ri/edit-box-line";
addIcon("terminalWindowLine", TerminalWindowLine); import OperationLog from "@iconify-icons/ri/history-fill";
addIcon("guide", Guide); import InformationLine from "@iconify-icons/ri/information-line";
addIcon("homeFilled", HomeFilled); import TerminalWindowLine from "@iconify-icons/ri/terminal-window-line";
addIcon("card", Card); import CheckboxCircleLine from "@iconify-icons/ri/checkbox-circle-line";
addIcon("listCheck", ListCheck); addIcon("ri:bookmark-2-line", Tag);
addIcon("histogram", Histogram); addIcon("ri:file-ppt-2-line", Ppt);
addIcon("ppt", Ppt); addIcon("ri:bank-card-line", Card);
addIcon("checkboxCircleLine", CheckboxCircleLine); addIcon("ri:admin-fill", Role);
addIcon("flUser", FlUser); addIcon("ri:file-info-line", Info);
addIcon("role", Role); addIcon("ri:git-branch-line", Dept);
addIcon("setting", Setting); addIcon("ri:links-fill", Links);
addIcon("dept", Dept); addIcon("ri:table-line", Table);
addIcon("search", Search); addIcon("ri:search-line", Search);
addIcon("lollipop", Lollipop); addIcon("ri:admin-line", FlUser);
addIcon("monitor", Monitor); addIcon("ri:settings-3-line", Setting);
addIcon("tag", Tag); addIcon("ri:mind-map", MindMap);
addIcon("table", Table); addIcon("ri:bar-chart-horizontal-line", BarChart);
addIcon("info", Info); addIcon("ri:window-line", LoginLog);
addIcon("artboard", Artboard); addIcon("ri:file-search-line", SystemLog);
addIcon("ri:artboard-line", Artboard);
addIcon("ri:list-check", ListCheck);
addIcon("ri:ubuntu-fill", UbuntuFill);
addIcon("ri:user-voice-line", OnlineUser);
addIcon("ri:edit-box-line", EditBoxLine);
addIcon("ri:history-fill", OperationLog);
addIcon("ri:information-line", InformationLine);
addIcon("ri:terminal-window-line", TerminalWindowLine);
addIcon("ri:checkbox-circle-line", CheckboxCircleLine);

View File

@ -1,5 +1,15 @@
import Sortable from "sortablejs";
import { transformI18n } from "@/plugins/i18n";
import { useEpThemeStoreHook } from "@/store/modules/epTheme"; import { useEpThemeStoreHook } from "@/store/modules/epTheme";
import { defineComponent, ref, computed, type PropType, nextTick } from "vue"; import {
type PropType,
ref,
unref,
computed,
nextTick,
defineComponent,
getCurrentInstance
} from "vue";
import { import {
delay, delay,
cloneDeep, cloneDeep,
@ -8,7 +18,6 @@ import {
getKeyList getKeyList
} from "@pureadmin/utils"; } from "@pureadmin/utils";
import Sortable from "sortablejs";
import DragIcon from "./svg/drag.svg?component"; import DragIcon from "./svg/drag.svg?component";
import ExpandIcon from "./svg/expand.svg?component"; import ExpandIcon from "./svg/expand.svg?component";
import RefreshIcon from "./svg/refresh.svg?component"; import RefreshIcon from "./svg/refresh.svg?component";
@ -29,6 +38,14 @@ const props = {
columns: { columns: {
type: Array as PropType<TableColumnList>, type: Array as PropType<TableColumnList>,
default: () => [] default: () => []
},
isExpandAll: {
type: Boolean,
default: true
},
tableKey: {
type: [String, Number] as PropType<string | number>,
default: "0"
} }
}; };
@ -37,12 +54,12 @@ export default defineComponent({
props, props,
emits: ["refresh"], emits: ["refresh"],
setup(props, { emit, slots, attrs }) { setup(props, { emit, slots, attrs }) {
const buttonRef = ref();
const size = ref("default"); const size = ref("default");
const isExpandAll = ref(true);
const loading = ref(false); const loading = ref(false);
const checkAll = ref(true); const checkAll = ref(true);
const isIndeterminate = ref(false); const isIndeterminate = ref(false);
const instance = getCurrentInstance()!;
const isExpandAll = ref(props.isExpandAll);
const filterColumns = cloneDeep(props?.columns).filter(column => const filterColumns = cloneDeep(props?.columns).filter(column =>
isBoolean(column?.hide) isBoolean(column?.hide)
? !column.hide ? !column.hide
@ -115,6 +132,7 @@ export default defineComponent({
} }
function handleCheckedColumnsChange(value: string[]) { function handleCheckedColumnsChange(value: string[]) {
checkedColumns.value = value;
const checkedCount = value.length; const checkedCount = value.length;
checkAll.value = checkedCount === checkColumnList.length; checkAll.value = checkedCount === checkColumnList.length;
isIndeterminate.value = isIndeterminate.value =
@ -122,7 +140,9 @@ export default defineComponent({
} }
function handleCheckColumnListChange(val: boolean, label: string) { function handleCheckColumnListChange(val: boolean, label: string) {
dynamicColumns.value.filter(item => item.label === label)[0].hide = !val; dynamicColumns.value.filter(
item => transformI18n(item.label) === transformI18n(label)
)[0].hide = !val;
} }
async function onReset() { async function onReset() {
@ -163,9 +183,9 @@ export default defineComponent({
const rowDrop = (event: { preventDefault: () => void }) => { const rowDrop = (event: { preventDefault: () => void }) => {
event.preventDefault(); event.preventDefault();
nextTick(() => { nextTick(() => {
const wrapper: HTMLElement = document.querySelector( const wrapper: HTMLElement = (
".el-checkbox-group>div" instance?.proxy?.$refs[`GroupRef${unref(props.tableKey)}`] as any
); ).$el.firstElementChild;
Sortable.create(wrapper, { Sortable.create(wrapper, {
animation: 300, animation: 300,
handle: ".drag-btn", handle: ".drag-btn",
@ -195,16 +215,29 @@ export default defineComponent({
}; };
const isFixedColumn = (label: string) => { const isFixedColumn = (label: string) => {
return dynamicColumns.value.filter(item => item.label === label)[0].fixed return dynamicColumns.value.filter(
item => transformI18n(item.label) === transformI18n(label)
)[0].fixed
? true ? true
: false; : false;
}; };
const rendTippyProps = (content: string) => {
// https://vue-tippy.netlify.app/props
return {
content,
offset: [0, 18],
duration: [300, 0],
followCursor: true,
hideOnClick: "toggle"
};
};
const reference = { const reference = {
reference: () => ( reference: () => (
<SettingIcon <SettingIcon
class={["w-[16px]", iconClass.value]} class={["w-[16px]", iconClass.value]}
onMouseover={e => (buttonRef.value = e.currentTarget)} v-tippy={rendTippyProps("列设置")}
/> />
) )
}; };
@ -224,38 +257,36 @@ export default defineComponent({
) : null} ) : null}
{props.tableRef?.size ? ( {props.tableRef?.size ? (
<> <>
<el-tooltip <ExpandIcon
effect="dark" class={["w-[16px]", iconClass.value]}
content={isExpandAll.value ? "折叠" : "展开"} style={{
placement="top" transform: isExpandAll.value ? "none" : "rotate(-90deg)"
> }}
<ExpandIcon v-tippy={rendTippyProps(
class={["w-[16px]", iconClass.value]} isExpandAll.value ? "折叠" : "展开"
style={{ )}
transform: isExpandAll.value ? "none" : "rotate(-90deg)" onClick={() => onExpand()}
}} />
onClick={() => onExpand()}
/>
</el-tooltip>
<el-divider direction="vertical" /> <el-divider direction="vertical" />
</> </>
) : null} ) : null}
<el-tooltip effect="dark" content="刷新" placement="top"> <RefreshIcon
<RefreshIcon class={[
class={[ "w-[16px]",
"w-[16px]", iconClass.value,
iconClass.value, loading.value ? "animate-spin" : ""
loading.value ? "animate-spin" : "" ]}
]} v-tippy={rendTippyProps("刷新")}
onClick={() => onReFresh()} onClick={() => onReFresh()}
/> />
</el-tooltip>
<el-divider direction="vertical" /> <el-divider direction="vertical" />
<el-tooltip effect="dark" content="密度" placement="top"> <el-dropdown
<el-dropdown v-slots={dropdown} trigger="click"> v-slots={dropdown}
<CollapseIcon class={["w-[16px]", iconClass.value]} /> trigger="click"
</el-dropdown> v-tippy={rendTippyProps("密度")}
</el-tooltip> >
<CollapseIcon class={["w-[16px]", iconClass.value]} />
</el-dropdown>
<el-divider direction="vertical" /> <el-divider direction="vertical" />
<el-popover <el-popover
@ -281,7 +312,8 @@ export default defineComponent({
<div class="pt-[6px] pl-[11px]"> <div class="pt-[6px] pl-[11px]">
<el-scrollbar max-height="36vh"> <el-scrollbar max-height="36vh">
<el-checkbox-group <el-checkbox-group
v-model={checkedColumns.value} ref={`GroupRef${unref(props.tableKey)}`}
modelValue={checkedColumns.value}
onChange={value => handleCheckedColumnsChange(value)} onChange={value => handleCheckedColumnsChange(value)}
> >
<el-space <el-space
@ -289,7 +321,7 @@ export default defineComponent({
alignment="flex-start" alignment="flex-start"
size={0} size={0}
> >
{checkColumnList.map(item => { {checkColumnList.map((item, index) => {
return ( return (
<div class="flex items-center"> <div class="flex items-center">
<DragIcon <DragIcon
@ -304,17 +336,18 @@ export default defineComponent({
}) => rowDrop(event)} }) => rowDrop(event)}
/> />
<el-checkbox <el-checkbox
key={item} key={index}
label={item} label={item}
value={item}
onChange={value => onChange={value =>
handleCheckColumnListChange(value, item) handleCheckColumnListChange(value, item)
} }
> >
<span <span
title={item} title={transformI18n(item)}
class="inline-block w-[120px] truncate hover:text-text_color_primary" class="inline-block w-[120px] truncate hover:text-text_color_primary"
> >
{item} {transformI18n(item)}
</span> </span>
</el-checkbox> </el-checkbox>
</div> </div>
@ -326,25 +359,6 @@ export default defineComponent({
</div> </div>
</el-popover> </el-popover>
</div> </div>
<el-tooltip
popper-options={{
modifiers: [
{
name: "computeStyles",
options: {
adaptive: false,
enabled: false
}
}
]
}}
placement="top"
virtual-ref={buttonRef.value}
virtual-triggering
trigger="hover"
content="列设置"
/>
</div> </div>
{slots.default({ {slots.default({
size: size.value, size: size.value,

View File

@ -1,10 +1,10 @@
import { import {
type PropType,
ref, ref,
unref, unref,
watch, watch,
nextTick, nextTick,
computed, computed,
type PropType,
defineComponent defineComponent
} from "vue"; } from "vue";
import "./index.scss"; import "./index.scss";

View File

@ -1,6 +1,12 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, ref, unref, nextTick } from "vue"; import {
import type { CSSProperties, PropType } from "vue"; type PropType,
type CSSProperties,
ref,
unref,
nextTick,
computed
} from "vue";
import { import {
tryOnMounted, tryOnMounted,
tryOnUnmounted, tryOnUnmounted,
@ -301,7 +307,7 @@ function touchMove(e) {
function touchEnd() { function touchEnd() {
if (!unref(canTouchScroll)) return; if (!unref(canTouchScroll)) return;
// eslint-disable-next-line prefer-const
let timer: any; let timer: any;
const direction = unref(options).direction; const direction = unref(options).direction;
delay.value = 50; delay.value = 50;

View File

@ -60,14 +60,12 @@ export function copyObj() {
copyIsArray, copyIsArray,
clone, clone,
i = 1, i = 1,
// eslint-disable-next-line prefer-rest-params
target = arguments[0] || {}, // 使用||运算符排除隐式强制类型转换为false的数据类型 target = arguments[0] || {}, // 使用||运算符排除隐式强制类型转换为false的数据类型
deep = false, deep = false,
// eslint-disable-next-line prefer-const
len = arguments.length; len = arguments.length;
if (typeof target === "boolean") { if (typeof target === "boolean") {
deep = target; deep = target;
// eslint-disable-next-line prefer-rest-params
target = arguments[1] || {}; target = arguments[1] || {};
i++; i++;
} }
@ -80,7 +78,7 @@ export function copyObj() {
} }
for (; i < len; i++) { for (; i < len; i++) {
//所以如果源对象中数据类型为Undefined或Null那么就会跳过本次循环接着循环下一个源对象 //所以如果源对象中数据类型为Undefined或Null那么就会跳过本次循环接着循环下一个源对象
// eslint-disable-next-line prefer-rest-params
if ((options = arguments[i]) != null) { if ((options = arguments[i]) != null) {
// 如果遇到源对象的数据类型为Boolean, Number for in循环会被跳过不执行for in循环// src用于判断target对象是否存在name属性 // 如果遇到源对象的数据类型为Boolean, Number for in循环会被跳过不执行for in循环// src用于判断target对象是否存在name属性
for (name in options) { for (name in options) {

View File

@ -1,11 +1,104 @@
.pure-segmented { .pure-segmented {
--pure-control-padding-horizontal: 12px;
--pure-control-padding-horizontal-sm: 8px;
--pure-segmented-track-padding: 2px;
--pure-segmented-line-width: 1px;
--pure-segmented-border-radius-small: 4px;
--pure-segmented-border-radius-base: 6px;
--pure-segmented-border-radius-large: 8px;
box-sizing: border-box; box-sizing: border-box;
display: inline-block; display: inline-block;
padding: 2px; padding: var(--pure-segmented-track-padding);
font-size: 14px; font-size: var(--el-font-size-base);
color: rgba(0, 0, 0, 0.65); color: rgba(0, 0, 0, 0.65);
background-color: rgb(0 0 0 / 4%); background-color: rgb(0 0 0 / 4%);
border-radius: 2px; border-radius: var(--pure-segmented-border-radius-base);
}
.pure-segmented-block {
display: flex;
}
.pure-segmented-block .pure-segmented-item {
flex: 1;
min-width: 0;
}
.pure-segmented-block .pure-segmented-item > .pure-segmented-item-label > span {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
/* small */
.pure-segmented.pure-segmented--small {
border-radius: var(--pure-segmented-border-radius-small);
}
.pure-segmented.pure-segmented--small .pure-segmented-item {
border-radius: var(--el-border-radius-small);
}
.pure-segmented.pure-segmented--small .pure-segmented-item > div {
min-height: calc(
var(--el-component-size-small) - var(--pure-segmented-track-padding) * 2
);
line-height: calc(
var(--el-component-size-small) - var(--pure-segmented-track-padding) * 2
);
padding: 0
calc(
var(--pure-control-padding-horizontal-sm) -
var(--pure-segmented-line-width)
);
}
/* large */
.pure-segmented.pure-segmented--large {
border-radius: var(--pure-segmented-border-radius-large);
}
.pure-segmented.pure-segmented--large .pure-segmented-item {
border-radius: calc(
var(--el-border-radius-base) + var(--el-border-radius-small)
);
}
.pure-segmented.pure-segmented--large .pure-segmented-item > div {
min-height: calc(
var(--el-component-size-large) - var(--pure-segmented-track-padding) * 2
);
line-height: calc(
var(--el-component-size-large) - var(--pure-segmented-track-padding) * 2
);
padding: 0
calc(
var(--pure-control-padding-horizontal) - var(--pure-segmented-line-width)
);
font-size: var(--el-font-size-medium);
}
/* default */
.pure-segmented-item {
position: relative;
text-align: center;
cursor: pointer;
border-radius: var(--el-border-radius-base);
transition: all 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);
}
.pure-segmented .pure-segmented-item > div {
min-height: calc(
var(--el-component-size) - var(--pure-segmented-track-padding) * 2
);
line-height: calc(
var(--el-component-size) - var(--pure-segmented-track-padding) * 2
);
padding: 0
calc(
var(--pure-control-padding-horizontal) - var(--pure-segmented-line-width)
);
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
transition: 0.1s;
} }
.pure-segmented-group { .pure-segmented-group {
@ -37,23 +130,6 @@
will-change: transform, width; will-change: transform, width;
} }
.pure-segmented-item {
position: relative;
text-align: center;
cursor: pointer;
border-radius: 4px;
transition: all 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);
}
.pure-segmented-item > div {
min-height: 28px;
line-height: 28px;
padding: 0 11px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.pure-segmented-item > input { .pure-segmented-item > input {
position: absolute; position: absolute;
inset-block-start: 0; inset-block-start: 0;
@ -67,6 +143,7 @@
.pure-segmented-item-label { .pure-segmented-item-label {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center;
} }
.pure-segmented-item-icon svg { .pure-segmented-item-icon svg {

View File

@ -1,5 +1,14 @@
import "./index.css"; import "./index.css";
import type { OptionsType } from "./type";
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
import { import {
useDark,
isNumber,
isFunction,
useResizeObserver
} from "@pureadmin/utils";
import {
type PropType,
h, h,
ref, ref,
toRef, toRef,
@ -8,9 +17,6 @@ import {
defineComponent, defineComponent,
getCurrentInstance getCurrentInstance
} from "vue"; } from "vue";
import type { OptionsType } from "./type";
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
import { isFunction, isNumber, useDark } from "@pureadmin/utils";
const props = { const props = {
options: { options: {
@ -22,6 +28,25 @@ const props = {
type: undefined, type: undefined,
require: false, require: false,
default: "0" default: "0"
},
/** 将宽度调整为父元素宽度 */
block: {
type: Boolean,
default: false
},
/** 控件尺寸 */
size: {
type: String as PropType<"small" | "default" | "large">
},
/** 是否全局禁用,默认 `false` */
disabled: {
type: Boolean,
default: false
},
/** 当内容发生变化时,设置 `resize` 可使其自适应容器位置 */
resize: {
type: Boolean,
default: false
} }
}; };
@ -42,7 +67,7 @@ export default defineComponent({
: ref(0); : ref(0);
function handleChange({ option, index }, event: Event) { function handleChange({ option, index }, event: Event) {
if (option.disabled) return; if (props.disabled || option.disabled) return;
event.preventDefault(); event.preventDefault();
isNumber(props.modelValue) isNumber(props.modelValue)
? emit("update:modelValue", index) ? emit("update:modelValue", index)
@ -52,6 +77,7 @@ export default defineComponent({
} }
function handleMouseenter({ option, index }, event: Event) { function handleMouseenter({ option, index }, event: Event) {
if (props.disabled) return;
event.preventDefault(); event.preventDefault();
curMouseActive.value = index; curMouseActive.value = index;
if (option.disabled || curIndex.value === index) { if (option.disabled || curIndex.value === index) {
@ -64,6 +90,7 @@ export default defineComponent({
} }
function handleMouseleave(_, event: Event) { function handleMouseleave(_, event: Event) {
if (props.disabled) return;
event.preventDefault(); event.preventDefault();
curMouseActive.value = -1; curMouseActive.value = -1;
} }
@ -71,12 +98,23 @@ export default defineComponent({
function handleInit(index = curIndex.value) { function handleInit(index = curIndex.value) {
nextTick(() => { nextTick(() => {
const curLabelRef = instance?.proxy?.$refs[`labelRef${index}`] as ElRef; const curLabelRef = instance?.proxy?.$refs[`labelRef${index}`] as ElRef;
if (!curLabelRef) return;
width.value = curLabelRef.clientWidth; width.value = curLabelRef.clientWidth;
translateX.value = curLabelRef.offsetLeft; translateX.value = curLabelRef.offsetLeft;
initStatus.value = true; initStatus.value = true;
}); });
} }
function handleResizeInit() {
useResizeObserver(".pure-segmented", () => {
nextTick(() => {
handleInit(curIndex.value);
});
});
}
(props.block || props.resize) && handleResizeInit();
watch( watch(
() => curIndex.value, () => curIndex.value,
index => { index => {
@ -85,11 +123,12 @@ export default defineComponent({
}); });
}, },
{ {
deep: true,
immediate: true immediate: true
} }
); );
watch(() => props.size, handleResizeInit);
const rendLabel = () => { const rendLabel = () => {
return props.options.map((option, index) => { return props.options.map((option, index) => {
return ( return (
@ -97,14 +136,16 @@ export default defineComponent({
ref={`labelRef${index}`} ref={`labelRef${index}`}
class={[ class={[
"pure-segmented-item", "pure-segmented-item",
option?.disabled && "pure-segmented-item-disabled" (props.disabled || option?.disabled) &&
"pure-segmented-item-disabled"
]} ]}
style={{ style={{
background: background:
curMouseActive.value === index ? segmentedItembg.value : "", curMouseActive.value === index ? segmentedItembg.value : "",
color: color: props.disabled
!option.disabled && ? null
(curIndex.value === index || curMouseActive.value === index) : !option.disabled &&
(curIndex.value === index || curMouseActive.value === index)
? isDark.value ? isDark.value
? "rgba(255, 255, 255, 0.85)" ? "rgba(255, 255, 255, 0.85)"
: "rgba(0,0,0,.88)" : "rgba(0,0,0,.88)"
@ -148,7 +189,14 @@ export default defineComponent({
}; };
return () => ( return () => (
<div class="pure-segmented"> <div
class={{
"pure-segmented": true,
"pure-segmented-block": props.block,
"pure-segmented--large": props.size === "large",
"pure-segmented--small": props.size === "small"
}}
>
<div class="pure-segmented-group"> <div class="pure-segmented-group">
<div <div
class="pure-segmented-item-selected" class="pure-segmented-item-selected"

View File

@ -12,7 +12,7 @@ export interface OptionsType {
/** 图标属性、样式配置 */ /** 图标属性、样式配置 */
iconAttrs?: iconType; iconAttrs?: iconType;
/** 值 */ /** 值 */
value?: string | number; value?: any;
/** 是否禁用 */ /** 是否禁用 */
disabled?: boolean; disabled?: boolean;
/** `tooltip` 提示 */ /** `tooltip` 提示 */

View File

@ -1,13 +1,13 @@
import "./index.css";
import { import {
defineComponent, unref,
computed, computed,
nextTick, nextTick,
onBeforeMount, onBeforeMount,
getCurrentInstance, defineComponent,
unref getCurrentInstance
} from "vue"; } from "vue";
import { addClass, removeClass, toggleClass } from "@pureadmin/utils"; import { addClass, removeClass, toggleClass } from "@pureadmin/utils";
import "./index.css";
const stayClass = "stay"; //鼠标点击 const stayClass = "stay"; //鼠标点击
const activeClass = "hs-on"; //鼠标移动上去 const activeClass = "hs-on"; //鼠标移动上去

View File

@ -44,7 +44,6 @@
(t.style.width = 0), (t.style.width = 0),
(t.style.height = 0), (t.style.height = 0),
(t.style.overflow = "hidden"), (t.style.overflow = "hidden"),
// eslint-disable-next-line no-self-assign
(t = t), (t = t),
(e = document.body).firstChild ? m(t, e.firstChild) : e.appendChild(t)); (e = document.body).firstChild ? m(t, e.firstChild) : e.appendChild(t));
}), }),

View File

@ -1,6 +1,6 @@
import { defineComponent, ref, unref, computed, type PropType } from "vue";
import resizer from "./resizer";
import "./index.css"; import "./index.css";
import resizer from "./resizer";
import { type PropType, defineComponent, ref, unref, computed } from "vue";
export interface ContextProps { export interface ContextProps {
minPercent: number; minPercent: number;

View File

@ -1,5 +1,5 @@
import { computed, unref, defineComponent } from "vue";
import "./resizer.css"; import "./resizer.css";
import { computed, unref, defineComponent } from "vue";
export default defineComponent({ export default defineComponent({
name: "Resizer", name: "Resizer",

View File

@ -0,0 +1,7 @@
import reText from "./src/index.vue";
import { withInstall } from "@pureadmin/utils";
/** 支持`Tooltip`提示的文本省略组件 */
export const ReText = withInstall(reText);
export default ReText;

View File

@ -0,0 +1,66 @@
<script lang="ts" setup>
import { h, onMounted, ref, useSlots } from "vue";
import { type TippyOptions, useTippy } from "vue-tippy";
defineOptions({
name: "ReText"
});
const props = defineProps({
//
lineClamp: {
type: [String, Number]
},
tippyProps: {
type: Object as PropType<TippyOptions>,
default: () => ({})
}
});
const $slots = useSlots();
const textRef = ref();
const tippyFunc = ref();
const isTextEllipsis = (el: HTMLElement) => {
if (!props.lineClamp) {
//
return el.scrollWidth > el.clientWidth;
} else {
//
return el.scrollHeight > el.clientHeight;
}
};
const getTippyProps = () => ({
content: h($slots.content || $slots.default),
...props.tippyProps
});
function handleHover(event: MouseEvent) {
if (isTextEllipsis(event.target as HTMLElement)) {
tippyFunc.value.setProps(getTippyProps());
tippyFunc.value.enable();
} else {
tippyFunc.value.disable();
}
}
onMounted(() => {
tippyFunc.value = useTippy(textRef.value?.$el, getTippyProps());
});
</script>
<template>
<el-text
v-bind="{
truncated: !lineClamp,
lineClamp,
...$attrs
}"
ref="textRef"
@mouseover.self="handleHover"
>
<slot />
</el-text>
</template>

View File

@ -1,8 +1,7 @@
// 参考https://www.npmjs.com/package/element-tree-line (主要是替换需要通过函数传参的方式去注册组件并添加更好的类型支持并移除this.$scopedSlots在3.x中,将所有this.$scopedSlots替换为this.$slots) // 参考https://www.npmjs.com/package/element-tree-line (主要是替换需要通过函数传参的方式去注册组件并添加更好的类型支持并移除this.$scopedSlots在3.x中,将所有this.$scopedSlots替换为this.$slots)
import { isFunction } from "@pureadmin/utils";
import { h, defineComponent } from "vue";
import type { PropType } from "vue";
import "./index.scss"; import "./index.scss";
import { isFunction } from "@pureadmin/utils";
import { type PropType, h, defineComponent } from "vue";
import type { import type {
TreeNode, TreeNode,
TreeData, TreeData,

View File

@ -1,44 +1,8 @@
import { h, defineComponent } from "vue"; import typeIt from "./src/index";
import TypeIt from "typeit"; import type { Options as TypeItOptions } from "typeit";
// 打字机效果组件(只是简单的封装下,更多配置项参考 https://www.typeitjs.com/docs/vanilla/usage#options const TypeIt = typeIt;
export default defineComponent({
name: "TypeIt", export { TypeIt, TypeItOptions };
props: {
/** 打字速度,以每一步之间的毫秒数为单位,默认`200` */ export default TypeIt;
speed: {
type: Number,
default: 200
},
values: {
type: Array,
defalut: []
},
className: {
type: String,
default: "type-it"
},
cursor: {
type: Boolean,
default: true
}
},
render() {
return h(
"span",
{
class: this.className
},
{
default: () => []
}
);
},
mounted() {
new TypeIt(`.${this.className}`, {
strings: this.values,
speed: this.speed,
cursor: this.cursor
}).go();
}
});

View File

@ -0,0 +1,56 @@
import type { El } from "typeit/dist/types";
import TypeIt, { type Options as TypeItOptions } from "typeit";
import { type PropType, ref, defineComponent, onMounted } from "vue";
// 打字机效果组件(配置项详情请查阅 https://www.typeitjs.com/docs/vanilla/usage#options
export default defineComponent({
name: "TypeIt",
props: {
options: {
type: Object as PropType<TypeItOptions>,
default: () => ({}) as TypeItOptions
}
},
setup(props, { slots, expose }) {
/**
*
* @param message
*/
function throwError(message: string) {
throw new TypeError(message);
}
/**
*
*/
function getBrowserLanguage() {
return navigator.language;
}
const typedItRef = ref<Element | null>(null);
onMounted(() => {
const $typed = typedItRef.value!.querySelector(".type-it") as El;
if (!$typed) {
const errorMsg =
getBrowserLanguage() === "zh-CN"
? "请确保有且只有一个具有class属性为 'type-it' 的元素"
: "Please make sure that there is only one element with a Class attribute with 'type-it'";
throwError(errorMsg);
}
const typeIt = new TypeIt($typed, props.options).go();
expose({
typeIt
});
});
return () => (
<div ref={typedItRef}>
{slots.default?.() ?? <span class="type-it"></span>}
</div>
);
}
});

View File

@ -1,5 +1,5 @@
import type { App } from "vue";
import axios from "axios"; import axios from "axios";
import type { App } from "vue";
let config: object = {}; let config: object = {};
const { VITE_PUBLIC_PATH } = import.meta.env; const { VITE_PUBLIC_PATH } = import.meta.env;
@ -35,7 +35,7 @@ export const getPlatformConfig = async (app: App): Promise<undefined> => {
}) })
.then(({ data: config }) => { .then(({ data: config }) => {
let $config = app.config.globalProperties.$config; let $config = app.config.globalProperties.$config;
// 自动注入项目配置 // 自动注入系统配置
if (app && $config && typeof config === "object") { if (app && $config && typeof config === "object") {
$config = Object.assign($config, config); $config = Object.assign($config, config);
app.config.globalProperties.$config = $config; app.config.globalProperties.$config = $config;

View File

@ -2,3 +2,4 @@ export * from "./auth";
export * from "./copy"; export * from "./copy";
export * from "./longpress"; export * from "./longpress";
export * from "./optimize"; export * from "./optimize";
export * from "./ripple";

View File

@ -1,9 +1,9 @@
import { import {
isFunction,
isObject,
isArray, isArray,
throttle,
debounce, debounce,
throttle isObject,
isFunction
} from "@pureadmin/utils"; } from "@pureadmin/utils";
import { useEventListener } from "@vueuse/core"; import { useEventListener } from "@vueuse/core";
import type { Directive, DirectiveBinding } from "vue"; import type { Directive, DirectiveBinding } from "vue";

View File

@ -0,0 +1,48 @@
/* stylelint-disable-next-line scss/dollar-variable-colon-space-after */
$ripple-animation-transition-in:
transform 0.4s cubic-bezier(0, 0, 0.2, 1),
opacity 0.2s cubic-bezier(0, 0, 0.2, 1) !default;
$ripple-animation-transition-out: opacity 0.5s cubic-bezier(0, 0, 0.2, 1) !default;
$ripple-animation-visible-opacity: 0.25 !default;
.v-ripple {
&__container {
position: absolute;
top: 0;
left: 0;
z-index: 0;
width: 100%;
height: 100%;
overflow: hidden;
pointer-events: none;
border-radius: inherit;
contain: strict;
}
&__animation {
position: absolute;
top: 0;
left: 0;
overflow: hidden;
pointer-events: none;
background: currentcolor;
border-radius: 50%;
opacity: 0;
will-change: transform, opacity;
&--enter {
opacity: 0;
transition: none;
}
&--in {
opacity: $ripple-animation-visible-opacity;
transition: $ripple-animation-transition-in;
}
&--out {
opacity: 0;
transition: $ripple-animation-transition-out;
}
}
}

View File

@ -0,0 +1,234 @@
import "./index.scss";
import { isObject } from "@pureadmin/utils";
import type { Directive, DirectiveBinding } from "vue";
interface RippleOptions {
class?: string;
center?: boolean;
circle?: boolean;
}
export interface RippleDirectiveBinding
extends Omit<DirectiveBinding, "modifiers" | "value"> {
value?: boolean | { class: string };
modifiers: {
center?: boolean;
circle?: boolean;
};
}
function transform(el: HTMLElement, value: string) {
el.style.transform = value;
el.style.webkitTransform = value;
}
const calculate = (
e: PointerEvent,
el: HTMLElement,
value: RippleOptions = {}
) => {
const offset = el.getBoundingClientRect();
// 获取点击位置距离 el 的垂直和水平距离
let localX = e.clientX - offset.left;
let localY = e.clientY - offset.top;
let radius = 0;
let scale = 0.3;
// 计算点击位置到 el 顶点最远距离,即为圆的最大半径(勾股定理)
if (el._ripple?.circle) {
scale = 0.15;
radius = el.clientWidth / 2;
radius = value.center
? radius
: radius + Math.sqrt((localX - radius) ** 2 + (localY - radius) ** 2) / 4;
} else {
radius = Math.sqrt(el.clientWidth ** 2 + el.clientHeight ** 2) / 2;
}
// 中心点坐标
const centerX = `${(el.clientWidth - radius * 2) / 2}px`;
const centerY = `${(el.clientHeight - radius * 2) / 2}px`;
// 点击位置坐标
const x = value.center ? centerX : `${localX - radius}px`;
const y = value.center ? centerY : `${localY - radius}px`;
return { radius, scale, x, y, centerX, centerY };
};
const ripples = {
show(e: PointerEvent, el: HTMLElement, value: RippleOptions = {}) {
if (!el?._ripple?.enabled) {
return;
}
// 创建 ripple 元素和 ripple 父元素
const container = document.createElement("span");
const animation = document.createElement("span");
container.appendChild(animation);
container.className = "v-ripple__container";
if (value.class) {
container.className += ` ${value.class}`;
}
const { radius, scale, x, y, centerX, centerY } = calculate(e, el, value);
// ripple 圆大小
const size = `${radius * 2}px`;
animation.className = "v-ripple__animation";
animation.style.width = size;
animation.style.height = size;
el.appendChild(container);
// 获取目标元素样式表
const computed = window.getComputedStyle(el);
// 防止 position 被覆盖导致 ripple 位置有问题
if (computed && computed.position === "static") {
el.style.position = "relative";
el.dataset.previousPosition = "static";
}
animation.classList.add("v-ripple__animation--enter");
animation.classList.add("v-ripple__animation--visible");
transform(
animation,
`translate(${x}, ${y}) scale3d(${scale},${scale},${scale})`
);
animation.dataset.activated = String(performance.now());
setTimeout(() => {
animation.classList.remove("v-ripple__animation--enter");
animation.classList.add("v-ripple__animation--in");
transform(animation, `translate(${centerX}, ${centerY}) scale3d(1,1,1)`);
}, 0);
},
hide(el: HTMLElement | null) {
if (!el?._ripple?.enabled) return;
const ripples = el.getElementsByClassName("v-ripple__animation");
if (ripples.length === 0) return;
const animation = ripples[ripples.length - 1] as HTMLElement;
if (animation.dataset.isHiding) return;
else animation.dataset.isHiding = "true";
const diff = performance.now() - Number(animation.dataset.activated);
const delay = Math.max(250 - diff, 0);
setTimeout(() => {
animation.classList.remove("v-ripple__animation--in");
animation.classList.add("v-ripple__animation--out");
setTimeout(() => {
const ripples = el.getElementsByClassName("v-ripple__animation");
if (ripples.length === 1 && el.dataset.previousPosition) {
el.style.position = el.dataset.previousPosition;
delete el.dataset.previousPosition;
}
if (animation.parentNode?.parentNode === el)
el.removeChild(animation.parentNode);
}, 300);
}, delay);
}
};
function isRippleEnabled(value: any): value is true {
return typeof value === "undefined" || !!value;
}
function rippleShow(e: PointerEvent) {
const value: RippleOptions = {};
const element = e.currentTarget as HTMLElement | undefined;
if (!element?._ripple || element._ripple.touched) return;
value.center = element._ripple.centered;
if (element._ripple.class) {
value.class = element._ripple.class;
}
ripples.show(e, element, value);
}
function rippleHide(e: Event) {
const element = e.currentTarget as HTMLElement | null;
if (!element?._ripple) return;
window.setTimeout(() => {
if (element._ripple) {
element._ripple.touched = false;
}
});
ripples.hide(element);
}
function updateRipple(
el: HTMLElement,
binding: RippleDirectiveBinding,
wasEnabled: boolean
) {
const { value, modifiers } = binding;
const enabled = isRippleEnabled(value);
if (!enabled) {
ripples.hide(el);
}
el._ripple = el._ripple ?? {};
el._ripple.enabled = enabled;
el._ripple.centered = modifiers.center;
el._ripple.circle = modifiers.circle;
if (isObject(value) && value.class) {
el._ripple.class = value.class;
}
if (enabled && !wasEnabled) {
el.addEventListener("pointerdown", rippleShow);
el.addEventListener("pointerup", rippleHide);
} else if (!enabled && wasEnabled) {
removeListeners(el);
}
}
function removeListeners(el: HTMLElement) {
el.removeEventListener("pointerdown", rippleShow);
el.removeEventListener("pointerup", rippleHide);
}
function mounted(el: HTMLElement, binding: RippleDirectiveBinding) {
updateRipple(el, binding, false);
}
function unmounted(el: HTMLElement) {
delete el._ripple;
removeListeners(el);
}
function updated(el: HTMLElement, binding: RippleDirectiveBinding) {
if (binding.value === binding.oldValue) {
return;
}
const wasEnabled = isRippleEnabled(binding.oldValue);
updateRipple(el, binding, wasEnabled);
}
/**
* @description v-ripple
* @use
* 1. v-ripple ripple
* 2. v-ripple="{ class: 'text-red' }" ripple tailwindcss color
* 3. v-ripple.center
*/
export const Ripple: Directive = {
mounted,
unmounted,
updated
};

View File

@ -1,6 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { useI18n } from "vue-i18n";
import Footer from "./footer/index.vue"; import Footer from "./footer/index.vue";
import { useGlobal } from "@pureadmin/utils"; import { useGlobal, isNumber } from "@pureadmin/utils";
import KeepAliveFrame from "./keepAliveFrame/index.vue"; import KeepAliveFrame from "./keepAliveFrame/index.vue";
import backTop from "@/assets/svg/back_top.svg?component"; import backTop from "@/assets/svg/back_top.svg?component";
import { h, computed, Transition, defineComponent } from "vue"; import { h, computed, Transition, defineComponent } from "vue";
@ -10,6 +11,7 @@ const props = defineProps({
fixedHeader: Boolean fixedHeader: Boolean
}); });
const { t } = useI18n();
const { $storage, $config } = useGlobal<GlobalPropertiesApi>(); const { $storage, $config } = useGlobal<GlobalPropertiesApi>();
const isKeepAlive = computed(() => { const isKeepAlive = computed(() => {
@ -30,16 +32,28 @@ const hideFooter = computed(() => {
return $storage?.configure.hideFooter; return $storage?.configure.hideFooter;
}); });
const stretch = computed(() => {
return $storage?.configure.stretch;
});
const layout = computed(() => { const layout = computed(() => {
return $storage?.layout.layout === "vertical"; return $storage?.layout.layout === "vertical";
}); });
const getMainWidth = computed(() => {
return isNumber(stretch.value)
? stretch.value + "px"
: stretch.value
? "1440px"
: "100%";
});
const getSectionStyle = computed(() => { const getSectionStyle = computed(() => {
return [ return [
hideTabs.value && layout ? "padding-top: 48px;" : "", hideTabs.value && layout ? "padding-top: 48px;" : "",
!hideTabs.value && layout ? "padding-top: 85px;" : "", !hideTabs.value && layout ? "padding-top: 81px;" : "",
hideTabs.value && !layout.value ? "padding-top: 48px;" : "", hideTabs.value && !layout.value ? "padding-top: 48px;" : "",
!hideTabs.value && !layout.value ? "padding-top: 85px;" : "", !hideTabs.value && !layout.value ? "padding-top: 81px;" : "",
props.fixedHeader props.fixedHeader
? "" ? ""
: `padding-top: 0;${ : `padding-top: 0;${
@ -96,17 +110,20 @@ const transitionMain = defineComponent({
v-if="props.fixedHeader" v-if="props.fixedHeader"
:wrap-style="{ :wrap-style="{
display: 'flex', display: 'flex',
'flex-wrap': 'wrap' 'flex-wrap': 'wrap',
'max-width': getMainWidth,
margin: '0 auto',
transition: 'all 300ms cubic-bezier(0.4, 0, 0.2, 1)'
}" }"
:view-style="{ :view-style="{
display: 'flex', display: 'flex',
flex: 'auto', flex: 'auto',
overflow: 'auto', overflow: 'hidden',
'flex-direction': 'column' 'flex-direction': 'column'
}" }"
> >
<el-backtop <el-backtop
title="回到顶部" :title="t('buttons.pureBackTop')"
target=".app-main .el-scrollbar__wrap" target=".app-main .el-scrollbar__wrap"
> >
<backTop /> <backTop />

View File

@ -5,14 +5,16 @@ const TITLE = getConfig("Title");
</script> </script>
<template> <template>
<footer class="layout-footer"> <footer
MIT © 2020-PRESENT class="layout-footer text-[rgba(0,0,0,0.6)] dark:text-[rgba(220,220,242,0.8)]"
>
Copyright © 2020-present
<a <a
class="ml-1 hover:text-primary" class="hover:text-primary"
href="https://github.com/pure-admin" href="https://github.com/pure-admin"
target="_blank" target="_blank"
> >
{{ TITLE }} &nbsp;{{ TITLE }}
</a> </a>
</footer> </footer>
</template> </template>
@ -24,6 +26,6 @@ const TITLE = getConfig("Title");
justify-content: center; justify-content: center;
width: 100%; width: 100%;
padding: 0 0 8px; padding: 0 0 8px;
color: #c0c4cc; font-size: 14px;
} }
</style> </style>

View File

@ -3,10 +3,12 @@ import Search from "./search/index.vue";
import Notice from "./notice/index.vue"; import Notice from "./notice/index.vue";
import mixNav from "./sidebar/mixNav.vue"; import mixNav from "./sidebar/mixNav.vue";
import { useNav } from "@/layout/hooks/useNav"; import { useNav } from "@/layout/hooks/useNav";
import FullScreen from "./sidebar/fullScreen.vue";
import Breadcrumb from "./sidebar/breadCrumb.vue"; import Breadcrumb from "./sidebar/breadCrumb.vue";
import topCollapse from "./sidebar/topCollapse.vue"; import topCollapse from "./sidebar/topCollapse.vue";
import { useTranslationLang } from "../hooks/useTranslationLang"; import { useTranslationLang } from "../hooks/useTranslationLang";
import globalization from "@/assets/svg/globalization.svg?component"; import globalization from "@/assets/svg/globalization.svg?component";
import AccountSettingsIcon from "@iconify-icons/ri/user-settings-line";
import LogoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line"; import LogoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line";
import Setting from "@iconify-icons/ri/settings-3-line"; import Setting from "@iconify-icons/ri/settings-3-line";
import Check from "@iconify-icons/ep/check"; import Check from "@iconify-icons/ep/check";
@ -21,6 +23,7 @@ const {
userAvatar, userAvatar,
avatarsStyle, avatarsStyle,
toggleSideBar, toggleSideBar,
toAccountSettings,
getDropdownItemStyle, getDropdownItemStyle,
getDropdownItemClass getDropdownItemClass
} = useNav(); } = useNav();
@ -47,8 +50,6 @@ const { t, locale, translationCh, translationEn } = useTranslationLang();
<div v-if="layout === 'vertical'" class="vertical-header-right"> <div v-if="layout === 'vertical'" class="vertical-header-right">
<!-- 菜单搜索 --> <!-- 菜单搜索 -->
<Search id="header-search" /> <Search id="header-search" />
<!-- 通知 -->
<Notice id="header-notice" />
<!-- 国际化 --> <!-- 国际化 -->
<el-dropdown id="header-translation" trigger="click"> <el-dropdown id="header-translation" trigger="click">
<globalization <globalization
@ -81,6 +82,10 @@ const { t, locale, translationCh, translationEn } = useTranslationLang();
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
</el-dropdown> </el-dropdown>
<!-- 全屏 -->
<FullScreen id="full-screen" />
<!-- 消息通知 -->
<Notice id="header-notice" />
<!-- 退出登录 --> <!-- 退出登录 -->
<el-dropdown trigger="click"> <el-dropdown trigger="click">
<span class="el-dropdown-link navbar-bg-hover select-none"> <span class="el-dropdown-link navbar-bg-hover select-none">
@ -89,19 +94,26 @@ const { t, locale, translationCh, translationEn } = useTranslationLang();
</span> </span>
<template #dropdown> <template #dropdown>
<el-dropdown-menu class="logout"> <el-dropdown-menu class="logout">
<el-dropdown-item @click="toAccountSettings">
<IconifyIconOffline
:icon="AccountSettingsIcon"
style="margin: 5px"
/>
{{ t("buttons.pureAccountSettings") }}
</el-dropdown-item>
<el-dropdown-item @click="logout"> <el-dropdown-item @click="logout">
<IconifyIconOffline <IconifyIconOffline
:icon="LogoutCircleRLine" :icon="LogoutCircleRLine"
style="margin: 5px" style="margin: 5px"
/> />
{{ t("buttons.hsLoginOut") }} {{ t("buttons.pureLoginOut") }}
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
</el-dropdown> </el-dropdown>
<span <span
class="set-icon navbar-bg-hover" class="set-icon navbar-bg-hover"
:title="t('buttons.hssystemSet')" :title="t('buttons.pureOpenSystemSet')"
@click="onPanel" @click="onPanel"
> >
<IconifyIconOffline :icon="Setting" /> <IconifyIconOffline :icon="Setting" />
@ -175,7 +187,7 @@ const { t, locale, translationCh, translationEn } = useTranslationLang();
} }
.logout { .logout {
max-width: 120px; width: 120px;
::v-deep(.el-dropdown-menu__item) { ::v-deep(.el-dropdown-menu__item) {
display: inline-flex; display: inline-flex;

View File

@ -4,7 +4,7 @@ export interface ListItem {
datetime: string; datetime: string;
type: string; type: string;
description: string; description: string;
status?: "" | "success" | "warning" | "info" | "danger"; status?: "primary" | "success" | "warning" | "info" | "danger";
extra?: string; extra?: string;
} }

View File

@ -1,9 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import { ref } from "vue";
import { useI18n } from "vue-i18n";
import { noticesData } from "./data"; import { noticesData } from "./data";
import NoticeList from "./noticeList.vue"; import NoticeList from "./noticeList.vue";
import Bell from "@iconify-icons/ep/bell"; import Bell from "@iconify-icons/ep/bell";
const { t } = useI18n();
const noticesNum = ref(0); const noticesNum = ref(0);
const notices = ref(noticesData); const notices = ref(noticesData);
const activeKey = ref(noticesData[0].key); const activeKey = ref(noticesData[0].key);
@ -30,7 +32,7 @@ notices.value.map(v => (noticesNum.value += v.list.length));
> >
<el-empty <el-empty
v-if="notices.length === 0" v-if="notices.length === 0"
description="暂无消息" :description="t('status.pureNoMessage')"
:image-size="60" :image-size="60"
/> />
<span v-else> <span v-else>

View File

@ -1,6 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { PropType } from "vue"; import { PropType } from "vue";
import { ListItem } from "./data"; import { ListItem } from "./data";
import { useI18n } from "vue-i18n";
import NoticeItem from "./noticeItem.vue"; import NoticeItem from "./noticeItem.vue";
const props = defineProps({ const props = defineProps({
@ -9,6 +10,8 @@ const props = defineProps({
default: () => [] default: () => []
} }
}); });
const { t } = useI18n();
</script> </script>
<template> <template>
@ -19,5 +22,5 @@ const props = defineProps({
:noticeItem="item" :noticeItem="item"
/> />
</div> </div>
<el-empty v-else description="暂无消息" /> <el-empty v-else :description="t('status.pureNoMessage')" />
</template> </template>

View File

@ -1,4 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { useI18n } from "vue-i18n";
import { emitter } from "@/utils/mitt"; import { emitter } from "@/utils/mitt";
import { onClickOutside } from "@vueuse/core"; import { onClickOutside } from "@vueuse/core";
import { ref, computed, onMounted, onBeforeUnmount } from "vue"; import { ref, computed, onMounted, onBeforeUnmount } from "vue";
@ -10,9 +11,12 @@ const show = ref<Boolean>(false);
const iconClass = computed(() => { const iconClass = computed(() => {
return [ return [
"w-[22px]",
"h-[22px]",
"flex",
"justify-center",
"items-center",
"outline-none", "outline-none",
"width-[20px]",
"height-[20px]",
"rounded-[4px]", "rounded-[4px]",
"cursor-pointer", "cursor-pointer",
"transition-colors", "transition-colors",
@ -22,6 +26,7 @@ const iconClass = computed(() => {
]; ];
}); });
const { t } = useI18n();
const { onReset } = useDataThemeChange(); const { onReset } = useDataThemeChange();
onClickOutside(target, (event: any) => { onClickOutside(target, (event: any) => {
@ -42,16 +47,18 @@ onBeforeUnmount(() => {
</script> </script>
<template> <template>
<div :class="{ show: show }" class="right-panel-container"> <div :class="{ show }">
<div class="right-panel-background" /> <div class="right-panel-background" />
<div ref="target" class="right-panel bg-bg_color"> <div ref="target" class="right-panel bg-bg_color">
<div <div
class="project-configuration border-b-[1px] border-solid border-[var(--pure-border-color)]" class="project-configuration border-b-[1px] border-solid border-[var(--pure-border-color)]"
> >
<h4 class="dark:text-white">项目配置</h4> <h4 class="dark:text-white">
{{ t("panel.pureSystemSet") }}
</h4>
<span <span
v-tippy="{ v-tippy="{
content: '关闭配置', content: t('panel.pureCloseSystemSet'),
placement: 'bottom-start', placement: 'bottom-start',
zIndex: 41000 zIndex: 41000
}" }"
@ -59,8 +66,8 @@ onBeforeUnmount(() => {
> >
<IconifyIconOffline <IconifyIconOffline
class="dark:text-white" class="dark:text-white"
width="20px" width="18px"
height="20px" height="18px"
:icon="Close" :icon="Close"
@click="show = !show" @click="show = !show"
/> />
@ -75,7 +82,7 @@ onBeforeUnmount(() => {
> >
<el-button <el-button
v-tippy="{ v-tippy="{
content: '清空缓存并返回登录页', content: t('panel.pureClearCacheAndToLogin'),
placement: 'left-start', placement: 'left-start',
zIndex: 41000 zIndex: 41000
}" }"
@ -84,21 +91,13 @@ onBeforeUnmount(() => {
bg bg
@click="onReset" @click="onReset"
> >
清空缓存 {{ t("panel.pureClearCache") }}
</el-button> </el-button>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<style>
.showright-panel {
position: relative;
width: calc(100% - 15px);
overflow: hidden;
}
</style>
<style lang="scss" scoped> <style lang="scss" scoped>
:deep(.el-scrollbar) { :deep(.el-scrollbar) {
height: calc(100vh - 110px); height: calc(100vh - 110px);
@ -121,7 +120,6 @@ onBeforeUnmount(() => {
z-index: 40000; z-index: 40000;
width: 100%; width: 100%;
max-width: 280px; max-width: 280px;
height: 100vh;
box-shadow: 0 0 15px 0 rgb(0 0 0 / 5%); box-shadow: 0 0 15px 0 rgb(0 0 0 / 5%);
transition: all 0.25s cubic-bezier(0.7, 0.3, 0.1, 1); transition: all 0.25s cubic-bezier(0.7, 0.3, 0.1, 1);
transform: translate(100%); transform: translate(100%);

View File

@ -1,14 +1,16 @@
<script setup lang="ts"> <script setup lang="ts">
import ArrowUpLine from "@iconify-icons/ri/arrow-up-line"; import { useI18n } from "vue-i18n";
import ArrowDownLine from "@iconify-icons/ri/arrow-down-line";
import { useNav } from "@/layout/hooks/useNav"; import { useNav } from "@/layout/hooks/useNav";
import mdiKeyboardEsc from "@/assets/svg/keyboard_esc.svg?component"; import mdiKeyboardEsc from "@/assets/svg/keyboard_esc.svg?component";
import enterOutlined from "@/assets/svg/enter_outlined.svg?component"; import enterOutlined from "@/assets/svg/enter_outlined.svg?component";
import ArrowUpLine from "@iconify-icons/ri/arrow-up-line";
import ArrowDownLine from "@iconify-icons/ri/arrow-down-line";
const props = withDefaults(defineProps<{ total: number }>(), { const props = withDefaults(defineProps<{ total: number }>(), {
total: 0 total: 0
}); });
const { t } = useI18n();
const { device } = useNav(); const { device } = useNav();
</script> </script>
@ -16,22 +18,22 @@ const { device } = useNav();
<div class="search-footer text-[#333] dark:text-white"> <div class="search-footer text-[#333] dark:text-white">
<span class="search-footer-item"> <span class="search-footer-item">
<enterOutlined class="icon" /> <enterOutlined class="icon" />
确认 {{ t("buttons.pureConfirm") }}
</span> </span>
<span class="search-footer-item"> <span class="search-footer-item">
<IconifyIconOffline :icon="ArrowUpLine" class="icon" /> <IconifyIconOffline :icon="ArrowUpLine" class="icon" />
<IconifyIconOffline :icon="ArrowDownLine" class="icon" /> <IconifyIconOffline :icon="ArrowDownLine" class="icon" />
切换 {{ t("buttons.pureSwitch") }}
</span> </span>
<span class="search-footer-item"> <span class="search-footer-item">
<mdiKeyboardEsc class="icon" /> <mdiKeyboardEsc class="icon" />
关闭 {{ t("buttons.pureClose") }}
</span> </span>
<p <p
v-if="device !== 'mobile' && props.total > 0" v-if="device !== 'mobile' && props.total > 0"
class="search-footer-total" class="search-footer-total"
> >
{{ props.total }} {{ `${t("search.pureTotal")} ${props.total}` }}
</p> </p>
</div> </div>
</template> </template>

View File

@ -0,0 +1,204 @@
<script setup lang="ts">
import Sortable from "sortablejs";
import { useI18n } from "vue-i18n";
import SearchHistoryItem from "./SearchHistoryItem.vue";
import type { optionsItem, dragItem, Props } from "../types";
import { useEpThemeStoreHook } from "@/store/modules/epTheme";
import { useResizeObserver, isArray, delay } from "@pureadmin/utils";
import { ref, watch, nextTick, computed, getCurrentInstance } from "vue";
interface Emits {
(e: "update:value", val: string): void;
(e: "enter"): void;
(e: "collect", val: optionsItem): void;
(e: "delete", val: optionsItem): void;
(e: "drag", val: dragItem): void;
}
const historyRef = ref();
const innerHeight = ref();
/** 判断是否停止鼠标移入事件处理 */
const stopMouseEvent = ref(false);
const { t } = useI18n();
const emit = defineEmits<Emits>();
const instance = getCurrentInstance()!;
const props = withDefaults(defineProps<Props>(), {});
const itemStyle = computed(() => {
return item => {
return {
background:
item?.path === active.value ? useEpThemeStoreHook().epThemeColor : "",
color: item.path === active.value ? "#fff" : "",
fontSize: item.path === active.value ? "16px" : "14px"
};
};
});
const titleStyle = computed(() => {
return {
color: useEpThemeStoreHook().epThemeColor,
fontWeight: 500
};
});
const active = computed({
get() {
return props.value;
},
set(val: string) {
emit("update:value", val);
}
});
watch(
() => props.value,
newValue => {
if (newValue) {
if (stopMouseEvent.value) {
delay(100).then(() => (stopMouseEvent.value = false));
}
}
}
);
const historyList = computed(() => {
return props.options.filter(item => item.type === "history");
});
const collectList = computed(() => {
return props.options.filter(item => item.type === "collect");
});
function handleCollect(item) {
emit("collect", item);
}
function handleDelete(item) {
stopMouseEvent.value = true;
emit("delete", item);
}
/** 鼠标移入 */
async function handleMouse(item) {
if (!stopMouseEvent.value) active.value = item.path;
}
function handleTo() {
emit("enter");
}
function resizeResult() {
// el-scrollbar max-height="calc(90vh - 140px)"
innerHeight.value = window.innerHeight - window.innerHeight / 10 - 140;
}
useResizeObserver(historyRef, resizeResult);
function handleScroll(index: number) {
const curInstance = instance?.proxy?.$refs[`historyItemRef${index}`];
if (!curInstance) return 0;
const curRef = isArray(curInstance)
? (curInstance[0] as ElRef)
: (curInstance as ElRef);
const scrollTop = curRef.offsetTop + 128; // 128 history-item56px+56px=112pxmargin8px+8px=16px
return scrollTop > innerHeight.value ? scrollTop - innerHeight.value : 0;
}
const handleChangeIndex = (evt): void => {
emit("drag", { oldIndex: evt.oldIndex, newIndex: evt.newIndex });
};
let sortableInstance = null;
watch(
collectList,
val => {
if (val.length > 1) {
nextTick(() => {
const wrapper: HTMLElement =
document.querySelector(".collect-container");
if (!wrapper || sortableInstance) return;
sortableInstance = Sortable.create(wrapper, {
animation: 160,
onStart: event => {
event.item.style.cursor = "move";
},
onEnd: event => {
event.item.style.cursor = "pointer";
},
onUpdate: handleChangeIndex
});
resizeResult();
});
}
},
{ deep: true, immediate: true }
);
defineExpose({ handleScroll });
</script>
<template>
<div ref="historyRef" class="history">
<template v-if="historyList.length">
<div :style="titleStyle">
{{ t("search.pureHistory") }}
</div>
<div
v-for="(item, index) in historyList"
:key="item.path"
:ref="'historyItemRef' + index"
class="history-item dark:bg-[#1d1d1d]"
:style="itemStyle(item)"
@click="handleTo"
@mouseenter="handleMouse(item)"
>
<SearchHistoryItem
:item="item"
@delete-item="handleDelete"
@collect-item="handleCollect"
/>
</div>
</template>
<template v-if="collectList.length">
<div :style="titleStyle">
{{
`${t("search.pureCollect")}${collectList.length > 1 ? t("search.pureDragSort") : ""}`
}}
</div>
<div class="collect-container">
<div
v-for="(item, index) in collectList"
:key="item.path"
:ref="'historyItemRef' + (index + historyList.length)"
class="history-item dark:bg-[#1d1d1d]"
:style="itemStyle(item)"
@click="handleTo"
@mouseenter="handleMouse(item)"
>
<SearchHistoryItem :item="item" @delete-item="handleDelete" />
</div>
</div>
</template>
</div>
</template>
<style lang="scss" scoped>
.history {
padding-bottom: 12px;
&-item {
display: flex;
align-items: center;
height: 56px;
padding: 14px;
margin: 8px auto 10px;
cursor: pointer;
border: 0.1px solid #ccc;
border-radius: 4px;
transition: font-size 0.16s;
}
}
</style>

View File

@ -0,0 +1,53 @@
<script setup lang="ts">
import type { optionsItem } from "../types";
import { transformI18n } from "@/plugins/i18n";
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
import Star from "@iconify-icons/ep/star";
import Close from "@iconify-icons/ep/close";
interface Props {
item: optionsItem;
}
interface Emits {
(e: "collectItem", val: optionsItem): void;
(e: "deleteItem", val: optionsItem): void;
}
const emit = defineEmits<Emits>();
withDefaults(defineProps<Props>(), {});
function handleCollect(item) {
emit("collectItem", item);
}
function handleDelete(item) {
emit("deleteItem", item);
}
</script>
<template>
<component :is="useRenderIcon(item.meta?.icon)" />
<span class="history-item-title">
{{ transformI18n(item.meta?.title) }}
</span>
<IconifyIconOffline
v-show="item.type === 'history'"
:icon="Star"
class="w-[18px] h-[18px] mr-2 hover:text-[#d7d5d4]"
@click.stop="handleCollect(item)"
/>
<IconifyIconOffline
:icon="Close"
class="w-[18px] h-[18px] hover:text-[#d7d5d4] cursor-pointer"
@click.stop="handleDelete(item)"
/>
</template>
<style lang="scss" scoped>
.history-item-title {
display: flex;
flex: 1;
margin-left: 5px;
}
</style>

View File

@ -1,15 +1,18 @@
<script setup lang="ts"> <script setup lang="ts">
import { match } from "pinyin-pro"; import { match } from "pinyin-pro";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import { getConfig } from "@/config";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import SearchResult from "./SearchResult.vue"; import SearchResult from "./SearchResult.vue";
import SearchFooter from "./SearchFooter.vue"; import SearchFooter from "./SearchFooter.vue";
import { useNav } from "@/layout/hooks/useNav"; import { useNav } from "@/layout/hooks/useNav";
import { transformI18n } from "@/plugins/i18n"; import SearchHistory from "./SearchHistory.vue";
import { ref, computed, shallowRef } from "vue"; import { transformI18n, $t } from "@/plugins/i18n";
import { cloneDeep, isAllEmpty } from "@pureadmin/utils"; import type { optionsItem, dragItem } from "../types";
import { ref, computed, shallowRef, watch } from "vue";
import { useDebounceFn, onKeyStroke } from "@vueuse/core"; import { useDebounceFn, onKeyStroke } from "@vueuse/core";
import { usePermissionStoreHook } from "@/store/modules/permission"; import { usePermissionStoreHook } from "@/store/modules/permission";
import { cloneDeep, isAllEmpty, storageLocal } from "@pureadmin/utils";
import Search from "@iconify-icons/ri/search-line"; import Search from "@iconify-icons/ri/search-line";
interface Props { interface Props {
@ -24,16 +27,26 @@ interface Emits {
const { device } = useNav(); const { device } = useNav();
const emit = defineEmits<Emits>(); const emit = defineEmits<Emits>();
const props = withDefaults(defineProps<Props>(), {}); const props = withDefaults(defineProps<Props>(), {});
const router = useRouter(); const router = useRouter();
const { locale } = useI18n(); const { t, locale } = useI18n();
const HISTORY_TYPE = "history";
const COLLECT_TYPE = "collect";
const LOCALEHISTORYKEY = "menu-search-history";
const LOCALECOLLECTKEY = "menu-search-collect";
const keyword = ref(""); const keyword = ref("");
const scrollbarRef = ref();
const resultRef = ref(); const resultRef = ref();
const historyRef = ref();
const scrollbarRef = ref();
const activePath = ref(""); const activePath = ref("");
const inputRef = ref<HTMLInputElement | null>(null); const historyPath = ref("");
const resultOptions = shallowRef([]); const resultOptions = shallowRef([]);
const historyOptions = shallowRef([]);
const handleSearch = useDebounceFn(search, 300); const handleSearch = useDebounceFn(search, 300);
const historyNum = getConfig().MenuSearchHistory;
const inputRef = ref<HTMLInputElement | null>(null);
/** 菜单树形结构 */ /** 菜单树形结构 */
const menusData = computed(() => { const menusData = computed(() => {
@ -49,6 +62,36 @@ const show = computed({
} }
}); });
watch(
() => props.value,
newValue => {
if (newValue) getHistory();
}
);
const showSearchResult = computed(() => {
return keyword.value && resultOptions.value.length > 0;
});
const showSearchHistory = computed(() => {
return !keyword.value && historyOptions.value.length > 0;
});
const showEmpty = computed(() => {
return (
(!keyword.value && historyOptions.value.length === 0) ||
(keyword.value && resultOptions.value.length === 0)
);
});
function getStorageItem(key) {
return storageLocal().getItem<optionsItem[]>(key) || [];
}
function setStorageItem(key, value) {
storageLocal().setItem(key, value);
}
/** 将菜单树形结构扁平化为一维数组,用于菜单查询 */ /** 将菜单树形结构扁平化为一维数组,用于菜单查询 */
function flatTree(arr) { function flatTree(arr) {
const res = []; const res = [];
@ -79,11 +122,8 @@ function search() {
)) ))
: false : false
); );
if (resultOptions.value?.length > 0) { activePath.value =
activePath.value = resultOptions.value[0].path; resultOptions.value?.length > 0 ? resultOptions.value[0].path : "";
} else {
activePath.value = "";
}
} }
function handleClose() { function handleClose() {
@ -91,54 +131,143 @@ function handleClose() {
/** 延时处理防止用户看到某些操作 */ /** 延时处理防止用户看到某些操作 */
setTimeout(() => { setTimeout(() => {
resultOptions.value = []; resultOptions.value = [];
historyPath.value = "";
keyword.value = ""; keyword.value = "";
}, 200); }, 200);
} }
function scrollTo(index) { function scrollTo(index) {
const scrollTop = resultRef.value.handleScroll(index); const ref = resultOptions.value.length ? resultRef.value : historyRef.value;
const scrollTop = ref.handleScroll(index);
scrollbarRef.value.setScrollTop(scrollTop); scrollbarRef.value.setScrollTop(scrollTop);
} }
/** 获取当前选项和路径 */
function getCurrentOptionsAndPath() {
const isResultOptions = resultOptions.value.length > 0;
const options = isResultOptions ? resultOptions.value : historyOptions.value;
const currentPath = isResultOptions ? activePath.value : historyPath.value;
return { options, currentPath, isResultOptions };
}
/** 更新路径并滚动到指定项 */
function updatePathAndScroll(newIndex, isResultOptions) {
if (isResultOptions) {
activePath.value = resultOptions.value[newIndex].path;
} else {
historyPath.value = historyOptions.value[newIndex].path;
}
scrollTo(newIndex);
}
/** key up */ /** key up */
function handleUp() { function handleUp() {
const { length } = resultOptions.value; const { options, currentPath, isResultOptions } = getCurrentOptionsAndPath();
if (length === 0) return; if (options.length === 0) return;
const index = resultOptions.value.findIndex( const index = options.findIndex(item => item.path === currentPath);
item => item.path === activePath.value const prevIndex = (index - 1 + options.length) % options.length;
); updatePathAndScroll(prevIndex, isResultOptions);
if (index === 0) {
activePath.value = resultOptions.value[length - 1].path;
scrollTo(resultOptions.value.length - 1);
} else {
activePath.value = resultOptions.value[index - 1].path;
scrollTo(index - 1);
}
} }
/** key down */ /** key down */
function handleDown() { function handleDown() {
const { length } = resultOptions.value; const { options, currentPath, isResultOptions } = getCurrentOptionsAndPath();
if (length === 0) return; if (options.length === 0) return;
const index = resultOptions.value.findIndex( const index = options.findIndex(item => item.path === currentPath);
item => item.path === activePath.value const nextIndex = (index + 1) % options.length;
); updatePathAndScroll(nextIndex, isResultOptions);
if (index + 1 === length) {
activePath.value = resultOptions.value[0].path;
} else {
activePath.value = resultOptions.value[index + 1].path;
}
scrollTo(index + 1);
} }
/** key enter */ /** key enter */
function handleEnter() { function handleEnter() {
const { length } = resultOptions.value; const { options, currentPath, isResultOptions } = getCurrentOptionsAndPath();
if (length === 0 || activePath.value === "") return; if (options.length === 0 || currentPath === "") return;
router.push(activePath.value); const index = options.findIndex(item => item.path === currentPath);
if (index === -1) return;
if (isResultOptions) {
saveHistory();
} else {
updateHistory();
}
router.push(options[index].path);
handleClose(); handleClose();
} }
/** 删除历史记录 */
function handleDelete(item) {
const key = item.type === HISTORY_TYPE ? LOCALEHISTORYKEY : LOCALECOLLECTKEY;
let list = getStorageItem(key);
list = list.filter(listItem => listItem.path !== item.path);
setStorageItem(key, list);
getHistory();
}
/** 收藏历史记录 */
function handleCollect(item) {
let searchHistoryList = getStorageItem(LOCALEHISTORYKEY);
let searchCollectList = getStorageItem(LOCALECOLLECTKEY);
searchHistoryList = searchHistoryList.filter(
historyItem => historyItem.path !== item.path
);
setStorageItem(LOCALEHISTORYKEY, searchHistoryList);
if (!searchCollectList.some(collectItem => collectItem.path === item.path)) {
searchCollectList.unshift({ ...item, type: COLLECT_TYPE });
setStorageItem(LOCALECOLLECTKEY, searchCollectList);
}
getHistory();
}
/** 存储搜索记录 */
function saveHistory() {
const { path, meta } = resultOptions.value.find(
item => item.path === activePath.value
);
const searchHistoryList = getStorageItem(LOCALEHISTORYKEY);
const searchCollectList = getStorageItem(LOCALECOLLECTKEY);
const isCollected = searchCollectList.some(item => item.path === path);
const existingIndex = searchHistoryList.findIndex(item => item.path === path);
if (!isCollected) {
if (existingIndex !== -1) searchHistoryList.splice(existingIndex, 1);
if (searchHistoryList.length >= historyNum) searchHistoryList.pop();
searchHistoryList.unshift({ path, meta, type: HISTORY_TYPE });
storageLocal().setItem(LOCALEHISTORYKEY, searchHistoryList);
}
}
/** 更新存储的搜索记录 */
function updateHistory() {
let searchHistoryList = getStorageItem(LOCALEHISTORYKEY);
const historyIndex = searchHistoryList.findIndex(
item => item.path === historyPath.value
);
if (historyIndex !== -1) {
const [historyItem] = searchHistoryList.splice(historyIndex, 1);
searchHistoryList.unshift(historyItem);
setStorageItem(LOCALEHISTORYKEY, searchHistoryList);
}
}
/** 获取本地历史记录 */
function getHistory() {
const searchHistoryList = getStorageItem(LOCALEHISTORYKEY);
const searchCollectList = getStorageItem(LOCALECOLLECTKEY);
historyOptions.value = [...searchHistoryList, ...searchCollectList];
historyPath.value = historyOptions.value[0]?.path;
}
/** 拖拽改变收藏顺序 */
function handleDrag(item: dragItem) {
const searchCollectList = getStorageItem(LOCALECOLLECTKEY);
const [reorderedItem] = searchCollectList.splice(item.oldIndex, 1);
searchCollectList.splice(item.newIndex, 0, reorderedItem);
storageLocal().setItem(LOCALECOLLECTKEY, searchCollectList);
historyOptions.value = [
...getStorageItem(LOCALEHISTORYKEY),
...getStorageItem(LOCALECOLLECTKEY)
];
historyPath.value = reorderedItem.path;
}
onKeyStroke("Enter", handleEnter); onKeyStroke("Enter", handleEnter);
onKeyStroke("ArrowUp", handleUp); onKeyStroke("ArrowUp", handleUp);
onKeyStroke("ArrowDown", handleDown); onKeyStroke("ArrowDown", handleDown);
@ -164,7 +293,7 @@ onKeyStroke("ArrowDown", handleDown);
v-model="keyword" v-model="keyword"
size="large" size="large"
clearable clearable
placeholder="搜索菜单(中文模式下支持拼音搜索)" :placeholder="t('search.purePlaceholder')"
@input="handleSearch" @input="handleSearch"
> >
<template #prefix> <template #prefix>
@ -174,14 +303,21 @@ onKeyStroke("ArrowDown", handleDown);
/> />
</template> </template>
</el-input> </el-input>
<div class="search-result-container"> <div class="search-content">
<el-scrollbar ref="scrollbarRef" max-height="calc(90vh - 140px)"> <el-scrollbar ref="scrollbarRef" max-height="calc(90vh - 140px)">
<el-empty <el-empty v-if="showEmpty" :description="t('search.pureEmpty')" />
v-if="resultOptions.length === 0" <SearchHistory
description="暂无搜索结果" v-if="showSearchHistory"
ref="historyRef"
v-model:value="historyPath"
:options="historyOptions"
@click="handleEnter"
@delete="handleDelete"
@collect="handleCollect"
@drag="handleDrag"
/> />
<SearchResult <SearchResult
v-else v-if="showSearchResult"
ref="resultRef" ref="resultRef"
v-model:value="activePath" v-model:value="activePath"
:options="resultOptions" :options="resultOptions"
@ -196,7 +332,7 @@ onKeyStroke("ArrowDown", handleDown);
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.search-result-container { .search-content {
margin-top: 12px; margin-top: 12px;
} }
</style> </style>

View File

@ -1,24 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Props } from "../types";
import { transformI18n } from "@/plugins/i18n"; import { transformI18n } from "@/plugins/i18n";
import { useResizeObserver } from "@pureadmin/utils"; import { useResizeObserver } from "@pureadmin/utils";
import { useEpThemeStoreHook } from "@/store/modules/epTheme"; import { useEpThemeStoreHook } from "@/store/modules/epTheme";
import { useRenderIcon } from "@/components/ReIcon/src/hooks"; import { useRenderIcon } from "@/components/ReIcon/src/hooks";
import { ref, computed, getCurrentInstance, onMounted } from "vue"; import { ref, computed, getCurrentInstance, onMounted } from "vue";
import enterOutlined from "@/assets/svg/enter_outlined.svg?component"; import enterOutlined from "@/assets/svg/enter_outlined.svg?component";
import Bookmark2Line from "@iconify-icons/ri/bookmark-2-line";
interface optionsItem {
path: string;
meta?: {
icon?: string;
title?: string;
};
}
interface Props {
value: string;
options: Array<optionsItem>;
}
interface Emits { interface Emits {
(e: "update:value", val: string): void; (e: "update:value", val: string): void;
@ -27,9 +14,9 @@ interface Emits {
const resultRef = ref(); const resultRef = ref();
const innerHeight = ref(); const innerHeight = ref();
const props = withDefaults(defineProps<Props>(), {});
const emit = defineEmits<Emits>(); const emit = defineEmits<Emits>();
const instance = getCurrentInstance()!; const instance = getCurrentInstance()!;
const props = withDefaults(defineProps<Props>(), {});
const itemStyle = computed(() => { const itemStyle = computed(() => {
return item => { return item => {
@ -93,7 +80,7 @@ defineExpose({ handleScroll });
@click="handleTo" @click="handleTo"
@mouseenter="handleMouse(item)" @mouseenter="handleMouse(item)"
> >
<component :is="useRenderIcon(item.meta?.icon ?? Bookmark2Line)" /> <component :is="useRenderIcon(item.meta?.icon)" />
<span class="result-item-title"> <span class="result-item-title">
{{ transformI18n(item.meta?.title) }} {{ transformI18n(item.meta?.title) }}
</span> </span>
@ -115,7 +102,7 @@ defineExpose({ handleScroll });
cursor: pointer; cursor: pointer;
border: 0.1px solid #ccc; border: 0.1px solid #ccc;
border-radius: 4px; border-radius: 4px;
transition: all 0.3s; transition: font-size 0.16s;
&-title { &-title {
display: flex; display: flex;

View File

@ -14,7 +14,7 @@ function handleSearch() {
class="search-container w-[40px] h-[48px] flex-c cursor-pointer navbar-bg-hover" class="search-container w-[40px] h-[48px] flex-c cursor-pointer navbar-bg-hover"
@click="handleSearch" @click="handleSearch"
> >
<IconifyIconOffline icon="search" /> <IconifyIconOffline icon="ri:search-line" />
</div> </div>
<SearchModal v-model:value="show" /> <SearchModal v-model:value="show" />
</div> </div>

View File

@ -0,0 +1,20 @@
interface optionsItem {
path: string;
type: "history" | "collect";
meta: {
icon?: string;
title?: string;
};
}
interface dragItem {
oldIndex: number;
newIndex: number;
}
interface Props {
value: string;
options: Array<optionsItem>;
}
export type { optionsItem, dragItem, Props };

View File

@ -9,21 +9,25 @@ import {
onUnmounted, onUnmounted,
onBeforeMount onBeforeMount
} from "vue"; } from "vue";
import { useI18n } from "vue-i18n";
import panel from "../panel/index.vue"; import panel from "../panel/index.vue";
import { emitter } from "@/utils/mitt"; import { emitter } from "@/utils/mitt";
import { useNav } from "@/layout/hooks/useNav"; import { useNav } from "@/layout/hooks/useNav";
import { useAppStoreHook } from "@/store/modules/app"; import { useAppStoreHook } from "@/store/modules/app";
import { useDark, debounce, useGlobal } from "@pureadmin/utils";
import { toggleTheme } from "@pureadmin/theme/dist/browser-utils"; import { toggleTheme } from "@pureadmin/theme/dist/browser-utils";
import { useMultiTagsStoreHook } from "@/store/modules/multiTags"; import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
import Segmented, { type OptionsType } from "@/components/ReSegmented"; import Segmented, { type OptionsType } from "@/components/ReSegmented";
import { useDataThemeChange } from "@/layout/hooks/useDataThemeChange"; import { useDataThemeChange } from "@/layout/hooks/useDataThemeChange";
import { useDark, useGlobal, debounce, isNumber } from "@pureadmin/utils";
import Check from "@iconify-icons/ep/check"; import Check from "@iconify-icons/ep/check";
import LeftArrow from "@iconify-icons/ri/arrow-left-s-line";
import RightArrow from "@iconify-icons/ri/arrow-right-s-line";
import dayIcon from "@/assets/svg/day.svg?component"; import dayIcon from "@/assets/svg/day.svg?component";
import darkIcon from "@/assets/svg/dark.svg?component"; import darkIcon from "@/assets/svg/dark.svg?component";
import systemIcon from "@/assets/svg/system.svg?component"; import systemIcon from "@/assets/svg/system.svg?component";
const { t } = useI18n();
const { device } = useNav(); const { device } = useNav();
const { isDark } = useDark(); const { isDark } = useDark();
const { $storage } = useGlobal<GlobalPropertiesApi>(); const { $storage } = useGlobal<GlobalPropertiesApi>();
@ -64,7 +68,8 @@ const settings = reactive({
showLogo: $storage.configure.showLogo, showLogo: $storage.configure.showLogo,
showModel: $storage.configure.showModel, showModel: $storage.configure.showModel,
hideFooter: $storage.configure.hideFooter, hideFooter: $storage.configure.hideFooter,
multiTagsCache: $storage.configure.multiTagsCache multiTagsCache: $storage.configure.multiTagsCache,
stretch: $storage.configure.stretch
}); });
const getThemeColorStyle = computed(() => { const getThemeColorStyle = computed(() => {
@ -88,17 +93,15 @@ function storageConfigureChange<T>(key: string, val: T): void {
/** 灰色模式设置 */ /** 灰色模式设置 */
const greyChange = (value): void => { const greyChange = (value): void => {
toggleClass(settings.greyVal, "html-grey", document.querySelector("html")); const htmlEl = document.querySelector("html");
toggleClass(settings.greyVal, "html-grey", htmlEl);
storageConfigureChange("grey", value); storageConfigureChange("grey", value);
}; };
/** 色弱模式设置 */ /** 色弱模式设置 */
const weekChange = (value): void => { const weekChange = (value): void => {
toggleClass( const htmlEl = document.querySelector("html");
settings.weakVal, toggleClass(settings.weakVal, "html-weakness", htmlEl);
"html-weakness",
document.querySelector("html")
);
storageConfigureChange("weak", value); storageConfigureChange("weak", value);
}; };
@ -143,6 +146,32 @@ function setFalse(Doms): any {
}); });
} }
/** 页宽 */
const stretchTypeOptions = computed<Array<OptionsType>>(() => {
return [
{
label: t("panel.pureStretchFixed"),
tip: t("panel.pureStretchFixedTip"),
value: "fixed"
},
{
label: t("panel.pureStretchCustom"),
tip: t("panel.pureStretchCustomTip"),
value: "custom"
}
];
});
const setStretch = value => {
settings.stretch = value;
storageConfigureChange("stretch", value);
};
const stretchTypeChange = ({ option }) => {
const { value } = option;
value === "custom" ? setStretch(1440) : setStretch(false);
};
/** 主题色 激活选择项 */ /** 主题色 激活选择项 */
const getThemeColor = computed(() => { const getThemeColor = computed(() => {
return current => { return current => {
@ -162,44 +191,50 @@ const getThemeColor = computed(() => {
}; };
}); });
const pClass = computed(() => {
return ["mb-[12px]", "font-medium", "text-sm", "dark:text-white"];
});
const themeOptions = computed<Array<OptionsType>>(() => { const themeOptions = computed<Array<OptionsType>>(() => {
return [ return [
{ {
label: "浅色", label: t("panel.pureOverallStyleLight"),
icon: dayIcon, icon: dayIcon,
theme: "light", theme: "light",
tip: "清新启航,点亮舒适的工作界面", tip: t("panel.pureOverallStyleLightTip"),
iconAttrs: { fill: isDark.value ? "#fff" : "#000" } iconAttrs: { fill: isDark.value ? "#fff" : "#000" }
}, },
{ {
label: "深色", label: t("panel.pureOverallStyleDark"),
icon: darkIcon, icon: darkIcon,
theme: "dark", theme: "dark",
tip: "月光序曲,沉醉于夜的静谧雅致", tip: t("panel.pureOverallStyleDarkTip"),
iconAttrs: { fill: isDark.value ? "#fff" : "#000" } iconAttrs: { fill: isDark.value ? "#fff" : "#000" }
}, },
{ {
label: "自动", label: t("panel.pureOverallStyleSystem"),
icon: systemIcon, icon: systemIcon,
theme: "system", theme: "system",
tip: "同步时光,界面随晨昏自然呼应", tip: t("panel.pureOverallStyleSystemTip"),
iconAttrs: { fill: isDark.value ? "#fff" : "#000" } iconAttrs: { fill: isDark.value ? "#fff" : "#000" }
} }
]; ];
}); });
const markOptions: Array<OptionsType> = [ const markOptions = computed<Array<OptionsType>>(() => {
{ return [
label: "灵动", {
tip: "灵动标签,添趣生辉", label: t("panel.pureTagsStyleSmart"),
value: "smart" tip: t("panel.pureTagsStyleSmartTip"),
}, value: "smart"
{ },
label: "卡片", {
tip: "卡片标签,高效浏览", label: t("panel.pureTagsStyleCard"),
value: "card" tip: t("panel.pureTagsStyleCardTip"),
} value: "card"
]; }
];
});
/** 设置导航模式 */ /** 设置导航模式 */
function setLayoutModel(layout: string) { function setLayoutModel(layout: string) {
@ -262,13 +297,13 @@ function watchSystemThemeChange() {
} }
onBeforeMount(() => { onBeforeMount(() => {
/* 初始化项目配置 */ /* 初始化系统配置 */
nextTick(() => { nextTick(() => {
watchSystemThemeChange(); watchSystemThemeChange();
settings.greyVal && settings.greyVal &&
document.querySelector("html")?.setAttribute("class", "html-grey"); document.querySelector("html")?.classList.add("html-grey");
settings.weakVal && settings.weakVal &&
document.querySelector("html")?.setAttribute("class", "html-weakness"); document.querySelector("html")?.classList.add("html-weakness");
settings.tabsVal && tagsChange(); settings.tabsVal && tagsChange();
settings.hideFooter && hideFooterChange(); settings.hideFooter && hideFooterChange();
}); });
@ -279,9 +314,10 @@ onUnmounted(() => removeMatchMedia);
<template> <template>
<panel> <panel>
<div class="p-6"> <div class="p-5">
<p class="mb-3 font-medium text-sm dark:text-white">整体风格</p> <p :class="pClass">{{ t("panel.pureOverallStyle") }}</p>
<Segmented <Segmented
resize
class="select-none" class="select-none"
:modelValue="overallStyle === 'system' ? 2 : dataTheme ? 1 : 0" :modelValue="overallStyle === 'system' ? 2 : dataTheme ? 1 : 0"
:options="themeOptions" :options="themeOptions"
@ -297,7 +333,7 @@ onUnmounted(() => removeMatchMedia);
" "
/> />
<p class="mt-5 mb-3 font-medium text-sm dark:text-white">主题色</p> <p :class="['mt-5', pClass]">{{ t("panel.pureThemeColor") }}</p>
<ul class="theme-color"> <ul class="theme-color">
<li <li
v-for="(item, index) in themeColors" v-for="(item, index) in themeColors"
@ -316,12 +352,12 @@ onUnmounted(() => removeMatchMedia);
</li> </li>
</ul> </ul>
<p class="mt-5 mb-3 font-medium text-sm dark:text-white">导航模式</p> <p :class="['mt-5', pClass]">{{ t("panel.pureLayoutModel") }}</p>
<ul class="pure-theme"> <ul class="pure-theme">
<li <li
ref="verticalRef" ref="verticalRef"
v-tippy="{ v-tippy="{
content: '左侧菜单,亲切熟悉', content: t('panel.pureVerticalTip'),
zIndex: 41000 zIndex: 41000
}" }"
:class="layoutTheme.layout === 'vertical' ? 'is-select' : ''" :class="layoutTheme.layout === 'vertical' ? 'is-select' : ''"
@ -334,7 +370,7 @@ onUnmounted(() => removeMatchMedia);
v-if="device !== 'mobile'" v-if="device !== 'mobile'"
ref="horizontalRef" ref="horizontalRef"
v-tippy="{ v-tippy="{
content: '顶部菜单,简洁概览', content: t('panel.pureHorizontalTip'),
zIndex: 41000 zIndex: 41000
}" }"
:class="layoutTheme.layout === 'horizontal' ? 'is-select' : ''" :class="layoutTheme.layout === 'horizontal' ? 'is-select' : ''"
@ -347,7 +383,7 @@ onUnmounted(() => removeMatchMedia);
v-if="device !== 'mobile'" v-if="device !== 'mobile'"
ref="mixRef" ref="mixRef"
v-tippy="{ v-tippy="{
content: '混合菜单,灵活多变', content: t('panel.pureMixTip'),
zIndex: 41000 zIndex: 41000
}" }"
:class="layoutTheme.layout === 'mix' ? 'is-select' : ''" :class="layoutTheme.layout === 'mix' ? 'is-select' : ''"
@ -358,53 +394,100 @@ onUnmounted(() => removeMatchMedia);
</li> </li>
</ul> </ul>
<p class="mt-5 mb-3 font-medium text-base dark:text-white">页签风格</p> <span v-if="useAppStoreHook().getViewportWidth > 1280">
<p :class="['mt-5', pClass]">{{ t("panel.pureStretch") }}</p>
<Segmented
resize
class="mb-2 select-none"
:modelValue="isNumber(settings.stretch) ? 1 : 0"
:options="stretchTypeOptions"
@change="stretchTypeChange"
/>
<el-input-number
v-if="isNumber(settings.stretch)"
v-model="settings.stretch as number"
:min="1280"
:max="1600"
controls-position="right"
@change="value => setStretch(value)"
/>
<button
v-else
v-ripple="{ class: 'text-gray-300' }"
class="bg-transparent flex-c w-full h-20 rounded-md border border-[var(--pure-border-color)]"
@click="setStretch(!settings.stretch)"
>
<div
class="flex-bc transition-all duration-300"
:class="[settings.stretch ? 'w-[24%]' : 'w-[50%]']"
style="color: var(--el-color-primary)"
>
<IconifyIconOffline
:icon="settings.stretch ? RightArrow : LeftArrow"
height="20"
/>
<div
class="flex-grow border-b border-dashed"
style="border-color: var(--el-color-primary)"
/>
<IconifyIconOffline
:icon="settings.stretch ? LeftArrow : RightArrow"
height="20"
/>
</div>
</button>
</span>
<p :class="['mt-4', pClass]">{{ t("panel.pureTagsStyle") }}</p>
<Segmented <Segmented
resize
class="select-none" class="select-none"
:modelValue="markValue === 'smart' ? 0 : 1" :modelValue="markValue === 'smart' ? 0 : 1"
:options="markOptions" :options="markOptions"
@change="onChange" @change="onChange"
/> />
<p class="mt-5 mb-1 font-medium text-sm dark:text-white">界面显示</p> <p class="mt-5 font-medium text-sm dark:text-white">
{{ t("panel.pureInterfaceDisplay") }}
</p>
<ul class="setting"> <ul class="setting">
<li> <li>
<span class="dark:text-white">灰色模式</span> <span class="dark:text-white">{{ t("panel.pureGreyModel") }}</span>
<el-switch <el-switch
v-model="settings.greyVal" v-model="settings.greyVal"
inline-prompt inline-prompt
active-text="开" :active-text="t('buttons.pureOpenText')"
inactive-text="关" :inactive-text="t('buttons.pureCloseText')"
@change="greyChange" @change="greyChange"
/> />
</li> </li>
<li> <li>
<span class="dark:text-white">色弱模式</span> <span class="dark:text-white">{{ t("panel.pureWeakModel") }}</span>
<el-switch <el-switch
v-model="settings.weakVal" v-model="settings.weakVal"
inline-prompt inline-prompt
active-text="开" :active-text="t('buttons.pureOpenText')"
inactive-text="关" :inactive-text="t('buttons.pureCloseText')"
@change="weekChange" @change="weekChange"
/> />
</li> </li>
<li> <li>
<span class="dark:text-white">隐藏标签页</span> <span class="dark:text-white">{{ t("panel.pureHiddenTags") }}</span>
<el-switch <el-switch
v-model="settings.tabsVal" v-model="settings.tabsVal"
inline-prompt inline-prompt
active-text="开" :active-text="t('buttons.pureOpenText')"
inactive-text="关" :inactive-text="t('buttons.pureCloseText')"
@change="tagsChange" @change="tagsChange"
/> />
</li> </li>
<li> <li>
<span class="dark:text-white">隐藏页脚</span> <span class="dark:text-white">{{ t("panel.pureHiddenFooter") }}</span>
<el-switch <el-switch
v-model="settings.hideFooter" v-model="settings.hideFooter"
inline-prompt inline-prompt
active-text="" :active-text="t('buttons.pureOpenText')"
inactive-text="" :inactive-text="t('buttons.pureCloseText')"
@change="hideFooterChange" @change="hideFooterChange"
/> />
</li> </li>
@ -415,18 +498,20 @@ onUnmounted(() => removeMatchMedia);
inline-prompt inline-prompt
:active-value="true" :active-value="true"
:inactive-value="false" :inactive-value="false"
active-text="" :active-text="t('buttons.pureOpenText')"
inactive-text="" :inactive-text="t('buttons.pureCloseText')"
@change="logoChange" @change="logoChange"
/> />
</li> </li>
<li> <li>
<span class="dark:text-white">页签持久化</span> <span class="dark:text-white">
{{ t("panel.pureMultiTagsCache") }}
</span>
<el-switch <el-switch
v-model="settings.multiTagsCache" v-model="settings.multiTagsCache"
inline-prompt inline-prompt
active-text="" :active-text="t('buttons.pureOpenText')"
inactive-text="" :inactive-text="t('buttons.pureCloseText')"
@change="multiTagsCacheChange" @change="multiTagsCacheChange"
/> />
</li> </li>
@ -545,7 +630,7 @@ onUnmounted(() => removeMatchMedia);
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
padding: 4px 0; padding: 3px 0;
font-size: 14px; font-size: 14px;
} }
} }

View File

@ -0,0 +1,74 @@
<script setup lang="ts">
import { computed } from "vue";
import { useI18n } from "vue-i18n";
import { useGlobal } from "@pureadmin/utils";
import { useNav } from "@/layout/hooks/useNav";
import ArrowLeft from "@iconify-icons/ri/arrow-left-double-fill";
interface Props {
isActive: boolean;
}
const props = withDefaults(defineProps<Props>(), {
isActive: false
});
const { t } = useI18n();
const { tooltipEffect } = useNav();
const iconClass = computed(() => {
return ["w-[16px]", "h-[16px]"];
});
const { $storage } = useGlobal<GlobalPropertiesApi>();
const themeColor = computed(() => $storage.layout?.themeColor);
const emit = defineEmits<{
(e: "toggleClick"): void;
}>();
const toggleClick = () => {
emit("toggleClick");
};
</script>
<template>
<div
v-tippy="{
content: props.isActive
? t('buttons.pureClickCollapse')
: t('buttons.pureClickExpand'),
theme: tooltipEffect,
hideOnClick: 'toggle',
placement: 'right'
}"
class="center-collapse"
@click="toggleClick"
>
<IconifyIconOffline
:icon="ArrowLeft"
:class="[iconClass, themeColor === 'light' ? '' : 'text-primary']"
:style="{ transform: props.isActive ? 'none' : 'rotateY(180deg)' }"
/>
</div>
</template>
<style lang="scss" scoped>
.center-collapse {
position: absolute;
top: 50%;
right: 2px;
z-index: 1002;
display: flex;
align-items: center;
justify-content: center;
width: 24px;
height: 34px;
cursor: pointer;
background: var(--el-bg-color);
border: 1px solid var(--pure-border-color);
border-radius: 4px;
transform: translate(12px, -50%);
}
</style>

View File

@ -0,0 +1,30 @@
<script setup lang="ts">
import { ref, watch } from "vue";
import { useNav } from "@/layout/hooks/useNav";
const screenIcon = ref();
const { toggle, isFullscreen, Fullscreen, ExitFullscreen } = useNav();
isFullscreen.value = !!(
document.fullscreenElement ||
document.webkitFullscreenElement ||
document.mozFullScreenElement ||
document.msFullscreenElement
);
watch(
isFullscreen,
full => {
screenIcon.value = full ? ExitFullscreen : Fullscreen;
},
{
immediate: true
}
);
</script>
<template>
<span class="fullscreen-icon navbar-bg-hover" @click="toggle">
<IconifyIconOffline :icon="screenIcon" />
</span>
</template>

View File

@ -1,6 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import Search from "../search/index.vue"; import Search from "../search/index.vue";
import Notice from "../notice/index.vue"; import Notice from "../notice/index.vue";
import FullScreen from "./fullScreen.vue";
import SidebarItem from "./sidebarItem.vue"; import SidebarItem from "./sidebarItem.vue";
import { isAllEmpty } from "@pureadmin/utils"; import { isAllEmpty } from "@pureadmin/utils";
import { ref, nextTick, computed } from "vue"; import { ref, nextTick, computed } from "vue";
@ -8,6 +9,7 @@ import { useNav } from "@/layout/hooks/useNav";
import { useTranslationLang } from "../../hooks/useTranslationLang"; import { useTranslationLang } from "../../hooks/useTranslationLang";
import { usePermissionStoreHook } from "@/store/modules/permission"; import { usePermissionStoreHook } from "@/store/modules/permission";
import globalization from "@/assets/svg/globalization.svg?component"; import globalization from "@/assets/svg/globalization.svg?component";
import AccountSettingsIcon from "@iconify-icons/ri/user-settings-line";
import LogoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line"; import LogoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line";
import Setting from "@iconify-icons/ri/settings-3-line"; import Setting from "@iconify-icons/ri/settings-3-line";
import Check from "@iconify-icons/ep/check"; import Check from "@iconify-icons/ep/check";
@ -25,6 +27,7 @@ const {
username, username,
userAvatar, userAvatar,
avatarsStyle, avatarsStyle,
toAccountSettings,
getDropdownItemStyle, getDropdownItemStyle,
getDropdownItemClass getDropdownItemClass
} = useNav(); } = useNav();
@ -65,8 +68,6 @@ nextTick(() => {
<div class="horizontal-header-right"> <div class="horizontal-header-right">
<!-- 菜单搜索 --> <!-- 菜单搜索 -->
<Search id="header-search" /> <Search id="header-search" />
<!-- 通知 -->
<Notice id="header-notice" />
<!-- 国际化 --> <!-- 国际化 -->
<el-dropdown id="header-translation" trigger="click"> <el-dropdown id="header-translation" trigger="click">
<globalization <globalization
@ -97,6 +98,10 @@ nextTick(() => {
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
</el-dropdown> </el-dropdown>
<!-- 全屏 -->
<FullScreen id="full-screen" />
<!-- 消息通知 -->
<Notice id="header-notice" />
<!-- 退出登录 --> <!-- 退出登录 -->
<el-dropdown trigger="click"> <el-dropdown trigger="click">
<span class="el-dropdown-link navbar-bg-hover"> <span class="el-dropdown-link navbar-bg-hover">
@ -104,20 +109,27 @@ nextTick(() => {
<p v-if="username" class="dark:text-white">{{ username }}</p> <p v-if="username" class="dark:text-white">{{ username }}</p>
</span> </span>
<template #dropdown> <template #dropdown>
<el-dropdown-item @click="toAccountSettings">
<IconifyIconOffline
:icon="AccountSettingsIcon"
style="margin: 5px"
/>
{{ t("buttons.pureAccountSettings") }}
</el-dropdown-item>
<el-dropdown-menu class="logout"> <el-dropdown-menu class="logout">
<el-dropdown-item @click="logout"> <el-dropdown-item @click="logout">
<IconifyIconOffline <IconifyIconOffline
:icon="LogoutCircleRLine" :icon="LogoutCircleRLine"
style="margin: 5px" style="margin: 5px"
/> />
{{ t("buttons.hsLoginOut") }} {{ t("buttons.pureLoginOut") }}
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
</el-dropdown> </el-dropdown>
<span <span
class="set-icon navbar-bg-hover" class="set-icon navbar-bg-hover"
:title="t('buttons.hssystemSet')" :title="t('buttons.pureOpenSystemSet')"
@click="onPanel" @click="onPanel"
> >
<IconifyIconOffline :icon="Setting" /> <IconifyIconOffline :icon="Setting" />
@ -148,7 +160,7 @@ nextTick(() => {
} }
.logout { .logout {
max-width: 120px; width: 120px;
::v-deep(.el-dropdown-menu__item) { ::v-deep(.el-dropdown-menu__item) {
display: inline-flex; display: inline-flex;

View File

@ -1,7 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed } from "vue"; import { computed } from "vue";
import { useI18n } from "vue-i18n";
import { useGlobal } from "@pureadmin/utils"; import { useGlobal } from "@pureadmin/utils";
import { useNav } from "@/layout/hooks/useNav"; import { useNav } from "@/layout/hooks/useNav";
import MenuFold from "@iconify-icons/ri/menu-fold-fill"; import MenuFold from "@iconify-icons/ri/menu-fold-fill";
interface Props { interface Props {
@ -12,7 +14,7 @@ const props = withDefaults(defineProps<Props>(), {
isActive: false isActive: false
}); });
const visible = ref(false); const { t } = useI18n();
const { tooltipEffect } = useNav(); const { tooltipEffect } = useNav();
const iconClass = computed(() => { const iconClass = computed(() => {
@ -41,27 +43,26 @@ const toggleClick = () => {
</script> </script>
<template> <template>
<div class="collapse-container"> <div class="left-collapse">
<el-tooltip <IconifyIconOffline
placement="right" v-tippy="{
:visible="visible" content: props.isActive
:effect="tooltipEffect" ? t('buttons.pureClickCollapse')
:content="props.isActive ? '点击折叠' : '点击展开'" : t('buttons.pureClickExpand'),
> theme: tooltipEffect,
<IconifyIconOffline hideOnClick: 'toggle',
:icon="MenuFold" placement: 'right'
:class="[iconClass, themeColor === 'light' ? '' : 'text-primary']" }"
:style="{ transform: props.isActive ? 'none' : 'rotateY(180deg)' }" :icon="MenuFold"
@click="toggleClick" :class="[iconClass, themeColor === 'light' ? '' : 'text-primary']"
@mouseenter="visible = true" :style="{ transform: props.isActive ? 'none' : 'rotateY(180deg)' }"
@mouseleave="visible = false" @click="toggleClick"
/> />
</el-tooltip>
</div> </div>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.collapse-container { .left-collapse {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
width: 100%; width: 100%;

View File

@ -0,0 +1,36 @@
<script setup lang="ts">
import { computed } from "vue";
import { isUrl } from "@pureadmin/utils";
import { menuType } from "@/layout/types";
defineOptions({
name: "LinkItem"
});
const props = defineProps<{
to: menuType;
}>();
const isExternalLink = computed(() => isUrl(props.to.name));
const getLinkProps = (item: menuType) => {
if (isExternalLink.value) {
return {
href: item.name,
target: "_blank",
rel: "noopener"
};
}
return {
to: item
};
};
</script>
<template>
<component
:is="isExternalLink ? 'a' : 'router-link'"
v-bind="getLinkProps(to)"
>
<slot />
</component>
</template>

View File

@ -48,6 +48,7 @@ const { title, getLogo } = useNav();
flex-wrap: nowrap; flex-wrap: nowrap;
align-items: center; align-items: center;
height: 100%; height: 100%;
padding-left: 10px;
img { img {
display: inline-block; display: inline-block;

View File

@ -2,6 +2,7 @@
import extraIcon from "./extraIcon.vue"; import extraIcon from "./extraIcon.vue";
import Search from "../search/index.vue"; import Search from "../search/index.vue";
import Notice from "../notice/index.vue"; import Notice from "../notice/index.vue";
import FullScreen from "./fullScreen.vue";
import { isAllEmpty } from "@pureadmin/utils"; import { isAllEmpty } from "@pureadmin/utils";
import { useNav } from "@/layout/hooks/useNav"; import { useNav } from "@/layout/hooks/useNav";
import { transformI18n } from "@/plugins/i18n"; import { transformI18n } from "@/plugins/i18n";
@ -11,6 +12,7 @@ import { getParentPaths, findRouteByPath } from "@/router/utils";
import { useTranslationLang } from "../../hooks/useTranslationLang"; import { useTranslationLang } from "../../hooks/useTranslationLang";
import { usePermissionStoreHook } from "@/store/modules/permission"; import { usePermissionStoreHook } from "@/store/modules/permission";
import globalization from "@/assets/svg/globalization.svg?component"; import globalization from "@/assets/svg/globalization.svg?component";
import AccountSettingsIcon from "@iconify-icons/ri/user-settings-line";
import LogoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line"; import LogoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line";
import Setting from "@iconify-icons/ri/settings-3-line"; import Setting from "@iconify-icons/ri/settings-3-line";
import Check from "@iconify-icons/ep/check"; import Check from "@iconify-icons/ep/check";
@ -29,6 +31,7 @@ const {
userAvatar, userAvatar,
getDivStyle, getDivStyle,
avatarsStyle, avatarsStyle,
toAccountSettings,
getDropdownItemStyle, getDropdownItemStyle,
getDropdownItemClass getDropdownItemClass
} = useNav(); } = useNav();
@ -98,8 +101,6 @@ watch(
<div class="horizontal-header-right"> <div class="horizontal-header-right">
<!-- 菜单搜索 --> <!-- 菜单搜索 -->
<Search id="header-search" /> <Search id="header-search" />
<!-- 通知 -->
<Notice id="header-notice" />
<!-- 国际化 --> <!-- 国际化 -->
<el-dropdown id="header-translation" trigger="click"> <el-dropdown id="header-translation" trigger="click">
<globalization <globalization
@ -130,6 +131,10 @@ watch(
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
</el-dropdown> </el-dropdown>
<!-- 全屏 -->
<FullScreen id="full-screen" />
<!-- 消息通知 -->
<Notice id="header-notice" />
<!-- 退出登录 --> <!-- 退出登录 -->
<el-dropdown trigger="click"> <el-dropdown trigger="click">
<span class="el-dropdown-link navbar-bg-hover select-none"> <span class="el-dropdown-link navbar-bg-hover select-none">
@ -137,20 +142,27 @@ watch(
<p v-if="username" class="dark:text-white">{{ username }}</p> <p v-if="username" class="dark:text-white">{{ username }}</p>
</span> </span>
<template #dropdown> <template #dropdown>
<el-dropdown-item @click="toAccountSettings">
<IconifyIconOffline
:icon="AccountSettingsIcon"
style="margin: 5px"
/>
{{ t("buttons.pureAccountSettings") }}
</el-dropdown-item>
<el-dropdown-menu class="logout"> <el-dropdown-menu class="logout">
<el-dropdown-item @click="logout"> <el-dropdown-item @click="logout">
<IconifyIconOffline <IconifyIconOffline
:icon="LogoutCircleRLine" :icon="LogoutCircleRLine"
style="margin: 5px" style="margin: 5px"
/> />
{{ t("buttons.hsLoginOut") }} {{ t("buttons.pureLoginOut") }}
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
</el-dropdown> </el-dropdown>
<span <span
class="set-icon navbar-bg-hover" class="set-icon navbar-bg-hover"
:title="t('buttons.hssystemSet')" :title="t('buttons.pureOpenSystemSet')"
@click="onPanel" @click="onPanel"
> >
<IconifyIconOffline :icon="Setting" /> <IconifyIconOffline :icon="Setting" />
@ -181,7 +193,7 @@ watch(
} }
.logout { .logout {
max-width: 120px; width: 120px;
::v-deep(.el-dropdown-menu__item) { ::v-deep(.el-dropdown-menu__item) {
display: inline-flex; display: inline-flex;

View File

@ -1,18 +1,28 @@
<script setup lang="ts"> <script setup lang="ts">
import path from "path"; import path from "path";
import { getConfig } from "@/config"; import { getConfig } from "@/config";
import LinkItem from "./linkItem.vue";
import { menuType } from "../../types"; import { menuType } from "../../types";
import extraIcon from "./extraIcon.vue"; import extraIcon from "./extraIcon.vue";
import { ReText } from "@/components/ReText";
import { useNav } from "@/layout/hooks/useNav"; import { useNav } from "@/layout/hooks/useNav";
import { transformI18n } from "@/plugins/i18n"; import { transformI18n } from "@/plugins/i18n";
import { useRenderIcon } from "@/components/ReIcon/src/hooks"; import { useRenderIcon } from "@/components/ReIcon/src/hooks";
import { ref, toRaw, PropType, nextTick, computed, CSSProperties } from "vue"; import {
type PropType,
type CSSProperties,
ref,
toRaw,
computed,
useAttrs
} from "vue";
import ArrowUp from "@iconify-icons/ep/arrow-up-bold"; import ArrowUp from "@iconify-icons/ep/arrow-up-bold";
import EpArrowDown from "@iconify-icons/ep/arrow-down-bold"; import EpArrowDown from "@iconify-icons/ep/arrow-down-bold";
import ArrowLeft from "@iconify-icons/ep/arrow-left-bold"; import ArrowLeft from "@iconify-icons/ep/arrow-left-bold";
import ArrowRight from "@iconify-icons/ep/arrow-right-bold"; import ArrowRight from "@iconify-icons/ep/arrow-right-bold";
const attrs = useAttrs();
const { layout, isCollapse, tooltipEffect, getDivStyle } = useNav(); const { layout, isCollapse, tooltipEffect, getDivStyle } = useNav();
const props = defineProps({ const props = defineProps({
@ -29,29 +39,15 @@ const props = defineProps({
} }
}); });
const getSpanStyle = computed((): CSSProperties => {
return {
width: "100%",
textAlign: "center"
};
});
const getNoDropdownStyle = computed((): CSSProperties => { const getNoDropdownStyle = computed((): CSSProperties => {
return { return {
width: "100%",
display: "flex", display: "flex",
alignItems: "center" alignItems: "center"
}; };
}); });
const getMenuTextStyle = computed(() => { const getSubMenuIconStyle = computed((): CSSProperties => {
return {
overflow: "hidden",
textOverflow: "ellipsis",
outline: "none"
};
});
const getsubMenuIconStyle = computed((): CSSProperties => {
return { return {
display: "flex", display: "flex",
justifyContent: "center", justifyContent: "center",
@ -65,43 +61,6 @@ const getsubMenuIconStyle = computed((): CSSProperties => {
}; };
}); });
const getSubTextStyle = computed((): CSSProperties => {
if (!isCollapse.value) {
return {
width: "210px",
display: "inline-block",
overflow: "hidden",
textOverflow: "ellipsis"
};
} else {
return {
width: ""
};
}
});
const getSubMenuDivStyle = computed((): any => {
return item => {
return !isCollapse.value
? {
width: "100%",
display: "flex",
alignItems: "center",
justifyContent: "space-between",
overflow: "hidden"
}
: {
width: "100%",
textAlign:
item?.parentId === null
? "center"
: layout.value === "mix" && item?.pathList?.length === 2
? "center"
: ""
};
};
});
const expandCloseIcon = computed(() => { const expandCloseIcon = computed(() => {
if (!getConfig()?.MenuArrowIconNoTransition) return ""; if (!getConfig()?.MenuArrowIconNoTransition) return "";
return { return {
@ -113,41 +72,6 @@ const expandCloseIcon = computed(() => {
}); });
const onlyOneChild: menuType = ref(null); const onlyOneChild: menuType = ref(null);
// showTooltip
const hoverMenuMap = new WeakMap();
// dom
const menuTextRef = ref(null);
function hoverMenu(key) {
// showTooltip退
if (hoverMenuMap.get(key)) return;
nextTick(() => {
//
menuTextRef.value?.scrollWidth > menuTextRef.value?.clientWidth
? Object.assign(key, {
showTooltip: true
})
: Object.assign(key, {
showTooltip: false
});
hoverMenuMap.set(key, true);
});
}
//
function overflowSlice(text, item?: any) {
const newText =
(text?.length > 1 ? text.toString().slice(0, 1) : text) + "...";
if (item && !(isCollapse.value && item?.parentId === null)) {
return layout.value === "mix" &&
item?.pathList?.length === 2 &&
isCollapse.value
? newText
: text;
}
return newText;
}
function hasOneShowingChild(children: menuType[] = [], parent: menuType) { function hasOneShowingChild(children: menuType[] = [], parent: menuType) {
const showingChildren = children.filter((item: any) => { const showingChildren = children.filter((item: any) => {
@ -182,78 +106,66 @@ function resolvePath(routePath) {
</script> </script>
<template> <template>
<el-menu-item <link-item
v-if=" v-if="
hasOneShowingChild(props.item.children, props.item) && hasOneShowingChild(props.item.children, props.item) &&
(!onlyOneChild.children || onlyOneChild.noShowingChildren) (!onlyOneChild.children || onlyOneChild.noShowingChildren)
" "
:index="resolvePath(onlyOneChild.path)" :to="item"
:class="{ 'submenu-title-noDropdown': !isNest }"
:style="getNoDropdownStyle"
> >
<div <el-menu-item
v-if="toRaw(props.item.meta.icon)" :index="resolvePath(onlyOneChild.path)"
class="sub-menu-icon" :class="{ 'submenu-title-noDropdown': !isNest }"
:style="getsubMenuIconStyle" :style="getNoDropdownStyle"
v-bind="attrs"
> >
<component <div
:is=" v-if="toRaw(props.item.meta.icon)"
useRenderIcon( class="sub-menu-icon"
toRaw(onlyOneChild.meta.icon) || :style="getSubMenuIconStyle"
(props.item.meta && toRaw(props.item.meta.icon)) >
) <component
:is="
useRenderIcon(
toRaw(onlyOneChild.meta.icon) ||
(props.item.meta && toRaw(props.item.meta.icon))
)
"
/>
</div>
<el-text
v-if="
(!props.item?.meta.icon &&
isCollapse &&
layout === 'vertical' &&
props.item?.pathList?.length === 1) ||
(!onlyOneChild.meta.icon &&
isCollapse &&
layout === 'mix' &&
props.item?.pathList?.length === 2)
" "
/> truncated
</div> class="!w-full !px-4 !text-inherit"
<span >
v-if=" {{ transformI18n(onlyOneChild.meta.title) }}
!props.item?.meta.icon && </el-text>
isCollapse &&
layout === 'vertical' && <template #title>
props.item?.pathList?.length === 1 <div :style="getDivStyle">
" <ReText
:style="getSpanStyle" :tippyProps="{
> offset: [0, -10],
{{ overflowSlice(transformI18n(onlyOneChild.meta.title)) }} theme: tooltipEffect
</span> }"
<span class="!w-full !text-inherit"
v-if="
!onlyOneChild.meta.icon &&
isCollapse &&
layout === 'mix' &&
props.item?.pathList?.length === 2
"
:style="getSpanStyle"
>
{{ overflowSlice(transformI18n(onlyOneChild.meta.title)) }}
</span>
<template #title>
<div :style="getDivStyle">
<span v-if="layout === 'horizontal'">
{{ transformI18n(onlyOneChild.meta.title) }}
</span>
<el-tooltip
v-else
placement="top"
:effect="tooltipEffect"
:offset="-10"
:disabled="!onlyOneChild.showTooltip"
>
<template #content>
{{ transformI18n(onlyOneChild.meta.title) }}
</template>
<span
ref="menuTextRef"
:style="getMenuTextStyle"
@mouseover="hoverMenu(onlyOneChild)"
> >
{{ transformI18n(onlyOneChild.meta.title) }} {{ transformI18n(onlyOneChild.meta.title) }}
</span> </ReText>
</el-tooltip> <extraIcon :extraIcon="onlyOneChild.meta.extraIcon" />
<extraIcon :extraIcon="onlyOneChild.meta.extraIcon" /> </div>
</div> </template>
</template> </el-menu-item>
</el-menu-item> </link-item>
<el-sub-menu <el-sub-menu
v-else v-else
ref="subMenu" ref="subMenu"
@ -264,48 +176,41 @@ function resolvePath(routePath) {
<template #title> <template #title>
<div <div
v-if="toRaw(props.item.meta.icon)" v-if="toRaw(props.item.meta.icon)"
:style="getsubMenuIconStyle" :style="getSubMenuIconStyle"
class="sub-menu-icon" class="sub-menu-icon"
> >
<component <component
:is="useRenderIcon(props.item.meta && toRaw(props.item.meta.icon))" :is="useRenderIcon(props.item.meta && toRaw(props.item.meta.icon))"
/> />
</div> </div>
<span v-if="layout === 'horizontal'"> <ReText
{{ transformI18n(props.item.meta.title) }}
</span>
<div
v-if=" v-if="
!( layout === 'mix' && toRaw(props.item.meta.icon)
isCollapse && ? !isCollapse || props.item?.pathList?.length !== 2
toRaw(props.item.meta.icon) && : !(
props.item.parentId === null layout === 'vertical' &&
) isCollapse &&
toRaw(props.item.meta.icon) &&
props.item.parentId === null
)
" "
:style="getSubMenuDivStyle(props.item)" :tippyProps="{
offset: [0, -10],
theme: tooltipEffect
}"
:class="{
'!w-full': true,
'!text-inherit': true,
'!px-4':
layout !== 'horizontal' &&
isCollapse &&
!toRaw(props.item.meta.icon) &&
props.item.parentId === null
}"
> >
<el-tooltip {{ transformI18n(props.item.meta.title) }}
v-if="layout !== 'horizontal'" </ReText>
placement="top" <extraIcon v-if="!isCollapse" :extraIcon="props.item.meta.extraIcon" />
:effect="tooltipEffect"
:offset="-10"
:disabled="!props.item.showTooltip"
>
<template #content>
{{ transformI18n(props.item.meta.title) }}
</template>
<span
ref="menuTextRef"
:style="getSubTextStyle"
@mouseover="hoverMenu(props.item)"
>
{{
overflowSlice(transformI18n(props.item.meta.title), props.item)
}}
</span>
</el-tooltip>
<extraIcon v-if="!isCollapse" :extraIcon="props.item.meta.extraIcon" />
</div>
</template> </template>
<sidebar-item <sidebar-item

View File

@ -1,4 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { useI18n } from "vue-i18n";
import MenuFold from "@iconify-icons/ri/menu-fold-fill"; import MenuFold from "@iconify-icons/ri/menu-fold-fill";
import MenuUnfold from "@iconify-icons/ri/menu-unfold-fill"; import MenuUnfold from "@iconify-icons/ri/menu-unfold-fill";
@ -10,6 +11,8 @@ const props = withDefaults(defineProps<Props>(), {
isActive: false isActive: false
}); });
const { t } = useI18n();
const emit = defineEmits<{ const emit = defineEmits<{
(e: "toggleClick"): void; (e: "toggleClick"): void;
}>(); }>();
@ -22,7 +25,11 @@ const toggleClick = () => {
<template> <template>
<div <div
class="px-3 mr-1 navbar-bg-hover" class="px-3 mr-1 navbar-bg-hover"
:title="props.isActive ? '点击折叠' : '点击展开'" :title="
props.isActive
? t('buttons.pureClickCollapse')
: t('buttons.pureClickExpand')
"
@click="toggleClick" @click="toggleClick"
> >
<IconifyIconOffline <IconifyIconOffline

View File

@ -3,8 +3,9 @@ import Logo from "./logo.vue";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
import { emitter } from "@/utils/mitt"; import { emitter } from "@/utils/mitt";
import SidebarItem from "./sidebarItem.vue"; import SidebarItem from "./sidebarItem.vue";
import leftCollapse from "./leftCollapse.vue"; import LeftCollapse from "./leftCollapse.vue";
import { useNav } from "@/layout/hooks/useNav"; import { useNav } from "@/layout/hooks/useNav";
import CenterCollapse from "./centerCollapse.vue";
import { responsiveStorageNameSpace } from "@/config"; import { responsiveStorageNameSpace } from "@/config";
import { storageLocal, isAllEmpty } from "@pureadmin/utils"; import { storageLocal, isAllEmpty } from "@pureadmin/utils";
import { findRouteByPath, getParentPaths } from "@/router/utils"; import { findRouteByPath, getParentPaths } from "@/router/utils";
@ -12,6 +13,7 @@ import { usePermissionStoreHook } from "@/store/modules/permission";
import { ref, computed, watch, onMounted, onBeforeUnmount } from "vue"; import { ref, computed, watch, onMounted, onBeforeUnmount } from "vue";
const route = useRoute(); const route = useRoute();
const isShow = ref(false);
const showLogo = ref( const showLogo = ref(
storageLocal().getItem<StorageConfigs>( storageLocal().getItem<StorageConfigs>(
`${responsiveStorageNameSpace()}configure` `${responsiveStorageNameSpace()}configure`
@ -88,6 +90,8 @@ onBeforeUnmount(() => {
<div <div
v-loading="loading" v-loading="loading"
:class="['sidebar-container', showLogo ? 'has-logo' : 'no-logo']" :class="['sidebar-container', showLogo ? 'has-logo' : 'no-logo']"
@mouseenter.prevent="isShow = true"
@mouseleave.prevent="isShow = false"
> >
<Logo v-if="showLogo" :collapse="isCollapse" /> <Logo v-if="showLogo" :collapse="isCollapse" />
<el-scrollbar <el-scrollbar
@ -114,7 +118,12 @@ onBeforeUnmount(() => {
/> />
</el-menu> </el-menu>
</el-scrollbar> </el-scrollbar>
<leftCollapse <CenterCollapse
v-if="device !== 'mobile' && (isShow || isCollapse)"
:is-active="pureApp.sidebar.opened"
@toggleClick="toggleSideBar"
/>
<LeftCollapse
v-if="device !== 'mobile'" v-if="device !== 'mobile'"
:is-active="pureApp.sidebar.opened" :is-active="pureApp.sidebar.opened"
@toggleClick="toggleSideBar" @toggleClick="toggleSideBar"

View File

@ -18,26 +18,6 @@
} }
} }
@keyframes rotate {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
@keyframes close {
from {
transform: translate(-50%, -50%);
}
to {
transform: translate(0, -50%);
}
}
.tags-view { .tags-view {
position: relative; position: relative;
display: flex; display: flex;
@ -51,41 +31,35 @@
.scroll-item { .scroll-item {
position: relative; position: relative;
display: inline-block; display: inline-block;
height: 28px; height: 34px;
padding: 0 6px; padding-left: 6px;
margin-right: 4px; line-height: 34px;
line-height: 28px;
cursor: pointer; cursor: pointer;
border-radius: 3px 3px 0 0;
box-shadow: 0 0 1px #888;
transition: all 0.4s; transition: all 0.4s;
&:not(:first-child) {
padding-right: 24px;
}
.el-icon-close { .el-icon-close {
position: absolute; position: absolute;
top: 50%; top: 50%;
font-size: 10px; display: inline-flex;
align-items: center;
justify-content: center;
width: 18px;
height: 18px;
color: var(--el-color-primary); color: var(--el-color-primary);
cursor: pointer; cursor: pointer;
transition: font-size 0.2s; border-radius: 4px;
transform: translate(-50%, -50%); transition:
background-color 0.12s,
color 0.12s;
transform: translate(0, -50%);
&:hover { &:hover {
font-size: 13px; color: rgb(0 0 0 / 88%) !important;
color: #fff; background-color: rgb(0 0 0 / 6%);
background: #b4bccc;
border-radius: 50%;
}
}
&.is-closable:not(:first-child) {
&:hover {
padding-right: 18px;
&:not(.is-active) {
.el-icon-close {
animation: close 200ms ease-in forwards;
}
}
} }
} }
} }
@ -99,7 +73,6 @@
.scroll-container { .scroll-container {
position: relative; position: relative;
flex: 1; flex: 1;
padding: 5px 0;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
@ -109,15 +82,18 @@
overflow: visible; overflow: visible;
white-space: nowrap; white-space: nowrap;
list-style: none; list-style: none;
transition: transform 0.5s ease-in-out;
.scroll-item { .scroll-item {
transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1); transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
&:nth-child(1) { &:nth-child(1) {
margin-left: 5px; padding: 0 12px;
} }
} }
.fixed-tag {
padding: 0 12px;
}
} }
} }
@ -195,14 +171,7 @@
.scroll-item.is-active { .scroll-item.is-active {
position: relative; position: relative;
color: #fff; color: #fff;
box-shadow: 0 0 0.7px #888;
&:not(:first-child) {
padding-right: 18px;
}
.el-icon-close {
transform: translate(0, -50%);
}
.tag-title { .tag-title {
color: var(--el-color-primary) !important; color: var(--el-color-primary) !important;
@ -213,16 +182,16 @@
.arrow-right, .arrow-right,
.arrow-down { .arrow-down {
position: relative; position: relative;
display: flex;
align-items: center;
justify-content: center;
width: 40px; width: 40px;
height: 38px; height: 34px;
color: var(--el-text-color-primary); color: var(--el-text-color-primary);
svg { svg {
position: absolute;
left: 50%;
width: 20px; width: 20px;
height: 20px; height: 20px;
transform: translate(-50%, 50%);
} }
} }

View File

@ -4,10 +4,11 @@ import { emitter } from "@/utils/mitt";
import { RouteConfigs } from "../../types"; import { RouteConfigs } from "../../types";
import { useTags } from "../../hooks/useTag"; import { useTags } from "../../hooks/useTag";
import { routerArrays } from "@/layout/types"; import { routerArrays } from "@/layout/types";
import { useFullscreen, onClickOutside } from "@vueuse/core"; import { onClickOutside } from "@vueuse/core";
import { handleAliveRoute, getTopMenu } from "@/router/utils"; import { handleAliveRoute, getTopMenu } from "@/router/utils";
import { useSettingStoreHook } from "@/store/modules/settings"; import { useSettingStoreHook } from "@/store/modules/settings";
import { useMultiTagsStoreHook } from "@/store/modules/multiTags"; import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
import { usePermissionStoreHook } from "@/store/modules/permission";
import { ref, watch, unref, toRaw, nextTick, onBeforeUnmount } from "vue"; import { ref, watch, unref, toRaw, nextTick, onBeforeUnmount } from "vue";
import { import {
delay, delay,
@ -21,9 +22,9 @@ import Fullscreen from "@iconify-icons/ri/fullscreen-fill";
import ArrowDown from "@iconify-icons/ri/arrow-down-s-line"; import ArrowDown from "@iconify-icons/ri/arrow-down-s-line";
import ArrowRightSLine from "@iconify-icons/ri/arrow-right-s-line"; import ArrowRightSLine from "@iconify-icons/ri/arrow-right-s-line";
import ArrowLeftSLine from "@iconify-icons/ri/arrow-left-s-line"; import ArrowLeftSLine from "@iconify-icons/ri/arrow-left-s-line";
import CloseBold from "@iconify-icons/ep/close-bold";
const { const {
Close,
route, route,
router, router,
visible, visible,
@ -38,6 +39,7 @@ const {
pureSetting, pureSetting,
activeIndex, activeIndex,
getTabStyle, getTabStyle,
isScrolling,
iconIsActive, iconIsActive,
linkIsActive, linkIsActive,
currentSelect, currentSelect,
@ -58,7 +60,10 @@ const contextmenuRef = ref();
const isShowArrow = ref(false); const isShowArrow = ref(false);
const topPath = getTopMenu()?.path; const topPath = getTopMenu()?.path;
const { VITE_HIDE_HOME } = import.meta.env; const { VITE_HIDE_HOME } = import.meta.env;
const { isFullscreen, toggle } = useFullscreen(); const fixedTags = [
...routerArrays,
...usePermissionStoreHook().flatteningRoutes.filter(v => v?.meta?.fixedTag)
];
const dynamicTagView = async () => { const dynamicTagView = async () => {
await nextTick(); await nextTick();
@ -138,6 +143,38 @@ const handleScroll = (offset: number): void => {
translateX.value = 0; translateX.value = 0;
} }
} }
isScrolling.value = false;
};
const handleWheel = (event: WheelEvent): void => {
isScrolling.value = true;
const scrollIntensity = Math.abs(event.deltaX) + Math.abs(event.deltaY);
let offset = 0;
if (event.deltaX < 0) {
offset = scrollIntensity > 0 ? scrollIntensity : 100;
} else {
offset = scrollIntensity > 0 ? -scrollIntensity : -100;
}
smoothScroll(offset);
};
const smoothScroll = (offset: number): void => {
//
const scrollAmount = 20;
let remaining = Math.abs(offset);
const scrollStep = () => {
const scrollOffset = Math.sign(offset) * Math.min(scrollAmount, remaining);
handleScroll(scrollOffset);
remaining -= Math.abs(scrollOffset);
if (remaining > 0) {
requestAnimationFrame(scrollStep);
}
};
requestAnimationFrame(scrollStep);
}; };
function dynamicRouteTag(value: string): void { function dynamicRouteTag(value: string): void {
@ -196,10 +233,13 @@ function deleteDynamicTag(obj: any, current: any, tag?: string) {
other?: boolean other?: boolean
): void => { ): void => {
if (other) { if (other) {
useMultiTagsStoreHook().handleTags("equal", [ useMultiTagsStoreHook().handleTags(
VITE_HIDE_HOME === "false" ? routerArrays[0] : toRaw(getTopMenu()), "equal",
obj [
]); VITE_HIDE_HOME === "false" ? fixedTags : toRaw(getTopMenu()),
obj
].flat()
);
} else { } else {
useMultiTagsStoreHook().handleTags("splice", "", { useMultiTagsStoreHook().handleTags("splice", "", {
startIndex, startIndex,
@ -212,7 +252,7 @@ function deleteDynamicTag(obj: any, current: any, tag?: string) {
if (tag === "other") { if (tag === "other") {
spliceRoute(1, 1, true); spliceRoute(1, 1, true);
} else if (tag === "left") { } else if (tag === "left") {
spliceRoute(1, valueIndex - 1); spliceRoute(fixedTags.length, valueIndex - 1, true);
} else if (tag === "right") { } else if (tag === "right") {
spliceRoute(valueIndex + 1, multiTags.value.length); spliceRoute(valueIndex + 1, multiTags.value.length);
} else { } else {
@ -289,35 +329,23 @@ function onClickDrop(key, item, selectRoute?: RouteConfigs) {
case 5: case 5:
// //
useMultiTagsStoreHook().handleTags("splice", "", { useMultiTagsStoreHook().handleTags("splice", "", {
startIndex: 1, startIndex: fixedTags.length,
length: multiTags.value.length length: multiTags.value.length
}); });
router.push(topPath); router.push(topPath);
// router.push(fixedTags[fixedTags.length - 1]?.path);
handleAliveRoute(route as ToRouteType); handleAliveRoute(route as ToRouteType);
break; break;
case 6: case 6:
//
toggle();
setTimeout(() => {
if (isFullscreen.value) {
tagsViews[6].icon = ExitFullscreen;
tagsViews[6].text = $t("buttons.hswholeExitFullScreen");
} else {
tagsViews[6].icon = Fullscreen;
tagsViews[6].text = $t("buttons.hswholeFullScreen");
}
}, 100);
break;
case 7:
// //
onContentFullScreen(); onContentFullScreen();
setTimeout(() => { setTimeout(() => {
if (pureSetting.hiddenSideBar) { if (pureSetting.hiddenSideBar) {
tagsViews[7].icon = ExitFullscreen; tagsViews[6].icon = ExitFullscreen;
tagsViews[7].text = $t("buttons.hscontentExitFullScreen"); tagsViews[6].text = $t("buttons.pureContentExitFullScreen");
} else { } else {
tagsViews[7].icon = Fullscreen; tagsViews[6].icon = Fullscreen;
tagsViews[7].text = $t("buttons.hscontentFullScreen"); tagsViews[6].text = $t("buttons.pureContentFullScreen");
} }
}, 100); }, 100);
break; break;
@ -344,10 +372,14 @@ function showMenus(value: boolean) {
}); });
} }
function disabledMenus(value: boolean) { function disabledMenus(value: boolean, fixedTag = false) {
Array.of(1, 2, 3, 4, 5).forEach(v => { Array.of(1, 2, 3, 4, 5).forEach(v => {
tagsViews[v].disabled = value; tagsViews[v].disabled = value;
}); });
if (fixedTag) {
tagsViews[2].show = false;
tagsViews[2].disabled = true;
}
} }
/** 检查当前右键的菜单两边是否存在别的菜单,如果左侧的菜单是顶级菜单,则不显示关闭左侧标签页,如果右侧没有菜单,则不显示关闭右侧标签页 */ /** 检查当前右键的菜单两边是否存在别的菜单,如果左侧的菜单是顶级菜单,则不显示关闭左侧标签页,如果右侧没有菜单,则不显示关闭右侧标签页 */
@ -364,6 +396,13 @@ function showMenuModel(
} else { } else {
currentIndex = allRoute.findIndex(v => isEqual(v.query, query)); currentIndex = allRoute.findIndex(v => isEqual(v.query, query));
} }
function fixedTagDisabled() {
if (allRoute[currentIndex]?.meta?.fixedTag) {
Array.of(1, 2, 3, 4, 5).forEach(v => {
tagsViews[v].disabled = true;
});
}
}
showMenus(true); showMenus(true);
@ -382,6 +421,7 @@ function showMenuModel(
tagsViews[v].disabled = false; tagsViews[v].disabled = false;
}); });
tagsViews[2].disabled = true; tagsViews[2].disabled = true;
fixedTagDisabled();
} else if (currentIndex === 1 && routeLength === 2) { } else if (currentIndex === 1 && routeLength === 2) {
disabledMenus(false); disabledMenus(false);
// //
@ -389,6 +429,7 @@ function showMenuModel(
tagsViews[v].show = false; tagsViews[v].show = false;
tagsViews[v].disabled = true; tagsViews[v].disabled = true;
}); });
fixedTagDisabled();
} else if (routeLength - 1 === currentIndex && currentIndex !== 0) { } else if (routeLength - 1 === currentIndex && currentIndex !== 0) {
// //
tagsViews[3].show = false; tagsViews[3].show = false;
@ -396,29 +437,31 @@ function showMenuModel(
tagsViews[v].disabled = false; tagsViews[v].disabled = false;
}); });
tagsViews[3].disabled = true; tagsViews[3].disabled = true;
if (allRoute[currentIndex - 1]?.meta?.fixedTag) {
tagsViews[2].show = false;
tagsViews[2].disabled = true;
}
fixedTagDisabled();
} else if (currentIndex === 0 || currentPath === `/redirect${topPath}`) { } else if (currentIndex === 0 || currentPath === `/redirect${topPath}`) {
// //
disabledMenus(true); disabledMenus(true);
} else { } else {
disabledMenus(false); disabledMenus(false, allRoute[currentIndex - 1]?.meta?.fixedTag);
fixedTagDisabled();
} }
} }
function openMenu(tag, e) { function openMenu(tag, e) {
closeMenu(); closeMenu();
if (tag.path === topPath) { if (tag.path === topPath || tag?.meta?.fixedTag) {
// // fixedTag
showMenus(false); showMenus(false);
tagsViews[0].show = true; tagsViews[0].show = true;
} else if (route.path !== tag.path && route.name !== tag.name) { } else if (route.path !== tag.path && route.name !== tag.name) {
// //
tagsViews[0].show = false; tagsViews[0].show = false;
showMenuModel(tag.path, tag.query); showMenuModel(tag.path, tag.query);
} else if ( } else if (multiTags.value.length === 2 && route.path !== tag.path) {
// eslint-disable-next-line no-dupe-else-if
multiTags.value.length === 2 &&
route.path !== tag.path
) {
showMenus(true); showMenus(true);
// //
tagsViews[4].show = false; tagsViews[4].show = false;
@ -466,7 +509,6 @@ function tagOnClick(item) {
} else { } else {
router.push({ path }); router.push({ path });
} }
// showMenuModel(item?.path, item?.query);
} }
onClickOutside(contextmenuRef, closeMenu, { onClickOutside(contextmenuRef, closeMenu, {
@ -478,11 +520,6 @@ watch(route, () => {
dynamicTagView(); dynamicTagView();
}); });
watch(isFullscreen, () => {
tagsViews[6].icon = Fullscreen;
tagsViews[6].text = $t("buttons.hswholeFullScreen");
});
onMounted(() => { onMounted(() => {
if (!instance) return; if (!instance) return;
@ -525,13 +562,21 @@ onBeforeUnmount(() => {
<span v-show="isShowArrow" class="arrow-left"> <span v-show="isShowArrow" class="arrow-left">
<IconifyIconOffline :icon="ArrowLeftSLine" @click="handleScroll(200)" /> <IconifyIconOffline :icon="ArrowLeftSLine" @click="handleScroll(200)" />
</span> </span>
<div ref="scrollbarDom" class="scroll-container"> <div
ref="scrollbarDom"
class="scroll-container"
@wheel.prevent="handleWheel"
>
<div ref="tabDom" class="tab select-none" :style="getTabStyle"> <div ref="tabDom" class="tab select-none" :style="getTabStyle">
<div <div
v-for="(item, index) in multiTags" v-for="(item, index) in multiTags"
:ref="'dynamic' + index" :ref="'dynamic' + index"
:key="index" :key="index"
:class="['scroll-item is-closable', linkIsActive(item)]" :class="[
'scroll-item is-closable',
linkIsActive(item),
!isAllEmpty(item?.meta?.fixedTag) && 'fixed-tag'
]"
@contextmenu.prevent="openMenu(item, $event)" @contextmenu.prevent="openMenu(item, $event)"
@mouseenter.prevent="onMouseenter(index)" @mouseenter.prevent="onMouseenter(index)"
@mouseleave.prevent="onMouseleave(index)" @mouseleave.prevent="onMouseleave(index)"
@ -544,15 +589,17 @@ onBeforeUnmount(() => {
</span> </span>
<span <span
v-if=" v-if="
iconIsActive(item, index) || isAllEmpty(item?.meta?.fixedTag)
(index === activeIndex && index !== 0) ? iconIsActive(item, index) ||
(index === activeIndex && index !== 0)
: false
" "
class="el-icon-close" class="el-icon-close"
@click.stop="deleteMenu(item)" @click.stop="deleteMenu(item)"
> >
<IconifyIconOffline :icon="CloseBold" /> <IconifyIconOffline :icon="Close" />
</span> </span>
<div <span
v-if="showModel !== 'card'" v-if="showModel !== 'card'"
:ref="'schedule' + index" :ref="'schedule' + index"
:class="[scheduleIsActive(item)]" :class="[scheduleIsActive(item)]"

View File

@ -48,14 +48,17 @@ function init() {
watch( watch(
() => currentRoute.fullPath, () => currentRoute.fullPath,
path => { path => {
if (
currentRoute.name === "Redirect" &&
path.includes(props.frameInfo?.fullPath)
) {
frameSrc.value = path; // redirect
loading.value = true;
}
//
if (props.frameInfo?.fullPath === path) { if (props.frameInfo?.fullPath === path) {
frameSrc.value = props.frameInfo?.frameSrc; frameSrc.value = props.frameInfo?.frameSrc;
} }
//
if (path.indexOf("/redirect/") > -1) {
frameSrc.value = props.frameInfo?.fullPath;
loading.value = true;
}
} }
); );
@ -68,7 +71,7 @@ onMounted(() => {
<div <div
v-loading="loading" v-loading="loading"
class="frame" class="frame"
:element-loading-text="t('status.hsLoad')" :element-loading-text="t('status.pureLoad')"
> >
<iframe ref="frameRef" :src="frameSrc" class="frame-iframe" /> <iframe ref="frameRef" :src="frameSrc" class="frame-iframe" />
</div> </div>

View File

@ -45,7 +45,7 @@ export function useDataThemeChange() {
const targetEl = target || document.body; const targetEl = target || document.body;
let { className } = targetEl; let { className } = targetEl;
className = className.replace(clsName, "").trim(); className = className.replace(clsName, "").trim();
targetEl.className = flag ? `${className} ${clsName} ` : className; targetEl.className = flag ? `${className} ${clsName}` : className;
} }
/** 设置导航主题色 */ /** 设置导航主题色 */

View File

@ -41,7 +41,8 @@ export function useLayout() {
hideFooter: $config.HideFooter ?? true, hideFooter: $config.HideFooter ?? true,
showLogo: $config?.ShowLogo ?? true, showLogo: $config?.ShowLogo ?? true,
showModel: $config?.ShowModel ?? "smart", showModel: $config?.ShowModel ?? "smart",
multiTagsCache: $config?.MultiTagsCache ?? false multiTagsCache: $config?.MultiTagsCache ?? false,
stretch: $config?.Stretch ?? false
}; };
} }
}; };

Some files were not shown because too many files have changed in this diff Show More