26 Commits

Author SHA1 Message Date
lyt
04ca9b04c1 'admin-21.10.17:更新优化,具体查看根目录CHANGELOG.md' 2021-10-17 12:32:28 +08:00
lyt
3f4c08c119 'admin-21.09.25:修复横向导航菜单不高亮问题' 2021-09-25 19:11:58 +08:00
lyt
99431138c5 'admin-21.09.25:修改浏览器窗口大小改变时菜单水平折叠问题,感谢群友@三木' 2021-09-25 17:47:34 +08:00
lyt
fe70746902 'admin-21.09.25:更新修复诸多内容,请查看CHANGELOG.md' 2021-09-25 16:47:30 +08:00
lyt
cea507e688 'admin-21.09.11:优化深色模式' 2021-09-11 10:37:29 +08:00
15a3025928 update CHANGELOG.md. 2021-09-10 15:32:18 +00:00
lyt
4f9ddc6c26 'admin-21.09.10:新增功能,具体查看CHANGELOG.md' 2021-09-10 23:24:58 +08:00
f6ff10c4a9 'admin-21.08.29:修复优化诸多内容,请查看CHANGELOG.md文件' 2021-08-29 18:45:29 +08:00
8b1c80a8d4 'admin-21.08.22:修复优化诸多内容,请查看CHANGELOG.md文件' 2021-08-22 18:05:26 +08:00
a4da51c179 !14 修复固定header后没有回到顶部的bug,修复拉取项目后运行不起来的bug
Merge pull request !14 from wjs0509/master
2021-08-21 09:42:43 +00:00
12e6b2b4bc 修复用户管理分页的bug 2021-08-20 19:16:29 +08:00
25fa3536de 修复固定header后没有回到顶部的bug,修复拉取项目后运行不起来的bug 2021-08-20 18:58:52 +08:00
ea5dccebe6 'admin-21.08.16:优化布局配置菜单/顶栏功能' 2021-08-16 21:44:16 +08:00
e0960f9009 'admin-21.08.14优化修复菜单高亮、右键菜单全屏、国际化等' 2021-08-14 18:03:50 +08:00
c49736ae7d 'admin-21.08.07:更新README.md' 2021-08-07 19:43:33 +08:00
dfcf817d70 'admin-21.08.06:优化,具体查看根目录CHANGELOG.md文件' 2021-08-06 12:19:25 +08:00
71eb623cef 'admin-21.08.06:优化,具体查看根目录CHANGELOG.md文件' 2021-08-06 12:17:56 +08:00
28edd79b1c 'admin-21.08.01:更新修复请查看CHANGELOG.md文件或查看标签' 2021-08-01 18:30:30 +08:00
1dd6b653e7 处理图标页全屏后无法渲染的问题 2021-07-27 02:36:19 +00:00
92db3f6335 !12 处理图表页全屏后无法渲染的问题
Merge pull request !12 from MaxNull/dev-20210727
2021-07-27 02:33:54 +00:00
fd5d763de4 处理图标页全屏后无法渲染的问题 2021-07-27 10:13:16 +08:00
0050120d79 Merge branch 'master' of https://gitee.com/maxnull/vue-next-admin
# Conflicts:
#	src/layout/component/aside.vue
#	src/layout/component/header.vue
#	src/layout/navBars/tagsView/tagsView.vue
#	src/store/modules/tagsViewRoutes.ts
2021-07-27 08:51:34 +08:00
b86aca5838 'admin-21.07.26:处理全屏若干问题,pr!11,感谢群友@另一个前端' 2021-07-26 23:46:37 +08:00
a1be0533c4 '处理冲突,请勿拉新(请忽略此版本)' 2021-07-26 20:12:51 +08:00
6ca702d590 处理全屏若干问题 2021-07-26 17:31:26 +08:00
lyt
e3f3a9cc5e 'admin-21.07.26:修复tagsview右键菜单点击开启当前页全屏问题' 2021-07-26 17:00:04 +08:00
93 changed files with 4539 additions and 640 deletions

2
.env
View File

@ -4,5 +4,5 @@ VITE_PORT = 8888
# open 运行 npm run dev 时自动打开浏览器
VITE_OPEN = false
# public path 配置线上环境路径(打包)
# public path 配置线上环境路径(打包)、本地通过 http-server 访问时,请置空即可
VITE_PUBLIC_PATH = /vue-next-admin-preview/

View File

@ -2,6 +2,93 @@
🎉🎉🔥 `vue-next-admin` 基于 vue3.x 、Typescript、vite、Element plus 等适配手机、平板、pc 的后台开源免费模板库vue2.x 请切换 vue-prev-admin 分支)
## 1.1.2
`2021.10.17`
- 🌟 更新 依赖更新最新版本
- 🐞 修复 开启全屏时,刷新界面被还原成未全屏的状态
- 🎯 优化 tagsView 右键菜单关闭逻辑
- 🎯 优化 wangeditor 富文本编辑器(增加双向绑定)
- 🎉 新增 工作流(暂不开源)
- 🎉 新增 基础版 ts不带国际化切换 `vue-next-admin-template` 分支
## 1.1.1
`2021.09.25`
- 🌟 更新 依赖更新最新版本(`"element-plus": "^1.1.0-beta.13"` 版本运行错误,`^1.1.0-beta.16`修复横向菜单卡死问题)
- 🐞 修复 Dialog 弹窗位置错误、Drawer 抽屉内边距、el-menu 菜单收起时背景色问题
- 🎯 优化 锁屏界面自动锁屏(s/秒)必须设置至少 1 秒
- 🎉 新增 分栏布局,鼠标移入当前项时,显示当前项菜单内容
- 🎉 新增 工作流(未完成)
## 1.1.0
`2021.09.10`
- 🌟 更新 依赖更新最新版本
- 🎯 优化 小屏模式下登录页二维码遮挡标题问题
- 🎉 新增 图片验证器
- 🎉 新增 动态复杂表单
- 🎉 新增 工作流(未完成)
- 🎉 新增 深色主题(伪深色,样式变动大,谨慎更新)
## 1.0.18
`2021.08.29`
- 🌟 更新 依赖更新最新版本
- 🎯 优化 权限组件去掉顶级 div`/src/components/auth`
- 🎉 新增 布局配置添加恢复默认按钮
- 🐞 修复 升级 <a href="https://element-plus.gitee.io/#/zh-CN/component/changelog" target="_blank">element plus 1.1.0-beta.7</a>后项目无法启动、el-menu 菜单
- 🐞 修复 表格固定列时的层级、设置了相对定位时,遮挡左侧导航菜单问题
## 1.0.17
`2021.08.22`
- 🌟 更新 依赖更新最新版本
- 🎯 优化 去除设置布局切换重置主题样式initSetLayoutChange切换布局需手动设置样式设置的样式自动同步各布局
- 🎯 优化 Dropdown 下拉菜单用户账号靠边时换行问题
- 🎯 优化 左侧导航菜单,共用菜单树,防止 `布局配置` 设置 `菜单 / 顶栏` 时,样式丢失等问题
- 🐞 修复 固定 header 后没有回到顶部的 bug拉取项目后运行不起来的 bug。<a href="https://gitee.com/lyt-top/vue-next-admin/pulls/14" target="_blank">!14</a>,感谢<a href="https://gitee.com/wjs0509" target="_blank">@wjs0509</a>
- 🐞 修复 tagView 右键全屏后,浏览器窗口大小发生任何变化都会导致左边菜单显示出来,并且可点击打开对应页面。<a href="https://gitee.com/lyt-top/vue-next-admin/issues/I46E6T" target="_blank">I46E6T</a>
- 🐞 修复 默认设置 `菜单 / 顶栏` 样式不生效问题(/@/src/store/modules/themeConfig.ts
## 1.0.16
`2021.08.14`
- 🌟 更新 依赖更新最新版本
- 🎯 优化 菜单高亮(详情且详情设置了 meta.isHide 时,顶级菜单高亮),感谢群友@YourObject
- 🎯 优化 详情路径写法:如父级(/pages/filtering那么详情为/pages/filtering/details?id=1。这样写可实现详情时父级菜单高亮否则写成/pages/filteringDetails?id=1顶级菜单将不会高亮。可参考`页面/过滤筛选组件`,点击当前图片进行测试
- 🎯 优化 tagsView 右键菜单全屏时,打开的界面高度问题
- 🎯 优化 图表批量 resize 问题
- 🐞 修复 菜单收起时设置全局主题primary 且有二级菜单时),文字高亮颜色不对
- 🐞 修复 国际化 <a href="https://gitee.com/lyt-top/vue-next-admin/issues/I43NPE" target="_blank">#I43NPE</a>。可参考:`页面/过滤筛选组件`,点击顶部语言切换,进行底部分页国际化查看
## 1.0.15
`2021.08.06`
- 🌟 更新 依赖更新最新版本
- 🎯 优化 tagsView 右键菜单点击时的字段名id 已修改成 contextMenuClickId与路由中返回的 id 名冲突问题,感谢群友@伯牙已遇钟子期
- 🎉 新增 多个 form 表单验证界面演示
## 1.0.14
`2021.07.29`
- 🌟 更新 依赖更新最新版本vue、vuex、vue-router,出现问题,请手动降级。版本查看:<a href="https://www.npmjs.com/" target="_blank">vnpm</a>
- 🎯 优化 数据可视化图表演示加载卡顿问题、优化有图表的演示界面
- 🎯 优化 路由参数演示界面
- 🎯 优化 tagsView 操作演示界面由于存在相同路由多标签必须要传全部参数值query 或者 params
- 🎉 新增 开启 TagsView 共用开启时多个路由菜单共用一个详情组件参数为后点击的覆盖前面点击的tagsView 中只会出现一个(不支持同时出现多个 tagsView 标签))。关闭时:(多个路由菜单共用一个详情组件,参数不同,会同时出现多个 tagsView 标签)
- 🐞 修复 tagsView 共用(单标签)时,右键菜单功能点击,参数不对的问题(第 2n+个参数未覆盖第一个参数值)
- 🐞 修复 多 tagsView 标签(参数不同)、单个 tagsView 标签公用(参数不同)所带来的刷新功能、横向自动滚动等问题
- 🐞 修复 处理全屏若干问题,<a href="https://gitee.com/lyt-top/vue-next-admin/pulls/12" target="_blank">pr!12</a>,感谢群友@另一个前端
## 1.0.13
`2021.07.25`

View File

@ -39,6 +39,14 @@
- 复制代码(桌面 cmd 运行) `npm install -g cnpm --registry=https://registry.npm.taobao.org`
- 复制代码(桌面 cmd 运行) `npm install -g yarn`
#### 🏭 环境支持
| Edge | last 2 versions | last 2 versions | last 2 versions |
| ------------------------------------------------------------------------ | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ |
| ![Edge](https://cdn.jsdelivr.net/npm/@browser-logos/edge/edge_32x32.png) | ![Firefox](https://cdn.jsdelivr.net/npm/@browser-logos/firefox/firefox_32x32.png) | ![Chrome](https://cdn.jsdelivr.net/npm/@browser-logos/chrome/chrome_32x32.png) | ![Safari](https://cdn.jsdelivr.net/npm/@browser-logos/safari/safari_32x32.png) |
> 由于 Vue3 不再支持 IE11故而 ElementPlus 也不支持 IE11 及之前版本。
#### ⚡ 使用说明
建议使用 cnpm因为 yarn 有时会报错。<a href="http://nodejs.cn/" target="_blank">node 版本 > 12xx.xx.x</a>
@ -71,11 +79,18 @@ cnpm run build
#### 💯 学习交流加 QQ 群
- 若加群了没同意(一般不会超过一天),那就是群满了,请换一个群试试
- 查看开发文档、<a href="https://lyt-top.gitee.io/vue-next-admin-preview/#/login" target="_blank">vue-next-admin</a> 开发文档正在编写中...
- 群号码:<a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=RdUY97Vx0T0vZ_1OOu-X1yFNkWgDwbjC&jump_from=webapi">665452019</a>
- 群号码:
1 群:<a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=RdUY97Vx0T0vZ_1OOu-X1yFNkWgDwbjC&jump_from=webapi">665452019</a>
2 群:<a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=zVfy3gNy7pNWVK3kMduDzwU369PZg2fw&jump_from=webapi">766356862</a>
<a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=RdUY97Vx0T0vZ_1OOu-X1yFNkWgDwbjC&jump_from=webapi">
<img src="https://gitee.com/lyt-top/vue-next-admin-images/raw/master/user/qqs.png" width="220" alt="vue-next-admin 讨论群" title="vue-next-admin 讨论群"/></a>
<a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=RdUY97Vx0T0vZ_1OOu-X1yFNkWgDwbjC&jump_from=webapi">
<img src="https://gitee.com/lyt-top/vue-next-admin-images/raw/master/user/qq1.png" width="220" height="220" alt="vue-next-admin 讨论群" title="vue-next-admin 讨论群1"/>
</a>
<a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=zVfy3gNy7pNWVK3kMduDzwU369PZg2fw&jump_from=webapi">
<img src="https://gitee.com/lyt-top/vue-next-admin-images/raw/master/user/qq2.png" width="220" height="220" alt="vue-next-admin 讨论群" title="vue-next-admin 讨论群2"/>
</a>
#### ❤️ 鸣谢列表
@ -103,10 +118,12 @@ cnpm run build
- <a href="https://github.com/likaia/screen-shot" target="_blank">vue-web-screen-shot</a>
- <a href="https://github.com/jbaysolutions/vue-grid-layout" target="_blank">vue-grid-layout</a>
- <a href="https://github.com/antoniandre/splitpanes" target="_blank">splitpanes</a>
- <a href="https://github.com/yimijianfang/vue-drag-verify" target="_blank">vue-drag-verify</a>
- <a href="https://github.com/jsplumb/jsplumb" target="_blank">jsplumb</a>
#### 💕 特别感谢
特别感谢群里老哥的建议、指导与帮忙谢谢!
特别感谢老哥的建议、指导与帮忙谢谢!
- <a href="https://gitee.com/click33/sa-plus" target="_blank">@省长</a>
- <a href="https://gitee.com/jskz/Jskz-SpringCloud" target="_blank">@唐参

View File

@ -1,19 +1,23 @@
{
"name": "vue-next-admin",
"version": "1.0.13",
"version": "1.1.2",
"description": "vue3 vite next admin template",
"author": "lyt_20201208",
"license": "MIT",
"scripts": {
"dev": "vite",
"build": "vite build",
"lint-fix": "eslint --fix --ext .js --ext .jsx --ext .vue src/"
},
"dependencies": {
"axios": "^0.21.1",
"countup.js": "^2.0.7",
"axios": "^0.23.0",
"countup.js": "^2.0.8",
"cropperjs": "^1.5.12",
"echarts": "^5.1.2",
"echarts-gl": "^2.0.6",
"echarts": "^5.2.1",
"echarts-gl": "^2.0.8",
"echarts-wordcloud": "^2.0.0",
"element-plus": "^1.0.2-beta.57",
"element-plus": "^1.1.0-beta.20",
"jsplumb": "^2.15.6",
"mitt": "^3.0.0",
"nprogress": "^0.2.0",
"print-js": "^1.6.0",
@ -21,38 +25,58 @@
"screenfull": "^5.1.0",
"sortablejs": "^1.14.0",
"splitpanes": "^3.0.4",
"vue": "^3.0.11",
"vue": "^3.2.20",
"vue-clipboard3": "^1.0.1",
"vue-grid-layout": "^3.0.0-beta1",
"vue-i18n": "^9.1.7",
"vue-router": "^4.0.8",
"vue-i18n": "^9.1.9",
"vue-router": "^4.0.12",
"vue-web-screen-shot": "^1.2.0",
"vuex": "^4.0.1",
"wangeditor": "^4.7.5"
"vuex": "^4.0.2",
"wangeditor": "^4.7.8"
},
"devDependencies": {
"@types/axios": "^0.14.0",
"@types/clipboard": "^2.0.1",
"@types/node": "^16.4.1",
"@types/node": "^16.11.0",
"@types/nprogress": "^0.2.0",
"@types/sortablejs": "^1.10.7",
"@typescript-eslint/eslint-plugin": "^4.28.4",
"@typescript-eslint/parser": "^4.28.4",
"@vitejs/plugin-vue": "^1.2.5",
"@vue/compiler-sfc": "^3.1.5",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"@vitejs/plugin-vue": "^1.9.3",
"@vue/compiler-sfc": "^3.2.20",
"dotenv": "^10.0.0",
"eslint": "^7.31.0",
"eslint-plugin-vue": "^7.14.0",
"prettier": "^2.3.2",
"sass": "^1.36.0",
"sass-loader": "^12.1.0",
"typescript": "^4.3.5",
"vite": "^2.4.3",
"vue-eslint-parser": "^7.9.0"
"eslint": "^8.0.1",
"eslint-plugin-vue": "^7.19.1",
"prettier": "^2.4.1",
"sass": "^1.43.2",
"sass-loader": "^12.2.0",
"typescript": "^4.4.4",
"vite": "^2.6.7",
"vue-eslint-parser": "^7.11.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
],
"bugs": {
"url": "https://gitee.com/lyt-top/vue-next-admin/issues"
},
"engines": {
"node": ">=12.0.0",
"npm": ">= 6.0.0"
},
"keywords": [
"vue",
"vue3",
"vuejs/vue-next",
"element-ui",
"element-plus",
"vue-next-admin",
"next-admin"
],
"repository": {
"type": "git",
"url": "https://gitee.com/lyt-top/vue-next-admin.git"
}
}

View File

@ -1,27 +1,34 @@
<template>
<router-view v-show="getThemeConfig.lockScreenTime !== 0" />
<LockScreen v-if="getThemeConfig.isLockScreen" />
<Setings ref="setingsRef" v-show="getThemeConfig.lockScreenTime !== 0" />
<el-config-provider :locale="i18nLocale">
<router-view v-show="getThemeConfig.lockScreenTime !== 0" />
<LockScreen v-if="getThemeConfig.isLockScreen" />
<Setings ref="setingsRef" v-show="getThemeConfig.lockScreenTime !== 0" />
<CloseFull />
</el-config-provider>
</template>
<script lang="ts">
import { computed, ref, getCurrentInstance, onBeforeMount, onMounted, onUnmounted, nextTick, defineComponent, watch } from 'vue';
import { computed, ref, getCurrentInstance, onBeforeMount, onMounted, onUnmounted, nextTick, defineComponent, watch, reactive, toRefs } from 'vue';
import { useRoute } from 'vue-router';
import { useStore } from '/@/store/index';
import { useTitle } from '/@/utils/setWebTitle';
import { Local } from '/@/utils/storage';
import { Local, Session } from '/@/utils/storage';
import setIntroduction from '/@/utils/setIconfont';
import LockScreen from '/@/layout/lockScreen/index.vue';
import Setings from '/@/layout/navBars/breadcrumb/setings.vue';
import CloseFull from '/@/layout/navBars/breadcrumb/closeFull.vue';
export default defineComponent({
name: 'app',
components: { LockScreen, Setings },
components: { LockScreen, Setings, CloseFull },
setup() {
const { proxy } = getCurrentInstance() as any;
const setingsRef = ref();
const route = useRoute();
const store = useStore();
const title = useTitle();
const state = reactive({
i18nLocale: null,
});
// 获取布局配置信息
const getThemeConfig = computed(() => {
return store.state.themeConfig.themeConfig;
@ -44,16 +51,25 @@ export default defineComponent({
proxy.mittBus.on('openSetingsDrawer', () => {
openSetingsDrawer();
});
// 设置 i18nApp.vue 中的 el-config-provider
proxy.mittBus.on('getI18nConfig', (locale: string) => {
state.i18nLocale = locale;
});
// 获取缓存中的布局配置
if (Local.get('themeConfig')) {
store.dispatch('themeConfig/setThemeConfig', Local.get('themeConfig'));
document.documentElement.style.cssText = Local.get('themeConfigStyle');
}
// 获取缓存中的全屏配置
if (Session.get('isTagsViewCurrenFull')) {
store.dispatch('tagsViewRoutes/setCurrenFullscreen', Session.get('isTagsViewCurrenFull'));
}
});
});
// 页面销毁时,关闭监听布局配置
// 页面销毁时,关闭监听布局配置/i18n监听
onUnmounted(() => {
proxy.mittBus.off('openSetingsDrawer', () => {});
proxy.mittBus.off('getI18nConfig', () => {});
});
// 监听路由的变化,设置网站标题
watch(
@ -65,6 +81,7 @@ export default defineComponent({
return {
setingsRef,
getThemeConfig,
...toRefs(state),
};
},
});

View File

@ -1,7 +1,5 @@
<template>
<div v-if="getUserAuthBtnList">
<slot />
</div>
<slot v-if="getUserAuthBtnList" />
</template>
<script lang="ts">

View File

@ -1,7 +1,5 @@
<template>
<div v-if="getUserAuthBtnList">
<slot />
</div>
<slot v-if="getUserAuthBtnList" />
</template>
<script lang="ts">

View File

@ -1,7 +1,5 @@
<template>
<div v-if="getUserAuthBtnList">
<slot />
</div>
<slot v-if="getUserAuthBtnList" />
</template>
<script lang="ts">

View File

@ -98,12 +98,12 @@ export default {
display: inline-block;
height: 350px;
flex: 1;
border: 1px solid #ebeef5;
background: #fff;
border: var(--el-border-base);
background: var(--color-whites);
overflow: hidden;
background-repeat: no-repeat;
cursor: move;
border-radius: 3px;
border-radius: var(--el-border-radius-base);
.cropper-warp-left-img {
width: 100%;
height: 100%;
@ -124,7 +124,7 @@ export default {
.cropper-warp-right-value-img {
width: 100px;
height: 100px;
border-radius: 100%;
border-radius: var(--el-border-radius-circle);
margin: auto;
}
.cropper-size {
@ -135,7 +135,7 @@ export default {
.cropper-warp-right-label {
text-align: center;
font-size: 12px;
color: #666666;
color: var(--el-text-color-primary);
height: 30px;
line-height: 30px;
}

View File

@ -0,0 +1,296 @@
<template>
<div
ref="dragVerify"
class="drag_verify"
:style="dragVerifyStyle"
@mousemove="dragMoving"
@mouseup="dragFinish"
@mouseleave="dragFinish"
@touchmove="dragMoving"
@touchend="dragFinish"
>
<div class="dv_progress_bar" :class="{ goFirst2: isOk }" ref="progressBar" :style="progressBarStyle"></div>
<div class="dv_text" :style="textStyle" ref="message">
<slot name="textBefore" v-if="$slots.textBefore"></slot>
{{ message }}
<slot name="textAfter" v-if="$slots.textAfter"></slot>
</div>
<div
class="dv_handler dv_handler_bg"
:class="{ goFirst: isOk }"
@mousedown="dragStart"
@touchstart="dragStart"
ref="handler"
:style="handlerStyle"
>
<i :class="handlerIcon"></i>
</div>
</div>
</template>
<script>
export default {
name: 'dragVerify',
props: {
isPassing: {
type: Boolean,
default: false,
},
width: {
type: Number,
default: 250,
},
height: {
type: Number,
default: 40,
},
text: {
type: String,
default: 'swiping to the right side',
},
successText: {
type: String,
default: 'success',
},
background: {
type: String,
default: '#eee',
},
progressBarBg: {
type: String,
default: '#76c61d',
},
completedBg: {
type: String,
default: '#76c61d',
},
circle: {
type: Boolean,
default: false,
},
radius: {
type: String,
default: '4px',
},
handlerIcon: {
type: String,
},
successIcon: {
type: String,
},
handlerBg: {
type: String,
default: '#fff',
},
textSize: {
type: String,
default: '14px',
},
textColor: {
type: String,
default: '#333',
},
},
mounted: function () {
const dragEl = this.$refs.dragVerify;
dragEl.style.setProperty('--textColor', this.textColor);
dragEl.style.setProperty('--width', Math.floor(this.width / 2) + 'px');
dragEl.style.setProperty('--pwidth', -Math.floor(this.width / 2) + 'px');
console.log(this.$slots);
},
computed: {
handlerStyle: function () {
return {
width: this.height + 'px',
height: this.height + 'px',
background: this.handlerBg,
};
},
message: function () {
return this.isPassing ? this.successText : this.text;
},
dragVerifyStyle: function () {
return {
width: this.width + 'px',
height: this.height + 'px',
lineHeight: this.height + 'px',
background: this.background,
borderRadius: this.circle ? this.height / 2 + 'px' : this.radius,
};
},
progressBarStyle: function () {
return {
background: this.progressBarBg,
height: this.height + 'px',
borderRadius: this.circle ? this.height / 2 + 'px 0 0 ' + this.height / 2 + 'px' : this.radius,
};
},
textStyle: function () {
return {
height: this.height + 'px',
width: this.width + 'px',
fontSize: this.textSize,
};
},
},
data() {
return {
isMoving: false,
x: 0,
isOk: false,
};
},
methods: {
dragStart: function (e) {
if (!this.isPassing) {
this.isMoving = true;
this.x = e.pageX || e.touches[0].pageX;
}
this.$emit('handlerMove');
},
dragMoving: function (e) {
if (this.isMoving && !this.isPassing) {
var _x = (e.pageX || e.touches[0].pageX) - this.x;
var handler = this.$refs.handler;
if (_x > 0 && _x <= this.width - this.height) {
handler.style.left = _x + 'px';
this.$refs.progressBar.style.width = _x + this.height / 2 + 'px';
} else if (_x > this.width - this.height) {
handler.style.left = this.width - this.height + 'px';
this.$refs.progressBar.style.width = this.width - this.height / 2 + 'px';
this.passVerify();
}
}
},
dragFinish: function (e) {
if (this.isMoving && !this.isPassing) {
var _x = (e.pageX || e.changedTouches[0].pageX) - this.x;
if (_x < this.width - this.height) {
this.isOk = true;
var that = this;
setTimeout(function () {
that.$refs.handler.style.left = '0';
that.$refs.progressBar.style.width = '0';
that.isOk = false;
}, 500);
this.$emit('passfail');
} else {
var handler = this.$refs.handler;
handler.style.left = this.width - this.height + 'px';
this.$refs.progressBar.style.width = this.width - this.height / 2 + 'px';
this.passVerify();
}
this.isMoving = false;
}
},
passVerify: function () {
this.$emit('update:isPassing', true);
this.isMoving = false;
var handler = this.$refs.handler;
handler.children[0].className = this.successIcon;
this.$refs.progressBar.style.background = this.completedBg;
this.$refs.message.style['-webkit-text-fill-color'] = 'unset';
this.$refs.message.style.animation = 'slidetounlock2 3s infinite';
this.$refs.message.style.color = '#fff';
this.$emit('passcallback');
},
reset: function () {
const oriData = this.$options.data();
for (const key in oriData) {
if (Object.prototype.hasOwnProperty.call(oriData, key)) {
this[key] = oriData[key];
}
}
var handler = this.$refs.handler;
var message = this.$refs.message;
handler.style.left = '0';
this.$refs.progressBar.style.width = '0';
handler.children[0].className = this.handlerIcon;
message.style['-webkit-text-fill-color'] = 'transparent';
message.style.animation = 'slidetounlock 3s infinite';
message.style.color = this.background;
},
},
};
</script>
<style scoped>
.drag_verify {
position: relative;
background-color: #e8e8e8;
text-align: center;
overflow: hidden;
}
.drag_verify .dv_handler {
position: absolute;
top: 0px;
left: 0px;
cursor: move;
}
.drag_verify .dv_handler i {
color: #666;
padding-left: 0;
font-size: 16px;
}
.drag_verify .dv_handler .el-icon-circle-check {
color: #6c6;
margin-top: 9px;
}
.drag_verify .dv_progress_bar {
position: absolute;
height: 34px;
width: 0px;
}
.drag_verify .dv_text {
position: absolute;
top: 0px;
color: transparent;
-moz-user-select: none;
-webkit-user-select: none;
user-select: none;
-o-user-select: none;
-ms-user-select: none;
background: -webkit-gradient(
linear,
left top,
right top,
color-stop(0, var(--textColor)),
color-stop(0.4, var(--textColor)),
color-stop(0.5, #fff),
color-stop(0.6, var(--textColor)),
color-stop(1, var(--textColor))
);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
-webkit-text-size-adjust: none;
animation: slidetounlock 3s infinite;
}
.drag_verify .dv_text * {
-webkit-text-fill-color: var(--textColor);
}
.goFirst {
left: 0px !important;
transition: left 0.5s;
}
.goFirst2 {
width: 0px !important;
transition: width 0.5s;
}
</style>
<style>
@-webkit-keyframes slidetounlock {
0% {
background-position: var(--pwidth) 0;
}
100% {
background-position: var(--width) 0;
}
}
@-webkit-keyframes slidetounlock2 {
0% {
background-position: var(--pwidth) 0;
}
100% {
background-position: var(--pwidth) 0;
}
}
</style>

View File

@ -0,0 +1,453 @@
<template>
<div class="drag-verify-container">
<div :style="dragVerifyImgStyle">
<img ref="checkImg" :src="imgsrc" @load="checkimgLoaded" style="width: 100%" alt="" />
<div class="move-bar" :class="{ goFirst: isOk, goKeep: isKeep }" :style="movebarStyle" ref="moveBar" v-show="showBar"></div>
<div class="clip-bar" :style="clipbarStyle" ref="clipBar"></div>
<div class="refresh" v-if="showRefresh && !isPassing">
<i :class="refreshIcon" @click="refreshimg"></i>
</div>
<div class="tips success" v-if="showTips && isPassing">{{ successTip }}</div>
<div class="tips danger" v-if="showTips && !isPassing && showErrorTip">{{ failTip }}</div>
</div>
<div
ref="dragVerify"
class="drag_verify"
:style="dragVerifyStyle"
@mousemove="dragMoving"
@mouseup="dragFinish"
@mouseleave="dragFinish"
@touchmove="dragMoving"
@touchend="dragFinish"
>
<div class="dv_progress_bar" :class="{ goFirst2: isOk }" ref="progressBar" :style="progressBarStyle">
{{ successMessage }}
</div>
<div class="dv_text" :style="textStyle" ref="message">
{{ message }}
</div>
<div
class="dv_handler dv_handler_bg"
:class="{ goFirst: isOk }"
@mousedown="dragStart"
@touchstart="dragStart"
ref="handler"
:style="handlerStyle"
>
<i :class="handlerIcon"></i>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'dragVerify',
props: {
isPassing: {
type: Boolean,
default: false,
},
width: {
type: Number,
default: 250,
},
height: {
type: Number,
default: 40,
},
text: {
type: String,
default: 'swiping to the right side',
},
successText: {
type: String,
default: 'success',
},
background: {
type: String,
default: '#eee',
},
progressBarBg: {
type: String,
default: '#76c61d',
},
completedBg: {
type: String,
default: '#76c61d',
},
circle: {
type: Boolean,
default: false,
},
radius: {
type: String,
default: '4px',
},
handlerIcon: {
type: String,
},
successIcon: {
type: String,
},
handlerBg: {
type: String,
default: '#fff',
},
textSize: {
type: String,
default: '14px',
},
textColor: {
type: String,
default: '#333',
},
imgsrc: {
type: String,
},
barWidth: {
type: Number,
default: 70,
},
barHeight: {
type: Number,
default: 40,
},
barRadius: {
type: Number,
default: 2,
},
showRefresh: {
type: Boolean,
default: false,
},
refreshIcon: {
type: String,
},
showTips: {
type: Boolean,
default: true,
},
successTip: {
type: String,
default: '验证通过超过80%用户',
},
failTip: {
type: String,
default: '验证未通过,拖动滑块将悬浮图像正确合并',
},
diffWidth: {
type: Number,
default: 20,
},
},
mounted: function () {
const dragEl = this.$refs.dragVerify;
dragEl.style.setProperty('--textColor', this.textColor);
dragEl.style.setProperty('--width', Math.floor(this.width / 2) + 'px');
dragEl.style.setProperty('--pwidth', -Math.floor(this.width / 2) + 'px');
},
computed: {
handlerStyle: function () {
return {
width: this.height + 'px',
height: this.height + 'px',
background: this.handlerBg,
};
},
message: function () {
return this.isPassing ? '' : this.text;
},
successMessage: function () {
return this.isPassing ? this.successText : '';
},
dragVerifyStyle: function () {
console.log(this.width, 'width');
return {
width: this.width + 'px',
height: this.height + 'px',
lineHeight: this.height + 'px',
background: this.background,
borderRadius: this.circle ? this.height / 2 + 'px' : this.radius,
};
},
dragVerifyImgStyle: function () {
return {
width: this.width + 'px',
position: 'relative',
overflow: 'hidden',
};
},
progressBarStyle: function () {
return {
background: this.progressBarBg,
height: this.height + 'px',
borderRadius: this.circle ? this.height / 2 + 'px 0 0 ' + this.height / 2 + 'px' : this.radius,
};
},
textStyle: function () {
return {
height: this.height + 'px',
width: this.width + 'px',
fontSize: this.textSize,
};
},
},
data() {
return {
isMoving: false,
x: 0,
isOk: false,
isKeep: false,
movebarStyle: {},
clipbarStyle: {},
showBar: false,
clipBarx: 0,
showErrorTip: false,
};
},
methods: {
checkimgLoaded: function () {
//生成图片缺失位置
var barWidth = this.barWidth;
var barHeight = this.barHeight;
var imgHeight = this.$refs.checkImg.height;
var halfWidth = Math.floor(this.width / 2);
var refreshHeigth = 25;
var tipHeight = 20;
var x = halfWidth + Math.ceil(Math.random() * (halfWidth - barWidth));
var y = refreshHeigth + Math.floor(Math.random() * (imgHeight - barHeight - refreshHeigth - tipHeight));
this.clipbarStyle = {
width: barWidth + 'px',
height: barHeight + 'px',
top: y + 'px',
left: x + 'px',
'border-radius': this.barRadius + 'px',
};
this.clipBarx = x;
var imgsrc = this.imgsrc;
var width = this.width;
this.movebarStyle = {
background: `url(${imgsrc})`,
'background-position': `-${x}px -${y}px`,
'background-size': `${width}px`,
width: barWidth + 'px',
height: barHeight + 'px',
top: y + 'px',
'border-radius': this.barRadius + 'px',
};
},
dragStart: function (e) {
if (!this.isPassing) {
this.isMoving = true;
this.x = e.pageX || e.touches[0].pageX;
}
this.showBar = true;
this.showErrorTip = false;
this.$emit('handlerMove');
},
dragMoving: function (e) {
if (this.isMoving && !this.isPassing) {
var _x = (e.pageX || e.touches[0].pageX) - this.x;
var handler = this.$refs.handler;
handler.style.left = _x + 'px';
this.$refs.progressBar.style.width = _x + this.height / 2 + 'px';
this.$refs.moveBar.style.left = _x + 'px';
}
},
dragFinish: function (e) {
if (this.isMoving && !this.isPassing) {
var _x = (e.pageX || e.changedTouches[0].pageX) - this.x;
if (Math.abs(_x - this.clipBarx) > this.diffWidth) {
this.isOk = true;
var that = this;
setTimeout(function () {
that.$refs.handler.style.left = '0';
that.$refs.progressBar.style.width = '0';
that.$refs.moveBar.style.left = '0';
that.isOk = false;
}, 500);
this.showErrorTip = true;
this.$emit('passfail');
} else {
this.passVerify();
}
this.isMoving = false;
}
},
passVerify: function () {
this.$emit('update:isPassing', true);
this.isMoving = false;
var handler = this.$refs.handler;
handler.children[0].className = this.successIcon;
this.$refs.progressBar.style.background = this.completedBg;
this.$refs.message.style['-webkit-text-fill-color'] = 'unset';
this.$refs.message.style.animation = 'slidetounlock2 3s infinite';
this.$refs.progressBar.style.color = '#fff';
this.$refs.progressBar.style.fontSize = this.textSize;
this.isKeep = true;
setTimeout(() => {
this.$refs.moveBar.style.left = this.clipBarx + 'px';
setTimeout(() => {
this.isKeep = false;
}, 200);
}, 100);
this.$emit('passcallback');
},
reset: function () {
this.reImg();
this.checkimgLoaded();
},
reImg: function () {
this.$emit('update:isPassing', false);
const oriData = this.$options.data();
for (const key in oriData) {
if (Object.prototype.hasOwnProperty.call(oriData, key)) {
this[key] = oriData[key];
}
}
var handler = this.$refs.handler;
var message = this.$refs.message;
handler.style.left = '0';
this.$refs.progressBar.style.width = '0';
handler.children[0].className = this.handlerIcon;
message.style['-webkit-text-fill-color'] = 'transparent';
message.style.animation = 'slidetounlock 3s infinite';
message.style.color = this.background;
},
refreshimg: function () {
this.$emit('refresh');
},
},
watch: {
imgsrc: {
immediate: false,
handler: function () {
this.reImg();
},
},
},
};
</script>
<style scoped>
.drag_verify {
position: relative;
background-color: #e8e8e8;
text-align: center;
overflow: hidden;
}
.drag_verify .dv_handler {
position: absolute;
top: 0px;
left: 0px;
cursor: move;
}
.drag_verify .dv_handler i {
color: #666;
padding-left: 0;
font-size: 16px;
}
.drag_verify .dv_handler .el-icon-circle-check {
color: #6c6;
margin-top: 9px;
}
.drag_verify .dv_progress_bar {
position: absolute;
height: 34px;
width: 0px;
}
.drag_verify .dv_text {
position: absolute;
top: 0px;
color: transparent;
-moz-user-select: none;
-webkit-user-select: none;
user-select: none;
-o-user-select: none;
-ms-user-select: none;
background: -webkit-gradient(
linear,
left top,
right top,
color-stop(0, var(--textColor)),
color-stop(0.4, var(--textColor)),
color-stop(0.5, #fff),
color-stop(0.6, var(--textColor)),
color-stop(1, var(--textColor))
);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
-webkit-text-size-adjust: none;
animation: slidetounlock 3s infinite;
}
.drag_verify .dv_text * {
-webkit-text-fill-color: var(--textColor);
}
.goFirst {
left: 0px !important;
transition: left 0.5s;
}
.goKeep {
transition: left 0.2s;
}
.goFirst2 {
width: 0px !important;
transition: width 0.5s;
}
.drag-verify-container {
position: relative;
line-height: 0;
}
.move-bar {
position: absolute;
z-index: 100;
}
.clip-bar {
position: absolute;
background: rgba(255, 255, 255, 0.8);
}
.refresh {
position: absolute;
right: 5px;
top: 5px;
cursor: pointer;
font-size: 20px;
z-index: 200;
}
.tips {
position: absolute;
bottom: 0;
height: 20px;
line-height: 20px;
text-align: center;
width: 100%;
font-size: 12px;
z-index: 200;
}
.tips.success {
background: rgba(255, 255, 255, 0.6);
color: green;
}
.tips.danger {
background: rgba(0, 0, 0, 0.6);
color: yellow;
}
</style>
<style>
@-webkit-keyframes slidetounlock {
0% {
background-position: var(--pwidth) 0;
}
100% {
background-position: var(--width) 0;
}
}
@-webkit-keyframes slidetounlock2 {
0% {
background-position: var(--pwidth) 0;
}
100% {
background-position: var(--pwidth) 0;
}
}
</style>

View File

@ -0,0 +1,473 @@
<template>
<div class="drag-verify-container">
<div :style="dragVerifyImgStyle">
<img ref="checkImg" crossOrigin="anonymous" :src="imgsrc" @load="checkimgLoaded" style="width: 100%" alt="" />
<canvas ref="maincanvas" class="main-canvas"></canvas>
<canvas ref="movecanvas" :class="{ goFirst: isOk, goKeep: isKeep }" class="move-canvas"></canvas>
<div class="refresh" v-if="showRefresh && !isPassing">
<i :class="refreshIcon" @click="refreshimg"></i>
</div>
<div class="tips success" v-if="showTips && isPassing">{{ successTip }}</div>
<div class="tips danger" v-if="showTips && !isPassing && showErrorTip">{{ failTip }}</div>
</div>
<div
ref="dragVerify"
class="drag_verify"
:style="dragVerifyStyle"
@mousemove="dragMoving"
@mouseup="dragFinish"
@mouseleave="dragFinish"
@touchmove="dragMoving"
@touchend="dragFinish"
>
<div class="dv_progress_bar" :class="{ goFirst2: isOk }" ref="progressBar" :style="progressBarStyle">
{{ successMessage }}
</div>
<div class="dv_text" :style="textStyle" ref="message">
{{ message }}
</div>
<div
class="dv_handler dv_handler_bg"
:class="{ goFirst: isOk }"
@mousedown="dragStart"
@touchstart="dragStart"
ref="handler"
:style="handlerStyle"
>
<i :class="handlerIcon"></i>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'dragVerifyImgChip',
props: {
isPassing: {
type: Boolean,
default: false,
},
width: {
type: Number,
default: 250,
},
height: {
type: Number,
default: 40,
},
text: {
type: String,
default: 'swiping to the right side',
},
successText: {
type: String,
default: 'success',
},
background: {
type: String,
default: '#eee',
},
progressBarBg: {
type: String,
default: '#76c61d',
},
completedBg: {
type: String,
default: '#76c61d',
},
circle: {
type: Boolean,
default: false,
},
radius: {
type: String,
default: '4px',
},
handlerIcon: {
type: String,
},
successIcon: {
type: String,
},
handlerBg: {
type: String,
default: '#fff',
},
textSize: {
type: String,
default: '14px',
},
textColor: {
type: String,
default: '#333',
},
imgsrc: {
type: String,
},
barWidth: {
type: Number,
default: 40,
},
barRadius: {
type: Number,
default: 8,
},
showRefresh: {
type: Boolean,
default: false,
},
refreshIcon: {
type: String,
},
showTips: {
type: Boolean,
default: true,
},
successTip: {
type: String,
default: '验证通过超过80%用户',
},
failTip: {
type: String,
default: '验证未通过,拖动滑块将悬浮图像正确合并',
},
diffWidth: {
type: Number,
default: 20,
},
},
mounted: function () {
const dragEl = this.$refs.dragVerify;
dragEl.style.setProperty('--textColor', this.textColor);
dragEl.style.setProperty('--width', Math.floor(this.width / 2) + 'px');
dragEl.style.setProperty('--pwidth', -Math.floor(this.width / 2) + 'px');
},
computed: {
handlerStyle: function () {
return {
width: this.height + 'px',
height: this.height + 'px',
background: this.handlerBg,
};
},
message: function () {
return this.isPassing ? '' : this.text;
},
successMessage: function () {
return this.isPassing ? this.successText : '';
},
dragVerifyStyle: function () {
return {
width: this.width + 'px',
height: this.height + 'px',
lineHeight: this.height + 'px',
background: this.background,
borderRadius: this.circle ? this.height / 2 + 'px' : this.radius,
};
},
dragVerifyImgStyle: function () {
return {
width: this.width + 'px',
position: 'relative',
overflow: 'hidden',
};
},
progressBarStyle: function () {
return {
background: this.progressBarBg,
height: this.height + 'px',
borderRadius: this.circle ? this.height / 2 + 'px 0 0 ' + this.height / 2 + 'px' : this.radius,
};
},
textStyle: function () {
return {
height: this.height + 'px',
width: this.width + 'px',
fontSize: this.textSize,
};
},
},
data() {
return {
isMoving: false,
x: 0,
isOk: false,
isKeep: false,
clipBarx: 0,
showErrorTip: false,
};
},
methods: {
draw: function (ctx, x, y, operation) {
var l = this.barWidth;
var r = this.barRadius;
const PI = Math.PI;
ctx.beginPath();
ctx.moveTo(x, y);
ctx.arc(x + l / 2, y - r + 2, r, 0.72 * PI, 2.26 * PI);
ctx.lineTo(x + l, y);
ctx.arc(x + l + r - 2, y + l / 2, r, 1.21 * PI, 2.78 * PI);
ctx.lineTo(x + l, y + l);
ctx.lineTo(x, y + l);
ctx.arc(x + r - 2, y + l / 2, r + 0.4, 2.76 * PI, 1.24 * PI, true);
ctx.lineTo(x, y);
ctx.lineWidth = 2;
ctx.fillStyle = 'rgba(255, 255, 255, 0.8)';
ctx.strokeStyle = 'rgba(255, 255, 255, 0.8)';
ctx.stroke();
ctx[operation]();
ctx.globalCompositeOperation = 'destination-over';
},
checkimgLoaded: function () {
// 生成图片缺失位置
var barWidth = this.barWidth;
var imgHeight = this.$refs.checkImg.height;
var imgWidth = this.$refs.checkImg.width;
var halfWidth = Math.floor(this.width / 2);
var refreshHeigth = 25;
var tipHeight = 20;
var x = halfWidth + Math.ceil(Math.random() * (halfWidth - barWidth - this.barRadius - 5));
var y = refreshHeigth + Math.floor(Math.random() * (imgHeight - barWidth - refreshHeigth - tipHeight));
this.$refs.maincanvas.setAttribute('width', imgWidth);
this.$refs.maincanvas.setAttribute('height', imgHeight);
this.$refs.maincanvas.style.display = 'block';
var canvasCtx = this.$refs.maincanvas.getContext('2d');
this.draw(canvasCtx, x, y, 'fill');
this.clipBarx = x;
var moveCanvas = this.$refs.movecanvas;
moveCanvas.setAttribute('width', imgWidth);
moveCanvas.setAttribute('height', imgHeight);
this.$refs.movecanvas.style.display = 'block';
const L = barWidth + this.barRadius * 2 + 3; //实际宽度
var moveCtx = this.$refs.movecanvas.getContext('2d');
moveCtx.clearRect(0, 0, imgWidth, imgHeight);
this.draw(moveCtx, x, y, 'clip');
moveCtx.drawImage(this.$refs.checkImg, 0, 0, imgWidth, imgHeight);
var y = y - this.barRadius * 2 - 1;
const ImageData = moveCtx.getImageData(x, y, L, L);
moveCanvas.setAttribute('width', L);
moveCanvas.setAttribute('height', imgHeight);
moveCtx.putImageData(ImageData, 0, y);
},
dragStart: function (e) {
if (!this.isPassing) {
this.isMoving = true;
this.x = e.pageX || e.touches[0].pageX;
}
this.showBar = true;
this.showErrorTip = false;
this.$emit('handlerMove');
},
dragMoving: function (e) {
if (this.isMoving && !this.isPassing) {
var _x = (e.pageX || e.touches[0].pageX) - this.x;
var handler = this.$refs.handler;
handler.style.left = _x + 'px';
this.$refs.progressBar.style.width = _x + this.height / 2 + 'px';
this.$refs.movecanvas.style.left = _x + 'px';
}
},
dragFinish: function (e) {
if (this.isMoving && !this.isPassing) {
var _x = (e.pageX || e.changedTouches[0].pageX) - this.x;
if (Math.abs(_x - this.clipBarx) > this.diffWidth) {
this.isOk = true;
var that = this;
setTimeout(function () {
that.$refs.handler.style.left = '0';
that.$refs.progressBar.style.width = '0';
that.$refs.movecanvas.style.left = '0';
that.isOk = false;
}, 500);
this.$emit('passfail');
this.showErrorTip = true;
} else {
this.passVerify();
}
this.isMoving = false;
}
},
passVerify: function () {
this.$emit('update:isPassing', true);
this.isMoving = false;
var handler = this.$refs.handler;
handler.children[0].className = this.successIcon;
this.$refs.progressBar.style.background = this.completedBg;
this.$refs.message.style['-webkit-text-fill-color'] = 'unset';
this.$refs.message.style.animation = 'slidetounlock2 3s infinite';
this.$refs.progressBar.style.color = '#fff';
this.$refs.progressBar.style.fontSize = this.textSize;
this.isKeep = true;
setTimeout(() => {
this.$refs.movecanvas.style.left = this.clipBarx + 'px';
setTimeout(() => {
this.isKeep = false;
this.$refs.maincanvas.style.display = 'none';
this.$refs.movecanvas.style.display = 'none';
}, 200);
}, 100);
this.$emit('passcallback');
},
reset: function () {
this.reImg();
this.checkimgLoaded();
},
reImg: function () {
this.$emit('update:isPassing', false);
const oriData = this.$options.data();
for (const key in oriData) {
if (Object.prototype.hasOwnProperty.call(oriData, key)) {
this[key] = oriData[key];
}
}
var handler = this.$refs.handler;
var message = this.$refs.message;
handler.style.left = '0';
this.$refs.progressBar.style.width = '0';
handler.children[0].className = this.handlerIcon;
message.style['-webkit-text-fill-color'] = 'transparent';
message.style.animation = 'slidetounlock 3s infinite';
message.style.color = this.background;
this.$refs.movecanvas.style.left = '0px';
},
refreshimg: function () {
this.$emit('refresh');
},
},
watch: {
imgsrc: {
immediate: false,
handler: function () {
this.reImg();
},
},
},
};
</script>
<style scoped>
.drag_verify {
position: relative;
background-color: #e8e8e8;
text-align: center;
overflow: hidden;
}
.drag_verify .dv_handler {
position: absolute;
top: 0px;
left: 0px;
cursor: move;
}
.drag_verify .dv_handler i {
color: #666;
padding-left: 0;
font-size: 16px;
}
.drag_verify .dv_handler .el-icon-circle-check {
color: #6c6;
margin-top: 9px;
}
.drag_verify .dv_progress_bar {
position: absolute;
height: 34px;
width: 0px;
}
.drag_verify .dv_text {
position: absolute;
top: 0px;
color: transparent;
-moz-user-select: none;
-webkit-user-select: none;
user-select: none;
-o-user-select: none;
-ms-user-select: none;
background: -webkit-gradient(
linear,
left top,
right top,
color-stop(0, var(--textColor)),
color-stop(0.4, var(--textColor)),
color-stop(0.5, #fff),
color-stop(0.6, var(--textColor)),
color-stop(1, var(--textColor))
);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
-webkit-text-size-adjust: none;
animation: slidetounlock 3s infinite;
}
.drag_verify .dv_text * {
-webkit-text-fill-color: var(--textColor);
}
.goFirst {
left: 0px !important;
transition: left 0.5s;
}
.goKeep {
transition: left 0.2s;
}
.goFirst2 {
width: 0px !important;
transition: width 0.5s;
}
.drag-verify-container {
position: relative;
line-height: 0;
}
.refresh {
position: absolute;
right: 5px;
top: 5px;
cursor: pointer;
font-size: 20px;
z-index: 200;
}
.tips {
position: absolute;
bottom: 0;
height: 20px;
line-height: 20px;
text-align: center;
width: 100%;
font-size: 12px;
z-index: 200;
}
.tips.success {
background: rgba(255, 255, 255, 0.6);
color: green;
}
.tips.danger {
background: rgba(0, 0, 0, 0.6);
color: yellow;
}
.main-canvas {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}
.move-canvas {
position: absolute;
top: 0;
left: 0;
}
</style>
<style>
@-webkit-keyframes slidetounlock {
0% {
background-position: var(--pwidth) 0;
}
100% {
background-position: var(--width) 0;
}
}
@-webkit-keyframes slidetounlock2 {
0% {
background-position: var(--pwidth) 0;
}
100% {
background-position: var(--pwidth) 0;
}
}
</style>

View File

@ -0,0 +1,434 @@
<template>
<div class="drag-verify-container">
<div :style="dragVerifyImgStyle">
<img ref="checkImg" :src="imgsrc" class="check-img" :class="{ goOrigin: isOk }" @load="checkimgLoaded" :style="imgStyle" alt="" />
<div class="tips success" v-if="showTips && isPassing">{{ successTip }}</div>
<div class="tips danger" v-if="showTips && !isPassing && showErrorTip">{{ failTip }}</div>
</div>
<div
ref="dragVerify"
class="drag_verify"
:style="dragVerifyStyle"
@mousemove="dragMoving"
@mouseup="dragFinish"
@mouseleave="dragFinish"
@touchmove="dragMoving"
@touchend="dragFinish"
>
<div class="dv_progress_bar" :class="{ goFirst2: isOk }" ref="progressBar" :style="progressBarStyle">
{{ successMessage }}
</div>
<div class="dv_text" :style="textStyle" ref="message">
{{ message }}
</div>
<div
class="dv_handler dv_handler_bg"
:class="{ goFirst: isOk }"
@mousedown="dragStart"
@touchstart="dragStart"
ref="handler"
:style="handlerStyle"
>
<i :class="handlerIcon"></i>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'dragVerify',
props: {
isPassing: {
type: Boolean,
default: false,
},
width: {
type: Number,
default: 250,
},
height: {
type: Number,
default: 40,
},
text: {
type: String,
default: 'swiping to the right side',
},
successText: {
type: String,
default: 'success',
},
background: {
type: String,
default: '#eee',
},
progressBarBg: {
type: String,
default: '#76c61d',
},
completedBg: {
type: String,
default: '#76c61d',
},
circle: {
type: Boolean,
default: false,
},
radius: {
type: String,
default: '4px',
},
handlerIcon: {
type: String,
},
successIcon: {
type: String,
},
handlerBg: {
type: String,
default: '#fff',
},
textSize: {
type: String,
default: '14px',
},
textColor: {
type: String,
default: '#333',
},
imgsrc: {
type: String,
},
showTips: {
type: Boolean,
default: true,
},
successTip: {
type: String,
default: '验证通过',
},
failTip: {
type: String,
default: '验证失败',
},
diffDegree: {
type: Number,
default: 10,
},
minDegree: {
type: Number,
default: 90,
},
maxDegree: {
type: Number,
default: 270,
},
},
mounted: function () {
const dragEl = this.$refs.dragVerify;
dragEl.style.setProperty('--textColor', this.textColor);
dragEl.style.setProperty('--width', Math.floor(this.width / 2) + 'px');
dragEl.style.setProperty('--pwidth', -Math.floor(this.width / 2) + 'px');
},
computed: {
handlerStyle: function () {
return {
width: this.height + 'px',
height: this.height + 'px',
background: this.handlerBg,
};
},
message: function () {
return this.isPassing ? '' : this.text;
},
successMessage: function () {
return this.isPassing ? this.successText : '';
},
dragVerifyStyle: function () {
return {
width: this.width + 'px',
height: this.height + 'px',
lineHeight: this.height + 'px',
background: this.background,
borderRadius: this.circle ? this.height / 2 + 'px' : this.radius,
};
},
dragVerifyImgStyle: function () {
return {
width: this.width + 'px',
height: this.width + 'px',
position: 'relative',
overflow: 'hidden',
'border-radius': '50%',
};
},
progressBarStyle: function () {
return {
background: this.progressBarBg,
height: this.height + 'px',
borderRadius: this.circle ? this.height / 2 + 'px 0 0 ' + this.height / 2 + 'px' : this.radius,
};
},
textStyle: function () {
return {
height: this.height + 'px',
width: this.width + 'px',
fontSize: this.textSize,
};
},
factor: function () {
//避免指定旋转角度时一直拖动到最右侧才验证通过
if (this.minDegree == this.maxDegree) {
return Math.floor(1 + Math.random() * 6) / 10 + 1;
}
return 1;
},
},
data() {
return {
isMoving: false,
x: 0,
isOk: false,
showBar: false,
showErrorTip: false,
ranRotate: 0,
cRotate: 0,
imgStyle: {},
};
},
methods: {
checkimgLoaded: function () {
//生成旋转角度
var minDegree = this.minDegree;
var maxDegree = this.maxDegree;
var ranRotate = Math.floor(minDegree + Math.random() * (maxDegree - minDegree)); //生成随机角度
this.ranRotate = ranRotate;
console.log('旋转' + ranRotate);
this.imgStyle = {
transform: `rotateZ(${ranRotate}deg)`,
};
},
dragStart: function (e) {
if (!this.isPassing) {
this.isMoving = true;
this.x = e.pageX || e.touches[0].pageX;
}
this.showBar = true;
this.showErrorTip = false;
this.$emit('handlerMove');
},
dragMoving: function (e) {
if (this.isMoving && !this.isPassing) {
var _x = (e.pageX || e.touches[0].pageX) - this.x;
console.log(_x, '_x');
var handler = this.$refs.handler;
handler.style.left = _x + 'px';
this.$refs.progressBar.style.width = _x + this.height / 2 + 'px';
var cRotate = Math.ceil((_x / (this.width - this.height)) * this.maxDegree * this.factor);
console.log(cRotate, 'cRotate');
this.cRotate = cRotate;
var rotate = this.ranRotate - cRotate;
this.imgStyle = {
transform: `rotateZ(${rotate}deg)`,
};
}
},
dragFinish: function (e) {
if (this.isMoving && !this.isPassing) {
if (Math.abs(this.ranRotate - this.cRotate) > this.diffDegree) {
this.isOk = true;
this.imgStyle = {
transform: `rotateZ(${this.ranRotate}deg)`,
};
var that = this;
setTimeout(function () {
that.$refs.handler.style.left = '0';
that.$refs.progressBar.style.width = '0';
that.isOk = false;
}, 500);
this.showErrorTip = true;
this.$emit('passfail');
} else {
this.passVerify();
}
this.isMoving = false;
}
},
passVerify: function () {
this.$emit('update:isPassing', true);
this.isMoving = false;
var handler = this.$refs.handler;
handler.children[0].className = this.successIcon;
this.$refs.progressBar.style.background = this.completedBg;
this.$refs.message.style['-webkit-text-fill-color'] = 'unset';
this.$refs.message.style.animation = 'slidetounlock2 3s infinite';
this.$refs.progressBar.style.color = '#fff';
this.$refs.progressBar.style.fontSize = this.textSize;
this.$emit('passcallback');
},
reset: function () {
this.reImg();
this.checkimgLoaded();
},
reImg: function () {
this.$emit('update:isPassing', false);
const oriData = this.$options.data();
for (const key in oriData) {
if (Object.prototype.hasOwnProperty.call(oriData, key)) {
this[key] = oriData[key];
}
}
var handler = this.$refs.handler;
var message = this.$refs.message;
handler.style.left = '0';
this.$refs.progressBar.style.width = '0';
handler.children[0].className = this.handlerIcon;
message.style['-webkit-text-fill-color'] = 'transparent';
message.style.animation = 'slidetounlock 3s infinite';
message.style.color = this.background;
},
refreshimg: function () {
this.$emit('refresh');
},
},
watch: {
imgsrc: {
immediate: false,
handler: function () {
this.reImg();
},
},
},
};
</script>
<style scoped>
.drag_verify {
position: relative;
background-color: #e8e8e8;
text-align: center;
overflow: hidden;
}
.drag_verify .dv_handler {
position: absolute;
top: 0px;
left: 0px;
cursor: move;
}
.drag_verify .dv_handler i {
color: #666;
padding-left: 0;
font-size: 16px;
}
.drag_verify .dv_handler .el-icon-circle-check {
color: #6c6;
margin-top: 9px;
}
.drag_verify .dv_progress_bar {
position: absolute;
height: 34px;
width: 0px;
}
.drag_verify .dv_text {
position: absolute;
top: 0px;
color: transparent;
-moz-user-select: none;
-webkit-user-select: none;
user-select: none;
-o-user-select: none;
-ms-user-select: none;
background: -webkit-gradient(
linear,
left top,
right top,
color-stop(0, var(--textColor)),
color-stop(0.4, var(--textColor)),
color-stop(0.5, #fff),
color-stop(0.6, var(--textColor)),
color-stop(1, var(--textColor))
);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
-webkit-text-size-adjust: none;
animation: slidetounlock 3s infinite;
}
.drag_verify .dv_text * {
-webkit-text-fill-color: var(--textColor);
}
.goFirst {
left: 0px !important;
transition: left 0.5s;
}
.goOrigin {
transition: transform 0.5s;
}
.goKeep {
transition: left 0.2s;
}
.goFirst2 {
width: 0px !important;
transition: width 0.5s;
}
.drag-verify-container {
position: relative;
line-height: 0;
border-radius: 50%;
}
.move-bar {
position: absolute;
z-index: 100;
}
.clip-bar {
position: absolute;
background: rgba(255, 255, 255, 0.8);
}
.refresh {
position: absolute;
right: 5px;
top: 5px;
cursor: pointer;
font-size: 20px;
z-index: 200;
}
.tips {
position: absolute;
bottom: 25px;
height: 20px;
line-height: 20px;
text-align: center;
width: 100%;
font-size: 12px;
z-index: 200;
}
.tips.success {
background: rgba(255, 255, 255, 0.6);
color: green;
}
.tips.danger {
background: rgba(0, 0, 0, 0.6);
color: yellow;
}
.check-img {
width: 100%;
border-radius: 50%;
}
</style>
<style>
@-webkit-keyframes slidetounlock {
0% {
background-position: var(--pwidth) 0;
}
100% {
background-position: var(--width) 0;
}
}
@-webkit-keyframes slidetounlock2 {
0% {
background-position: var(--pwidth) 0;
}
100% {
background-position: var(--pwidth) 0;
}
}
</style>

View File

@ -0,0 +1,59 @@
<template>
<div class="editor-container">
<div :id="id"></div>
</div>
</template>
<script lang="ts">
import { toRefs, reactive, onMounted } from 'vue';
import wangeditor from 'wangeditor';
export default {
name: 'wngEditor',
props: {
// 节点 id
id: {
type: String,
default: () => 'wangeditor',
},
// 是否禁用
isDisable: {
type: Boolean,
default: () => false,
},
// 双向绑定
// 双向绑定值,字段名为固定,改了之后将不生效
// 参考https://v3.cn.vuejs.org/guide/migration/v-model.html#%E8%BF%81%E7%A7%BB%E7%AD%96%E7%95%A5
modelValue: String,
},
setup(props, { emit }) {
const state = reactive({
editor: null,
});
// 初始化富文本
// https://doc.wangeditor.com/
const initWangeditor = () => {
state.editor = new wangeditor('#wangeditor');
state.editor.config.placeholder = '请输入内容';
state.editor.config.uploadImgShowBase64 = true;
state.editor.config.showLinkImg = false;
onWangeditorChange();
state.editor.create();
state.editor.txt.html(props.modelValue);
props.isDisable ? state.editor.disable() : state.editor.enable();
};
// 内容改变时
const onWangeditorChange = () => {
state.editor.config.onchange = (html: string) => {
emit('update:modelValue', html);
};
};
// 页面加载时
onMounted(() => {
initWangeditor();
});
return {
...toRefs(state),
};
},
};
</script>

View File

@ -26,7 +26,7 @@ import pagesFormI18nZhtw from '/@/i18n/pages/formI18n/zh-tw';
*/
const messages = {
[zhcnLocale.name]: {
el: zhcnLocale.el,
...zhcnLocale,
message: {
...nextZhcn,
...pagesHomeZhcn,
@ -35,7 +35,7 @@ const messages = {
},
},
[enLocale.name]: {
el: enLocale.el,
...enLocale,
message: {
...nextEn,
...pagesHomeEn,
@ -44,7 +44,7 @@ const messages = {
},
},
[zhtwLocale.name]: {
el: zhtwLocale.el,
...zhtwLocale,
message: {
...nextZhtw,
...pagesHomeZhtw,

View File

@ -34,6 +34,7 @@ export default {
funScreenShort: 'screenCapture',
funGridLayout: 'Drag layout',
funSplitpanes: 'Pane splitter',
funDragVerify: 'Validator',
pagesIndex: 'pages',
pagesFiltering: 'Filtering',
pagesFilteringDetails: 'FilteringDetails',
@ -44,6 +45,9 @@ export default {
pagesCityLinkage: 'CityLinkage',
pagesFormAdapt: 'FormAdapt',
pagesFormI18n: 'FormI18n',
pagesFormRules: 'Multi form validation',
pagesDynamicForm: 'Dynamic complex form',
pagesWorkflow: 'Workflow',
pagesListAdapt: 'ListAdapt',
pagesWaterfall: 'Waterfall',
pagesSteps: 'Steps',
@ -107,6 +111,7 @@ export default {
closeOther: 'closeOther',
closeAll: 'closeAll',
fullscreen: 'fullscreen',
closeFullscreen: 'closeFullscreen',
},
notFound: {
foundTitle: 'Wrong address input, please re-enter the address~',
@ -147,9 +152,11 @@ export default {
fourIsTagsviewIcon: 'Open tagsview Icon',
fourIsCacheTagsView: 'Enable tagsview cache',
fourIsSortableTagsView: 'Enable tagsview drag',
fourIsShareTagsView: 'Enable tagsview sharing',
fourIsFooter: 'Open footer',
fourIsGrayscale: 'Grey model',
fourIsInvert: 'Color weak mode',
fourIsDark: 'Dark Mode',
fourIsWartermark: 'Turn on watermark',
fourWartermarkText: 'Watermark copy',
fiveTitle: 'Other settings',
@ -164,6 +171,7 @@ export default {
sixColumns: 'Four',
tipText: 'Click the button below to copy the layout configuration to `/src/store/modules/themeConfig.ts` It has been modified in.',
copyText: 'replication configuration',
resetText: 'restore default',
copyTextSuccess: 'Copy succeeded!',
copyTextError: 'Copy failed!',
},

View File

@ -34,6 +34,7 @@ export default {
funScreenShort: 'web端自定义截屏',
funGridLayout: '拖拽布局',
funSplitpanes: '窗格拆分器',
funDragVerify: '验证器',
pagesIndex: '页面',
pagesFiltering: '过滤筛选组件',
pagesFilteringDetails: '过滤筛选组件详情',
@ -44,6 +45,9 @@ export default {
pagesCityLinkage: '城市多级联动',
pagesFormAdapt: '表单自适应',
pagesFormI18n: '表单国际化',
pagesFormRules: '多表单验证',
pagesDynamicForm: '动态复杂表单',
pagesWorkflow: '工作流',
pagesListAdapt: '列表自适应',
pagesWaterfall: '瀑布屏',
pagesSteps: '步骤条',
@ -107,6 +111,7 @@ export default {
closeOther: '关闭其它',
closeAll: '全部关闭',
fullscreen: '当前页全屏',
closeFullscreen: '关闭全屏',
},
notFound: {
foundTitle: '地址输入错误,请重新输入地址~',
@ -147,9 +152,11 @@ export default {
fourIsTagsviewIcon: '开启 Tagsview 图标',
fourIsCacheTagsView: '开启 TagsView 缓存',
fourIsSortableTagsView: '开启 TagsView 拖拽',
fourIsShareTagsView: '开启 TagsView 共用',
fourIsFooter: '开启 Footer',
fourIsGrayscale: '灰色模式',
fourIsInvert: '色弱模式',
fourIsDark: '深色模式',
fourIsWartermark: '开启水印',
fourWartermarkText: '水印文案',
fiveTitle: '其它设置',
@ -164,6 +171,7 @@ export default {
sixColumns: '分栏',
tipText: '点击下方按钮,复制布局配置去 `src/store/modules/themeConfig.ts` 中修改。',
copyText: '一键复制配置',
resetText: '一键恢复默认',
copyTextSuccess: '复制成功!',
copyTextError: '复制失败!',
},

View File

@ -34,6 +34,7 @@ export default {
funScreenShort: '自定義截圖',
funGridLayout: '拖拽佈局',
funSplitpanes: '窗格折開器',
funDragVerify: '驗證器',
pagesIndex: '頁面',
pagesFiltering: '過濾篩選組件',
pagesFilteringDetails: '過濾篩選組件詳情',
@ -44,6 +45,9 @@ export default {
pagesCityLinkage: '都市多級聯動',
pagesFormAdapt: '表單自我調整',
pagesFormI18n: '表單國際化',
pagesFormRules: '多表單驗證',
pagesDynamicForm: '動態複雜表單',
pagesWorkflow: '工作流',
pagesListAdapt: '清單自我調整',
pagesWaterfall: '瀑布屏',
pagesSteps: '步驟條',
@ -107,6 +111,7 @@ export default {
closeOther: '關閉其它',
closeAll: '全部關閉',
fullscreen: '當前頁全屏',
closeFullscreen: '關閉全屏',
},
notFound: {
foundTitle: '地址輸入錯誤,請重新輸入地址~',
@ -147,9 +152,11 @@ export default {
fourIsTagsviewIcon: '開啟 Tagsview 圖標',
fourIsCacheTagsView: '開啟 TagsView 緩存',
fourIsSortableTagsView: '開啟 TagsView 拖拽',
fourIsShareTagsView: '開啟 TagsView 共用',
fourIsFooter: '開啟 Footer',
fourIsGrayscale: '灰色模式',
fourIsInvert: '色弱模式',
fourIsDark: '深色模式',
fourIsWartermark: '開啟浮水印',
fourWartermarkText: '浮水印文案',
fiveTitle: '其它設定',
@ -164,6 +171,7 @@ export default {
sixColumns: '分欄',
tipText: '點擊下方按鈕,複製佈局配寘去`src/store/modules/themeConfig.ts`中修改。',
copyText: '一鍵複製配寘',
resetText: '一鍵恢復默認',
copyTextSuccess: '複製成功!',
copyTextError: '複製失敗!',
},

View File

@ -1,18 +1,12 @@
<template>
<el-aside class="layout-aside" :class="setCollapseWidth" v-if="clientWidth > 1000">
<Logo v-if="setShowLogo" />
<el-scrollbar class="flex-auto" ref="layoutAsideScrollbarRef">
<Vertical :menuList="menuList" :class="setCollapseWidth" />
</el-scrollbar>
</el-aside>
<el-drawer v-model="getThemeConfig.isCollapse" :with-header="false" direction="ltr" size="220px" v-else>
<el-aside class="layout-aside w100 h100">
<div class="h100" v-show="!isTagsViewCurrenFull">
<el-aside class="layout-aside" :class="setCollapseStyle">
<Logo v-if="setShowLogo" />
<el-scrollbar class="flex-auto" ref="layoutAsideScrollbarRef">
<el-scrollbar class="flex-auto" ref="layoutAsideScrollbarRef" @mouseenter="onAsideEnterLeave(true)" @mouseleave="onAsideEnterLeave(false)">
<Vertical :menuList="menuList" />
</el-scrollbar>
</el-aside>
</el-drawer>
</div>
</template>
<script lang="ts">
@ -34,26 +28,56 @@ export default {
const getThemeConfig = computed(() => {
return store.state.themeConfig.themeConfig;
});
// 获取卡片全屏信息
const isTagsViewCurrenFull = computed(() => {
return store.state.tagsViewRoutes.isTagsViewCurrenFull;
});
// 设置菜单展开/收起时的宽度
const setCollapseWidth = computed(() => {
let { layout, isCollapse, menuBar } = store.state.themeConfig.themeConfig;
let asideBrColor = menuBar === '#FFFFFF' || menuBar === '#FFF' || menuBar === '#fff' || menuBar === '#ffffff' ? 'layout-el-aside-br-color' : '';
if (layout === 'columns') {
// 分栏布局,菜单收起时宽度给 1px
const setCollapseStyle = computed(() => {
const { layout, isCollapse, menuBar } = store.state.themeConfig.themeConfig;
const asideBrColor =
menuBar === '#FFFFFF' || menuBar === '#FFF' || menuBar === '#fff' || menuBar === '#ffffff' ? 'layout-el-aside-br-color' : '';
// 判断是否是手机端
if (state.clientWidth <= 1000) {
if (isCollapse) {
return ['layout-aside-width1', asideBrColor];
document.body.setAttribute('class', 'el-popup-parent--hidden');
const asideEle = document.querySelector('.layout-container') as HTMLElement;
const modeDivs = document.createElement('div');
modeDivs.setAttribute('class', 'layout-aside-mobile-mode');
asideEle.appendChild(modeDivs);
modeDivs.addEventListener('click', closeLayoutAsideMobileMode);
return [asideBrColor, 'layout-aside-mobile', 'layout-aside-mobile-open'];
} else {
return ['layout-aside-width-default', asideBrColor];
// 关闭弹窗
closeLayoutAsideMobileMode();
return [asideBrColor, 'layout-aside-mobile', 'layout-aside-mobile-close'];
}
} else {
// 其它布局给 64px
if (isCollapse) {
return ['layout-aside-width64', asideBrColor];
if (layout === 'columns') {
// 分栏布局,菜单收起时宽度给 1px
if (isCollapse) {
return [asideBrColor, 'layout-aside-pc-1'];
} else {
return [asideBrColor, 'layout-aside-pc-220'];
}
} else {
return ['layout-aside-width-default', asideBrColor];
// 其它布局给 64px
if (isCollapse) {
return [asideBrColor, 'layout-aside-pc-64'];
} else {
return [asideBrColor, 'layout-aside-pc-220'];
}
}
}
});
// 关闭移动端蒙版
const closeLayoutAsideMobileMode = () => {
const el = document.querySelector('.layout-aside-mobile-mode');
el && el.parentNode?.removeChild(el);
const clientWidth = document.body.clientWidth;
if (clientWidth < 1000) store.state.themeConfig.themeConfig.isCollapse = false;
document.body.setAttribute('class', '');
};
// 设置显示/隐藏 logo
const setShowLogo = computed(() => {
let { layout, isShowLogo } = store.state.themeConfig.themeConfig;
@ -78,6 +102,13 @@ export default {
const initMenuFixed = (clientWidth: number) => {
state.clientWidth = clientWidth;
};
// 鼠标移入、移出
const onAsideEnterLeave = (bool: Boolean) => {
let { layout } = store.state.themeConfig.themeConfig;
if (layout !== 'columns') return false;
if (!bool) proxy.mittBus.emit('restoreDefault');
store.dispatch('routesList/setColumnsMenuHover', bool);
};
// 监听 themeConfig 配置文件的变化,更新菜单 el-scrollbar 的高度
watch(store.state.themeConfig.themeConfig, (val) => {
if (val.isShowLogoChange !== val.isShowLogo) {
@ -112,12 +143,15 @@ export default {
});
proxy.mittBus.on('layoutMobileResize', (res: any) => {
initMenuFixed(res.clientWidth);
closeLayoutAsideMobileMode();
});
});
return {
setCollapseWidth,
setCollapseStyle,
setShowLogo,
getThemeConfig,
isTagsViewCurrenFull,
onAsideEnterLeave,
...toRefs(state),
};
},

View File

@ -1,17 +1,18 @@
<template>
<div class="layout-columns-aside">
<el-scrollbar>
<ul>
<ul @mouseleave="onColumnsAsideMenuMouseleave()">
<li
v-for="(v, k) in columnsAsideList"
:key="k"
@click="onColumnsAsideMenuClick(v, k)"
@mouseenter="onColumnsAsideMenuMouseenter(v, k)"
:ref="
(el) => {
if (el) columnsAsideOffsetTopRefs[k] = el;
}
"
:class="{ 'layout-columns-active': liIndex === k }"
:class="{ 'layout-columns-active': liIndex === k, 'layout-columns-hover': liHoverIndex === k }"
:title="$t(v.meta.title)"
>
<div :class="setColumnsAsidelayout" v-if="!v.meta.isLink || (v.meta.isLink && v.meta.isIframe)">
@ -44,7 +45,7 @@
</template>
<script lang="ts">
import { reactive, toRefs, ref, computed, onMounted, nextTick, getCurrentInstance, watch } from 'vue';
import { reactive, toRefs, ref, computed, onMounted, nextTick, getCurrentInstance, watch, onUnmounted } from 'vue';
import { useRoute, useRouter, onBeforeRouteUpdate } from 'vue-router';
import { useStore } from '/@/store/index';
export default {
@ -59,8 +60,12 @@ export default {
const state: any = reactive({
columnsAsideList: [],
liIndex: 0,
liOldIndex: null,
liHoverIndex: null,
liOldPath: null,
difference: 0,
routeSplit: [],
isNavHover: false,
});
// 设置分栏高亮风格
const setColumnsAsideStyle = computed(() => {
@ -82,6 +87,27 @@ export default {
if (redirect) router.push(redirect);
else router.push(path);
};
// 鼠标移入时,显示当前的子级菜单
const onColumnsAsideMenuMouseenter = (v: Object, k: number) => {
let { path } = v;
state.liOldPath = path;
state.liOldIndex = k;
state.liHoverIndex = k;
proxy.mittBus.emit('setSendColumnsChildren', setSendChildren(path));
store.dispatch('routesList/setColumnsMenuHover', false);
store.dispatch('routesList/setColumnsNavHover', true);
state.isNavHover = true;
};
// 鼠标移走时,显示原来的子级菜单
const onColumnsAsideMenuMouseleave = async () => {
await store.dispatch('routesList/setColumnsNavHover', false);
// 添加延时器,防止拿到的 store.state.routesList 值不是最新的
setTimeout(() => {
const { isColumnsMenuHover, isColumnsNavHover } = store.state.routesList;
if (!isColumnsMenuHover && !isColumnsNavHover) proxy.mittBus.emit('restoreDefault');
}, 100);
// state.isNavHover = false;
};
// 设置高亮动态位置
const onColumnsAsideDown = (k: number) => {
nextTick(() => {
@ -135,10 +161,27 @@ export default {
// 监听布局配置信息的变化,动态增加菜单高亮位置移动像素
watch(store.state, (val) => {
val.themeConfig.themeConfig.columnsAsideStyle === 'columnsRound' ? (state.difference = 3) : (state.difference = 0);
if (!val.routesList.isColumnsMenuHover && !val.routesList.isColumnsNavHover) {
state.liHoverIndex = null;
proxy.mittBus.emit('setSendColumnsChildren', setSendChildren(route.path));
} else {
state.liHoverIndex = state.liOldIndex;
if (!state.liOldPath) return false;
proxy.mittBus.emit('setSendColumnsChildren', setSendChildren(state.liOldPath));
}
});
// 页面加载时
onMounted(() => {
setFilterRoutes();
// 销毁变量,防止鼠标再次移入时,保留了上次的记录
proxy.mittBus.on('restoreDefault', () => {
state.liOldIndex = null;
state.liOldPath = null;
});
});
// 页面卸载时
onUnmounted(() => {
proxy.mittBus.off('restoreDefault', () => {});
});
// 路由更新时
onBeforeRouteUpdate((to) => {
@ -152,6 +195,8 @@ export default {
setColumnsAsideStyle,
setColumnsAsidelayout,
onColumnsAsideMenuClick,
onColumnsAsideMenuMouseenter,
onColumnsAsideMenuMouseleave,
...toRefs(state),
};
},
@ -202,12 +247,18 @@ export default {
}
}
.layout-columns-active {
color: #ffffff;
color: var(--color-whites) !important;
transition: 0.3s ease-in-out;
}
.layout-columns-hover {
color: var(--color-primary);
a {
color: var(--color-primary);
}
}
.columns-round {
background: var(--color-primary);
color: #ffffff;
color: var(--color-whites);
position: absolute;
left: 50%;
top: 2px;

View File

@ -1,5 +1,5 @@
<template>
<el-header class="layout-header" :height="setHeaderHeight">
<el-header class="layout-header" :height="setHeaderHeight" v-show="!isTagsViewCurrenFull">
<NavBarsIndex />
</el-header>
</template>
@ -19,8 +19,13 @@ export default {
if (isTagsview && layout !== 'classic') return '84px';
else return '50px';
});
// 获取卡片全屏信息
const isTagsViewCurrenFull = computed(() => {
return store.state.tagsViewRoutes.isTagsViewCurrenFull;
});
return {
setHeaderHeight,
isTagsViewCurrenFull,
};
},
};

View File

@ -4,7 +4,7 @@
class="layout-scrollbar"
ref="layoutScrollbarRef"
:style="{
minHeight: `calc(100vh - ${headerHeight}`,
minHeight: `calc(100vh - ${headerHeight})`,
padding: currentRouteMeta.isLink && currentRouteMeta.isIframe ? 0 : '',
transition: 'padding 0.3s ease-in-out',
}"

View File

@ -36,7 +36,7 @@ export default {
display: flex;
&-warp {
margin: auto;
color: #9e9e9e;
color: var(--el-text-color-secondary);
text-align: center;
animation: logoAnimation 0.3s ease-in-out;
}

View File

@ -144,7 +144,7 @@ export default defineComponent({
const initLockScreen = () => {
if (store.state.themeConfig.themeConfig.isLockScreen) {
state.isShowLockScreenIntervalTime = window.setInterval(() => {
if (store.state.themeConfig.themeConfig.lockScreenTime <= 0) {
if (store.state.themeConfig.themeConfig.lockScreenTime <= 1) {
state.isShowLockScreen = true;
setLocalThemeConfig();
return false;
@ -198,12 +198,10 @@ export default defineComponent({
height: 100%;
}
.layout-lock-screen-filter {
filter: blur(5px);
transform: scale(1.01);
transition: all 0.1s 0.1s ease-in-out;
filter: blur(1px);
}
.layout-lock-screen-mask {
background: rgba(255, 255, 255, 1);
background: var(--el-color-white);
@extend .layout-lock-screen-fixed;
z-index: 9999990;
}
@ -222,7 +220,7 @@ export default defineComponent({
top: 0;
width: 100%;
height: 100%;
color: #ffffff;
color: var(--el-color-white);
z-index: 9999993;
user-select: none;
&-box {
@ -231,9 +229,11 @@ export default defineComponent({
bottom: 50px;
&-time {
font-size: 100px;
color: var(--color-whites);
}
&-info {
font-size: 40px;
color: var(--color-whites);
}
&-minutes {
font-size: 16px;
@ -244,9 +244,9 @@ export default defineComponent({
height: 40px;
line-height: 40px;
border-radius: 100%;
border: 1px solid rgba(255, 255, 255, 0.3);
border: 1px solid var(--el-border-color-light, #ebeef5);
background: rgba(255, 255, 255, 0.1);
color: #ffffff;
color: var(--color-whites);
opacity: 0.8;
position: absolute;
right: 30px;
@ -262,7 +262,7 @@ export default defineComponent({
position: absolute;
top: 150%;
font-size: 12px;
color: #ffffff;
color: var(--color-whites);
left: 50%;
line-height: 1.2;
transform: translate(-50%, -50%);
@ -273,7 +273,7 @@ export default defineComponent({
border: 1px solid rgba(255, 255, 255, 0.5);
background: rgba(255, 255, 255, 0.2);
box-shadow: 0 0 12px 0 rgba(255, 255, 255, 0.5);
color: #ffffff;
color: var(--color-whites);
opacity: 1;
transition: all 0.3s ease;
i {
@ -298,7 +298,7 @@ export default defineComponent({
display: flex;
flex-direction: column;
justify-content: center;
color: #ffffff;
color: var(--color-whites);
&-box {
text-align: center;
margin: auto;
@ -334,13 +334,13 @@ export default defineComponent({
}
}
::v-deep(.el-input-group__append) {
background: #ffffff;
background: var(--el-color-white);
padding: 0px 15px;
}
::v-deep(.el-input__inner) {
border-right-color: #f6f6f6;
border-right-color: var(--el-border-color-extra-light);
&:hover {
border-color: #f6f6f6;
border-color: var(--el-border-color-extra-light);
}
}
</style>

View File

@ -3,9 +3,9 @@
<ColumnsAside />
<div class="layout-columns-warp">
<Aside />
<el-container class="flex-center layout-backtop">
<el-container class="flex-center layout-backtop" :class="{ 'layout-backtop': !isFixedHeader }">
<Header v-if="isFixedHeader" />
<el-scrollbar>
<el-scrollbar :class="{ 'layout-backtop': isFixedHeader }">
<Header v-if="!isFixedHeader" />
<Main />
</el-scrollbar>

View File

@ -1,9 +1,9 @@
<template>
<el-container class="layout-container">
<Aside />
<el-container class="flex-center layout-backtop">
<el-container class="flex-center" :class="{ 'layout-backtop': !isFixedHeader }">
<Header v-if="isFixedHeader" />
<el-scrollbar ref="layoutDefaultsScrollbarRef">
<el-scrollbar ref="layoutDefaultsScrollbarRef" :class="{ 'layout-backtop': isFixedHeader }">
<Header v-if="!isFixedHeader" />
<Main />
</el-scrollbar>
@ -23,7 +23,7 @@ export default {
name: 'layoutDefaults',
components: { Aside, Header, Main },
setup() {
const { proxy } = getCurrentInstance();
const { proxy } = getCurrentInstance() as any;
const store = useStore();
const route = useRoute();
const isFixedHeader = computed(() => {

View File

@ -0,0 +1,65 @@
<template>
<div class="layout-navbars-close-full" v-if="isTagsViewCurrenFull">
<div class="layout-navbars-close-full-box" :title="$t('message.tagsView.closeFullscreen')" @click="onCloseFullscreen">
<i class="el-icon-close"></i>
</div>
</div>
</template>
<script lang="ts">
import { toRefs, reactive, computed } from 'vue';
import { useStore } from '/@/store/index';
export default {
name: 'layoutCloseFull',
setup() {
const store = useStore();
const state: any = reactive({});
// 获取卡片全屏信息
const isTagsViewCurrenFull = computed(() => {
return store.state.tagsViewRoutes.isTagsViewCurrenFull;
});
// 关闭当前全屏
const onCloseFullscreen = () => {
store.dispatch('tagsViewRoutes/setCurrenFullscreen', false);
};
return {
isTagsViewCurrenFull,
onCloseFullscreen,
...toRefs(state),
};
},
};
</script>
<style scoped lang="scss">
.layout-navbars-close-full {
position: fixed;
z-index: 9999999999;
right: -30px;
top: -30px;
.layout-navbars-close-full-box {
width: 60px;
height: 60px;
border-radius: 100%;
position: relative;
cursor: pointer;
background: rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
i {
position: absolute;
left: 11px;
top: 35px;
color: #333333;
transition: all 0.3s ease;
}
&:hover {
background: rgba(0, 0, 0, 0.2);
transition: all 0.3s ease;
i {
color: var(--color-primary);
transition: all 0.3s ease;
}
}
}
}
</style>

View File

@ -109,7 +109,6 @@ export default {
align-items: center;
padding-right: 15px;
background: var(--bg-topBar);
overflow: hidden;
border-bottom: 1px solid #f1f2f3;
}
</style>

View File

@ -146,7 +146,7 @@
<el-input-number
v-model="getThemeConfig.lockScreenTime"
controls-position="right"
:min="0"
:min="1"
:max="9999"
@change="setLocalThemeConfig"
size="mini"
@ -207,6 +207,12 @@
<el-switch v-model="getThemeConfig.isSortableTagsView" @change="onSortableTagsViewChange"></el-switch>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex mt15">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fourIsShareTagsView') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-switch v-model="getThemeConfig.isShareTagsView" @change="onShareTagsViewChange"></el-switch>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex mt15">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fourIsFooter') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
@ -225,6 +231,12 @@
<el-switch v-model="getThemeConfig.isInvert" @change="onAddFilterChange('invert')"></el-switch>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex mt15">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fourIsDark') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-switch v-model="getThemeConfig.isIsDark" @change="onAddDarkChange"></el-switch>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex mt15">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fourIsWartermark') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
@ -270,7 +282,7 @@
</el-select>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex mt15 mb28">
<div class="layout-breadcrumb-seting-bar-flex mt15 mb27">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fiveColumnsAsideLayout') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-select v-model="getThemeConfig.columnsAsideLayout" placeholder="请选择" size="mini" style="width: 90px" @change="setLocalThemeConfig">
@ -359,6 +371,9 @@
@click="onCopyConfigClick"
>{{ $t('message.layout.copyText') }}
</el-button>
<el-button size="small" class="copy-config-btn-reset" icon="el-icon-refresh-right" type="info" @click="onResetConfigClick"
>{{ $t('message.layout.resetText') }}
</el-button>
</div>
</el-scrollbar>
</el-drawer>
@ -476,6 +491,11 @@ export default defineComponent({
proxy.mittBus.emit('openOrCloseSortable');
setLocalThemeConfig();
};
// 4、界面显示 --> 开启 TagsView 共用
const onShareTagsViewChange = () => {
proxy.mittBus.emit('openShareTagsView');
setLocalThemeConfig();
};
// 4、界面显示 --> 灰色模式/色弱模式
const onAddFilterChange = (attr: string) => {
if (attr === 'grayscale') {
@ -489,6 +509,12 @@ export default defineComponent({
appEle.setAttribute('style', `filter: ${cssAttr}`);
setLocalThemeConfig();
};
// 4、界面显示 --> 深色模式
const onAddDarkChange = () => {
const body = document.documentElement as HTMLElement;
if (getThemeConfig.value.isIsDark) body.setAttribute('data-theme', 'dark');
else body.setAttribute('data-theme', '');
};
// 4、界面显示 --> 开启水印
const onWartermarkChange = () => {
getThemeConfig.value.isWartermark ? Watermark.set(getThemeConfig.value.wartermarkText) : Watermark.del();
@ -507,38 +533,9 @@ export default defineComponent({
if (getThemeConfig.value.layout === layout) return false;
getThemeConfig.value.layout = layout;
getThemeConfig.value.isDrawer = false;
initSetLayoutChange();
initLayoutChangeFun();
onMenuBarHighlightChange();
};
// 设置布局切换,重置主题样式
const initSetLayoutChange = () => {
if (getThemeConfig.value.layout === 'classic') {
getThemeConfig.value.menuBar = '#FFFFFF';
getThemeConfig.value.menuBarColor = '#606266';
getThemeConfig.value.topBar = '#ffffff';
getThemeConfig.value.topBarColor = '#606266';
initLayoutChangeFun();
} else if (getThemeConfig.value.layout === 'transverse') {
getThemeConfig.value.menuBarColor = '#FFFFFF';
getThemeConfig.value.topBar = '#545c64';
getThemeConfig.value.topBarColor = '#FFFFFF';
initLayoutChangeFun();
} else if (getThemeConfig.value.layout === 'columns') {
// 1.0.11 更新日志
getThemeConfig.value.isShowLogo = false;
getThemeConfig.value.menuBar = '#FFFFFF';
getThemeConfig.value.menuBarColor = '#606266';
getThemeConfig.value.topBar = '#ffffff';
getThemeConfig.value.topBarColor = '#606266';
initLayoutChangeFun();
} else {
getThemeConfig.value.menuBar = '#545c64';
getThemeConfig.value.menuBarColor = '#eaeaea';
getThemeConfig.value.topBar = '#FFFFFF';
getThemeConfig.value.topBarColor = '#606266';
initLayoutChangeFun();
}
};
// 设置布局切换函数
const initLayoutChangeFun = () => {
onBgColorPickerChange('menuBar');
@ -579,6 +576,11 @@ export default defineComponent({
getThemeConfig.value.isDrawer = false;
});
};
// 一键恢复默认
const onResetConfigClick = () => {
Local.clear();
window.location.reload();
};
// 修复防止退出登录再进入界面时,需要刷新样式才生效的问题,初始化布局样式等(登录的时候触发,目前方案)
const initSetStyle = () => {
setTimeout(() => {
@ -595,7 +597,7 @@ export default defineComponent({
onMounted(() => {
nextTick(() => {
// 判断当前布局是否不相同不相同则初始化当前布局的样式防止监听窗口大小改变时布局配置logo、菜单背景等部分布局失效问题
if (!Local.get('frequency')) initSetLayoutChange();
if (!Local.get('frequency')) initLayoutChangeFun();
Local.set('frequency', 1);
// 修复防止退出登录再进入界面时,需要刷新样式才生效的问题,初始化布局样式等(登录的时候触发,目前方案)
proxy.mittBus.on('onSignInClick', () => {
@ -607,10 +609,9 @@ export default defineComponent({
});
// 监听窗口大小改变,非默认布局,设置成默认布局(适配移动端)
proxy.mittBus.on('layoutMobileResize', (res: any) => {
if (getThemeConfig.value.layout === res.layout) return false;
getThemeConfig.value.layout = res.layout;
getThemeConfig.value.isDrawer = false;
initSetLayoutChange();
initLayoutChangeFun();
onMenuBarHighlightChange();
});
setTimeout(() => {
@ -620,6 +621,8 @@ export default defineComponent({
if (getThemeConfig.value.isGrayscale) onAddFilterChange('grayscale');
// 色弱模式
if (getThemeConfig.value.isInvert) onAddFilterChange('invert');
// 深色模式
if (getThemeConfig.value.isIsDark) onAddDarkChange();
// 开启水印
onWartermarkChange();
// 语言国际化
@ -647,6 +650,7 @@ export default defineComponent({
getThemeConfig,
onDrawerClose,
onAddFilterChange,
onAddDarkChange,
onWartermarkChange,
onWartermarkTextInput,
onSetLayout,
@ -654,7 +658,9 @@ export default defineComponent({
onClassicSplitMenuChange,
onIsBreadcrumbChange,
onSortableTagsViewChange,
onShareTagsViewChange,
onCopyConfigClick,
onResetConfigClick,
};
},
});
@ -791,7 +797,8 @@ export default defineComponent({
width: 100%;
margin-top: 15px;
}
.copy-config-last-btn {
.copy-config-btn-reset {
width: 100%;
margin: 10px 0 0;
}
}

View File

@ -194,17 +194,24 @@ export default {
initI18n();
title();
};
// 设置 element plus 组件的国际化
const setI18nConfig = (locale: string) => {
proxy.mittBus.emit('getI18nConfig', proxy.$i18n.messages[locale]);
};
// 初始化言语国际化
const initI18n = () => {
switch (Local.get('themeConfig').globalI18n) {
case 'zh-cn':
state.disabledI18n = 'zh-cn';
setI18nConfig('zh-cn');
break;
case 'en':
state.disabledI18n = 'en';
setI18nConfig('en');
break;
case 'zh-tw':
state.disabledI18n = 'zh-tw';
setI18nConfig('zh-tw');
break;
}
};

View File

@ -11,7 +11,14 @@
>
<ul class="el-dropdown-menu">
<template v-for="(v, k) in dropdownList">
<li class="el-dropdown-menu__item" aria-disabled="false" tabindex="-1" :key="k" v-if="!v.affix" @click="onCurrentContextmenuClick(v.id)">
<li
class="el-dropdown-menu__item"
aria-disabled="false"
tabindex="-1"
:key="k"
v-if="!v.affix"
@click="onCurrentContextmenuClick(v.contextMenuClickId)"
>
<i :class="v.icon"></i>
<span>{{ $t(v.txt) }}</span>
</li>
@ -35,30 +42,30 @@ export default defineComponent({
const state = reactive({
isShow: false,
dropdownList: [
{ id: 0, txt: 'message.tagsView.refresh', affix: false, icon: 'el-icon-refresh-right' },
{ id: 1, txt: 'message.tagsView.close', affix: false, icon: 'el-icon-close' },
{ id: 2, txt: 'message.tagsView.closeOther', affix: false, icon: 'el-icon-circle-close' },
{ id: 3, txt: 'message.tagsView.closeAll', affix: false, icon: 'el-icon-folder-delete' },
{ contextMenuClickId: 0, txt: 'message.tagsView.refresh', affix: false, icon: 'el-icon-refresh-right' },
{ contextMenuClickId: 1, txt: 'message.tagsView.close', affix: false, icon: 'el-icon-close' },
{ contextMenuClickId: 2, txt: 'message.tagsView.closeOther', affix: false, icon: 'el-icon-circle-close' },
{ contextMenuClickId: 3, txt: 'message.tagsView.closeAll', affix: false, icon: 'el-icon-folder-delete' },
{
id: 4,
contextMenuClickId: 4,
txt: 'message.tagsView.fullscreen',
affix: false,
icon: 'iconfont icon-fullscreen',
},
],
path: {},
item: {},
});
// 父级传过来的坐标 x,y 值
const dropdowns = computed(() => {
return props.dropdown;
});
// 当前项菜单点击
const onCurrentContextmenuClick = (id: number) => {
emit('currentContextmenuClick', { id, path: state.path });
const onCurrentContextmenuClick = (contextMenuClickId: number) => {
emit('currentContextmenuClick', Object.assign({}, { contextMenuClickId }, state.item));
};
// 打开右键菜单:判断是否固定,固定则不显示关闭按钮
const openContextmenu = (item: any) => {
state.path = item.path;
state.item = item;
item.meta.isAffix ? (state.dropdownList[1].affix = true) : (state.dropdownList[1].affix = false);
closeContextmenu();
setTimeout(() => {

View File

@ -7,7 +7,7 @@
:key="k"
class="layout-navbars-tagsview-ul-li"
:data-name="v.name"
:class="{ 'is-active': isActive(v.path) }"
:class="{ 'is-active': isActive(v) }"
@contextmenu.prevent="onContextmenu(v, $event)"
@click="onTagsClick(v, k)"
:ref="
@ -16,21 +16,21 @@
}
"
>
<i class="iconfont icon-webicon318 layout-navbars-tagsview-ul-li-iconfont font14" v-if="isActive(v.path)"></i>
<i class="layout-navbars-tagsview-ul-li-iconfont" :class="v.meta.icon" v-if="!isActive(v.path) && getThemeConfig.isTagsviewIcon"></i>
<i class="iconfont icon-webicon318 layout-navbars-tagsview-ul-li-iconfont font14" v-if="isActive(v)"></i>
<i class="layout-navbars-tagsview-ul-li-iconfont" :class="v.meta.icon" v-if="!isActive(v) && getThemeConfig.isTagsviewIcon"></i>
<span>{{ $t(v.meta.title) }}</span>
<template v-if="isActive(v.path)">
<i class="el-icon-refresh-right ml5" @click.stop="refreshCurrentTagsView(v.path)"></i>
<template v-if="isActive(v)">
<i class="el-icon-refresh-right ml5" @click.stop="refreshCurrentTagsView($route.fullPath)"></i>
<i
class="el-icon-close layout-navbars-tagsview-ul-li-icon layout-icon-active"
v-if="!v.meta.isAffix"
@click.stop="closeCurrentTagsView(v.path)"
@click.stop="closeCurrentTagsView(getThemeConfig.isShareTagsView ? v.path : v.url)"
></i>
</template>
<i
class="el-icon-close layout-navbars-tagsview-ul-li-icon layout-icon-three"
v-if="!v.meta.isAffix"
@click.stop="closeCurrentTagsView(v.path)"
@click.stop="closeCurrentTagsView(getThemeConfig.isShareTagsView ? v.path : v.url)"
></i>
</li>
</ul>
@ -42,10 +42,11 @@
<script lang="ts">
import { toRefs, reactive, onMounted, computed, ref, nextTick, onBeforeUpdate, onBeforeMount, onUnmounted, getCurrentInstance, watch } from 'vue';
import { useRoute, useRouter, onBeforeRouteUpdate } from 'vue-router';
import screenfull from 'screenfull';
import Sortable from 'sortablejs';
import { ElMessage } from 'element-plus';
import { useStore } from '/@/store/index';
import { Session } from '/@/utils/storage';
import Sortable from 'sortablejs';
import { isObjectValueEqual } from '/@/utils/arrayOperation';
import Contextmenu from '/@/layout/navBars/tagsView/contextmenu.vue';
export default {
name: 'layoutTagsView',
@ -60,6 +61,7 @@ export default {
const route = useRoute();
const router = useRouter();
const state: any = reactive({
routeActive: '',
routePath: route.path,
dropdown: { x: '', y: '' },
tagsRefsIndex: 0,
@ -75,73 +77,133 @@ export default {
const getThemeConfig = computed(() => {
return store.state.themeConfig.themeConfig;
});
// 设置 tagsView 高亮
const isActive = (v) => {
if (getThemeConfig.value.isShareTagsView) {
return v.path === state.routePath;
} else {
return v.url === state.routeActive;
}
};
// 存储 tagsViewList 到浏览器临时缓存中,页面刷新时,保留记录
const addBrowserSetSession = (tagsViewList: Array<object>) => {
Session.set('tagsViewList', tagsViewList);
};
// 获取 vuex 中的 tagsViewRoutes 列表
const getTagsViewRoutes = () => {
state.routePath = route.meta.isDynamic ? route.meta.isDynamicPath : route.path;
const getTagsViewRoutes = async () => {
state.routeActive = await setTagsViewHighlight(route);
state.routePath = (await route.meta.isDynamic) ? route.meta.isDynamicPath : route.path;
state.tagsViewList = [];
if (!store.state.themeConfig.themeConfig.isCacheTagsView) Session.remove('tagsViewList');
state.tagsViewRoutesList = store.state.tagsViewRoutes.tagsViewRoutes;
initTagsView();
};
// vuex 中获取路由信息如果是设置了固定的isAffix进行初始化显示
const initTagsView = () => {
if (Session.get('tagsViewList') && store.state.themeConfig.themeConfig.isCacheTagsView) {
state.tagsViewList = Session.get('tagsViewList');
const initTagsView = async () => {
if (Session.get('tagsViewList') && getThemeConfig.value.isCacheTagsView) {
state.tagsViewList = await Session.get('tagsViewList');
} else {
state.tagsViewRoutesList.map((v: any) => {
if (v.meta.isAffix && !v.meta.isHide) state.tagsViewList.push({ ...v });
await state.tagsViewRoutesList.map((v: any) => {
if (v.meta.isAffix && !v.meta.isHide) {
v.url = setTagsViewHighlight(v);
state.tagsViewList.push({ ...v });
}
});
addTagsView(route.path, route);
await addTagsView(route.path, route);
}
// 初始化当前元素(li)的下标
getTagsRefsIndex(route.path);
// 添加初始化横向滚动条移动到对应位置
tagsViewmoveToCurrentTag();
getTagsRefsIndex(getThemeConfig.value.isShareTagsView ? state.routePath : state.routeActive);
};
// 1、添加 tagsView未设置隐藏isHide也添加到在 tagsView 中
const addTagsView = (path: string, to?: any) => {
// 修复https://gitee.com/lyt-top/vue-next-admin/issues/I3YX6G
let item = '';
if (to && to.meta.isDynamic) {
if (state.tagsViewList.some((v: any) => v.path === to.meta.isDynamicPath)) return false;
item = state.tagsViewRoutesList.find((v: any) => v.path === to.meta.isDynamicPath);
} else {
if (state.tagsViewList.some((v: any) => v.path === path)) return false;
item = state.tagsViewRoutesList.find((v: any) => v.path === path);
// 处理可开启多标签详情单标签详情动态路由xxx/:id/:name"),普通路由处理)
const solveAddTagsView = async (path: string, to?: any) => {
let isDynamicPath = to.meta.isDynamic ? to.meta.isDynamicPath : path;
let current = state.tagsViewList.filter(
(v: any) =>
v.path === isDynamicPath &&
isObjectValueEqual(
to.meta.isDynamic ? (v.params ? v.params : null) : v.query ? v.query : null,
to.meta.isDynamic ? (to?.params ? to?.params : null) : to?.query ? to?.query : null
)
);
if (current.length <= 0) {
// 防止Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.
let findItem = state.tagsViewRoutesList.find((v: any) => v.path === isDynamicPath);
if (findItem.meta.isAffix) return false;
if (findItem.meta.isLink && !findItem.meta.isIframe) return false;
to.meta.isDynamic ? (findItem.params = to.params) : (findItem.query = to.query);
findItem.url = setTagsViewHighlight(findItem);
state.tagsViewList.push({ ...findItem });
addBrowserSetSession(state.tagsViewList);
}
if (item.meta.isLink && !item.meta.isIframe) return false;
if (to && to.meta.isDynamic) item.params = to?.params ? to?.params : route.params;
else item.query = to?.query ? to?.query : route.query;
state.tagsViewList.push({ ...item });
addBrowserSetSession(state.tagsViewList);
};
// 处理单标签时,第二次的值未覆盖第一次的 tagsViewList 值Session Storage
const singleAddTagsView = (path: string, to?: any) => {
let isDynamicPath = to.meta.isDynamic ? to.meta.isDynamicPath : path;
state.tagsViewList.forEach((v) => {
if (
v.path === isDynamicPath &&
!isObjectValueEqual(
to.meta.isDynamic ? (v.params ? v.params : null) : v.query ? v.query : null,
to.meta.isDynamic ? (to?.params ? to?.params : null) : to?.query ? to?.query : null
)
) {
to.meta.isDynamic ? (v.params = to.params) : (v.query = to.query);
v.url = setTagsViewHighlight(v);
addBrowserSetSession(state.tagsViewList);
}
});
};
// 1、添加 tagsView未设置隐藏isHide也添加到在 tagsView 中(可开启多标签详情,单标签详情)
const addTagsView = (path: string, to?: any) => {
// 防止拿取不到路由信息
nextTick(async () => {
// 修复https://gitee.com/lyt-top/vue-next-admin/issues/I3YX6G
let item = '';
if (to && to.meta.isDynamic) {
// 动态路由xxx/:id/:name"):参数不同,开启多个 tagsview
if (!getThemeConfig.value.isShareTagsView) await solveAddTagsView(path, to);
else await singleAddTagsView(path, to);
if (state.tagsViewList.some((v: any) => v.path === to.meta.isDynamicPath)) return false;
item = state.tagsViewRoutesList.find((v: any) => v.path === to.meta.isDynamicPath);
} else {
// 普通路由:参数不同,开启多个 tagsview
if (!getThemeConfig.value.isShareTagsView) await solveAddTagsView(path, to);
else await singleAddTagsView(path, to);
if (state.tagsViewList.some((v: any) => v.path === path)) return false;
item = state.tagsViewRoutesList.find((v: any) => v.path === path);
}
if (item.meta.isLink && !item.meta.isIframe) return false;
if (to && to.meta.isDynamic) item.params = to?.params ? to?.params : route.params;
else item.query = to?.query ? to?.query : route.query;
item.url = setTagsViewHighlight(item);
await state.tagsViewList.push({ ...item });
await addBrowserSetSession(state.tagsViewList);
});
};
// 2、刷新当前 tagsView
const refreshCurrentTagsView = (path: string) => {
proxy.mittBus.emit('onTagsViewRefreshRouterView', path);
const refreshCurrentTagsView = (fullPath: string) => {
proxy.mittBus.emit('onTagsViewRefreshRouterView', fullPath);
};
// 3、关闭当前 tagsView如果是设置了固定的isAffix不可以关闭
const closeCurrentTagsView = (path: string) => {
state.tagsViewList.map((v: any, k: number, arr: any) => {
if (!v.meta.isAffix) {
if (v.path === path) {
if (getThemeConfig.value.isShareTagsView ? v.path === path : v.url === path) {
state.tagsViewList.splice(k, 1);
setTimeout(() => {
if (state.tagsViewList.length === k && state.routePath === path) {
if (state.tagsViewList.length === k && getThemeConfig.value.isShareTagsView ? state.routePath === path : state.routeActive === path) {
// 最后一个且高亮时
if (arr[arr.length - 1].meta.isDynamic) {
// 动态路由xxx/:id/:name"
router.push({ name: arr[arr.length - 1].name, params: arr[arr.length - 1].params });
if (k !== arr.length) router.push({ name: arr[k].name, params: arr[k].params });
else router.push({ name: arr[arr.length - 1].name, params: arr[arr.length - 1].params });
} else {
// 普通路由
router.push({ path: arr[arr.length - 1].path, query: arr[arr.length - 1].query });
if (k !== arr.length) router.push({ path: arr[k].path, query: arr[k].query });
else router.push({ path: arr[arr.length - 1].path, query: arr[arr.length - 1].query });
}
} else {
// 非最后一个且高亮时,跳转到下一个
if (state.tagsViewList.length !== k && state.routePath === path) {
if (state.tagsViewList.length !== k && getThemeConfig.value.isShareTagsView ? state.routePath === path : state.routeActive === path) {
if (arr[k].meta.isDynamic) {
// 动态路由xxx/:id/:name"
router.push({ name: arr[k].name, params: arr[k].params });
@ -166,61 +228,73 @@ export default {
addTagsView(path, route);
};
// 5、关闭全部 tagsView如果是设置了固定的isAffix不进行关闭
const closeAllTagsView = (path: string) => {
const closeAllTagsView = () => {
state.tagsViewList = [];
state.tagsViewRoutesList.map((v: any) => {
if (v.meta.isAffix && !v.meta.isHide) {
state.tagsViewList.push({ ...v });
if (state.tagsViewList.some((v: any) => v.path === path)) router.push({ path, query: route.query });
else router.push({ path: v.path, query: route.query });
router.push({ path: state.tagsViewList[state.tagsViewList.length - 1].path });
}
});
addBrowserSetSession(state.tagsViewList);
};
// 6、开启当前页面全屏
const openCurrenFullscreen = (path: string) => {
const item = state.tagsViewList.find((v: any) => v.path === path);
nextTick(() => {
router.push({ path, query: item.query });
const element = document.querySelector('.layout-main');
const screenfulls: any = screenfull;
screenfulls.request(element);
});
const openCurrenFullscreen = async (path: string) => {
const item = state.tagsViewList.find((v: any) => (getThemeConfig.value.isShareTagsView ? v.path === path : v.url === path));
if (item.meta.isDynamic) await router.push({ name: item.name, params: item.params });
else await router.push({ name: item.name, query: item.query });
store.dispatch('tagsViewRoutes/setCurrenFullscreen', true);
};
// 当前项右键菜单点击,拿当前点击的路由路径对比 浏览器缓存中的 tagsView 路由数组,取当前点击项的详细路由信息
const getCurrentRouteItem = (path: string) => {
return Session.get('tagsViewList').find((v: any) => v.path === path);
// 防止 tagsView 非当前页演示时,操作异常
const getCurrentRouteItem = (path: string, cParams: { [key: string]: any }) => {
const itemRoute = Session.get('tagsViewList') ? Session.get('tagsViewList') : state.tagsViewList;
return itemRoute.find((v: any) => {
if (
v.path === path &&
isObjectValueEqual(
v.meta.isDynamic ? (v.params ? v.params : null) : v.query ? v.query : null,
cParams && Object.keys(cParams ? cParams : {}).length > 0 ? cParams : null
)
) {
return v;
} else if (v.path === path && Object.keys(cParams ? cParams : {}).length <= 0) {
return v;
}
});
};
// 当前项右键菜单点击
const onCurrentContextmenuClick = (item) => {
const { id, path } = item;
const { meta, name, params, query } = getCurrentRouteItem(path);
switch (id) {
const onCurrentContextmenuClick = async (item) => {
const cParams = item.meta.isDynamic ? item.params : item.query;
if (!getCurrentRouteItem(item.path, cParams)) return ElMessage({ type: 'warning', message: '请正确输入路径及完整参数query、params' });
const { path, name, params, query, meta, url } = getCurrentRouteItem(item.path, cParams);
switch (item.contextMenuClickId) {
case 0:
refreshCurrentTagsView(path);
if (meta.isDynamic) router.push({ name, params });
else router.push({ path, query });
// 刷新当前
if (meta.isDynamic) await router.push({ name, params });
else await router.push({ path, query });
refreshCurrentTagsView(route.fullPath);
break;
case 1:
closeCurrentTagsView(path);
// 关闭当前
closeCurrentTagsView(getThemeConfig.value.isShareTagsView ? path : url);
break;
case 2:
if (meta.isDynamic) router.push({ name, params });
else router.push({ path, query });
// 关闭其它
if (meta.isDynamic) await router.push({ name, params });
else await router.push({ path, query });
closeOtherTagsView(path);
break;
case 3:
closeAllTagsView(path);
// 关闭全部
closeAllTagsView();
break;
case 4:
openCurrenFullscreen(path);
// 开启当前页面全屏
openCurrenFullscreen(getThemeConfig.value.isShareTagsView ? path : url);
break;
}
};
// 判断页面高亮修复https://gitee.com/lyt-top/vue-next-admin/issues/I3YX6G
const isActive = (path: string) => {
return path === state.routePath;
};
// 右键点击时:传 x,y 坐标值到子组件中props
const onContextmenu = (v: any, e: any) => {
const { clientX, clientY } = e;
@ -230,10 +304,20 @@ export default {
};
// 当前的 tagsView 项点击时
const onTagsClick = (v: any, k: number) => {
state.routePath = v.path;
state.tagsRefsIndex = k;
router.push(v);
};
// 处理 tagsView 高亮(多标签详情时使用,单标签详情未使用)
const setTagsViewHighlight = (v: any) => {
let params = v.query && Object.keys(v.query).length > 0 ? v.query : v.params;
if (!params || Object.keys(params).length <= 0) return v.path;
let path = '';
for (let i in params) {
path += params[i];
}
// 判断是否是动态路由xxx/:id/:name"
return `${v.meta.isDynamic ? v.meta.isDynamicPath : v.path}-${path}`;
};
// 更新滚动条显示
const updateScrollbar = () => {
proxy.$refs.scrollbarRef.update();
@ -296,9 +380,19 @@ export default {
};
// 获取 tagsView 的下标:用于处理 tagsView 点击时的横向滚动
const getTagsRefsIndex = (path: string) => {
if (state.tagsViewList.length > 0) {
state.tagsRefsIndex = state.tagsViewList.findIndex((item: any) => item.path === path);
}
nextTick(async () => {
// await 使用该写法,防止拿取不到 tagsViewList 列表数据不完整
let tagsViewList = await state.tagsViewList;
state.tagsRefsIndex = tagsViewList.findIndex((v: any) => {
if (getThemeConfig.value.isShareTagsView) {
return v.path === path;
} else {
return v.url === path;
}
});
// 添加初始化横向滚动条移动到对应位置
tagsViewmoveToCurrentTag();
});
};
// 设置 tagsView 可以进行拖拽
const initSortable = () => {
@ -327,11 +421,6 @@ export default {
else getThemeConfig.value.isSortableTagsView = true;
initSortable();
};
// 监听路由的变化,动态赋值给 tagsView
watch(store.state, (val) => {
if (val.tagsViewRoutes.tagsViewRoutes.length === state.tagsViewRoutesList.length) return false;
getTagsViewRoutes();
});
// 页面加载前
onBeforeMount(() => {
// 初始化,防止手机端直接访问时还可以拖拽
@ -346,6 +435,19 @@ export default {
proxy.mittBus.on('openOrCloseSortable', () => {
initSortable();
});
// 监听布局配置开启 TagsView 共用,为了演示还原默认值
proxy.mittBus.on('openShareTagsView', () => {
if (getThemeConfig.value.isShareTagsView) {
router.push('/home');
state.tagsViewList = [];
state.tagsViewRoutesList.map((v: any) => {
if (v.meta.isAffix && !v.meta.isHide) {
v.url = setTagsViewHighlight(v);
state.tagsViewList.push({ ...v });
}
});
}
});
});
// 页面卸载时
onUnmounted(() => {
@ -353,6 +455,8 @@ export default {
proxy.mittBus.off('onCurrentContextmenuClick');
// 取消监听布局配置界面开启/关闭拖拽
proxy.mittBus.off('openOrCloseSortable');
// 取消监听布局配置开启 TagsView 共用
proxy.mittBus.off('openShareTagsView');
// 取消窗口 resize 监听
window.removeEventListener('resize', onSortableResize);
});
@ -367,11 +471,16 @@ export default {
initSortable();
});
// 路由更新时
onBeforeRouteUpdate((to) => {
onBeforeRouteUpdate(async (to) => {
state.routeActive = setTagsViewHighlight(to);
state.routePath = to.meta.isDynamic ? to.meta.isDynamicPath : to.path;
addTagsView(to.path, to);
getTagsRefsIndex(to.path);
tagsViewmoveToCurrentTag();
await addTagsView(to.path, to);
getTagsRefsIndex(getThemeConfig.value.isShareTagsView ? state.routePath : state.routeActive);
});
// 监听路由的变化,动态赋值给 tagsView
watch(store.state, (val) => {
if (val.tagsViewRoutes.tagsViewRoutes.length === state.tagsViewRoutesList.length) return false;
getTagsViewRoutes();
});
return {
isActive,
@ -396,9 +505,10 @@ export default {
<style scoped lang="scss">
.layout-navbars-tagsview {
flex: 1;
background-color: #ffffff;
background-color: var(--el-color-white);
border-bottom: 1px solid #f1f2f3;
z-index: 1;
position: relative;
::v-deep(.el-scrollbar__wrap) {
overflow-x: auto !important;
}
@ -409,7 +519,7 @@ export default {
height: 34px;
display: flex;
align-items: center;
color: #606266;
color: var(--el-text-color-regular);
font-size: 12px;
white-space: nowrap;
padding: 0 15px;
@ -445,7 +555,7 @@ export default {
line-height: 14px;
right: -5px;
&:hover {
color: #fff;
color: var(--color-whites);
background-color: var(--color-primary-light-3);
}
}
@ -457,9 +567,10 @@ export default {
}
}
.is-active {
color: #ffffff;
color: var(--color-whites);
background: var(--color-primary);
border-color: var(--color-primary);
transition: border-color 3s ease;
}
}
// 风格2
@ -508,7 +619,7 @@ export default {
}
}
.is-active {
background: white !important;
background: var(--el-color-white) !important;
color: var(--color-primary) !important;
border-top: 1px solid !important;
border-top-color: var(--color-primary) !important;

View File

@ -3,13 +3,13 @@
<el-scrollbar @wheel.native.prevent="onElMenuHorizontalScroll" ref="elMenuHorizontalScrollRef">
<el-menu router :default-active="defaultActive" background-color="transparent" mode="horizontal">
<template v-for="val in menuLists">
<el-submenu :index="val.path" v-if="val.children && val.children.length > 0" :key="val.path">
<el-sub-menu :index="val.path" v-if="val.children && val.children.length > 0" :key="val.path">
<template #title>
<i :class="val.meta.icon ? val.meta.icon : ''"></i>
<span>{{ $t(val.meta.title) }}</span>
</template>
<SubItem :chil="val.children" />
</el-submenu>
</el-sub-menu>
<el-menu-item :index="val.path" :key="val.path" v-else>
<template #title v-if="!val.meta.isLink || (val.meta.isLink && val.meta.isIframe)">
<i :class="val.meta.icon ? val.meta.icon : ''"></i>
@ -29,7 +29,7 @@
</template>
<script lang="ts">
import { toRefs, reactive, computed, defineComponent, getCurrentInstance, onMounted, nextTick } from 'vue';
import { toRefs, reactive, computed, defineComponent, getCurrentInstance, onMounted, nextTick, onBeforeMount } from 'vue';
import { useRoute, onBeforeRouteUpdate } from 'vue-router';
import { useStore } from '/@/store/index';
import SubItem from '/@/layout/navMenu/subItem.vue';
@ -46,7 +46,7 @@ export default defineComponent({
const { proxy } = getCurrentInstance() as any;
const route = useRoute();
const store = useStore();
const state: any = reactive({
const state = reactive({
defaultActive: null,
});
// 获取父级菜单数据
@ -66,15 +66,6 @@ export default defineComponent({
proxy.$refs.elMenuHorizontalScrollRef.$refs.wrap.scrollLeft = els.offsetLeft;
});
};
// 设置页面当前路由高亮
const setCurrentRouterHighlight = (path: string) => {
const currentPathSplit = path.split('/');
if (store.state.themeConfig.themeConfig.layout === 'classic') {
state.defaultActive = `/${currentPathSplit[1]}`;
} else {
state.defaultActive = path;
}
};
// 路由过滤递归函数
const filterRoutesFun = (arr: Array<object>) => {
return arr
@ -99,15 +90,29 @@ export default defineComponent({
});
return currentData;
};
// 设置页面当前路由高亮
const setCurrentRouterHighlight = (currentRoute) => {
const { path, meta } = currentRoute;
if (store.state.themeConfig.themeConfig.layout === 'classic') {
state.defaultActive = `/${path.split('/')[1]}`;
} else {
const pathSplit = meta.isDynamic ? meta.isDynamicPath.split('/') : path.split('/');
if (pathSplit.length >= 4 && meta.isHide) state.defaultActive = pathSplit.splice(0, 3).join('/');
else state.defaultActive = path;
}
};
// 页面加载前
onBeforeMount(() => {
setCurrentRouterHighlight(route);
});
// 页面加载时
onMounted(() => {
initElMenuOffsetLeft();
setCurrentRouterHighlight(route.meta.isDynamic ? route.meta.isDynamicPath : route.path);
});
// 路由更新时
onBeforeRouteUpdate((to) => {
// 修复https://gitee.com/lyt-top/vue-next-admin/issues/I3YX6G
setCurrentRouterHighlight(to.meta.isDynamic ? to.meta.isDynamicPath : to.path);
setCurrentRouterHighlight(to);
proxy.mittBus.emit('onMenuClick');
// 修复经典布局开启切割菜单时点击tagsView后左侧导航菜单数据不变的问题
let { layout, isClassicSplitMenu } = store.state.themeConfig.themeConfig;

View File

@ -1,12 +1,12 @@
<template>
<template v-for="val in chils">
<el-submenu :index="val.path" :key="val.path" v-if="val.children && val.children.length > 0">
<el-sub-menu :index="val.path" :key="val.path" v-if="val.children && val.children.length > 0">
<template #title>
<i :class="val.meta.icon"></i>
<span>{{ $t(val.meta.title) }}</span>
</template>
<sub-item :chil="val.children" />
</el-submenu>
</el-sub-menu>
<el-menu-item :index="val.path" :key="val.path" v-else>
<template v-if="!val.meta.isLink || (val.meta.isLink && val.meta.isIframe)">
<i :class="val.meta.icon ? val.meta.icon : ''"></i>

View File

@ -3,18 +3,18 @@
router
:default-active="defaultActive"
background-color="transparent"
:collapse="setIsCollapse"
:collapse="isCollapse"
:unique-opened="getThemeConfig.isUniqueOpened"
:collapse-transition="false"
>
<template v-for="val in menuLists">
<el-submenu :index="val.path" v-if="val.children && val.children.length > 0" :key="val.path">
<el-sub-menu :index="val.path" v-if="val.children && val.children.length > 0" :key="val.path">
<template #title>
<i :class="val.meta.icon ? val.meta.icon : ''"></i>
<span>{{ $t(val.meta.title) }}</span>
</template>
<SubItem :chil="val.children" />
</el-submenu>
</el-sub-menu>
<el-menu-item :index="val.path" :key="val.path" v-else>
<i :class="val.meta.icon ? val.meta.icon : ''"></i>
<template #title v-if="!val.meta.isLink || (val.meta.isLink && val.meta.isIframe)">
@ -29,7 +29,7 @@
</template>
<script lang="ts">
import { toRefs, reactive, computed, defineComponent, getCurrentInstance } from 'vue';
import { toRefs, reactive, computed, defineComponent, getCurrentInstance, onMounted, watch } from 'vue';
import { useRoute, onBeforeRouteUpdate } from 'vue-router';
import { useStore } from '/@/store/index';
import SubItem from '/@/layout/navMenu/subItem.vue';
@ -49,6 +49,7 @@ export default defineComponent({
const state = reactive({
// 修复https://gitee.com/lyt-top/vue-next-admin/issues/I3YX6G
defaultActive: route.meta.isDynamic ? route.meta.isDynamicPath : route.path,
isCollapse: false,
});
// 获取父级菜单数据
const menuLists = computed(() => {
@ -58,14 +59,31 @@ export default defineComponent({
const getThemeConfig = computed(() => {
return store.state.themeConfig.themeConfig;
});
// 菜单高亮(详情时,父级高亮)
const setParentHighlight = (currentRoute) => {
const { path, meta } = currentRoute;
const pathSplit = meta.isDynamic ? meta.isDynamicPath.split('/') : path.split('/');
if (pathSplit.length >= 4 && meta.isHide) return pathSplit.splice(0, 3).join('/');
else return path;
};
// 设置菜单的收起/展开
const setIsCollapse = computed(() => {
return document.body.clientWidth < 1000 ? false : getThemeConfig.value.isCollapse;
watch(
store.state.themeConfig.themeConfig,
() => {
document.body.clientWidth <= 1000 ? (state.isCollapse = false) : (state.isCollapse = getThemeConfig.value.isCollapse);
},
{
immediate: true,
}
);
// 页面加载时
onMounted(() => {
state.defaultActive = setParentHighlight(route);
});
// 路由更新时
onBeforeRouteUpdate((to) => {
// 修复https://gitee.com/lyt-top/vue-next-admin/issues/I3YX6G
state.defaultActive = to.meta.isDynamic ? to.meta.isDynamicPath : to.path;
state.defaultActive = setParentHighlight(to);
proxy.mittBus.emit('onMenuClick');
const clientWidth = document.body.clientWidth;
if (clientWidth < 1000) getThemeConfig.value.isCollapse = false;
@ -73,7 +91,6 @@ export default defineComponent({
return {
menuLists,
getThemeConfig,
setIsCollapse,
...toRefs(state),
};
},

View File

@ -32,8 +32,13 @@ export default defineComponent({
// 设置 iframe 的高度
const setIframeHeight = computed(() => {
let { isTagsview } = store.state.themeConfig.themeConfig;
if (isTagsview) return `84px`;
else return `50px`;
let { isTagsViewCurrenFull } = store.state.tagsViewRoutes;
if (isTagsViewCurrenFull) {
return `0px`;
} else {
if (isTagsview) return `84px`;
else return `50px`;
}
});
// 页面加载时
onMounted(() => {

View File

@ -11,7 +11,7 @@
</template>
<script lang="ts">
import { computed, defineComponent, toRefs, reactive, getCurrentInstance, onBeforeMount, onUnmounted, nextTick } from 'vue';
import { computed, defineComponent, toRefs, reactive, getCurrentInstance, onBeforeMount, onUnmounted, nextTick, watch } from 'vue';
import { useRoute } from 'vue-router';
import { useStore } from '/@/store/index';
export default defineComponent({
@ -40,19 +40,11 @@ export default defineComponent({
// 页面加载前,处理缓存,页面刷新时路由缓存处理
onBeforeMount(() => {
state.keepAliveNameList = getKeepAliveNames.value;
proxy.mittBus.on('onTagsViewRefreshRouterView', (path: string) => {
// 修复https://gitee.com/lyt-top/vue-next-admin/issues/I3YX6G
if (route.meta.isDynamic) {
// 动态路由xxx/:id/:name
if (route.meta.isDynamicPath !== path) return false;
} else {
// 普通路由
if (route.path !== path) return false;
}
proxy.mittBus.on('onTagsViewRefreshRouterView', (fullPath: string) => {
state.keepAliveNameList = getKeepAliveNames.value.filter((name: string) => route.name !== name);
state.refreshRouterViewKey = route.meta.isDynamic ? route.meta.isDynamicPath : route.path;
state.refreshRouterViewKey = null;
nextTick(() => {
state.refreshRouterViewKey = null;
state.refreshRouterViewKey = fullPath;
state.keepAliveNameList = getKeepAliveNames.value;
});
});
@ -61,6 +53,13 @@ export default defineComponent({
onUnmounted(() => {
proxy.mittBus.off('onTagsViewRefreshRouterView');
});
// 监听路由变化,防止 tagsView 多标签时,切换动画消失
watch(
() => route.fullPath,
() => {
state.refreshRouterViewKey = route.fullPath;
}
);
return {
getThemeConfig,
getKeepAliveNames,

View File

@ -7,7 +7,7 @@ import { i18n } from '/@/i18n/index';
import { globalComponentSize } from '/@/utils/componentSize';
import ElementPlus from 'element-plus';
import 'element-plus/lib/theme-chalk/index.css';
import 'element-plus/dist/index.css';
import '/@/theme/index.scss';
import mitt from 'mitt';
import screenShort from 'vue-web-screen-shot';

View File

@ -93,7 +93,6 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
},
],
},
{
path: '/limits',
name: 'limits',
@ -542,6 +541,21 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
icon: 'iconfont icon--chaifenlie',
},
},
{
path: '/fun/dragVerify',
name: 'funDragVerify',
component: () => import('/@/views/fun/dragVerify/index.vue'),
meta: {
title: 'message.router.funDragVerify',
isLink: '',
isHide: false,
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'el-icon-s-promotion',
},
},
],
},
{
@ -574,24 +588,32 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
auth: ['admin', 'test'],
icon: 'el-icon-sell',
},
/**
* 注意此处详情写法:
* 1、嵌套进父级里时面包屑显示为首页/页面/过滤筛选组件/过滤筛选组件详情
* 2、不嵌套进父级时面包屑显示为首页/页面/过滤筛选组件/过滤筛选组件详情
* 3、想要父级不高亮面包屑显示为首页/页面/过滤筛选组件详情,设置路径为:/pages/filteringDetails
*/
children: [
{
path: '/pages/filtering/details',
name: 'pagesFilteringDetails',
component: () => import('/@/views/pages/filtering/details.vue'),
meta: {
title: 'message.router.pagesFilteringDetails',
isLink: '',
isHide: true,
isKeepAlive: false,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'el-icon-s-order',
},
},
],
},
{
path: '/pages/filteringDetails',
name: 'pagesFilteringDetails',
component: () => import('/@/views/pages/filtering/details.vue'),
meta: {
title: 'message.router.pagesFilteringDetails',
isLink: '',
isHide: true,
isKeepAlive: false,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'el-icon-s-order',
},
},
{
path: '/pages/filteringDetails1',
path: '/pages/filtering/details1',
name: 'pagesFilteringDetails1',
component: () => import('/@/views/pages/filtering/details1.vue'),
meta: {
@ -695,6 +717,21 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
icon: 'iconfont icon-diqiu',
},
},
{
path: '/pages/formRules',
name: 'pagesFormRules',
component: () => import('/@/views/pages/formRules/index.vue'),
meta: {
title: 'message.router.pagesFormRules',
isLink: '',
isHide: false,
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'iconfont icon-shuxing',
},
},
{
path: '/pages/listAdapt',
name: 'pagesListAdapt',
@ -815,6 +852,36 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
icon: 'el-icon-picture-outline',
},
},
{
path: '/pages/dynamicForm',
name: 'pagesDynamicForm',
component: () => import('/@/views/pages/dynamicForm/index.vue'),
meta: {
title: 'message.router.pagesDynamicForm',
isLink: '',
isHide: false,
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin'],
icon: 'iconfont icon-diannao',
},
},
{
path: '/pages/workflow',
name: 'pagesWorkflow',
component: () => import('/@/views/pages/workflow/index.vue'),
meta: {
title: 'message.router.pagesWorkflow',
isLink: '',
isHide: false,
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin'],
icon: 'el-icon-connection',
},
},
],
},
{
@ -1009,7 +1076,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
component: () => import('/@/layout/routerView/iframes.vue'),
meta: {
title: 'message.router.layoutIfameView',
isLink: 'https://gitee.com/lyt-top/vue-next-admin',
isLink: 'https://wdd.js.org/jsplumb-chinese-tutorial/#/',
isHide: false,
isKeepAlive: false,
isAffix: true,

View File

@ -34,9 +34,11 @@ export interface ThemeConfigState {
isTagsviewIcon: boolean;
isCacheTagsView: boolean;
isSortableTagsView: boolean;
isShareTagsView: boolean;
isFooter: boolean;
isGrayscale: boolean;
isInvert: boolean;
isIsDark: boolean;
isWartermark: boolean;
wartermarkText: string;
tagsStyle: string;
@ -55,6 +57,8 @@ export interface ThemeConfigState {
// 路由列表
export interface RoutesListState {
routesList: Array<object>;
isColumnsMenuHover: Boolean;
isColumnsNavHover: Boolean;
}
// 路由缓存列表
@ -65,6 +69,7 @@ export interface KeepAliveNamesState {
// TagsView 路由列表
export interface TagsViewRoutesState {
tagsViewRoutes: Array<object>;
isTagsViewCurrenFull: Boolean;
}
// 用户信息

View File

@ -6,18 +6,36 @@ const routesListModule: Module<RoutesListState, RootStateTypes> = {
namespaced: true,
state: {
routesList: [],
isColumnsMenuHover: false,
isColumnsNavHover: false,
},
mutations: {
// 设置路由,菜单中使用到
getRoutesList(state: any, data: Array<object>) {
state.routesList = data;
},
// 设置分栏布局,鼠标是否移入移出(菜单)
getColumnsMenuHover(state: any, bool: Boolean) {
state.isColumnsMenuHover = bool;
},
// 设置分栏布局,鼠标是否移入移出(导航)
getColumnsNavHover(state: any, bool: Boolean) {
state.isColumnsNavHover = bool;
},
},
actions: {
// 设置路由,菜单中使用到
async setRoutesList({ commit }, data: any) {
commit('getRoutesList', data);
},
// 设置分栏布局,鼠标是否移入移出(菜单)
async setColumnsMenuHover({ commit }, bool: Boolean) {
commit('getColumnsMenuHover', bool);
},
// 设置分栏布局,鼠标是否移入移出(菜单)
async setColumnsNavHover({ commit }, bool: Boolean) {
commit('getColumnsNavHover', bool);
},
},
};

View File

@ -1,23 +1,34 @@
import { Module } from 'vuex';
// 此处加上 `.ts` 后缀报错,具体原因不详
import { TagsViewRoutesState, RootStateTypes } from '/@/store/interface/index';
import { Session } from '/@/utils/storage';
const tagsViewRoutesModule: Module<TagsViewRoutesState, RootStateTypes> = {
namespaced: true,
state: {
tagsViewRoutes: [],
isTagsViewCurrenFull: false,
},
mutations: {
// 设置 TagsView 路由
getTagsViewRoutes(state: any, data: Array<string>) {
state.tagsViewRoutes = data;
},
// 设置卡片全屏
getCurrenFullscreen(state: any, bool: boolean) {
Session.set('isTagsViewCurrenFull', bool);
state.isTagsViewCurrenFull = bool;
},
},
actions: {
// 设置 TagsView 路由
async setTagsViewRoutes({ commit }, data: Array<string>) {
commit('getTagsViewRoutes', data);
},
// 设置卡片全屏
setCurrenFullscreen({ commit }, bool: Boolean) {
commit('getCurrenFullscreen', bool);
},
},
};

View File

@ -5,6 +5,7 @@ import { ThemeConfigState, RootStateTypes } from '/@/store/interface/index';
/**
* 2020.05.28 by lyt 优化
* 修改一下配置时,需要每次都清理 `window.localStorage` 浏览器永久缓存,配置才会生效
* 哪个大佬有解决办法欢迎pr感谢💕
*/
const themeConfigModule: Module<ThemeConfigState, RootStateTypes> = {
namespaced: true,
@ -29,8 +30,9 @@ const themeConfigModule: Module<ThemeConfigState, RootStateTypes> = {
/**
* 菜单 / 顶栏
* 注意:为了演示,切换布局时,颜色会被还原成默认,代码位置:/@/layout/navBars/breadcrumb/setings.vue
* 中的 `initSetLayoutChange(设置布局切换,重置主题样式)` 方法
* 注意:v1.0.17 版本去除设置布局切换重置主题样式initSetLayoutChange
* 切换布局需手动设置样式,设置的样式自动同步各布局,
* 代码位置:/@/layout/navBars/breadcrumb/setings.vue
*/
// 默认顶栏导航背景颜色,请注意:需要同时修改 `/@/theme/common/var.scss` 对应的值
topBar: '#ffffff',
@ -52,7 +54,6 @@ const themeConfigModule: Module<ThemeConfigState, RootStateTypes> = {
isColumnsMenuBarColorGradual: false,
// 是否开启菜单字体背景高亮
isMenuBarColorHighlight: false,
// 是否开启菜单字体背景高亮
/**
* 界面设置
@ -91,12 +92,16 @@ const themeConfigModule: Module<ThemeConfigState, RootStateTypes> = {
isCacheTagsView: false,
// 是否开启 TagsView 拖拽
isSortableTagsView: true,
// 是否开启 TagsView 共用
isShareTagsView: false,
// 是否开启 Footer 底部版权信息
isFooter: false,
// 是否开启灰色模式
isGrayscale: false,
// 是否开启色弱模式
isInvert: false,
// 是否开启深色模式
isIsDark: false,
// 是否开启水印
isWartermark: false,
// 水印文案

View File

@ -1,5 +1,5 @@
import { Module } from 'vuex';
import { Session } from '/@/utils/storage.ts';
import { Session } from '/@/utils/storage';
// 此处加上 `.ts` 后缀报错,具体原因不详
import { UserInfosState, RootStateTypes } from '/@/store/interface/index';

View File

@ -54,28 +54,56 @@ body,
.el-scrollbar {
width: 100%;
}
// 此字段多次用到,建议不删除,如需修改,请重写覆盖样式
.layout-view-bg-white {
background: white;
background: var(--el-color-white);
width: 100%;
height: 100%;
border-radius: 4px;
border: 1px solid #ebeef5;
border: 1px solid var(--el-border-color-light, #ebeef5);
}
.layout-el-aside-br-color {
border-right: 1px solid rgb(238, 238, 238);
}
.layout-aside-width-default {
// pc端左侧导航样式
.layout-aside-pc-220 {
width: 220px !important;
transition: width 0.3s ease;
}
.layout-aside-width64 {
.layout-aside-pc-64 {
width: 64px !important;
transition: width 0.3s ease;
}
.layout-aside-width1 {
.layout-aside-pc-1 {
width: 1px !important;
transition: width 0.3s ease;
}
// 手机端左侧导航样式
.layout-aside-mobile {
position: fixed;
top: 0;
left: -220px;
width: 220px;
z-index: 9999999;
}
.layout-aside-mobile-close {
left: -220px;
transition: all 0.3s cubic-bezier(1, -0.04, 0, 1.32);
}
.layout-aside-mobile-open {
left: 0;
transition: all 0.3s cubic-bezier(0.53, -0.26, 0.42, 1.18);
}
.layout-aside-mobile-mode {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 9999998;
}
.layout-scrollbar {
@extend .el-scrollbar;
padding: 15px;
@ -96,14 +124,6 @@ body,
/* element plus 全局样式
------------------------------- */
.layout-breadcrumb-seting {
.el-drawer__header {
padding: 0 15px !important;
height: 50px;
display: flex;
align-items: center;
margin-bottom: 0 !important;
border-bottom: 1px solid rgb(230, 230, 230);
}
.el-divider {
background-color: rgb(230, 230, 230);
}

View File

@ -8,7 +8,6 @@
------------------------------- */
$--color-primary: #409eff !default;
$--color-whites: #ffffff !default;
$--color-blacks: #000000 !default;
$--color-primary-light-1: mix($--color-whites, $--color-primary, 10%) !default;
$--color-primary-light-2: mix($--color-whites, $--color-primary, 20%) !default;
$--color-primary-light-3: mix($--color-whites, $--color-primary, 30%) !default;
@ -70,7 +69,6 @@ $--bg-columnsMenuBarColor: #e6e6e6;
:root {
--color-primary: #{$--color-primary};
--color-whites: #{$--color-whites};
--color-blacks: #{$--color-blacks};
--color-primary-light-1: #{$--color-primary-light-1};
--color-primary-light-2: #{$--color-primary-light-2};
--color-primary-light-3: #{$--color-primary-light-3};

48
src/theme/dark.scss Normal file
View File

@ -0,0 +1,48 @@
/* 深色模式样式
------------------------------- */
[data-theme='dark'] {
// 全局
filter: invert(0.9) hue-rotate(180deg);
img,
.layout-lock-screen-img,
.visualizing-demo2,
.w-e-panel-tab-content {
filter: invert(1) hue-rotate(180deg);
}
.error img {
filter: unset;
}
// element plus
.el-radio-button__original-radio:checked + .el-radio-button__inner,
.el-image-viewer__close,
.el-image-viewer__actions__inner,
.el-image-viewer__next,
.el-image-viewer__prev {
color: #000000 !important;
}
// 数据可视化演示
.visualizing-container-head {
background: linear-gradient(to bottom, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.02)) !important;
.visualizing-container-head-left-text-box {
color: #000000 !important;
}
}
.visualizing-container-content-left {
background: linear-gradient(to right, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.01)) !important;
}
.visualizing-container-content-center {
background: linear-gradient(to top, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.01)) !important;
}
.visualizing-container-content-right {
background: linear-gradient(to left, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.01)) !important;
}
.cropper-modal {
background-color: #ffffff;
}
// 其它菜单等
--bg-menuBar: #ffffff !important;
--bg-menuBarColor: #303133 !important;
--bg-columnsMenuBar: #ffffff !important;
--bg-columnsMenuBarColor: #303133 !important;
--color-whites: #000000 !important;
}

View File

@ -747,9 +747,14 @@
// 默认样式修改
.el-menu {
border-right: none !important;
width: 220px;
}
// 修复点击左侧菜单折叠再展开时,宽度不跟随问题
.el-menu--collapse {
width: 64px !important;
}
.el-menu-item,
.el-submenu__title {
.el-sub-menu__title {
height: 50px !important;
line-height: 50px !important;
color: var(--bg-menuBarColor);
@ -757,31 +762,31 @@
}
// horizontal 水平方向时
.el-menu--horizontal > .el-menu-item.is-active,
.el-menu--horizontal > .el-submenu.is-active .el-submenu__title {
.el-menu--horizontal > .el-sub-menu.is-active .el-sub-menu__title {
border-bottom: 3px solid !important;
border-bottom-color: set-color(primary);
color: set-color(primary) !important;
}
.el-menu--horizontal .el-menu-item:not(.is-disabled):focus,
.el-menu--horizontal .el-menu-item:not(.is-disabled):hover,
.el-menu--horizontal > .el-submenu:focus .el-submenu__title,
.el-menu--horizontal > .el-submenu:hover .el-submenu__title,
.el-menu--horizontal > .el-sub-menu:focus .el-sub-menu__title,
.el-menu--horizontal > .el-sub-menu:hover .el-sub-menu__title,
.el-menu--horizontal .el-menu .el-menu-item.is-active,
.el-menu--horizontal .el-menu .el-submenu.is-active > .el-submenu__title {
.el-menu--horizontal .el-menu .el-sub-menu.is-active > .el-sub-menu__title {
color: set-color(primary) !important;
}
.el-menu.el-menu--horizontal {
border-bottom: none !important;
}
.el-menu--horizontal > .el-menu-item,
.el-menu--horizontal > .el-submenu .el-submenu__title {
.el-menu--horizontal > .el-sub-menu .el-sub-menu__title {
color: var(--bg-topBarColor);
}
// 外部链接时
.el-menu-item a,
.el-menu-item a:hover,
.el-menu-item i,
.el-submenu__title i {
.el-sub-menu__title i {
color: inherit;
text-decoration: none;
}
@ -791,22 +796,23 @@
}
// 默认 hover 时
.el-menu-item:hover,
.el-submenu__title:hover {
.el-sub-menu__title:hover {
color: set-color(primary) !important;
background-color: transparent !important;
i {
color: set-color(primary);
}
}
// 高亮时
.el-menu-item.is-active {
// 高亮时/菜单收起时
.el-menu-item.is-active,
.el-menu--collapse .el-sub-menu.is-active i {
color: set-color(primary);
}
.el-active-extend {
color: #ffffff !important;
color: var(--color-whites) !important;
background-color: set-color(primary) !important;
i {
color: #ffffff !important;
color: var(--color-whites) !important;
}
}
#add-is-active {
@ -817,33 +823,37 @@
}
// 菜单收起时且是a链接
.el-popper.is-dark a {
color: #ffffff !important;
color: var(--color-whites) !important;
text-decoration: none;
}
// 菜单收起时鼠标经过背景颜色/字体颜色
.el-popper.is-light {
.el-menu--vertical {
background: var(--bg-menuBar);
.el-menu {
background: var(--bg-menuBar);
}
}
.el-menu--horizontal {
background: var(--bg-topBar);
.el-menu,
.el-menu-item,
.el-submenu__title {
.el-sub-menu__title {
color: var(--bg-topBarColor);
background: var(--bg-topBar);
}
}
}
// 第三方图标字体间距/大小设置
.el-menu-item .iconfont,
.el-submenu .iconfont {
.el-sub-menu .iconfont {
@include generalIcon;
}
.el-menu-item .fa,
.el-submenu .fa {
.el-sub-menu .fa {
@include generalIcon;
}
// element plus 本身字体图标
.el-submenu [class^='el-icon-'] {
.el-sub-menu [class^='el-icon-'] {
font-size: 14px !important;
}
// 去掉离开浏览器时,菜单的默认高亮
@ -885,6 +895,9 @@
color: set-color(primary);
background-color: set-color(primary-light-9);
}
.el-dropdown-menu .el-dropdown-menu__item {
white-space: nowrap;
}
/* Steps 步骤条
------------------------------- */
@ -928,14 +941,20 @@
color: set-color(primary);
}
.el-overlay {
display: flex;
align-items: center;
justify-content: center;
.el-dialog {
margin: 0 auto !important;
position: absolute;
.el-dialog__body {
padding: 20px !important;
overflow: hidden;
.el-overlay-dialog {
display: flex;
align-items: center;
justify-content: center;
position: unset !important;
width: 100%;
height: 100%;
.el-dialog {
margin: 0 auto !important;
position: absolute;
.el-dialog__body {
padding: 20px !important;
}
}
}
}
@ -1012,10 +1031,21 @@
/* Drawer 抽屉
------------------------------- */
.el-drawer__body {
width: 100%;
height: 100%;
overflow: auto;
.el-drawer {
--el-drawer-padding-primary: unset !important;
.el-drawer__header {
padding: 0 15px !important;
height: 50px;
display: flex;
align-items: center;
margin-bottom: 0 !important;
border-bottom: 1px solid rgb(230, 230, 230);
}
.el-drawer__body {
width: 100%;
height: 100%;
overflow: auto;
}
}
.el-drawer-fade-enter-active .el-drawer.rtl {
animation: rtl-drawer-animation 0.3s ease-in reverse !important;

View File

@ -13,7 +13,7 @@
.icon-selector-warp-row {
height: 230px;
overflow: hidden;
border-top: 1px solid #ebeef5;
border-top: var(--el-border-base);
.el-row {
padding: 15px;
}
@ -22,14 +22,14 @@
}
.icon-selector-warp-item {
display: flex;
border: 1px solid #ebeef5;
border: var(--el-border-base);
padding: 5px;
border-radius: 5px;
margin-bottom: 10px;
.icon-selector-warp-item-value {
i {
font-size: 20px;
color: #606266;
color: var(--el-text-color-regular);
}
}
&:hover {

View File

@ -5,3 +5,4 @@
@import './iconSelector.scss';
@import './media/media.scss';
@import './waves.scss';
@import './dark.scss';

View File

@ -24,3 +24,14 @@
}
}
}
/* 页面宽度小于375px
------------------------------- */
@media screen and (max-width: 376px) {
.login-container {
.login-content-title {
font-size: 18px !important;
transition: all 0.3s ease;
}
}
}

View File

@ -14,3 +14,28 @@ export function judementSameArr(news: Array<string>, old: Array<string>): boolea
}
return count === leng ? true : false;
}
/**
* 判断两个对象是否相同
* @param a 要比较的对象一
* @param b 要比较的对象二
* @returns 相同返回 true反之则反
*/
export function isObjectValueEqual(a: { [key: string]: any }, b: { [key: string]: any }) {
if (!a || !b) return false;
let aProps = Object.getOwnPropertyNames(a);
let bProps = Object.getOwnPropertyNames(b);
if (aProps.length != bProps.length) return false;
for (let i = 0; i < aProps.length; i++) {
let propName = aProps[i];
let propA = a[propName];
let propB = b[propName];
if (!b.hasOwnProperty(propName)) return false;
if (propA instanceof Object) {
if (!isObjectValueEqual(propA, propB)) return false;
} else if (propA !== propB) {
return false;
}
}
return true;
}

View File

@ -8,7 +8,7 @@ import { ElMessage } from 'element-plus';
export function hexToRgb(str: any) {
let hexs: any = '';
let reg = /^\#?[0-9A-Fa-f]{6}$/;
if (!reg.test(str)) return ElMessage({ type: 'warning', message: '输入错误的hex' });
if (!reg.test(str)) return ElMessage.warning('输入错误的hex');
str = str.replace('#', '');
hexs = str.match(/../g);
for (let i = 0; i < 3; i++) hexs[i] = parseInt(hexs[i], 16);
@ -24,7 +24,7 @@ export function hexToRgb(str: any) {
*/
export function rgbToHex(r: any, g: any, b: any) {
let reg = /^\d{1,3}$/;
if (!reg.test(r) || !reg.test(g) || !reg.test(b)) return ElMessage({ type: 'warning', message: '输入错误的rgb颜色值' });
if (!reg.test(r) || !reg.test(g) || !reg.test(b)) return ElMessage.warning('输入错误的rgb颜色值');
let hexs = [r.toString(16), g.toString(16), b.toString(16)];
for (let i = 0; i < 3; i++) if (hexs[i].length == 1) hexs[i] = `0${hexs[i]}`;
return `#${hexs.join('')}`;
@ -38,7 +38,7 @@ export function rgbToHex(r: any, g: any, b: any) {
*/
export function getDarkColor(color: any, level: number) {
let reg = /^\#?[0-9A-Fa-f]{6}$/;
if (!reg.test(color)) return ElMessage({ type: 'warning', message: '输入错误的hex颜色值' });
if (!reg.test(color)) return ElMessage.warning('输入错误的hex颜色值');
let rgb = hexToRgb(color);
for (let i = 0; i < 3; i++) rgb[i] = Math.floor(rgb[i] * (1 - level));
return rgbToHex(rgb[0], rgb[1], rgb[2]);
@ -52,7 +52,7 @@ export function getDarkColor(color: any, level: number) {
*/
export function getLightColor(color: any, level: number) {
let reg = /^\#?[0-9A-Fa-f]{6}$/;
if (!reg.test(color)) return ElMessage({ type: 'warning', message: '输入错误的hex颜色值' });
if (!reg.test(color)) return ElMessage.warning('输入错误的hex颜色值');
let rgb = hexToRgb(color);
for (let i = 0; i < 3; i++) rgb[i] = Math.floor((255 - rgb[i]) * level + rgb[i]);
return rgbToHex(rgb[0], rgb[1], rgb[2]);

View File

@ -3,19 +3,18 @@ const setWatermark = (str: string) => {
const id = '1.23452384164.123412416';
if (document.getElementById(id) !== null) document.body.removeChild(document.getElementById(id) as any);
const can = document.createElement('canvas');
can.width = 250;
can.height = 180;
can.width = 200;
can.height = 130;
const cans: any = can.getContext('2d');
cans.rotate((-20 * Math.PI) / 180);
cans.font = '12px Vedana';
cans.fillStyle = 'rgba(200, 200, 200, 0.30)';
cans.textAlign = 'center';
cans.textBaseline = 'Middle';
cans.fillText(str, can.width / 10, can.height / 2);
const div = document.createElement('div');
div.id = id;
div.style.pointerEvents = 'none';
div.style.top = '35px';
div.style.top = '15px';
div.style.left = '0px';
div.style.position = 'fixed';
div.style.zIndex = '10000000';

View File

@ -19,8 +19,8 @@
.flex-warp-item-box {
width: 100%;
height: 100%;
background: white;
border: 1px solid #ebeef5;
background: var(--el-color-white);
border: 1px solid var(--el-border-color-light, #ebeef5);
border-radius: 4px;
display: flex;
flex-direction: column;
@ -49,7 +49,7 @@
}
}
.big-data-down-left {
color: #303133;
color: var(--el-text-color-primary);
.sky {
display: flex;
align-items: center;
@ -67,7 +67,7 @@
background: #22bc76;
border-radius: 2px;
padding: 0 5px;
color: white;
color: var(--color-whites);
}
}
.sky-right {
@ -117,7 +117,7 @@
text-align: center;
border-radius: 100%;
flex-shrink: 1;
color: #ffffff;
color: var(--color-whites);
}
.i-bg1 {
background: #22bc76;
@ -189,9 +189,9 @@
padding: 0 7.5px 15px;
.big-data-down-center-one-content {
height: 100%;
background: white;
background: var(--el-color-white);
padding: 15px;
border: 1px solid #ebeef5;
border: 1px solid var(--el-border-color-light, #ebeef5);
border-radius: 4px;
transition: all ease 0.3s;
&:hover {
@ -206,11 +206,11 @@
.flex-warp-item-box {
width: 100%;
height: 100%;
background: white;
background: var(--el-color-white);
display: flex;
flex-direction: column;
padding: 15px;
border: 1px solid #ebeef5;
border: 1px solid var(--el-border-color-light, #ebeef5);
border-radius: 4px;
transition: all ease 0.3s;
&:hover {
@ -317,7 +317,7 @@
height: 45px;
.task-item {
flex: 1;
color: #ffffff;
color: var(--color-whites);
display: flex;
justify-content: center;
.task-item-box {

View File

@ -1,6 +1,6 @@
<template>
<div class="chart-scrollbar" :style="{ height: `calc(100vh - ${initTagViewHeight}` }">
<div class="chart-warp layout-view-bg-white">
<div class="chart-scrollbar layout-view-bg-white" :style="{ height: `calc(100vh - ${initTagViewHeight}` }">
<div class="chart-warp">
<div class="chart-warp-top">
<ChartHead />
</div>
@ -202,7 +202,7 @@
</template>
<script lang="ts">
import { toRefs, reactive, computed, onMounted, getCurrentInstance } from 'vue';
import { toRefs, reactive, computed, onMounted, getCurrentInstance, watch, nextTick, onActivated } from 'vue';
import { useStore } from '/@/store/index';
import ChartHead from '/@/views/chart/head.vue';
import * as echarts from 'echarts';
@ -220,12 +220,18 @@ export default {
dBtnList,
chartData4List,
earth3DBtnList,
myCharts: [],
});
// 设置主内容的高度
const initTagViewHeight = computed(() => {
let { isTagsview } = store.state.themeConfig.themeConfig;
if (isTagsview) return `114px`;
else return `80px`;
let { isTagsViewCurrenFull } = store.state.tagsViewRoutes;
if (isTagsViewCurrenFull) {
return `30px`;
} else {
if (isTagsview) return `114px`;
else return `80px`;
}
});
// 初始化中间图表1
const initChartsCenterOne = () => {
@ -286,9 +292,7 @@ export default {
],
};
myChart.setOption(option);
window.addEventListener('resize', () => {
myChart.resize();
});
state.myCharts.push(myChart);
};
// 初始化近7天产品追溯扫码统计
const initChartsSevenDays = () => {
@ -333,9 +337,7 @@ export default {
],
};
myChart.setOption(option);
window.addEventListener('resize', () => {
myChart.resize();
});
state.myCharts.push(myChart);
};
// 初始化近30天预警总数
const initChartsWarning = () => {
@ -370,9 +372,7 @@ export default {
],
};
myChart.setOption(option);
window.addEventListener('resize', () => {
myChart.resize();
});
state.myCharts.push(myChart);
};
// 初始化当前设备监测
const initChartsMonitor = () => {
@ -412,9 +412,7 @@ export default {
],
};
myChart.setOption(option);
window.addEventListener('resize', () => {
myChart.resize();
});
state.myCharts.push(myChart);
};
// 初始化近7天投入品记录
const initChartsInvestment = () => {
@ -444,10 +442,20 @@ export default {
],
};
myChart.setOption(option);
window.addEventListener('resize', () => {
myChart.resize();
state.myCharts.push(myChart);
};
// 批量设置 echarts resize
const initEchartsResizeFun = () => {
nextTick(() => {
for (let i = 0; i < state.myCharts.length; i++) {
state.myCharts[i].resize();
}
});
};
// 批量设置 echarts resize
const initEchartsResize = () => {
window.addEventListener('resize', initEchartsResizeFun);
};
// 页面加载时
onMounted(() => {
initChartsCenterOne();
@ -455,7 +463,19 @@ export default {
initChartsWarning();
initChartsMonitor();
initChartsInvestment();
initEchartsResize();
});
// 由于页面缓存原因keep-alive
onActivated(() => {
initEchartsResizeFun();
});
// 监听 vuex 中的 tagsview 开启全屏变化,重新 resize 图表,防止不出现/大小不变等
watch(
() => store.state.tagsViewRoutes.isTagsViewCurrenFull,
() => {
initEchartsResizeFun();
}
);
return {
initTagViewHeight,
...toRefs(state),

View File

@ -39,7 +39,7 @@ export default {
<style scoped lang="scss">
.error {
height: 100%;
background-color: white;
background-color: var(--el-color-white);
display: flex;
.error-flex {
margin: auto;
@ -59,17 +59,17 @@ export default {
animation-fill-mode: forwards;
}
.left-item-num {
color: #d6e0f6;
color: var(--el-color-info);
font-size: 55px;
}
.left-item-title {
font-size: 20px;
color: #333333;
color: var(--el-text-color-primary);
margin: 15px 0 5px 0;
animation-delay: 0.1s;
}
.left-item-msg {
color: #c0bebe;
color: var(--el-text-color-secondary);
font-size: 12px;
margin-bottom: 30px;
animation-delay: 0.2s;

View File

@ -37,7 +37,7 @@ export default {
<style scoped lang="scss">
.error {
height: 100%;
background-color: white;
background-color: var(--el-color-white);
display: flex;
.error-flex {
margin: auto;
@ -57,17 +57,17 @@ export default {
animation-fill-mode: forwards;
}
.left-item-num {
color: #d6e0f6;
color: var(--el-color-info);
font-size: 55px;
}
.left-item-title {
font-size: 20px;
color: #333333;
color: var(--el-text-color-primary);
margin: 15px 0 5px 0;
animation-delay: 0.1s;
}
.left-item-msg {
color: #c0bebe;
color: var(--el-text-color-secondary);
font-size: 12px;
margin-bottom: 30px;
animation-delay: 0.2s;

View File

@ -110,7 +110,7 @@ export default {
.countup-card-item {
width: 100%;
height: 103px;
background: gray;
background: var(--el-text-color-secondary);
border-radius: 4px;
transition: all ease 0.3s;
&:hover {
@ -140,7 +140,7 @@ export default {
}
.countup-card-item-flex {
padding: 0 20px;
color: white;
color: var(--color-whites);
.countup-card-item-title,
.countup-card-item-tip {
font-size: 13px;

View File

@ -0,0 +1,107 @@
<template>
<div class="dragVerify-container">
<el-card shadow="hover" header="验证器:基本滑块验证组件">
<el-alert
title="感谢优秀的 `vue-drag-verify`项目地址https://github.com/yimijianfang/vue-drag-verify"
type="success"
:closable="false"
class="mb15"
></el-alert>
<DragVerify
v-model:isPassing="isPassingOne"
text="请按住滑块拖动"
successText="验证通过"
handlerIcon="el-icon-d-arrow-right"
successIcon="el-icon-circle-check"
/>
</el-card>
<el-card shadow="hover" header="验证器:图片滑块组件" class="mt15">
<el-alert
title="感谢优秀的 `vue-drag-verify`项目地址https://github.com/yimijianfang/vue-drag-verify"
type="success"
:closable="false"
class="mb15"
></el-alert>
<DragVerifyImg
:imgsrc="imgTwo"
v-model:isPassing="isPassingTwo"
:showRefresh="true"
text="请按住滑块拖动"
successText="验证通过"
handlerIcon="el-icon-d-arrow-right"
successIcon="el-icon-circle-check"
/>
</el-card>
<el-card shadow="hover" header="验证器:图片滑块组件(拼图)" class="mt15">
<el-alert
title="感谢优秀的 `vue-drag-verify`项目地址https://github.com/yimijianfang/vue-drag-verify"
type="success"
:closable="false"
class="mb15"
></el-alert>
<DragVerifyImgChip
:imgsrc="imgThree"
v-model:isPassing="isPassingThree"
:showRefresh="true"
text="请按住滑块拖动"
successText="验证通过"
handlerIcon="el-icon-d-arrow-right"
successIcon="el-icon-circle-check"
/>
</el-card>
<el-card shadow="hover" header="验证器:旋转图片滑块组件" class="mt15">
<el-alert
title="感谢优秀的 `vue-drag-verify`项目地址https://github.com/yimijianfang/vue-drag-verify"
type="success"
:closable="false"
class="mb15"
></el-alert>
<DragVerifyImgRotate
:imgsrc="imgThree"
v-model:isPassing="isPassingFour"
:showRefresh="true"
text="请按住滑块拖动"
successText="验证通过"
handlerIcon="el-icon-d-arrow-right"
successIcon="el-icon-circle-check"
/>
</el-card>
</div>
</template>
<script lang="ts">
import { toRefs, reactive } from 'vue';
// 基本滑块验证组件
import DragVerify from '/@/components/dragVerify/dragVerify.vue';
// 图片滑块组件
import DragVerifyImg from '/@/components/dragVerify/dragVerifyImg.vue';
// 图片滑块组件(拼图)
import DragVerifyImgChip from '/@/components/dragVerify/dragVerifyImgChip.vue';
// 旋转图片滑块组件
import DragVerifyImgRotate from '/@/components/dragVerify/dragVerifyImgRotate.vue';
export default {
name: 'funDragVerify',
components: {
DragVerify,
DragVerifyImg,
DragVerifyImgChip,
DragVerifyImgRotate,
},
setup() {
const state = reactive({
isPassingOne: false,
isPassingTwo: false,
isPassingThree: false,
isPassingFour: false,
imgTwo: 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1813762643,1914315241&fm=26&gp=0.jpg',
imgThree: 'https://img1.baidu.com/it/u=2813520958,2218166536&fm=26&fmt=auto&gp=0.jpg',
});
return {
...toRefs(state),
};
},
};
</script>

View File

@ -23,8 +23,13 @@ export default {
// 设置主内容的高度
const initTagViewHeight = computed(() => {
let { isTagsview } = store.state.themeConfig.themeConfig;
if (isTagsview) return `114px`;
else return `80px`;
let { isTagsViewCurrenFull } = store.state.tagsViewRoutes;
if (isTagsViewCurrenFull) {
return `30px`;
} else {
if (isTagsview) return `114px`;
else return `80px`;
}
});
// echartsMap 将坐标信息和对应物理量的值合在一起
const convertData = (data) => {

View File

@ -55,7 +55,7 @@ export default {
.grid-layout-container {
.vue-grid-item {
background: var(--color-primary);
color: #ffffff;
color: var(--color-whites);
}
}
</style>

View File

@ -1,5 +1,5 @@
<template>
<div id="printRref">
<div id="printRef">
<el-card shadow="hover" header="打印演示">
<el-alert
title="感谢优秀的 `print-js`项目地址https://github.com/crabbly/Print.js。请在打印弹窗 `更多设置` 中开启 `背景图形。`"
@ -22,7 +22,7 @@ export default {
// 打印点击
const onPrintJs = () => {
printJs({
printable: 'printRref',
printable: 'printRef',
type: 'html',
css: ['//at.alicdn.com/t/font_2298093_o73r8wjdhlg.css', 'https://unpkg.com/element-plus/lib/theme-chalk/index.css'],
scanStyles: false,

View File

@ -1,28 +1,10 @@
<template>
<div class="fun-tagsview">
<el-card shadow="hover" header="tagsView 非当前页演示">
<el-form :model="formInline" size="small" label-width="40px" class="tags-view-form">
<el-row :gutter="35">
<el-col :xs="24" :sm="8" :md="8" :lg="6" :xl="4" class="tags-view-form-col">
<el-form-item label="功能">
<el-select v-model="formInline.selectId" placeholder="请选择" class="w100">
<el-option v-for="item in selectOptions" :key="item.value" :label="item.label" :value="item.value"> </el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="8" :md="8" :lg="6" :xl="4" class="tags-view-form-col">
<el-form-item label="路径">
<el-input v-model="formInline.path" placeholder="路径如:/fun/tagsView"></el-input>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="8" :md="8" :lg="6" :xl="4">
<el-form-item class="fun-tagsview-from-item">
<el-button type="primary" @click="onImplementClick" icon="el-icon-thumb">点击执行</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<NoticeBar
text="已删除非当前页 tagsView 演示,后续有时间可以再加回来!,tagsview 支持多标签(参数不同)、单标签共用(参数不同)"
background="#ecf5ff"
color="#409eff"
/>
<el-card shadow="hover" header="tagsView 当前页演示" class="mt15">
<div class="flex-warp">
<div class="flex-warp-item">
@ -57,82 +39,35 @@
<script lang="ts">
import { getCurrentInstance, reactive, toRefs } from 'vue';
import NoticeBar from '/@/components/noticeBar/index.vue';
import { useRoute } from 'vue-router';
export default {
name: 'funTagsView',
components: { NoticeBar },
setup() {
const { proxy } = getCurrentInstance() as any;
const route = useRoute();
const state = reactive({
formInline: {
path: '',
selectId: 0,
},
selectOptions: [
{
value: 0,
label: '刷新当前',
},
{
value: 1,
label: '关闭当前',
},
{
value: 2,
label: '关闭其它',
},
{
value: 3,
label: '关闭全部',
},
{
value: 4,
label: '当前页全屏',
},
],
});
const state = reactive({});
// 0 刷新当前1 关闭当前2 关闭其它3 关闭全部 4 当前页全屏
// 1、刷新当前 tagsView
const refreshCurrentTagsView = () => {
proxy.mittBus.emit('onCurrentContextmenuClick', {
id: 0,
path: route.path,
});
proxy.mittBus.emit('onCurrentContextmenuClick', Object.assign({}, { contextMenuClickId: 0, ...route }));
};
// 2、关闭当前 tagsView
const closeCurrentTagsView = () => {
proxy.mittBus.emit('onCurrentContextmenuClick', {
id: 1,
path: route.path,
});
proxy.mittBus.emit('onCurrentContextmenuClick', Object.assign({}, { contextMenuClickId: 1, ...route }));
};
// 3、关闭其它 tagsView
const closeOtherTagsView = () => {
proxy.mittBus.emit('onCurrentContextmenuClick', {
id: 2,
path: route.path,
});
proxy.mittBus.emit('onCurrentContextmenuClick', Object.assign({}, { contextMenuClickId: 2, ...route }));
};
// 4、关闭全部 tagsView
const closeAllTagsView = () => {
proxy.mittBus.emit('onCurrentContextmenuClick', {
id: 3,
path: route.path,
});
proxy.mittBus.emit('onCurrentContextmenuClick', Object.assign({}, { contextMenuClickId: 3, ...route }));
};
// 5、开启当前页面全屏
const openCurrenFullscreen = () => {
proxy.mittBus.emit('onCurrentContextmenuClick', {
id: 4,
path: route.path,
});
};
// 执行点击
const onImplementClick = () => {
proxy.mittBus.emit('onCurrentContextmenuClick', {
id: state.formInline.selectId,
path: state.formInline.path,
});
proxy.mittBus.emit('onCurrentContextmenuClick', Object.assign({}, { contextMenuClickId: 4, ...route }));
};
return {
refreshCurrentTagsView,
@ -140,7 +75,6 @@ export default {
closeOtherTagsView,
closeAllTagsView,
openCurrenFullscreen,
onImplementClick,
...toRefs(state),
};
},

View File

@ -23,8 +23,13 @@ export default {
// 设置主内容的高度
const initTagViewHeight = computed(() => {
let { isTagsview } = store.state.themeConfig.themeConfig;
if (isTagsview) return `114px`;
else return `80px`;
let { isTagsViewCurrenFull } = store.state.tagsViewRoutes;
if (isTagsViewCurrenFull) {
return `30px`;
} else {
if (isTagsview) return `114px`;
else return `80px`;
}
});
// 初始化数据
const initEchartsTree = () => {

View File

@ -7,34 +7,23 @@
:closable="false"
class="mb15"
></el-alert>
<div id="wangeditor"></div>
<Editor :is-disable="false" v-model="editorVal" />
</el-card>
</div>
</template>
<script lang="ts">
import { toRefs, reactive, onMounted } from 'vue';
import wangeditor from 'wangeditor';
import Editor from '/@/components/editor/index.vue';
export default {
name: 'funWangEditor',
components: { Editor },
setup() {
const state = reactive({});
// 初始化富文本
// https://doc.wangeditor.com/
const initWangeditor = () => {
const editor = new wangeditor('#wangeditor');
editor.config.placeholder = '请输入内容';
editor.config.onchange = (html: string) => {
console.log(html);
// console.log(editor.txt.html());
// console.log(editor.txt.text());
};
editor.create();
};
// 页面加载时
onMounted(() => {
initWangeditor();
const state = reactive({
editorVal: '',
});
// 页面加载时
onMounted(() => {});
return {
...toRefs(state),
};

View File

@ -96,7 +96,7 @@
</template>
<script lang="ts">
import { toRefs, reactive, onMounted, nextTick, computed, getCurrentInstance } from 'vue';
import { toRefs, reactive, onMounted, nextTick, computed, getCurrentInstance, watch, onActivated } from 'vue';
import * as echarts from 'echarts';
import { CountUp } from 'countup.js';
import { formatAxis } from '/@/utils/formatTime';
@ -130,6 +130,7 @@ export default {
},
],
},
myCharts: [],
});
// 获取用户信息 vuex
const getUserInfos = computed(() => {
@ -234,9 +235,7 @@ export default {
],
};
myChart.setOption(option);
window.addEventListener('resize', () => {
myChart.resize();
});
state.myCharts.push(myChart);
};
// 履约超时预警
const initHomeOvertime = () => {
@ -288,16 +287,38 @@ export default {
],
};
myChart.setOption(option);
window.addEventListener('resize', () => {
myChart.resize();
state.myCharts.push(myChart);
};
// 批量设置 echarts resize
const initEchartsResizeFun = () => {
nextTick(() => {
for (let i = 0; i < state.myCharts.length; i++) {
state.myCharts[i].resize();
}
});
};
// 批量设置 echarts resize
const initEchartsResize = () => {
window.addEventListener('resize', initEchartsResizeFun);
};
// 页面加载时
onMounted(() => {
initNumCountUp();
initHomeLaboratory();
initHomeOvertime();
initEchartsResize();
});
// 由于页面缓存原因keep-alive
onActivated(() => {
initEchartsResizeFun();
});
// 监听 vuex 中的 tagsview 开启全屏变化,重新 resize 图表,防止不出现/大小不变等
watch(
() => store.state.tagsViewRoutes.isTagsViewCurrenFull,
() => {
initEchartsResizeFun();
}
);
return {
getUserInfos,
currentTime,
@ -313,7 +334,7 @@ export default {
.home-card-item {
width: 100%;
height: 103px;
background: gray;
background: var(--el-text-color-secondary);
border-radius: 4px;
transition: all ease 0.3s;
&:hover {
@ -343,7 +364,7 @@ export default {
}
.home-card-item-flex {
padding: 0 20px;
color: white;
color: var(--color-whites);
.home-card-item-title,
.home-card-item-tip {
font-size: 13px;
@ -357,8 +378,8 @@ export default {
}
}
.home-card-first {
background: white;
border: 1px solid #ebeef5;
background: var(--el-color-white);
border: 1px solid var(--el-border-color-light, #ebeef5);
display: flex;
align-items: center;
img {
@ -371,9 +392,12 @@ export default {
flex: 1;
display: flex;
flex-direction: column;
.home-card-first-right-title {
color: var(--el-color-black);
}
.home-card-first-right-msg {
font-size: 13px;
color: gray;
color: var(--el-text-color-secondary);
}
}
}
@ -387,6 +411,7 @@ export default {
margin: auto;
height: auto;
text-align: center;
color: var(--el-text-color-primary);
}
}
}
@ -416,12 +441,12 @@ export default {
}
.home-dynamic-item-left-time2 {
font-size: 13px;
color: gray;
color: var(--el-text-color-secondary);
}
}
.home-dynamic-item-line {
height: 60px;
border-right: 2px dashed #dfdfdf;
border-right: 2px dashed var(--el-border-color-light, #ebeef5);
margin: 0 20px;
position: relative;
i {
@ -431,7 +456,7 @@ export default {
top: 1px;
left: -6px;
transform: rotate(46deg);
background: white;
background: var(--el-color-white);
}
}
.home-dynamic-item-right {
@ -439,7 +464,7 @@ export default {
.home-dynamic-item-right-title {
i {
margin-right: 5px;
border: 1px solid #dfdfdf;
border: 1px solid var(--el-border-color-light, #ebeef5);
width: 20px;
height: 20px;
border-radius: 100%;
@ -450,7 +475,7 @@ export default {
}
.home-dynamic-item-right-label {
font-size: 13px;
color: gray;
color: var(--el-text-color-secondary);
}
}
}

View File

@ -27,6 +27,7 @@
<Scan v-else />
<div class="login-content-main-sacn" @click="isScan = !isScan">
<i class="iconfont" :class="isScan ? 'icon-diannao1' : 'icon-barcode-qr'"></i>
<div class="login-content-main-sacn-delta"></div>
</div>
</div>
</div>
@ -114,40 +115,43 @@ export default {
letter-spacing: 4px;
margin: 15px 0 30px;
white-space: nowrap;
z-index: 5;
position: relative;
transition: all 0.3s ease;
}
}
.login-content-main-sacn {
position: absolute;
top: 0;
right: 0;
width: 51px;
width: 50px;
height: 50px;
overflow: hidden;
cursor: pointer;
opacity: 0.7;
transition: all ease 0.3s;
&::before {
content: '';
&-delta {
position: absolute;
width: 0;
height: 0;
border-bottom: 50px solid #ffffff;
border-right: 50px solid transparent;
width: 35px;
height: 70px;
z-index: 2;
top: 2px;
right: 21px;
background: var(--el-color-white);
transform: rotate(-45deg);
}
&:hover {
opacity: 1;
transition: all ease 0.3s;
color: var(--color-primary);
}
i {
content: '';
width: 50px;
width: 47px;
height: 50px;
display: inline-block;
font-size: 48px;
position: absolute;
top: -2px;
right: 0px;
font-size: 50px;
z-index: 1;
right: 2px;
top: -1px;
}
}
}
@ -160,7 +164,7 @@ export default {
transform: translateX(-50%);
bottom: 30px;
text-align: center;
color: white;
color: var(--color-whites);
font-size: 12px;
opacity: 0.8;
.login-copyright-company {

View File

@ -0,0 +1,159 @@
<template>
<div class="dynamic-form-container">
<el-card shadow="hover" header="动态复杂表单">
<el-form :model="form" ref="formRulesOneRef" size="small" label-width="100px" class="mt35">
<el-row :gutter="35">
<el-col
:xs="val.xs"
:sm="val.sm"
:md="val.md"
:lg="val.md"
:xl="val.xl"
class="mb20"
v-show="val.isShow"
v-for="(val, key) in formData"
:key="key"
>
<template v-if="val.type !== ''">
<el-form-item
:label="val.label"
:prop="val.prop"
:rules="[{ required: val.required, message: `${val.label}不能为空`, trigger: val.type === 'input' ? 'blur' : 'change' }]"
v-if="val.type !== ''"
>
<el-input
v-model="form[val.prop]"
:placeholder="val.placeholder"
clearable
v-if="val.type === 'input'"
style="width: 100%"
:disabled="val.disabled"
></el-input>
<el-date-picker
v-model="form[val.prop]"
type="date"
:placeholder="val.placeholder"
v-else-if="val.type === 'date'"
style="width: 100%"
:disabled="val.disabled"
>
</el-date-picker>
<el-select
v-model="form[val.prop]"
:placeholder="val.placeholder"
v-else-if="val.type === 'select'"
style="width: 100%"
:disabled="val.disabled"
>
<el-option v-for="item in val.options" :key="item.value" :label="item.label" :value="item.value"> </el-option>
</el-select>
<el-input
type="textarea"
v-model="form[val.prop]"
:placeholder="val.placeholder"
clearable
v-if="val.type === 'textarea'"
style="width: 100%"
:disabled="val.disabled"
></el-input>
</el-form-item>
</template>
<template v-else>
<el-row :gutter="35" v-for="(v, k) in form.list" :key="k">
<el-col :xs="24" :sm="12" :md="8" :lg="8" :xl="6" class="mb20">
<el-form-item label="年度" :prop="`list[${k}].year`" :rules="[{ required: true, message: `年度不能为空`, trigger: 'blur' }]">
<template #label>
<el-button type="primary" icon="el-icon-plus" circle size="mini" @click="onAddRow" v-if="k === 0"></el-button>
<el-button type="danger" icon="el-icon-delete" circle size="mini" @click="onDelRow(k)" v-else></el-button>
<span class="ml10">年度</span>
</template>
<el-input v-model="form.list[k].year" style="width: 100%" placeholder="请输入"> </el-input>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="8" :lg="8" :xl="6" class="mb20">
<el-form-item label="月度" :prop="`list[${k}].month`" :rules="[{ required: true, message: `月度不能为空`, trigger: 'blur' }]">
<el-input v-model="form.list[k].month" style="width: 100%" placeholder="请输入"> </el-input>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="8" :lg="8" :xl="6" class="mb20">
<el-form-item label="日度" :prop="`list[${k}].day`" :rules="[{ required: true, message: `日度不能为空`, trigger: 'blur' }]">
<el-input v-model="form.list[k].day" style="width: 100%" placeholder="请输入"> </el-input>
</el-form-item>
</el-col>
</el-row>
</template>
</el-col>
</el-row>
</el-form>
</el-card>
<el-row class="flex mt15">
<div class="flex-margin">
<el-button size="small" icon="el-icon-refresh-right" @click="onResetForm">重置表单</el-button>
<el-button size="small" type="primary" icon="iconfont icon-shuxing" @click="onSubmitForm">验证表单</el-button>
</div>
</el-row>
</div>
</template>
<script lang="ts">
import { toRefs, reactive, onMounted, getCurrentInstance } from 'vue';
import { formData } from './mock';
export default {
name: 'pagesDynamicForm',
setup() {
const { proxy } = getCurrentInstance() as any;
const state = reactive({
formData,
form: {
name: '',
email: '',
autograph: '',
occupation: '',
list: [
{
year: '',
month: '',
day: '',
},
],
remarks: '',
},
});
// 新增行
const onAddRow = () => {
state.form.list.push({
year: '',
month: '',
day: '',
});
};
// 删除行
const onDelRow = (k) => {
state.form.list.splice(k, 1);
};
// 表单验证
const onSubmitForm = () => {
proxy.$refs.formRulesOneRef.validate((valid) => {
if (valid) {
proxy.$message.success('验证成功');
} else {
return false;
}
});
};
// 重置表单
const onResetForm = () => {
proxy.$refs.formRulesOneRef.resetFields();
};
// 页面加载时
onMounted(() => {});
return {
onAddRow,
onDelRow,
onSubmitForm,
onResetForm,
...toRefs(state),
};
},
};
</script>

View File

@ -0,0 +1,119 @@
// 表单数据选项(自行扩展)
export const formData = [
{
label: '姓名',
prop: 'name',
placeholder: '请输入姓名',
clearable: true,
disabled: false,
required: true,
type: 'input',
i18n: false,
i18nText: '',
isShow: true,
xs: 24,
sm: 12,
md: 8,
lg: 6,
xl: 4,
},
{
label: '邮箱',
prop: 'email',
placeholder: '请输入用户邮箱',
clearable: true,
disabled: false,
required: true,
type: 'input',
i18n: false,
i18nText: '',
isShow: true,
xs: 24,
sm: 12,
md: 8,
lg: 6,
xl: 4,
},
{
label: '登陆时间',
prop: 'autograph',
placeholder: '选择时间',
clearable: true,
disabled: false,
required: true,
type: 'date',
i18n: false,
i18nText: '',
isShow: true,
xs: 24,
sm: 12,
md: 8,
lg: 6,
xl: 4,
},
{
label: '职务',
prop: 'occupation',
placeholder: '请选择职务',
clearable: true,
disabled: false,
required: true,
type: 'select',
i18n: false,
i18nText: '',
options: [
{
label: '计算机 / 互联网 / 通信',
value: '1',
},
{
label: '生产 / 工艺 / 制造',
value: '2',
},
{
label: '医疗 / 护理 / 制药',
value: '3',
},
],
isShow: true,
xs: 24,
sm: 12,
md: 8,
lg: 6,
xl: 4,
},
{
label: '',
prop: '',
placeholder: '',
clearable: true,
disabled: false,
required: true,
type: '',
i18n: false,
i18nText: '',
isShow: true,
xs: 24,
sm: 24,
md: 24,
lg: 24,
xl: 24,
},
{
label: '备注',
prop: 'remarks',
placeholder: '请输入',
clearable: true,
disabled: false,
required: true,
type: 'textarea',
i18n: false,
i18nText: '',
isShow: true,
xs: 24,
sm: 24,
md: 24,
lg: 24,
xl: 24,
},
];

View File

@ -21,8 +21,13 @@ export default {
// 设置主内容的高度
const initTagViewHeight = computed(() => {
let { isTagsview } = store.state.themeConfig.themeConfig;
if (isTagsview) return `114px`;
else return `80px`;
let { isTagsViewCurrenFull } = store.state.tagsViewRoutes;
if (isTagsViewCurrenFull) {
return `30px`;
} else {
if (isTagsview) return `114px`;
else return `80px`;
}
});
return {
initTagViewHeight,

View File

@ -21,8 +21,13 @@ export default {
// 设置主内容的高度
const initTagViewHeight = computed(() => {
let { isTagsview } = store.state.themeConfig.themeConfig;
if (isTagsview) return `114px`;
else return `80px`;
let { isTagsViewCurrenFull } = store.state.tagsViewRoutes;
if (isTagsViewCurrenFull) {
return `30px`;
} else {
if (isTagsview) return `114px`;
else return `80px`;
}
});
return {
initTagViewHeight,

View File

@ -145,12 +145,12 @@ export default {
const onTableItemClick = (v: object) => {
if (v.id === 1) {
router.push({
path: '/pages/filteringDetails',
path: '/pages/filtering/details',
query: { id: v.id },
});
} else {
router.push({
path: '/pages/filteringDetails1',
path: '/pages/filtering/details1',
query: { id: v.id },
});
}

View File

@ -0,0 +1,67 @@
<template>
<div class="form-rules-one-container">
<el-form :model="form" :rules="rules" ref="formRulesOneRef" size="small" label-width="100px" class="mt35">
<el-row :gutter="35">
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4" class="mb20">
<el-form-item label="姓名" prop="name">
<el-input v-model="form.name" placeholder="请输入姓名" clearable></el-input>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4" class="mb20">
<el-form-item label="邮箱" prop="email">
<el-input v-model="form.email" placeholder="请输入用户邮箱" clearable></el-input>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4" class="mb20">
<el-form-item label="登陆账户名" prop="autograph">
<el-input v-model="form.autograph" placeholder="请输入登陆账户名" clearable></el-input>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4" class="mb20">
<el-form-item label="职务" prop="occupation">
<el-select v-model="form.occupation" placeholder="请选择职务" clearable class="w100">
<el-option label="计算机 / 互联网 / 通信" value="1"></el-option>
<el-option label="生产 / 工艺 / 制造" value="2"></el-option>
<el-option label="医疗 / 护理 / 制药" value="3"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</template>
<script lang="ts">
import { toRefs, reactive, onMounted } from 'vue';
export default {
name: 'pagesFormRulesOne',
props: {
data: {
type: Object,
default: () => {},
},
},
setup(props) {
const state = reactive({
form: {},
rules: {
name: { required: true, message: '请输入姓名', trigger: 'blur' },
email: { required: true, message: '请输入用户邮箱', trigger: 'blur' },
autograph: { required: true, message: '请输入登陆账户名', trigger: 'blur' },
occupation: { required: true, message: '请选择职务', trigger: 'change' },
},
});
// 赋值回显
const initForm = () => {
state.form = props.data;
};
// 页面加载时
onMounted(() => {
initForm();
});
return {
...toRefs(state),
};
},
};
</script>

View File

@ -0,0 +1,49 @@
<template>
<div class="form-rules-three-container">
<el-form :model="form" :rules="rules" ref="formRulesThreeRef" size="small" label-width="100px" class="mt35">
<el-row :gutter="35">
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4" class="mb20">
<el-form-item label="创建用户" prop="createUser">
<el-input v-model="form.createUser" placeholder="请输入创建用户" clearable></el-input>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4" class="mb20">
<el-form-item label="修改用户" prop="editUser">
<el-input v-model="form.editUser" placeholder="请输入修改用户" clearable></el-input>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4" class="mb20">
<el-form-item label="所属用户" prop="user">
<el-input v-model="form.user" placeholder="请输入所属用户" clearable></el-input>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4" class="mb20">
<el-form-item label="所属部门" prop="department">
<el-input v-model="form.department" placeholder="请输入所属部门" clearable></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</template>
<script lang="ts">
import { toRefs, reactive } from 'vue';
export default {
name: 'pagesFormRulesThree',
setup() {
const state = reactive({
form: {},
rules: {
createUser: { required: true, message: '请输入创建用户', trigger: 'blur' },
editUser: { required: true, message: '请输入修改用户', trigger: 'blur' },
user: { required: true, message: '请输入所属用户', trigger: 'blur' },
department: { required: true, message: '请输入所属部门', trigger: 'blur' },
},
});
return {
...toRefs(state),
};
},
};
</script>

View File

@ -0,0 +1,51 @@
<template>
<div class="form-rules-two-container">
<el-form :model="form" :rules="rules" ref="formRulesTwoRef" size="small" label-width="100px" class="mt35">
<el-row :gutter="35">
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4" class="mb20">
<el-form-item label="手机" prop="phone">
<el-input v-model="form.phone" placeholder="请输入手机" clearable></el-input>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4" class="mb20">
<el-form-item label="性别">
<el-select v-model="form.sex" placeholder="请选择性别" clearable class="w100">
<el-option label="男" value="1"></el-option>
<el-option label="女" value="2"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4" class="mb20">
<el-form-item label="登录密码" prop="password">
<el-input v-model="form.password" placeholder="请输入登录密码" clearable></el-input>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4" class="mb20">
<el-form-item label="权限角色" prop="auth">
<el-input v-model="form.auth" placeholder="请输入权限角色" clearable></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</template>
<script lang="ts">
import { toRefs, reactive } from 'vue';
export default {
name: 'pagesFormRulesTwo',
setup() {
const state = reactive({
form: {},
rules: {
phone: { required: true, message: '请输入手机', trigger: 'blur' },
password: { required: true, message: '请输入登录密码', trigger: 'blur' },
auth: { required: true, message: '请输入权限角色', trigger: 'blur' },
},
});
return {
...toRefs(state),
};
},
};
</script>

View File

@ -0,0 +1,73 @@
<template>
<div class="form-rules-container">
<el-card shadow="hover" header="表单组件1"> <FormRulesOne :data="formRulesOneData" ref="pagesFormRulesOneRef" /></el-card>
<el-card shadow="hover" header="表单组件2" class="mt15"><FormRulesTwo ref="pagesFormRulesTwoRef" /> </el-card>
<el-card shadow="hover" header="表单组件3" class="mt15"> <FormRulesThree ref="pagesFormRulesThreeRef" /></el-card>
<el-row class="flex mt15">
<div class="flex-margin">
<el-button size="small" icon="el-icon-refresh-right" @click="onResetForm">重置表单</el-button>
<el-button size="small" type="primary" icon="iconfont icon-shuxing" @click="onSubmitForm">验证表单</el-button>
</div>
</el-row>
</div>
</template>
<script lang="ts">
import { toRefs, reactive, defineComponent, getCurrentInstance } from 'vue';
import { ElMessage } from 'element-plus';
import FormRulesOne from '/@/views/pages/formRules/component/formRulesOne.vue';
import FormRulesTwo from '/@/views/pages/formRules/component/formRulesTwo.vue';
import FormRulesThree from '/@/views/pages/formRules/component/formRulesThree.vue';
export default defineComponent({
name: 'pagesFormRules',
components: {
FormRulesOne,
FormRulesTwo,
FormRulesThree,
},
setup() {
const { proxy } = getCurrentInstance() as any;
const state = reactive({
formRulesOneData: {
name: 'lyt',
email: 'lyt123@.com',
autograph: 'lyt123456',
occupation: '1',
},
});
// 表单组件验证
const formRulesValidate = (pageRef, sonRef) => {
return new Promise((resolve) => {
proxy.$refs[pageRef].$refs[sonRef].validate((valid) => {
if (valid) resolve(valid);
});
});
};
// 表单组件重置
const formRulesResetFields = () => {
proxy.$refs.pagesFormRulesOneRef.$refs.formRulesOneRef.resetFields();
proxy.$refs.pagesFormRulesTwoRef.$refs.formRulesTwoRef.resetFields();
proxy.$refs.pagesFormRulesThreeRef.$refs.formRulesThreeRef.resetFields();
};
// 验证表单
const onSubmitForm = () => {
Promise.all([
formRulesValidate('pagesFormRulesOneRef', 'formRulesOneRef'),
formRulesValidate('pagesFormRulesTwoRef', 'formRulesTwoRef'),
formRulesValidate('pagesFormRulesThreeRef', 'formRulesThreeRef'),
]).then(() => {
ElMessage.success('表单全部验证成功');
});
};
// 重置表单
const onResetForm = () => {
formRulesResetFields();
};
return {
onSubmitForm,
onResetForm,
...toRefs(state),
};
},
});
</script>

View File

@ -45,7 +45,7 @@ export default {
.waterfall-first-item {
width: 100%;
background: var(--color-primary);
color: #ffffff;
color: var(--color-whites);
transition: all 0.3s ease;
border-radius: 3px;
&:nth-of-type(3n + 1) {
@ -73,7 +73,7 @@ export default {
.waterfall-last-item {
height: 100%;
background: var(--color-primary);
color: #ffffff;
color: var(--color-whites);
transition: all 0.3s ease;
border-radius: 3px;
&:hover {

View File

@ -89,7 +89,7 @@ export default {
.waterfall-first-item {
width: 100%;
background: var(--color-primary);
color: #ffffff;
color: var(--color-whites);
transition: all 0.3s ease;
border-radius: 3px;
&:nth-of-type(3n + 1) {

View File

@ -0,0 +1,106 @@
<template>
<transition name="el-zoom-in-center">
<div
aria-hidden="true"
class="el-dropdown__popper el-popper is-light is-pure custom-contextmenu"
role="tooltip"
data-popper-placement="bottom"
:style="`top: ${dropdowns.y + 5}px;left: ${dropdowns.x}px;`"
:key="Math.random()"
v-show="isShow"
>
<ul class="el-dropdown-menu">
<li
v-for="(v, k) in dropdownList"
class="el-dropdown-menu__item"
aria-disabled="false"
tabindex="-1"
:key="k"
@click="onCurrentClick(v.contextMenuClickId)"
>
<i :class="v.icon"></i>
<span>{{ v.txt }}{{ item.type === 'line' ? '线' : '节点' }}</span>
</li>
</ul>
<div class="el-popper__arrow" style="left: 10px"></div>
</div>
</transition>
</template>
<script lang="ts">
import { computed, defineComponent, reactive, toRefs, onMounted, onUnmounted } from 'vue';
export default defineComponent({
name: 'pagesWorkflowContextmenu',
props: {
dropdown: {
type: Object,
},
},
setup(props, { emit }) {
const state = reactive({
isShow: false,
dropdownList: [
{ contextMenuClickId: 0, txt: '删除', icon: 'el-icon-delete' },
{ contextMenuClickId: 1, txt: '编辑', icon: 'el-icon-edit-outline' },
],
item: {
type: 'node',
},
conn: {},
});
// 父级传过来的坐标 x,y 值
const dropdowns = computed(() => {
return props.dropdown;
});
// 当前项菜单点击
const onCurrentClick = (contextMenuClickId: number) => {
emit('current', Object.assign({}, { contextMenuClickId }, state.item), state.conn);
};
// 打开右键菜单:判断是否固定,固定则不显示关闭按钮
const openContextmenu = (item: any, conn = {}) => {
state.item = item;
state.conn = conn;
closeContextmenu();
setTimeout(() => {
state.isShow = true;
}, 10);
};
// 关闭右键菜单
const closeContextmenu = () => {
state.isShow = false;
};
// 监听页面监听进行右键菜单的关闭
onMounted(() => {
document.body.addEventListener('click', closeContextmenu);
document.body.addEventListener('contextmenu', closeContextmenu);
});
// 页面卸载时,移除右键菜单监听事件
onUnmounted(() => {
document.body.removeEventListener('click', closeContextmenu);
document.body.removeEventListener('contextmenu', closeContextmenu);
});
return {
dropdowns,
openContextmenu,
closeContextmenu,
onCurrentClick,
...toRefs(state),
};
},
});
</script>
<style scoped lang="scss">
.custom-contextmenu {
transform-origin: center top;
z-index: 2190;
position: fixed;
.el-dropdown-menu__item {
font-size: 12px !important;
white-space: nowrap;
i {
font-size: 12px !important;
}
}
}
</style>

View File

@ -0,0 +1,36 @@
<template>
<el-drawer :title="`${nodeData.type === 'line' ? '线' : '节点'}操作`" v-model="isOpen" size="320px">
<el-scrollbar>
<pre>{{ nodeData }}</pre>
</el-scrollbar>
</el-drawer>
</template>
<script lang="ts">
import { defineComponent, reactive, toRefs } from 'vue';
export default defineComponent({
name: 'pagesWorkflowDrawer',
setup() {
const state = reactive({
isOpen: false,
nodeData: {
type: 'node',
},
});
// 打开抽屉
const open = (item) => {
state.nodeData = item;
state.isOpen = true;
};
// 关闭
const close = () => {
state.isOpen = false;
};
return {
open,
close,
...toRefs(state),
};
},
});
</script>

View File

@ -0,0 +1,91 @@
// jsplumb 默认配置
export const jsplumbDefaults = {
// 多个锚点 [源锚点,目标锚点]
Anchors: [
'Top',
'TopCenter',
'TopRight',
'TopLeft',
'Right',
'RightMiddle',
'Bottom',
'BottomCenter',
'BottomRight',
'BottomLeft',
'Left',
'LeftMiddle',
],
// 连线的容器id
Container: 'workflow-right',
// 设置链接线的形状如直线或者曲线之类的。anchor可以去设置锚点的位置。可选值"<Bezier|Flowchart|StateMachine|Straight>"
Connector: ['Bezier', { curviness: 100 }],
// 节点是否可以用鼠标拖动使其断开默认为true。即用鼠标链接上的连线也可以使用鼠标拖动让其断开。设置成false可以让其拖动也不会自动断开
ConnectionsDetachable: false,
// 删除线的时候节点不删除
DeleteEndpointsOnDetach: false,
// 每当添加或以其他方式创建 Endpoint 并且 jsPlumb 尚未给出任何明确的 Endpoint 定义时将使用
Endpoint: ['Blank', { Overlays: '' }],
// 连接中源和目标端点的默认外观
EndpointStyle: { fill: '#1879ffa1', outlineWidth: 1 },
// jsPlumb 的内部日志记录是否打开
LogEnabled: true,
// 连接器的默认外观
PaintStyle: {
stroke: '#E0E3E7',
strokeWidth: 1,
outlineStroke: 'transparent',
outlineWidth: 10,
},
// 用于配置任何可拖动元素的默认选项jsPlumb.draggable
DragOptions: { cursor: 'pointer', zIndex: 2000 },
// 添加到连接器和端点的默认叠加层。已弃用:从 4.x 开始,将不支持此功能。并非所有叠加层都可以连接到连接器和端点。
Overlays: [
[
'Arrow',
{
width: 10, // 箭头尾部的宽度
length: 8, // 从箭头的尾部到头部的距离
location: 1, // 位置建议使用01之间
direction: 1, // 方向默认值为1表示向前可选-1表示向后
foldback: 0.623, // 折回也就是尾翼的角度默认0.623当为1时为正三角
},
],
[
'Label',
{
label: '',
location: 0.5,
cssClass: 'aLabel',
},
],
],
// 默认渲染模式 svg、canvas
RenderMode: 'svg',
// 悬停状态下连接的默认外观
HoverPaintStyle: { stroke: '#b0b2b5', strokeWidth: 1 },
// 悬停状态下端点的默认外观
EndpointHoverStyle: { fill: 'red' },
// 端点和连接的默认范围。范围提供了对哪些端点可以连接到哪些其他端点的基本控制
Scope: 'jsPlumb_DefaultScope',
};
// 整个节点作为source或者target
export const jsplumbMakeSource = {
// 设置可以拖拽的类名只要鼠标移动到该类名上的DOM就可以拖拽连线
filter: '.workflow-icon-drag',
filterExclude: false,
anchor: 'Continuous',
// 是否允许自己连接自己
allowLoopback: true,
maxConnections: -1,
};
// 整个节点作为source或者target
export const jsplumbMakeMakeTarget = {
filter: '.workflow-icon-drag',
filterExclude: false,
// 是否允许自己连接自己
anchor: 'Continuous',
allowLoopback: true,
dropOptions: { hoverClass: 'ef-drop-hover' },
};

View File

@ -0,0 +1,436 @@
<template>
<div class="workflow-form-container">
<div class="layout-view-bg-white flex" :style="{ height: `calc(100vh - ${setViewHeight}` }">
<div class="workflow">
<!-- 顶部工具栏 -->
<div class="workflow-tool">
<div class="pl15">{{ setToolTitle }}</div>
<div class="workflow-tool-right">
<div class="workflow-tool-icon">
<i class="el-icon-warning-outline"></i>
</div>
<div class="workflow-tool-icon">
<i class="el-icon-download"></i>
</div>
<div class="workflow-tool-icon">
<i class="el-icon-video-play"></i>
</div>
<div class="workflow-tool-icon">
<i class="el-icon-full-screen"></i>
</div>
<div class="workflow-tool-icon">
<i class="el-icon-printer"></i>
</div>
</div>
</div>
<!-- 左侧导航区 -->
<div class="workflow-content">
<div id="workflow-left">
<el-scrollbar>
<div
:id="`left${key}`"
v-for="(val, key) in leftNavList"
:key="key"
:style="{ height: val.isOpen ? 'auto' : '50px', overflow: 'hidden' }"
class="workflow-left-id"
>
<div class="workflow-left-title" @click="onTitleClick(val)">
<span>{{ val.title }}</span>
<i :class="val.isOpen ? 'el-icon-arrow-down' : 'el-icon-arrow-right'"></i>
</div>
<div class="workflow-left-item" v-for="(v, k) in val.children" :key="k" :data-name="v.name" :data-icon="v.icon">
<div class="workflow-left-item-icon">
<i :class="v.icon" class="workflow-icon-drag"></i>
<div class="font10 pl5 name">{{ v.name }}</div>
</div>
</div>
</div>
</el-scrollbar>
</div>
<!-- 右侧绘画区 -->
<div id="workflow-right">
<div
v-for="(v, k) in nodeList"
:key="k"
:id="v.nodeId"
:class="v.class"
:style="{ left: v.left, top: v.top }"
@click="onItemCloneClick(k)"
@contextmenu.prevent="onContextmenu(v, k, $event)"
>
<div class="workflow-right-box" :class="{ 'workflow-right-active': nodeIndex === k }">
<div class="workflow-left-item-icon">
<i class="workflow-icon-drag" :class="v.icon"></i>
<div class="font10 pl5 name">{{ v.name }}</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- 节点右键菜单 -->
<Contextmenu :dropdown="dropdownNode" ref="contextmenuNodeRef" @current="onCurrentNodeClick" />
<!-- 线右键菜单 -->
<Contextmenu :dropdown="dropdownLine" ref="contextmenuLineRef" @current="onCurrentLineClick" />
<!-- 弹窗表单线 -->
<Drawer ref="drawerRef" />
</div>
</template>
<script lang="ts">
import { defineComponent, toRefs, reactive, computed, onMounted, nextTick, ref } from 'vue';
import { ElMessage } from 'element-plus';
import { jsPlumb } from 'jsplumb';
import Sortable from 'sortablejs';
import { useStore } from '/@/store/index';
import Contextmenu from './component/contextmenu/index.vue';
import Drawer from './component/drawer/index.vue';
import { leftNavList } from './mock';
import { jsplumbDefaults, jsplumbMakeSource, jsplumbMakeMakeTarget } from './config';
export default defineComponent({
name: 'pagesWorkflow',
components: { Contextmenu, Drawer },
setup() {
const contextmenuNodeRef = ref();
const contextmenuLineRef = ref();
const drawerRef = ref();
const store = useStore();
const state = reactive({
leftNavList: [],
jsPlumb: null,
nodeList: [],
nodeIndex: null,
dropdownNode: { x: '', y: '' },
dropdownLine: { x: '', y: '' },
jsplumbDefaults,
jsplumbMakeSource,
jsplumbMakeMakeTarget,
});
// 设置 view 的高度
const setViewHeight = computed(() => {
let { isTagsview } = store.state.themeConfig.themeConfig;
let { isTagsViewCurrenFull } = store.state.tagsViewRoutes;
if (isTagsViewCurrenFull) {
return `30px`;
} else {
if (isTagsview) return `114px`;
else return `80px`;
}
});
// 设置 tool 标题
const setToolTitle = computed(() => {
let { globalTitle } = store.state.themeConfig.themeConfig;
return `${globalTitle}工作流`;
});
// 左侧导航-数据初始化
const initLeftNavList = () => {
state.leftNavList = leftNavList;
};
// 左侧导航-初始化拖动
const initSortable = () => {
state.leftNavList.forEach((v, k) => {
Sortable.create(document.getElementById(`left${k}`), {
group: { name: 'vue-next-admin-1', pull: 'clone', put: false },
animation: 0,
sort: false,
draggable: '.workflow-left-item',
forceFallback: true,
onEnd: function (evt) {
const { name, icon } = evt.clone.dataset;
const { layerX, layerY, clientX, clientY } = evt.originalEvent;
const el = document.querySelector('#workflow-right') as HTMLElement;
const { x, y, width, height } = el.getBoundingClientRect();
if (clientX < x || clientX > width + x || clientY < y || y > y + height) {
ElMessage({ type: 'warning', message: '请把节点拖入到画布中' });
} else {
// 节点id唯一
const nodeId = Math.random().toString(36).substr(2, 12);
// 处理节点数据
const node = {
nodeId,
left: `${layerX - 40}px`,
top: `${layerY - 15}px`,
class: 'workflow-right-clone',
cloneItem: evt.clone.innerHTML,
name,
icon,
};
// 右侧视图内容数组
state.nodeList.push(node);
// 元素加载完毕时
nextTick(() => {
// 整个节点作为source或者target
state.jsPlumb.makeSource(nodeId, state.jsplumbMakeSource);
// 整个节点作为source或者target
state.jsPlumb.makeTarget(nodeId, state.jsplumbMakeMakeTarget);
// 设置节点可以拖拽此处为id值非class
state.jsPlumb.draggable(nodeId, {
containment: 'parent',
stop: (el) => {
state.nodeList.forEach((v) => {
if (v.nodeId === el.el.id) {
// 节点x, y重新赋值防止再次从左侧导航中拖拽节点时x, y恢复默认
v.left = `${el.pos[0]}px`;
v.top = `${el.pos[1]}px`;
}
});
},
});
});
}
},
});
});
};
// 左侧导航-菜单标题点击
const onTitleClick = (val) => {
val.isOpen = !val.isOpen;
};
// 右侧内容区-当前项点击
const onItemCloneClick = (k) => {
state.nodeIndex = k;
};
// 右侧内容区-当前项右键菜单点击
const onContextmenu = (v, k, e) => {
state.nodeIndex = k;
const { clientX, clientY } = e;
state.dropdownNode.x = clientX;
state.dropdownNode.y = clientY;
v.index = k;
v.type = 'node';
contextmenuNodeRef.value.openContextmenu(v);
};
// 右侧内容区-当前项右键菜单点击回调(节点)
const onCurrentNodeClick = (item) => {
const { index, contextMenuClickId, name } = item;
state.leftNavList.map((v) => {
v.children.map((v) => {
if (v.name === name) item.form = v.form;
});
});
if (contextMenuClickId === 0) state.nodeList.splice(index, 1);
else if (contextMenuClickId === 1) drawerRef.value.open(item);
};
// 右侧内容区-当前项右键菜单点击回调(线)
const onCurrentLineClick = (item, conn) => {
const { contextMenuClickId } = item;
state.leftNavList.map((v) => {
v.children.map((v) => {
if (v.name === name) item.form = v.form;
});
});
if (contextMenuClickId === 0) state.jsPlumb.deleteConnection(conn);
else if (contextMenuClickId === 1) drawerRef.value.open(item);
};
// 初始化 jsPlumb
const initJsPlumb = () => {
jsPlumb.ready(() => {
state.jsPlumb = jsPlumb.getInstance({
detachable: false,
Container: 'workflow-right',
});
// 导入默认配置
state.jsPlumb.importDefaults(state.jsplumbDefaults);
// 会使整个jsPlumb立即重绘。
state.jsPlumb.setSuspendDrawing(false, true);
// 点击线弹出右键菜单
state.jsPlumb.bind('contextmenu', (conn, originalEvent) => {
originalEvent.preventDefault();
const { clientX, clientY } = originalEvent;
state.dropdownLine.x = clientX;
state.dropdownLine.y = clientY;
const v = state.nodeList.find((v) => v.nodeId === conn.targetId);
const k = state.nodeList.findIndex((v) => v.nodeId === conn.targetId);
v.index = k;
v.type = 'line';
contextmenuLineRef.value.openContextmenu(v, conn);
});
// 连线
state.jsPlumb.bind('connection', (evt) => {
const { sourceId, targetId } = evt;
const conn = state.jsPlumb.getConnections({
source: sourceId,
target: targetId,
})[0];
conn.setLabel('同意');
conn.endpointStyle = [{ fill: '#f35958' }];
conn.style.color = 'red';
});
});
};
// 页面加载时
onMounted(async () => {
await initLeftNavList();
initSortable();
initJsPlumb();
});
return {
setViewHeight,
setToolTitle,
onTitleClick,
onItemCloneClick,
onContextmenu,
onCurrentNodeClick,
onCurrentLineClick,
contextmenuNodeRef,
contextmenuLineRef,
drawerRef,
...toRefs(state),
};
},
});
</script>
<style scoped lang="scss">
.workflow-form-container {
.workflow {
display: flex;
height: 100%;
width: 100%;
flex-direction: column;
.workflow-tool {
height: 35px;
display: flex;
align-items: center;
border-bottom: 1px solid var(--el-border-color-light, #ebeef5);
.workflow-tool-right {
flex: 1;
display: flex;
justify-content: flex-end;
}
&-icon {
padding: 0 10px;
cursor: pointer;
color: var(--bg-topBarColor);
height: 35px;
line-height: 35px;
display: flex;
align-items: center;
&:hover {
background: rgba(0, 0, 0, 0.04);
i {
display: inline-block;
animation: logoAnimation 0.3s ease-in-out;
}
}
}
}
.workflow-content {
flex: 1;
display: flex;
#workflow-left {
width: 220px;
height: 100%;
border-right: 1px solid var(--el-border-color-light, #ebeef5);
::v-deep(.el-collapse-item__content) {
padding-bottom: 0;
}
.workflow-left-title {
height: 50px;
display: flex;
align-items: center;
padding: 0 15px;
border-top: 1px solid var(--el-border-color-light, #ebeef5);
color: --el-text-color-primary;
cursor: default;
span {
flex: 1;
}
}
.workflow-left-item {
display: inline-block;
width: calc(50% - 15px);
position: relative;
cursor: move;
margin: 0 0 10px 10px;
.workflow-left-item-icon {
height: 35px;
display: flex;
align-items: center;
transition: all 0.3s ease;
padding: 5px 10px;
border: 1px dashed transparent;
background: rgba(0, 0, 0, 0.04);
border-radius: 3px;
i,
.name {
color: var(--el-text-color-secondary);
transition: all 0.3s ease;
}
&:hover {
transition: all 0.3s ease;
border: 1px dashed var(--color-primary);
background: var(--color-primary-light-9);
border-radius: 5px;
i,
.name {
transition: all 0.3s ease;
color: var(--color-primary);
}
}
}
}
& .workflow-left-id:first-of-type {
.workflow-left-title {
border-top: none;
}
}
}
#workflow-right {
flex: 1;
position: relative;
overflow: hidden;
height: 100%;
background-image: linear-gradient(90deg, rgb(156 214 255 / 15%) 10%, rgba(0, 0, 0, 0) 10%),
linear-gradient(rgb(156 214 255 / 15%) 10%, rgba(0, 0, 0, 0) 10%);
background-size: 10px 10px;
.workflow-right-clone {
position: absolute;
.workflow-right-box {
height: 35px;
align-items: center;
border: 1px solid var(--el-border-color-light, #ebeef5);
color: var(--el-text-color-secondary);
padding: 0 10px;
border-radius: 3px;
cursor: move;
transition: all 0.3s ease;
background: rgba(255, 255, 255, 0.3);
min-width: 94.5px;
.workflow-left-item-icon {
display: flex;
align-items: center;
height: 35px;
}
&:hover {
border: 1px dashed var(--color-primary);
background: var(--color-primary-light-9);
transition: all 0.3s ease;
color: var(--color-primary);
i {
cursor: Crosshair;
}
}
}
.workflow-right-active {
border: 1px dashed var(--color-primary);
background: var(--color-primary-light-9);
color: var(--color-primary);
}
}
::v-deep(.jtk-overlay):not(.aLabel) {
padding: 4px 10px;
border: 1px solid var(--el-border-color-light, #ebeef5);
color: var(--el-text-color-secondary);
background: rgba(255, 255, 255, 1);
border-radius: 3px;
font-size: 10px;
}
}
}
}
}
</style>

View File

@ -0,0 +1,171 @@
// 左侧菜单导航数据
export const leftNavList = [
{
title: '录像',
icon: 'el-icon-video-camera-solid',
isOpen: true,
id: 1,
children: [
{
icon: 'el-icon-s-custom',
name: '小米',
id: 11,
form: [
{
type: 'input',
label: '活动名称1',
prop: 'name',
},
],
},
{
icon: 'el-icon-s-opportunity',
name: '超小米',
id: 12,
form: [
{
type: 'input',
label: '活动名称2',
prop: 'name',
},
],
},
{
icon: 'el-icon-s-data',
name: '中米',
id: 13,
form: [
{
type: 'input',
label: '活动名称3',
prop: 'name',
},
],
},
{
icon: 'el-icon-s-check',
name: '大米',
id: 14,
form: [
{
type: 'input',
label: '活动名称4',
prop: 'name',
},
],
},
{
icon: 'el-icon-s-grid',
name: '超大米',
id: 15,
form: [
{
type: 'input',
label: '活动名称5',
prop: 'name',
},
],
},
{
icon: 'el-icon-menu',
name: '紫米',
id: 16,
form: [
{
type: 'input',
label: '活动名称6',
prop: 'name',
},
],
},
],
},
{
title: '文本',
isOpen: true,
icon: 'el-icon-s-order',
id: 2,
children: [
{
icon: 'el-icon-share',
name: '红米',
id: 21,
form: [
{
type: 'input',
label: '活动名称7',
prop: 'name',
},
],
},
{
icon: 'el-icon-s-shop',
name: '粉米',
id: 22,
form: [
{
type: 'input',
label: '活动名称8',
prop: 'name',
},
],
},
{
icon: 'el-icon-s-marketing',
name: '黑米',
id: 23,
form: [
{
type: 'input',
label: '活动名称9',
prop: 'name',
},
],
},
],
},
{
title: '电视',
isOpen: true,
icon: 'el-icon-s-platform',
id: 3,
children: [
{
icon: 'el-icon-s-flag',
name: '白米',
id: 31,
form: [
{
type: 'input',
label: '活动名称10',
prop: 'name',
},
],
},
{
icon: 'el-icon-s-comment',
name: '绿米',
id: 32,
form: [
{
type: 'input',
label: '活动名称11',
prop: 'name',
},
],
},
{
icon: 'iconfont icon-fangkuang',
name: '蓝米',
id: 33,
form: [
{
type: 'input',
label: '活动名称12',
prop: 'name',
},
],
},
],
},
];

View File

@ -23,8 +23,13 @@ export default defineComponent({
// 设置 view 的高度
const setViewHeight = computed(() => {
let { isTagsview } = store.state.themeConfig.themeConfig;
if (isTagsview) return `114px`;
else return `80px`;
let { isTagsViewCurrenFull } = store.state.tagsViewRoutes;
if (isTagsViewCurrenFull) {
return `30px`;
} else {
if (isTagsview) return `114px`;
else return `80px`;
}
});
// 页面加载时
onMounted(() => {

View File

@ -1,9 +1,10 @@
<template>
<div class="layout-view-bg-white flex" :style="{ height: `calc(100vh - ${setViewHeight}` }">
<div class="flex-margin">
<el-result icon="success" title="普通路由" subTitle="请根据提示进行操作">
<el-result icon="success" title="普通路由" subTitle="可 `开启 TagsView 共用` 进行单标签测试">
<template #extra>
<el-button type="primary" size="small" icon="iconfont icon-putong" @click="onGoDetailsClick">点击测试普通路由传参</el-button>
<el-input v-model="value" placeholder="请输入路由参数id值" clearable></el-input>
<el-button type="primary" size="small" icon="iconfont icon-putong" class="mt15" @click="onGoDetailsClick">普通路由传参</el-button>
</template>
</el-result>
</div>
@ -18,23 +19,28 @@ export default defineComponent({
name: 'paramsCommon',
setup() {
const store = useStore();
const state = reactive({});
const state = reactive({
value: '',
});
const router = useRouter();
// 设置 view 的高度
const setViewHeight = computed(() => {
let { isTagsview } = store.state.themeConfig.themeConfig;
if (isTagsview) return `114px`;
else return `80px`;
let { isTagsViewCurrenFull } = store.state.tagsViewRoutes;
if (isTagsViewCurrenFull) {
return `30px`;
} else {
if (isTagsview) return `114px`;
else return `80px`;
}
});
// 跳转到详情
const onGoDetailsClick = () => {
router.push({
path: '/params/common/details',
query: {
t: new Date().getTime(),
id: Math.random(),
},
query: { id: state.value, name: 'vue-next-admin' },
});
state.value = '';
};
return {
setViewHeight,

View File

@ -23,8 +23,13 @@ export default defineComponent({
// 设置 view 的高度
const setViewHeight = computed(() => {
let { isTagsview } = store.state.themeConfig.themeConfig;
if (isTagsview) return `114px`;
else return `80px`;
let { isTagsViewCurrenFull } = store.state.tagsViewRoutes;
if (isTagsViewCurrenFull) {
return `30px`;
} else {
if (isTagsview) return `114px`;
else return `80px`;
}
});
// 页面加载时
onMounted(() => {

View File

@ -1,9 +1,10 @@
<template>
<div class="layout-view-bg-white flex" :style="{ height: `calc(100vh - ${setViewHeight}` }">
<div class="flex-margin">
<el-result icon="warning" title="动态路由" subTitle="请根据提示进行操作">
<el-result icon="warning" title="动态路由" subTitle="可 `开启 TagsView 共用` 进行单标签测试">
<template #extra>
<el-button type="primary" size="small" icon="iconfont icon-dongtai" @click="onGoDetailsClick">点击测试动态路由传参</el-button>
<el-input v-model="value" placeholder="请输入路由参数id值" clearable></el-input>
<el-button type="primary" size="small" icon="iconfont icon-dongtai" class="mt15" @click="onGoDetailsClick">动态路由传参</el-button>
</template>
</el-result>
</div>
@ -18,26 +19,32 @@ export default defineComponent({
name: 'paramsDynamic',
setup() {
const store = useStore();
const state = reactive({});
const state = reactive({
value: '',
});
const router = useRouter();
// 设置 view 的高度
const setViewHeight = computed(() => {
let { isTagsview } = store.state.themeConfig.themeConfig;
if (isTagsview) return `114px`;
else return `80px`;
let { isTagsViewCurrenFull } = store.state.tagsViewRoutes;
if (isTagsViewCurrenFull) {
return `30px`;
} else {
if (isTagsview) return `114px`;
else return `80px`;
}
});
// 跳转到详情
const onGoDetailsClick = () => {
// name 值为路由中的 name
const t = new Date().getTime();
const id = Math.random();
router.push({
name: 'paramsDynamicDetails',
params: {
t,
id,
t: 'vue-next-admin',
id: state.value,
},
});
state.value = '';
};
return {
setViewHeight,

View File

@ -248,7 +248,7 @@ export default {
align-items: center;
font-size: 13px;
.personal-item-label {
color: gray;
color: var(--el-text-color-secondary);
@include text-ellipsis(1);
}
.personal-item-value {
@ -260,7 +260,7 @@ export default {
.personal-info {
.personal-info-more {
float: right;
color: gray;
color: var(--el-text-color-secondary);
font-size: 13px;
&:hover {
color: var(--color-primary);
@ -278,7 +278,7 @@ export default {
.personal-info-li-title {
display: inline-block;
@include text-ellipsis(1);
color: grey;
color: var(--el-text-color-secondary);
text-decoration: none;
}
& a:hover {
@ -294,7 +294,7 @@ export default {
.personal-recommend {
position: relative;
height: 100px;
color: #ffffff;
color: var(--color-whites);
border-radius: 3px;
overflow: hidden;
cursor: pointer;
@ -330,7 +330,7 @@ export default {
.personal-edit-title {
position: relative;
padding-left: 10px;
color: #606266;
color: var(--el-text-color-regular);
&::after {
content: '';
width: 2px;
@ -343,7 +343,7 @@ export default {
}
}
.personal-edit-safe-box {
border-bottom: 1px solid #ebeef5;
border-bottom: 1px solid var(--el-border-color-light, #ebeef5);
padding: 15px 0;
.personal-edit-safe-item {
width: 100%;
@ -354,11 +354,11 @@ export default {
flex: 1;
overflow: hidden;
.personal-edit-safe-item-left-label {
color: #606266;
color: var(--el-text-color-regular);
margin-bottom: 5px;
}
.personal-edit-safe-item-left-value {
color: gray;
color: var(--el-text-color-secondary);
@include text-ellipsis(1);
margin-right: 15px;
}

View File

@ -30,9 +30,9 @@
class="mt15"
:pager-count="5"
:page-sizes="[10, 20, 30]"
:current-page="tableData.param.pageNum"
v-model:current-page="tableData.param.pageNum"
background
:page-size="tableData.param.pageSize"
v-model:page-size="tableData.param.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="tableData.total"
>
@ -84,7 +84,7 @@ export default {
};
// 分页改变
const onHandleCurrentChange = (val: number) => {
state.tableData.param.pageSize = val;
state.tableData.param.pageNum = val;
};
// 页面加载时
onMounted(() => {

View File

@ -106,6 +106,7 @@ export default defineComponent({
txt: '',
fun: 0,
},
myCharts: [],
});
// 初始化时间
const initTime = () => {
@ -233,9 +234,7 @@ export default defineComponent({
],
};
myChart.setOption(option);
window.addEventListener('resize', () => {
myChart.resize();
});
state.myCharts.push(myChart);
// 地图
const map = myChart.getModel().getComponent('bmap').getBMap();
@ -355,9 +354,7 @@ export default defineComponent({
],
};
myChart.setOption(option);
window.addEventListener('resize', () => {
myChart.resize();
});
state.myCharts.push(myChart);
};
// A级风景区对比
const initVisualizingContentLeftBottom = () => {
@ -473,9 +470,7 @@ export default defineComponent({
],
};
myChart.setOption(option);
window.addEventListener('resize', () => {
myChart.resize();
});
state.myCharts.push(myChart);
};
// 游客过夜情况
const initVisualizingContentCenterTop = () => {
@ -603,9 +598,7 @@ export default defineComponent({
],
};
myChart.setOption(option);
window.addEventListener('resize', () => {
myChart.resize();
});
state.myCharts.push(myChart);
};
// 游客驻留时长
const initVisualizingContentCenterBottom = () => {
@ -702,9 +695,7 @@ export default defineComponent({
},
};
myChart.setOption(option);
window.addEventListener('resize', () => {
myChart.resize();
});
state.myCharts.push(myChart);
};
// 当日游客趋势分析
const initVisualizingContentRightTop = () => {
@ -839,9 +830,7 @@ export default defineComponent({
],
};
myChart.setOption(option);
window.addEventListener('resize', () => {
myChart.resize();
});
state.myCharts.push(myChart);
};
// 当月游客趋势分析
const initVisualizingContentRightBottom = () => {
@ -923,20 +912,27 @@ export default defineComponent({
],
};
myChart.setOption(option);
state.myCharts.push(myChart);
};
// 批量设置 echarts resize
const initEchartsResize = () => {
window.addEventListener('resize', () => {
myChart.resize();
for (let i = 0; i < state.myCharts.length; i++) {
state.myCharts[i].resize();
}
});
};
// 页面加载时
onMounted(() => {
onMounted(async () => {
initTime();
initEchartsMap();
initVisualizingContentLeftTop();
initVisualizingContentLeftBottom();
initVisualizingContentCenterTop();
initVisualizingContentCenterBottom();
initVisualizingContentRightTop();
initVisualizingContentRightBottom();
await initEchartsMap();
await initVisualizingContentLeftTop();
await initVisualizingContentLeftBottom();
await initVisualizingContentCenterTop();
await initVisualizingContentCenterBottom();
await initVisualizingContentRightTop();
await initVisualizingContentRightBottom();
await initEchartsResize();
});
// 页面卸载时
onUnmounted(() => {
@ -975,7 +971,7 @@ $titleWidth: 240px;
left: 0;
display: flex;
align-items: center;
color: #fff;
color: var(--color-whites);
background: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.02));
z-index: 3;
.visualizing-container-head-left {
@ -1180,11 +1176,11 @@ $titleWidth: 240px;
.visualizing-container-title {
max-width: $titleWidth;
font-size: 14px;
color: #ffffff;
color: var(--color-whites);
opacity: 0.8;
padding: 0 5px;
border-bottom: 1px solid #ffffff;
border-image: linear-gradient(to right, #ffffff, rgba(22, 207, 208, 0.02)) 1 10;
border-bottom: 1px solid var(--color-whites);
border-image: linear-gradient(to right, var(--color-whites), rgba(22, 207, 208, 0.02)) 1 10;
position: relative;
i {
padding-right: 5px;
@ -1197,7 +1193,7 @@ $titleWidth: 240px;
bottom: 0;
width: 1px;
height: 10px;
background: linear-gradient(to top, #ffffff, rgba(255, 255, 255, 0.5));
background: linear-gradient(to top, var(--color-whites), rgba(255, 255, 255, 0.5));
}
}
.visualizing-container-title-colorful {

View File

@ -253,6 +253,7 @@ export default defineComponent({
dBtnActive: 0,
earth3DBtnList,
chartData4List,
myCharts: [],
});
// 初始化时间
const initTime = () => {
@ -291,9 +292,7 @@ export default defineComponent({
],
};
myChart.setOption(option);
window.addEventListener('resize', () => {
myChart.resize();
});
state.myCharts.push(myChart);
};
// 当前设备监测
const initRightChartData4 = () => {
@ -381,9 +380,7 @@ export default defineComponent({
],
};
myChart.setOption(option);
window.addEventListener('resize', () => {
myChart.resize();
});
state.myCharts.push(myChart);
};
// 近7天产品追溯扫码统计
const initRightChartData3 = () => {
@ -462,9 +459,7 @@ export default defineComponent({
],
};
myChart.setOption(option);
window.addEventListener('resize', () => {
myChart.resize();
});
state.myCharts.push(myChart);
};
// 当前任务统计
const initRightChartData6 = () => {
@ -478,7 +473,7 @@ export default defineComponent({
},
grid: {
top: 20,
right: 42,
right: 50,
bottom: 0,
left: 80,
},
@ -508,7 +503,7 @@ export default defineComponent({
data: ['施肥任务完成率', '施药任务完成率', '农事任务完成率'],
axisLabel: {
color: '#A7D6F4',
fontSize: 10,
fontSize: 12,
},
},
],
@ -516,12 +511,12 @@ export default defineComponent({
{
name: '标准化',
type: 'bar',
barWidth: 12, // 柱子宽度
barWidth: 10, // 柱子宽度
label: {
show: true,
position: 'right', // 位置
color: '#A7D6F4',
fontSize: 10,
fontSize: 12,
distance: 15, // 距离
formatter: '{c}%', // 这里是数据展示的时候显示的数据
}, // 柱子上方的数值
@ -551,9 +546,7 @@ export default defineComponent({
],
};
myChart.setOption(option);
window.addEventListener('resize', () => {
myChart.resize();
});
state.myCharts.push(myChart);
};
// 近7天投入品记录
const initRightChartData2 = () => {
@ -686,9 +679,7 @@ export default defineComponent({
],
};
myChart.setOption(option);
window.addEventListener('resize', () => {
myChart.resize();
});
state.myCharts.push(myChart);
};
// 3DEarth 地图
const init3DEarth = (globeRadius) => {
@ -751,7 +742,7 @@ export default defineComponent({
myChart.setOption(option);
};
// 监听地球大小变化
const initAddEventListener3DEarthFun = () => {
const initAddEventListener3DEarth = () => {
let w = document.body.clientWidth;
let globeRadius = 0;
if (w >= 1920) globeRadius = 100;
@ -761,22 +752,25 @@ export default defineComponent({
else if (w < 768) globeRadius = 20;
init3DEarth(globeRadius);
};
// 监听地球大小变化
const initAddEventListener3DEarth = () => {
initAddEventListener3DEarthFun();
// 批量设置 echarts resize
const initEchartsResize = () => {
initAddEventListener3DEarth();
window.addEventListener('resize', () => {
initAddEventListener3DEarthFun();
for (let i = 0; i < state.myCharts.length; i++) {
state.myCharts[i].resize();
}
initAddEventListener3DEarth();
});
};
// 页面加载时
onMounted(() => {
initAddEventListener3DEarth();
onMounted(async () => {
initTime();
initRightChartData1();
initRightChartData4();
initRightChartData3();
initRightChartData2();
initRightChartData6();
await initRightChartData1();
await initRightChartData4();
await initRightChartData3();
await initRightChartData2();
await initRightChartData6();
await initEchartsResize();
});
// 页面卸载时
onUnmounted(() => {
@ -841,7 +835,7 @@ export default defineComponent({
left: 50%;
transform: translateX(-50%);
border: 1px transparent solid;
border-image: linear-gradient(to right, #000718, #43bdf0) 1 10;
border-image: linear-gradient(to right, rgba(0, 0, 0, 0.1), #43bdf0) 1 10;
}
span {
cursor: pointer;

View File

@ -10,7 +10,7 @@ const pathResolve = (dir: string): any => {
const { VITE_PORT, VITE_OPEN, VITE_PUBLIC_PATH } = loadEnv();
const alias: Record<string, string> = {
'/@': pathResolve('/src/'),
'/@': pathResolve('./src/'),
'vue-i18n': 'vue-i18n/dist/vue-i18n.cjs.js',
};
@ -39,6 +39,7 @@ const viteConfig: UserConfig = {
outDir: 'dist',
minify: 'esbuild',
sourcemap: false,
chunkSizeWarningLimit: 1500,
},
define: {
__VUE_I18N_LEGACY_API__: JSON.stringify(false),