15 Commits

Author SHA1 Message Date
lyt
646eac1c88 'admin-21.12.12:更新修复查看CHANGELOG.md文件' 2021-12-12 21:27:33 +08:00
94af6f8e1e !15 fixed typo
Merge pull request !15 from Rehmet/master
2021-12-12 04:39:01 +00:00
f9c604ac96 update README.md. fixed typo 2021-12-11 09:52:43 +00:00
lyt
4228b58434 'admin-21.12.04:修复更新诸多内容,具体查看CHANGELOG.md文件。改动大,谨慎更新!' 2021-12-04 13:32:14 +08:00
lyt
cc7520976e 'admin-21.10.31:优化login界面组件name值重复问题' 2021-10-31 22:49:53 +08:00
lyt
e3aa4d4816 'admin-21.10.30:修复演示错误,TagsView拖拽问题,感谢群友@小明画家、@HelloWord' 2021-10-30 21:11:40 +08:00
lyt
af13922492 'admin-21.10.18:优化tagsview问题' 2021-10-18 20:32:06 +08:00
lyt
6467f57cf2 'admin-21.10.18:优化tagsview问题' 2021-10-18 20:21:22 +08:00
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
120 changed files with 6608 additions and 989 deletions

View File

@ -44,6 +44,7 @@ module.exports = {
'vue/comment-directive': 'off',
'vue/no-parsing-error': 'off',
'vue/no-deprecated-v-on-native-modifier': 'off',
'vue/multi-word-component-names': 'off',
'no-useless-escape': 'off',
'no-sparse-arrays': 'off',
'no-prototype-builtins': 'off',

View File

@ -2,6 +2,64 @@
🎉🎉🔥 `vue-next-admin` 基于 vue3.x 、Typescript、vite、Element plus 等适配手机、平板、pc 的后台开源免费模板库vue2.x 请切换 vue-prev-admin 分支)
## 1.2.1
`2021.12.12`
- 🌟 更新 依赖更新最新版本
- 🎯 优化 cropper 裁剪时卡顿问题 [#I4M2VQ](https://gitee.com/lyt-top/vue-next-admin/issues/I4M2VQ)
- 🎯 优化 Wangeditor 富文本编辑器的问题 [#I4LPC1](https://gitee.com/lyt-top/vue-next-admin/issues/I4LPC1)、[#I4LM7I](https://gitee.com/lyt-top/vue-next-admin/issues/I4LM7I)
- 🐞 修复 浏览器标题问题
- 🐞 修复 element plus svg 图标引入
- 🐞 修复 工作流不可以拖线连接问题
## 1.2.0
`2021.11.28`
- 🌟 更新 依赖更新最新版本
- 🎯 优化 深色模式
- 🎯 优化 `/@/utils` 文件夹,合并删除单一内容
- 🎯 优化 系统设置:菜单管理(新增、修改)、角色管理(新增菜单权限)、用户管理、部门管理、字典管理
- 🎯 优化 登录界面逻辑、权限管理逻辑
- 🎯 优化 同步 [vue-next-admin-images](https://gitee.com/lyt-top/vue-next-admin-images/tree/master/menu) 后端控制菜单模拟数据
- 🎉 新增 适配 Font Icon 向 SVG Icon 迁移(改动大,"element-plus": "^1.2.0-beta.4" 谨慎更新)
- 🐞 修复 热更新问题,感谢@甜蜜蜜
- 🐞 修复 页面/element 字体图标演示
- 🐞 修复 功能/图标选择器演示,新增高级功能 [issues #I4GJXQ](https://gitee.com/lyt-top/vue-next-admin/issues/I4GJXQ)
## 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`

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>
@ -90,7 +98,7 @@ cnpm run build
- <a href="https://github.com/vuejs/vue-next" target="_blank">vue-next</a>
- <a href="https://github.com/ElemeFE/element" target="_blank">element-ui</a>
- <a href="https://github.com/element-plus/element-plus" target="_blank">element-plus</a>
- <a href="https://github.com/vuejs/vue-router-next" target="_blank">vue-router-nex</a>
- <a href="https://github.com/vuejs/vue-router-next" target="_blank">vue-router-next</a>
- <a href="https://github.com/vuejs/vuex" target="_blank">vuex</a>
- <a href="https://github.com/apache/echarts" target="_blank">echarts</a>
- <a href="https://github.com/axios/axios" target="_blank">axios</a>
@ -110,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,58 +1,83 @@
{
"name": "vue-next-admin",
"version": "1.0.18",
"version": "1.2.0",
"description": "vue3 vite next admin template",
"author": "lyt_20201208",
"license": "MIT",
"scripts": {
"dev": "vite",
"dev": "vite --force",
"build": "vite build",
"lint-fix": "eslint --fix --ext .js --ext .jsx --ext .vue src/"
},
"dependencies": {
"axios": "^0.21.1",
"@element-plus/icons-vue": "^0.2.4",
"axios": "^0.24.0",
"countup.js": "^2.0.8",
"cropperjs": "^1.5.12",
"echarts": "^5.1.2",
"echarts": "^5.2.2",
"echarts-gl": "^2.0.8",
"echarts-wordcloud": "^2.0.0",
"element-plus": "^1.1.0-beta.7",
"element-plus": "^1.2.0-beta.6",
"jsplumb": "^2.15.6",
"mitt": "^3.0.0",
"nprogress": "^0.2.0",
"print-js": "^1.6.0",
"qrcodejs2-fixes": "^0.0.2",
"screenfull": "^5.1.0",
"screenfull": "^6.0.0",
"sortablejs": "^1.14.0",
"splitpanes": "^3.0.4",
"vue": "^3.2.6",
"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.11",
"vue-web-screen-shot": "^1.2.0",
"vue-i18n": "^9.1.9",
"vue-router": "^4.0.12",
"vue-web-screen-shot": "^1.3.2",
"vuex": "^4.0.2",
"wangeditor": "^4.7.7"
"wangeditor": "^4.7.10"
},
"devDependencies": {
"@types/axios": "^0.14.0",
"@types/clipboard": "^2.0.1",
"@types/node": "^16.7.5",
"@types/node": "^16.11.12",
"@types/nprogress": "^0.2.0",
"@types/sortablejs": "^1.10.7",
"@typescript-eslint/eslint-plugin": "^4.29.3",
"@typescript-eslint/parser": "^4.29.3",
"@vitejs/plugin-vue": "^1.6.0",
"@vue/compiler-sfc": "^3.2.6",
"@typescript-eslint/eslint-plugin": "^5.6.0",
"@typescript-eslint/parser": "^5.6.0",
"@vitejs/plugin-vue": "^2.0.0",
"@vue/compiler-sfc": "^3.2.26",
"dotenv": "^10.0.0",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^7.17.0",
"prettier": "^2.3.2",
"sass": "^1.38.2",
"sass-loader": "^12.1.0",
"typescript": "^4.4.2",
"vite": "^2.5.1",
"vue-eslint-parser": "^7.10.0"
"eslint": "^8.4.1",
"eslint-plugin-vue": "^8.2.0",
"prettier": "^2.5.1",
"sass": "^1.45.0",
"sass-loader": "^12.4.0",
"typescript": "^4.5.3",
"vite": "^2.7.1",
"vue-eslint-parser": "^8.0.1"
},
"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

@ -11,8 +11,8 @@
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 other from '/@/utils/other';
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';
@ -25,7 +25,6 @@ export default defineComponent({
const setingsRef = ref();
const route = useRoute();
const store = useStore();
const title = useTitle();
const state = reactive({
i18nLocale: null,
});
@ -60,6 +59,10 @@ export default defineComponent({
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监听
@ -71,7 +74,7 @@ export default defineComponent({
watch(
() => route.path,
() => {
title();
other.useTitle();
}
);
return {

View File

@ -42,6 +42,7 @@ export default {
isShowDialog: false,
cropperImg: '',
cropperImgBase64: '',
cropper: null,
});
// 打开弹窗
const openDialog = (imgs: any) => {
@ -59,12 +60,14 @@ export default {
const onCancel = () => {
closeDialog();
};
// 新增
const onSubmit = () => {};
// 更换
const onSubmit = () => {
// state.cropperImgBase64 = state.cropper.getCroppedCanvas().toDataURL('image/jpeg');
};
// 初始化cropperjs图片裁剪
const initCropper = () => {
const letImg: any = document.querySelector('.cropper-warp-left-img');
const cropper = new Cropper(letImg, {
state.cropper = new Cropper(letImg, {
viewMode: 1,
dragMode: 'none',
initialAspectRatio: 1,
@ -74,7 +77,7 @@ export default {
autoCropArea: 0.6,
zoomOnWheel: false,
crop: () => {
state.cropperImgBase64 = cropper.getCroppedCanvas().toDataURL('image/jpeg');
state.cropperImgBase64 = state.cropper.getCroppedCanvas().toDataURL('image/jpeg');
},
});
};
@ -98,12 +101,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 +127,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 +138,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,73 @@
<template>
<div class="editor-container">
<div :id="id"></div>
</div>
</template>
<script lang="ts">
import { toRefs, reactive, onMounted, watch } from 'vue';
import wangeditor from 'wangeditor';
export default {
name: 'wngEditor',
props: {
// 节点 id
id: {
type: String,
default: () => 'wangeditor',
},
// 是否禁用
isDisable: {
type: Boolean,
default: () => false,
},
// 内容框默认 placeholder
placeholder: {
type: String,
default: () => '请输入内容',
},
// 双向绑定
// 双向绑定值,字段名为固定,改了之后将不生效
// 参考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(`#${props.id}`);
state.editor.config.zIndex = 1;
state.editor.config.placeholder = props.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();
});
// 监听双向绑定值的改变
// https://gitee.com/lyt-top/vue-next-admin/issues/I4LM7I
watch(
() => props.modelValue,
(value) => {
state.editor.txt.html(value);
}
);
return {
...toRefs(state),
};
},
};
</script>

View File

@ -14,29 +14,33 @@
@blur="onIconBlur"
>
<template #prepend>
<i
:class="[
fontIconPrefix === '' ? prepend : fontIconPrefix,
{ iconfont: fontIconTabsIndex === 0 },
{ ele: fontIconTabsIndex === 1 },
{ fa: fontIconTabsIndex === 2 },
]"
<SvgIcon
:name="fontIconPrefix === '' ? prepend : fontIconPrefix"
class="font14"
></i>
v-if="fontIconPrefix === '' ? prepend?.indexOf('element') > -1 : fontIconPrefix?.indexOf('element') > -1"
/>
<i v-else :class="fontIconPrefix === '' ? prepend : fontIconPrefix" class="font14"></i>
</template>
</el-input>
</template>
<transition name="el-zoom-in-top">
<div class="icon-selector-warp" v-show="fontIconVisible">
<div class="icon-selector-warp-title">{{ title }}</div>
<div class="icon-selector-warp-title flex">
<div class="flex-auto">{{ title }}</div>
<div class="icon-selector-warp-title-tab" v-if="type === 'all'">
<span :class="{ 'span-active': fontIconType === 'ali' }" @click="onIconChange('ali')" class="ml10" title="iconfont 图标">ali</span>
<span :class="{ 'span-active': fontIconType === 'ele' }" @click="onIconChange('ele')" class="ml10" title="elementPlus 图标">ele</span>
<span :class="{ 'span-active': fontIconType === 'awe' }" @click="onIconChange('awe')" class="ml10" title="fontawesome 图标">awe</span>
</div>
</div>
<div class="icon-selector-warp-row">
<el-scrollbar>
<el-scrollbar ref="selectorScrollbarRef">
<el-row :gutter="10" v-if="fontIconSheetsFilterList.length > 0">
<el-col :xs="6" :sm="4" :md="4" :lg="4" :xl="4" @click="onColClick(v)" v-for="(v, k) in fontIconSheetsFilterList" :key="k">
<div class="icon-selector-warp-item" :class="{ 'icon-selector-active': fontIconPrefix === v }">
<div class="flex-margin">
<div class="icon-selector-warp-item-value">
<i :class="v"></i>
<SvgIcon :name="v" />
</div>
</div>
</div>
@ -61,7 +65,7 @@ export default {
// 输入框前置内容
prepend: {
type: String,
default: () => 'el-icon-thumb',
default: () => 'elementPointer',
},
// 输入框占位文本
placeholder: {
@ -104,6 +108,7 @@ export default {
},
setup(props, { emit }) {
const inputWidthRef = ref();
const selectorScrollbarRef = ref();
const state: any = reactive({
fontIconPrefix: '',
fontIconVisible: false,
@ -112,6 +117,8 @@ export default {
fontIconTabsIndex: 0,
fontIconSheetsList: [],
fontIconPlaceholder: '',
fontIconType: 'ali',
fontIconShow: true,
});
// 处理 input 获取焦点时modelValue 有值时,改变 input 的 placeholder 值
const onIconFocus = () => {
@ -153,21 +160,19 @@ export default {
});
};
// 初始化数据
const initFontIconData = async () => {
if (props.type === 'ali') {
const initFontIconData = async (type: string) => {
state.fontIconSheetsList = [];
if (type === 'ali') {
await initIconfont.ali().then((res: any) => {
state.fontIconTabsIndex = 0;
// 阿里字体图标使用 `iconfont xxx`
state.fontIconSheetsList = res.map((i) => `iconfont ${i}`);
});
} else if (props.type === 'ele') {
} else if (type === 'ele') {
await initIconfont.ele().then((res: any) => {
state.fontIconTabsIndex = 1;
state.fontIconSheetsList = res;
});
} else if (props.type === 'awe') {
} else if (type === 'awe') {
await initIconfont.awe().then((res: any) => {
state.fontIconTabsIndex = 2;
// fontawesome字体图标使用 `fa xxx`
state.fontIconSheetsList = res.map((i) => `fa ${i}`);
});
@ -177,14 +182,19 @@ export default {
state.fontIconPlaceholder = props.placeholder;
// 初始化双向绑定回显
initModeValueEcho();
// 切换时,滚动条置顶。感兴趣可以使用 keep-alive <component :is="xxx"/> 进行缓存
selectorScrollbarRef.value.wrap$.scrollTop = 0;
};
// 图标点击切换
const onIconChange = (type: string) => {
state.fontIconType = type;
initFontIconData(type);
};
// 获取当前点击的 icon 图标
const onColClick = (v: any) => {
state.fontIconPlaceholder = v;
state.fontIconVisible = false;
if (state.fontIconTabsIndex === 0) state.fontIconPrefix = `${v}`;
else if (state.fontIconTabsIndex === 1) state.fontIconPrefix = `${v}`;
else if (state.fontIconTabsIndex === 2) state.fontIconPrefix = `${v}`;
state.fontIconPrefix = v;
emit('get', state.fontIconPrefix);
emit('update:modelValue', state.fontIconPrefix);
};
@ -196,7 +206,15 @@ export default {
};
// 页面加载时
onMounted(() => {
initFontIconData();
// 判断默认进来是什么类型图标,进行 tab 回显
if (props.type === 'all') {
if (props.modelValue?.indexOf('iconfont') > -1) onIconChange('ali');
else if (props.modelValue?.indexOf('element') > -1) onIconChange('ele');
else if (props.modelValue?.indexOf('fa') > -1) onIconChange('awe');
else onIconChange('ali');
} else {
onIconChange(props.type);
}
initResize();
getInputWidth();
});
@ -209,8 +227,10 @@ export default {
);
return {
inputWidthRef,
selectorScrollbarRef,
fontIconSheetsFilterList,
onColClick,
onIconChange,
onClearFontIcon,
onIconFocus,
onIconBlur,

View File

@ -6,7 +6,7 @@
<div class="notice-bar-warp-text" ref="noticeBarTextRef" v-if="!scrollable">{{ text }}</div>
<div class="notice-bar-warp-slot" v-else><slot /></div>
</div>
<i v-if="rightIcon" class="notice-bar-warp-right-icon" :class="rightIcon" @click="onRightIconClick"></i>
<SvgIcon :name="rightIcon" v-if="rightIcon" class="notice-bar-warp-right-icon" @click="onRightIconClick" />
</div>
</div>
</template>

View File

@ -0,0 +1,28 @@
<script lang="ts">
// 渲染函数https://v3.cn.vuejs.org/guide/render-function.html
import { h, resolveComponent, defineComponent } from 'vue';
export default defineComponent({
name: 'svgIcon',
props: {
// svg 图标组件名字
name: {
type: String,
},
// svg 大小
size: {
type: Number,
},
// svg 颜色
color: {
type: String,
},
},
setup(props) {
if (props.name?.indexOf('element') > -1) {
return () => h('i', { class: 'el-icon', style: `--font-size: ${props.size};--color: ${props.color}` }, [h(resolveComponent(props.name))]);
} else {
return () => h('i', { class: props.name, style: `font-size: ${props.size};color: ${props.color}` });
}
},
});
</script>

View File

@ -4,7 +4,10 @@ export default {
home: 'home',
system: 'system',
systemMenu: 'systemMenu',
systemRole: 'systemRole',
systemUser: 'systemUser',
systemDept: 'systemDept',
systemDic: 'systemDic',
limits: 'limits',
limitsFrontEnd: 'FrontEnd',
limitsFrontEndPage: 'FrontEndPage',
@ -34,6 +37,7 @@ export default {
funScreenShort: 'screenCapture',
funGridLayout: 'Drag layout',
funSplitpanes: 'Pane splitter',
funDragVerify: 'Validator',
pagesIndex: 'pages',
pagesFiltering: 'Filtering',
pagesFilteringDetails: 'FilteringDetails',
@ -45,6 +49,8 @@ export default {
pagesFormAdapt: 'FormAdapt',
pagesFormI18n: 'FormI18n',
pagesFormRules: 'Multi form validation',
pagesDynamicForm: 'Dynamic complex form',
pagesWorkflow: 'Workflow',
pagesListAdapt: 'ListAdapt',
pagesWaterfall: 'Waterfall',
pagesSteps: 'Steps',
@ -153,6 +159,7 @@ export default {
fourIsFooter: 'Open footer',
fourIsGrayscale: 'Grey model',
fourIsInvert: 'Color weak mode',
fourIsDark: 'Dark Mode',
fourIsWartermark: 'Turn on watermark',
fourWartermarkText: 'Watermark copy',
fiveTitle: 'Other settings',

View File

@ -4,7 +4,10 @@ export default {
home: '首页',
system: '系统设置',
systemMenu: '菜单管理',
systemRole: '角色管理',
systemUser: '用户管理',
systemDept: '部门管理',
systemDic: '字典管理',
limits: '权限管理',
limitsFrontEnd: '前端控制',
limitsFrontEndPage: '页面权限',
@ -34,6 +37,7 @@ export default {
funScreenShort: 'web端自定义截屏',
funGridLayout: '拖拽布局',
funSplitpanes: '窗格拆分器',
funDragVerify: '验证器',
pagesIndex: '页面',
pagesFiltering: '过滤筛选组件',
pagesFilteringDetails: '过滤筛选组件详情',
@ -45,6 +49,8 @@ export default {
pagesFormAdapt: '表单自适应',
pagesFormI18n: '表单国际化',
pagesFormRules: '多表单验证',
pagesDynamicForm: '动态复杂表单',
pagesWorkflow: '工作流',
pagesListAdapt: '列表自适应',
pagesWaterfall: '瀑布屏',
pagesSteps: '步骤条',
@ -153,6 +159,7 @@ export default {
fourIsFooter: '开启 Footer',
fourIsGrayscale: '灰色模式',
fourIsInvert: '色弱模式',
fourIsDark: '深色模式',
fourIsWartermark: '开启水印',
fourWartermarkText: '水印文案',
fiveTitle: '其它设置',

View File

@ -4,7 +4,10 @@ export default {
home: '首頁',
system: '系統設置',
systemMenu: '選單管理',
systemRole: '角色管理',
systemUser: '用戶管理',
systemDept: '部門管理',
systemDic: '字典管理',
limits: '許可權管理',
limitsFrontEnd: '前端控制',
limitsFrontEndPage: '頁面許可權',
@ -34,6 +37,7 @@ export default {
funScreenShort: '自定義截圖',
funGridLayout: '拖拽佈局',
funSplitpanes: '窗格折開器',
funDragVerify: '驗證器',
pagesIndex: '頁面',
pagesFiltering: '過濾篩選組件',
pagesFilteringDetails: '過濾篩選組件詳情',
@ -45,6 +49,8 @@ export default {
pagesFormAdapt: '表單自我調整',
pagesFormI18n: '表單國際化',
pagesFormRules: '多表單驗證',
pagesDynamicForm: '動態複雜表單',
pagesWorkflow: '工作流',
pagesListAdapt: '清單自我調整',
pagesWaterfall: '瀑布屏',
pagesSteps: '步驟條',
@ -153,6 +159,7 @@ export default {
fourIsFooter: '開啟 Footer',
fourIsGrayscale: '灰色模式',
fourIsInvert: '色弱模式',
fourIsDark: '深色模式',
fourIsWartermark: '開啟浮水印',
fourWartermarkText: '浮水印文案',
fiveTitle: '其它設定',

View File

@ -2,7 +2,7 @@
<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>
@ -74,7 +74,8 @@ export default {
const closeLayoutAsideMobileMode = () => {
const el = document.querySelector('.layout-aside-mobile-mode');
el && el.parentNode?.removeChild(el);
store.state.themeConfig.themeConfig.isCollapse = false;
const clientWidth = document.body.clientWidth;
if (clientWidth < 1000) store.state.themeConfig.themeConfig.isCollapse = false;
document.body.setAttribute('class', '');
};
// 设置显示/隐藏 logo
@ -101,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) {
@ -143,6 +151,7 @@ export default {
setShowLogo,
getThemeConfig,
isTagsViewCurrenFull,
onAsideEnterLeave,
...toRefs(state),
};
},

View File

@ -1,21 +1,22 @@
<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)">
<i :class="v.meta.icon"></i>
<SvgIcon :name="v.meta.icon" />
<div class="columns-vertical-title font12">
{{
$t(v.meta.title) && $t(v.meta.title).length >= 4
@ -26,7 +27,7 @@
</div>
<div :class="setColumnsAsidelayout" v-else>
<a :href="v.meta.isLink" target="_blank">
<i :class="v.meta.icon"></i>
<SvgIcon :name="v.meta.icon" />
<div class="columns-vertical-title font12">
{{
$t(v.meta.title) && $t(v.meta.title).length >= 4
@ -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

@ -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

@ -33,7 +33,7 @@ export default {
watch(
() => route.path,
() => {
proxy.$refs.layoutDefaultsScrollbarRef.wrap.scrollTop = 0;
proxy.$refs.layoutDefaultsScrollbarRef.wrap$.scrollTop = 0;
}
);
return {

View File

@ -1,18 +1,18 @@
<template>
<div class="layout-navbars-breadcrumb" :style="{ display: isShowBreadcrumb }">
<i
<SvgIcon
class="layout-navbars-breadcrumb-icon"
:class="getThemeConfig.isCollapse ? 'el-icon-s-unfold' : 'el-icon-s-fold'"
:name="getThemeConfig.isCollapse ? 'elementExpand' : 'elementFold'"
@click="onThemeConfigChange"
></i>
/>
<el-breadcrumb class="layout-navbars-breadcrumb-hide">
<transition-group name="breadcrumb" mode="out-in">
<el-breadcrumb-item v-for="(v, k) in breadcrumbList" :key="v.meta.title">
<span v-if="k === breadcrumbList.length - 1" class="layout-navbars-breadcrumb-span">
<i :class="v.meta.icon" class="layout-navbars-breadcrumb-iconfont" v-if="getThemeConfig.isBreadcrumbIcon"></i>{{ $t(v.meta.title) }}
<SvgIcon :name="v.meta.icon" class="layout-navbars-breadcrumb-iconfont" v-if="getThemeConfig.isBreadcrumbIcon" />{{ $t(v.meta.title) }}
</span>
<a v-else @click.prevent="onBreadcrumbClick(v)">
<i :class="v.meta.icon" class="layout-navbars-breadcrumb-iconfont" v-if="getThemeConfig.isBreadcrumbIcon"></i>{{ $t(v.meta.title) }}
<SvgIcon :name="v.meta.icon" class="layout-navbars-breadcrumb-iconfont" v-if="getThemeConfig.isBreadcrumbIcon" />{{ $t(v.meta.title) }}
</a>
</el-breadcrumb-item>
</transition-group>

View File

@ -1,7 +1,7 @@
<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>
<SvgIcon name="elementClose" />
</div>
</div>
</template>

View File

@ -5,13 +5,20 @@
v-model="menuQuery"
:fetch-suggestions="menuSearch"
:placeholder="$t('message.user.searchPlaceholder')"
prefix-icon="el-icon-search"
ref="layoutMenuAutocompleteRef"
@select="onHandleSelect"
@blur="onSearchBlur"
>
<template #prefix>
<el-icon class="el-input__icon">
<elementSearch />
</el-icon>
</template>
<template #default="{ item }">
<div><i :class="item.meta.icon" class="mr10"></i>{{ $t(item.meta.title) }}</div>
<div>
<SvgIcon :name="item.meta.icon" class="mr5" />
{{ $t(item.meta.title) }}
</div>
</template>
</el-autocomplete>
</el-dialog>

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"
@ -231,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">
@ -276,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">
@ -356,17 +362,17 @@
</div>
<div class="copy-config">
<el-alert :title="$t('message.layout.tipText')" type="warning" :closable="false"> </el-alert>
<el-button
size="small"
class="copy-config-btn"
icon="el-icon-document-copy"
type="primary"
ref="copyConfigBtnRef"
@click="onCopyConfigClick"
>{{ $t('message.layout.copyText') }}
<el-button size="small" class="copy-config-btn" type="primary" ref="copyConfigBtnRef" @click="onCopyConfigClick">
<el-icon>
<elementCopyDocument />
</el-icon>
{{ $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 size="small" class="copy-config-btn-reset" type="info" @click="onResetConfigClick">
<el-icon>
<elementRefreshRight />
</el-icon>
{{ $t('message.layout.resetText') }}
</el-button>
</div>
</el-scrollbar>
@ -503,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();
@ -609,6 +621,8 @@ export default defineComponent({
if (getThemeConfig.value.isGrayscale) onAddFilterChange('grayscale');
// 色弱模式
if (getThemeConfig.value.isInvert) onAddFilterChange('invert');
// 深色模式
if (getThemeConfig.value.isIsDark) onAddDarkChange();
// 开启水印
onWartermarkChange();
// 语言国际化
@ -636,6 +650,7 @@ export default defineComponent({
getThemeConfig,
onDrawerClose,
onAddFilterChange,
onAddDarkChange,
onWartermarkChange,
onWartermarkTextInput,
onSetLayout,

View File

@ -26,7 +26,9 @@
</template>
</el-dropdown>
<div class="layout-navbars-breadcrumb-user-icon" @click="onSearchClick">
<i class="el-icon-search" :title="$t('message.user.title2')"></i>
<el-icon :title="$t('message.user.title2')">
<elementSearch />
</el-icon>
</div>
<div class="layout-navbars-breadcrumb-user-icon" @click="onLayoutSetingClick">
<i class="icon-skin iconfont" :title="$t('message.user.title3')"></i>
@ -35,7 +37,9 @@
<el-popover placement="bottom" trigger="click" v-model:visible="isShowUserNewsPopover" :width="300" popper-class="el-popover-pupop-user-news">
<template #reference>
<el-badge :is-dot="true" @click="isShowUserNewsPopover = !isShowUserNewsPopover">
<i class="el-icon-bell" :title="$t('message.user.title4')"></i>
<el-icon :title="$t('message.user.title4')">
<elementBell />
</el-icon>
</el-badge>
</template>
<transition name="el-zoom-in-top">
@ -54,7 +58,9 @@
<span class="layout-navbars-breadcrumb-user-link">
<img :src="getUserInfos.photo" class="layout-navbars-breadcrumb-user-link-photo mr5" />
{{ getUserInfos.userName === '' ? 'test' : getUserInfos.userName }}
<i class="el-icon-arrow-down el-icon--right"></i>
<el-icon class="el-icon--right">
<elementArrowDown />
</el-icon>
</span>
<template #dropdown>
<el-dropdown-menu>
@ -79,7 +85,7 @@ import screenfull from 'screenfull';
import { useI18n } from 'vue-i18n';
import { resetRoute } from '/@/router/index';
import { useStore } from '/@/store/index';
import { useTitle } from '/@/utils/setWebTitle';
import other from '/@/utils/other';
import { Session, Local } from '/@/utils/storage';
import UserNews from '/@/layout/navBars/breadcrumb/userNews.vue';
import Search from '/@/layout/navBars/breadcrumb/search.vue';
@ -91,7 +97,6 @@ export default {
const { proxy } = getCurrentInstance() as any;
const router = useRouter();
const store = useStore();
const title = useTitle();
const searchRef = ref();
const state = reactive({
isScreenfull: false,
@ -192,7 +197,7 @@ export default {
Local.set('themeConfig', getThemeConfig.value);
proxy.$i18n.locale = lang;
initI18n();
title();
other.useTitle();
};
// 设置 element plus 组件的国际化
const setI18nConfig = (locale: string) => {

View File

@ -19,7 +19,7 @@
v-if="!v.affix"
@click="onCurrentContextmenuClick(v.contextMenuClickId)"
>
<i :class="v.icon"></i>
<SvgIcon :name="v.icon" />
<span>{{ $t(v.txt) }}</span>
</li>
</template>
@ -42,10 +42,10 @@ export default defineComponent({
const state = reactive({
isShow: false,
dropdownList: [
{ 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' },
{ contextMenuClickId: 0, txt: 'message.tagsView.refresh', affix: false, icon: 'elementRefreshRight' },
{ contextMenuClickId: 1, txt: 'message.tagsView.close', affix: false, icon: 'elementClose' },
{ contextMenuClickId: 2, txt: 'message.tagsView.closeOther', affix: false, icon: 'elementCircleClose' },
{ contextMenuClickId: 3, txt: 'message.tagsView.closeAll', affix: false, icon: 'elementFolderDelete' },
{
contextMenuClickId: 4,
txt: 'message.tagsView.fullscreen',

View File

@ -6,7 +6,7 @@
v-for="(v, k) in tagsViewList"
:key="k"
class="layout-navbars-tagsview-ul-li"
:data-name="v.name"
:data-url="v.url"
:class="{ 'is-active': isActive(v) }"
@contextmenu.prevent="onContextmenu(v, $event)"
@click="onTagsClick(v, k)"
@ -17,21 +17,23 @@
"
>
<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>
<SvgIcon :name="v.meta.icon" class="layout-navbars-tagsview-ul-li-iconfont" v-if="!isActive(v) && getThemeConfig.isTagsviewIcon" />
<span>{{ $t(v.meta.title) }}</span>
<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"
<SvgIcon name="elementRefreshRight" class="ml5" @click.stop="refreshCurrentTagsView($route.fullPath)" />
<SvgIcon
name="elementClose"
class="layout-navbars-tagsview-ul-li-icon layout-icon-active"
v-if="!v.meta.isAffix"
@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"
<SvgIcon
name="elementClose"
class="layout-navbars-tagsview-ul-li-icon layout-icon-three"
v-if="!v.meta.isAffix"
@click.stop="closeCurrentTagsView(getThemeConfig.isShareTagsView ? v.path : v.url)"
></i>
/>
</li>
</ul>
</el-scrollbar>
@ -82,7 +84,7 @@ export default {
if (getThemeConfig.value.isShareTagsView) {
return v.path === state.routePath;
} else {
return v.url === state.routeActive;
return v.url ? v.url === state.routeActive : v.path === state.routeActive;
}
};
// 存储 tagsViewList 到浏览器临时缓存中,页面刷新时,保留记录
@ -194,10 +196,12 @@ export default {
// 最后一个且高亮时
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 {
// 非最后一个且高亮时,跳转到下一个
@ -322,7 +326,7 @@ export default {
};
// 鼠标滚轮滚动
const onHandleScroll = (e: any) => {
proxy.$refs.scrollbarRef.$refs.wrap.scrollLeft += e.wheelDelta / 4;
proxy.$refs.scrollbarRef.$refs.wrap$.scrollLeft += e.wheelDelta / 4;
};
// tagsView 横向滚动
const tagsViewmoveToCurrentTag = () => {
@ -339,7 +343,7 @@ export default {
// 最后 li
let liLast: any = tagsRefs.value[tagsRefs.value.length - 1];
// 当前滚动条的值
let scrollRefs = proxy.$refs.scrollbarRef.$refs.wrap;
let scrollRefs = proxy.$refs.scrollbarRef.$refs.wrap$;
// 当前滚动条滚动宽度
let scrollS = scrollRefs.scrollWidth;
// 当前滚动条偏移宽度
@ -399,13 +403,13 @@ export default {
state.sortable && state.sortable.destroy();
state.sortable = Sortable.create(el, {
animation: 300,
dataIdAttr: 'data-name',
dataIdAttr: 'data-url',
disabled: getThemeConfig.value.isSortableTagsView ? false : true,
onEnd: () => {
const sortEndList: any = [];
state.sortable.toArray().map((val: any) => {
state.tagsViewList.map((v: any) => {
if (v.name === val) sortEndList.push({ ...v });
if (v.url === val) sortEndList.push({ ...v });
});
});
addBrowserSetSession(sortEndList);
@ -503,9 +507,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;
position: relative;
z-index: 4;
::v-deep(.el-scrollbar__wrap) {
overflow-x: auto !important;
}
@ -516,7 +521,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;
@ -552,7 +557,7 @@ export default {
line-height: 14px;
right: -5px;
&:hover {
color: #fff;
color: var(--color-whites);
background-color: var(--color-primary-light-3);
}
}
@ -564,9 +569,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
@ -615,7 +621,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

@ -5,19 +5,19 @@
<template v-for="val in menuLists">
<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>
<SvgIcon :name="val.meta.icon" />
<span>{{ $t(val.meta.title) }}</span>
</template>
<SubItem :chil="val.children" />
</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>
<SvgIcon :name="val.meta.icon" />
{{ $t(val.meta.title) }}
</template>
<template #title v-else>
<a :href="val.meta.isLink" target="_blank" rel="opener">
<i :class="val.meta.icon ? val.meta.icon : ''"></i>
<SvgIcon :name="val.meta.icon" />
{{ $t(val.meta.title) }}
</a>
</template>
@ -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,
});
// 获取父级菜单数据
@ -101,10 +101,13 @@ export default defineComponent({
else state.defaultActive = path;
}
};
// 页面加载前
onBeforeMount(() => {
setCurrentRouterHighlight(route);
});
// 页面加载时
onMounted(() => {
initElMenuOffsetLeft();
setCurrentRouterHighlight(route);
});
// 路由更新时
onBeforeRouteUpdate((to) => {

View File

@ -2,19 +2,19 @@
<template v-for="val in chils">
<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>
<SvgIcon :name="val.meta.icon" />
<span>{{ $t(val.meta.title) }}</span>
</template>
<sub-item :chil="val.children" />
</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>
<SvgIcon :name="val.meta.icon" />
<span>{{ $t(val.meta.title) }}</span>
</template>
<template v-else>
<a :href="val.meta.isLink" target="_blank" rel="opener">
<i :class="val.meta.icon ? val.meta.icon : ''"></i>
<SvgIcon :name="val.meta.icon" />
{{ $t(val.meta.title) }}
</a>
</template>

View File

@ -10,19 +10,19 @@
<template v-for="val in menuLists">
<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>
<SvgIcon :name="val.meta.icon" />
<span>{{ $t(val.meta.title) }}</span>
</template>
<SubItem :chil="val.children" />
</el-sub-menu>
<el-menu-item :index="val.path" :key="val.path" v-else>
<i :class="val.meta.icon ? val.meta.icon : ''"></i>
<SvgIcon :name="val.meta.icon" />
<template #title v-if="!val.meta.isLink || (val.meta.isLink && val.meta.isIframe)">
<span>{{ $t(val.meta.title) }}</span>
</template>
<template #title v-else>
<a :href="val.meta.isLink" target="_blank" rel="opener">{{ $t(val.meta.title) }}</a></template
>
<a :href="val.meta.isLink" target="_blank" rel="opener">{{ $t(val.meta.title) }}</a>
</template>
</el-menu-item>
</template>
</el-menu>

View File

@ -1,5 +1,5 @@
<template>
<div class="layout-view-bg-white flex" :style="{ height: `calc(100vh - ${setIframeHeight}`, border: 'none' }" v-loading="iframeLoading">
<div class="layout-view-bg-white flex mt1" :style="{ height: `calc(100vh - ${setIframeHeight}`, border: 'none' }" v-loading="iframeLoading">
<iframe :src="iframeUrl" frameborder="0" height="100%" width="100%" id="iframe" v-show="!iframeLoading"></iframe>
</div>
</template>
@ -36,8 +36,8 @@ export default defineComponent({
if (isTagsViewCurrenFull) {
return `0px`;
} else {
if (isTagsview) return `84px`;
else return `50px`;
if (isTagsview) return `83px`;
else return `49px`;
}
});
// 页面加载时

View File

@ -4,7 +4,7 @@ import router from './router';
import { store, key } from './store';
import { directive } from '/@/utils/directive';
import { i18n } from '/@/i18n/index';
import { globalComponentSize } from '/@/utils/componentSize';
import other from '/@/utils/other';
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
@ -14,15 +14,17 @@ import screenShort from 'vue-web-screen-shot';
import VueGridLayout from 'vue-grid-layout';
const app = createApp(App);
directive(app);
other.elSvg(app);
app
.use(router)
.use(store, key)
.use(ElementPlus, { i18n: i18n.global.t, size: globalComponentSize })
.use(ElementPlus, { i18n: i18n.global.t, size: other.globalComponentSize })
.use(i18n)
.use(screenShort, { enableWebRtc: false })
.use(VueGridLayout)
.mount('#app');
app.config.globalProperties.mittBus = mitt();
directive(app);

View File

@ -48,7 +48,7 @@ export async function initBackEndControlRoutes() {
*/
export function getBackEndControlRoutes() {
// 模拟 admin 与 test
const auth = store.state.userInfos.userInfos.authPageList[0];
const auth = store.state.userInfos.userInfos.roles[0];
// 管理员 admin
if (auth === 'admin') return getMenuAdmin();
// 其它用户 test

View File

@ -81,34 +81,34 @@ export function formatTwoStageRoutes(arr: any) {
*/
export function setCacheTagsViewRoutes() {
// 获取有权限的路由,否则 tagsView、菜单搜索中无权限的路由也将显示
let authsRoutes = setFilterHasAuthMenu(dynamicRoutes, store.state.userInfos.userInfos.authPageList);
let rolesRoutes = setFilterHasRolesMenu(dynamicRoutes, store.state.userInfos.userInfos.roles);
// 添加到 vuex setTagsViewRoutes 中
store.dispatch('tagsViewRoutes/setTagsViewRoutes', formatTwoStageRoutes(formatFlatteningRoutes(authsRoutes))[0].children);
store.dispatch('tagsViewRoutes/setTagsViewRoutes', formatTwoStageRoutes(formatFlatteningRoutes(rolesRoutes))[0].children);
}
/**
* 判断路由 `meta.auth` 中是否包含当前登录用户权限字段
* @param auths 用户权限标识,在 userInfos用户信息authPageList(登录页登录时缓存到浏览器)数组
* 判断路由 `meta.roles` 中是否包含当前登录用户权限字段
* @param roles 用户权限标识,在 userInfos用户信息roles(登录页登录时缓存到浏览器)数组
* @param route 当前循环时的路由项
* @returns 返回对比后有权限的路由项
*/
export function hasAuth(auths: any, route: any) {
if (route.meta && route.meta.auth) return auths.some((auth: any) => route.meta.auth.includes(auth));
export function hasRoles(roles: any, route: any) {
if (route.meta && route.meta.roles) return roles.some((role: any) => route.meta.roles.includes(role));
else return true;
}
/**
* 获取当前用户权限标识去比对路由表,设置递归过滤有权限的路由
* @param routes 当前路由 children
* @param auth 用户权限标识,在 userInfos用户信息authPageList(登录页登录时缓存到浏览器)数组
* @returns 返回有权限的路由数组 `meta.auth` 中控制
* @param roles 用户权限标识,在 userInfos用户信息roles(登录页登录时缓存到浏览器)数组
* @returns 返回有权限的路由数组 `meta.roles` 中控制
*/
export function setFilterHasAuthMenu(routes: any, auth: any) {
export function setFilterHasRolesMenu(routes: any, roles: any) {
const menu: any = [];
routes.forEach((route: any) => {
const item = { ...route };
if (hasAuth(auth, item)) {
if (item.children) item.children = setFilterHasAuthMenu(item.children, auth);
if (hasRoles(roles, item)) {
if (item.children) item.children = setFilterHasRolesMenu(item.children, roles);
menu.push(item);
}
});
@ -121,7 +121,7 @@ export function setFilterHasAuthMenu(routes: any, auth: any) {
* @description 用于 tagsView、菜单搜索中未过滤隐藏的(isHide)
*/
export function setFilterMenuAndCacheTagsViewRoutes() {
store.dispatch('routesList/setRoutesList', setFilterHasAuthMenu(dynamicRoutes[0].children, store.state.userInfos.userInfos.authPageList));
store.dispatch('routesList/setRoutesList', setFilterHasRolesMenu(dynamicRoutes[0].children, store.state.userInfos.userInfos.roles));
setCacheTagsViewRoutes();
}
@ -135,10 +135,10 @@ export function setFilterMenuAndCacheTagsViewRoutes() {
export function setFilterRoute(chil: any) {
let filterRoute: any = [];
chil.forEach((route: any) => {
if (route.meta.auth) {
route.meta.auth.forEach((metaAuth: any) => {
store.state.userInfos.userInfos.authPageList.forEach((auth: any) => {
if (metaAuth === auth) filterRoute.push({ ...route });
if (route.meta.roles) {
route.meta.roles.forEach((metaRoles: any) => {
store.state.userInfos.userInfos.roles.forEach((roles: any) => {
if (metaRoles === roles) filterRoute.push({ ...route });
});
});
}

View File

@ -9,7 +9,7 @@ import { RouteRecordRaw } from 'vue-router';
* isKeepAlive 是否缓存组件状态
* isAffix 是否固定在 tagsView 栏上
* isIframe 是否内嵌窗口,,开启条件,`1、isIframe:true 2、链接地址不为空`
* auth 当前路由权限标识(多个请用逗号隔开),最后转成数组格式,用于与当前用户权限进行对比,控制路由显示、隐藏
* roles 当前路由权限标识取角色管理。控制路由显示、隐藏。超级管理员admin 普通角色common
* icon 菜单、tagsView 图标,阿里:加 `iconfont xxx`fontawesome加 `fa xxx`
* }
*/
@ -41,7 +41,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: true,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-shouye',
},
},
@ -57,7 +57,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin'],
roles: ['admin'],
icon: 'iconfont icon-xitongshezhi',
},
children: [
@ -72,10 +72,25 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin'],
roles: ['admin'],
icon: 'iconfont icon-caidan',
},
},
{
path: '/system/role',
name: 'systemRole',
component: () => import('/@/views/system/role/index.vue'),
meta: {
title: 'message.router.systemRole',
isLink: '',
isHide: false,
isKeepAlive: true,
isAffix: false,
isIframe: false,
roles: ['admin'],
icon: 'elementColdDrink',
},
},
{
path: '/system/user',
name: 'systemUser',
@ -87,13 +102,42 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin'],
roles: ['admin'],
icon: 'iconfont icon-icon-',
},
},
{
path: '/system/dept',
name: 'systemDept',
component: () => import('/@/views/system/dept/index.vue'),
meta: {
title: 'message.router.systemDept',
isLink: '',
isHide: false,
isKeepAlive: true,
isAffix: false,
isIframe: false,
roles: ['admin'],
icon: 'elementOfficeBuilding',
},
},
{
path: '/system/dic',
name: 'systemDic',
component: () => import('/@/views/system/dic/index.vue'),
meta: {
title: 'message.router.systemDic',
isLink: '',
isHide: false,
isKeepAlive: true,
isAffix: false,
isIframe: false,
roles: ['admin'],
icon: 'elementSetUp',
},
},
],
},
{
path: '/limits',
name: 'limits',
@ -106,7 +150,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-quanxian',
},
children: [
@ -122,7 +166,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: '',
},
children: [
{
@ -136,7 +181,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: '',
},
},
{
@ -150,7 +196,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: '',
},
},
],
@ -166,7 +213,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: '',
},
children: [
{
@ -180,7 +228,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: '',
},
},
],
@ -199,7 +248,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-caidan',
},
children: [
@ -215,7 +264,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-caidan',
},
children: [
@ -230,7 +279,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-caidan',
},
},
@ -246,7 +295,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-caidan',
},
children: [
@ -261,7 +310,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-caidan',
},
},
@ -276,7 +325,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-caidan',
},
},
@ -293,7 +342,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-caidan',
},
},
@ -310,7 +359,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-caidan',
},
},
@ -328,7 +377,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-crew_feature',
},
children: [
@ -343,8 +392,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'el-icon-thumb',
roles: ['admin', 'common'],
icon: 'elementPointer',
},
},
{
@ -358,8 +407,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'el-icon-odometer',
roles: ['admin', 'common'],
icon: 'elementOdometer',
},
},
{
@ -373,8 +422,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'el-icon-connection',
roles: ['admin', 'common'],
icon: 'elementConnection',
},
},
{
@ -388,7 +437,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-xuanzeqi',
},
},
@ -403,8 +452,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'el-icon-bell',
roles: ['admin', 'common'],
icon: 'elementBell',
},
},
{
@ -418,7 +467,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-fuwenbenkuang',
},
},
@ -433,7 +482,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-caijian',
},
},
@ -448,7 +497,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-ico',
},
},
@ -463,7 +512,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-ditu',
},
},
@ -478,8 +527,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'el-icon-printer',
roles: ['admin', 'common'],
icon: 'elementPrinter',
},
},
{
@ -493,8 +542,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'el-icon-document-copy',
roles: ['admin', 'common'],
icon: 'elementDocumentCopy',
},
},
{
@ -508,8 +557,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'el-icon-crop',
roles: ['admin', 'common'],
icon: 'elementCrop',
},
},
{
@ -523,7 +572,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-tuodong',
},
},
@ -538,10 +587,25 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
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,
roles: ['admin', 'common'],
icon: 'elementPromotion',
},
},
],
},
{
@ -556,7 +620,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-fuzhiyemian',
},
children: [
@ -571,8 +635,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'el-icon-sell',
roles: ['admin', 'common'],
icon: 'elementSell',
},
/**
* 注意此处详情写法:
@ -592,8 +656,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: false,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'el-icon-s-order',
roles: ['admin', 'common'],
icon: 'elementSunny',
},
},
],
@ -609,8 +673,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: false,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'el-icon-s-order',
roles: ['admin', 'common'],
icon: 'elementSunny',
},
},
{
@ -624,8 +688,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'el-icon-present',
roles: ['admin', 'common'],
icon: 'elementPresent',
},
},
{
@ -639,8 +703,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'el-icon-platform-eleme',
roles: ['admin', 'common'],
icon: 'elementEleme',
},
},
{
@ -654,8 +718,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'el-icon-set-up',
roles: ['admin', 'common'],
icon: 'elementSetUp',
},
},
{
@ -669,7 +733,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-jiliandongxuanzeqi',
},
},
@ -684,7 +748,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-biaodan',
},
},
@ -699,7 +763,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-diqiu',
},
},
@ -714,7 +778,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-shuxing',
},
},
@ -729,7 +793,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-chazhaobiaodanliebiao',
},
},
@ -744,7 +808,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-zidingyibuju',
},
},
@ -759,7 +823,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-step',
},
},
@ -774,7 +838,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-15tupianyulan',
},
},
@ -789,7 +853,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-bolangneng',
},
},
@ -804,7 +868,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-shuxingtu',
},
},
@ -819,8 +883,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'el-icon-thumb',
roles: ['admin', 'common'],
icon: 'elementPointer',
},
},
{
@ -834,8 +898,38 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin'],
icon: 'el-icon-picture-outline',
roles: ['admin'],
icon: 'elementPictureFilled',
},
},
{
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,
roles: ['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,
roles: ['admin'],
icon: 'elementConnection',
},
},
],
@ -852,7 +946,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin'],
roles: ['admin'],
icon: 'iconfont icon-zhongduancanshu',
},
children: [
@ -867,7 +961,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin'],
roles: ['admin'],
icon: 'iconfont icon-putong',
},
},
@ -882,8 +976,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin'],
icon: 'el-icon-s-order',
roles: ['admin'],
icon: 'elementComment',
},
},
{
@ -897,7 +991,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin'],
roles: ['admin'],
icon: 'iconfont icon-dongtai',
},
},
@ -912,8 +1006,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin'],
icon: 'el-icon-s-order',
roles: ['admin'],
icon: 'elementLightning',
},
},
],
@ -930,8 +1024,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin'],
icon: 'el-icon-data-line',
roles: ['admin'],
icon: 'elementChatLineRound',
},
children: [
{
@ -945,7 +1039,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: false,
isAffix: false,
isIframe: false,
auth: ['admin'],
roles: ['admin'],
icon: 'iconfont icon-caozuo-wailian',
},
},
@ -960,7 +1054,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: false,
isAffix: false,
isIframe: false,
auth: ['admin'],
roles: ['admin'],
icon: 'iconfont icon-caozuo-wailian',
},
},
@ -977,7 +1071,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-ico_shuju',
},
},
@ -992,7 +1086,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-gerenzhongxin',
},
},
@ -1007,7 +1101,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-gongju',
},
},
@ -1022,7 +1116,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: false,
isAffix: false,
isIframe: false,
auth: ['admin'],
roles: ['admin'],
icon: 'iconfont icon-caozuo-wailian',
},
},
@ -1032,12 +1126,12 @@ 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,
isIframe: true,
auth: ['admin'],
roles: ['admin'],
icon: 'iconfont icon-neiqianshujuchucun',
},
},

View File

@ -38,6 +38,7 @@ export interface ThemeConfigState {
isFooter: boolean;
isGrayscale: boolean;
isInvert: boolean;
isIsDark: boolean;
isWartermark: boolean;
wartermarkText: string;
tagsStyle: string;
@ -56,6 +57,8 @@ export interface ThemeConfigState {
// 路由列表
export interface RoutesListState {
routesList: Array<object>;
isColumnsMenuHover: Boolean;
isColumnsNavHover: 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,6 +1,7 @@
import { Module } from 'vuex';
// 此处加上 `.ts` 后缀报错,具体原因不详
import { TagsViewRoutesState, RootStateTypes } from '/@/store/interface/index';
import { Session } from '/@/utils/storage';
const tagsViewRoutesModule: Module<TagsViewRoutesState, RootStateTypes> = {
namespaced: true,
@ -15,6 +16,7 @@ const tagsViewRoutesModule: Module<TagsViewRoutesState, RootStateTypes> = {
},
// 设置卡片全屏
getCurrenFullscreen(state: any, bool: boolean) {
Session.set('isTagsViewCurrenFull', bool);
state.isTagsViewCurrenFull = bool;
},
},

View File

@ -54,7 +54,6 @@ const themeConfigModule: Module<ThemeConfigState, RootStateTypes> = {
isColumnsMenuBarColorGradual: false,
// 是否开启菜单字体背景高亮
isMenuBarColorHighlight: false,
// 是否开启菜单字体背景高亮
/**
* 界面设置
@ -101,6 +100,8 @@ const themeConfigModule: Module<ThemeConfigState, RootStateTypes> = {
isGrayscale: false,
// 是否开启色弱模式
isInvert: false,
// 是否开启深色模式
isIsDark: false,
// 是否开启水印
isWartermark: false,
// 水印文案

View File

@ -56,11 +56,11 @@ body,
}
// 此字段多次用到,建议不删除,如需修改,请重写覆盖样式
.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);
@ -124,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);
}
@ -177,6 +169,25 @@ body,
}
}
/* cursor 鼠标形状
------------------------------- */
// 默认
.cursor-default {
cursor: default !important;
}
// 帮助
.cursor-help {
cursor: help !important;
}
// 手指
.cursor-pointer {
cursor: pointer !important;
}
// 移动
.cursor-move {
cursor: move !important;
}
/* 宽高 100%
------------------------------- */
.w100 {

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};

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

@ -0,0 +1,57 @@
/* 深色模式样式
------------------------------- */
[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;
}
.el-overlay {
background-color: rgba(0, 0, 0, 0.05) !important;
}
.el-drawer {
box-shadow: 0 8px 10px -5px rgb(0 0 0 / 1%), 0 16px 24px 2px rgb(0 0 0 / 2%), 0 6px 30px 5px rgb(0 0 0 / 1%);
}
// 数据可视化演示
.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

@ -809,10 +809,10 @@
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 {
@ -823,19 +823,23 @@
}
// 菜单收起时且是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-sub-menu__title {
color: var(--bg-topBarColor);
background: var(--bg-topBar);
}
}
}
@ -849,7 +853,7 @@
@include generalIcon;
}
// element plus 本身字体图标
.el-sub-menu [class^='el-icon-'] {
.el-sub-menu .el-icon {
font-size: 14px !important;
}
// 去掉离开浏览器时,菜单的默认高亮
@ -937,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;
}
}
}
}
@ -1005,6 +1015,9 @@
/* scrollbar
------------------------------- */
.el-scrollbar__bar {
z-index: 4;
}
.el-scrollbar__wrap {
overflow-x: hidden !important;
max-height: 100%; /*防止页面切换时,滚动条高度不变的问题(滚动条高度非滚动条滚动高度)*/
@ -1021,10 +1034,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

@ -9,11 +9,24 @@
height: 40px;
line-height: 40px;
padding: 0 15px;
.icon-selector-warp-title-tab {
span {
cursor: pointer;
&:hover {
color: var(--color-primary);
text-decoration: underline;
}
}
.span-active {
color: var(--color-primary);
text-decoration: underline;
}
}
}
.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 +35,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

@ -1,7 +0,0 @@
import { Local } from '/@/utils/storage';
/**
* 全局组件大小
* @returns 返回 `window.localStorage` 中读取的缓存值 `globalComponentSize`
*/
export const globalComponentSize: string = Local.get('themeConfig')?.globalComponentSize;

View File

@ -1,21 +0,0 @@
/**
* 对象深克隆
* @param obj 源对象
* @returns 克隆后的对象
*/
export function deepClone(obj: any) {
let newObj: any;
try {
newObj = obj.push ? [] : {};
} catch (error) {
newObj = {};
}
for (let attr in obj) {
if (typeof obj[attr] === 'object') {
newObj[attr] = deepClone(obj[attr]);
} else {
newObj[attr] = obj[attr];
}
}
return newObj;
}

View File

@ -1,4 +1,5 @@
import { nextTick } from 'vue';
import * as svg from '@element-plus/icons-vue';
// 获取阿里字体图标
const getAlicdnIconfont = () => {
@ -27,24 +28,16 @@ const getAlicdnIconfont = () => {
});
};
// 初始化获取 css 样式,获取 element plus 自带图标
// 初始化获取 css 样式,获取 element plus 自带 svg 图标,增加了 element 前缀使用时elementAim
const getElementPlusIconfont = () => {
return new Promise((resolve, reject) => {
nextTick(() => {
const styles: any = document.styleSheets;
let sheetsIconList = [];
for (let i = 0; i < styles.length; i++) {
for (let j = 0; j < styles[i].cssRules.length; j++) {
if (styles[i].cssRules[j].selectorText && styles[i].cssRules[j].selectorText.indexOf('.el-icon-') === 0) {
if (/::before/.test(styles[i].cssRules[j].selectorText)) {
sheetsIconList.push(
`${styles[i].cssRules[j].selectorText.substring(1, styles[i].cssRules[j].selectorText.length).replace(/\:\:before/gi, '')}`
);
}
}
}
const icons = svg as any;
const sheetsIconList = [];
for (const i in icons) {
sheetsIconList.push(`element${icons[i].name}`);
}
if (sheetsIconList.length > 0) resolve(sheetsIconList.reverse());
if (sheetsIconList.length > 0) resolve(sheetsIconList);
else reject('未获取到值,请刷新重试');
});
});

View File

@ -1,25 +0,0 @@
import { nextTick } from 'vue';
/**
* 图片懒加载
* @param el dom 目标元素
* @param arr 列表数据
* @description data-xxx 属性用于存储页面或应用程序的私有自定义数据
*/
export const lazyImgLoading = (el: any, arr: any) => {
const io = new IntersectionObserver((res) => {
res.forEach((v: any) => {
if (v.isIntersecting) {
const { img, key } = v.target.dataset;
v.target.src = img;
v.target.onload = () => {
io.unobserve(v.target);
arr[key]['loading'] = false;
};
}
});
});
nextTick(() => {
document.querySelectorAll(el).forEach((img) => io.observe(img));
});
};

119
src/utils/other.ts Normal file
View File

@ -0,0 +1,119 @@
import { nextTick } from 'vue';
import type { App } from 'vue';
import * as svg from '@element-plus/icons-vue';
import router from '/@/router/index';
import { store } from '/@/store/index';
import { i18n } from '/@/i18n/index';
import { Local } from '/@/utils/storage';
import SvgIcon from '/@/components/svgIcon/index.vue';
/**
* 导出全局注册 element plus svg 图标
* @param app vue 实例
* @description 使用https://element-plus.gitee.io/zh-CN/component/icon.html
*/
export function elSvg(app: App) {
const icons = svg as any;
for (const i in icons) {
app.component(`element${icons[i].name}`, icons[i]);
}
app.component('SvgIcon', SvgIcon);
}
/**
* 设置浏览器标题国际化
* @method const title = useTitle(); ==> title()
*/
export function useTitle() {
nextTick(() => {
let webTitle = '';
let globalTitle: string = store.state.themeConfig.themeConfig.globalTitle;
router.currentRoute.value.path === '/login'
? (webTitle = router.currentRoute.value.meta.title as any)
: (webTitle = i18n.global.t(router.currentRoute.value.meta.title as any));
document.title = `${webTitle} - ${globalTitle}` || globalTitle;
});
}
/**
* 图片懒加载
* @param el dom 目标元素
* @param arr 列表数据
* @description data-xxx 属性用于存储页面或应用程序的私有自定义数据
*/
export const lazyImg = (el: any, arr: any) => {
const io = new IntersectionObserver((res) => {
res.forEach((v: any) => {
if (v.isIntersecting) {
const { img, key } = v.target.dataset;
v.target.src = img;
v.target.onload = () => {
io.unobserve(v.target);
arr[key]['loading'] = false;
};
}
});
});
nextTick(() => {
document.querySelectorAll(el).forEach((img) => io.observe(img));
});
};
/**
* 全局组件大小
* @returns 返回 `window.localStorage` 中读取的缓存值 `globalComponentSize`
*/
export function globalComponentSize() {
return Local.get('themeConfig')?.globalComponentSize;
}
/**
* 对象深克隆
* @param obj 源对象
* @returns 克隆后的对象
*/
export function deepClone(obj: any) {
let newObj: any;
try {
newObj = obj.push ? [] : {};
} catch (error) {
newObj = {};
}
for (let attr in obj) {
if (typeof obj[attr] === 'object') {
newObj[attr] = deepClone(obj[attr]);
} else {
newObj[attr] = obj[attr];
}
}
return newObj;
}
/**
* 统一批量导出
* @method elSvg 导出全局注册 element plus svg 图标
* @method useTitle 设置浏览器标题国际化
* @method lazyImg 图片懒加载
* @method globalComponentSize element plus 全局组件大小
* @method deepClone 对象深克隆
*/
const other = {
elSvg: (app: App) => {
elSvg(app);
},
useTitle: () => {
useTitle();
},
lazyImg: (el: any, arr: any) => {
lazyImg(el, arr);
},
globalComponentSize: () => {
globalComponentSize();
},
deepClone: (obj: any) => {
deepClone(obj);
},
};
// 统一批量导出
export default other;

View File

@ -1,20 +0,0 @@
import { nextTick } from 'vue';
import router from '/@/router/index';
import { store } from '/@/store/index';
import { i18n } from '/@/i18n/index';
/**
* 设置浏览器标题国际化
*/
export function useTitle() {
return () => {
nextTick(() => {
let webTitle = '';
let globalTitle: string = store.state.themeConfig.themeConfig.globalTitle;
router.currentRoute.value.path === '/login'
? (webTitle = router.currentRoute.value.meta.title as any)
: (webTitle = i18n.global.t(router.currentRoute.value.meta.title as any));
document.title = `${webTitle} - ${globalTitle}` || globalTitle;
});
};
}

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,10 @@
text-align: center;
border-radius: 100%;
flex-shrink: 1;
color: #ffffff;
color: var(--color-whites);
display: flex;
align-items: center;
justify-content: center;
}
.i-bg1 {
background: #22bc76;
@ -189,9 +192,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 +209,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 +320,7 @@
height: 45px;
.task-item {
flex: 1;
color: #ffffff;
color: var(--color-whites);
display: flex;
justify-content: center;
.task-item-box {

View File

@ -13,14 +13,14 @@ export const skyList = [
},
{
v1: '今天',
v2: 'el-icon-cloudy-and-sunny',
v2: 'elementSunny',
v3: '20°/26°',
v5: '50%',
v7: '13m/s',
},
{
v1: '明天',
v2: 'el-icon-lightning',
v2: 'elementLightning',
v3: '20°/26°',
v5: '50%',
v7: '13m/s',
@ -57,34 +57,3 @@ export const chartData4List = [
label: '风力',
},
];
/**
* 3DEarth 地图周围按钮组
* @returns 返回模拟数据
*/
export const earth3DBtnList = [
{
topLevelClass: 'fixed-top',
icon: 'el-icon-s-marketing',
label: '环境监测',
type: 0,
},
{
topLevelClass: 'fixed-right',
icon: 'el-icon-s-cooperation',
label: '精准管理',
type: 1,
},
{
topLevelClass: 'fixed-bottom',
icon: 'el-icon-s-order',
label: '数据报表',
type: 2,
},
{
topLevelClass: 'fixed-left',
icon: 'el-icon-s-claim',
label: '产品追溯',
type: 3,
},
];

View File

@ -12,7 +12,7 @@
<div class="flex-title">天气预报</div>
<div class="flex-content">
<div class="sky">
<i class="sky-left el-icon-cloudy-and-sunny"></i>
<SvgIcon name="elementSunny" class="sky-left" />
<div class="sky-center">
<div class="mb2">
<span>多云转晴</span>
@ -30,7 +30,7 @@
<div>{{ v.v1 }}</div>
<div v-if="v.type === 'title'">{{ v.v2 }}</div>
<div v-else>
<i :class="v.v2"></i>
<SvgIcon :name="v.v2" />
</div>
<div>{{ v.v3 }}</div>
<div class="tip">{{ v.v5 }}</div>
@ -46,23 +46,23 @@
<div class="flex-content flex-content-overflow">
<div class="d-states">
<div class="d-states-item">
<i class="el-icon-odometer i-bg1"></i>
<SvgIcon name="elementOdometer" class="i-bg1" />
<div class="d-states-flex">
<div class="d-states-item-label">设备</div>
<div class="d-states-item-label">园区设备</div>
<div class="d-states-item-value">99</div>
</div>
</div>
<div class="d-states-item">
<i class="el-icon-first-aid-kit i-bg2"></i>
<SvgIcon name="elementFirstAidKit" class="i-bg2" />
<div class="d-states-flex">
<div class="d-states-item-label">预警</div>
<div class="d-states-item-label">预警设备数</div>
<div class="d-states-item-value">10</div>
</div>
</div>
<div class="d-states-item">
<i class="el-icon-video-play i-bg3"></i>
<SvgIcon name="elementVideoPlay" class="i-bg3" />
<div class="d-states-flex">
<div class="d-states-item-label">运行</div>
<div class="d-states-item-label">运行设备数</div>
<div class="d-states-item-value">20</div>
</div>
</div>
@ -207,7 +207,7 @@ import { useStore } from '/@/store/index';
import ChartHead from '/@/views/chart/head.vue';
import * as echarts from 'echarts';
import 'echarts-wordcloud';
import { skyList, dBtnList, chartData4List, earth3DBtnList } from '/@/views/chart/chart';
import { skyList, dBtnList, chartData4List } from '/@/views/chart/chart';
export default {
name: 'chartIndex',
components: { ChartHead },
@ -219,7 +219,6 @@ export default {
skyList,
dBtnList,
chartData4List,
earth3DBtnList,
myCharts: [],
});
// 设置主内容的高度

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

@ -23,7 +23,12 @@
<div class="flex-warp">
<div class="flex-warp-item">
<div class="flex-warp-item-box">
<el-button type="primary" size="small" icon="el-icon-refresh-right" @click="refreshCurrent">重置/刷新数值 </el-button>
<el-button type="primary" size="small" @click="refreshCurrent">
<el-icon>
<elementRefreshRight />
</el-icon>
重置/刷新数值
</el-button>
</div>
</div>
</div>
@ -110,7 +115,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 +145,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

@ -11,7 +11,12 @@
<div class="mb15 mt15">
<img class="cropper-img" :src="cropperImg" />
</div>
<el-button type="primary" icon="el-icon-crop" size="small" @click="onCropperDialogOpen">更换头像</el-button>
<el-button type="primary" size="small" @click="onCropperDialogOpen">
<el-icon>
<elementCrop />
</el-icon>
更换头像
</el-button>
</div>
</el-card>
<CropperDialog ref="cropperDialogRef" />

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

@ -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

@ -12,7 +12,7 @@
text="🎉🎉🔥基于vue3.x 、Typescript、vite、Element plus等适配手机、平板、pc
的后台开源免费模板库vue2.x请切换vue-prev-admin分支仓库地址https://gitee.com/lyt-top/vue-next-admin"
leftIcon="iconfont icon-tongzhi2"
rightIcon="el-icon-arrow-right"
rightIcon="elementArrowRight"
background="#ecf5ff"
color="#409eff"
/>

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。请在打印弹窗 `更多设置` 中开启 `背景图形。`"
@ -7,7 +7,10 @@
:closable="false"
class="mb15"
></el-alert>
<el-button @click="onPrintJs" size="small" type="primary" icon="iconfont icon-dayin">点击打印演示</el-button>
<el-button @click="onPrintJs" size="small" type="primary">
<SvgIcon name="iconfont icon-dayin" />
点击打印演示
</el-button>
</el-card>
</div>
</template>
@ -22,7 +25,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

@ -11,7 +11,12 @@
<div class="mb30 mt30 qrcode-img">
<div class="qrcode" ref="qrcodeRef"></div>
</div>
<el-button type="primary" icon="el-icon-refresh" size="small" @click="onInitQrcode">重新生成</el-button>
<el-button type="primary" size="small" @click="onInitQrcode">
<el-icon>
<elementRefresh />
</el-icon>
重新生成
</el-button>
</div>
</el-card>
</div>

View File

@ -8,7 +8,10 @@
class="mb15"
></el-alert>
<ScreenShort ref="screenShortRef" @getBase64="onGetBase64" />
<el-button type="primary" size="small" @click="onScreenShortClick" icon="el-icon-crop">点击截屏</el-button>
<el-button type="primary" size="small" @click="onScreenShortClick">
<SvgIcon name="elementCrop" />
点击截屏
</el-button>
</el-card>
</div>
</template>

View File

@ -1,6 +1,6 @@
<template>
<div class="selector-container">
<el-card shadow="hover" header="图标选择器(宽度自动)简单版本">
<el-card shadow="hover" header="图标选择器(宽度自动)">
<IconSelector @get="onGetIcon" @clear="onClearIcon" v-model="modelIcon" />
</el-card>
@ -40,7 +40,7 @@ export default defineComponent({
a2: '输入框前置内容,只能字体图标',
a3: 'string',
a4: '',
a5: 'el-icon-thumb',
a5: 'elementPointer',
},
{
a1: 'placeholder',
@ -67,7 +67,7 @@ export default defineComponent({
a1: 'type',
a2: 'icon 图标类型',
a3: 'string',
a4: 'ali / ele / awe',
a4: 'ali / ele / awe / all',
a5: 'ele',
},
{

View File

@ -9,27 +9,52 @@
<div class="flex-warp">
<div class="flex-warp-item">
<div class="flex-warp-item-box">
<el-button type="primary" size="small" icon="el-icon-refresh-right" @click="refreshCurrentTagsView">刷新当前页 </el-button>
<el-button type="primary" size="small" @click="refreshCurrentTagsView">
<el-icon>
<elementRefreshRight />
</el-icon>
刷新当前页
</el-button>
</div>
</div>
<div class="flex-warp-item">
<div class="flex-warp-item-box">
<el-button type="info" size="small" icon="el-icon-close" @click="closeCurrentTagsView">关闭当前页</el-button>
<el-button type="info" size="small" @click="closeCurrentTagsView">
<el-icon>
<elementClose />
</el-icon>
关闭当前页
</el-button>
</div>
</div>
<div class="flex-warp-item">
<div class="flex-warp-item-box">
<el-button type="warning" size="small" icon="el-icon-circle-close" @click="closeOtherTagsView">关闭其它 </el-button>
<el-button type="warning" size="small" @click="closeOtherTagsView">
<el-icon>
<elementCircleClose />
</el-icon>
关闭其它
</el-button>
</div>
</div>
<div class="flex-warp-item">
<div class="flex-warp-item-box">
<el-button type="danger" size="small" icon="el-icon-folder-delete" @click="closeAllTagsView">全部关闭 </el-button>
<el-button type="danger" size="small" @click="closeAllTagsView">
<el-icon>
<elementFolderDelete />
</el-icon>
全部关闭
</el-button>
</div>
</div>
<div class="flex-warp-item">
<div class="flex-warp-item-box">
<el-button type="success" size="small" icon="el-icon-full-screen" @click="openCurrenFullscreen">当前页全屏 </el-button>
<el-button type="success" size="small" @click="openCurrenFullscreen">
<el-icon>
<elementFullScreen />
</el-icon>
当前页全屏
</el-button>
</div>
</div>
</div>

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

@ -74,7 +74,7 @@
</div>
<div class="home-dynamic-item-right">
<div class="home-dynamic-item-right-title mb5">
<i class="el-icon-s-comment"></i>
<SvgIcon name="elementComment" />
<span>{{ v.title }}</span>
</div>
<div class="home-dynamic-item-right-label">{{ v.label }}</div>
@ -334,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 {
@ -364,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;
@ -378,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 {
@ -392,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);
}
}
}
@ -408,6 +411,7 @@ export default {
margin: auto;
height: auto;
text-align: center;
color: var(--el-text-color-primary);
}
}
}
@ -437,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 {
@ -452,7 +456,7 @@ export default {
top: 1px;
left: -6px;
transform: rotate(46deg);
background: white;
background: var(--el-color-white);
}
}
.home-dynamic-item-right {
@ -460,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%;
@ -471,7 +475,7 @@ export default {
}
.home-dynamic-item-right-label {
font-size: 13px;
color: gray;
color: var(--el-text-color-secondary);
}
}
}

View File

@ -8,7 +8,12 @@
type="warning"
:closable="false"
></el-alert>
<el-button type="primary" size="small" class="mt15" icon="el-icon-position" @click="onGoToFrontEndPage">立即前往前端控制路由 </el-button>
<el-button type="primary" size="small" class="mt15" @click="onGoToFrontEndPage">
<el-icon>
<elementPosition />
</el-icon>
立即前往前端控制路由
</el-button>
</div>
</template>

View File

@ -8,28 +8,48 @@
<Auth :value="'btn.add'">
<div class="flex-warp-item">
<div class="flex-warp-item-box">
<el-button type="primary" size="small" icon="el-icon-document-add">新增 </el-button>
<el-button type="primary" size="small">
<el-icon>
<elementDocumentAdd />
</el-icon>
新增
</el-button>
</div>
</div>
</Auth>
<Auth :value="'btn.edit'">
<div class="flex-warp-item">
<div class="flex-warp-item-box">
<el-button type="info" size="small" icon="el-icon-edit-outline">编辑</el-button>
<el-button type="info" size="small">
<el-icon>
<elementEdit />
</el-icon>
编辑
</el-button>
</div>
</div>
</Auth>
<Auth :value="'btn.del'">
<div class="flex-warp-item">
<div class="flex-warp-item-box">
<el-button type="danger" size="small" icon="el-icon-delete">删除 </el-button>
<el-button type="danger" size="small">
<el-icon>
<elementDelete />
</el-icon>
删除
</el-button>
</div>
</div>
</Auth>
<Auth :value="'btn.link'">
<div class="flex-warp-item">
<div class="flex-warp-item-box">
<el-button type="success" size="small" icon="el-icon-link">跳转 </el-button>
<el-button type="success" size="small">
<el-icon>
<elementLink />
</el-icon>
跳转
</el-button>
</div>
</div>
</Auth>
@ -40,28 +60,48 @@
<Auths :value="['btn.addsss', 'btn.edit', 'btn.delsss', 'btn.linksss']">
<div class="flex-warp-item">
<div class="flex-warp-item-box">
<el-button type="primary" size="small" icon="el-icon-document-add">新增 </el-button>
<el-button type="primary" size="small">
<el-icon>
<elementDocumentAdd />
</el-icon>
新增
</el-button>
</div>
</div>
</Auths>
<Auths :value="['btn.add', 'btn.edit', 'btn.del', 'btn.link']">
<div class="flex-warp-item">
<div class="flex-warp-item-box">
<el-button type="info" size="small" icon="el-icon-edit-outline">编辑</el-button>
<el-button type="info" size="small">
<el-icon>
<elementEdit />
</el-icon>
编辑
</el-button>
</div>
</div>
</Auths>
<Auths :value="['btn.add', 'btn.edit', 'btn.del', 'btn.link']">
<div class="flex-warp-item">
<div class="flex-warp-item-box">
<el-button type="danger" size="small" icon="el-icon-delete">删除 </el-button>
<el-button type="danger" size="small">
<el-icon>
<elementDelete />
</el-icon>
删除
</el-button>
</div>
</div>
</Auths>
<Auths :value="['btn.add', 'btn.edit', 'btn.del', 'btn.link']">
<div class="flex-warp-item">
<div class="flex-warp-item-box">
<el-button type="success" size="small" icon="el-icon-link">跳转 </el-button>
<el-button type="success" size="small">
<el-icon>
<elementLink />
</el-icon>
跳转
</el-button>
</div>
</div>
</Auths>
@ -72,28 +112,48 @@
<AuthAll :value="['btn.add', 'btn.edit', 'btn.del', 'btn.link']">
<div class="flex-warp-item">
<div class="flex-warp-item-box">
<el-button type="primary" size="small" icon="el-icon-document-add">新增 </el-button>
<el-button type="primary" size="small">
<el-icon>
<elementDocumentAdd />
</el-icon>
新增
</el-button>
</div>
</div>
</AuthAll>
<AuthAll :value="['btn.add', 'btn.edit', 'btn.del', 'btn.link']">
<div class="flex-warp-item">
<div class="flex-warp-item-box">
<el-button type="info" size="small" icon="el-icon-edit-outline">编辑</el-button>
<el-button type="info" size="small">
<el-icon>
<elementEdit />
</el-icon>
编辑
</el-button>
</div>
</div>
</AuthAll>
<AuthAll :value="['btn.add', 'btn.edit', 'btn.del', 'btn.link']">
<div class="flex-warp-item">
<div class="flex-warp-item-box">
<el-button type="danger" size="small" icon="el-icon-delete">删除 </el-button>
<el-button type="danger" size="small">
<el-icon>
<elementDelete />
</el-icon>
删除
</el-button>
</div>
</div>
</AuthAll>
<AuthAll :value="['btn.add', 'btn.edit', 'btn.del', 'btn.link']">
<div class="flex-warp-item">
<div class="flex-warp-item-box">
<el-button type="success" size="small" icon="el-icon-link">跳转 </el-button>
<el-button type="success" size="small">
<el-icon>
<elementLink />
</el-icon>
跳转
</el-button>
</div>
</div>
</AuthAll>
@ -106,22 +166,42 @@
<div class="flex-warp">
<div class="flex-warp-item" v-auth="'btn.add'">
<div class="flex-warp-item-box">
<el-button type="primary" size="small" icon="el-icon-document-add">新增 </el-button>
<el-button type="primary" size="small">
<el-icon>
<elementDocumentAdd />
</el-icon>
新增
</el-button>
</div>
</div>
<div class="flex-warp-item" v-auth="'btn.edit'">
<div class="flex-warp-item-box">
<el-button type="info" size="small" icon="el-icon-edit-outline">编辑</el-button>
<el-button type="info" size="small">
<el-icon>
<elementEdit />
</el-icon>
编辑
</el-button>
</div>
</div>
<div class="flex-warp-item" v-auth="'btn.del'">
<div class="flex-warp-item-box">
<el-button type="danger" size="small" icon="el-icon-delete">删除 </el-button>
<el-button type="danger" size="small">
<el-icon>
<elementDelete />
</el-icon>
删除
</el-button>
</div>
</div>
<div class="flex-warp-item" v-auth="'btn.link'">
<div class="flex-warp-item-box">
<el-button type="success" size="small" icon="el-icon-link">跳转 </el-button>
<el-button type="success" size="small">
<el-icon>
<elementLink />
</el-icon>
跳转
</el-button>
</div>
</div>
</div>
@ -130,22 +210,42 @@
<div class="flex-warp">
<div class="flex-warp-item" v-auths="['btn.addsss', 'btn.edit', 'btn.delsss', 'btn.linksss']">
<div class="flex-warp-item-box">
<el-button type="primary" size="small" icon="el-icon-document-add">新增 </el-button>
<el-button type="primary" size="small">
<el-icon>
<elementDocumentAdd />
</el-icon>
新增
</el-button>
</div>
</div>
<div class="flex-warp-item" v-auths="['btn.add', 'btn.edit', 'btn.del', 'btn.link']">
<div class="flex-warp-item-box">
<el-button type="info" size="small" icon="el-icon-edit-outline">编辑</el-button>
<el-button type="info" size="small">
<el-icon>
<elementEdit />
</el-icon>
编辑
</el-button>
</div>
</div>
<div class="flex-warp-item" v-auths="['btn.add', 'btn.edit', 'btn.del', 'btn.link']">
<div class="flex-warp-item-box">
<el-button type="danger" size="small" icon="el-icon-delete">删除 </el-button>
<el-button type="danger" size="small">
<el-icon>
<elementDelete />
</el-icon>
删除
</el-button>
</div>
</div>
<div class="flex-warp-item" v-auths="['btn.add', 'btn.edit', 'btn.del', 'btn.link']">
<div class="flex-warp-item-box">
<el-button type="success" size="small" icon="el-icon-link">跳转 </el-button>
<el-button type="success" size="small">
<el-icon>
<elementLink />
</el-icon>
跳转
</el-button>
</div>
</div>
</div>
@ -154,22 +254,42 @@
<div class="flex-warp">
<div class="flex-warp-item" v-auth-all="['btn.add', 'btn.edit', 'btn.del', 'btn.link']">
<div class="flex-warp-item-box">
<el-button type="primary" size="small" icon="el-icon-document-add">新增 </el-button>
<el-button type="primary" size="small">
<el-icon>
<elementDocumentAdd />
</el-icon>
新增
</el-button>
</div>
</div>
<div class="flex-warp-item" v-auth-all="['btn.add', 'btn.edit', 'btn.del', 'btn.link']">
<div class="flex-warp-item-box">
<el-button type="info" size="small" icon="el-icon-edit-outline">编辑</el-button>
<el-button type="info" size="small">
<el-icon>
<elementEdit />
</el-icon>
编辑
</el-button>
</div>
</div>
<div class="flex-warp-item" v-auth-all="['btn.add', 'btn.edit', 'btn.del', 'btn.link']">
<div class="flex-warp-item-box">
<el-button type="danger" size="small" icon="el-icon-delete">删除 </el-button>
<el-button type="danger" size="small">
<el-icon>
<elementDelete />
</el-icon>
删除
</el-button>
</div>
</div>
<div class="flex-warp-item" v-auth-all="['btn.add', 'btn.edit', 'btn.del', 'btn.link']">
<div class="flex-warp-item-box">
<el-button type="success" size="small" icon="el-icon-link">跳转 </el-button>
<el-button type="success" size="small">
<el-icon>
<elementLink />
</el-icon>
跳转
</el-button>
</div>
</div>
</div>
@ -181,17 +301,32 @@
<div class="flex-warp">
<div class="flex-warp-item">
<div class="flex-warp-item-box">
<el-button type="primary" size="small" icon="el-icon-document-add" @click="onAuthClick">新增 </el-button>
<el-button type="primary" size="small" @click="onAuthClick">
<el-icon>
<elementDocumentAdd />
</el-icon>
新增
</el-button>
</div>
</div>
<div class="flex-warp-item">
<div class="flex-warp-item-box">
<el-button type="info" size="small" icon="el-icon-edit-outline" @click="onAuthsClick">编辑</el-button>
<el-button type="info" size="small" @click="onAuthsClick">
<el-icon>
<elementEdit />
</el-icon>
编辑
</el-button>
</div>
</div>
<div class="flex-warp-item">
<div class="flex-warp-item-box">
<el-button type="danger" size="small" icon="el-icon-delete" @click="onAuthAllClick">删除 </el-button>
<el-button type="danger" size="small" @click="onAuthAllClick">
<el-icon>
<elementDelete />
</el-icon>
删除
</el-button>
</div>
</div>
</div>

View File

@ -8,7 +8,7 @@
:closable="false"
></el-alert>
<el-alert
:title="`当前用户页面权限:[${getAuthPageList}],当前用户按钮权限:[${getAuthBtnList}]`"
:title="`当前用户页面权限:[${getRoles}],当前用户按钮权限:[${getAuthBtnList}]`"
type="success"
:closable="false"
class="mt15"
@ -36,8 +36,8 @@ export default {
userAuth: '',
});
// 获取用户页面权限信息
const getAuthPageList = computed(() => {
return store.state.userInfos.userInfos.authPageList;
const getRoles = computed(() => {
return store.state.userInfos.userInfos.roles;
});
// 获取用户按钮权限信息
const getAuthBtnList = computed(() => {
@ -45,27 +45,28 @@ export default {
});
// 初始化用户权限
const initUserAuth = () => {
state.userAuth = store.state.userInfos.userInfos.authPageList[0];
state.userAuth = store.state.userInfos.userInfos.roles[0];
};
// 用户权限改变时
const onRadioChange = async () => {
// 模拟数据
resetRoute();
let defaultAuthPageList: Array<string> = [];
let defaultRoles: Array<string> = [];
let defaultAuthBtnList: Array<string> = [];
// admin 页面权限标识,对应路由 meta.auth,用于控制路由的显示/隐藏
let adminAuthPageList: Array<string> = ['admin'];
// admin 页面权限标识,对应路由 meta.roles,用于控制路由的显示/隐藏
let adminRoles: Array<string> = ['admin'];
// admin 按钮权限标识
let adminAuthBtnList: Array<string> = ['btn.add', 'btn.del', 'btn.edit', 'btn.link'];
// test 页面权限标识,对应路由 meta.auth,用于控制路由的显示/隐藏
let testAuthPageList: Array<string> = ['test'];
// test 页面权限标识,对应路由 meta.roles,用于控制路由的显示/隐藏
let testRoles: Array<string> = ['common'];
// test 按钮权限标识
let testAuthBtnList: Array<string> = ['btn.add', 'btn.link'];
// 不同用户模拟不同的用户权限
if (state.userAuth === 'admin') {
defaultAuthPageList = adminAuthPageList;
defaultRoles = adminRoles;
defaultAuthBtnList = adminAuthBtnList;
} else {
defaultAuthPageList = testAuthPageList;
defaultRoles = testRoles;
defaultAuthBtnList = testAuthBtnList;
}
const userInfos = {
@ -75,7 +76,7 @@ export default {
? 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1813762643,1914315241&fm=26&gp=0.jpg'
: 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=317673774,2961727727&fm=26&gp=0.jpg',
time: new Date().getTime(),
authPageList: defaultAuthPageList,
roles: defaultRoles,
authBtnList: defaultAuthBtnList,
};
Session.set('userInfo', userInfos);
@ -88,7 +89,7 @@ export default {
initUserAuth();
});
return {
getAuthPageList,
getRoles,
getAuthBtnList,
onRadioChange,
...toRefs(state),

View File

@ -1,24 +1,22 @@
<template>
<el-form class="login-content-form">
<el-form-item>
<el-input
type="text"
:placeholder="$t('message.account.accountPlaceholder1')"
prefix-icon="el-icon-user"
v-model="ruleForm.userName"
clearable
autocomplete="off"
>
<el-input type="text" :placeholder="$t('message.account.accountPlaceholder1')" v-model="ruleForm.userName" clearable autocomplete="off">
<template #prefix>
<el-icon class="el-input__icon"><elementUser /></el-icon>
</template>
</el-input>
</el-form-item>
<el-form-item>
<el-input
:type="isShowPassword ? 'text' : 'password'"
:placeholder="$t('message.account.accountPlaceholder2')"
prefix-icon="el-icon-lock"
v-model="ruleForm.password"
autocomplete="off"
>
<template #prefix>
<el-icon class="el-input__icon"><elementUnlock /></el-icon>
</template>
<template #suffix>
<i
class="iconfont el-input__icon login-content-password"
@ -36,11 +34,14 @@
type="text"
maxlength="4"
:placeholder="$t('message.account.accountPlaceholder3')"
prefix-icon="el-icon-position"
v-model="ruleForm.code"
clearable
autocomplete="off"
></el-input>
>
<template #prefix>
<el-icon class="el-input__icon"><elementPosition /></el-icon>
</template>
</el-input>
</el-col>
<el-col :span="8">
<div class="login-content-code">
@ -68,7 +69,7 @@ import { useStore } from '/@/store/index';
import { Session } from '/@/utils/storage';
import { formatAxis } from '/@/utils/formatTime';
export default defineComponent({
name: 'login',
name: 'loginAccount',
setup() {
const { t } = useI18n();
const { proxy } = getCurrentInstance() as any;
@ -92,23 +93,24 @@ export default defineComponent({
});
// 登录
const onSignIn = async () => {
// 模拟数据
state.loading.signIn = true;
let defaultAuthPageList: Array<string> = [];
let defaultRoles: Array<string> = [];
let defaultAuthBtnList: Array<string> = [];
// admin 页面权限标识,对应路由 meta.auth,用于控制路由的显示/隐藏
let adminAuthPageList: Array<string> = ['admin'];
// admin 页面权限标识,对应路由 meta.roles,用于控制路由的显示/隐藏
let adminRoles: Array<string> = ['admin'];
// admin 按钮权限标识
let adminAuthBtnList: Array<string> = ['btn.add', 'btn.del', 'btn.edit', 'btn.link'];
// test 页面权限标识,对应路由 meta.auth,用于控制路由的显示/隐藏
let testAuthPageList: Array<string> = ['test'];
// test 页面权限标识,对应路由 meta.roles,用于控制路由的显示/隐藏
let testRoles: Array<string> = ['common'];
// test 按钮权限标识
let testAuthBtnList: Array<string> = ['btn.add', 'btn.link'];
// 不同用户模拟不同的用户权限
if (state.ruleForm.userName === 'admin') {
defaultAuthPageList = adminAuthPageList;
defaultRoles = adminRoles;
defaultAuthBtnList = adminAuthBtnList;
} else {
defaultAuthPageList = testAuthPageList;
defaultRoles = testRoles;
defaultAuthBtnList = testAuthBtnList;
}
// 用户信息模拟数据
@ -119,7 +121,7 @@ export default defineComponent({
? 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1813762643,1914315241&fm=26&gp=0.jpg'
: 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=317673774,2961727727&fm=26&gp=0.jpg',
time: new Date().getTime(),
authPageList: defaultAuthPageList,
roles: defaultRoles,
authBtnList: defaultAuthBtnList,
};
// 存储 token 到浏览器缓存

View File

@ -1,28 +1,20 @@
<template>
<el-form class="login-content-form">
<el-form-item>
<el-input
type="text"
:placeholder="$t('message.mobile.placeholder1')"
prefix-icon="iconfont icon-dianhua"
v-model="ruleForm.userName"
clearable
autocomplete="off"
>
<el-input type="text" :placeholder="$t('message.mobile.placeholder1')" v-model="ruleForm.userName" clearable autocomplete="off">
<template #prefix>
<i class="iconfont icon-dianhua el-input__icon"></i>
</template>
</el-input>
</el-form-item>
<el-form-item>
<el-row :gutter="15">
<el-col :span="16">
<el-input
type="text"
maxlength="4"
:placeholder="$t('message.mobile.placeholder2')"
prefix-icon="el-icon-position"
v-model="ruleForm.code"
clearable
autocomplete="off"
></el-input>
<el-input type="text" maxlength="4" :placeholder="$t('message.mobile.placeholder2')" v-model="ruleForm.code" clearable autocomplete="off">
<template #prefix>
<el-icon class="el-input__icon"><elementPosition /></el-icon>
</template>
</el-input>
</el-col>
<el-col :span="8">
<el-button class="login-content-code">{{ $t('message.mobile.codeText') }}</el-button>
@ -40,7 +32,7 @@
<script lang="ts">
import { toRefs, reactive, defineComponent } from 'vue';
export default defineComponent({
name: 'login',
name: 'loginMobile',
setup() {
const state = reactive({
ruleForm: {
@ -58,9 +50,6 @@ export default defineComponent({
<style scoped lang="scss">
.login-content-form {
margin-top: 20px;
::v-deep(.el-input__icon) {
display: inline-block;
}
.login-content-code {
width: 100%;
padding: 0;

View File

@ -8,7 +8,7 @@
import { toRefs, reactive, defineComponent, onMounted, getCurrentInstance } from 'vue';
import QRCode from 'qrcodejs2-fixes';
export default defineComponent({
name: 'login11',
name: 'loginScan',
setup() {
const { proxy } = getCurrentInstance() as any;
const state = reactive({});

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>
@ -44,7 +45,7 @@ import Mobile from '/@/views/login/component/mobile.vue';
import Scan from '/@/views/login/component/scan.vue';
import { useStore } from '/@/store/index';
export default {
name: 'login',
name: 'loginIndex',
components: { Account, Mobile, Scan },
setup() {
const store = useStore();
@ -114,6 +115,9 @@ 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 {
@ -124,18 +128,16 @@ export default {
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: 0;
right: 0;
top: 2px;
right: 21px;
background: var(--el-color-white);
transform: rotate(-45deg);
}
&:hover {
opacity: 1;
@ -143,14 +145,13 @@ export default {
color: var(--color-primary);
}
i {
content: '';
width: 48px;
width: 47px;
height: 50px;
display: inline-block;
font-size: 48px;
position: absolute;
top: 0px;
right: 0px;
font-size: 47px;
z-index: 1;
right: 2px;
top: -1px;
}
}
}
@ -163,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

@ -1,15 +1,23 @@
<template>
<div class="drag-container">
<el-card shadow="hover" header="拖动指令效果v-drag作用于 Dialog 对话框">
<el-button type="primary" @click="dialogVisible = true" size="small" icon="el-icon-thumb">点击打开 Dialog</el-button>
<el-button type="primary" @click="dialogVisible = true" size="small">
<el-icon>
<elementPointer />
</el-icon>
点击打开 Dialog
</el-button>
</el-card>
<el-card shadow="hover" header="自定义div" class="mt15">
<div class="drag-dom">
<div class="drag-header">
<el-button type="success" size="small" icon="el-icon-thumb" v-drag="['.drag-container .drag-dom', '.drag-container .drag-header']"
>按住进行拖动测试</el-button
>
<el-button type="success" size="small" v-drag="['.drag-container .drag-dom', '.drag-container .drag-header']">
<el-icon>
<elementPointer />
</el-icon>
按住进行拖动测试
</el-button>
</div>
</div>
</el-card>

View File

@ -0,0 +1,175 @@
<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" circle size="mini" @click="onAddRow" v-if="k === 0">
<el-icon>
<elementPlus />
</el-icon>
</el-button>
<el-button type="danger" circle size="mini" @click="onDelRow(k)" v-else>
<el-icon>
<elementDelete />
</el-icon>
</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" @click="onResetForm">
<el-icon>
<elementRefreshRight />
</el-icon>
重置表单
</el-button>
<el-button size="small" type="primary" @click="onSubmitForm">
<SvgIcon name="iconfont icon-shuxing" />
验证表单
</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

@ -1,12 +1,12 @@
<template>
<div class="element-container">
<el-card shadow="hover" :header="`element plus 字体图标(自动载入)${sheetsIconList.length - 2}个`">
<el-card shadow="hover" :header="`element plus 字体图标(自动载入,增加了 element 前缀使用时elementAim)${sheetsIconList.length}个`">
<el-row class="iconfont-row">
<el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="2" v-for="(v, k) in sheetsIconList" :key="k">
<div class="iconfont-warp">
<div class="flex-margin">
<div class="iconfont-warp-value">
<i :class="v"></i>
<SvgIcon :name="v" />
</div>
<div class="iconfont-warp-label mt10">{{ v }}</div>
</div>
@ -26,9 +26,11 @@ export default {
const state = reactive({
sheetsIconList: [],
});
// 初始化获取 css 样式,获取 element plus 自带图标
// 初始化获取 css 样式,获取 element plus 自带 svg 图标,增加了 element 前缀使用时elementAim
const initGetStyleSheets = () => {
initIconfont.ele().then((res: any) => (state.sheetsIconList = res));
initIconfont.ele().then((res: any) => {
state.sheetsIconList = res;
});
};
// 页面加载时
onMounted(() => {

View File

@ -72,7 +72,10 @@
</el-col>
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<el-form-item>
<el-button type="primary" icon="iconfont icon-biaodan">更新个人信息</el-button>
<el-button type="primary">
<SvgIcon name="iconfont icon-biaodan" />
更新个人信息
</el-button>
</el-form-item>
</el-col>
</el-row>

View File

@ -5,8 +5,14 @@
<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>
<el-button size="small" @click="onResetForm">
<SvgIcon name="elementRefreshRight" />
重置表单
</el-button>
<el-button size="small" type="primary" @click="onSubmitForm">
<SvgIcon name="iconfont icon-shuxing" />
验证表单
</el-button>
</div>
</el-row>
</div>

View File

@ -54,7 +54,7 @@
<script lang="ts">
import { toRefs, reactive, onMounted } from 'vue';
import { useRouter } from 'vue-router';
import { lazyImgLoading } from '/@/utils/lazyImgLoading';
import other from '/@/utils/other';
import { filterList } from './mock';
export default {
name: 'pagesListAdapt',
@ -88,7 +88,7 @@ export default {
};
// 页面加载时
onMounted(() => {
lazyImgLoading('[data-lazy-img-list]', state.tableData.data);
other.lazyImg('[data-lazy-img-list]', state.tableData.data);
});
return {
onTableItemClick,

View File

@ -2,14 +2,29 @@
<div class="steps-container">
<el-card shadow="hover" header="element-plus 步骤条">
<el-steps :active="stepsActive">
<el-step title="第一步" icon="iconfont icon-0_round_solid"></el-step>
<el-step title="第二步" icon="iconfont icon-2_round_solid"></el-step>
<el-step title="第三步" icon="iconfont icon-3_round_solid"></el-step>
<el-step title="第一步">
<template #icon>
<SvgIcon name="iconfont icon-0_round_solid" />
</template>
</el-step>
<el-step title="第二步">
<template #icon>
<SvgIcon name="iconfont icon-2_round_solid" />
</template>
</el-step>
<el-step title="第三步">
<template #icon>
<SvgIcon name="iconfont icon-3_round_solid" />
</template>
</el-step>
</el-steps>
<el-result icon="error" title="成功提示" subTitle="请根据提示进行操作" v-if="stepsActive === 1"> </el-result>
<el-result icon="success" title="成功提示" subTitle="请根据提示进行操作" v-if="stepsActive === 1"> </el-result>
<el-result icon="warning" title="警告提示" subTitle="请根据提示进行操作" v-else-if="stepsActive === 2"> </el-result>
<el-result icon="success" title="错误提示" subTitle="请根据提示进行操作" v-else-if="stepsActive === 3"> </el-result>
<el-button @click="onNextSteps" size="small" class="mt15" type="primary" icon="iconfont icon-step">下一步</el-button>
<el-result icon="error" title="错误提示" subTitle="请根据提示进行操作" v-else-if="stepsActive === 3"> </el-result>
<el-button @click="onNextSteps" size="small" class="mt15" type="primary">
<SvgIcon name="iconfont icon-step" />
下一步
</el-button>
</el-card>
</div>
</template>

View File

@ -22,7 +22,10 @@
</template>
</el-tree>
</div>
<el-button @click="onSelect" class="mt15" size="small" type="primary" icon="iconfont icon-shuxingtu">选择元素</el-button>
<el-button @click="onSelect" class="mt15" size="small" type="primary">
<SvgIcon name="iconfont icon-shuxingtu" />
选择元素
</el-button>
</el-card>
</div>
</template>
@ -76,7 +79,7 @@ export default {
ElMessage.warning('请选择元素');
return;
} else {
console.log(proxy.$refs.treeTable.getCheckedNodes());
// console.log(proxy.$refs.treeTable.getCheckedNodes());
}
};
// 初始化树模拟数据

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

@ -5,37 +5,58 @@
<div class="flex-warp">
<div class="flex-warp-item">
<div class="flex-warp-item-box">
<el-button size="small" icon="iconfont icon-bolangnengshiyanchang" v-waves>默认效果</el-button>
<el-button size="small" v-waves>
<SvgIcon name="iconfont icon-bolangnengshiyanchang" />
默认效果
</el-button>
</div>
</div>
<div class="flex-warp-item">
<div class="flex-warp-item-box">
<el-button type="primary" size="small" icon="iconfont icon-bolangnengshiyanchang" v-waves="'light'">light 效果</el-button>
<el-button type="primary" size="small" v-waves="'light'">
<SvgIcon name="iconfont icon-bolangnengshiyanchang" />
light 效果
</el-button>
</div>
</div>
<div class="flex-warp-item">
<div class="flex-warp-item-box">
<el-button type="success" size="small" icon="iconfont icon-bolangnengshiyanchang" v-waves="'red'">red 效果</el-button>
<el-button type="success" size="small" v-waves="'red'">
<SvgIcon name="iconfont icon-bolangnengshiyanchang" />
red 效果
</el-button>
</div>
</div>
<div class="flex-warp-item">
<div class="flex-warp-item-box">
<el-button type="info" size="small" icon="iconfont icon-bolangnengshiyanchang" v-waves="'orange'">orange 效果</el-button>
<el-button type="info" size="small" v-waves="'orange'">
<SvgIcon name="iconfont icon-bolangnengshiyanchang" />
orange 效果
</el-button>
</div>
</div>
<div class="flex-warp-item">
<div class="flex-warp-item-box">
<el-button type="warning" size="small" icon="iconfont icon-bolangnengshiyanchang" v-waves="'purple'">purple 效果</el-button>
<el-button type="warning" size="small" v-waves="'purple'">
<SvgIcon name="iconfont icon-bolangnengshiyanchang" />
purple 效果
</el-button>
</div>
</div>
<div class="flex-warp-item">
<div class="flex-warp-item-box">
<el-button type="danger" size="small" icon="iconfont icon-bolangnengshiyanchang" v-waves="'green'">green 效果</el-button>
<el-button type="danger" size="small" v-waves="'green'">
<SvgIcon name="iconfont icon-bolangnengshiyanchang" />
green 效果
</el-button>
</div>
</div>
<div class="flex-warp-item">
<div class="flex-warp-item-box">
<el-button type="primary" size="small" icon="iconfont icon-bolangnengshiyanchang" v-waves="'teal'">teal 效果</el-button>
<el-button type="primary" size="small" v-waves="'teal'">
<SvgIcon name="iconfont icon-bolangnengshiyanchang" />
teal 效果
</el-button>
</div>
</div>
</div>
@ -89,7 +110,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

@ -4,7 +4,10 @@
<el-result icon="success" title="普通路由" subTitle="可 `开启 TagsView 共用` 进行单标签测试">
<template #extra>
<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>
<el-button type="primary" size="small" class="mt15" @click="onGoDetailsClick">
<SvgIcon name="iconfont icon-putong" />
普通路由传参
</el-button>
</template>
</el-result>
</div>

View File

@ -4,7 +4,10 @@
<el-result icon="warning" title="动态路由" subTitle="可 `开启 TagsView 共用` 进行单标签测试">
<template #extra>
<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>
<el-button type="primary" size="small" class="mt15" @click="onGoDetailsClick">
<SvgIcon name="iconfont icon-dongtai" />
动态路由传参
</el-button>
</template>
</el-result>
</div>

View File

@ -66,7 +66,7 @@
<el-row :gutter="15" class="personal-recommend-row">
<el-col :sm="6" v-for="(v, k) in recommendList" :key="k" class="personal-recommend-col">
<div class="personal-recommend" :style="{ 'background-color': v.bg }">
<i :class="v.icon" :style="{ color: v.iconColor }"></i>
<SvgIcon :name="v.icon" :style="{ color: v.iconColor }" />
<div class="personal-recommend-auto">
<div>{{ v.title }}</div>
<div class="personal-recommend-msg">{{ v.msg }}</div>
@ -122,7 +122,12 @@
</el-col>
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<el-form-item>
<el-button type="primary" icon="el-icon-position">更新个人信息</el-button>
<el-button type="primary">
<el-icon>
<elementPosition />
</el-icon>
更新个人信息
</el-button>
</el-form-item>
</el-col>
</el-row>
@ -248,7 +253,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 +265,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 +283,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 +299,7 @@ export default {
.personal-recommend {
position: relative;
height: 100px;
color: #ffffff;
color: var(--color-whites);
border-radius: 3px;
overflow: hidden;
cursor: pointer;
@ -330,7 +335,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 +348,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 +359,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;
}

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