Compare commits

..

126 Commits

Author SHA1 Message Date
xiaoxian521
90a61a1000 release: update 3.7.1 2022-11-22 01:00:04 +08:00
xiaoxian521
ad34c7b891 fix: 修复在未开启标签页缓存时退出登录,可能存在标签页未重置的问题 2022-11-22 00:52:30 +08:00
xiaoxian521
c5b107eab9 chore: update 2022-11-22 00:25:28 +08:00
xiaoxian521
a8c59c5c36 release: update 3.7.0 2022-11-21 17:14:22 +08:00
xiaoxian521
0d4d3a301b fix: 优化单点登录 2022-11-21 16:44:31 +08:00
xiaoxian521
b10c3eb1bb feat: 添加前端单点登录 2022-11-21 16:22:17 +08:00
RealityBoy
9b62d6ef1e feat: add ample demos to @pureadmin/table (#379)
* feat: add ample demos to @pureadmin/table
2022-11-21 11:42:33 +08:00
xiaoxian521
8ff242ea45 docs: update README.md 2022-11-18 22:40:32 +08:00
xiaoxian521
867ef87a34 chore: use intro.js replace driver.js 2022-11-18 19:54:08 +08:00
xiaoxian521
2235d9d7a8 chore: 删除 @vitejs/plugin-legacyvue3 无法通过任何工具使其支持ie 2022-11-17 22:11:13 +08:00
clovelll
5c82fdcd0f fix: 卡片列表页编辑菜单高度问题 (#376)
Co-authored-by: chenanrong <chenanrong@kezaihui.com>
2022-11-17 19:21:02 +08:00
xiaoxian521
641355083c feat: 兼容引入某个库导致 global is not defined 报错 2022-11-17 18:54:09 +08:00
xiaoxian521
cadd611559 perf: 补充注释 2022-11-17 18:12:03 +08:00
xiaoxian521
fb734f3394 chore: 删除 httpREADME.md,看文档 http请求 即可 2022-11-17 15:48:03 +08:00
xiaoxian521
e4a87e2138 perf: 优化环境变量注释 2022-11-17 15:44:11 +08:00
xiaoxian521
12db42892d chore: 规范menuArrowIconNoTransition 写法 2022-11-17 15:29:12 +08:00
xiaoxian521
13a0db0180 perf: 删除已废弃的 $baseUrl 2022-11-17 14:59:36 +08:00
xiaoxian521
facb09d779 fix: 页内菜单带参互相跳转,标签没有选中高亮 2022-11-16 17:30:24 +08:00
xiaoxian521
617f8e936c chore: update 2022-11-16 12:03:34 +08:00
xiaoxian521
6e48ad79a7 feat: 优化菜单,添加 menuArrowIconNoTransition 全局配置 2022-11-16 11:59:59 +08:00
xiaoxian521
3984ab19c9 docs: update 2022-11-16 01:34:19 +08:00
xiaoxian521
49a9259f2e perf: 规范script setup写法 2022-11-16 00:40:13 +08:00
xiaoxian521
867bbad1be docs: update README 2022-11-14 12:09:10 +08:00
xiaoxian521
ead4318163 feat: 丰富水印功能页面 2022-11-13 13:15:01 +08:00
xiaoxian521
bfa9203883 chore: update dependencies 2022-11-12 17:48:05 +08:00
xiaoxian521
4f5f18f61c perf: update 2022-11-12 09:55:20 +08:00
xiaoxian521
df71c7f75c chore: update dependencies 2022-11-11 03:36:18 +08:00
xiaoxian521
c4839aa5f4 chore: 更换表单设计器组件 2022-11-10 13:00:48 +08:00
xiaoxian521
c19fbb1473 release: update 3.6.4 2022-11-10 12:17:05 +08:00
xiaoxian521
3cdebf4ee9 style: 删除多余样式(请务必删除) 2022-11-10 12:11:16 +08:00
xiaoxian521
2bb433c3cd perf: 将baseURL和全局环境代理删除,可直接在vite.config.ts编写,即方便又支持多个代理地址 2022-11-10 11:47:07 +08:00
xiaoxian521
731e9b2f57 chore: update 2022-11-09 01:17:19 +08:00
xiaoxian521
b606fa454d perf: 优化路由守卫 2022-11-08 18:14:33 +08:00
xiaoxian521
c6bd3f11b6 chore: update devDependencies 2022-11-08 13:52:59 +08:00
xiaoxian521
d11398274a feat: 菜单图标 icon 支持使用在线图标 2022-11-08 12:05:07 +08:00
xiaoxian521
b2081b3481 perf: 优化代码 2022-11-08 01:30:04 +08:00
xiaoxian521
f5b7ee5a81 docs: update 2022-11-08 00:48:16 +08:00
xiaoxian521
20a1293a55 style: vxe-button color in hover 2022-11-02 22:48:35 +08:00
xiaoxian521
504b45783f release: update 3.6.3 2022-11-01 16:18:12 +08:00
xiaoxian521
27bc135bd2 fix: 修复当token过期后,如果页面有多个请求会重复刷新token 2022-11-01 16:06:22 +08:00
xiaoxian521
4d91d2017c perf: 优化代码 2022-10-31 10:22:01 +08:00
xiaoxian521
523c979488 docs: update 2022-10-28 15:57:11 +08:00
xiaoxian521
d2bba801d9 chore: update 2022-10-28 14:07:47 +08:00
一万
ceb1ec6e6d feat: add danmaku demo (#362)
* feat: add danmaku demo

* fix: /@/改为@/

* fix: update
2022-10-28 12:27:59 +08:00
xiaoxian521
aa83ea83fa feat: 静态资源分类打包 2022-10-27 15:51:59 +08:00
xiaoxian521
4a7d5d6573 style: update 2022-10-27 14:40:43 +08:00
xiaoxian521
b69db2ff2c fix: 修复tailwindcss最新版新增的collapse属性与平台class类名冲突 2022-10-27 14:33:36 +08:00
xiaoxian521
c288d438dc release: update 3.6.2 2022-10-27 12:58:44 +08:00
xiaoxian521
94f72cd6d9 refactor: 使用@/别名替换/@/别名 2022-10-27 12:43:01 +08:00
xiaoxian521
307944cdb5 release: update 3.6.1 2022-10-27 02:42:33 +08:00
xiaoxian521
f5a75356df feat: 打包构建添加可选 gzipbrotli 压缩模式 2022-10-27 02:35:56 +08:00
xiaoxian521
54ebd19875 feat: 添加打包是否启动cdn替换本地库配置,默认false不启动 2022-10-26 19:44:44 +08:00
xiaoxian521
303fc25af3 fix: 修复路由中父级name不应和子级name重复,会造成重定向跳转404问题 2022-10-26 11:09:33 +08:00
xiaoxian521
a455072d7a chore: update axios latest 2022-10-26 00:16:34 +08:00
xiaoxian521
2bbf04b191 chore: update 2022-10-25 17:36:35 +08:00
xiaoxian521
e4c33a7d22 fix: 修复title过长显示样式问题 2022-10-25 15:50:18 +08:00
xiaoxian521
6765ce8644 workflow: update 2022-10-25 13:33:31 +08:00
xiaoxian521
2d639c8f48 release: update 3.6.0 2022-10-25 13:07:18 +08:00
RealityBoy
6ef4cf9fb6 refactor: permission (#357)
* refactor: permission

* chore: update

* chore: update

* chore: update

* chore: update

* chore: update

* chore: update

* chore: update

* chore: update

* chore: update

* fix: 修复`mix`混合模式导航在生产环境左侧菜单一定机率不显示的问题

* chore: update

* chore: update

* chore: update

* chore: update

* chore: update

* chore: update

* chore: update

* chore: update
2022-10-25 12:17:13 +08:00
xiaoxian521
cedc84d31a chore: update @pureadmin/utils latest 2022-10-20 23:17:42 +08:00
xiaoxian521
f0af6bf830 types: update shims-vue.d.ts 2022-10-20 12:48:38 +08:00
xiaoxian521
a209f49be5 chore: update 2022-10-19 23:48:53 +08:00
xiaoxian521
8b44336779 chore: update 2022-10-19 23:31:05 +08:00
xiaoxian521
7bd7ea34ad feat: 添加json编辑器demo 2022-10-19 23:24:02 +08:00
xiaoxian521
5dbba0f3ff feat: 添加打字机组件demo 2022-10-19 18:54:26 +08:00
xiaoxian521
f9cf804627 chore: update @pureadmin/utils latest 2022-10-19 17:01:25 +08:00
xiaoxian521
b871d8528e perf: 优化登录回车事件 2022-10-19 14:11:12 +08:00
xiaoxian521
fc33e7e3f2 style: update 2022-10-19 12:56:43 +08:00
xiaoxian521
47e296c861 chore: update 2022-10-18 22:17:46 +08:00
xiaoxian521
5bce4dfa6a fix: 修复horizontal模式下menu在生产环境显示问题 2022-10-18 19:16:17 +08:00
xiaoxian521
e50d13a84a fix: 修复清空缓存并返回登录页时未清空主题 2022-10-18 18:51:08 +08:00
xiaoxian521
b1bce9f4ce feat: 添加文件下载demo 2022-10-18 17:54:17 +08:00
xiaoxian521
aae35ff5d9 chore: update @pureadmin/utils 2022-10-17 12:46:30 +08:00
xiaoxian521
2cc1d8d736 chore: update debounce demo 2022-10-16 15:29:03 +08:00
xiaoxian521
b6f0e7736c chore: update 2022-10-08 19:00:16 +08:00
xiaoxian521
89bf050f70 chore: update 2022-10-01 20:06:48 +08:00
xiaoxian521
6f0b44d959 chore: 升级、优化@pureadmin/utils里的isUrl函数 2022-09-20 15:50:47 +08:00
xiaoxian521
0e87633c8b style: 样式优化 2022-09-18 19:58:42 +08:00
xiaoxian521
e349c469fa chore: update 2022-09-18 14:54:35 +08:00
xiaoxian521
0af0f8c447 style: perf dark model 2022-09-17 12:42:30 +08:00
RealityBoy
c119328176 perf: 优化页面布局 (#349)
* perf: 优化页面布局

* fix: update
2022-09-17 11:52:46 +08:00
xiaoxian521
4d1a9ea8e7 chore: update 2022-09-15 14:41:46 +08:00
xiaoxian521
af25f6ca6e chore: update extensions.json 2022-09-13 17:55:46 +08:00
xiaoxian521
2231b88f6d chore: update 2022-09-12 23:10:59 +08:00
xiaoxian521
685d7beb11 chore: 优化样式 2022-09-11 19:46:53 +08:00
xiaoxian521
f14889ef56 perf: 使用/** */替换//注释,对编辑器的智能提示更友好 2022-09-11 16:46:01 +08:00
xiaoxian521
fafbdc7c69 perf: 从tailwind.css中移除不常用的@apply 2022-09-11 11:32:10 +08:00
xiaoxian521
ad6ced45cc release: update 3.5.0 2022-09-10 21:44:17 +08:00
xiaoxian521
3d96b9acd4 chore: update 2022-09-09 00:02:15 +08:00
xiaoxian521
594f9b98ab feat: 添加cssnano,打包时压缩css体积 2022-09-08 17:23:48 +08:00
xiaoxian521
392105e820 chore: use pnpm shell-emulator instead of cross-env 2022-09-07 21:59:03 +08:00
xiaoxian521
f629663641 chore: update 2022-09-07 16:55:49 +08:00
RealityBoy
3683bd46a4 refactor: use tailwindcss replace unocss (#342)
* refactor: use `tailwindcss` replace `unocss`

* fix: update
2022-09-07 15:07:01 +08:00
Yalin
4dfde1bea6 docs:注释文案修正 (#344) 2022-09-07 14:09:54 +08:00
xiaoxian521
4e506555ad fix: token过期,刷新死循环 2022-09-06 23:22:06 +08:00
xiaoxian521
45f912c2f5 chore: update 2022-09-05 22:21:10 +08:00
xiaoxian521
d44b35937b chore: update 2022-09-04 12:34:43 +08:00
xiaoxian521
594abd7372 chore: update 2022-09-03 13:56:30 +08:00
xiaoxian521
869964ea7e chore: update 2022-08-31 11:37:18 +08:00
xiaoxian521
4c26318126 docs: update 2022-08-31 11:19:27 +08:00
xiaoxian521
ab3468b758 chore: update 2022-08-31 11:01:36 +08:00
xiaoxian521
1dbd29735e docs: update 2022-08-31 01:39:09 +08:00
xiaoxian521
2def54c775 workflow: add gitee Deploy 2022-08-31 00:40:03 +08:00
xiaoxian521
67e8532d37 chore: update 2022-08-29 17:14:25 +08:00
一万
fb2c016ebe feat: add el-table-infinite-scroll demo (#335) 2022-08-24 23:25:00 +08:00
xiaoxian521
3056527701 perf: 重置路由时,清空缓存页面 2022-08-24 16:08:05 +08:00
xiaoxian521
cef79dfca0 chore: window.process定义在index.html中,防止低版本浏览器报错 2022-08-24 09:46:19 +08:00
xiaoxian521
769410efdf chore: 开启vscode括号对指南 2022-08-23 20:47:35 +08:00
xiaoxian521
c7dbb07858 chore: update unocss 2022-08-23 17:59:38 +08:00
xiaoxian521
cc92b3e51e style: reset.scss 2022-08-23 16:58:52 +08:00
xiaoxian521
88bba7555b release: update 3.4.6 2022-08-23 10:31:44 +08:00
xiaoxian521
30c682bd24 fix: 修复iframe加载失败 2022-08-23 10:24:40 +08:00
SampsonYe(叶飞)
3baffa11e4 fix: 修复动态路由子级长度为0时抛出异常 (#333) 2022-08-23 10:10:49 +08:00
xiaoxian521
1ed598c5f2 fix: process is not defined in path 2022-08-23 09:55:23 +08:00
xiaoxian521
185d779c8d release: update 3.4.5 2022-08-22 20:21:53 +08:00
xiaoxian521
241fc618b8 fix: 修复本地响应式存储对象设置问题 2022-08-22 20:17:50 +08:00
xiaoxian521
3a0b2e04d4 release: update 3.4.0 2022-08-22 17:21:18 +08:00
xiaoxian521
cec867297d chore: update 2022-08-22 16:16:17 +08:00
RealityBoy
cbe539c727 Refactor/tags (#332)
* refactor: tags

* chore: update

* chore: update

* chore: update

* chore: update
2022-08-22 15:49:29 +08:00
xiaoxian521
7c84d9eb70 perf: router 2022-08-22 10:19:10 +08:00
xiaoxian521
5a7187d22f perf: 移动端优化 2022-08-21 10:49:27 +08:00
xiaoxian521
a7e8249ae6 chore: update 2022-08-21 10:26:09 +08:00
xiaoxian521
d81ab81fb0 chore: update 2022-08-21 07:31:59 +08:00
xiaoxian521
846e7350fb chore: update 2022-08-19 23:01:45 +08:00
xiaoxian521
102f27fe30 chore: update element-plus@2.2.14 and perf menu 2022-08-19 21:41:49 +08:00
newives
0e76bd4aac perf: 清空缓存并返回登录页时添加重置路由 (#329)
Co-authored-by: xiaoxian521 <1923740402@qq.com>
2022-08-19 15:56:39 +08:00
255 changed files with 7514 additions and 4479 deletions

2
.env
View File

@@ -1,2 +1,2 @@
# 项目本地运行端口号 # 平台本地运行端口号
VITE_PORT = 8848 VITE_PORT = 8848

View File

@@ -1,14 +1,8 @@
# 项目本地运行端口号 # 平台本地运行端口号
VITE_PORT = 8848 VITE_PORT = 8848
# 开发环境读取配置文件路径 # 开发环境读取配置文件路径
VITE_PUBLIC_PATH = / VITE_PUBLIC_PATH = /
# 开发环境代理 # 开发环境路由历史模式Hash模式传"hash"、HTML5模式传"h5"、Hash模式带base参数传"hash,base参数"、HTML5模式带base参数传"h5,base参数"
VITE_PROXY_DOMAIN = /api
# 开发环境路由历史模式
VITE_ROUTER_HISTORY = "hash" VITE_ROUTER_HISTORY = "hash"
# 开发环境后端地址
VITE_PROXY_DOMAIN_REAL = "http://127.0.0.1:3000"

View File

@@ -1,11 +1,13 @@
# 线上环境项目打包路径 # 线上环境平台打包路径
VITE_PUBLIC_PATH = / VITE_PUBLIC_PATH = /
# 线上环境路由历史模式 # 线上环境路由历史模式Hash模式传"hash"、HTML5模式传"h5"、Hash模式带base参数传"hash,base参数"、HTML5模式带base参数传"h5,base参数"
VITE_ROUTER_HISTORY = "hash" VITE_ROUTER_HISTORY = "hash"
# 线上环境后端地址 # 是否在打包时使用cdn替换本地库 替换 true 不替换 false
VITE_PROXY_DOMAIN_REAL = "" VITE_CDN = false
# 是否为打包后的文件提供传统浏览器兼容性支持 支持 true 不支持 false # 是否启用gzip压缩或brotli压缩分两种情况删除原始文件和不删除原始文件
VITE_LEGACY = false # 压缩时不删除原始文件的配置gzip、brotli、both同时开启 gzip 与 brotli 压缩、none不开启压缩默认
# 压缩时删除原始文件的配置gzip-clear、brotli-clear、both-clear同时开启 gzip 与 brotli 压缩、none不开启压缩默认
VITE_COMPRESSION = "none"

View File

@@ -4,11 +4,13 @@ NODE_ENV=production
VITE_PUBLIC_PATH = / VITE_PUBLIC_PATH = /
# 线上环境路由历史模式 # 预发布环境路由历史模式Hash模式传"hash"、HTML5模式传"h5"、Hash模式带base参数传"hash,base参数"、HTML5模式带base参数传"h5,base参数"
VITE_ROUTER_HISTORY = "hash" VITE_ROUTER_HISTORY = "hash"
# 线上环境后端地址 # 是否在打包时使用cdn替换本地库 替换 true 不替换 false
VITE_PROXY_DOMAIN_REAL = "" VITE_CDN = true
# 是否为打包后的文件提供传统浏览器兼容性支持 支持 true 不支持 false # 是否启用gzip压缩或brotli压缩分两种情况删除原始文件和不删除原始文件
VITE_LEGACY = false # 压缩时不删除原始文件的配置gzip、brotli、both同时开启 gzip 与 brotli 压缩、none不开启压缩默认
# 压缩时删除原始文件的配置gzip-clear、brotli-clear、both-clear同时开启 gzip 与 brotli 压缩、none不开启压缩默认
VITE_COMPRESSION = "both-clear"

View File

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

39
.github/workflows/gitee.yml vendored Normal file
View File

@@ -0,0 +1,39 @@
name: Build and Deploy
permissions:
contents: write
on:
push:
branches:
- master
jobs:
deploy:
concurrency: ci-${{ github.ref }}
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: "16"
registry-url: https://registry.npmjs.com/
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: latest
- name: Deploy 🔧
run: |
pnpm install
sed -i "s#VITE_PUBLIC_PATH = /#VITE_PUBLIC_PATH = /vue-pure-admin/#g" $(pwd)/.env.production
pnpm build
cd dist
touch README.md .nojekyll
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: dist
clean: true

View File

@@ -1,6 +1,6 @@
module.exports = { module.exports = {
"*.{js,jsx,ts,tsx}": ["eslint --fix", "prettier --write"], "*.{js,jsx,ts,tsx}": ["eslint --fix", "prettier --write"],
"{!(package)*.json,.!(browserslist)*rc}": ["prettier --write--parser json"], "{!(package)*.json}": ["prettier --write--parser json"],
"package.json": ["prettier --write"], "package.json": ["prettier --write"],
"*.vue": ["eslint --fix", "prettier --write", "stylelint --fix"], "*.vue": ["eslint --fix", "prettier --write", "stylelint --fix"],
"*.{vue,css,scss,postcss,less}": ["stylelint --fix", "prettier --write"], "*.{vue,css,scss,postcss,less}": ["stylelint --fix", "prettier --write"],

3
.npmrc Normal file
View File

@@ -0,0 +1,3 @@
shamefully-hoist=true
strict-peer-dependencies=false
shell-emulator=true

View File

@@ -1,15 +1,18 @@
{ {
"recommendations": [ "recommendations": [
"christian-kohler.path-intellisense",
"vscode-icons-team.vscode-icons", "vscode-icons-team.vscode-icons",
"davidanson.vscode-markdownlint", "davidanson.vscode-markdownlint",
"stylelint.vscode-stylelint", "stylelint.vscode-stylelint",
"bradlc.vscode-tailwindcss",
"dbaeumer.vscode-eslint", "dbaeumer.vscode-eslint",
"esbenp.prettier-vscode", "esbenp.prettier-vscode",
"lokalise.i18n-ally", "lokalise.i18n-ally",
"redhat.vscode-yaml",
"csstools.postcss",
"mikestead.dotenv", "mikestead.dotenv",
"eamodio.gitlens", "eamodio.gitlens",
"antfu.iconify", "antfu.iconify",
"antfu.unocss",
"Vue.volar" "Vue.volar"
] ]
} }

View File

@@ -6,6 +6,7 @@
}, },
"editor.tabSize": 2, "editor.tabSize": 2,
"editor.formatOnPaste": true, "editor.formatOnPaste": true,
"editor.guides.bracketPairs": "active",
"files.autoSave": "afterDelay", "files.autoSave": "afterDelay",
"git.confirmSync": false, "git.confirmSync": false,
"workbench.startupEditor": "newUntitledFile", "workbench.startupEditor": "newUntitledFile",

View File

@@ -1,10 +1,157 @@
# 3.7.1 (2022-11-22)
### 🔥 hotfix
- Fixed the problem that the tab page may not be reset when logging out when the tab page cache is not turned on
# 3.7.0 (2022-11-21)
### ✔️ refactor
- Replace `driver.js` with `intro.js`
### 🎫 Feat
- Add front-end single sign-on, test address https://yiming_chang.gitee.io/vue-pure-admin/#/pure-table/index?username=sso&roles=admin&accessToken=eyJhbGciOiJIUzUxMiJ9.admin
- Add more examples for [@pureadmin/table](https://github.com/xiaoxian521/pure-admin-table) and `element-plus` [table](https://element-plus.org /zh-CN/component/table.html) example remains the same
- Rich watermark function page (supports customizing various colors, shadows, text, additional attributes, setting undeletable watermarks and setting watermarks for specified elements)
- Optimize the menu, add `MenuArrowIconNoTransition` global configuration, configure it in `public/serverConfig.json`, for the left menu mode, the menu expansion can be set `MenuArrowIconNoTransition: true` to solve
- Replacement form designer component demo
### 🐞 Bug fixes
- Repair the in-page menu with parameters to jump to each other, the label is not selected and highlighted
### 🍏 Perf
- Removed deprecated `$baseUrl`
- Compatible importing a certain library leads to `global is not defined` error, importing `src/utils/globalPolyfills.ts` file into `src/main.ts` can solve the problem
- Remove `@vitejs/plugin-legacy`, `vue3` cannot make it support `ie` through any tool
# 3.6.4 (2022-11-10)
### 🎫 Feat
- Menu icon `icon` supports using online icons
### 🐞 Bug fixes
- Fixed `vxe-button` font color issue after mouse overlay and some other style issues
### 🍏 Perf
- Optimize the routing guard, if you have logged in and there is login information, you cannot jump to the routing whitelist, but continue to stay on the current page
- Removed `baseURL` and global environment proxy, and can be written directly in `vite.config.ts`, which is convenient and supports multiple proxy addresses
# 3.6.3 (2022-11-01)
### 🎫 Feat
- Static resource classification and packaging
- Add danmaku component `demo`
### 🐞 Bug fixes
- Fix the `collapse` property added in the latest version of `tailwindcss` conflicts with the platform `class` class name
- Fix that when the `token` expires, if the page has multiple requests, the `token` will be refreshed repeatedly
# 3.6.2 (2022-10-27)
### ✔️ refactor
- Replace `/@/` alias with `@/` alias
# 3.6.1 (2022-10-27)
### 🎫 Feat
- Add whether to start `cdn` for packaging to replace the local library configuration, the default `false` does not start
- Added optional `gzip` and `brotli` compression modes for packaging builds
### 🐞 Bug fixes
- Fix `title` too long display style problem
- Fix the parent `name` in the route should not be repeated with the child `name`, which will cause redirection to jump `404` problem
### 🍏 Perf
- Upgrade `axios` to the latest version
# 3.6.0 (2022-10-25)
### 🎫 Feat
- Add file download `demo`
- Add typewriter component `demo`
- Added `json` editor `demo`
### ✔️ refactor
- Refactor the permission module, adopt the most commonly used `RBAC` (Role-Based Access List): role-based permission control (User -> Role -> Permission), and update the page permission and button permission `demo` example, button Permissions support three operation modes (judging permissions in component mode, judging permissions in function mode, and judging permissions in instruction mode)
### 🐞 Bug fixes
- Fixed the theme not being emptied when clearing the cache and returning to the login page
- Fix `menu` display problem in production environment in `horizontal` mode
- Fixed the problem that the `mix` mixed mode navigation might not be displayed in the left menu of the production environment
- After the `token` expires, calling the refresh `token` interface will cause an infinite loop
### 🍏 Perf
- Removed uncommon `@apply` from `tailwind.css`
- Replace `//` comments with `/** */`, which is more friendly to the editor's intellisense
- Optimize the login enter event
- Simplified some functions, eliminated useless functions, and optimized page loading speed
# 3.5.0 (2022-9-10)
### 🎫 Feat
- Add `cssnano` to compress the size of `css` when packaging
- Add `element-plus` seamless scrolling `Table` page demo
- Open `vscode` bracket pair guide
### ✔️ refactor
- Replace `unocss` with `tailwindcss`, add `tailwindcss` [documentation](https://xiaoxian521.github.io/pure-admin-doc/pages/39156f/)
### 🐞 Bug fixes
- `token` expires, refresh the infinite loop
### 🍏 Perf
- When resetting the route, clear the cached page
# 3.4.6 (2022-8-23)
### 🐞 Bug fixes
- `process` is not defined in path
- Fixed an error when dynamic routing `children` is an empty array
- Fixed `iframe` loading failure
# 3.4.5 (2022-8-22)
### 🐞 Bug fixes
- Fix local responsive storage object setting issue
# 3.4.0 (2022-8-22)
### 🍏 Perf
- Optimized routing
- Optimized for mobile compatibility
- Optimized routing parameters (`query`, `params` way to refresh the page does not need to open the tab page cache, the parameters can be retained on the `url` and `tab page`)
# 3.3.5 (2022-8-19) # 3.3.5 (2022-8-19)
### 🎫 Feat ### 🎫 Feat
- Secondary encapsulation of `Table` of `element-plus` into [@pureadmin/table](https://github.com/xiaoxian521/pure-admin-table), providing flexible configuration items and integrating into the platform - Secondary encapsulation of `Table` of `element-plus` into [@pureadmin/table](https://github.com/xiaoxian521/pure-admin-table), providing flexible configuration items and integrating into the platform
- Secondary encapsulation of `Descriptions` of `element-plus` into [@pureadmin/descriptions](https://github.com/xiaoxian521/pure-admin-descriptions), providing flexible configuration items and integrating into the platform - Secondary encapsulation of `Descriptions` of `element-plus` into [@pureadmin/descriptions](https://github.com/xiaoxian521/pure-admin-descriptions), providing flexible configuration items and integrating into the platform
- Centralize most of the tools and hooks of the platform to [@pureadmin/utils](https://pure-admin-utils-docs.vercel.app/), and delete the code concentrated in this library to reduce the size of the platform - Centralize most of the tools and hooks of the platform to [@pureadmin/utils](https://pure-admin-utils.netlify.app), and delete the code concentrated in this library to reduce the size of the platform
- Add [unplugin-vue-define-options](https://www.npmjs.com/package/unplugin-vue-define-options) plugin, the page can directly write `defineOptions({name: custom name})` - Add [unplugin-vue-define-options](https://www.npmjs.com/package/unplugin-vue-define-options) plugin, the page can directly write `defineOptions({name: custom name})`
- Add project files, language analysis tool [cloc](https://www.npmjs.com/package/cloc) - Add project files, language analysis tool [cloc](https://www.npmjs.com/package/cloc)
- Added landing page internationalization - Added landing page internationalization
@@ -165,7 +312,6 @@
- Optimize the tab page to bring a better interactive experience - Optimize the tab page to bring a better interactive experience
- Routing title supports direct writing in Chinese, which can be separated from internationalization - Routing title supports direct writing in Chinese, which can be separated from internationalization
- Route history mode is read from env and supports base parameter - Route history mode is read from env and supports base parameter
- Packaged files provide traditional browser compatibility support, configure VITE_LEGACY to true
# 2.6.0(2021-11-10) # 2.6.0(2021-11-10)

View File

@@ -1,10 +1,157 @@
# 3.7.1 (2022-11-22)
### 🔥 hotfix
- Fixed the problem that the tab page may not be reset when logging out when the tab page cache is not turned on
# 3.7.0 (2022-11-21)
### ✔️ refactor
- Replace `driver.js` with `intro.js`
### 🎫 Feat
- Add front-end single sign-on, test address https://yiming_chang.gitee.io/vue-pure-admin/#/pure-table/index?username=sso&roles=admin&accessToken=eyJhbGciOiJIUzUxMiJ9.admin
- Add more examples for [@pureadmin/table](https://github.com/xiaoxian521/pure-admin-table) and `element-plus` [table](https://element-plus.org /zh-CN/component/table.html) example remains the same
- Rich watermark function page (supports customizing various colors, shadows, text, additional attributes, setting undeletable watermarks and setting watermarks for specified elements)
- Optimize the menu, add `MenuArrowIconNoTransition` global configuration, configure it in `public/serverConfig.json`, for the left menu mode, the menu expansion can be set `MenuArrowIconNoTransition: true` to solve
- Replacement form designer component demo
### 🐞 Bug fixes
- Repair the in-page menu with parameters to jump to each other, the label is not selected and highlighted
### 🍏 Perf
- Removed deprecated `$baseUrl`
- Compatible importing a certain library leads to `global is not defined` error, importing `src/utils/globalPolyfills.ts` file into `src/main.ts` can solve the problem
- Remove `@vitejs/plugin-legacy`, `vue3` cannot make it support `ie` through any tool
# 3.6.4 (2022-11-10)
### 🎫 Feat
- Menu icon `icon` supports using online icons
### 🐞 Bug fixes
- Fixed `vxe-button` font color issue after mouse overlay and some other style issues
### 🍏 Perf
- Optimize the routing guard, if you have logged in and there is login information, you cannot jump to the routing whitelist, but continue to stay on the current page
- Removed `baseURL` and global environment proxy, and can be written directly in `vite.config.ts`, which is convenient and supports multiple proxy addresses
# 3.6.3 (2022-11-01)
### 🎫 Feat
- Static resource classification and packaging
- Add danmaku component `demo`
### 🐞 Bug fixes
- Fix the `collapse` property added in the latest version of `tailwindcss` conflicts with the platform `class` class name
- Fix that when the `token` expires, if the page has multiple requests, the `token` will be refreshed repeatedly
# 3.6.2 (2022-10-27)
### ✔️ refactor
- Replace `/@/` alias with `@/` alias
# 3.6.1 (2022-10-27)
### 🎫 Feat
- Add whether to start `cdn` for packaging to replace the local library configuration, the default `false` does not start
- Added optional `gzip` and `brotli` compression modes for packaging builds
### 🐞 Bug fixes
- Fix `title` too long display style problem
- Fix the parent `name` in the route should not be repeated with the child `name`, which will cause redirection to jump `404` problem
### 🍏 Perf
- Upgrade `axios` to the latest version
# 3.6.0 (2022-10-25)
### 🎫 Feat
- Add file download `demo`
- Add typewriter component `demo`
- Added `json` editor `demo`
### ✔️ refactor
- Refactor the permission module, adopt the most commonly used `RBAC` (Role-Based Access List): role-based permission control (User -> Role -> Permission), and update the page permission and button permission `demo` example, button Permissions support three operation modes (judging permissions in component mode, judging permissions in function mode, and judging permissions in instruction mode)
### 🐞 Bug fixes
- Fixed the theme not being emptied when clearing the cache and returning to the login page
- Fix `menu` display problem in production environment in `horizontal` mode
- Fixed the problem that the `mix` mixed mode navigation might not be displayed in the left menu of the production environment
- After the `token` expires, calling the refresh `token` interface will cause an infinite loop
### 🍏 Perf
- Removed uncommon `@apply` from `tailwind.css`
- Replace `//` comments with `/** */`, which is more friendly to the editor's intellisense
- Optimize the login enter event
- Simplified some functions, eliminated useless functions, and optimized page loading speed
# 3.5.0 (2022-9-10)
### 🎫 Feat
- Add `cssnano` to compress the size of `css` when packaging
- Add `element-plus` seamless scrolling `Table` page demo
- Open `vscode` bracket pair guide
### ✔️ refactor
- Replace `unocss` with `tailwindcss`, add `tailwindcss` [documentation](https://xiaoxian521.github.io/pure-admin-doc/pages/39156f/)
### 🐞 Bug fixes
- `token` expires, refresh the infinite loop
### 🍏 Perf
- When resetting the route, clear the cached page
# 3.4.6 (2022-8-23)
### 🐞 Bug fixes
- `process` is not defined in path
- Fixed an error when dynamic routing `children` is an empty array
- Fixed `iframe` loading failure
# 3.4.5 (2022-8-22)
### 🐞 Bug fixes
- Fix local responsive storage object setting issue
# 3.4.0 (2022-8-22)
### 🍏 Perf
- Optimized routing
- Optimized for mobile compatibility
- Optimized routing parameters (`query`, `params` way to refresh the page does not need to open the tab page cache, the parameters can be retained on the `url` and `tab page`)
# 3.3.5 (2022-8-19) # 3.3.5 (2022-8-19)
### 🎫 Feat ### 🎫 Feat
- Secondary encapsulation of `Table` of `element-plus` into [@pureadmin/table](https://github.com/xiaoxian521/pure-admin-table), providing flexible configuration items and integrating into the platform - Secondary encapsulation of `Table` of `element-plus` into [@pureadmin/table](https://github.com/xiaoxian521/pure-admin-table), providing flexible configuration items and integrating into the platform
- Secondary encapsulation of `Descriptions` of `element-plus` into [@pureadmin/descriptions](https://github.com/xiaoxian521/pure-admin-descriptions), providing flexible configuration items and integrating into the platform - Secondary encapsulation of `Descriptions` of `element-plus` into [@pureadmin/descriptions](https://github.com/xiaoxian521/pure-admin-descriptions), providing flexible configuration items and integrating into the platform
- Centralize most of the tools and hooks of the platform to [@pureadmin/utils](https://pure-admin-utils-docs.vercel.app/), and delete the code concentrated in this library to reduce the size of the platform - Centralize most of the tools and hooks of the platform to [@pureadmin/utils](https://pure-admin-utils.netlify.app), and delete the code concentrated in this library to reduce the size of the platform
- Add [unplugin-vue-define-options](https://www.npmjs.com/package/unplugin-vue-define-options) plugin, the page can directly write `defineOptions({name: custom name})` - Add [unplugin-vue-define-options](https://www.npmjs.com/package/unplugin-vue-define-options) plugin, the page can directly write `defineOptions({name: custom name})`
- Add project files, language analysis tool [cloc](https://www.npmjs.com/package/cloc) - Add project files, language analysis tool [cloc](https://www.npmjs.com/package/cloc)
- Added landing page internationalization - Added landing page internationalization
@@ -165,7 +312,6 @@
- Optimize the tab page to bring a better interactive experience - Optimize the tab page to bring a better interactive experience
- Routing title supports direct writing in Chinese, which can be separated from internationalization - Routing title supports direct writing in Chinese, which can be separated from internationalization
- Route history mode is read from env and supports base parameter - Route history mode is read from env and supports base parameter
- Packaged files provide traditional browser compatibility support, configure VITE_LEGACY to true
# 2.6.0(2021-11-10) # 2.6.0(2021-11-10)

View File

@@ -1,13 +1,160 @@
# 3.7.1 (2022-11-22)
### 🔥 hotfix
- 修复在未开启标签页缓存时退出登录,可能存在标签页未重置的问题
# 3.7.0 (2022-11-21)
### ✔️ refactor
- 使用 `intro.js` 替换 `driver.js`
### 🎫 Feat
- 添加前端单点登录,测试地址 https://yiming_chang.gitee.io/vue-pure-admin/#/pure-table/index?username=sso&roles=admin&accessToken=eyJhbGciOiJIUzUxMiJ9.admin
- 为 [@pureadmin/table](https://github.com/xiaoxian521/pure-admin-table) 添加更多的示例和 `element-plus` 的 [table](https://element-plus.org/zh-CN/component/table.html) 示例保持一致
- 丰富水印功能页面(支持自定义各种颜色、阴影、文字、额外属性、设置不可删除水印以及给指定元素设置水印)
- 优化菜单,添加 `MenuArrowIconNoTransition` 全局配置,在 `public/serverConfig.json` 中配置即可,对于出现左侧菜单模式,菜单展开卡顿的可设置 `MenuArrowIconNoTransition: true` 即可解决
- 更换表单设计器组件演示
### 🐞 Bug fixes
- 修复页内菜单带参互相跳转,标签没有选中高亮
### 🍏 Perf
- 删除已废弃的 `$baseUrl`
- 兼容引入某个库导致 `global is not defined` 报错,将 `src/utils/globalPolyfills.ts` 文件引入 `src/main.ts` 即可解决
- 删除 `@vitejs/plugin-legacy``vue3` 无法通过任何工具使其支持 `ie`
# 3.6.4 (2022-11-10)
### 🎫 Feat
- 菜单图标 `icon` 支持使用在线图标
### 🐞 Bug fixes
- 修复 `vxe-button` 鼠标覆盖后字体颜色问题以及一些别的样式问题
### 🍏 Perf
- 优化路由守卫,如果已经登录并存在登录信息后不能跳转到路由白名单,而是继续保持在当前页面
-`baseURL` 和全局环境代理删除,可直接在 `vite.config.ts` 编写,即方便又支持多个代理地址
# 3.6.3 (2022-11-01)
### 🎫 Feat
- 静态资源分类打包
- 添加弹幕组件 `demo`
### 🐞 Bug fixes
- 修复 `tailwindcss` 最新版新增的 `collapse` 属性与平台 `class` 类名冲突
- 修复当 `token` 过期后,如果页面有多个请求会重复刷新 `token`
# 3.6.2 (2022-10-27)
### ✔️ refactor
- 使用`@/`别名替换`/@/`别名
# 3.6.1 (2022-10-27)
### 🎫 Feat
- 添加打包是否启动`cdn`替换本地库配置,默认`false`不启动
- 添加打包构建可选`gzip``brotli`压缩模式
### 🐞 Bug fixes
- 修复`title`过长显示样式问题
- 修复路由中父级`name`不应和子级`name`重复,会造成重定向跳转`404`问题
### 🍏 Perf
- 升级`axios`至最新版
# 3.6.0 (2022-10-25)
### 🎫 Feat
- 添加文件下载`demo`
- 添加打字机组件`demo`
- 添加`json`编辑器`demo`
### ✔️ refactor
- 重构权限模块,采用目前最常用的`RBAC`Role-Based Access List: 基于角色的权限控制( 用户 -> 角色 -> 权限 ),并更新页面权限和按钮权限`demo`示例,按钮权限支持三种操作模式(组件方式判断权限、函数方式判断权限、指令方式判断权限)
### 🐞 Bug fixes
- 修复清空缓存并返回登录页时未清空主题
- 修复`horizontal`模式下`menu`在生产环境显示问题
- 修复`mix`混合模式导航在生产环境左侧菜单一定机率不显示的问题
- `token`过期后调用刷新`token`接口会无限循环的问题
### 🍏 Perf
-`tailwind.css`中移除不常用的`@apply`
- 使用`/** */`替换`//`注释,对编辑器的智能提示更友好
- 优化登录回车事件
- 简化了一些函数,剔除了无用函数,优化了页面加载速度
# 3.5.0 (2022-9-10)
### 🎫 Feat
- 添加 `cssnano` ,打包时压缩 `css` 体积
- 添加 `element-plus` 无缝滚动 `Table` 页面 demo
- 开启 `vscode` 括号对指南
### ✔️ refactor
- 使用 `tailwindcss` 替换 `unocss`,新增 `tailwindcss` [使用文档](https://yiming_chang.gitee.io/pure-admin-doc/pages/tailwindcss/)
### 🐞 Bug fixes
- `token` 过期,刷新死循环
### 🍏 Perf
- 重置路由时,清空缓存页面
# 3.4.6 (2022-8-23)
### 🐞 Bug fixes
- `process` is not defined in path
- 修复动态路由`children`为空数组时报错
- 修复`iframe`加载失败
# 3.4.5 (2022-8-22)
### 🐞 Bug fixes
- 修复本地响应式存储对象设置问题
# 3.4.0 (2022-8-22)
### 🍏 Perf
- 优化路由
- 优化移动端兼容性
- 优化路由传参(`query``params` 方式刷新页面不需要再开启标签页缓存也能保留参数在`url``标签页`上)
# 3.3.5 (2022-8-19) # 3.3.5 (2022-8-19)
### 🎫 Feat ### 🎫 Feat
-`element-plus``Table` 二次封装到[@pureadmin/table](https://github.com/xiaoxian521/pure-admin-table),提供灵活的配置项并集成到平台里 -`element-plus``Table` 二次封装到[@pureadmin/table](https://github.com/xiaoxian521/pure-admin-table),提供灵活的配置项并集成到平台里
-`element-plus``Descriptions` 二次封装到[@pureadmin/descriptions](https://github.com/xiaoxian521/pure-admin-descriptions),提供灵活的配置项并集成到平台里 -`element-plus``Descriptions` 二次封装到[@pureadmin/descriptions](https://github.com/xiaoxian521/pure-admin-descriptions),提供灵活的配置项并集成到平台里
- 将平台的大部分工具以及 hooks 都集中到[@pureadmin/utils](https://pure-admin-utils-docs.vercel.app/),并删除集中到这个库里的代码,减少平台体积 - 将平台的大部分工具以及 `hooks` 都集中到[@pureadmin/utils](https://pure-admin-utils.netlify.app),并删除集中到这个库里的代码,减少平台体积
- 添加[unplugin-vue-define-options](https://www.npmjs.com/package/unplugin-vue-define-options)插件,页面可直接写 `defineOptions({name: 自定义名称})` - 添加[unplugin-vue-define-options](https://www.npmjs.com/package/unplugin-vue-define-options)插件,页面可直接写 `defineOptions({name: 自定义名称})`
- 添加项目文件、语言分析工具 [cloc](https://www.npmjs.com/package/cloc) - 添加项目文件、语言分析工具 [cloc](https://www.npmjs.com/package/cloc)
- 添加登页国际化 - 添加登页国际化
- 添加完整路由配置表类型声明 - 添加完整路由配置表类型声明
- 添加虚拟列表页面 demo - 添加虚拟列表页面 demo
- 添加 `PDF` 预览页面 demo - 添加 `PDF` 预览页面 demo
@@ -165,7 +312,6 @@
- 优化标签页,带来更好的交互体验 - 优化标签页,带来更好的交互体验
- 路由 title 支持直接写中文,可脱离国际化 - 路由 title 支持直接写中文,可脱离国际化
- 路由历史模式从 env 读取并支持 base 参数 - 路由历史模式从 env 读取并支持 base 参数
- 打包后的文件提供传统浏览器兼容性支持,配置 VITE_LEGACY 为 true
# 2.6.0(2021-11-10) # 2.6.0(2021-11-10)

View File

@@ -8,28 +8,35 @@
## Introduction ## Introduction
vue-pure-admin is a free and open source middle and back-end template. Using the latest `vue3` `vite2` `Element-Plus` `TypeScript` and other mainstream technology development, the out-of-the-box middle and back-end front-end solutions can also be used for learning reference. `vue-pure-admin` is an open source free and out-of-the-box middle and background management system template. Developed using the latest mainstream technologies such as `Vue3`, `Vite`, `Element-Plus`, `TypeScript`, `Pinia`, `Tailwindcss`
## Supporting Video ## Supporting Video
- [Click Watch Tutorial](https://www.bilibili.com/video/BV1534y1S7HV) - [Click Watch Tutorial](https://www.bilibili.com/video/BV1kg411v7QT)
- [Click Watch UI Design](https://www.bilibili.com/video/BV17g411T7rq) - [Click Watch UI Design](https://www.bilibili.com/video/BV17g411T7rq)
## Docs ## Docs (support `PWA` fast, offline access)
- [Click Watch Docs](https://pure-admin-doc.vercel.app) - [Click me to view the domestic documentation site](https://yiming_chang.gitee.io/pure-admin-doc)
- [Click me to view foreign document site](https://xiaoxian521.github.io/pure-admin-doc)
## Thin ## Thin version (offering non-internationalized and internationalized versions)
- [Click Watch Thin](https://github.com/xiaoxian521/pure-admin-thin) - [Click me to view the non-internationalized version](https://github.com/xiaoxian521/pure-admin-thin)
- [Click me to view Internationalization version](https://github.com/xiaoxian521/pure-admin-thin/tree/i18n)
## Tauri ## Tauri
- [Click Watch Tauri](https://github.com/xiaoxian521/tauri-pure-admin) - [Click Watch Tauri](https://github.com/xiaoxian521/tauri-pure-admin)
## Electron
- [Click Watch Electron](https://github.com/xiaoxian521/electron-pure-admin)
## Preview ## Preview
- [vue-pure-admin](https://vue-pure-admin.vercel.app) - [Click me to view the domestic preview station](https://yiming_chang.gitee.io/vue-pure-admin)
- [Click me to view foreign preview site](https://xiaoxian521.github.io/vue-pure-admin)
- PC - PC
<p align="center"> <p align="center">

View File

@@ -8,28 +8,35 @@
## 简介 ## 简介
vue-pure-admin 是一个免费开源的中后台模版。使用了最新的`vue3` `vite2` `Element-Plus` `TypeScript`等主流技术开发,开箱即用的中后台前端解决方案,也可用于学习参考。 `vue-pure-admin` 是一款开源免费且开箱即用的中后台管理系统模版。使用了最新的 `Vue3``Vite``Element-Plus``TypeScript``Pinia``Tailwindcss` 等主流技术开发
## 配套视频 ## 配套视频
- [点我查看教程](https://www.bilibili.com/video/BV1534y1S7HV) - [点我查看快速开发教程](https://www.bilibili.com/video/BV1kg411v7QT)
- [点我查看 UI 设计](https://www.bilibili.com/video/BV17g411T7rq) - [点我查看 UI 设计](https://www.bilibili.com/video/BV17g411T7rq)
## 配套文档 ## 配套文档(支持 `PWA` 快速、离线访问)
- [点我查看文档](https://pure-admin-doc.vercel.app) - [点我查看国内文档](https://yiming_chang.gitee.io/pure-admin-doc)
- [点我查看国外文档站](https://xiaoxian521.github.io/pure-admin-doc)
## 精简版 ## 精简版(提供非国际化、国际化两个版本选择)
- [点我查看精简版](https://github.com/xiaoxian521/pure-admin-thin) - [点我查看非国际化精简版](https://github.com/xiaoxian521/pure-admin-thin)
- [点我查看国际化精简版](https://github.com/xiaoxian521/pure-admin-thin/tree/i18n)
## Tauri 版 ## Tauri 版
- [点我查看 Tauri 版](https://github.com/xiaoxian521/tauri-pure-admin) - [点我查看 Tauri 版](https://github.com/xiaoxian521/tauri-pure-admin)
## Electron 版
- [点我查看 Electron 版](https://github.com/xiaoxian521/electron-pure-admin)
## 预览 ## 预览
- [vue-pure-admin](https://vue-pure-admin.vercel.app) - [点我查看国内预览站](https://yiming_chang.gitee.io/vue-pure-admin)
- [点我查看国外预览站](https://xiaoxian521.github.io/vue-pure-admin)
- PC 端 - PC 端
<p align="center"> <p align="center">
@@ -141,7 +148,7 @@ pnpm build
一群已满,下面是二群,群里严禁`黄``赌``毒``vpn`等违法行为! 一群已满,下面是二群,群里严禁`黄``赌``毒``vpn`等违法行为!
<img src="https://pure-admin-doc.vercel.app/img/support/qq.png" width="150px" height="225px" /> <img src="https://yiming_chang.gitee.io/pure-admin-doc/img/support/qq.png" width="150px" height="225px" />
## 许可证 ## 许可证

67
build/cdn.ts Normal file
View File

@@ -0,0 +1,67 @@
import { Plugin as importToCDN } from "vite-plugin-cdn-import";
/**
* @description 打包时采用`cdn`模式仅限外网使用默认不采用如果需要采用cdn模式请在 .env.production 文件,将 VITE_CDN 设置成true
* 平台采用国内cdnhttps://www.bootcdn.cn当然你也可以选择 https://unpkg.com 或者 https://www.jsdelivr.com
* 提醒mockjs不能用cdn模式引入会报错。正确的方式是生产环境删除mockjs使用真实的后端请求
* 注意上面提到的仅限外网使用也不是完全肯定的如果你们公司内网部署的有相关js、css文件也可以将下面配置对应改一下整一套内网版cdn
*/
export const cdn = importToCDN({
//prodUrl解释 name: 对应下面modules的nameversion: 自动读取本地package.json中dependencies依赖中对应包的版本号path: 对应下面modules的path
prodUrl: "https://cdn.bootcdn.net/ajax/libs/{name}/{version}/{path}",
modules: [
{
name: "vue",
var: "Vue",
path: "vue.global.prod.min.js"
},
{
name: "vue-router",
var: "VueRouter",
path: "vue-router.global.min.js"
},
{
name: "vue-i18n",
var: "VueI18n",
path: "vue-i18n.runtime.global.prod.min.js"
},
// 项目中没有直接安装vue-demi但是pinia用到了所以需要在引入pinia前引入vue-demihttps://github.com/vuejs/pinia/blob/v2/packages/pinia/package.json#L77
{
name: "vue-demi",
var: "VueDemi",
path: "index.iife.min.js"
},
{
name: "pinia",
var: "Pinia",
path: "pinia.iife.min.js"
},
{
name: "element-plus",
var: "ElementPlus",
path: "index.full.min.js",
css: "index.min.css"
},
{
name: "axios",
var: "axios",
path: "axios.min.js"
},
{
name: "dayjs",
var: "dayjs",
path: "dayjs.min.js"
},
{
name: "echarts",
var: "echarts",
path: "echarts.min.js"
},
{
name: "lodash",
var: "lodash",
// 可写`完整路径`,会替换`prodUrl`
path: "https://cdn.bootcdn.net/ajax/libs/lodash.js/4.17.21/lodash.min.js"
}
]
});

63
build/compress.ts Normal file
View File

@@ -0,0 +1,63 @@
import type { Plugin } from "vite";
import { isArray } from "@pureadmin/utils";
import compressPlugin from "vite-plugin-compression";
export const configCompressPlugin = (
compress: ViteCompression
): Plugin | Plugin[] => {
if (compress === "none") return null;
const gz = {
// 生成的压缩包后缀
ext: ".gz",
// 体积大于threshold才会被压缩
threshold: 0,
// 默认压缩.js|mjs|json|css|html后缀文件设置成true压缩全部文件
filter: () => true,
// 压缩后是否删除原始文件
deleteOriginFile: false
};
const br = {
ext: ".br",
algorithm: "brotliCompress",
threshold: 0,
filter: () => true,
deleteOriginFile: false
};
const codeList = [
{ k: "gzip", v: gz },
{ k: "brotli", v: br },
{ k: "both", v: [gz, br] }
];
const plugins: Plugin[] = [];
codeList.forEach(item => {
if (compress.includes(item.k)) {
if (compress.includes("clear")) {
if (isArray(item.v)) {
item.v.forEach(vItem => {
plugins.push(
compressPlugin(Object.assign(vItem, { deleteOriginFile: true }))
);
});
} else {
plugins.push(
compressPlugin(Object.assign(item.v, { deleteOriginFile: true }))
);
}
} else {
if (isArray(item.v)) {
item.v.forEach(vItem => {
plugins.push(compressPlugin(vItem));
});
} else {
plugins.push(compressPlugin(item.v));
}
}
}
});
return plugins;
};

View File

@@ -1,13 +1,12 @@
// 处理环境变量 /** 处理环境变量 */
const warpperEnv = (envConf: Recordable): ViteEnv => { const warpperEnv = (envConf: Recordable): ViteEnv => {
// 此处为默认值,无需修改 /** 此处为默认值 */
const ret: ViteEnv = { const ret: ViteEnv = {
VITE_PORT: 8848, VITE_PORT: 8848,
VITE_PUBLIC_PATH: "", VITE_PUBLIC_PATH: "",
VITE_PROXY_DOMAIN: "",
VITE_PROXY_DOMAIN_REAL: "",
VITE_ROUTER_HISTORY: "", VITE_ROUTER_HISTORY: "",
VITE_LEGACY: false VITE_CDN: false,
VITE_COMPRESSION: "none"
}; };
for (const envName of Object.keys(envConf)) { for (const envName of Object.keys(envConf)) {
@@ -28,14 +27,9 @@ const warpperEnv = (envConf: Recordable): ViteEnv => {
return ret; return ret;
}; };
// 跨域代理重写 /** 获取环境变量 */
const regExps = (value: string, reg: string): string => {
return value.replace(new RegExp(`^${reg}`, "g"), "");
};
// 环境变量
const loadEnv = (): ViteEnv => { const loadEnv = (): ViteEnv => {
return import.meta.env; return import.meta.env;
}; };
export { warpperEnv, regExps, loadEnv }; export { warpperEnv, loadEnv };

View File

@@ -1,19 +1,23 @@
import { cdn } from "./cdn";
import { resolve } from "path"; import { resolve } from "path";
import Unocss from "unocss/vite";
import vue from "@vitejs/plugin-vue"; import vue from "@vitejs/plugin-vue";
import { viteBuildInfo } from "./info"; import { viteBuildInfo } from "./info";
import svgLoader from "vite-svg-loader"; import svgLoader from "vite-svg-loader";
import legacy from "@vitejs/plugin-legacy";
import vueJsx from "@vitejs/plugin-vue-jsx"; import vueJsx from "@vitejs/plugin-vue-jsx";
import VueMacros from "unplugin-vue-macros/vite";
import { viteMockServe } from "vite-plugin-mock"; import { viteMockServe } from "vite-plugin-mock";
import { configCompressPlugin } from "./compress";
import VueI18n from "@intlify/vite-plugin-vue-i18n"; import VueI18n from "@intlify/vite-plugin-vue-i18n";
import { visualizer } from "rollup-plugin-visualizer"; import { visualizer } from "rollup-plugin-visualizer";
import removeConsole from "vite-plugin-remove-console"; import removeConsole from "vite-plugin-remove-console";
import themePreprocessorPlugin from "@pureadmin/theme"; import themePreprocessorPlugin from "@pureadmin/theme";
import { genScssMultipleScopeVars } from "/@/layout/theme"; import { genScssMultipleScopeVars } from "../src/layout/theme";
import DefineOptions from "unplugin-vue-define-options/vite";
export function getPluginsList(command, VITE_LEGACY) { export function getPluginsList(
command: string,
VITE_CDN: boolean,
VITE_COMPRESSION: ViteCompression
) {
const prodMock = true; const prodMock = true;
const lifecycle = process.env.npm_lifecycle_event; const lifecycle = process.env.npm_lifecycle_event;
return [ return [
@@ -26,8 +30,9 @@ export function getPluginsList(command, VITE_LEGACY) {
}), }),
// jsx、tsx语法支持 // jsx、tsx语法支持
vueJsx(), vueJsx(),
Unocss(), VITE_CDN ? cdn : null,
DefineOptions(), configCompressPlugin(VITE_COMPRESSION),
VueMacros(),
// 线上环境删除console // 线上环境删除console
removeConsole({ external: ["src/assets/iconfont/iconfont.js"] }), removeConsole({ external: ["src/assets/iconfont/iconfont.js"] }),
viteBuildInfo(), viteBuildInfo(),
@@ -58,13 +63,6 @@ export function getPluginsList(command, VITE_LEGACY) {
`, `,
logger: false logger: false
}), }),
// 是否为打包后的文件提供传统浏览器兼容性支持
VITE_LEGACY
? legacy({
targets: ["ie >= 11"],
additionalLegacyPolyfills: ["regenerator-runtime/runtime"]
})
: null,
// 打包分析 // 打包分析
lifecycle === "report" lifecycle === "report"
? visualizer({ open: true, brotliSize: true, filename: "report.html" }) ? visualizer({ open: true, brotliSize: true, filename: "report.html" })

View File

@@ -2,9 +2,14 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="renderer" content="webkit" />
<meta
name="viewport"
content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0"
/>
<title>vue-pure-admin</title> <title>vue-pure-admin</title>
<link rel="icon" href="/favicon.ico" />
<script> <script>
window.process = {}; window.process = {};
</script> </script>
@@ -31,9 +36,7 @@
border-radius: 50%; border-radius: 50%;
width: 2.5em; width: 2.5em;
height: 2.5em; height: 2.5em;
-webkit-animation-fill-mode: both;
animation-fill-mode: both; animation-fill-mode: both;
-webkit-animation: loadAnimation 1.8s infinite ease-in-out;
animation: loadAnimation 1.8s infinite ease-in-out; animation: loadAnimation 1.8s infinite ease-in-out;
} }
@@ -43,10 +46,7 @@
margin: 80px auto; margin: 80px auto;
position: relative; position: relative;
text-indent: -9999em; text-indent: -9999em;
-webkit-transform: translateZ(0);
-ms-transform: translateZ(0);
transform: translateZ(0); transform: translateZ(0);
-webkit-animation-delay: -0.16s;
animation-delay: -0.16s; animation-delay: -0.16s;
top: 0; top: 0;
transform: translate(-50%, 0); transform: translate(-50%, 0);
@@ -61,7 +61,6 @@
.loader:before { .loader:before {
left: -3.5em; left: -3.5em;
-webkit-animation-delay: -0.32s;
animation-delay: -0.32s; animation-delay: -0.32s;
} }
@@ -69,18 +68,6 @@
left: 3.5em; left: 3.5em;
} }
@-webkit-keyframes loadAnimation {
0%,
80%,
100% {
box-shadow: 0 2.5em 0 -1.3em;
}
40% {
box-shadow: 0 2.5em 0 0;
}
}
@keyframes loadAnimation { @keyframes loadAnimation {
0%, 0%,
80%, 80%,

View File

@@ -18,6 +18,10 @@ buttons:
hscloseRightTabs: Close RightTabs hscloseRightTabs: Close RightTabs
hscloseOtherTabs: Close OtherTabs hscloseOtherTabs: Close OtherTabs
hscloseAllTabs: Close AllTabs hscloseAllTabs: Close AllTabs
hswholeFullScreen: Whole FullScreen
hswholeExitFullScreen: Whole ExitFullScreen
hscontentFullScreen: Content FullScreen
hscontentExitFullScreen: Content ExitFullScreen
menus: menus:
hshome: Home hshome: Home
hslogin: Login hslogin: Login
@@ -28,7 +32,7 @@ menus:
hsRole: Role Manage hsRole: Role Manage
hsDept: Dept Manage hsDept: Dept Manage
hseditor: Editor hseditor: Editor
hserror: Error Page hsabnormal: Abnormal Page
hsfourZeroFour: "404" hsfourZeroFour: "404"
hsfourZeroOne: "403" hsfourZeroOne: "403"
hsFive: "500" hsFive: "500"
@@ -44,6 +48,8 @@ menus:
hsflowChart: Flow Chart hsflowChart: Flow Chart
hsseamless: Seamless Scroll hsseamless: Seamless Scroll
hscontextmenu: Context Menu hscontextmenu: Context Menu
hstypeit: Typeit Components
hsjsoneditor: JSON Editor
hsmenus: MultiLevel Menu hsmenus: MultiLevel Menu
hsmenu1: Menu1 hsmenu1: Menu1
hsmenu1-1: Menu1-1 hsmenu1-1: Menu1-1
@@ -61,6 +67,7 @@ menus:
hsMenuTree: Menu Tree hsMenuTree: Menu Tree
hsWatermark: Water Mark hsWatermark: Water Mark
hsPrint: Print hsPrint: Print
hsDownload: Download
hsExternalPage: External Page hsExternalPage: External Page
hsPureDocument: Pure Doc(Embedded) hsPureDocument: Pure Doc(Embedded)
externalLink: Pure Doc(External) externalLink: Pure Doc(External)
@@ -86,6 +93,8 @@ menus:
hsVirtualList: Virtual List hsVirtualList: Virtual List
hsPdf: PDF Preview hsPdf: PDF Preview
hsExecl: Export Excel hsExecl: Export Excel
hsInfiniteScroll: Table Infinite Scroll
hsdanmaku: Danmaku Components
status: status:
hsLoad: Loading... hsLoad: Loading...
login: login:

View File

@@ -18,6 +18,10 @@ buttons:
hscloseRightTabs: 关闭右侧标签页 hscloseRightTabs: 关闭右侧标签页
hscloseOtherTabs: 关闭其他标签页 hscloseOtherTabs: 关闭其他标签页
hscloseAllTabs: 关闭全部标签页 hscloseAllTabs: 关闭全部标签页
hswholeFullScreen: 整体页面全屏
hswholeExitFullScreen: 整体页面退出全屏
hscontentFullScreen: 内容区全屏
hscontentExitFullScreen: 内容区退出全屏
menus: menus:
hshome: 首页 hshome: 首页
hslogin: 登录 hslogin: 登录
@@ -28,7 +32,7 @@ menus:
hsRole: 角色管理 hsRole: 角色管理
hsDept: 部门管理 hsDept: 部门管理
hseditor: 编辑器 hseditor: 编辑器
hserror: 错误页面 hsabnormal: 异常页面
hsfourZeroFour: "404" hsfourZeroFour: "404"
hsfourZeroOne: "403" hsfourZeroOne: "403"
hsFive: "500" hsFive: "500"
@@ -44,6 +48,8 @@ menus:
hsflowChart: 流程图 hsflowChart: 流程图
hsseamless: 无缝滚动 hsseamless: 无缝滚动
hscontextmenu: 右键菜单 hscontextmenu: 右键菜单
hstypeit: 打字机组件
hsjsoneditor: JSON编辑器
hsmenus: 多级菜单 hsmenus: 多级菜单
hsmenu1: 菜单1 hsmenu1: 菜单1
hsmenu1-1: 菜单1-1 hsmenu1-1: 菜单1-1
@@ -61,6 +67,7 @@ menus:
hsMenuTree: 菜单树结构 hsMenuTree: 菜单树结构
hsWatermark: 水印 hsWatermark: 水印
hsPrint: 打印 hsPrint: 打印
hsDownload: 下载
hsExternalPage: 外部页面 hsExternalPage: 外部页面
hsPureDocument: 平台文档(内嵌) hsPureDocument: 平台文档(内嵌)
externalLink: 平台文档(外链) externalLink: 平台文档(外链)
@@ -86,6 +93,8 @@ menus:
hsVirtualList: 虚拟列表 hsVirtualList: 虚拟列表
hsPdf: PDF预览 hsPdf: PDF预览
hsExecl: 导出Excel hsExecl: 导出Excel
hsInfiniteScroll: 表格无限滚动
hsdanmaku: 弹幕组件
status: status:
hsLoad: 加载中... hsLoad: 加载中...
login: login:

View File

@@ -1,11 +1,14 @@
// 根据角色动态生成路由 // 模拟后端动态生成路由
import { MockMethod } from "vite-plugin-mock"; import { MockMethod } from "vite-plugin-mock";
// http://mockjs.com/examples.html#Object /**
* roles页面级别权限这里模拟二种 "admin"、"common"
* admin管理员角色
* common普通角色
*/
const systemRouter = { const systemRouter = {
path: "/system", path: "/system",
name: "User",
redirect: "/system/user/index",
meta: { meta: {
icon: "setting", icon: "setting",
title: "menus.hssysManagement", title: "menus.hssysManagement",
@@ -17,7 +20,8 @@ const systemRouter = {
name: "User", name: "User",
meta: { meta: {
icon: "flUser", icon: "flUser",
title: "menus.hsUser" title: "menus.hsUser",
roles: ["admin"]
} }
}, },
{ {
@@ -25,7 +29,8 @@ const systemRouter = {
name: "Role", name: "Role",
meta: { meta: {
icon: "role", icon: "role",
title: "menus.hsRole" title: "menus.hsRole",
roles: ["admin"]
} }
}, },
{ {
@@ -33,7 +38,8 @@ const systemRouter = {
name: "Dept", name: "Dept",
meta: { meta: {
icon: "dept", icon: "dept",
title: "menus.hsDept" title: "menus.hsDept",
roles: ["admin"]
} }
}, },
{ {
@@ -43,7 +49,8 @@ const systemRouter = {
meta: { meta: {
icon: "dict", icon: "dict",
title: "menus.hsDict", title: "menus.hsDict",
keepAlive: true keepAlive: true,
roles: ["admin"]
} }
} }
] ]
@@ -51,19 +58,18 @@ const systemRouter = {
const permissionRouter = { const permissionRouter = {
path: "/permission", path: "/permission",
redirect: "/permission/page/index",
name: "PermissionPage",
meta: { meta: {
title: "menus.permission", title: "menus.permission",
icon: "lollipop", icon: "lollipop",
rank: 7 rank: 10
}, },
children: [ children: [
{ {
path: "/permission/page/index", path: "/permission/page/index",
name: "PermissionPage", name: "PermissionPage",
meta: { meta: {
title: "menus.permissionPage" title: "menus.permissionPage",
roles: ["admin", "common"]
} }
}, },
{ {
@@ -71,7 +77,8 @@ const permissionRouter = {
name: "PermissionButton", name: "PermissionButton",
meta: { meta: {
title: "menus.permissionButton", title: "menus.permissionButton",
authority: [] roles: ["admin", "common"],
auths: ["btn_add", "btn_edit", "btn_delete"]
} }
} }
] ]
@@ -79,12 +86,10 @@ const permissionRouter = {
const frameRouter = { const frameRouter = {
path: "/iframe", path: "/iframe",
name: "FramePure",
redirect: "/iframe/pure",
meta: { meta: {
icon: "monitor", icon: "monitor",
title: "menus.hsExternalPage", title: "menus.hsExternalPage",
rank: 10 rank: 8
}, },
children: [ children: [
{ {
@@ -92,14 +97,16 @@ const frameRouter = {
name: "FramePure", name: "FramePure",
meta: { meta: {
title: "menus.hsPureDocument", title: "menus.hsPureDocument",
frameSrc: "https://pure-admin-doc.vercel.app" frameSrc: "https://yiming_chang.gitee.io/pure-admin-doc",
roles: ["admin", "common"]
} }
}, },
{ {
path: "/external", path: "/external",
name: "https://pure-admin-doc.vercel.app", name: "https://yiming_chang.gitee.io/pure-admin-doc",
meta: { meta: {
title: "menus.externalLink" title: "menus.externalLink",
roles: ["admin", "common"]
} }
}, },
{ {
@@ -107,7 +114,8 @@ const frameRouter = {
name: "FrameEp", name: "FrameEp",
meta: { meta: {
title: "menus.hsEpDocument", title: "menus.hsEpDocument",
frameSrc: "https://element-plus.org/zh-CN/" frameSrc: "https://element-plus.org/zh-CN/",
roles: ["admin", "common"]
} }
} }
] ]
@@ -115,8 +123,6 @@ const frameRouter = {
const tabsRouter = { const tabsRouter = {
path: "/tabs", path: "/tabs",
redirect: "/tabs/index",
name: "Tabs",
meta: { meta: {
icon: "IF-team-icontabs", icon: "IF-team-icontabs",
title: "menus.hstabs", title: "menus.hstabs",
@@ -127,49 +133,43 @@ const tabsRouter = {
path: "/tabs/index", path: "/tabs/index",
name: "Tabs", name: "Tabs",
meta: { meta: {
title: "menus.hstabs" title: "menus.hstabs",
roles: ["admin", "common"]
} }
}, },
// query 传参模式
{ {
path: "/tabs/detail", path: "/tabs/query-detail",
name: "TabDetail", name: "TabQueryDetail",
meta: { meta: {
title: "", // 不在menu菜单中显示
showLink: false, showLink: false,
dynamicLevel: 3, roles: ["admin", "common"]
refreshRedirect: "/tabs/index" }
},
// params 传参模式
{
path: "/tabs/params-detail/:id",
component: "params-detail",
name: "TabParamsDetail",
meta: {
// 不在menu菜单中显示
showLink: false,
roles: ["admin", "common"]
} }
} }
] ]
}; };
// 添加不同按钮权限到/permission/button页面中
function setDifAuthority(authority, routes) {
routes.children[1].meta.authority = [authority];
return routes;
}
export default [ export default [
{ {
url: "/getAsyncRoutes", url: "/getAsyncRoutes",
method: "get", method: "get",
response: ({ query }) => { response: () => {
if (query.name === "admin") {
return { return {
code: 0, success: true,
info: [ data: [systemRouter, permissionRouter, frameRouter, tabsRouter]
tabsRouter,
frameRouter,
systemRouter,
setDifAuthority("v-admin", permissionRouter)
]
}; };
} else {
return {
code: 0,
info: [tabsRouter, setDifAuthority("v-test", permissionRouter)]
};
}
} }
} }
] as MockMethod[]; ] as MockMethod[];

View File

@@ -6,7 +6,7 @@ export default [
method: "post", method: "post",
response: () => { response: () => {
return { return {
code: 0, success: true,
data: { data: {
list: [ list: [
{ {

36
mock/login.ts Normal file
View File

@@ -0,0 +1,36 @@
// 根据角色动态生成路由
import { MockMethod } from "vite-plugin-mock";
export default [
{
url: "/login",
method: "post",
response: ({ body }) => {
if (body.username === "admin") {
return {
success: true,
data: {
username: "admin",
// 一个用户可能有多个角色
roles: ["admin"],
accessToken: "eyJhbGciOiJIUzUxMiJ9.admin",
refreshToken: "eyJhbGciOiJIUzUxMiJ9.adminRefresh",
expires: "2023/10/30 00:00:00"
}
};
} else {
return {
success: true,
data: {
username: "common",
// 一个用户可能有多个角色
roles: ["common"],
accessToken: "eyJhbGciOiJIUzUxMiJ9.common",
refreshToken: "eyJhbGciOiJIUzUxMiJ9.commonRefresh",
expires: "2023/10/30 00:00:00"
}
};
}
}
}
] as MockMethod[];

View File

@@ -29,8 +29,8 @@ export default [
method: "get", method: "get",
response: () => { response: () => {
return { return {
code: 0, success: true,
info: mapList() data: mapList()
}; };
} }
} }

27
mock/refreshToken.ts Normal file
View File

@@ -0,0 +1,27 @@
import { MockMethod } from "vite-plugin-mock";
// 模拟刷新token接口
export default [
{
url: "/refreshToken",
method: "post",
response: ({ body }) => {
if (body.refreshToken) {
return {
success: true,
data: {
accessToken: "eyJhbGciOiJIUzUxMiJ9.newAdmin",
refreshToken: "eyJhbGciOiJIUzUxMiJ9.newAdminRefresh",
// `expires`选择这种日期格式是为了方便调试,后端直接设置时间戳或许更方便(每次都应该递增)。如果后端返回的是时间戳格式,前端开发请来到这个目录`src/utils/auth.ts`,把第`38`行的代码换成expires = data.expires即可。
expires: "2023/10/30 23:59:59"
}
};
} else {
return {
success: false,
data: {}
};
}
}
}
] as MockMethod[];

View File

@@ -6,7 +6,7 @@ export default [
method: "post", method: "post",
response: () => { response: () => {
return { return {
code: 0, success: true,
data: { data: {
list: [ list: [
{ {
@@ -71,7 +71,7 @@ export default [
method: "post", method: "post",
response: () => { response: () => {
return { return {
code: 0, success: true,
data: [ data: [
{ {
name: "杭州总公司", name: "杭州总公司",
@@ -212,7 +212,7 @@ export default [
method: "post", method: "post",
response: () => { response: () => {
return { return {
code: 0, success: true,
data: { data: {
list: [ list: [
{ {

View File

@@ -1,20 +1,20 @@
{ {
"name": "vue-pure-admin", "name": "vue-pure-admin",
"version": "3.3.5", "version": "3.7.1",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "cross-env --max_old_space_size=4096 vite", "dev": "NODE_OPTIONS=--max-old-space-size=4096 vite",
"serve": "pnpm dev", "serve": "pnpm dev",
"build": "rimraf dist && cross-env NODE_OPTIONS=--max-old-space-size=8192 vite build", "build": "rimraf dist && NODE_OPTIONS=--max-old-space-size=8192 vite build",
"build:staging": "rimraf dist && cross-env vite build --mode staging", "build:staging": "rimraf dist && vite build --mode staging",
"report": "rimraf dist && cross-env vite build", "report": "rimraf dist && vite build",
"preview": "vite preview", "preview": "vite preview",
"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",
"cloc": "cross-env --max_old_space_size=4096 cloc . --exclude-dir=node_modules --exclude-lang=YAML", "cloc": "NODE_OPTIONS=--max-old-space-size=4096 cloc . --exclude-dir=node_modules --exclude-lang=YAML",
"clean:cache": "rm -rf node_modules && rm -rf .eslintcache && pnpm install", "clean:cache": "rm -rf node_modules && rm -rf .eslintcache && pnpm install",
"lint:eslint": "eslint --cache --max-warnings 0 \"{src,mock}/**/*.{vue,ts,tsx}\" --fix", "lint:eslint": "eslint --cache --max-warnings 0 \"{src,mock,build}/**/*.{vue,js,ts,tsx}\" --fix",
"lint:prettier": "prettier --write \"src/**/*.{js,json,tsx,css,less,scss,vue,html,md}\"", "lint:prettier": "prettier --write \"src/**/*.{js,ts,json,tsx,css,less,scss,vue,html,md}\"",
"lint:stylelint": "stylelint --cache --fix \"**/*.{vue,css,scss,postcss,less}\" --cache --cache-location node_modules/.cache/stylelint/", "lint:stylelint": "stylelint --cache --fix \"**/*.{vue,css,scss,postcss,less}\" --cache --cache-location node_modules/.cache/stylelint/",
"lint:lint-staged": "lint-staged -c ./.husky/lintstagedrc.js", "lint:lint-staged": "lint-staged -c ./.husky/lintstagedrc.js",
"lint:pretty": "pretty-quick --staged", "lint:pretty": "pretty-quick --staged",
@@ -30,27 +30,26 @@
"dependencies": { "dependencies": {
"@amap/amap-jsapi-loader": "^1.0.1", "@amap/amap-jsapi-loader": "^1.0.1",
"@ctrl/tinycolor": "^3.4.1", "@ctrl/tinycolor": "^3.4.1",
"@logicflow/core": "^1.1.24", "@logicflow/core": "^1.1.30",
"@logicflow/extension": "^1.1.24", "@logicflow/extension": "^1.1.30",
"@pureadmin/components": "^1.1.0", "@pureadmin/components": "^1.1.0",
"@pureadmin/descriptions": "^1.1.0", "@pureadmin/descriptions": "^1.1.0",
"@pureadmin/table": "^1.2.0", "@pureadmin/table": "^1.6.0",
"@pureadmin/utils": "^0.1.1", "@pureadmin/utils": "^1.6.7",
"@vueuse/core": "^9.1.0", "@vueuse/core": "^9.5.0",
"@vueuse/motion": "^2.0.0-beta.12", "@vueuse/motion": "2.0.0-beta.12",
"@vueuse/shared": "^9.1.0", "@wangeditor/editor": "^5.1.21",
"@wangeditor/editor": "^5.1.14",
"@wangeditor/editor-for-vue": "^5.1.12", "@wangeditor/editor-for-vue": "^5.1.12",
"animate.css": "^4.1.1", "animate.css": "^4.1.1",
"axios": "^0.27.2", "axios": "^1.1.3",
"china-area-data": "^5.0.1", "china-area-data": "^5.0.1",
"cropperjs": "^1.5.12", "cropperjs": "^1.5.12",
"css-color-function": "^1.3.3", "dayjs": "^1.11.5",
"dayjs": "^1.11.4", "echarts": "^5.4.0",
"driver.js": "^0.9.8", "el-table-infinite-scroll": "^3.0.1",
"echarts": "^5.3.3", "element-plus": "^2.2.22",
"element-plus": "^2.2.13", "element-resize-detector": "^1.2.4",
"element-resize-detector": "^1.2.3", "intro.js": "^6.0.0",
"js-cookie": "^3.0.1", "js-cookie": "^3.0.1",
"jsbarcode": "^3.11.5", "jsbarcode": "^3.11.5",
"lodash": "^4.17.21", "lodash": "^4.17.21",
@@ -60,33 +59,33 @@
"mockjs": "^1.1.0", "mockjs": "^1.1.0",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"path": "^0.12.7", "path": "^0.12.7",
"pinia": "^2.0.19", "pinia": "^2.0.24",
"qrcode": "^1.5.1", "qrcode": "^1.5.1",
"qs": "^6.11.0", "qs": "^6.11.0",
"resize-observer-polyfill": "^1.5.1", "resize-observer-polyfill": "^1.5.1",
"responsive-storage": "^2.1.0", "responsive-storage": "^2.1.0",
"rgb-hex": "^4.0.0",
"sortablejs": "^1.15.0", "sortablejs": "^1.15.0",
"swiper": "^8.3.2", "swiper": "^8.4.4",
"typeit": "^8.7.0",
"v-contextmenu": "3.0.0", "v-contextmenu": "3.0.0",
"vue": "^3.2.37", "vue": "^3.2.45",
"vue-form-create2": "^1.2.8",
"vue-i18n": "^9.2.2", "vue-i18n": "^9.2.2",
"vue-json-pretty": "^2.1.1", "vue-json-pretty": "^2.2.2",
"vue-pdf-embed": "^1.1.4", "vue-pdf-embed": "^1.1.4",
"vue-router": "^4.1.3", "vue-router": "^4.1.6",
"vue-types": "^4.2.1", "vue-types": "^4.2.1",
"vue-virtual-scroller": "^2.0.0-alpha.1", "vue-virtual-scroller": "^2.0.0-alpha.1",
"vue3-danmaku": "^1.0.0",
"vuedraggable": "^4.1.0", "vuedraggable": "^4.1.0",
"vxe-table": "^4.3.0-beta.5", "vxe-table": "^4.3.5",
"xe-utils": "^3.5.6", "xe-utils": "^3.5.7",
"xgplayer": "^2.31.7", "xgplayer": "^2.32.1",
"xlsx": "^0.18.5" "xlsx": "^0.18.5"
}, },
"devDependencies": { "devDependencies": {
"@commitlint/cli": "13.1.0", "@commitlint/cli": "13.1.0",
"@commitlint/config-conventional": "13.1.0", "@commitlint/config-conventional": "13.1.0",
"@faker-js/faker": "^7.4.0", "@faker-js/faker": "^7.5.0",
"@iconify-icons/carbon": "^1.2.8", "@iconify-icons/carbon": "^1.2.8",
"@iconify-icons/ep": "^1.2.7", "@iconify-icons/ep": "^1.2.7",
"@iconify-icons/fa": "^1.2.3", "@iconify-icons/fa": "^1.2.3",
@@ -95,68 +94,70 @@
"@iconify-icons/mdi": "^1.2.8", "@iconify-icons/mdi": "^1.2.8",
"@iconify-icons/ri": "^1.2.3", "@iconify-icons/ri": "^1.2.3",
"@iconify-icons/uil": "^1.2.2", "@iconify-icons/uil": "^1.2.2",
"@iconify/vue": "^3.2.1", "@iconify/vue": "^4.0.0",
"@intlify/vite-plugin-vue-i18n": "^6.0.1", "@intlify/vite-plugin-vue-i18n": "^6.0.3",
"@pureadmin/theme": "^2.4.0", "@pureadmin/theme": "^2.4.0",
"@types/element-resize-detector": "1.1.3", "@types/element-resize-detector": "1.1.3",
"@types/intro.js": "^5.1.0",
"@types/js-cookie": "^3.0.1", "@types/js-cookie": "^3.0.1",
"@types/lodash": "^4.14.180", "@types/lodash": "^4.14.180",
"@types/lodash-es": "^4.17.6", "@types/lodash-es": "^4.17.6",
"@types/mockjs": "1.0.3", "@types/mockjs": "^1.0.7",
"@types/node": "14.14.14", "@types/node": "^18.11.9",
"@types/nprogress": "0.2.0", "@types/nprogress": "0.2.0",
"@types/qrcode": "^1.4.2", "@types/qrcode": "^1.4.2",
"@types/qs": "^6.9.7", "@types/qs": "^6.9.7",
"@types/sortablejs": "^1.13.0", "@types/sortablejs": "^1.13.0",
"@typescript-eslint/eslint-plugin": "^5.10.2", "@typescript-eslint/eslint-plugin": "^5.43.0",
"@typescript-eslint/parser": "^5.10.2", "@typescript-eslint/parser": "^5.43.0",
"@vitejs/plugin-legacy": "^2.0.0", "@vitejs/plugin-vue": "^3.2.0",
"@vitejs/plugin-vue": "^3.0.1", "@vitejs/plugin-vue-jsx": "^2.1.1",
"@vitejs/plugin-vue-jsx": "^2.0.0",
"@vue/eslint-config-prettier": "^7.0.0", "@vue/eslint-config-prettier": "^7.0.0",
"@vue/eslint-config-typescript": "^10.0.0", "@vue/eslint-config-typescript": "^11.0.2",
"@vue/runtime-core": "^3.2.37", "@vue/runtime-core": "^3.2.45",
"autoprefixer": "^10.4.8", "autoprefixer": "^10.4.13",
"cloc": "^2.10.0", "cloc": "^2.10.0",
"cross-env": "7.0.3", "cssnano": "^5.1.14",
"eslint": "^8.8.0", "eslint": "^8.8.0",
"eslint-plugin-prettier": "^4.0.0", "eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-vue": "^8.4.1", "eslint-plugin-vue": "^9.7.0",
"font-awesome": "^4.7.0", "font-awesome": "^4.7.0",
"husky": "^7.0.4", "husky": "^7.0.4",
"lint-staged": "11.1.2", "lint-staged": "11.1.2",
"picocolors": "^1.0.0", "picocolors": "^1.0.0",
"postcss": "^8.4.16", "postcss": "^8.4.18",
"postcss-html": "^1.5.0", "postcss-html": "^1.5.0",
"postcss-import": "^14.1.0", "postcss-import": "^15.0.0",
"postcss-scss": "^4.0.4", "postcss-scss": "^4.0.5",
"prettier": "^2.5.1", "prettier": "^2.5.1",
"pretty-quick": "3.1.1", "pretty-quick": "3.1.1",
"rimraf": "3.0.2", "rimraf": "3.0.2",
"rollup-plugin-visualizer": "^5.7.1", "rollup-plugin-visualizer": "^5.8.3",
"sass": "^1.53.0", "sass": "^1.56.1",
"sass-loader": "^13.0.2", "sass-loader": "^13.2.0",
"stylelint": "^14.3.0", "stylelint": "^14.3.0",
"stylelint-config-html": "^1.0.0", "stylelint-config-html": "^1.0.0",
"stylelint-config-prettier": "^9.0.3", "stylelint-config-prettier": "^9.0.3",
"stylelint-config-recommended": "^6.0.0", "stylelint-config-recommended": "^9.0.0",
"stylelint-config-standard": "^24.0.0", "stylelint-config-standard": "^29.0.0",
"stylelint-order": "^5.0.0", "stylelint-order": "^5.0.0",
"typescript": "^4.7.4", "tailwindcss": "^3.2.4",
"unocss": "^0.45.8", "terser": "^5.15.1",
"unplugin-vue-define-options": "^0.7.3", "typescript": "^4.9.3",
"vite": "^3.0.8", "unplugin-vue-macros": "^0.16.3",
"vite": "3.1.8",
"vite-plugin-cdn-import": "^0.3.5",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-mock": "^2.9.6", "vite-plugin-mock": "^2.9.6",
"vite-plugin-remove-console": "^1.1.0", "vite-plugin-remove-console": "^1.3.0",
"vite-svg-loader": "^3.4.0", "vite-svg-loader": "^3.6.0",
"vue-eslint-parser": "^8.2.0", "vue-eslint-parser": "^9.1.0",
"vue-tsc": "^0.40.1" "vue-tsc": "^1.0.9"
}, },
"pnpm": { "pnpm": {
"peerDependencyRules": { "peerDependencyRules": {
"ignoreMissing": [ "ignoreMissing": [
"rollup", "rollup",
"terser",
"webpack" "webpack"
] ]
} }

3686
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,8 @@
module.exports = { module.exports = {
plugins: [require("autoprefixer"), require("postcss-import")] plugins: {
"postcss-import": {},
tailwindcss: {},
autoprefixer: {},
...(process.env.NODE_ENV === "production" ? { cssnano: {} } : {})
}
}; };

View File

@@ -95,7 +95,6 @@
.c:active { .c:active {
transform: translate(0px, 4px); transform: translate(0px, 4px);
-webkit-transform: translate(0px, 4px);
box-shadow: 0px 1px 0px 0px #3486d5; box-shadow: 0px 1px 0px 0px #3486d5;
} }
@@ -223,8 +222,6 @@
} }
input[type="checkbox"].toggle { input[type="checkbox"].toggle {
-moz-appearance: none;
-webkit-appearance: none;
position: absolute; position: absolute;
width: 100%; width: 100%;
height: 100%; height: 100%;
@@ -299,36 +296,6 @@
animation: anim-out-pseudo 0.75s; animation: anim-out-pseudo 0.75s;
} }
@-webkit-keyframes anim-in {
0% {
width: 0%;
}
100% {
width: 100%;
}
}
@-moz-keyframes anim-in {
0% {
width: 0%;
}
100% {
width: 100%;
}
}
@-ms-keyframes anim-in {
0% {
width: 0%;
}
100% {
width: 100%;
}
}
@keyframes anim-in { @keyframes anim-in {
0% { 0% {
width: 0%; width: 0%;
@@ -339,36 +306,6 @@
} }
} }
@-webkit-keyframes anim-in-pseudo {
0% {
background: rgba(0, 0, 0, 0.3);
}
100% {
background: transparent;
}
}
@-moz-keyframes anim-in-pseudo {
0% {
background: rgba(0, 0, 0, 0.3);
}
100% {
background: transparent;
}
}
@-ms-keyframes anim-in-pseudo {
0% {
background: rgba(0, 0, 0, 0.3);
}
100% {
background: transparent;
}
}
@keyframes anim-in-pseudo { @keyframes anim-in-pseudo {
0% { 0% {
background: rgba(0, 0, 0, 0.3); background: rgba(0, 0, 0, 0.3);
@@ -379,36 +316,6 @@
} }
} }
@-webkit-keyframes anim-out {
0% {
width: 0%;
}
100% {
width: 100%;
}
}
@-moz-keyframes anim-out {
0% {
width: 0%;
}
100% {
width: 100%;
}
}
@-ms-keyframes anim-out {
0% {
width: 0%;
}
100% {
width: 100%;
}
}
@keyframes anim-out { @keyframes anim-out {
0% { 0% {
width: 0%; width: 0%;
@@ -419,36 +326,6 @@
} }
} }
@-webkit-keyframes anim-out-pseudo {
0% {
background: rgba(0, 0, 0, 0.35);
}
100% {
background: transparent;
}
}
@-moz-keyframes anim-out-pseudo {
0% {
background: rgba(0, 0, 0, 0.35);
}
100% {
background: transparent;
}
}
@-ms-keyframes anim-out-pseudo {
0% {
background: rgba(0, 0, 0, 0.35);
}
100% {
background: transparent;
}
}
@keyframes anim-out-pseudo { @keyframes anim-out-pseudo {
0% { 0% {
background: rgba(0, 0, 0, 0.35); background: rgba(0, 0, 0, 0.35);
@@ -515,9 +392,6 @@
.php, .php,
.php::after { .php::after {
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
-o-transition: all 0.5s;
transition: all 0.5s; transition: all 0.5s;
} }

View File

@@ -1,5 +1,5 @@
{ {
"Version": "3.3.5", "Version": "3.7.1",
"Title": "PureAdmin", "Title": "PureAdmin",
"FixedHeader": true, "FixedHeader": true,
"HiddenSideBar": false, "HiddenSideBar": false,
@@ -16,6 +16,7 @@
"EpThemeColor": "#409EFF", "EpThemeColor": "#409EFF",
"ShowLogo": true, "ShowLogo": true,
"ShowModel": "smart", "ShowModel": "smart",
"MenuArrowIconNoTransition": false,
"MapConfigure": { "MapConfigure": {
"amapKey": "97b3248d1553172e81f168cf94ea667e", "amapKey": "97b3248d1553172e81f168cf94ea667e",
"options": { "options": {

View File

@@ -1,15 +1,14 @@
import { http } from "../utils/http"; import { http } from "@/utils/http";
type Result = { type Result = {
success: boolean;
data?: { data?: {
/** 列表数据 */ /** 列表数据 */
list: Array<any>; list: Array<any>;
}; };
code?: number;
msg?: string;
}; };
// 卡片列表 /** 卡片列表 */
export const getCardList = (data?: object) => { export const getCardList = (data?: object) => {
return http.request<Result>("post", "/getCardList", { data }); return http.request<Result>("post", "/getCardList", { data });
}; };

View File

@@ -1,11 +1,11 @@
import { http } from "../utils/http"; import { http } from "@/utils/http";
type Result = { type Result = {
code: number; success: boolean;
info: Array<any>; data: Array<any>;
}; };
// 地图数据 /** 地图数据 */
export const mapJson = (params?: object) => { export const mapJson = (params?: object) => {
return http.request<Result>("get", "/getMapInfo", { params }); return http.request<Result>("get", "/getMapInfo", { params });
}; };

View File

@@ -1,10 +1,10 @@
import { http } from "../utils/http"; import { http } from "@/utils/http";
type Result = { type Result = {
code: number; success: boolean;
info: Array<any>; data: Array<any>;
}; };
export const getAsyncRoutes = (params?: object) => { export const getAsyncRoutes = () => {
return http.request<Result>("get", "/getAsyncRoutes", { params }); return http.request<Result>("get", "/getAsyncRoutes");
}; };

View File

@@ -1,27 +1,26 @@
import { http } from "../utils/http"; import { http } from "@/utils/http";
type Result = { type Result = {
success: boolean;
data?: { data?: {
/** 列表数据 */ /** 列表数据 */
list: Array<any>; list: Array<any>;
/** 总数 */ /** 总数 */
total: number; total?: number;
}; };
code?: number;
msg?: string;
}; };
// 获取用户管理列表 /** 获取用户管理列表 */
export const getUserList = (data?: object) => { export const getUserList = (data?: object) => {
return http.request<Result>("post", "/user", { data }); return http.request<Result>("post", "/user", { data });
}; };
// 获取角色管理列表 /** 获取角色管理列表 */
export const getRoleList = (data?: object) => { export const getRoleList = (data?: object) => {
return http.request<Result>("post", "/role", { data }); return http.request<Result>("post", "/role", { 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 });
}; };

View File

@@ -1,26 +1,39 @@
import { http } from "../utils/http"; import { http } from "@/utils/http";
type Result = { export type UserResult = {
svg?: string; success: boolean;
code?: number; data: {
info?: object; /** 用户名 */
username: string;
/** 当前登陆用户的角色 */
roles: Array<string>;
/** `token` */
accessToken: string;
/** 用于调用刷新`accessToken`的接口时所需的`token` */
refreshToken: string;
/** `accessToken`的过期时间(格式'xxxx/xx/xx xx:xx:xx' */
expires: Date;
};
}; };
// 获取验证码 export type RefreshTokenResult = {
export const getVerify = () => { success: boolean;
return http.request<Result>("get", "/captcha"); data: {
/** `token` */
accessToken: string;
/** 用于调用刷新`accessToken`的接口时所需的`token` */
refreshToken: string;
/** `accessToken`的过期时间(格式'xxxx/xx/xx xx:xx:xx' */
expires: Date;
};
}; };
// 登录 /** 登录 */
export const getLogin = (data: object) => { export const getLogin = (data?: object) => {
return http.request("post", "/login", { data }); return http.request<UserResult>("post", "/login", { data });
}; };
// 刷新token /** 刷新token */
export const refreshToken = (data: object) => { export const refreshTokenApi = (data?: object) => {
return http.request("post", "/refreshToken", { data }); return http.request<RefreshTokenResult>("post", "/refreshToken", { data });
}; };
// export const searchVague = (data: object) => {
// return http.request("post", "/searchVague", { data });
// };

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 36 36"><path d="M19.41 18l8.29-8.29a1 1 0 0 0-1.41-1.41L18 16.59l-8.29-8.3a1 1 0 0 0-1.42 1.42l8.3 8.29l-8.3 8.29A1 1 0 1 0 9.7 27.7l8.3-8.29l8.29 8.29a1 1 0 0 0 1.41-1.41z" fill="currentColor"></path></svg>

Before

Width:  |  Height:  |  Size: 395 B

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 36 36"><path d="M26 17H10a1 1 0 0 0 0 2h16a1 1 0 0 0 0-2z" fill="currentColor"></path></svg>

Before

Width:  |  Height:  |  Size: 279 B

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><g fill="none"><path d="M7 12l7 7" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path><path d="M7 12l7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path><path d="M21 12H7.5" stroke="currentColor" stroke-width="2" stroke-linecap="round" ></path><path d="M3 3v18" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></g></svg>

Before

Width:  |  Height:  |  Size: 647 B

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 20 20"><path d="M3 5h14V3H3v2zm12 8V7H5v6h10zM3 17h14v-2H3v2z" fill="currentColor"></path></svg>

Before

Width:  |  Height:  |  Size: 284 B

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><g transform="translate(24 0) scale(-1 1)"><g fill="none"><path d="M7 12l7 7" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path><path d="M7 12l7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path><path d="M21 12H7.5" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path><path d="M3 3v18" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></g></g></svg>

Before

Width:  |  Height:  |  Size: 693 B

View File

Before

Width:  |  Height:  |  Size: 477 B

After

Width:  |  Height:  |  Size: 477 B

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 512 512"><path d="M400 148l-21.12-24.57A191.43 191.43 0 0 0 240 64C134 64 48 150 48 256s86 192 192 192a192.09 192.09 0 0 0 181.07-128" fill="none" stroke="currentColor" stroke-linecap="square" stroke-miterlimit="10" stroke-width="32"></path><path d="M464 68.45V220a4 4 0 0 1-4 4H308.45a4 4 0 0 1-2.83-6.83L457.17 65.62a4 4 0 0 1 6.83 2.83z" fill="currentColor"></path></svg>

Before

Width:  |  Height:  |  Size: 561 B

View File

@@ -0,0 +1,5 @@
import auth from "./src/auth";
const Auth = auth;
export { Auth };

View File

@@ -0,0 +1,20 @@
import { defineComponent, Fragment } from "vue";
import { hasAuth } from "@/router/utils";
export default defineComponent({
name: "Auth",
props: {
value: {
type: undefined,
default: []
}
},
setup(props, { slots }) {
return () => {
if (!slots) return null;
return hasAuth(props.value) ? (
<Fragment>{slots.default?.()}</Fragment>
) : null;
};
}
});

View File

@@ -1,5 +1,5 @@
import { PropType } from "vue"; import { 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,5 +1,5 @@
import { PropType } from "vue"; import { 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

@@ -8,7 +8,6 @@ import {
computed, computed,
PropType PropType
} from "vue"; } from "vue";
import { templateRef } from "@vueuse/core";
import { useAttrs } from "@pureadmin/utils"; import { useAttrs } from "@pureadmin/utils";
import Cropper from "cropperjs"; import Cropper from "cropperjs";
@@ -78,7 +77,7 @@ export default defineComponent({
props, props,
setup(props) { setup(props) {
const cropper: any = ref<Nullable<Cropper>>(null); const cropper: any = ref<Nullable<Cropper>>(null);
const imgElRef = templateRef<HTMLImageElement | null>("imgElRef", null); const imgElRef = ref();
const isReady = ref<boolean>(false); const isReady = ref<boolean>(false);

View File

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

View File

@@ -1,22 +1,21 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, unref, nextTick, onUnmounted } from "vue"; import { ref, unref, nextTick, onUnmounted } from "vue";
import { templateRef } from "@vueuse/core";
import flippers from "./filpper"; import flippers from "./filpper";
let timer = ref(null); const timer = ref(null);
let flipObjs = ref([]); const flipObjs = ref([]);
const flipperHour1 = templateRef<HTMLElement | null>("flipperHour1", null); const flipperHour1 = ref();
const flipperHour2 = templateRef<HTMLElement | null>("flipperHour2", null); const flipperHour2 = ref();
const flipperMinute1 = templateRef<HTMLElement | null>("flipperMinute1", null); const flipperMinute1 = ref();
const flipperMinute2 = templateRef<HTMLElement | null>("flipperMinute2", null); const flipperMinute2 = ref();
const flipperSecond1 = templateRef<HTMLElement | null>("flipperSecond1", null); const flipperSecond1 = ref();
const flipperSecond2 = templateRef<HTMLElement | null>("flipperSecond2", null); const flipperSecond2 = ref();
// 初始化数字 // 初始化数字
const init = () => { const init = () => {
let now = new Date(); const now = new Date();
let nowTimeStr = formatDate(new Date(now.getTime()), "hhiiss"); const nowTimeStr = formatDate(new Date(now.getTime()), "hhiiss");
for (let i = 0; i < flipObjs.value.length; i++) { for (let i = 0; i < flipObjs.value.length; i++) {
flipObjs?.value[i]?.setFront(nowTimeStr[i]); flipObjs?.value[i]?.setFront(nowTimeStr[i]);
} }
@@ -26,9 +25,9 @@ const init = () => {
const run = () => { const run = () => {
timer.value = setInterval(() => { timer.value = setInterval(() => {
// 获取当前时间 // 获取当前时间
let now = new Date(); const now = new Date();
let nowTimeStr = formatDate(new Date(now.getTime() - 1000), "hhiiss"); const nowTimeStr = formatDate(new Date(now.getTime() - 1000), "hhiiss");
let nextTimeStr = formatDate(now, "hhiiss"); const nextTimeStr = formatDate(now, "hhiiss");
for (let i = 0; i < flipObjs.value.length; i++) { for (let i = 0; i < flipObjs.value.length; i++) {
if (nowTimeStr[i] === nextTimeStr[i]) { if (nowTimeStr[i] === nextTimeStr[i]) {
continue; continue;
@@ -52,17 +51,17 @@ const formatDate = (date: Date, dateFormat: string) => {
); );
} }
// 格式化月、日、时、分、秒 // 格式化月、日、时、分、秒
let o = { const o = {
"m+": date.getMonth() + 1, "m+": date.getMonth() + 1,
"d+": date.getDate(), "d+": date.getDate(),
"h+": date.getHours(), "h+": date.getHours(),
"i+": date.getMinutes(), "i+": date.getMinutes(),
"s+": date.getSeconds() "s+": date.getSeconds()
}; };
for (let k in o) { for (const k in o) {
if (new RegExp(`(${k})`).test(dateFormat)) { if (new RegExp(`(${k})`).test(dateFormat)) {
// 取出对应的值 // 取出对应的值
let str = o[k] + ""; const str = o[k] + "";
/* 根据设置的格式,输出对应的字符 /* 根据设置的格式,输出对应的字符
* 例如: 早上8时hh => 08h => 8 * 例如: 早上8时hh => 08h => 8
* 但是,当数字>=10时无论格式为一位还是多位不做截取这是与年份格式化不一致的地方 * 但是,当数字>=10时无论格式为一位还是多位不做截取这是与年份格式化不一致的地方

View File

@@ -1,6 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, unref, onMounted } from "vue"; import { ref, unref, onMounted } from "vue";
import { templateRef } from "@vueuse/core";
import { LogicFlow } from "@logicflow/core"; import { LogicFlow } from "@logicflow/core";
interface Props { interface Props {
@@ -16,11 +15,11 @@ const emit = defineEmits<{
(e: "catData"): void; (e: "catData"): void;
}>(); }>();
const controlButton3 = templateRef<HTMLElement | any>("controlButton3", null); const controlButton3 = ref();
const controlButton4 = templateRef<HTMLElement | any>("controlButton4", null); const controlButton4 = ref();
let focusIndex = ref<Number>(-1); const focusIndex = ref<Number>(-1);
let titleLists = ref([ const titleLists = ref([
{ {
icon: "icon-zoom-out-hs", icon: "icon-zoom-out-hs",
text: "缩小", text: "缩小",
@@ -68,7 +67,7 @@ let titleLists = ref([
const onControl = (item, key) => { const onControl = (item, key) => {
["zoom", "zoom", "resetZoom", "undo", "redo", "getSnapshot"].forEach( ["zoom", "zoom", "resetZoom", "undo", "redo", "getSnapshot"].forEach(
(v, i) => { (v, i) => {
let domControl = props.lf; const domControl = props.lf;
if (key === 1) { if (key === 1) {
domControl.zoom(true); domControl.zoom(true);
} }
@@ -102,7 +101,7 @@ onMounted(() => {
v-for="(item, key) in titleLists" v-for="(item, key) in titleLists"
:key="key" :key="key"
:title="item.text" :title="item.text"
class="dark:color-bg_color" class="dark:text-bg_color"
@mouseenter.prevent="onEnter(key)" @mouseenter.prevent="onEnter(key)"
@mouseleave.prevent="focusIndex = -1" @mouseleave.prevent="focusIndex = -1"
> >
@@ -116,7 +115,8 @@ onMounted(() => {
:disabled="item.disabled" :disabled="item.disabled"
:style="{ :style="{
cursor: item.disabled === false ? 'pointer' : 'not-allowed', cursor: item.disabled === false ? 'pointer' : 'not-allowed',
color: item.disabled === false ? '' : '#00000040' color: item.disabled === false ? '' : '#00000040',
background: 'transparent'
}" }"
@click="onControl(item, key)" @click="onControl(item, key)"
> >

View File

@@ -18,7 +18,7 @@ const props = withDefaults(defineProps<Props>(), {
nodeList: null nodeList: null
}); });
let properties = ref({ const properties = ref({
a: "efrwe", a: "efrwe",
b: "wewe" b: "wewe"
}); });
@@ -35,7 +35,7 @@ const nodeDragNode = item => {
<!-- 左侧bpmn元素选择器 --> <!-- 左侧bpmn元素选择器 -->
<div class="node-panel"> <div class="node-panel">
<div <div
class="node-item dark:color-bg_color" class="node-item dark:text-bg_color"
v-for="item in props.nodeList" v-for="item in props.nodeList"
:key="item.text" :key="item.text"
@mousedown="nodeDragNode(item)" @mousedown="nodeDragNode(item)"

View File

@@ -3,7 +3,7 @@ import iconifyIconOnline from "./src/iconifyIconOnline";
import iconSelect from "./src/Select.vue"; import iconSelect from "./src/Select.vue";
import fontIcon from "./src/iconfont"; import fontIcon from "./src/iconfont";
/** 离线图标组件 */ /** 本地图标组件 */
const IconifyIconOffline = iconifyIconOffline; const IconifyIconOffline = iconifyIconOffline;
/** 在线图标组件 */ /** 在线图标组件 */
const IconifyIconOnline = iconifyIconOnline; const IconifyIconOnline = iconifyIconOnline;

View File

@@ -1,7 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { cloneDeep } from "lodash-unified"; import { cloneDeep } from "lodash-unified";
import { ref, computed, CSSProperties, toRef, watch } from "vue"; import { ref, computed, CSSProperties, toRef, watch } from "vue";
import { IconJson } from "/@/components/ReIcon/data"; import { IconJson } from "@/components/ReIcon/data";
type ParameterCSSProperties = (item?: string) => CSSProperties | undefined; type ParameterCSSProperties = (item?: string) => CSSProperties | undefined;
defineOptions({ defineOptions({
@@ -16,21 +16,21 @@ const props = defineProps({
}); });
const emit = defineEmits<{ (e: "update:modelValue", v: string) }>(); const emit = defineEmits<{ (e: "update:modelValue", v: string) }>();
let visible = ref(false); const visible = ref(false);
let inputValue = toRef(props, "modelValue"); const inputValue = toRef(props, "modelValue");
let iconList = ref(IconJson); const iconList = ref(IconJson);
let icon = ref("add-location"); const icon = ref("add-location");
let currentActiveType = ref("ep:"); const currentActiveType = ref("ep:");
// 深拷贝图标数据,前端做搜索 // 深拷贝图标数据,前端做搜索
let copyIconList = cloneDeep(iconList.value); const copyIconList = cloneDeep(iconList.value);
let pageSize = ref(96); const pageSize = ref(96);
let currentPage = ref(1); const currentPage = ref(1);
// 搜索条件 // 搜索条件
let filterValue = ref(""); const filterValue = ref("");
let tabsList = [ const tabsList = [
{ {
label: "Element Plus", label: "Element Plus",
name: "ep:" name: "ep:"
@@ -45,7 +45,7 @@ let tabsList = [
} }
]; ];
let pageList = computed(() => { const pageList = computed(() => {
if (currentPage.value === 1) { if (currentPage.value === 1) {
return copyIconList[currentActiveType.value] return copyIconList[currentActiveType.value]
.filter(v => v.includes(filterValue.value)) .filter(v => v.includes(filterValue.value))
@@ -118,7 +118,7 @@ watch(
</script> </script>
<template> <template>
<div class="selector w-350px"> <div class="selector w-[350px]">
<el-input v-model="inputValue" disabled> <el-input v-model="inputValue" disabled>
<template #append> <template #append>
<el-popover <el-popover
@@ -132,7 +132,7 @@ watch(
> >
<template #reference> <template #reference>
<div <div
class="w-40px h-32px cursor-pointer flex justify-center items-center" class="w-[40px] h-[32px] cursor-pointer flex justify-center items-center"
@click="visible = !visible" @click="visible = !visible"
> >
<IconifyIconOnline :icon="currentActiveType + icon" /> <IconifyIconOnline :icon="currentActiveType + icon" />
@@ -161,7 +161,7 @@ watch(
v-for="(item, key) in pageList" v-for="(item, key) in pageList"
:key="key" :key="key"
:title="item" :title="item"
class="icon-item p-2 w-1/10 cursor-pointer mr-2 mt-1 flex justify-center items-center border border-solid" class="icon-item p-2 w-[1/10] cursor-pointer mr-2 mt-1 flex justify-center items-center border border-solid"
:style="iconItemStyle(item)" :style="iconItemStyle(item)"
@click="onChangeIcon(item)" @click="onChangeIcon(item)"
> >

View File

@@ -3,7 +3,8 @@ import { h, defineComponent, Component } from "vue";
import { IconifyIconOnline, IconifyIconOffline, FontIcon } from "../index"; import { IconifyIconOnline, IconifyIconOffline, FontIcon } from "../index";
/** /**
* 支持fontawesome4、5+、iconfont、remixicon、element-plus的icons、自定义svg * 支持 `iconfont`、自定义 `svg` 以及 `iconify` 中所有的图标
* @see 点击查看文档图标篇 {@link https://yiming_chang.gitee.io/pure-admin-doc/pages/icon/}
* @param icon 必传 图标 * @param icon 必传 图标
* @param attrs 可选 iconType 属性 * @param attrs 可选 iconType 属性
* @returns Component * @returns Component
@@ -34,11 +35,12 @@ export function useRenderIcon(icon: any, attrs?: iconType): Component {
// svg // svg
return icon; return icon;
} else { } else {
// 通过是否存在 : 符号来判断是在线还是本地图标,存在即是在线图标,反之
return defineComponent({ return defineComponent({
name: "Icon", name: "Icon",
render() { render() {
const IconifyIcon = const IconifyIcon =
attrs && attrs["online"] ? IconifyIconOnline : IconifyIconOffline; icon && icon.includes(":") ? IconifyIconOnline : IconifyIconOffline;
return h(IconifyIcon, { return h(IconifyIcon, {
icon: icon, icon: icon,
...attrs ...attrs

View File

@@ -7,13 +7,11 @@ import Menu from "@iconify-icons/ep/menu";
import HomeFilled from "@iconify-icons/ep/home-filled"; import HomeFilled from "@iconify-icons/ep/home-filled";
import SetUp from "@iconify-icons/ep/set-up"; import SetUp from "@iconify-icons/ep/set-up";
import Edit from "@iconify-icons/ep/edit"; import Edit from "@iconify-icons/ep/edit";
import Setting from "@iconify-icons/ep/setting";
import Lollipop from "@iconify-icons/ep/lollipop"; import Lollipop from "@iconify-icons/ep/lollipop";
import Link from "@iconify-icons/ep/link"; import Link from "@iconify-icons/ep/link";
import Position from "@iconify-icons/ep/position"; import Position from "@iconify-icons/ep/position";
import Histogram from "@iconify-icons/ep/histogram"; import Histogram from "@iconify-icons/ep/histogram";
import RefreshRight from "@iconify-icons/ep/refresh-right"; import RefreshRight from "@iconify-icons/ep/refresh-right";
import ArrowDown from "@iconify-icons/ep/arrow-down";
import Close from "@iconify-icons/ep/close"; import Close from "@iconify-icons/ep/close";
import CloseBold from "@iconify-icons/ep/close-bold"; import CloseBold from "@iconify-icons/ep/close-bold";
import Bell from "@iconify-icons/ep/bell"; import Bell from "@iconify-icons/ep/bell";
@@ -31,18 +29,20 @@ import Refresh from "@iconify-icons/ep/refresh";
import EditPen from "@iconify-icons/ep/edit-pen"; import EditPen from "@iconify-icons/ep/edit-pen";
import Delete from "@iconify-icons/ep/delete"; import Delete from "@iconify-icons/ep/delete";
import More from "@iconify-icons/ep/more-filled"; import More from "@iconify-icons/ep/more-filled";
import EpArrowDown from "@iconify-icons/ep/arrow-down";
import ArrowUp from "@iconify-icons/ep/arrow-up";
import ArrowRight from "@iconify-icons/ep/arrow-right";
import ArrowLeft from "@iconify-icons/ep/arrow-left";
addIcon("check", Check); addIcon("check", Check);
addIcon("menu", Menu); addIcon("menu", Menu);
addIcon("home-filled", HomeFilled); addIcon("home-filled", HomeFilled);
addIcon("set-up", SetUp); addIcon("set-up", SetUp);
addIcon("edit", Edit); addIcon("edit", Edit);
addIcon("setting", Setting);
addIcon("lollipop", Lollipop); addIcon("lollipop", Lollipop);
addIcon("link", Link); addIcon("link", Link);
addIcon("position", Position); addIcon("position", Position);
addIcon("histogram", Histogram); addIcon("histogram", Histogram);
addIcon("refresh-right", RefreshRight); addIcon("refresh-right", RefreshRight);
addIcon("arrow-down", ArrowDown);
addIcon("close", Close); addIcon("close", Close);
addIcon("close-bold", CloseBold); addIcon("close-bold", CloseBold);
addIcon("bell", Bell); addIcon("bell", Bell);
@@ -60,6 +60,10 @@ addIcon("refresh", Refresh);
addIcon("edits", EditPen); addIcon("edits", EditPen);
addIcon("delete", Delete); addIcon("delete", Delete);
addIcon("more", More); addIcon("more", More);
addIcon("ep-arrow-down", EpArrowDown);
addIcon("ep-arrow-up", ArrowUp);
addIcon("ep-arrow-right", ArrowRight);
addIcon("ep-arrow-left", ArrowLeft);
// remixicon // remixicon
import ArrowRightSLine from "@iconify-icons/ri/arrow-right-s-line"; import ArrowRightSLine from "@iconify-icons/ri/arrow-right-s-line";
@@ -89,6 +93,14 @@ import User from "@iconify-icons/ri/user-3-fill";
import Lock from "@iconify-icons/ri/lock-fill"; import Lock from "@iconify-icons/ri/lock-fill";
import MenuUnfold from "@iconify-icons/ri/menu-unfold-fill"; import MenuUnfold from "@iconify-icons/ri/menu-unfold-fill";
import MenuFold from "@iconify-icons/ri/menu-fold-fill"; import MenuFold from "@iconify-icons/ri/menu-fold-fill";
import Setting from "@iconify-icons/ri/settings-3-line";
import ArrowDown from "@iconify-icons/ri/arrow-down-s-line";
import CloseLeftTags from "@iconify-icons/ri/text-direction-r";
import CloseRightTags from "@iconify-icons/ri/text-direction-l";
import CloseOtherTags from "@iconify-icons/ri/text-spacing";
import CloseAllTags from "@iconify-icons/ri/subtract-line";
import Fullscreen from "@iconify-icons/ri/fullscreen-fill";
import ExitFullscreen from "@iconify-icons/ri/fullscreen-exit-fill";
addIcon("arrow-right-s-line", ArrowRightSLine); addIcon("arrow-right-s-line", ArrowRightSLine);
addIcon("arrow-left-s-line", ArrowLeftSLine); addIcon("arrow-left-s-line", ArrowLeftSLine);
addIcon("logout-circle-r-line", LogoutCircleRLine); addIcon("logout-circle-r-line", LogoutCircleRLine);
@@ -116,6 +128,14 @@ addIcon("user", User);
addIcon("lock", Lock); addIcon("lock", Lock);
addIcon("menu-unfold", MenuUnfold); addIcon("menu-unfold", MenuUnfold);
addIcon("menu-fold", MenuFold); addIcon("menu-fold", MenuFold);
addIcon("setting", Setting);
addIcon("arrow-down", ArrowDown);
addIcon("close-left-tags", CloseLeftTags);
addIcon("close-right-tags", CloseRightTags);
addIcon("close-other-tags", CloseOtherTags);
addIcon("close-all-tags", CloseAllTags);
addIcon("fullscreen", Fullscreen);
addIcon("exit-fullscreen", ExitFullscreen);
// Font Awesome 4 // Font Awesome 4
import FaUser from "@iconify-icons/fa/user"; import FaUser from "@iconify-icons/fa/user";
@@ -149,7 +169,7 @@ addIcon("unExpand", UnExpand);
import LocationCompany from "@iconify-icons/carbon/location-company"; import LocationCompany from "@iconify-icons/carbon/location-company";
addIcon("location-company", LocationCompany); addIcon("location-company", LocationCompany);
// Iconify Icon在Vue里离线使用用于内网环境https://docs.iconify.design/icon-components/vue/offline.html // Iconify Icon在Vue里本地使用用于内网环境https://docs.iconify.design/icon-components/vue/offline.html
export default defineComponent({ export default defineComponent({
name: "IconifyIconOffline", name: "IconifyIconOffline",
components: { IconifyIcon }, components: { IconifyIcon },

View File

@@ -11,7 +11,6 @@ export interface iconType {
horizontalAlign?: boolean; horizontalAlign?: boolean;
verticalAlign?: boolean; verticalAlign?: boolean;
align?: string; align?: string;
online?: boolean;
onLoad?: Function; onLoad?: Function;
includes?: Function; includes?: Function;

View File

@@ -2,8 +2,8 @@
import { reactive, getCurrentInstance, onBeforeMount, onUnmounted } from "vue"; import { reactive, getCurrentInstance, onBeforeMount, onUnmounted } from "vue";
import { deviceDetection } from "@pureadmin/utils"; import { deviceDetection } from "@pureadmin/utils";
import AMapLoader from "@amap/amap-jsapi-loader"; import AMapLoader from "@amap/amap-jsapi-loader";
import { mapJson } from "/@/api/mock"; import { mapJson } from "@/api/mock";
import car from "/@/assets/car.png"; import car from "@/assets/car.png";
export interface MapConfigureInter { export interface MapConfigureInter {
on: Fn; on: Fn;
@@ -39,8 +39,8 @@ const complete = (): void => {
onBeforeMount(() => { onBeforeMount(() => {
if (!instance) return; if (!instance) return;
let { MapConfigure } = instance.appContext.config.globalProperties.$config; const { MapConfigure } = instance.appContext.config.globalProperties.$config;
let { options } = MapConfigure; const { options } = MapConfigure;
AMapLoader.load({ AMapLoader.load({
key: MapConfigure.amapKey, key: MapConfigure.amapKey,
@@ -67,10 +67,10 @@ onBeforeMount(() => {
gridSize: 80, gridSize: 80,
maxZoom: 14, maxZoom: 14,
renderMarker(ctx) { renderMarker(ctx) {
let { marker, data } = ctx; const { marker, data } = ctx;
if (Array.isArray(data) && data[0]) { if (Array.isArray(data) && data[0]) {
var { driver, plateNumber, orientation } = data[0]; const { driver, plateNumber, orientation } = data[0];
var content = `<img style="transform: scale(1) rotate(${ const content = `<img style="transform: scale(1) rotate(${
360 - Number(orientation) 360 - Number(orientation)
}deg);" src='${car}' />`; }deg);" src='${car}' />`;
marker.setContent(content); marker.setContent(content);
@@ -92,8 +92,8 @@ onBeforeMount(() => {
// 获取模拟车辆信息 // 获取模拟车辆信息
mapJson() mapJson()
.then(({ info }) => { .then(({ data }) => {
let points: object = info.map(v => { const points: object = data.map(v => {
return { return {
lnglat: [v.lng, v.lat], lnglat: [v.lng, v.lat],
...v ...v

View File

@@ -10,7 +10,7 @@ import {
import "./index.scss"; import "./index.scss";
import { cloneDeep } from "lodash-unified"; import { cloneDeep } from "lodash-unified";
import { isString } from "@pureadmin/utils"; import { isString } from "@pureadmin/utils";
import { propTypes } from "/@/utils/propTypes"; import { propTypes } from "@/utils/propTypes";
import { IconifyIconOffline } from "../../ReIcon"; import { IconifyIconOffline } from "../../ReIcon";
import QRCode, { QRCodeRenderersOptions } from "qrcode"; import QRCode, { QRCodeRenderersOptions } from "qrcode";
@@ -78,7 +78,7 @@ export default defineComponent({
const _width: number = await getOriginWidth(unref(renderText), options); const _width: number = await getOriginWidth(unref(renderText), options);
options.scale = options.scale =
props.width === 0 ? undefined : (props.width / _width) * 4; props.width === 0 ? undefined : (props.width / _width) * 4;
const canvasRef: HTMLCanvasElement = await toCanvas( const canvasRef: any = await toCanvas(
unref(wrapRef) as HTMLCanvasElement, unref(wrapRef) as HTMLCanvasElement,
unref(renderText), unref(renderText),
options options

View File

@@ -28,16 +28,16 @@ const emit = defineEmits<{
(e: "scrollEnd"): void; (e: "scrollEnd"): void;
}>(); }>();
let xPos = ref<number>(0); const xPos = ref<number>(0);
let yPos = ref<number>(0); const yPos = ref<number>(0);
let delay = ref<number>(0); const delay = ref<number>(0);
let height = ref<number>(0); const height = ref<number>(0);
// 外容器宽度 // 外容器宽度
let width = ref<number>(0); const width = ref<number>(0);
// 内容实际宽度 // 内容实际宽度
let realBoxWidth = ref<number>(0); const realBoxWidth = ref<number>(0);
let realBoxHeight = ref<number>(0); const realBoxHeight = ref<number>(0);
let copyHtml = ref(""); const copyHtml = ref("");
// single 单步滚动的定时器 // single 单步滚动的定时器
let singleWaitTime = null; let singleWaitTime = null;
// move动画的animationFrame定时器 // move动画的animationFrame定时器
@@ -52,7 +52,7 @@ let isHover = false;
let ease = "ease-in"; let ease = "ease-in";
// eslint-disable-next-line vue/no-setup-props-destructure // eslint-disable-next-line vue/no-setup-props-destructure
let { classOption } = props; const { classOption } = props;
if (classOption["key"] === undefined) { if (classOption["key"] === undefined) {
classOption["key"] = 0; classOption["key"] = 0;
@@ -68,15 +68,15 @@ const realBox = templateRef<HTMLElement | null>(
null null
); );
let leftSwitchState = computed(() => { const leftSwitchState = computed(() => {
return unref(xPos) < 0; return unref(xPos) < 0;
}); });
let rightSwitchState = computed(() => { const rightSwitchState = computed(() => {
return Math.abs(unref(xPos)) < unref(realBoxWidth) - unref(width); return Math.abs(unref(xPos)) < unref(realBoxWidth) - unref(width);
}); });
let defaultOption = computed(() => { const defaultOption = computed(() => {
return { return {
//步长 //步长
step: 1, step: 1,
@@ -105,7 +105,7 @@ let defaultOption = computed(() => {
}; };
}); });
let options = computed(() => { const options = computed(() => {
// @ts-expect-error // @ts-expect-error
return copyObj({}, unref(defaultOption), classOption); return copyObj({}, unref(defaultOption), classOption);
}); });
@@ -114,11 +114,11 @@ const leftSwitchClass = computed(() => {
return unref(leftSwitchState) ? "" : unref(options).switchDisabledClass; return unref(leftSwitchState) ? "" : unref(options).switchDisabledClass;
}); });
let rightSwitchClass = computed(() => { const rightSwitchClass = computed(() => {
return unref(rightSwitchState) ? "" : unref(options).switchDisabledClass; return unref(rightSwitchState) ? "" : unref(options).switchDisabledClass;
}); });
let leftSwitch = computed((): CSSProperties => { const leftSwitch = computed((): CSSProperties => {
return { return {
position: "absolute", position: "absolute",
margin: `${unref(height) / 2}px 0 0 -${unref(options).switchOffset}px`, margin: `${unref(height) / 2}px 0 0 -${unref(options).switchOffset}px`,
@@ -126,7 +126,7 @@ let leftSwitch = computed((): CSSProperties => {
}; };
}); });
let rightSwitch = computed((): CSSProperties => { const rightSwitch = computed((): CSSProperties => {
return { return {
position: "absolute", position: "absolute",
margin: `${unref(height) / 2}px 0 0 ${ margin: `${unref(height) / 2}px 0 0 ${
@@ -136,19 +136,19 @@ let rightSwitch = computed((): CSSProperties => {
}; };
}); });
let isHorizontal = computed(() => { const isHorizontal = computed(() => {
return ( return (
unref(options).direction !== "bottom" && unref(options).direction !== "top" unref(options).direction !== "bottom" && unref(options).direction !== "top"
); );
}); });
let float = computed((): CSSProperties => { const float = computed((): CSSProperties => {
return unref(isHorizontal) return unref(isHorizontal)
? { float: "left", overflow: "hidden" } ? { float: "left", overflow: "hidden" }
: { overflow: "hidden" }; : { overflow: "hidden" };
}); });
let pos = computed(() => { const pos = computed(() => {
return { return {
transform: `translate(${unref(xPos)}px,${unref(yPos)}px)`, transform: `translate(${unref(xPos)}px,${unref(yPos)}px)`,
transition: `all ${ease} ${unref(delay)}ms`, transition: `all ${ease} ${unref(delay)}ms`,
@@ -156,45 +156,45 @@ let pos = computed(() => {
}; };
}); });
let navigation = computed(() => { const navigation = computed(() => {
return unref(options).navigation; return unref(options).navigation;
}); });
let autoPlay = computed(() => { const autoPlay = computed(() => {
if (unref(navigation)) return false; if (unref(navigation)) return false;
return unref(options).autoPlay; return unref(options).autoPlay;
}); });
let scrollSwitch = computed(() => { const scrollSwitch = computed(() => {
// 从 props 解构出来的 属性 不再具有应性. // 从 props 解构出来的 属性 不再具有应性.
return (props.data as any).length >= unref(options).limitMoveNum; return (props.data as any).length >= unref(options).limitMoveNum;
}); });
let hoverStopSwitch = computed(() => { const hoverStopSwitch = computed(() => {
return unref(options).hoverStop && unref(autoPlay) && unref(scrollSwitch); return unref(options).hoverStop && unref(autoPlay) && unref(scrollSwitch);
}); });
let canTouchScroll = computed(() => { const canTouchScroll = computed(() => {
return unref(options).openTouch; return unref(options).openTouch;
}); });
let baseFontSize = computed(() => { const baseFontSize = computed(() => {
return unref(options).isSingleRemUnit return unref(options).isSingleRemUnit
? parseInt(window.getComputedStyle(document.documentElement, null).fontSize) ? parseInt(window.getComputedStyle(document.documentElement, null).fontSize)
: 1; : 1;
}); });
let realSingleStopWidth = computed(() => { const realSingleStopWidth = computed(() => {
return unref(options).singleWidth * unref(baseFontSize); return unref(options).singleWidth * unref(baseFontSize);
}); });
let realSingleStopHeight = computed(() => { const realSingleStopHeight = computed(() => {
return unref(options).singleHeight * unref(baseFontSize); return unref(options).singleHeight * unref(baseFontSize);
}); });
let step = computed(() => { const step = computed(() => {
let singleStep; let singleStep;
let step = unref(options).step; const step = unref(options).step;
if (unref(isHorizontal)) { if (unref(isHorizontal)) {
singleStep = unref(realSingleStopWidth); singleStep = unref(realSingleStopWidth);
} else { } else {
@@ -275,7 +275,7 @@ function touchMove(e) {
return; return;
const touch = e.targetTouches[0]; const touch = e.targetTouches[0];
const { direction } = unref(options); const { direction } = unref(options);
let endPos = { const endPos = {
x: touch.pageX - startPos.x, x: touch.pageX - startPos.x,
y: touch.pageY - startPos.y y: touch.pageY - startPos.y
}; };
@@ -300,18 +300,19 @@ function touchMove(e) {
function touchEnd() { function touchEnd() {
if (!unref(canTouchScroll)) return; if (!unref(canTouchScroll)) return;
let timer; // eslint-disable-next-line prefer-const
let timer: any;
const direction = unref(options).direction; const direction = unref(options).direction;
delay.value = 50; delay.value = 50;
if (direction === "top") { if (direction === "top") {
if (unref(yPos) > 0) yPos.value = 0; if (unref(yPos) > 0) yPos.value = 0;
} else if (direction === "bottom") { } else if (direction === "bottom") {
let h = (unref(realBoxHeight) / 2) * -1; const h = (unref(realBoxHeight) / 2) * -1;
if (unref(yPos) < h) yPos.value = h; if (unref(yPos) < h) yPos.value = h;
} else if (direction === "left") { } else if (direction === "left") {
if (unref(xPos) > 0) xPos.value = 0; if (unref(xPos) > 0) xPos.value = 0;
} else if (direction === "right") { } else if (direction === "right") {
let w = unref(realBoxWidth) * -1; const w = unref(realBoxWidth) * -1;
if (unref(xPos) < w) xPos.value = w; if (unref(xPos) < w) xPos.value = w;
} }
if (timer) clearTimeout(timer); if (timer) clearTimeout(timer);
@@ -339,7 +340,7 @@ function scrollMove() {
const h = unref(realBoxHeight) / 2; const h = unref(realBoxHeight) / 2;
//宽度 //宽度
const w = unref(realBoxWidth) / 2; const w = unref(realBoxWidth) / 2;
let { direction, waitTime } = unref(options); const { direction, waitTime } = unref(options);
if (direction === "top") { if (direction === "top") {
// 上 // 上
if (Math.abs(unref(yPos)) >= h) { if (Math.abs(unref(yPos)) >= h) {
@@ -428,7 +429,7 @@ function scrollInitMove() {
if (timer) clearTimeout(timer); if (timer) clearTimeout(timer);
copyHtml.value = unref(slotList).innerHTML; copyHtml.value = unref(slotList).innerHTML;
setTimeout(() => { setTimeout(() => {
realBoxHeight.value = unref(realBox).offsetHeight; realBoxHeight.value = unref(realBox)?.offsetHeight;
scrollMove(); scrollMove();
}, 0); }, 0);
} else { } else {
@@ -454,7 +455,6 @@ function scrollStopMove() {
// 鼠标滚轮事件 // 鼠标滚轮事件
function wheel(e) { function wheel(e) {
e.preventDefault();
if ( if (
unref(options).direction === "left" || unref(options).direction === "left" ||
unref(options).direction === "right" unref(options).direction === "right"
@@ -517,10 +517,10 @@ defineExpose({
:style="pos" :style="pos"
@mouseenter="enter" @mouseenter="enter"
@mouseleave="leave" @mouseleave="leave"
@touchstart="touchStart" @touchstart.passive="touchStart"
@touchmove="touchMove" @touchmove.passive="touchMove"
@touchend="touchEnd" @touchend="touchEnd"
@mousewheel="wheel" @mousewheel.passive="wheel"
> >
<div :ref="'slotList' + classOption['key']" :style="float"> <div :ref="'slotList' + classOption['key']" :style="float">
<slot /> <slot />

View File

@@ -1,5 +1,5 @@
import { defineComponent, ref, computed, PropType } from "vue"; import { defineComponent, ref, computed, PropType } from "vue";
import { useEpThemeStoreHook } from "/@/store/modules/epTheme"; import { useEpThemeStoreHook } from "@/store/modules/epTheme";
import { IconifyIconOffline } from "../../ReIcon"; import { IconifyIconOffline } from "../../ReIcon";
export const loadingSvg = ` export const loadingSvg = `
@@ -117,12 +117,12 @@ export default defineComponent({
<> <>
<div <div
{...attrs} {...attrs}
class="w-99/100 mt-6 p-2 bg-white dark:bg-dark" class="w-[99/100] mt-6 p-2 bg-bg_color"
v-loading={props.loading} v-loading={props.loading}
element-loading-svg={loadingSvg} element-loading-svg={loadingSvg}
element-loading-svg-view-box="-10, -10, 50, 50" element-loading-svg-view-box="-10, -10, 50, 50"
> >
<div class="flex justify-between w-full h-60px p-4"> <div class="flex justify-between w-full h-[60px] p-4">
<p class="font-bold truncate">{props.title}</p> <p class="font-bold truncate">{props.title}</p>
<div class="flex items-center justify-around"> <div class="flex items-center justify-around">
<div class="flex mr-4">{slots?.buttons()}</div> <div class="flex mr-4">{slots?.buttons()}</div>

View File

@@ -0,0 +1,44 @@
import { h, defineComponent } from "vue";
import TypeIt from "typeit";
// 打字机效果组件(只是简单的封装下,更多配置项参考 https://www.typeitjs.com/docs/vanilla/usage#options
export default defineComponent({
name: "TypeIt",
props: {
/** 打字速度,以每一步之间的毫秒数为单位 */
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

@@ -27,11 +27,10 @@ const getConfig = (key?: string): ServerConfigs => {
return config; return config;
}; };
// 获取项目动态全局配置 /** 获取项目动态全局配置 */
export const getServerConfig = async (app: App): Promise<undefined> => { export const getServerConfig = async (app: App): Promise<undefined> => {
app.config.globalProperties.$config = getConfig(); app.config.globalProperties.$config = getConfig();
return axios({ return axios({
baseURL: "",
method: "get", method: "get",
url: `${VITE_PUBLIC_PATH}serverConfig.json` url: `${VITE_PUBLIC_PATH}serverConfig.json`
}) })
@@ -44,8 +43,6 @@ export const getServerConfig = async (app: App): Promise<undefined> => {
// 设置全局配置 // 设置全局配置
setConfig($config); setConfig($config);
} }
// 设置全局baseURL
app.config.globalProperties.$baseUrl = $config.baseURL;
return $config; return $config;
}) })
.catch(() => { .catch(() => {

View File

@@ -0,0 +1,13 @@
import { hasAuth } from "@/router/utils";
import { Directive, type DirectiveBinding } from "vue";
export const auth: Directive = {
mounted(el: HTMLElement, binding: DirectiveBinding) {
const { value } = binding;
if (value) {
!hasAuth(value) && el.parentNode.removeChild(el);
} else {
throw new Error("need auths! Like v-auth=\"['btn.add','btn.edit']\"");
}
}
};

View File

@@ -1,8 +1,7 @@
import { Directive, type DirectiveBinding, type VNode } from "vue"; import { Directive, type DirectiveBinding, type VNode } from "vue";
import elementResizeDetectorMaker from "element-resize-detector"; import elementResizeDetectorMaker from "element-resize-detector";
import type { Erd } from "element-resize-detector"; import type { Erd } from "element-resize-detector";
import { optimizeFps } from "@pureadmin/utils"; import { emitter } from "@/utils/mitt";
import { emitter } from "/@/utils/mitt";
const erd: Erd = elementResizeDetectorMaker({ const erd: Erd = elementResizeDetectorMaker({
strategy: "scroll" strategy: "scroll"
@@ -14,9 +13,7 @@ export const resize: Directive = {
const width = elem.offsetWidth; const width = elem.offsetWidth;
const height = elem.offsetHeight; const height = elem.offsetHeight;
if (binding?.instance) { if (binding?.instance) {
optimizeFps(() => {
emitter.emit("resize", { detail: { width, height } }); emitter.emit("resize", { detail: { width, height } });
})();
} else { } else {
vnode.el.dispatchEvent( vnode.el.dispatchEvent(
new CustomEvent("resize", { detail: { width, height } }) new CustomEvent("resize", { detail: { width, height } })

View File

@@ -1,2 +1,2 @@
export * from "./permission"; export * from "./auth";
export * from "./elResizeDetector"; export * from "./elResizeDetector";

View File

@@ -1,18 +0,0 @@
import { usePermissionStoreHook } from "/@/store/modules/permission";
import { Directive } from "vue";
import type { DirectiveBinding } from "vue";
export const auth: Directive = {
mounted(el: HTMLElement, binding: DirectiveBinding) {
const { value } = binding;
if (value) {
const authRoles = value;
const hasAuth = usePermissionStoreHook().buttonAuth.includes(authRoles);
if (!hasAuth) {
el.parentNode.removeChild(el);
}
} else {
throw new Error("need roles! Like v-auth=\"['admin','test']\"");
}
}
};

View File

@@ -1,8 +1,8 @@
<script setup lang="ts"> <script setup lang="ts">
import { useGlobal } from "@pureadmin/utils"; import { useGlobal } from "@pureadmin/utils";
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";
import { usePermissionStoreHook } from "/@/store/modules/permission"; import { usePermissionStoreHook } from "@/store/modules/permission";
const props = defineProps({ const props = defineProps({
fixedHeader: Boolean fixedHeader: Boolean

View File

@@ -2,14 +2,11 @@
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 mixNav from "./sidebar/mixNav.vue"; import mixNav from "./sidebar/mixNav.vue";
import avatars from "/@/assets/avatars.jpg"; import { useNav } from "@/layout/hooks/useNav";
import { useNav } from "/@/layout/hooks/useNav";
import Breadcrumb from "./sidebar/breadCrumb.vue"; import Breadcrumb from "./sidebar/breadCrumb.vue";
import { deviceDetection } from "@pureadmin/utils";
import topCollapse from "./sidebar/topCollapse.vue"; import topCollapse from "./sidebar/topCollapse.vue";
import screenfull from "../components/screenfull/index.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";
const { const {
layout, layout,
@@ -50,18 +47,16 @@ const { t, locale, translationCh, translationEn } = useTranslationLang();
<Search /> <Search />
<!-- 通知 --> <!-- 通知 -->
<Notice id="header-notice" /> <Notice id="header-notice" />
<!-- 全屏 -->
<screenfull id="header-screenfull" v-show="!deviceDetection()" />
<!-- 国际化 --> <!-- 国际化 -->
<el-dropdown id="header-translation" trigger="click"> <el-dropdown id="header-translation" trigger="click">
<globalization <globalization
class="navbar-bg-hover w-40px h-48px p-11px cursor-pointer outline-none" class="navbar-bg-hover w-[40px] h-[48px] p-[11px] cursor-pointer outline-none"
/> />
<template #dropdown> <template #dropdown>
<el-dropdown-menu class="translation"> <el-dropdown-menu class="translation">
<el-dropdown-item <el-dropdown-item
:style="getDropdownItemStyle(locale, 'zh')" :style="getDropdownItemStyle(locale, 'zh')"
:class="['!dark:color-white', getDropdownItemClass(locale, 'zh')]" :class="['dark:!text-white', getDropdownItemClass(locale, 'zh')]"
@click="translationCh" @click="translationCh"
> >
<IconifyIconOffline <IconifyIconOffline
@@ -73,7 +68,7 @@ const { t, locale, translationCh, translationEn } = useTranslationLang();
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item <el-dropdown-item
:style="getDropdownItemStyle(locale, 'en')" :style="getDropdownItemStyle(locale, 'en')"
:class="['!dark:color-white', getDropdownItemClass(locale, 'en')]" :class="['dark:!text-white', getDropdownItemClass(locale, 'en')]"
@click="translationEn" @click="translationEn"
> >
<span class="check-en" v-show="locale === 'en'"> <span class="check-en" v-show="locale === 'en'">
@@ -86,9 +81,12 @@ const { t, locale, translationCh, translationEn } = useTranslationLang();
</el-dropdown> </el-dropdown>
<!-- 退出登录 --> <!-- 退出登录 -->
<el-dropdown trigger="click"> <el-dropdown trigger="click">
<span class="el-dropdown-link navbar-bg-hover"> <span class="el-dropdown-link navbar-bg-hover select-none">
<img v-if="avatars" :src="avatars" :style="avatarsStyle" /> <img
<p v-if="username" class="dark:color-white">{{ username }}</p> src="https://avatars.githubusercontent.com/u/44761321?v=4"
:style="avatarsStyle"
/>
<p v-if="username" class="dark:text-white">{{ username }}</p>
</span> </span>
<template #dropdown> <template #dropdown>
<el-dropdown-menu class="logout"> <el-dropdown-menu class="logout">
@@ -103,7 +101,7 @@ const { t, locale, translationCh, translationEn } = useTranslationLang();
</template> </template>
</el-dropdown> </el-dropdown>
<span <span
class="el-icon-setting navbar-bg-hover" class="set-icon navbar-bg-hover"
:title="t('buttons.hssystemSet')" :title="t('buttons.hssystemSet')"
@click="onPanel" @click="onPanel"
> >
@@ -153,15 +151,6 @@ const { t, locale, translationCh, translationEn } = useTranslationLang();
border-radius: 50%; border-radius: 50%;
} }
} }
.el-icon-setting {
height: 48px;
width: 38px;
padding: 12px;
display: flex;
cursor: pointer;
align-items: center;
}
} }
.breadcrumb-container { .breadcrumb-container {

View File

@@ -2,14 +2,14 @@
import { ref } from "vue"; import { ref } from "vue";
import { noticesData } from "./data"; import { noticesData } from "./data";
import NoticeList from "./noticeList.vue"; import NoticeList from "./noticeList.vue";
import { templateRef } from "@vueuse/core";
import { Tabs, TabPane } from "@pureadmin/components"; import { Tabs, TabPane } from "@pureadmin/components";
const dropdownDom = templateRef<ElRef | null>("dropdownDom", null); const dropdownDom = ref();
const activeName = ref(noticesData[0].name); const activeKey = ref(noticesData[0].key);
const notices = ref(noticesData); const notices = ref(noticesData);
let noticesNum = ref(0); const noticesNum = ref(0);
notices.value.forEach(notice => { notices.value.forEach(notice => {
noticesNum.value += notice.list.length; noticesNum.value += notice.list.length;
}); });
@@ -33,7 +33,8 @@ function tabClick() {
<Tabs <Tabs
centered centered
class="dropdown-tabs" class="dropdown-tabs"
v-model:activeName="activeName" :tabBarStyle="{ marginLeft: notices?.length > 4 ? '8px' : '0' }"
v-model:activeKey="activeKey"
@tabClick="tabClick" @tabClick="tabClick"
> >
<template v-for="item in notices" :key="item.key"> <template v-for="item in notices" :key="item.key">

View File

@@ -24,11 +24,11 @@ function hoverTitle() {
function hoverDescription(event, description) { function hoverDescription(event, description) {
// currentWidth 为文本在页面中所占的宽度创建标签加入到页面获取currentWidth ,最后在移除 // currentWidth 为文本在页面中所占的宽度创建标签加入到页面获取currentWidth ,最后在移除
let tempTag = document.createElement("span"); const tempTag = document.createElement("span");
tempTag.innerText = description; tempTag.innerText = description;
tempTag.className = "getDescriptionWidth"; tempTag.className = "getDescriptionWidth";
document.querySelector("body").appendChild(tempTag); document.querySelector("body").appendChild(tempTag);
let currentWidth = ( const currentWidth = (
document.querySelector(".getDescriptionWidth") as HTMLSpanElement document.querySelector(".getDescriptionWidth") as HTMLSpanElement
).offsetWidth; ).offsetWidth;
document.querySelector(".getDescriptionWidth").remove(); document.querySelector(".getDescriptionWidth").remove();
@@ -45,7 +45,7 @@ function hoverDescription(event, description) {
<template> <template>
<div <div
class="notice-container border-b-1 border-[#f0f0f0] dark:border-[#303030]" class="notice-container border-b-[1px] border-solid border-[#f0f0f0] dark:border-[#303030]"
> >
<el-avatar <el-avatar
v-if="props.noticeItem.avatar" v-if="props.noticeItem.avatar"
@@ -54,7 +54,7 @@ function hoverDescription(event, description) {
class="notice-container-avatar" class="notice-container-avatar"
/> />
<div class="notice-container-text"> <div class="notice-container-text">
<div class="notice-text-title color-[#000000d9] dark:color-white"> <div class="notice-text-title text-[#000000d9] dark:text-white">
<el-tooltip <el-tooltip
popper-class="notice-title-popper" popper-class="notice-title-popper"
:disabled="!titleTooltip" :disabled="!titleTooltip"
@@ -93,7 +93,7 @@ function hoverDescription(event, description) {
{{ props.noticeItem.description }} {{ props.noticeItem.description }}
</div> </div>
</el-tooltip> </el-tooltip>
<div class="notice-text-datetime color-[#00000073] dark:color-white"> <div class="notice-text-datetime text-[#00000073] dark:text-white">
{{ props.noticeItem.datetime }} {{ props.noticeItem.datetime }}
</div> </div>
</div> </div>

View File

@@ -1,9 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import { ref } from "vue";
import { onClickOutside } from "@vueuse/core"; import { onClickOutside } from "@vueuse/core";
import { emitter } from "/@/utils/mitt"; import { emitter } from "@/utils/mitt";
let show = ref<Boolean>(false); const show = ref<Boolean>(false);
const target = ref(null); const target = ref(null);
onClickOutside(target, (event: any) => { onClickOutside(target, (event: any) => {
if (event.clientX > target.value.offsetLeft) return; if (event.clientX > target.value.offsetLeft) return;
@@ -18,15 +18,21 @@ emitter.on("openPanel", () => {
<template> <template>
<div :class="{ show: show }" class="right-panel-container"> <div :class="{ show: show }" class="right-panel-container">
<div class="right-panel-background" /> <div class="right-panel-background" />
<div ref="target" class="right-panel bg-white dark:bg-dark"> <div ref="target" class="right-panel bg-bg_color">
<div class="right-panel-items"> <div class="right-panel-items">
<div class="project-configuration"> <div class="project-configuration">
<h3>项目配置</h3> <h4 class="dark:text-white">项目配置</h4>
<el-icon title="关闭配置" class="el-icon-close" @click="show = !show"> <span title="关闭配置">
<IconifyIconOffline icon="close" /> <IconifyIconOffline
</el-icon> class="dark:text-white"
icon="close"
@click="show = !show"
/>
</span>
</div> </div>
<div class="border-b-1 border-[#dcdfe6] dark:border-[#303030]" /> <div
class="border-b-[1px] border-solid border-[#dcdfe6] dark:border-[#303030]"
/>
<slot /> <slot />
</div> </div>
</div> </div>
@@ -119,7 +125,7 @@ emitter.on("openPanel", () => {
top: 15px; top: 15px;
margin-left: 10px; margin-left: 10px;
i { svg {
font-size: 20px; font-size: 20px;
margin-right: 20px; margin-right: 20px;

View File

@@ -8,7 +8,7 @@ const { isFullscreen, toggle } = useFullscreen();
<template> <template>
<div <div
class="screen-full w-36px h-48px flex-ac cursor-pointer navbar-bg-hover" class="screen-full w-[36px] h-[48px] flex-ac cursor-pointer navbar-bg-hover"
@click="toggle" @click="toggle"
> >
<FontIcon <FontIcon

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="search-footer color-[#333] dark:color-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" />
确认 确认
@@ -16,10 +16,11 @@
</div> </div>
</template> </template>
<script lang="ts" setup> <script setup lang="ts">
import enterOutlined from "/@/assets/svg/enter_outlined.svg?component"; import mdiKeyboardEsc from "@/assets/svg/keyboard_esc.svg?component";
import mdiKeyboardEsc from "/@/assets/svg/mdi_keyboard_esc.svg?component"; import enterOutlined from "@/assets/svg/enter_outlined.svg?component";
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.search-footer { .search-footer {
display: flex; display: flex;

View File

@@ -1,13 +1,14 @@
<script lang="ts" setup> <script setup lang="ts">
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { cloneDeep } from "lodash-unified";
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 { transformI18n } from "@/plugins/i18n";
import { deleteChildren } from "@pureadmin/utils"; import { deleteChildren } from "@pureadmin/utils";
import { useDebounceFn, onKeyStroke } from "@vueuse/core"; import { useDebounceFn, onKeyStroke } from "@vueuse/core";
import { ref, watch, computed, nextTick, shallowRef } from "vue"; import { ref, watch, computed, nextTick, shallowRef } from "vue";
import { usePermissionStoreHook } from "/@/store/modules/permission"; import { usePermissionStoreHook } from "@/store/modules/permission";
interface Props { interface Props {
/** 弹窗显隐 */ /** 弹窗显隐 */
@@ -31,7 +32,7 @@ const handleSearch = useDebounceFn(search, 300);
/** 菜单树形结构 */ /** 菜单树形结构 */
const menusData = computed(() => { const menusData = computed(() => {
return deleteChildren(usePermissionStoreHook().menusTree); return deleteChildren(cloneDeep(usePermissionStoreHook().wholeMenus));
}); });
const show = computed({ const show = computed({

View File

@@ -1,9 +1,9 @@
<script lang="ts" setup> <script setup lang="ts">
import { computed } from "vue"; import { computed } from "vue";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
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 enterOutlined from "/@/assets/svg/enter_outlined.svg?component"; import enterOutlined from "@/assets/svg/enter_outlined.svg?component";
const { t } = useI18n(); const { t } = useI18n();

View File

@@ -1,4 +1,4 @@
<script lang="ts" setup> <script setup lang="ts">
import { SearchModal } from "./components"; import { SearchModal } from "./components";
import { useBoolean } from "../../hooks/useBoolean"; import { useBoolean } from "../../hooks/useBoolean";
const { bool: show, toggle } = useBoolean(); const { bool: show, toggle } = useBoolean();
@@ -9,7 +9,7 @@ function handleSearch() {
<template> <template>
<div <div
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="search" />

View File

@@ -8,16 +8,17 @@ import {
nextTick, nextTick,
useCssModule useCssModule
} from "vue"; } from "vue";
import { getConfig } from "/@/config"; import { getConfig } from "@/config";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import panel from "../panel/index.vue"; import panel from "../panel/index.vue";
import { emitter } from "/@/utils/mitt"; import { emitter } from "@/utils/mitt";
import { templateRef } from "@vueuse/core"; import { resetRouter } from "@/router";
import { routerArrays } from "/@/layout/types"; import { removeToken } from "@/utils/auth";
import { useNav } from "/@/layout/hooks/useNav"; import { routerArrays } from "@/layout/types";
import { useAppStoreHook } from "/@/store/modules/app"; import { useNav } from "@/layout/hooks/useNav";
import { useMultiTagsStoreHook } from "/@/store/modules/multiTags"; import { useAppStoreHook } from "@/store/modules/app";
import { useDataThemeChange } from "/@/layout/hooks/useDataThemeChange"; import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
import { useDataThemeChange } from "@/layout/hooks/useDataThemeChange";
import { import {
useDark, useDark,
debounce, debounce,
@@ -27,8 +28,8 @@ import {
} from "@pureadmin/utils"; } from "@pureadmin/utils";
import { toggleTheme } from "@pureadmin/theme/dist/browser-utils"; import { toggleTheme } from "@pureadmin/theme/dist/browser-utils";
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";
const router = useRouter(); const router = useRouter();
const { device } = useNav(); const { device } = useNav();
@@ -36,9 +37,9 @@ const { isDark } = useDark();
const { isSelect } = useCssModule(); const { isSelect } = useCssModule();
const { $storage } = useGlobal<GlobalPropertiesApi>(); const { $storage } = useGlobal<GlobalPropertiesApi>();
const mixRef = templateRef<HTMLElement | null>("mixRef", null); const mixRef = ref();
const verticalRef = templateRef<HTMLElement | null>("verticalRef", null); const verticalRef = ref();
const horizontalRef = templateRef<HTMLElement | null>("horizontalRef", null); const horizontalRef = ref();
const { const {
body, body,
@@ -52,8 +53,8 @@ const {
/* body添加layout属性作用于src/style/sidebar.scss */ /* body添加layout属性作用于src/style/sidebar.scss */
if (unref(layoutTheme)) { if (unref(layoutTheme)) {
let layout = unref(layoutTheme).layout; const layout = unref(layoutTheme).layout;
let theme = unref(layoutTheme).theme; const theme = unref(layoutTheme).theme;
toggleTheme({ toggleTheme({
scopeName: `layout-theme-${theme}` scopeName: `layout-theme-${theme}`
}); });
@@ -117,29 +118,31 @@ const weekChange = (value): void => {
}; };
const tagsChange = () => { const tagsChange = () => {
let showVal = settings.tabsVal; const showVal = settings.tabsVal;
storageConfigureChange("hideTabs", showVal); storageConfigureChange("hideTabs", showVal);
emitter.emit("tagViewsChange", showVal as unknown as string); emitter.emit("tagViewsChange", showVal as unknown as string);
}; };
const multiTagsCacheChange = () => { const multiTagsCacheChange = () => {
let multiTagsCache = settings.multiTagsCache; const multiTagsCache = settings.multiTagsCache;
storageConfigureChange("multiTagsCache", multiTagsCache); storageConfigureChange("multiTagsCache", multiTagsCache);
useMultiTagsStoreHook().multiTagsCacheChange(multiTagsCache); useMultiTagsStoreHook().multiTagsCacheChange(multiTagsCache);
}; };
/** 清空缓存并返回登录页 */ /** 清空缓存并返回登录页 */
function onReset() { function onReset() {
router.push("/login"); removeToken();
storageLocal.clear();
storageSession.clear();
const { Grey, Weak, MultiTagsCache, EpThemeColor, Layout } = getConfig(); const { Grey, Weak, MultiTagsCache, EpThemeColor, Layout } = getConfig();
useAppStoreHook().setLayout(Layout); useAppStoreHook().setLayout(Layout);
setEpThemeColor(EpThemeColor); setEpThemeColor(EpThemeColor);
useMultiTagsStoreHook().multiTagsCacheChange(MultiTagsCache); useMultiTagsStoreHook().multiTagsCacheChange(MultiTagsCache);
toggleClass(Grey, "html-grey", document.querySelector("html")); toggleClass(Grey, "html-grey", document.querySelector("html"));
toggleClass(Weak, "html-weakness", document.querySelector("html")); toggleClass(Weak, "html-weakness", document.querySelector("html"));
router.push("/login");
useMultiTagsStoreHook().handleTags("equal", [...routerArrays]); useMultiTagsStoreHook().handleTags("equal", [...routerArrays]);
storageLocal.clear(); resetRouter();
storageSession.clear();
} }
function onChange(label) { function onChange(label) {
@@ -209,8 +212,9 @@ function setLayoutModel(layout: string) {
$storage.layout = { $storage.layout = {
layout, layout,
theme: layoutTheme.value.theme, theme: layoutTheme.value.theme,
darkMode: $storage.layout.darkMode, darkMode: $storage.layout?.darkMode,
sidebarStatus: $storage.layout.sidebarStatus sidebarStatus: $storage.layout?.sidebarStatus,
epThemeColor: $storage.layout?.epThemeColor
}; };
useAppStoreHook().setLayout(layout); useAppStoreHook().setLayout(layout);
} }
@@ -306,7 +310,7 @@ nextTick(() => {
<el-divider>界面显示</el-divider> <el-divider>界面显示</el-divider>
<ul class="setting"> <ul class="setting">
<li> <li>
<span>灰色模式</span> <span class="dark:text-white">灰色模式</span>
<el-switch <el-switch
v-model="settings.greyVal" v-model="settings.greyVal"
inline-prompt inline-prompt
@@ -317,7 +321,7 @@ nextTick(() => {
/> />
</li> </li>
<li> <li>
<span>色弱模式</span> <span class="dark:text-white">色弱模式</span>
<el-switch <el-switch
v-model="settings.weakVal" v-model="settings.weakVal"
inline-prompt inline-prompt
@@ -328,7 +332,7 @@ nextTick(() => {
/> />
</li> </li>
<li> <li>
<span>隐藏标签页</span> <span class="dark:text-white">隐藏标签页</span>
<el-switch <el-switch
v-model="settings.tabsVal" v-model="settings.tabsVal"
inline-prompt inline-prompt
@@ -339,7 +343,7 @@ nextTick(() => {
/> />
</li> </li>
<li> <li>
<span>侧边栏Logo</span> <span class="dark:text-white">侧边栏Logo</span>
<el-switch <el-switch
v-model="logoVal" v-model="logoVal"
inline-prompt inline-prompt
@@ -352,7 +356,7 @@ nextTick(() => {
/> />
</li> </li>
<li> <li>
<span>标签页持久化</span> <span class="dark:text-white">标签页持久化</span>
<el-switch <el-switch
v-model="settings.multiTagsCache" v-model="settings.multiTagsCache"
inline-prompt inline-prompt
@@ -364,7 +368,7 @@ nextTick(() => {
</li> </li>
<li> <li>
<span>标签风格</span> <span class="dark:text-white">标签风格</span>
<el-radio-group v-model="markValue" size="small" @change="onChange"> <el-radio-group v-model="markValue" size="small" @change="onChange">
<el-radio label="card">卡片</el-radio> <el-radio label="card">卡片</el-radio>
<el-radio label="smart">灵动</el-radio> <el-radio label="smart">灵动</el-radio>

View File

@@ -1,9 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch } from "vue"; import { isEqual } from "@pureadmin/utils";
import { isEqual } from "lodash-unified"; import { transformI18n } from "@/plugins/i18n";
import { transformI18n } from "/@/plugins/i18n"; import { ref, watch, onMounted, toRaw } from "vue";
import { getParentPaths, findRouteByPath } from "/@/router/utils"; import { getParentPaths, findRouteByPath } from "@/router/utils";
import { useMultiTagsStoreHook } from "/@/store/modules/multiTags"; import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
import { useRoute, useRouter, RouteLocationMatched } from "vue-router"; import { useRoute, useRouter, RouteLocationMatched } from "vue-router";
const route = useRoute(); const route = useRoute();
@@ -14,19 +14,24 @@ const multiTags: any = useMultiTagsStoreHook().multiTags;
const isDashboard = (route: RouteLocationMatched): boolean | string => { const isDashboard = (route: RouteLocationMatched): boolean | string => {
const name = route && (route.name as string); const name = route && (route.name as string);
if (!name) { if (!name) return false;
return false;
}
return name.trim().toLocaleLowerCase() === "Welcome".toLocaleLowerCase(); return name.trim().toLocaleLowerCase() === "Welcome".toLocaleLowerCase();
}; };
const getBreadcrumb = (): void => { const getBreadcrumb = (): void => {
// 当前路由信息 // 当前路由信息
let currentRoute; let currentRoute;
if (Object.keys(route.query).length > 0) { if (Object.keys(route.query).length > 0) {
multiTags.forEach(item => { multiTags.forEach(item => {
if (isEqual(route.query, item?.query)) { if (isEqual(route.query, item?.query)) {
currentRoute = item; currentRoute = toRaw(item);
}
});
} else if (Object.keys(route.params).length > 0) {
multiTags.forEach(item => {
if (isEqual(route.params, item?.params)) {
currentRoute = toRaw(item);
} }
}); });
} else { } else {
@@ -38,29 +43,12 @@ const getBreadcrumb = (): void => {
let matched = []; let matched = [];
// 获取每个父级路径对应的路由信息 // 获取每个父级路径对应的路由信息
parentRoutes.forEach(path => { parentRoutes.forEach(path => {
if (path !== "/") { if (path !== "/") matched.push(findRouteByPath(path, routes));
matched.push(findRouteByPath(path, routes));
}
}); });
if (router.currentRoute.value.meta?.refreshRedirect) {
matched.unshift(
findRouteByPath(
router.currentRoute.value.meta.refreshRedirect as string,
routes
)
);
} else {
// 过滤与子级相同标题的父级路由
matched = matched.filter(item => {
return !item.redirect || (item.redirect && item.children.length !== 1);
});
}
if (currentRoute?.path !== "/welcome") {
matched.push(currentRoute);
}
const first = matched[0]; if (currentRoute?.path !== "/welcome") matched.push(currentRoute);
if (!isDashboard(first)) {
if (!isDashboard(matched[0])) {
matched = [ matched = [
{ {
path: "/welcome", path: "/welcome",
@@ -70,60 +58,51 @@ const getBreadcrumb = (): void => {
].concat(matched); ].concat(matched);
} }
matched.forEach((item, index) => {
if (currentRoute?.query || currentRoute?.params) return;
if (item?.children) {
item.children.forEach(v => {
if (v?.meta?.title === item?.meta?.title) {
matched.splice(index, 1);
}
});
}
});
levelList.value = matched.filter( levelList.value = matched.filter(
item => item?.meta && item?.meta.title !== false item => item?.meta && item?.meta.title !== false
); );
}; };
getBreadcrumb(); const handleLink = (item: RouteLocationMatched): void => {
const { redirect, path } = item;
if (redirect) {
router.push(redirect as any);
} else {
router.push(path);
}
};
onMounted(() => {
getBreadcrumb();
});
watch( watch(
() => route.path, () => route.path,
() => getBreadcrumb() () => {
); getBreadcrumb();
watch(
() => route.query,
() => getBreadcrumb()
);
const handleLink = (item: RouteLocationMatched): any => {
const { redirect, path } = item;
if (redirect) {
router.push(redirect.toString());
return;
} }
router.push(path); );
};
</script> </script>
<template> <template>
<el-breadcrumb class="app-breadcrumb select-none" separator="/"> <el-breadcrumb class="!leading-[50px] select-none" separator="/">
<transition-group appear name="breadcrumb"> <transition-group appear name="breadcrumb">
<el-breadcrumb-item v-for="(item, index) in levelList" :key="item.path"> <el-breadcrumb-item v-for="item in levelList" :key="item.path">
<span <a @click.prevent="handleLink(item)">
v-if="item.redirect === 'noRedirect' || index == levelList.length - 1"
class="no-redirect"
>
{{ transformI18n(item.meta.title) }}
</span>
<a v-else @click.prevent="handleLink(item)">
{{ transformI18n(item.meta.title) }} {{ transformI18n(item.meta.title) }}
</a> </a>
</el-breadcrumb-item> </el-breadcrumb-item>
</transition-group> </transition-group>
</el-breadcrumb> </el-breadcrumb>
</template> </template>
<style lang="scss" scoped>
.app-breadcrumb.el-breadcrumb {
display: inline-block;
font-size: 14px;
line-height: 50px;
.no-redirect {
color: #97a8be;
cursor: text;
}
}
</style>

View File

@@ -1,15 +1,12 @@
<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 { ref, watch, nextTick } from "vue";
import SidebarItem from "./sidebarItem.vue"; import SidebarItem from "./sidebarItem.vue";
import avatars from "/@/assets/avatars.jpg"; import { useNav } from "@/layout/hooks/useNav";
import { useNav } from "/@/layout/hooks/useNav";
import screenfull from "../screenfull/index.vue";
import { deviceDetection } from "@pureadmin/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 { ref, watch, nextTick, onMounted, onBeforeUnmount } from "vue";
const menuRef = ref(); const menuRef = ref();
@@ -21,7 +18,6 @@ const {
logout, logout,
backHome, backHome,
onPanel, onPanel,
handleResize,
menuSelect, menuSelect,
username, username,
avatarsStyle, avatarsStyle,
@@ -29,18 +25,8 @@ const {
getDropdownItemClass getDropdownItemClass
} = useNav(); } = useNav();
function onResizeMenu() { nextTick(() => {
nextTick(() => { menuRef.value?.handleResize();
handleResize(menuRef.value);
});
}
onMounted(() => {
window.addEventListener("resize", onResizeMenu);
});
onBeforeUnmount(() => {
window.removeEventListener("resize", onResizeMenu);
}); });
watch( watch(
@@ -77,18 +63,16 @@ watch(
<Search /> <Search />
<!-- 通知 --> <!-- 通知 -->
<Notice id="header-notice" /> <Notice id="header-notice" />
<!-- 全屏 -->
<screenfull id="header-screenfull" v-show="!deviceDetection()" />
<!-- 国际化 --> <!-- 国际化 -->
<el-dropdown id="header-translation" trigger="click"> <el-dropdown id="header-translation" trigger="click">
<globalization <globalization
class="navbar-bg-hover w-40px h-48px p-11px cursor-pointer outline-none" class="navbar-bg-hover w-[40px] h-[48px] p-[11px] cursor-pointer outline-none"
/> />
<template #dropdown> <template #dropdown>
<el-dropdown-menu class="translation"> <el-dropdown-menu class="translation">
<el-dropdown-item <el-dropdown-item
:style="getDropdownItemStyle(locale, 'zh')" :style="getDropdownItemStyle(locale, 'zh')"
:class="['!dark:color-white', getDropdownItemClass(locale, 'zh')]" :class="['dark:!text-white', getDropdownItemClass(locale, 'zh')]"
@click="translationCh" @click="translationCh"
> >
<span class="check-zh" v-show="locale === 'zh'"> <span class="check-zh" v-show="locale === 'zh'">
@@ -98,7 +82,7 @@ watch(
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item <el-dropdown-item
:style="getDropdownItemStyle(locale, 'en')" :style="getDropdownItemStyle(locale, 'en')"
:class="['!dark:color-white', getDropdownItemClass(locale, 'en')]" :class="['dark:!text-white', getDropdownItemClass(locale, 'en')]"
@click="translationEn" @click="translationEn"
> >
<span class="check-en" v-show="locale === 'en'"> <span class="check-en" v-show="locale === 'en'">
@@ -112,8 +96,11 @@ watch(
<!-- 退出登录 --> <!-- 退出登录 -->
<el-dropdown trigger="click"> <el-dropdown trigger="click">
<span class="el-dropdown-link navbar-bg-hover"> <span class="el-dropdown-link navbar-bg-hover">
<img v-if="avatars" :src="avatars" :style="avatarsStyle" /> <img
<p v-if="username" class="dark:color-white">{{ username }}</p> src="https://avatars.githubusercontent.com/u/44761321?v=4"
:style="avatarsStyle"
/>
<p v-if="username" class="dark:text-white">{{ username }}</p>
</span> </span>
<template #dropdown> <template #dropdown>
<el-dropdown-menu class="logout"> <el-dropdown-menu class="logout">
@@ -128,7 +115,7 @@ watch(
</template> </template>
</el-dropdown> </el-dropdown>
<span <span
class="el-icon-setting navbar-bg-hover" class="set-icon navbar-bg-hover"
:title="t('buttons.hssystemSet')" :title="t('buttons.hssystemSet')"
@click="onPanel" @click="onPanel"
> >

View File

@@ -28,7 +28,7 @@ const toggleClick = () => {
> >
<IconifyIconOffline <IconifyIconOffline
:icon="props.isActive ? 'menu-fold' : 'menu-unfold'" :icon="props.isActive ? 'menu-fold' : 'menu-unfold'"
class="cursor-pointer inline-block align-middle color-primary hover:color-primary !dark:hover:color-white w-16px h-16px ml-4 mb-1" class="cursor-pointer inline-block align-middle text-primary hover:text-primary dark:hover:!text-white w-[16px] h-[16px] ml-4 mb-1"
@click="toggleClick" @click="toggleClick"
/> />
</el-tooltip> </el-tooltip>

View File

@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { useNav } from "/@/layout/hooks/useNav"; import { useNav } from "@/layout/hooks/useNav";
const props = defineProps({ const props = defineProps({
collapse: Boolean collapse: Boolean
@@ -9,7 +9,7 @@ const { title } = useNav();
</script> </script>
<template> <template>
<div class="sidebar-logo-container" :class="{ collapse: props.collapse }"> <div class="sidebar-logo-container" :class="{ collapses: props.collapse }">
<transition name="sidebarLogoFade"> <transition name="sidebarLogoFade">
<router-link <router-link
v-if="props.collapse" v-if="props.collapse"
@@ -51,6 +51,12 @@ const { title } = useNav();
margin-top: 5px; margin-top: 5px;
.sidebar-title { .sidebar-title {
display: block;
width: 160px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
text-align: left;
color: #1890ff; color: #1890ff;
font-weight: 600; font-weight: 600;
font-size: 20px; font-size: 20px;
@@ -59,7 +65,7 @@ const { title } = useNav();
} }
} }
.collapse { .collapses {
.sidebar-logo { .sidebar-logo {
margin-right: 0; margin-right: 0;
} }

View File

@@ -1,20 +1,17 @@
<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 avatars from "/@/assets/avatars.jpg"; import { useNav } from "@/layout/hooks/useNav";
import { useNav } from "/@/layout/hooks/useNav"; import { transformI18n } from "@/plugins/i18n";
import { transformI18n } from "/@/plugins/i18n"; import { ref, toRaw, watch, onMounted, nextTick } from "vue";
import screenfull from "../screenfull/index.vue"; import { useRenderIcon } from "@/components/ReIcon/src/hooks";
import { deviceDetection } from "@pureadmin/utils"; import { getParentPaths, findRouteByPath } from "@/router/utils";
import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
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 { ref, toRaw, watch, nextTick, onMounted, onBeforeUnmount } from "vue";
const menuRef = ref(); const menuRef = ref();
let defaultActive = ref(null); const defaultActive = ref(null);
const { t, route, locale, translationCh, translationEn } = const { t, route, locale, translationCh, translationEn } =
useTranslationLang(menuRef); useTranslationLang(menuRef);
@@ -23,7 +20,6 @@ const {
routers, routers,
logout, logout,
onPanel, onPanel,
handleResize,
menuSelect, menuSelect,
resolvePath, resolvePath,
username, username,
@@ -42,23 +38,16 @@ function getDefaultActive(routePath) {
)?.children[0]?.path; )?.children[0]?.path;
} }
function onResizeMenu() {
nextTick(() => {
handleResize(menuRef.value);
});
}
onMounted(() => { onMounted(() => {
getDefaultActive(route.path); getDefaultActive(route.path);
window.addEventListener("resize", onResizeMenu);
}); });
onBeforeUnmount(() => { nextTick(() => {
window.removeEventListener("resize", onResizeMenu); menuRef.value?.handleResize();
}); });
watch( watch(
() => route.path, () => [route.path, usePermissionStoreHook().wholeMenus],
() => { () => {
getDefaultActive(route.path); getDefaultActive(route.path);
} }
@@ -106,18 +95,16 @@ watch(
<Search /> <Search />
<!-- 通知 --> <!-- 通知 -->
<Notice id="header-notice" /> <Notice id="header-notice" />
<!-- 全屏 -->
<screenfull id="header-screenfull" v-show="!deviceDetection()" />
<!-- 国际化 --> <!-- 国际化 -->
<el-dropdown id="header-translation" trigger="click"> <el-dropdown id="header-translation" trigger="click">
<globalization <globalization
class="navbar-bg-hover w-40px h-48px p-11px cursor-pointer outline-none" class="navbar-bg-hover w-[40px] h-[48px] p-[11px] cursor-pointer outline-none"
/> />
<template #dropdown> <template #dropdown>
<el-dropdown-menu class="translation"> <el-dropdown-menu class="translation">
<el-dropdown-item <el-dropdown-item
:style="getDropdownItemStyle(locale, 'zh')" :style="getDropdownItemStyle(locale, 'zh')"
:class="['!dark:color-white', getDropdownItemClass(locale, 'zh')]" :class="['dark:!text-white', getDropdownItemClass(locale, 'zh')]"
@click="translationCh" @click="translationCh"
> >
<span class="check-zh" v-show="locale === 'zh'"> <span class="check-zh" v-show="locale === 'zh'">
@@ -127,7 +114,7 @@ watch(
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item <el-dropdown-item
:style="getDropdownItemStyle(locale, 'en')" :style="getDropdownItemStyle(locale, 'en')"
:class="['!dark:color-white', getDropdownItemClass(locale, 'en')]" :class="['dark:!text-white', getDropdownItemClass(locale, 'en')]"
@click="translationEn" @click="translationEn"
> >
<span class="check-en" v-show="locale === 'en'"> <span class="check-en" v-show="locale === 'en'">
@@ -140,9 +127,12 @@ watch(
</el-dropdown> </el-dropdown>
<!-- 退出登录 --> <!-- 退出登录 -->
<el-dropdown trigger="click"> <el-dropdown trigger="click">
<span class="el-dropdown-link navbar-bg-hover"> <span class="el-dropdown-link navbar-bg-hover select-none">
<img v-if="avatars" :src="avatars" :style="avatarsStyle" /> <img
<p v-if="username" class="dark:color-white">{{ username }}</p> src="https://avatars.githubusercontent.com/u/44761321?v=4"
:style="avatarsStyle"
/>
<p v-if="username" class="dark:text-white">{{ username }}</p>
</span> </span>
<template #dropdown> <template #dropdown>
<el-dropdown-menu class="logout"> <el-dropdown-menu class="logout">
@@ -157,7 +147,7 @@ watch(
</template> </template>
</el-dropdown> </el-dropdown>
<span <span
class="el-icon-setting navbar-bg-hover" class="set-icon navbar-bg-hover"
:title="t('buttons.hssystemSet')" :title="t('buttons.hssystemSet')"
@click="onPanel" @click="onPanel"
> >

View File

@@ -1,9 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import path from "path"; import path from "path";
import { getConfig } from "@/config";
import { childrenType } from "../../types"; import { childrenType } from "../../types";
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 { ref, toRaw, PropType, nextTick, computed, CSSProperties } from "vue";
const { layout, isCollapse } = useNav(); const { layout, isCollapse } = useNav();
@@ -76,6 +77,10 @@ const getSpanStyle = computed(() => {
}; };
}); });
const expandCloseIcon = computed(() => {
return getConfig()?.MenuArrowIconNoTransition ? "expand-close-icon" : "";
});
const onlyOneChild: childrenType = ref(null); const onlyOneChild: childrenType = ref(null);
// 存放菜单是否存在showTooltip属性标识 // 存放菜单是否存在showTooltip属性标识
const hoverMenuMap = new WeakMap(); const hoverMenuMap = new WeakMap();
@@ -212,7 +217,15 @@ function resolvePath(routePath) {
</el-menu-item> </el-menu-item>
</template> </template>
<el-sub-menu v-else ref="subMenu" :index="resolvePath(props.item.path)"> <el-sub-menu
v-else
ref="subMenu"
:index="resolvePath(props.item.path)"
v-bind:[expandCloseIcon]="useRenderIcon('ep-arrow-down')"
:expand-open-icon="useRenderIcon('ep-arrow-up')"
:collapse-close-icon="useRenderIcon('ep-arrow-right')"
:collapse-open-icon="useRenderIcon('ep-arrow-left')"
>
<template #title> <template #title>
<div v-if="toRaw(props.item.meta.icon)" class="sub-menu-icon"> <div v-if="toRaw(props.item.meta.icon)" class="sub-menu-icon">
<component <component

View File

@@ -24,7 +24,7 @@ const toggleClick = () => {
> >
<IconifyIconOffline <IconifyIconOffline
:icon="props.isActive ? 'menu-fold' : 'menu-unfold'" :icon="props.isActive ? 'menu-fold' : 'menu-unfold'"
class="inline-block align-middle hover:color-primary !dark:hover:color-white" class="inline-block align-middle hover:text-primary dark:hover:!text-white"
/> />
</div> </div>
</template> </template>

View File

@@ -1,15 +1,15 @@
<script setup lang="ts"> <script setup lang="ts">
import Logo from "./logo.vue"; 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 type { StorageConfigs } from "/#/index"; import type { StorageConfigs } from "/#/index";
import { useNav } from "/@/layout/hooks/useNav"; import { useNav } from "@/layout/hooks/useNav";
import { storageLocal } from "@pureadmin/utils"; import { storageLocal } from "@pureadmin/utils";
import { ref, computed, watch, onBeforeMount } from "vue"; import { ref, computed, watch, onBeforeMount } from "vue";
import { findRouteByPath, getParentPaths } from "/@/router/utils"; import { findRouteByPath, getParentPaths } from "@/router/utils";
import { usePermissionStoreHook } from "/@/store/modules/permission"; import { usePermissionStoreHook } from "@/store/modules/permission";
const route = useRoute(); const route = useRoute();
const showLogo = ref( const showLogo = ref(
@@ -19,7 +19,7 @@ const showLogo = ref(
const { routers, device, pureApp, isCollapse, menuSelect, toggleSideBar } = const { routers, device, pureApp, isCollapse, menuSelect, toggleSideBar } =
useNav(); useNav();
let subMenuData = ref([]); const subMenuData = ref([]);
const menuData = computed(() => { const menuData = computed(() => {
return pureApp.layout === "mix" && device.value !== "mobile" return pureApp.layout === "mix" && device.value !== "mobile"
@@ -27,7 +27,7 @@ const menuData = computed(() => {
: usePermissionStoreHook().wholeMenus; : usePermissionStoreHook().wholeMenus;
}); });
function getSubMenuData(path) { function getSubMenuData(path: string) {
// path的上级路由组成的数组 // path的上级路由组成的数组
const parentPathArr = getParentPaths( const parentPathArr = getParentPaths(
path, path,
@@ -41,6 +41,7 @@ function getSubMenuData(path) {
if (!parenetRoute?.children) return; if (!parenetRoute?.children) return;
subMenuData.value = parenetRoute?.children; subMenuData.value = parenetRoute?.children;
} }
getSubMenuData(route.path); getSubMenuData(route.path);
onBeforeMount(() => { onBeforeMount(() => {
@@ -50,7 +51,7 @@ onBeforeMount(() => {
}); });
watch( watch(
() => route.path, () => [route.path, usePermissionStoreHook().wholeMenus],
() => { () => {
getSubMenuData(route.path); getSubMenuData(route.path);
menuSelect(route.path, routers); menuSelect(route.path, routers);

View File

@@ -121,21 +121,6 @@
} }
} }
.right-button {
display: flex;
font-size: 16px;
li {
display: flex;
align-items: center;
justify-content: center;
width: 40px;
height: 38px;
border-right: 1px solid #ccc;
cursor: pointer;
}
}
/* 右键菜单 */ /* 右键菜单 */
.contextmenu { .contextmenu {
margin: 0; margin: 0;
@@ -196,6 +181,9 @@
margin-right: 10px; margin-right: 10px;
} }
:deep(.el-dropdown-menu__item--divided) {
margin: 1px 0;
}
.el-dropdown-menu__item--divided::before { .el-dropdown-menu__item--divided::before {
margin: 0; margin: 0;
} }
@@ -223,7 +211,8 @@
} }
.arrow-left, .arrow-left,
.arrow-right { .arrow-right,
.arrow-down {
width: 40px; width: 40px;
height: 38px; height: 38px;
color: var(--el-text-color-primary); color: var(--el-text-color-primary);
@@ -248,7 +237,7 @@
.arrow-right { .arrow-right {
box-shadow: -5px 0 5px -6px #ccc; box-shadow: -5px 0 5px -6px #ccc;
border-right: 1px solid #ccc; border-right: 0.5px solid #ccc;
&:hover { &:hover {
cursor: e-resize; cursor: e-resize;
@@ -305,8 +294,3 @@
background: var(--el-color-primary); background: var(--el-color-primary);
animation: scheduleOutWidth 400ms ease-in; animation: scheduleOutWidth 400ms ease-in;
} }
/* 刷新按钮动画效果 */
.refresh-button {
animation: rotate 600ms linear infinite;
}

View File

@@ -1,123 +1,56 @@
<script setup lang="ts"> <script setup lang="ts">
import { import { $t } from "@/plugins/i18n";
ref, import { emitter } from "@/utils/mitt";
watch, import { RouteConfigs } from "../../types";
unref, import { useTags } from "../../hooks/useTag";
toRaw, import { routerArrays } from "@/layout/types";
reactive,
nextTick,
computed,
ComputedRef,
CSSProperties,
onBeforeMount,
getCurrentInstance
} from "vue";
import close from "/@/assets/svg/close.svg?component";
import refresh from "/@/assets/svg/refresh.svg?component";
import closeAll from "/@/assets/svg/close_all.svg?component";
import closeLeft from "/@/assets/svg/close_left.svg?component";
import closeOther from "/@/assets/svg/close_other.svg?component";
import closeRight from "/@/assets/svg/close_right.svg?component";
import { useI18n } from "vue-i18n";
import { emitter } from "/@/utils/mitt";
import type { StorageConfigs } from "/#/index";
import { routerArrays } from "/@/layout/types";
import { useRoute, useRouter } from "vue-router";
import { isEqual, isEmpty } from "lodash-unified"; import { isEqual, isEmpty } from "lodash-unified";
import { transformI18n, $t } from "/@/plugins/i18n"; import { useSettingStoreHook } from "@/store/modules/settings";
import { RouteConfigs, tagsViewsType } from "../../types"; import { ref, watch, unref, nextTick, onBeforeMount } from "vue";
import { useSettingStoreHook } from "/@/store/modules/settings"; import { handleAliveRoute, delAliveRoutes } from "@/router/utils";
import { handleAliveRoute, delAliveRoutes } from "/@/router/utils"; import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
import { useMultiTagsStoreHook } from "/@/store/modules/multiTags"; import { useResizeObserver, useDebounceFn, useFullscreen } from "@vueuse/core";
import { usePermissionStoreHook } from "/@/store/modules/permission";
import { templateRef, useResizeObserver, useDebounceFn } from "@vueuse/core";
import {
toggleClass,
removeClass,
hasClass,
storageLocal
} from "@pureadmin/utils";
const { t } = useI18n(); const {
const route = useRoute(); route,
const router = useRouter(); router,
const translateX = ref<number>(0); visible,
const activeIndex = ref<number>(-1); showTags,
let refreshButton = "refresh-button"; instance,
const instance = getCurrentInstance(); multiTags,
const pureSetting = useSettingStoreHook(); tagsViews,
const tabDom = templateRef<HTMLElement | null>("tabDom", null); buttonTop,
const containerDom = templateRef<HTMLElement | null>("containerDom", null); buttonLeft,
const scrollbarDom = templateRef<HTMLElement | null>("scrollbarDom", null); showModel,
const showTags = translateX,
ref(storageLocal.getItem<StorageConfigs>("responsive-configure").hideTabs) ?? pureSetting,
"false"; activeIndex,
// @ts-expect-error getTabStyle,
let multiTags: ComputedRef<Array<RouteConfigs>> = computed(() => { iconIsActive,
return useMultiTagsStoreHook()?.multiTags; linkIsActive,
}); currentSelect,
scheduleIsActive,
getContextMenuStyle,
closeMenu,
onMounted,
onMouseenter,
onMouseleave,
transformI18n,
onContentFullScreen
} = useTags();
const linkIsActive = computed(() => { const tabDom = ref();
return item => { const containerDom = ref();
if (Object.keys(route.query).length === 0) { const scrollbarDom = ref();
if (route.path === item.path) { const isShowArrow = ref(false);
return "is-active"; const { isFullscreen, toggle } = useFullscreen();
} else {
return "";
}
} else {
if (isEqual(route?.query, item?.query)) {
return "is-active";
} else {
return "";
}
}
};
});
const scheduleIsActive = computed(() => {
return item => {
if (Object.keys(route.query).length === 0) {
if (route.path === item.path) {
return "schedule-active";
} else {
return "";
}
} else {
if (isEqual(route?.query, item?.query)) {
return "schedule-active";
} else {
return "";
}
}
};
});
const iconIsActive = computed(() => {
return (item, index) => {
if (index === 0) return;
if (Object.keys(route.query).length === 0) {
if (route.path === item.path) {
return true;
} else {
return false;
}
} else {
if (isEqual(route?.query, item?.query)) {
return true;
} else {
return false;
}
}
};
});
const dynamicTagView = () => { const dynamicTagView = () => {
const index = multiTags.value.findIndex(item => { const index = multiTags.value.findIndex(item => {
if (item?.query) { if (item.query) {
return isEqual(route?.query, item?.query); return isEqual(route.query, item.query);
} else if (item.params) {
return isEqual(route.params, item.params);
} else { } else {
return item.path === route.path; return item.path === route.path;
} }
@@ -125,23 +58,9 @@ const dynamicTagView = () => {
moveToView(index); moveToView(index);
}; };
watch([route], () => {
activeIndex.value = -1;
dynamicTagView();
});
useResizeObserver(
scrollbarDom,
useDebounceFn(() => {
dynamicTagView();
}, 200)
);
const tabNavPadding = 10;
const moveToView = (index: number): void => { const moveToView = (index: number): void => {
if (!instance.refs["dynamic" + index]) { const tabNavPadding = 10;
return; if (!instance.refs["dynamic" + index]) return;
}
const tabItemEl = instance.refs["dynamic" + index][0]; const tabItemEl = instance.refs["dynamic" + index][0];
const tabItemElOffsetLeft = (tabItemEl as HTMLElement)?.offsetLeft; const tabItemElOffsetLeft = (tabItemEl as HTMLElement)?.offsetLeft;
const tabItemOffsetWidth = (tabItemEl as HTMLElement)?.offsetWidth; const tabItemOffsetWidth = (tabItemEl as HTMLElement)?.offsetWidth;
@@ -151,7 +70,9 @@ const moveToView = (index: number): void => {
: 0; : 0;
// 已有标签页总长度(包含溢出部分) // 已有标签页总长度(包含溢出部分)
const tabDomWidth = tabDom.value ? tabDom.value?.offsetWidth : 0; const tabDomWidth = tabDom.value ? tabDom.value?.offsetWidth : 0;
scrollbarDomWidth <= tabDomWidth
? (isShowArrow.value = true)
: (isShowArrow.value = false);
if (tabDomWidth < scrollbarDomWidth || tabItemElOffsetLeft === 0) { if (tabDomWidth < scrollbarDomWidth || tabItemElOffsetLeft === 0) {
translateX.value = 0; translateX.value = 0;
} else if (tabItemElOffsetLeft < -translateX.value) { } else if (tabItemElOffsetLeft < -translateX.value) {
@@ -200,71 +121,6 @@ const handleScroll = (offset: number): void => {
} }
}; };
const tagsViews = reactive<Array<tagsViewsType>>([
{
icon: refresh,
text: $t("buttons.hsreload"),
divided: false,
disabled: false,
show: true
},
{
icon: close,
text: $t("buttons.hscloseCurrentTab"),
divided: false,
disabled: multiTags.value.length > 1 ? false : true,
show: true
},
{
icon: closeLeft,
text: $t("buttons.hscloseLeftTabs"),
divided: true,
disabled: multiTags.value.length > 1 ? false : true,
show: true
},
{
icon: closeRight,
text: $t("buttons.hscloseRightTabs"),
divided: false,
disabled: multiTags.value.length > 1 ? false : true,
show: true
},
{
icon: closeOther,
text: $t("buttons.hscloseOtherTabs"),
divided: true,
disabled: multiTags.value.length > 2 ? false : true,
show: true
},
{
icon: closeAll,
text: $t("buttons.hscloseAllTabs"),
divided: false,
disabled: multiTags.value.length > 1 ? false : true,
show: true
}
]);
// 显示模式,默认灵动模式显示
const showModel = ref(
storageLocal.getItem<StorageConfigs>("responsive-configure")?.showModel ||
"smart"
);
if (!showModel.value) {
const configure = storageLocal.getItem<StorageConfigs>(
"responsive-configure"
);
configure.showModel = "card";
storageLocal.setItem("responsive-configure", configure);
}
let visible = ref(false);
let buttonLeft = ref(0);
let buttonTop = ref(0);
// 当前右键选中的路由信息
let currentSelect = ref({});
function dynamicRouteTag(value: string, parentPath: string): void { function dynamicRouteTag(value: string, parentPath: string): void {
const hasValue = multiTags.value.some(item => { const hasValue = multiTags.value.some(item => {
return item.path === value; return item.path === value;
@@ -273,7 +129,7 @@ function dynamicRouteTag(value: string, parentPath: string): void {
function concatPath(arr: object[], value: string, parentPath: string) { function concatPath(arr: object[], value: string, parentPath: string) {
if (!hasValue) { if (!hasValue) {
arr.forEach((arrItem: any) => { arr.forEach((arrItem: any) => {
let pathConcat = parentPath + arrItem.path; const pathConcat = parentPath + arrItem.path;
if (arrItem.path === value || pathConcat === value) { if (arrItem.path === value || pathConcat === value) {
useMultiTagsStoreHook().handleTags("push", { useMultiTagsStoreHook().handleTags("push", {
path: value, path: value,
@@ -292,27 +148,27 @@ function dynamicRouteTag(value: string, parentPath: string): void {
concatPath(router.options.routes as any, value, parentPath); concatPath(router.options.routes as any, value, parentPath);
} }
// 重新加载 /** 刷新路由 */
function onFresh() { function onFresh() {
toggleClass(true, refreshButton, document.querySelector(".rotate"));
const { fullPath, query } = unref(route); const { fullPath, query } = unref(route);
router.replace({ router.replace({
path: "/redirect" + fullPath, path: "/redirect" + fullPath,
query: query query: query
}); });
setTimeout(() => {
removeClass(document.querySelector(".rotate"), refreshButton);
}, 600);
} }
function deleteDynamicTag(obj: any, current: any, tag?: string) { function deleteDynamicTag(obj: any, current: any, tag?: string) {
// 存放被删除的缓存路由 // 存放被删除的缓存路由
let delAliveRouteList = []; let delAliveRouteList = [];
let valueIndex: number = multiTags.value.findIndex((item: any) => { const valueIndex: number = multiTags.value.findIndex((item: any) => {
if (item.query) { if (item.query) {
if (item.path === obj.path) { if (item.path === obj.path) {
return item.query === obj.query; return item.query === obj.query;
} }
} else if (item.params) {
if (item.path === obj.path) {
return item.params === obj.params;
}
} else { } else {
return item.path === obj.path; return item.path === obj.path;
} }
@@ -343,7 +199,7 @@ function deleteDynamicTag(obj: any, current: any, tag?: string) {
// 从当前匹配到的路径中删除 // 从当前匹配到的路径中删除
spliceRoute(valueIndex, 1); spliceRoute(valueIndex, 1);
} }
let newRoute = useMultiTagsStoreHook().handleTags("slice"); const newRoute = useMultiTagsStoreHook().handleTags("slice");
if (current === route.path) { if (current === route.path) {
// 删除缓存路由 // 删除缓存路由
tag tag
@@ -351,24 +207,25 @@ function deleteDynamicTag(obj: any, current: any, tag?: string) {
: handleAliveRoute(route.matched, "delete"); : handleAliveRoute(route.matched, "delete");
// 如果删除当前激活tag就自动切换到最后一个tag // 如果删除当前激活tag就自动切换到最后一个tag
if (tag === "left") return; if (tag === "left") return;
nextTick(() => { if (newRoute[0]?.query) {
router.push({ router.push({ name: newRoute[0].name, query: newRoute[0].query });
path: newRoute[0].path, } else if (newRoute[0]?.params) {
query: newRoute[0].query router.push({ name: newRoute[0].name, params: newRoute[0].params });
}); } else {
}); router.push({ path: newRoute[0].path });
}
} else { } else {
// 删除缓存路由 // 删除缓存路由
tag ? delAliveRoutes(delAliveRouteList) : delAliveRoutes([obj]); tag ? delAliveRoutes(delAliveRouteList) : delAliveRoutes([obj]);
if (!multiTags.value.length) return; if (!multiTags.value.length) return;
let isHasActiveTag = multiTags.value.some(item => { if (multiTags.value.some(item => item.path === route.path)) return;
return item.path === route.path; if (newRoute[0]?.query) {
}); router.push({ name: newRoute[0].name, query: newRoute[0].query });
!isHasActiveTag && } else if (newRoute[0]?.params) {
router.push({ router.push({ name: newRoute[0].name, params: newRoute[0].params });
path: newRoute[0].path, } else {
query: newRoute[0].query router.push({ path: newRoute[0].path });
}); }
} }
} }
@@ -385,7 +242,8 @@ function onClickDrop(key, item, selectRoute?: RouteConfigs) {
path: selectRoute.path, path: selectRoute.path,
meta: selectRoute.meta, meta: selectRoute.meta,
name: selectRoute.name, name: selectRoute.name,
query: selectRoute.query query: selectRoute?.query,
params: selectRoute?.params
}; };
} else { } else {
selectTagRoute = { path: route.path, meta: route.meta }; selectTagRoute = { path: route.path, meta: route.meta };
@@ -394,7 +252,7 @@ function onClickDrop(key, item, selectRoute?: RouteConfigs) {
// 当前路由信息 // 当前路由信息
switch (key) { switch (key) {
case 0: case 0:
// 重新加载 // 刷新路由
onFresh(); onFresh();
break; break;
case 1: case 1:
@@ -419,9 +277,34 @@ function onClickDrop(key, item, selectRoute?: RouteConfigs) {
startIndex: 1, startIndex: 1,
length: multiTags.value.length length: multiTags.value.length
}); });
usePermissionStoreHook().clearAllCachePage();
router.push("/welcome"); router.push("/welcome");
break; break;
case 6:
// 整体页面全屏
toggle();
setTimeout(() => {
if (isFullscreen.value) {
tagsViews[6].icon = "exit-fullscreen";
tagsViews[6].text = $t("buttons.hswholeExitFullScreen");
} else {
tagsViews[6].icon = "fullscreen";
tagsViews[6].text = $t("buttons.hswholeFullScreen");
}
}, 100);
break;
case 7:
// 内容区全屏
onContentFullScreen();
setTimeout(() => {
if (pureSetting.hiddenSideBar) {
tagsViews[7].icon = "exit-fullscreen";
tagsViews[7].text = $t("buttons.hscontentExitFullScreen");
} else {
tagsViews[7].icon = "fullscreen";
tagsViews[7].text = $t("buttons.hscontentFullScreen");
}
}, 100);
break;
} }
setTimeout(() => { setTimeout(() => {
showMenuModel(route.fullPath, route.query); showMenuModel(route.fullPath, route.query);
@@ -433,15 +316,11 @@ function handleCommand(command: any) {
onClickDrop(key, item); onClickDrop(key, item);
} }
// 触发右键中菜单的点击事件 /** 触发右键中菜单的点击事件 */
function selectTag(key, item) { function selectTag(key, item) {
onClickDrop(key, item, currentSelect.value); onClickDrop(key, item, currentSelect.value);
} }
function closeMenu() {
visible.value = false;
}
function showMenus(value: boolean) { function showMenus(value: boolean) {
Array.of(1, 2, 3, 4, 5).forEach(v => { Array.of(1, 2, 3, 4, 5).forEach(v => {
tagsViews[v].show = value; tagsViews[v].show = value;
@@ -454,14 +333,14 @@ function disabledMenus(value: boolean) {
}); });
} }
// 检查当前右键的菜单两边是否存在别的菜单,如果左侧的菜单是首页,则不显示关闭左侧标签页,如果右侧没有菜单,则不显示关闭右侧标签页 /** 检查当前右键的菜单两边是否存在别的菜单,如果左侧的菜单是首页,则不显示关闭左侧标签页,如果右侧没有菜单,则不显示关闭右侧标签页 */
function showMenuModel( function showMenuModel(
currentPath: string, currentPath: string,
query: object = {}, query: object = {},
refresh = false refresh = false
) { ) {
let allRoute = multiTags.value; const allRoute = multiTags.value;
let routeLength = multiTags.value.length; const routeLength = multiTags.value.length;
let currentIndex = -1; let currentIndex = -1;
if (isEmpty(query)) { if (isEmpty(query)) {
currentIndex = allRoute.findIndex(v => v.path === currentPath); currentIndex = allRoute.findIndex(v => v.path === currentPath);
@@ -514,7 +393,7 @@ function openMenu(tag, e) {
// 右键菜单为首页,只显示刷新 // 右键菜单为首页,只显示刷新
showMenus(false); showMenus(false);
tagsViews[0].show = true; tagsViews[0].show = true;
} else if (route.path !== tag.path) { } 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);
@@ -542,64 +421,37 @@ function openMenu(tag, e) {
} else { } else {
buttonLeft.value = left; buttonLeft.value = left;
} }
pureSetting.hiddenSideBar useSettingStoreHook().hiddenSideBar
? (buttonTop.value = e.clientY) ? (buttonTop.value = e.clientY)
: (buttonTop.value = e.clientY - 40); : (buttonTop.value = e.clientY - 40);
setTimeout(() => { nextTick(() => {
visible.value = true; visible.value = true;
}, 10);
}
// 触发tags标签切换
function tagOnClick(item) {
router.push({
path: item?.path,
query: item?.query
}); });
showMenuModel(item?.path, item?.query);
} }
// 鼠标移入 /** 触发tags标签切换 */
function onMouseenter(index) { function tagOnClick(item) {
if (index) activeIndex.value = index; const { name, path } = item;
if (unref(showModel) === "smart") { if (name) {
if (hasClass(instance.refs["schedule" + index][0], "schedule-active")) if (item.query) {
return; router.push({
toggleClass(true, "schedule-in", instance.refs["schedule" + index][0]); name,
toggleClass(false, "schedule-out", instance.refs["schedule" + index][0]); query: item.query
});
} else if (item.params) {
router.push({
name,
params: item.params
});
} else { } else {
if (hasClass(instance.refs["dynamic" + index][0], "card-active")) return; router.push({ name });
toggleClass(true, "card-in", instance.refs["dynamic" + index][0]);
toggleClass(false, "card-out", instance.refs["dynamic" + index][0]);
} }
} else {
router.push({ path });
}
// showMenuModel(item?.path, item?.query);
} }
// 鼠标移出
function onMouseleave(index) {
activeIndex.value = -1;
if (unref(showModel) === "smart") {
if (hasClass(instance.refs["schedule" + index][0], "schedule-active"))
return;
toggleClass(false, "schedule-in", instance.refs["schedule" + index][0]);
toggleClass(true, "schedule-out", instance.refs["schedule" + index][0]);
} else {
if (hasClass(instance.refs["dynamic" + index][0], "card-active")) return;
toggleClass(false, "card-in", instance.refs["dynamic" + index][0]);
toggleClass(true, "card-out", instance.refs["dynamic" + index][0]);
}
}
watch(
() => visible.value,
val => {
if (val) {
document.body.addEventListener("click", closeMenu);
} else {
document.body.removeEventListener("click", closeMenu);
}
}
);
onBeforeMount(() => { onBeforeMount(() => {
if (!instance) return; if (!instance) return;
@@ -626,24 +478,28 @@ onBeforeMount(() => {
}); });
}); });
const getTabStyle = computed((): CSSProperties => { watch([route], () => {
return { activeIndex.value = -1;
transform: `translateX(${translateX.value}px)` dynamicTagView();
};
}); });
const getContextMenuStyle = computed((): CSSProperties => { onMounted(() => {
return { left: buttonLeft.value + "px", top: buttonTop.value + "px" }; useResizeObserver(
scrollbarDom,
useDebounceFn(() => {
dynamicTagView();
}, 200)
);
}); });
</script> </script>
<template> <template>
<div ref="containerDom" class="tags-view" v-if="!showTags"> <div ref="containerDom" class="tags-view" v-if="!showTags">
<div class="arrow-left"> <span v-show="isShowArrow" class="arrow-left">
<IconifyIconOffline icon="arrow-left-s-line" @click="handleScroll(200)" /> <IconifyIconOffline icon="arrow-left-s-line" @click="handleScroll(200)" />
</div> </span>
<div ref="scrollbarDom" class="scroll-container"> <div ref="scrollbarDom" class="scroll-container">
<div class="tab" ref="tabDom" :style="getTabStyle"> <div class="tab select-none" ref="tabDom" :style="getTabStyle">
<div <div
:ref="'dynamic' + index" :ref="'dynamic' + index"
v-for="(item, index) in multiTags" v-for="(item, index) in multiTags"
@@ -662,7 +518,7 @@ const getContextMenuStyle = computed((): CSSProperties => {
> >
<router-link <router-link
:to="item.path" :to="item.path"
class="!dark:color-text_color_primary !dark:hover:color-primary" class="dark:!text-text_color_primary dark:hover:!text-primary"
> >
{{ transformI18n(item.meta.title) }} {{ transformI18n(item.meta.title) }}
</router-link> </router-link>
@@ -684,7 +540,7 @@ const getContextMenuStyle = computed((): CSSProperties => {
</div> </div>
</div> </div>
</div> </div>
<span class="arrow-right"> <span v-show="isShowArrow" class="arrow-right">
<IconifyIconOffline <IconifyIconOffline
icon="arrow-right-s-line" icon="arrow-right-s-line"
@click="handleScroll(-200)" @click="handleScroll(-200)"
@@ -699,35 +555,26 @@ const getContextMenuStyle = computed((): CSSProperties => {
class="contextmenu" class="contextmenu"
> >
<div <div
v-for="(item, key) in tagsViews" v-for="(item, key) in tagsViews.slice(0, 6)"
:key="key" :key="key"
style="display: flex; align-items: center" style="display: flex; align-items: center"
> >
<li v-if="item.show" @click="selectTag(key, item)"> <li v-if="item.show" @click="selectTag(key, item)">
<component :is="toRaw(item.icon)" :key="key" /> <IconifyIconOffline :icon="item.icon" />
{{ t(item.text) }} {{ transformI18n(item.text) }}
</li> </li>
</div> </div>
</ul> </ul>
</transition> </transition>
<!-- 右侧功能按钮 --> <!-- 右侧功能按钮 -->
<ul class="right-button">
<li>
<span
:title="t('buttons.hsrefreshRoute')"
class="el-icon-refresh-right rotate"
@click="onFresh"
>
<IconifyIconOffline icon="refresh-right" />
</span>
</li>
<li>
<el-dropdown <el-dropdown
trigger="click" trigger="click"
placement="bottom-end" placement="bottom-end"
@command="handleCommand" @command="handleCommand"
> >
<IconifyIconOffline icon="arrow-down" class="dark:color-white" /> <span class="arrow-down">
<IconifyIconOffline icon="arrow-down" class="dark:text-white" />
</span>
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
<el-dropdown-item <el-dropdown-item
@@ -737,21 +584,12 @@ const getContextMenuStyle = computed((): CSSProperties => {
:divided="item.divided" :divided="item.divided"
:disabled="item.disabled" :disabled="item.disabled"
> >
<component <IconifyIconOffline :icon="item.icon" />
:is="toRaw(item.icon)" {{ transformI18n(item.text) }}
:key="key"
style="margin-right: 6px"
/>
{{ t(item.text) }}
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
</el-dropdown> </el-dropdown>
</li>
<li>
<slot />
</li>
</ul>
</div> </div>
</template> </template>

View File

@@ -1,4 +1,4 @@
<script lang="ts" setup> <script setup lang="ts">
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
import { ref, unref, onMounted, nextTick } from "vue"; import { ref, unref, onMounted, nextTick } from "vue";

View File

@@ -1,11 +1,11 @@
import { ref } from "vue"; import { ref } from "vue";
import { getConfig } from "/@/config"; import { getConfig } from "@/config";
import { find } from "lodash-unified"; import { find } from "lodash-unified";
import { useLayout } from "./useLayout"; import { useLayout } from "./useLayout";
import { themeColorsType } from "../types"; import { themeColorsType } from "../types";
import { TinyColor } from "@ctrl/tinycolor"; import { TinyColor } from "@ctrl/tinycolor";
import { useGlobal } from "@pureadmin/utils"; import { useGlobal } from "@pureadmin/utils";
import { useEpThemeStoreHook } from "/@/store/modules/epTheme"; import { useEpThemeStoreHook } from "@/store/modules/epTheme";
import { import {
darken, darken,
lighten, lighten,
@@ -13,7 +13,7 @@ import {
} from "@pureadmin/theme/dist/browser-utils"; } from "@pureadmin/theme/dist/browser-utils";
export function useDataThemeChange() { export function useDataThemeChange() {
const { layoutTheme } = useLayout(); const { layoutTheme, layout } = useLayout();
const themeColors = ref<Array<themeColorsType>>([ const themeColors = ref<Array<themeColorsType>>([
/* 道奇蓝(默认) */ /* 道奇蓝(默认) */
{ color: "#1b2a47", themeColor: "default" }, { color: "#1b2a47", themeColor: "default" },
@@ -36,7 +36,7 @@ export function useDataThemeChange() {
]); ]);
const { $storage } = useGlobal<GlobalPropertiesApi>(); const { $storage } = useGlobal<GlobalPropertiesApi>();
const dataTheme = ref<boolean>($storage?.layout?.darkMode);
const body = document.documentElement as HTMLElement; const body = document.documentElement as HTMLElement;
/** 设置导航主题色 */ /** 设置导航主题色 */
@@ -45,8 +45,13 @@ export function useDataThemeChange() {
toggleTheme({ toggleTheme({
scopeName: `layout-theme-${theme}` scopeName: `layout-theme-${theme}`
}); });
$storage.layout.theme = theme; $storage.layout = {
$storage.layout.darkMode = dataTheme.value; layout: layout.value,
theme,
darkMode: dataTheme.value,
sidebarStatus: $storage.layout?.sidebarStatus,
epThemeColor: $storage.layout?.epThemeColor
};
if (theme === "default" || theme === "light") { if (theme === "default" || theme === "light") {
setEpThemeColor(getConfig().EpThemeColor); setEpThemeColor(getConfig().EpThemeColor);
@@ -64,7 +69,7 @@ export function useDataThemeChange() {
return new TinyColor(color).shade(10).toString(); return new TinyColor(color).shade(10).toString();
}; };
/** 设置ep主题色 */ /** 设置 `element-plus` 主题色 */
const setEpThemeColor = (color: string) => { const setEpThemeColor = (color: string) => {
useEpThemeStoreHook().setEpThemeColor(color); useEpThemeStoreHook().setEpThemeColor(color);
body.style.setProperty("--el-color-primary-active", shadeBgColor(color)); body.style.setProperty("--el-color-primary-active", shadeBgColor(color));
@@ -82,7 +87,6 @@ export function useDataThemeChange() {
); );
} }
}; };
const dataTheme = ref<boolean>($storage?.layout?.darkMode);
/** 日间、夜间主题切换 */ /** 日间、夜间主题切换 */
function dataThemeChange() { function dataThemeChange() {
@@ -94,10 +98,8 @@ export function useDataThemeChange() {
} }
if (dataTheme.value) { if (dataTheme.value) {
$storage.layout.darkMode = true;
document.documentElement.classList.add("dark"); document.documentElement.classList.add("dark");
} else { } else {
$storage.layout.darkMode = false;
document.documentElement.classList.remove("dark"); document.documentElement.classList.remove("dark");
} }
} }

View File

@@ -2,7 +2,7 @@ import { computed } from "vue";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import { routerArrays } from "../types"; import { routerArrays } from "../types";
import { useGlobal } from "@pureadmin/utils"; import { useGlobal } from "@pureadmin/utils";
import { useMultiTagsStore } from "/@/store/modules/multiTags"; import { useMultiTagsStore } from "@/store/modules/multiTags";
export function useLayout() { export function useLayout() {
const { $storage, $config } = useGlobal<GlobalPropertiesApi>(); const { $storage, $config } = useGlobal<GlobalPropertiesApi>();

View File

@@ -1,27 +1,29 @@
import { computed } from "vue"; import { computed } from "vue";
import { router } from "/@/router"; import { storeToRefs } from "pinia";
import { getConfig } from "/@/config"; import { getConfig } from "@/config";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { emitter } from "/@/utils/mitt"; import { emitter } from "@/utils/mitt";
import { routeMetaType } from "../types"; import { routeMetaType } from "../types";
import type { StorageConfigs } from "/#/index"; import { useGlobal } from "@pureadmin/utils";
import { routerArrays } from "/@/layout/types"; import { transformI18n } from "@/plugins/i18n";
import { transformI18n } from "/@/plugins/i18n"; import { router, remainingPaths } from "@/router";
import { useAppStoreHook } from "/@/store/modules/app"; import { useAppStoreHook } from "@/store/modules/app";
import { remainingPaths, resetRouter } from "/@/router";
import { i18nChangeLanguage } from "@wangeditor/editor"; import { i18nChangeLanguage } from "@wangeditor/editor";
import { storageSession, useGlobal } from "@pureadmin/utils"; import { useUserStoreHook } from "@/store/modules/user";
import { useEpThemeStoreHook } from "/@/store/modules/epTheme"; import { useEpThemeStoreHook } from "@/store/modules/epTheme";
import { useMultiTagsStoreHook } from "/@/store/modules/multiTags"; import { usePermissionStoreHook } from "@/store/modules/permission";
const errorInfo = "当前路由配置不正确,请检查配置"; const errorInfo = "当前路由配置不正确,请检查配置";
export function useNav() { export function useNav() {
const pureApp = useAppStoreHook(); const pureApp = useAppStoreHook();
const routers = useRouter().options.routes; const routers = useRouter().options.routes;
const { wholeMenus } = storeToRefs(usePermissionStoreHook());
/** 用户名 */ /** 用户名 */
const username: string = const username = computed(() => {
storageSession.getItem<StorageConfigs>("info")?.username; return useUserStoreHook()?.username;
});
/** 设置国际化选中后的样式 */ /** 设置国际化选中后的样式 */
const getDropdownItemStyle = computed(() => { const getDropdownItemStyle = computed(() => {
@@ -35,12 +37,12 @@ export function useNav() {
const getDropdownItemClass = computed(() => { const getDropdownItemClass = computed(() => {
return (locale, t) => { return (locale, t) => {
return locale === t ? "" : "!dark:hover:color-primary"; return locale === t ? "" : "dark:hover:!text-primary";
}; };
}); });
const avatarsStyle = computed(() => { const avatarsStyle = computed(() => {
return username ? { marginRight: "10px" } : ""; return username.value ? { marginRight: "10px" } : "";
}); });
const isCollapse = computed(() => { const isCollapse = computed(() => {
@@ -69,10 +71,7 @@ export function useNav() {
/** 退出登录 */ /** 退出登录 */
function logout() { function logout() {
useMultiTagsStoreHook().handleTags("equal", [...routerArrays]); useUserStoreHook().logOut();
storageSession.removeItem("info");
router.push("/login");
resetRouter();
} }
function backHome() { function backHome() {
@@ -103,6 +102,7 @@ export function useNav() {
} }
function menuSelect(indexPath: string, routers): void { function menuSelect(indexPath: string, routers): void {
if (wholeMenus.value.length === 0) return;
if (isRemaining(indexPath)) return; if (isRemaining(indexPath)) return;
let parentPath = ""; let parentPath = "";
const parentPathIndex = indexPath.lastIndexOf("/"); const parentPathIndex = indexPath.lastIndexOf("/");

234
src/layout/hooks/useTag.ts Normal file
View File

@@ -0,0 +1,234 @@
import {
ref,
unref,
watch,
computed,
reactive,
onMounted,
CSSProperties,
getCurrentInstance
} from "vue";
import { tagsViewsType } from "../types";
import type { StorageConfigs } from "/#/index";
import { useEventListener } from "@vueuse/core";
import { useRoute, useRouter } from "vue-router";
import { transformI18n, $t } from "@/plugins/i18n";
import { isEqual, isBoolean } from "@pureadmin/utils";
import { useSettingStoreHook } from "@/store/modules/settings";
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
import { storageLocal, toggleClass, hasClass } from "@pureadmin/utils";
export function useTags() {
const route = useRoute();
const router = useRouter();
const instance = getCurrentInstance();
const pureSetting = useSettingStoreHook();
const buttonTop = ref(0);
const buttonLeft = ref(0);
const translateX = ref(0);
const visible = ref(false);
const activeIndex = ref(-1);
// 当前右键选中的路由信息
const currentSelect = ref({});
/** 显示模式,默认灵动模式 */
const showModel = ref(
storageLocal.getItem<StorageConfigs>("responsive-configure")?.showModel ||
"smart"
);
/** 是否隐藏标签页,默认显示 */
const showTags =
ref(
storageLocal.getItem<StorageConfigs>("responsive-configure").hideTabs
) ?? ref("false");
const multiTags: any = computed(() => {
return useMultiTagsStoreHook().multiTags;
});
const tagsViews = reactive<Array<tagsViewsType>>([
{
icon: "refresh-right",
text: $t("buttons.hsreload"),
divided: false,
disabled: false,
show: true
},
{
icon: "close",
text: $t("buttons.hscloseCurrentTab"),
divided: false,
disabled: multiTags.value.length > 1 ? false : true,
show: true
},
{
icon: "close-left-tags",
text: $t("buttons.hscloseLeftTabs"),
divided: true,
disabled: multiTags.value.length > 1 ? false : true,
show: true
},
{
icon: "close-right-tags",
text: $t("buttons.hscloseRightTabs"),
divided: false,
disabled: multiTags.value.length > 1 ? false : true,
show: true
},
{
icon: "close-other-tags",
text: $t("buttons.hscloseOtherTabs"),
divided: true,
disabled: multiTags.value.length > 2 ? false : true,
show: true
},
{
icon: "close-all-tags",
text: $t("buttons.hscloseAllTabs"),
divided: false,
disabled: multiTags.value.length > 1 ? false : true,
show: true
},
{
icon: "fullscreen",
text: $t("buttons.hswholeFullScreen"),
divided: true,
disabled: false,
show: true
},
{
icon: "fullscreen",
text: $t("buttons.hscontentFullScreen"),
divided: false,
disabled: false,
show: true
}
]);
function conditionHandle(item, previous, next) {
if (isBoolean(route?.meta?.showLink) && route?.meta?.showLink === false) {
if (Object.keys(route.query).length > 0) {
return isEqual(route.query, item.query) ? previous : next;
} else {
return isEqual(route.params, item.params) ? previous : next;
}
} else {
return route.path === item.path ? previous : next;
}
}
const iconIsActive = computed(() => {
return (item, index) => {
if (index === 0) return;
return conditionHandle(item, true, false);
};
});
const linkIsActive = computed(() => {
return item => {
return conditionHandle(item, "is-active", "");
};
});
const scheduleIsActive = computed(() => {
return item => {
return conditionHandle(item, "schedule-active", "");
};
});
const getTabStyle = computed((): CSSProperties => {
return {
transform: `translateX(${translateX.value}px)`
};
});
const getContextMenuStyle = computed((): CSSProperties => {
return { left: buttonLeft.value + "px", top: buttonTop.value + "px" };
});
const closeMenu = () => {
visible.value = false;
};
/** 鼠标移入添加激活样式 */
function onMouseenter(index) {
if (index) activeIndex.value = index;
if (unref(showModel) === "smart") {
if (hasClass(instance.refs["schedule" + index][0], "schedule-active"))
return;
toggleClass(true, "schedule-in", instance.refs["schedule" + index][0]);
toggleClass(false, "schedule-out", instance.refs["schedule" + index][0]);
} else {
if (hasClass(instance.refs["dynamic" + index][0], "card-active")) return;
toggleClass(true, "card-in", instance.refs["dynamic" + index][0]);
toggleClass(false, "card-out", instance.refs["dynamic" + index][0]);
}
}
/** 鼠标移出恢复默认样式 */
function onMouseleave(index) {
activeIndex.value = -1;
if (unref(showModel) === "smart") {
if (hasClass(instance.refs["schedule" + index][0], "schedule-active"))
return;
toggleClass(false, "schedule-in", instance.refs["schedule" + index][0]);
toggleClass(true, "schedule-out", instance.refs["schedule" + index][0]);
} else {
if (hasClass(instance.refs["dynamic" + index][0], "card-active")) return;
toggleClass(false, "card-in", instance.refs["dynamic" + index][0]);
toggleClass(true, "card-out", instance.refs["dynamic" + index][0]);
}
}
function onContentFullScreen() {
pureSetting.hiddenSideBar
? pureSetting.changeSetting({ key: "hiddenSideBar", value: false })
: pureSetting.changeSetting({ key: "hiddenSideBar", value: true });
}
onMounted(() => {
if (!showModel.value) {
const configure = storageLocal.getItem<StorageConfigs>(
"responsive-configure"
);
configure.showModel = "card";
storageLocal.setItem("responsive-configure", configure);
}
});
watch(
() => visible.value,
() => {
useEventListener(document, "click", closeMenu);
}
);
return {
route,
router,
visible,
showTags,
instance,
multiTags,
showModel,
tagsViews,
buttonTop,
buttonLeft,
translateX,
pureSetting,
activeIndex,
getTabStyle,
iconIsActive,
linkIsActive,
currentSelect,
scheduleIsActive,
getContextMenuStyle,
$t,
closeMenu,
onMounted,
onMouseenter,
onMouseleave,
transformI18n,
onContentFullScreen
};
}

View File

@@ -1,22 +1,19 @@
<script setup lang="ts"> <script setup lang="ts">
import { setType } from "./types"; import { setType } from "./types";
import { emitter } from "/@/utils/mitt"; import { emitter } from "@/utils/mitt";
import { useLayout } from "./hooks/useLayout"; import { useLayout } from "./hooks/useLayout";
import { useAppStoreHook } from "/@/store/modules/app"; import { useAppStoreHook } from "@/store/modules/app";
import { useSettingStoreHook } from "/@/store/modules/settings"; import { useSettingStoreHook } from "@/store/modules/settings";
import { deviceDetection, useDark, useGlobal } from "@pureadmin/utils"; import { deviceDetection, useDark, useGlobal } from "@pureadmin/utils";
import { h, reactive, computed, onMounted, defineComponent } from "vue"; import { h, reactive, computed, onMounted, defineComponent } from "vue";
import backTop from "/@/assets/svg/back_top.svg?component";
import fullScreen from "/@/assets/svg/full_screen.svg?component";
import exitScreen from "/@/assets/svg/exit_screen.svg?component";
import navbar from "./components/navbar.vue"; import navbar from "./components/navbar.vue";
import tag from "./components/tag/index.vue"; import tag from "./components/tag/index.vue";
import appMain from "./components/appMain.vue"; import appMain from "./components/appMain.vue";
import setting from "./components/setting/index.vue"; import setting from "./components/setting/index.vue";
import Vertical from "./components/sidebar/vertical.vue"; import Vertical from "./components/sidebar/vertical.vue";
import Horizontal from "./components/sidebar/horizontal.vue"; import Horizontal from "./components/sidebar/horizontal.vue";
import backTop from "@/assets/svg/back_top.svg?component";
const { isDark } = useDark(); const { isDark } = useDark();
const { layout } = useLayout(); const { layout } = useLayout();
@@ -73,7 +70,7 @@ let isAutoCloseSidebar = true;
// 监听容器 // 监听容器
emitter.on("resize", ({ detail }) => { emitter.on("resize", ({ detail }) => {
if (isMobile) return; if (isMobile) return;
let { width } = detail; const { width } = detail;
width <= 760 ? setTheme("vertical") : setTheme(useAppStoreHook().layout); width <= 760 ? setTheme("vertical") : setTheme(useAppStoreHook().layout);
/** width app-wrapper类容器宽度 /** width app-wrapper类容器宽度
* 0 < width <= 760 隐藏侧边栏 * 0 < width <= 760 隐藏侧边栏
@@ -102,12 +99,6 @@ onMounted(() => {
} }
}); });
function onFullScreen() {
pureSetting.hiddenSideBar
? pureSetting.changeSetting({ key: "hiddenSideBar", value: false })
: pureSetting.changeSetting({ key: "hiddenSideBar", value: true });
}
const layoutHeader = defineComponent({ const layoutHeader = defineComponent({
render() { render() {
return h( return h(
@@ -127,31 +118,11 @@ const layoutHeader = defineComponent({
!pureSetting.hiddenSideBar && !pureSetting.hiddenSideBar &&
(layout.value.includes("vertical") || layout.value.includes("mix")) (layout.value.includes("vertical") || layout.value.includes("mix"))
? h(navbar) ? h(navbar)
: h("div"), : null,
!pureSetting.hiddenSideBar && layout.value.includes("horizontal") !pureSetting.hiddenSideBar && layout.value.includes("horizontal")
? h(Horizontal) ? h(Horizontal)
: h("div"), : null,
h( h(tag)
tag,
{},
{
default: () => [
h(
"span",
{
onClick: onFullScreen
},
{
default: () => [
!pureSetting.hiddenSideBar
? h(fullScreen, { class: "dark:color-white" })
: h(exitScreen, { class: "dark:color-white" })
]
}
)
]
}
)
] ]
} }
); );
@@ -226,10 +197,6 @@ const layoutHeader = defineComponent({
} }
} }
.main-hidden {
margin-left: 0 !important;
}
.app-mask { .app-mask {
background: #000; background: #000;
opacity: 0.3; opacity: 0.3;

View File

@@ -20,7 +20,6 @@ const themeColors = {
menuHover: "#4091f7", menuHover: "#4091f7",
subMenuBg: "#0f0303", subMenuBg: "#0f0303",
subMenuActiveBg: "#4091f7", subMenuActiveBg: "#4091f7",
navTextColor: "#fff",
menuText: "rgb(254 254 254 / 65%)", menuText: "rgb(254 254 254 / 65%)",
sidebarLogo: "#002140", sidebarLogo: "#002140",
menuTitleHover: "#fff", menuTitleHover: "#fff",
@@ -33,7 +32,6 @@ const themeColors = {
menuHover: "#e0ebf6", menuHover: "#e0ebf6",
subMenuBg: "#fff", subMenuBg: "#fff",
subMenuActiveBg: "#e0ebf6", subMenuActiveBg: "#e0ebf6",
navTextColor: "#7a80b4",
menuText: "#7a80b4", menuText: "#7a80b4",
sidebarLogo: "#fff", sidebarLogo: "#fff",
menuTitleHover: "#000", menuTitleHover: "#000",
@@ -46,7 +44,6 @@ const themeColors = {
menuHover: "#e13c39", menuHover: "#e13c39",
subMenuBg: "#000", subMenuBg: "#000",
subMenuActiveBg: "#e13c39", subMenuActiveBg: "#e13c39",
navTextColor: "#red",
menuText: "rgb(254 254 254 / 65.1%)", menuText: "rgb(254 254 254 / 65.1%)",
sidebarLogo: "#42090c", sidebarLogo: "#42090c",
menuTitleHover: "#fff", menuTitleHover: "#fff",
@@ -59,7 +56,6 @@ const themeColors = {
menuHover: "#e85f33", menuHover: "#e85f33",
subMenuBg: "#0f0603", subMenuBg: "#0f0603",
subMenuActiveBg: "#e85f33", subMenuActiveBg: "#e85f33",
navTextColor: "#fff",
menuText: "rgb(254 254 254 / 65%)", menuText: "rgb(254 254 254 / 65%)",
sidebarLogo: "#441708", sidebarLogo: "#441708",
menuTitleHover: "#fff", menuTitleHover: "#fff",
@@ -72,7 +68,6 @@ const themeColors = {
menuHover: "#f6da4d", menuHover: "#f6da4d",
subMenuBg: "#0f0603", subMenuBg: "#0f0603",
subMenuActiveBg: "#f6da4d", subMenuActiveBg: "#f6da4d",
navTextColor: "#fff",
menuText: "rgb(254 254 254 / 65%)", menuText: "rgb(254 254 254 / 65%)",
sidebarLogo: "#443b05", sidebarLogo: "#443b05",
menuTitleHover: "#fff", menuTitleHover: "#fff",
@@ -85,7 +80,6 @@ const themeColors = {
menuHover: "#59bfc1", menuHover: "#59bfc1",
subMenuBg: "#000", subMenuBg: "#000",
subMenuActiveBg: "#59bfc1", subMenuActiveBg: "#59bfc1",
navTextColor: "#7a80b4",
menuText: "#7a80b4", menuText: "#7a80b4",
sidebarLogo: "#053434", sidebarLogo: "#053434",
menuTitleHover: "#fff", menuTitleHover: "#fff",
@@ -98,7 +92,6 @@ const themeColors = {
menuHover: "#60ac80", menuHover: "#60ac80",
subMenuBg: "#000", subMenuBg: "#000",
subMenuActiveBg: "#60ac80", subMenuActiveBg: "#60ac80",
navTextColor: "#7a80b4",
menuText: "#7a80b4", menuText: "#7a80b4",
sidebarLogo: "#112f21", sidebarLogo: "#112f21",
menuTitleHover: "#fff", menuTitleHover: "#fff",
@@ -111,7 +104,6 @@ const themeColors = {
menuHover: "#d84493", menuHover: "#d84493",
subMenuBg: "#000", subMenuBg: "#000",
subMenuActiveBg: "#d84493", subMenuActiveBg: "#d84493",
navTextColor: "#7a80b4",
menuText: "#7a80b4", menuText: "#7a80b4",
sidebarLogo: "#3f0d29", sidebarLogo: "#3f0d29",
menuTitleHover: "#fff", menuTitleHover: "#fff",
@@ -124,7 +116,6 @@ const themeColors = {
menuHover: "#693ac9", menuHover: "#693ac9",
subMenuBg: "#000", subMenuBg: "#000",
subMenuActiveBg: "#693ac9", subMenuActiveBg: "#693ac9",
navTextColor: "#7a80b4",
menuText: "#7a80b4", menuText: "#7a80b4",
sidebarLogo: "#1f0c38", sidebarLogo: "#1f0c38",
menuTitleHover: "#fff", menuTitleHover: "#fff",
@@ -147,7 +138,6 @@ export const genScssMultipleScopeVars = (): MultipleScopeVarsItem[] => {
$menuHover: ${themeColors[key].menuHover} !default; $menuHover: ${themeColors[key].menuHover} !default;
$subMenuBg: ${themeColors[key].subMenuBg} !default; $subMenuBg: ${themeColors[key].subMenuBg} !default;
$subMenuActiveBg: ${themeColors[key].subMenuActiveBg} !default; $subMenuActiveBg: ${themeColors[key].subMenuActiveBg} !default;
$navTextColor: ${themeColors[key].navTextColor} !default;
$menuText: ${themeColors[key].menuText} !default; $menuText: ${themeColors[key].menuText} !default;
$sidebarLogo: ${themeColors[key].sidebarLogo} !default; $sidebarLogo: ${themeColors[key].sidebarLogo} !default;
$menuTitleHover: ${themeColors[key].menuTitleHover} !default; $menuTitleHover: ${themeColors[key].menuTitleHover} !default;

View File

@@ -1,4 +1,3 @@
import { Component } from "vue";
export const routerArrays: Array<RouteConfigs> = [ export const routerArrays: Array<RouteConfigs> = [
{ {
path: "/welcome", path: "/welcome",
@@ -15,13 +14,14 @@ export type routeMetaType = {
icon?: string; icon?: string;
showLink?: boolean; showLink?: boolean;
savedPosition?: boolean; savedPosition?: boolean;
authority?: Array<string>; auths?: Array<string>;
}; };
export type RouteConfigs = { export type RouteConfigs = {
path?: string; path?: string;
parentPath?: string; parentPath?: string;
query?: object; query?: object;
params?: object;
meta?: routeMetaType; meta?: routeMetaType;
children?: RouteConfigs[]; children?: RouteConfigs[];
name?: string; name?: string;
@@ -32,7 +32,7 @@ export type multiTagsType = {
}; };
export type tagsViewsType = { export type tagsViewsType = {
icon: Component; icon: string;
text: string; text: string;
divided: boolean; divided: boolean;
disabled: boolean; disabled: boolean;

View File

@@ -1,20 +1,19 @@
import App from "./App.vue"; import App from "./App.vue";
import router from "./router"; import router from "./router";
import { setupStore } from "/@/store"; import { setupStore } from "@/store";
import ElementPlus from "element-plus"; import ElementPlus from "element-plus";
import { useI18n } from "@/plugins/i18n";
import { getServerConfig } from "./config"; import { getServerConfig } from "./config";
import { createApp, Directive } from "vue"; import { createApp, Directive } from "vue";
import { useI18n } from "../src/plugins/i18n";
import { MotionPlugin } from "@vueuse/motion"; import { MotionPlugin } from "@vueuse/motion";
import { useEcharts } from "/@/plugins/echarts"; import { useEcharts } from "@/plugins/echarts";
import { useTable } from "@/plugins/vxe-table";
import VirtualScroller from "vue-virtual-scroller"; import VirtualScroller from "vue-virtual-scroller";
import { useTable } from "../src/plugins/vxe-table"; import { injectResponsiveStorage } from "@/utils/responsive";
import { injectResponsiveStorage } from "/@/utils/responsive";
import Table from "@pureadmin/table"; import Table from "@pureadmin/table";
import PureDescriptions from "@pureadmin/descriptions"; import PureDescriptions from "@pureadmin/descriptions";
import "uno.css";
import "animate.css"; import "animate.css";
// 引入重置样式 // 引入重置样式
import "./style/reset.scss"; import "./style/reset.scss";
@@ -33,7 +32,7 @@ import "vue-virtual-scroller/dist/vue-virtual-scroller.css";
const app = createApp(App); const app = createApp(App);
// 自定义指令 // 自定义指令
import * as directives from "/@/directives"; import * as directives from "@/directives";
Object.keys(directives).forEach(key => { Object.keys(directives).forEach(key => {
app.directive(key, (directives as { [key: string]: Directive })[key]); app.directive(key, (directives as { [key: string]: Directive })[key]);
}); });
@@ -48,6 +47,10 @@ app.component("IconifyIconOffline", IconifyIconOffline);
app.component("IconifyIconOnline", IconifyIconOnline); app.component("IconifyIconOnline", IconifyIconOnline);
app.component("FontIcon", FontIcon); app.component("FontIcon", FontIcon);
// 全局注册按钮级别权限组件
import { Auth } from "@/components/ReAuth";
app.component("Auth", Auth);
getServerConfig(app).then(async config => { getServerConfig(app).then(async config => {
app.use(router); app.use(router);
await router.isReady(); await router.isReady();

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