19 Commits

Author SHA1 Message Date
lyt
4408b04b0f 'admin-22.02.21:更新版本v2.0.0,更新内容查看根目录CHANGELOG.md' 2022-02-21 23:52:59 +08:00
lyt
920c705421 'admin-21.12.30:新增tagsview风格5' 2021-12-30 20:24:35 +08:00
98e75351b8 !17 修复 修改elementPlus 组件size无效BUG
Merge pull request !17 from P)/master
2021-12-23 11:50:33 +00:00
P)
8ae48b5c7c 修复 修改elementPlus 组件size无效BUG 2021-12-23 05:11:31 +00:00
lyt
616de6e06b 'admin-21.12.22:优化打包时警告问题' 2021-12-22 21:37:33 +08:00
e2db218ca8 update vite.config.ts. 2021-12-22 03:25:32 +00:00
6a6b95b725 'admin-21.12.21:更新优化内容请看CHANGELOG.md文件' 2021-12-21 13:49:55 +00:00
lyt
73db2121ff 'admin-21.12.21:更新优化内容请看CHANGELOG.md文件' 2021-12-21 21:35:01 +08:00
lyt
9051c31771 'admin-21.12.21:更新优化内容请看CHANGELOG.md文件' 2021-12-21 21:32:26 +08:00
lyt
18ef20b230 'admin-21.12.17:修复tagsView拖拽问题,感谢@简单爱、' 2021-12-17 20:19:11 +08:00
lyt
ec5911a987 'admin-21.12.16:优化登录页、添加开发文档连接' 2021-12-16 21:10:17 +08:00
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
201 changed files with 8867 additions and 13705 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,68 @@
🎉🎉🔥 `vue-next-admin` 基于 vue3.x 、Typescript、vite、Element plus 等适配手机、平板、pc 的后台开源免费模板库vue2.x 请切换 vue-prev-admin 分支)
## 2.0.0
`2022.02.21`
⚡⚡⚡ 此版本为破环性更新,优化内容如下:(谨慎更新!谨慎更新!!谨慎更新!!!)。演示界面建议直接覆盖文件。如需使用之前版本,请前往[gitee 发行版](https://gitee.com/lyt-top/vue-next-admin/releases) 进行对应版本下载。基础版会基于 `master` 分支进行修改
- 🌟 更新 依赖更新最新版本
- 🌟 更新 登录页、首页
- 💔 移除 vue-web-screen-shot
- 💔 移除 城市多级联动,完整 json 数据请去 [vue-next-admin-images/menu](https://gitee.com/lyt-top/vue-next-admin-images/tree/master/menu) 仓库查看
- 💔 移除 功能/echartsTree 树图
- 💔 移除 其它设置/Tagsview 风格 2、Tagsview 风格 3
- 💔 移除 功能/验证器
- 🚧 调整 src/api 编写方式
- 🚧 调整 自定义封装公用组件演示,更好的维护
- 🎉 新增 Volar 支持vs code 配置参考 [Vue Language Features (Volar)](https://lyt-top.gitee.io/vue-next-admin-doc-preview/home/vscode/)
- 🎉 新增 `SvgIcon` 支持本地 svg 图标使用
- 🎉 新增 表单表格验证演示
- 🎯 优化 全局主题(移除 success、info、warning、danger
- 🎯 优化 工作流(开源)
- 🎯 优化 element plus svg 图标,`elementXXX` 改成 `ele-XXX`
- 🌈 重构 深色模式
- 🌹 合并 [处理 parent 的 h100 由于外层有 min-height 导致失效的问题](https://gitee.com/lyt-top/vue-next-admin/pulls/20),感谢@MaxNull@21030442-mao
- 🐞 修复 element plus 升级 `^1.3.0-beta.5` 后 组件 size 大小问题(大改:涉及布局、演示界面)
- 🐞 修复 vs code 使用 Vue Language Features (Volar) 插件 代码报红问题(可以把公用的 ts 类型定义封装起来公用)
## 1.2.2
`2021.12.21`
- 🌟 更新 依赖更新最新版本
- 🎯 优化 iframes 滚动条问题
- 🎯 优化 部署后每次都要强制刷新清浏览器缓存问题
- 🎉 新增 工具类百分比验证演示
- 🐞 修复 [tag-view 标签右键会超出浏览器 #I4KN78](https://gitee.com/lyt-top/vue-next-admin/issues/I4KN78)
## 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`

View File

@ -68,29 +68,29 @@ cnpm run dev
cnpm run build
```
#### 🍉 git 命令
- 在本地新建一个分支:`git branch newBranch`
- 切换到你的新分支:`git checkout newBranch`
- 将新分支发布在 github、gitee 上:`git push origin newBranch`
- 在本地删除一个分支:`git branch -d newBranch`
- 在 github 远程端删除一个分支:`git push origin :newBranch (分支名前的冒号代表删除)`
- 注意删除远程分支后,如果有对应的本地分支,本地分支并不会同步删除!
#### 💯 学习交流加 QQ 群
- 若加群了没同意(一般不会超过一天),那就是群满了,请换一个群试试
- 查看开发文档<a href="https://lyt-top.gitee.io/vue-next-admin-preview/#/login" target="_blank">vue-next-admin</a> 开发文档正在编写中...
- 若加群了没同意(一般秒过),那就是群满了500 人群),请换一个群试试3 群未满
- 查看开发文档<a href="https://lyt-top.gitee.io/vue-next-admin-doc-preview" target="_blank">vue-next-admin-doc</a>
- 群号码:
1 群:<a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=RdUY97Vx0T0vZ_1OOu-X1yFNkWgDwbjC&jump_from=webapi">665452019</a>
2 群:<a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=zVfy3gNy7pNWVK3kMduDzwU369PZg2fw&jump_from=webapi">766356862</a>
3 群:<a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=02EWb5P2JkP-8iwzaDadgFdxA0HSHPpn&jump_from=webapi">795345435</a>
<a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=RdUY97Vx0T0vZ_1OOu-X1yFNkWgDwbjC&jump_from=webapi">
<img src="https://gitee.com/lyt-top/vue-next-admin-images/raw/master/user/qq1.png" width="220" height="220" alt="vue-next-admin 讨论群" title="vue-next-admin 讨论群1"/>
<img src="https://gitee.com/lyt-top/vue-next-admin-images/raw/master/user/qq1.png" width="220" height="220" alt="vue-next-admin 讨论群1" title="vue-next-admin 讨论群1"/>
</a>
<a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=zVfy3gNy7pNWVK3kMduDzwU369PZg2fw&jump_from=webapi">
<img src="https://gitee.com/lyt-top/vue-next-admin-images/raw/master/user/qq2.png" width="220" height="220" alt="vue-next-admin 讨论群" title="vue-next-admin 讨论群2"/>
<img src="https://gitee.com/lyt-top/vue-next-admin-images/raw/master/user/qq2.png" width="220" height="220" alt="vue-next-admin 讨论群2" title="vue-next-admin 讨论群2"/>
</a>
<a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=02EWb5P2JkP-8iwzaDadgFdxA0HSHPpn&jump_from=webapi">
<img src="https://gitee.com/lyt-top/vue-next-admin-images/raw/master/user/qq3.png" width="220" height="220" alt="vue-next-admin 讨论群3" title="vue-next-admin 讨论群3"/>
</a>
#### 💒 集成后端
- <a target="_blank" href="https://github.com/PandaGoAdmin/PandaX">@熊猫 PandaGoAdmin</a>
- <a target="_blank" href="https://www.gnet.top/public">@甜蜜蜜 GoPro 平台</a>
#### ❤️ 鸣谢列表
@ -98,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>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta

7651
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,58 +1,56 @@
{
"name": "vue-next-admin",
"version": "1.1.2",
"version": "2.0.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.23.0",
"@element-plus/icons-vue": "^0.2.7",
"axios": "^0.26.0",
"countup.js": "^2.0.8",
"cropperjs": "^1.5.12",
"echarts": "^5.2.1",
"echarts": "^5.3.0",
"echarts-gl": "^2.0.8",
"echarts-wordcloud": "^2.0.0",
"element-plus": "^1.1.0-beta.20",
"element-plus": "^2.0.2",
"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.1",
"sortablejs": "^1.14.0",
"splitpanes": "^3.0.4",
"vue": "^3.2.20",
"splitpanes": "^3.0.6",
"vue": "^3.2.31",
"vue-clipboard3": "^1.0.1",
"vue-grid-layout": "^3.0.0-beta1",
"vue-i18n": "^9.1.9",
"vue-router": "^4.0.12",
"vue-web-screen-shot": "^1.2.0",
"vuex": "^4.0.2",
"wangeditor": "^4.7.8"
"wangeditor": "^4.7.11"
},
"devDependencies": {
"@types/axios": "^0.14.0",
"@types/clipboard": "^2.0.1",
"@types/node": "^16.11.0",
"@types/node": "^17.0.19",
"@types/nprogress": "^0.2.0",
"@types/sortablejs": "^1.10.7",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"@vitejs/plugin-vue": "^1.9.3",
"@vue/compiler-sfc": "^3.2.20",
"dotenv": "^10.0.0",
"eslint": "^8.0.1",
"eslint-plugin-vue": "^7.19.1",
"prettier": "^2.4.1",
"sass": "^1.43.2",
"sass-loader": "^12.2.0",
"typescript": "^4.4.4",
"vite": "^2.6.7",
"vue-eslint-parser": "^7.11.0"
"@typescript-eslint/eslint-plugin": "^5.12.0",
"@typescript-eslint/parser": "^5.12.0",
"@vitejs/plugin-vue": "^2.2.2",
"@vue/compiler-sfc": "^3.2.31",
"dotenv": "^16.0.0",
"eslint": "^8.9.0",
"eslint-plugin-vue": "^8.4.1",
"prettier": "^2.5.1",
"sass": "^1.49.8",
"sass-loader": "^12.6.0",
"typescript": "^4.5.5",
"vite": "^2.8.4",
"vue-eslint-parser": "^8.2.0"
},
"browserslist": [
"> 1%",

2
plugins.d.ts vendored
View File

@ -1 +1,3 @@
declare module 'vue-grid-layout';
declare module 'qrcodejs2-fixes';
declare module 'splitpanes';

View File

@ -1,5 +1,5 @@
<template>
<el-config-provider :locale="i18nLocale">
<el-config-provider :size="getGlobalComponentSize" :locale="i18nLocale">
<router-view v-show="getThemeConfig.lockScreenTime !== 0" />
<LockScreen v-if="getThemeConfig.isLockScreen" />
<Setings ref="setingsRef" v-show="getThemeConfig.lockScreenTime !== 0" />
@ -11,7 +11,7 @@
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 other from '/@/utils/other';
import { Local, Session } from '/@/utils/storage';
import setIntroduction from '/@/utils/setIconfont';
import LockScreen from '/@/layout/lockScreen/index.vue';
@ -21,11 +21,10 @@ export default defineComponent({
name: 'app',
components: { LockScreen, Setings, CloseFull },
setup() {
const { proxy } = getCurrentInstance() as any;
const { proxy } = <any>getCurrentInstance();
const setingsRef = ref();
const route = useRoute();
const store = useStore();
const title = useTitle();
const state = reactive({
i18nLocale: null,
});
@ -33,6 +32,10 @@ export default defineComponent({
const getThemeConfig = computed(() => {
return store.state.themeConfig.themeConfig;
});
// 获取全局组件大小
const getGlobalComponentSize = computed(() => {
return other.globalComponentSize;
});
// 布局配置弹窗打开
const openSetingsDrawer = () => {
setingsRef.value.openDrawer();
@ -53,7 +56,7 @@ export default defineComponent({
});
// 设置 i18nApp.vue 中的 el-config-provider
proxy.mittBus.on('getI18nConfig', (locale: string) => {
state.i18nLocale = locale;
(state.i18nLocale as string | null) = locale;
});
// 获取缓存中的布局配置
if (Local.get('themeConfig')) {
@ -75,12 +78,13 @@ export default defineComponent({
watch(
() => route.path,
() => {
title();
other.useTitle();
}
);
return {
setingsRef,
getThemeConfig,
getGlobalComponentSize,
...toRefs(state),
};
},

View File

@ -1,27 +1,25 @@
import request from '/@/utils/request';
/**
* 用户登录
* @param params 要传的参数值
* @returns 返回接口数据
* 登录api接口集合
* @method signIn 用户登录
* @method signOut 用户退出登录
*/
export function signIn(params: object) {
return request({
url: '/user/signIn',
method: 'post',
data: params,
});
}
/**
* 用户退出登录
* @param params 要传的参数值
* @returns 返回接口数据
*/
export function signOut(params: object) {
return request({
url: '/user/signOut',
method: 'post',
data: params,
});
export function useLoginApi() {
return {
signIn: (params: object) => {
return request({
url: '/user/signIn',
method: 'post',
data: params,
});
},
signOut: (params: object) => {
return request({
url: '/user/signOut',
method: 'post',
data: params,
});
},
};
}

View File

@ -3,32 +3,24 @@ import request from '/@/utils/request';
/**
* 后端控制菜单模拟json路径在 https://gitee.com/lyt-top/vue-next-admin-images/tree/master/menu
* 后端控制路由isRequestRoutes 为 true则开启后端控制路由
* @method getMenuAdmin 获取后端动态路由菜单(admin)
* @method getMenuTest 获取后端动态路由菜单(test)
*/
/**
* 获取后端动态路由菜单(admin)
* @link 参考https://gitee.com/lyt-top/vue-next-admin-images/tree/master/menu
* @param params 要传的参数值,非必传
* @returns 返回接口数据
*/
export function getMenuAdmin(params?: object) {
return request({
url: '/gitee/lyt-top/vue-next-admin-images/raw/master/menu/adminMenu.json',
method: 'get',
params,
});
}
/**
* 获取后端动态路由菜单(test)
* @link 参考https://gitee.com/lyt-top/vue-next-admin-images/tree/master/menu
* @param params 要传的参数值,非必传
* @returns 返回接口数据
*/
export function getMenuTest(params?: object) {
return request({
url: '/gitee/lyt-top/vue-next-admin-images/raw/master/menu/testMenu.json',
method: 'get',
params,
});
export function useMenuApi() {
return {
getMenuAdmin: (params?: object) => {
return request({
url: '/gitee/lyt-top/vue-next-admin-images/raw/master/menu/adminMenu.json',
method: 'get',
params,
});
},
getMenuTest: (params?: object) => {
return request({
url: '/gitee/lyt-top/vue-next-admin-images/raw/master/menu/testMenu.json',
method: 'get',
params,
});
},
};
}

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 26 KiB

9
src/assets/logo-mini.svg Normal file
View File

@ -0,0 +1,9 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 50" width="64" height="50">
<defs>
<image width="64" height="50" id="img1" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAyCAYAAADsg90UAAAAAXNSR0IB2cksfwAACI5JREFUeJy1WgtsW9UZdvNq0xU6WhZoCCVx7Gunbld1GSsMdYpGREhwr+2IMbQWqRoTk+iWPZi2wWhm1kwEmqV52feRJrbvvd6DiUnbQCAemzY2xh4tSB0wOqZIqAtLYzultIWEpt13btLq+sap/R8nRzpK4vh+5/++85///8851yEk1V+hX6B0tyE3OWwt0x789VR78AKlZ0KBz1oxBE3+BdUW9PNuQ7nJbk/BDQ/v4hi0x44z1R64jyrAVCjQ/fLNN8/ZoUWdgqGc57AFE6I86giH+QRw6XI9QE4RBz3iTAyVW3EyQdEDUmeIIhyeFNtMHO/o0B4e8qYASfVvLk2p4BKgdnioFCAvEQeddhnyFivOpOgvBaFXiAKcygQDrk927S/zjkae5xUA/X3YI/C5AFwHLrSPw+2+YYfCMugiCvDaCbGt0hc9uAXuP1OEAPACZQ+fAGguQ9nGgglx0OfsOAhq24lBcG/YYQa/kWLIz3XlCW4B6mKRCoCMEQdNu3VpnRVnMhBYA2L/LVCATCooXuNJSHXFzv58P+mMyyu5RQDAKNntdLnNjoN0+NMCM0D8901NDkGXuyBAseRZn3Ubagu3AFjTd1GXAdZdpCqurMgSIBS4BwRn8wgwje/d4pV6yz2adGQJyM/bo/ZyC+DSlWqApIiDHqtPyFdlCyBeD4Lv5xHgr5mAWO4ZjTRh9s8tlQDoryIbrOISoLYvvAIALxIHnIHn3GnFmfDfztLhH/IEv/vYd72xyKElJM/6Gdjj4fYCuNA3yYMa6ogdBwQfvIwAk+mguHZz3+MbMPsfLrEALD3v5RfAkH3UOID+Jqqwj2ULIDZeJvhF2He8I0NfX2ry8wI85VSy41LBzaUPsXT4L/Iy0OUbrTgpsXUlyI7lEOAsvGOboPRdKejK28shAPqpek1etxjHArxAiXCo/pAdB2QPLRQg8BLcv8ITi4h4bnaZBGD2+IsQQG0DCDUyv2LfjcHVQyB93iLAecz+bvY/T1x6YrnImwIkVakIAeSrAfIucdCz7qRcY8VJh8RrQDplWfvHxttaVvkGe6vg/h8tpwDoR926wpcOb9CkEhQ4Mbrqym4rTkrcydLhs5bU95Wwwwx+311m8qxPQ4CtvE6AdKjcLlCrQkNJXNXdnYUD0t+eF+AE1v76rV0/qvTEo/8kkkGJq/yFLIKhPsgtgEszl8E4cdAxPHdllgDBwGZW9k6Fguaa9A4PtMEwkrDe0chhCPAZ/E5dNn/kPiWqGe5mVSH1rJCdze2w4rDNDsi/gdn/FPtb0KTfUmeyQenvuE45WCLQd6unsc3fwKeAw0yHX+Zwu247DpbB3emQv3R7x7du8GgybdtrKGc39Ty23rQnqfKk5y9wCwD1XACZJg56xGUMZFVhx1taytjPBnWAfuihyT+3TEiAQwC1Mhzmqwrr9QhbBoeJg36A6Ou0Y/kGe2qQ+mhiGspHDcODTZfs0eRr8fkE0Z4xpyGt4RJgTnX1carq8Jw9dhzv6BB5k+VJyK9t6+y8dNK74bGHMSHK00Scc/CC7fwC6MotAjX6GuqTzsTBkosYW/f9YKUnIb1OFiAW/c4Ce5Lq18jLKKnu5xaApTWBHn0n8Nz6ixhw4zvJ5HXlvU2R3gWui02XizwhrEznbTW9vQ64nUEckBUut13EQOHzFFUA70jErBv+09xcYrXHqUXK8H9qIXXapSs1dm4FN1SF95DdzlD72LMNUt/15CMvXT65NfzIRtQOq5FCv7jAHkPppdqDZ3YvZFZgY8WEQN8dvvFxpB8hLvWT3T8uyWxckG9CEfX38fk0ahGgmboMMIk/2xg5UJKbYZ62sf9RbI7UPxGJzLgT0R2Y/RM0z1HO+QZ6Gl/3+dh2Wmdb6HQwUJc9IfI6fPc40Z5xCLeW2wvw8Pfoy0B5mfoMAuYLn+7oKE0FxZqp+YvWTHugw24PvvtLIjZLh83cAghzmxHqASb5qntz/4EvsfEy7UHroepvJoKtWdUcPPKrVGwsA6k2FuYTAPXAGoC8RfYCStflqRvv3VuB4Hc1SI9bBJjAZ1VWe+p1+TqBHpfG+M8Ksa0EgLacAnhiETNzIPjdbztLPIfPWrME0CSkQ+UfxDFmkQ5v5RPAYcYBckFTcDfUWc+hwZsw06tA+EiOi5RoDns66ctA/Qm3AE4tuhYgZ5Zl9uPR32165PtlINoMwjM5jtPfSvn9WTe/iEufw7PUW+U3a2NSKZ8CTU0s+DyzHAJgq9yuNDaywxNtkQuVWaTDBqs5SIdsQt4hjsXOCvmvzrDu6Fdnebo3Hj3u69xXngoFqkH09KL3ie2BB6y2XCsfZNt1apnOqsL7uY/KoB57k+SDJRUhIZlX2iD4UJ4b5ef+3dqabY9hlunUdPt0XXyIryqs1yKVAv3qbPFuKNNedaAR5FeD4NE8AqRTwZ1ZmxqnHv0EcI4Rxz3hNqSqxThevrEXqpJq31IJgOD3TN3+h0tYmmPpLt9bJex80W4SRBzmEF7kE8Bhbo5aONwutwCx6K4JUVyByu/JfOTn+6EFAiTNN1uoAgxyC1BvqFcAZLJo8pr8rlvuq8wExfpFUl+u/s7/dt6R9UKkS5ergHeaOP6Yc2SQLw7Mqa6SDznsHakvzLAyoeAPCyRvVoXpUGCb1ZZqRWFnhdQXPWcg3Jac5App7C2MImf/5Kb+nupJ0X8FSL1NEOACEyyHPQ9QbWA73CIEkBuEIqrCzUO9CsNB6esCqQ8pAqD/Oe33l9vs2SLQd6svuhJSWW6GeVptLFKGbMD9eltjZ2cjw5m4o60ChF4lCvBeJhjIuntAYF4N3KNEO9Lwgmo+F/D5mNt1cbr/2OeD916qx+HSB4gCsDdNdmXZM7dbjRJtYXeZd/EJ4DDX3Q4uARLSj604yO23UgVA2jRy2EO+OkNX/w+fZNm8pw5QbAAAAABJRU5ErkJggg=="/>
</defs>
<style>
tspan { white-space:pre }
</style>
<use id="Background" href="#img1" x="0" y="0" />
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -3,9 +3,9 @@
</template>
<script lang="ts">
import { computed } from 'vue';
import { computed, defineComponent } from 'vue';
import { useStore } from '/@/store/index';
export default {
export default defineComponent({
name: 'auth',
props: {
value: {
@ -17,11 +17,11 @@ export default {
const store = useStore();
// 获取 vuex 中的用户权限
const getUserAuthBtnList = computed(() => {
return store.state.userInfos.userInfos.authBtnList.some((v: any) => v === props.value);
return store.state.userInfos.userInfos.authBtnList.some((v: string) => v === props.value);
});
return {
getUserAuthBtnList,
};
},
};
});
</script>

View File

@ -3,10 +3,10 @@
</template>
<script lang="ts">
import { computed } from 'vue';
import { computed, defineComponent } from 'vue';
import { useStore } from '/@/store/index';
import { judementSameArr } from '/@/utils/arrayOperation';
export default {
export default defineComponent({
name: 'authAll',
props: {
value: {
@ -24,5 +24,5 @@ export default {
getUserAuthBtnList,
};
},
};
});
</script>

View File

@ -3,9 +3,9 @@
</template>
<script lang="ts">
import { computed } from 'vue';
import { computed, defineComponent } from 'vue';
import { useStore } from '/@/store/index';
export default {
export default defineComponent({
name: 'auths',
props: {
value: {
@ -18,7 +18,7 @@ export default {
// 获取 vuex 中的用户权限
const getUserAuthBtnList = computed(() => {
let flag = false;
store.state.userInfos.userInfos.authBtnList.map((val: any) => {
store.state.userInfos.userInfos.authBtnList.map((val: string) => {
props.value.map((v) => {
if (val === v) flag = true;
});
@ -29,5 +29,5 @@ export default {
getUserAuthBtnList,
};
},
};
});
</script>

View File

@ -23,8 +23,8 @@
</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="onCancel" size="small"> </el-button>
<el-button type="primary" @click="onSubmit" size="small"> </el-button>
<el-button @click="onCancel" size="default"> </el-button>
<el-button type="primary" @click="onSubmit" size="default"> </el-button>
</span>
</template>
</el-dialog>
@ -32,16 +32,17 @@
</template>
<script lang="ts">
import { reactive, toRefs, nextTick } from 'vue';
import { reactive, toRefs, nextTick, defineComponent } from 'vue';
import Cropper from 'cropperjs';
import 'cropperjs/dist/cropper.css';
export default {
export default defineComponent({
name: 'cropperIndex',
setup() {
const state = reactive({
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, {
(<any>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 = (<any>state.cropper).getCroppedCanvas().toDataURL('image/jpeg');
},
});
};
@ -87,7 +90,7 @@ export default {
...toRefs(state),
};
},
};
});
</script>
<style scoped lang="scss">
@ -99,7 +102,7 @@ export default {
height: 350px;
flex: 1;
border: var(--el-border-base);
background: var(--color-whites);
background: var(--el-color-white);
overflow: hidden;
background-repeat: no-repeat;
cursor: move;

View File

@ -1,296 +0,0 @@
<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

@ -1,453 +0,0 @@
<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

@ -1,473 +0,0 @@
<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

@ -1,434 +0,0 @@
<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

@ -5,9 +5,15 @@
</template>
<script lang="ts">
import { toRefs, reactive, onMounted } from 'vue';
import { toRefs, reactive, onMounted, watch, defineComponent } from 'vue';
import wangeditor from 'wangeditor';
export default {
// 定义接口来定义对象的类型
interface WangeditorState {
editor: any;
}
export default defineComponent({
name: 'wngEditor',
props: {
// 节点 id
@ -20,20 +26,26 @@ export default {
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({
const state = reactive<WangeditorState>({
editor: null,
});
// 初始化富文本
// https://doc.wangeditor.com/
const initWangeditor = () => {
state.editor = new wangeditor('#wangeditor');
state.editor.config.placeholder = '请输入内容';
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();
@ -51,9 +63,17 @@ export default {
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('ele-') > -1 : fontIconPrefix?.indexOf('ele-') > -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>
@ -52,16 +56,16 @@
</template>
<script lang="ts">
import { ref, toRefs, reactive, onMounted, nextTick, computed, watch } from 'vue';
import { ref, toRefs, reactive, onMounted, nextTick, computed, watch, defineComponent } from 'vue';
import initIconfont from '/@/utils/getStyleSheets';
export default {
export default defineComponent({
name: 'iconSelector',
emits: ['update:modelValue', 'get', 'clear'],
props: {
// 输入框前置内容
prepend: {
type: String,
default: () => 'el-icon-thumb',
default: () => 'ele-Pointer',
},
// 输入框占位文本
placeholder: {
@ -71,7 +75,7 @@ export default {
// 输入框占位文本
size: {
type: String,
default: () => 'small',
default: () => 'default',
},
// 弹窗标题
title: {
@ -104,7 +108,8 @@ export default {
},
setup(props, { emit }) {
const inputWidthRef = ref();
const state: any = reactive({
const selectorScrollbarRef = ref();
const state = reactive({
fontIconPrefix: '',
fontIconVisible: false,
fontIconWidth: 0,
@ -112,9 +117,12 @@ export default {
fontIconTabsIndex: 0,
fontIconSheetsList: [],
fontIconPlaceholder: '',
fontIconType: 'ali',
fontIconShow: true,
});
// 处理 input 获取焦点时modelValue 有值时,改变 input 的 placeholder 值
const onIconFocus = () => {
state.fontIconVisible = true;
if (!props.modelValue) return false;
state.fontIconSearch = '';
state.fontIconPlaceholder = props.modelValue;
@ -129,8 +137,8 @@ export default {
// 处理 icon 双向绑定数值回显
const initModeValueEcho = () => {
if (props.modelValue === '') return false;
state.fontIconPlaceholder = props.modelValue;
state.fontIconPrefix = props.modelValue;
(<string | undefined>state.fontIconPlaceholder) = props.modelValue;
(<string | undefined>state.fontIconPrefix) = props.modelValue;
};
// 图标搜索及图标数据显示
const fontIconSheetsFilterList = computed(() => {
@ -153,23 +161,21 @@ 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}`);
state.fontIconSheetsList = res.map((i: string) => `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}`);
state.fontIconSheetsList = res.map((i: string) => `fa ${i}`);
});
}
// 初始化 input 的 placeholder
@ -177,14 +183,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 +207,15 @@ export default {
};
// 页面加载时
onMounted(() => {
initFontIconData();
// 判断默认进来是什么类型图标,进行 tab 回显
if (props.type === 'all') {
if ((<any>props.modelValue)?.indexOf('iconfont') > -1) onIconChange('ali');
else if ((<any>props.modelValue)?.indexOf('ele-') > -1) onIconChange('ele');
else if ((<any>props.modelValue)?.indexOf('fa') > -1) onIconChange('awe');
else onIconChange('ali');
} else {
onIconChange(props.type);
}
initResize();
getInputWidth();
});
@ -209,13 +228,15 @@ export default {
);
return {
inputWidthRef,
selectorScrollbarRef,
fontIconSheetsFilterList,
onColClick,
onIconChange,
onClearFontIcon,
onIconFocus,
onIconBlur,
...toRefs(state),
};
},
};
});
</script>

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>
@ -43,17 +43,17 @@ export default defineComponent({
},
// 通知栏高度单位px
height: {
type: [Number, String],
type: Number,
default: () => 40,
},
// 动画延迟时间 (s)
delay: {
type: [Number, String],
type: Number,
default: () => 1,
},
// 滚动速率 (px/s)
speed: {
type: [Number, String],
type: Number,
default: () => 100,
},
// 是否开启垂直滚动
@ -77,10 +77,10 @@ export default defineComponent({
const noticeBarTextRef = ref();
const state = reactive({
order: 1,
oneTime: '',
twoTime: '',
warpOWidth: '',
textOWidth: '',
oneTime: 0,
twoTime: 0,
warpOWidth: 0,
textOWidth: 0,
isMode: false,
});
// 初始化 animation 各项参数

View File

@ -1,48 +0,0 @@
<template>
<div>
<screen-short v-if="screenshotStatus" @destroy-component="destroyComponent" @get-image-data="getImageData"></screen-short>
</div>
</template>
<script lang="ts">
import { toRefs, reactive, defineComponent, onUnmounted } from 'vue';
export default defineComponent({
name: 'screenShortComponent',
setup(props, { emit }) {
const state = reactive({
screenshotStatus: false,
});
// 打开截屏
const openScreenshot = () => {
state.screenshotStatus = true;
onMonitorKeyup();
};
// 销毁组件函数
const destroyComponent = (status: boolean) => {
state.screenshotStatus = status;
};
// 获取裁剪区域图片信息
const getImageData = (base64: string) => {
emit('getBase64', base64);
};
// 监听键盘 `esc` 按下
const onMonitorKeyup = () => {
if (!state.screenshotStatus) return false;
window.addEventListener('keydown', (e: any) => {
if (e.keyCode === 27) destroyComponent();
});
};
// 页面销毁时
onUnmounted(() => {
window.removeEventListener('keydown', () => {});
});
return {
openScreenshot,
destroyComponent,
getImageData,
onMonitorKeyup,
...toRefs(state),
};
},
});
</script>

View File

@ -0,0 +1,41 @@
<script lang="ts">
// 渲染函数https://v3.cn.vuejs.org/guide/render-function.html
import { h, resolveComponent } from 'vue';
// 定义接口来定义对象的类型
interface SvgIconProps {
name: string;
size: number;
color: string;
}
export default {
name: 'svgIcon',
props: {
// svg 图标组件名字
name: {
type: String,
},
// svg 大小
size: {
type: Number,
default: () => 14,
},
// svg 颜色
color: {
type: String,
},
},
setup(props: SvgIconProps) {
// 定义变量
const linesString: string[] = ['https', 'http', '/src', '/assets'];
const onLineStyle: string = `font-size: ${props.size}px;color: ${props.color}`;
const localsStyle: string = `width: ${props.size}px;height: ${props.size}px`;
// 逻辑判断
if (props.name?.startsWith('ele-')) return () => h('i', { class: 'el-icon', style: onLineStyle }, [h(resolveComponent(props.name))]);
else if (linesString.find((str) => props.name?.startsWith(str))) return () => h('img', { src: props.name, style: localsStyle });
else return () => h('i', { class: props.name, style: onLineStyle });
},
};
</script>

View File

@ -8,9 +8,6 @@ import nextZhcn from '/@/i18n/lang/zh-cn';
import nextEn from '/@/i18n/lang/en';
import nextZhtw from '/@/i18n/lang/zh-tw';
import pagesHomeZhcn from '/@/i18n/pages/home/zh-cn';
import pagesHomeEn from '/@/i18n/pages/home/en';
import pagesHomeZhtw from '/@/i18n/pages/home/zh-tw';
import pagesLoginZhcn from '/@/i18n/pages/login/zh-cn';
import pagesLoginEn from '/@/i18n/pages/login/en';
import pagesLoginZhtw from '/@/i18n/pages/login/zh-tw';
@ -29,7 +26,6 @@ const messages = {
...zhcnLocale,
message: {
...nextZhcn,
...pagesHomeZhcn,
...pagesLoginZhcn,
...pagesFormI18nZhcn,
},
@ -38,7 +34,6 @@ const messages = {
...enLocale,
message: {
...nextEn,
...pagesHomeEn,
...pagesLoginEn,
...pagesFormI18nEn,
},
@ -47,7 +42,6 @@ const messages = {
...zhtwLocale,
message: {
...nextZhtw,
...pagesHomeZhtw,
...pagesLoginZhtw,
...pagesFormI18nZhtw,
},

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',
@ -22,16 +25,12 @@ export default {
funIndex: 'function',
funTagsView: 'funTagsView',
funCountup: 'countup',
funEchartsTree: 'echartsTree',
funSelector: 'funSelector',
funNoticeBar: 'ScrollingNoticeBar',
funWangEditor: 'wangEditor',
funCropper: 'cropper',
funQrcode: 'qrcode',
funEchartsMap: 'EchartsMap',
funPrintJs: 'PrintJs',
funClipboard: 'Copy cut',
funScreenShort: 'screenCapture',
funGridLayout: 'Drag layout',
funSplitpanes: 'Pane splitter',
funDragVerify: 'Validator',
@ -42,8 +41,8 @@ export default {
pagesIocnfont: 'iconfont icon',
pagesElement: 'element icon',
pagesAwesome: 'awesome icon',
pagesCityLinkage: 'CityLinkage',
pagesFormAdapt: 'FormAdapt',
pagesTableRules: 'pagesTableRules',
pagesFormI18n: 'FormI18n',
pagesFormRules: 'Multi form validation',
pagesDynamicForm: 'Dynamic complex form',
@ -56,6 +55,10 @@ export default {
pagesTree: 'tree alter table',
pagesDrag: 'Drag command',
pagesLazyImg: 'Image lazy loading',
makeIndex: 'makeIndex',
makeSelector: 'Icon selector',
makeNoticeBar: 'notification bar',
makeSvgDemo: 'Svgicon demo',
paramsIndex: 'Routing parameters',
paramsCommon: 'General routing',
paramsDynamic: 'Dynamic routing',
@ -83,10 +86,9 @@ export default {
title4: 'news',
title5: 'Full screen on',
title6: 'Full screen off',
dropdownLarge: 'large',
dropdownDefault: 'default',
dropdownMedium: 'medium',
dropdownSmall: 'small',
dropdownMini: 'mini',
dropdown1: 'home page',
dropdown2: 'Personal Center',
dropdown3: '404',
@ -126,17 +128,18 @@ export default {
layout: {
configTitle: 'Layout configuration',
oneTitle: 'Global Themes',
twoTitle: 'Menu / top bar',
twoTopTitle: 'top bar set up',
twoMenuTitle: 'Menu set up',
twoColumnsTitle: 'Columns set up',
twoTopBar: 'Top bar background',
twoMenuBar: 'Menu background',
twoColumnsMenuBar: 'Column menu background',
twoTopBarColor: 'Top bar default font color',
twoMenuBarColor: 'Menu default font color',
twoColumnsMenuBarColor: 'Default font color bar menu',
twoIsTopBarColorGradual: 'Top bar gradient',
twoMenuBar: 'Menu background',
twoMenuBarColor: 'Menu default font color',
twoIsMenuBarColorGradual: 'Menu gradient',
twoColumnsMenuBar: 'Column menu background',
twoColumnsMenuBarColor: 'Default font color bar menu',
twoIsColumnsMenuBarColorGradual: 'Column gradient',
twoIsMenuBarColorHighlight: 'Menu font highlight',
threeTitle: 'Interface settings',
threeIsCollapse: 'Menu horizontal collapse',
threeIsUniqueOpened: 'Menu accordion',

View File

@ -4,7 +4,10 @@ export default {
home: '首页',
system: '系统设置',
systemMenu: '菜单管理',
systemRole: '角色管理',
systemUser: '用户管理',
systemDept: '部门管理',
systemDic: '字典管理',
limits: '权限管理',
limitsFrontEnd: '前端控制',
limitsFrontEndPage: '页面权限',
@ -21,17 +24,13 @@ export default {
menu2: '菜单2',
funIndex: '功能',
funTagsView: 'tagsView 操作',
funCountup: 'countup 数字滚动',
funEchartsTree: 'echartsTree 树图',
funSelector: '图标选择器',
funNoticeBar: '滚动通知栏',
funWangEditor: 'wangEditor 编辑器',
funCropper: 'cropper 图片裁剪',
funQrcode: 'qrcode 二维码生成',
funCountup: '数字滚动',
funWangEditor: 'Editor 编辑器',
funCropper: '图片裁剪',
funQrcode: '二维码生成',
funEchartsMap: '地理坐标/地图',
funPrintJs: '页面打印',
funClipboard: '复制剪切',
funScreenShort: 'web端自定义截屏',
funGridLayout: '拖拽布局',
funSplitpanes: '窗格拆分器',
funDragVerify: '验证器',
@ -39,11 +38,11 @@ export default {
pagesFiltering: '过滤筛选组件',
pagesFilteringDetails: '过滤筛选组件详情',
pagesFilteringDetails1: '过滤筛选组件详情111',
pagesIocnfont: 'iconfont 字体图标',
pagesElement: 'element 字体图标',
pagesAwesome: 'awesome 字体图标',
pagesCityLinkage: '城市多级联动',
pagesIocnfont: 'ali 字体图标',
pagesElement: 'ele 字体图标',
pagesAwesome: 'awe 字体图标',
pagesFormAdapt: '表单自适应',
pagesTableRules: '表单表格验证',
pagesFormI18n: '表单国际化',
pagesFormRules: '多表单验证',
pagesDynamicForm: '动态复杂表单',
@ -56,6 +55,10 @@ export default {
pagesTree: '树形改表格',
pagesDrag: '拖动指令',
pagesLazyImg: '图片懒加载',
makeIndex: '组件封装',
makeSelector: '图标选择器',
makeNoticeBar: '滚动通知栏',
makeSvgDemo: 'svgIcon 演示',
paramsIndex: '路由参数',
paramsCommon: '普通路由',
paramsDynamic: '动态路由',
@ -83,10 +86,9 @@ export default {
title4: '消息',
title5: '开全屏',
title6: '关全屏',
dropdownLarge: '大型',
dropdownDefault: '默认',
dropdownMedium: '中等',
dropdownSmall: '小型',
dropdownMini: '超小',
dropdown1: '首页',
dropdown2: '个人中心',
dropdown3: '404',
@ -126,17 +128,18 @@ export default {
layout: {
configTitle: '布局配置',
oneTitle: '全局主题',
twoTitle: '菜单 / 顶栏',
twoTopTitle: '顶栏设置',
twoMenuTitle: '菜单设置',
twoColumnsTitle: '分栏设置',
twoTopBar: '顶栏背景',
twoMenuBar: '菜单背景',
twoColumnsMenuBar: '分栏菜单背景',
twoTopBarColor: '顶栏默认字体颜色',
twoMenuBarColor: '菜单默认字体颜色',
twoColumnsMenuBarColor: '分栏菜单默认字体颜色',
twoIsTopBarColorGradual: '顶栏背景渐变',
twoMenuBar: '菜单背景',
twoMenuBarColor: '菜单默认字体颜色',
twoIsMenuBarColorGradual: '菜单背景渐变',
twoColumnsMenuBar: '分栏菜单背景',
twoColumnsMenuBarColor: '分栏菜单默认字体颜色',
twoIsColumnsMenuBarColorGradual: '分栏菜单背景渐变',
twoIsMenuBarColorHighlight: '菜单字体背景高亮',
threeTitle: '界面设置',
threeIsCollapse: '菜单水平折叠',
threeIsUniqueOpened: '菜单手风琴',

View File

@ -4,7 +4,10 @@ export default {
home: '首頁',
system: '系統設置',
systemMenu: '選單管理',
systemRole: '角色管理',
systemUser: '用戶管理',
systemDept: '部門管理',
systemDic: '字典管理',
limits: '許可權管理',
limitsFrontEnd: '前端控制',
limitsFrontEndPage: '頁面許可權',
@ -21,17 +24,13 @@ export default {
menu2: '選單2',
funIndex: '功能',
funTagsView: 'tagsView 操作',
funCountup: 'countup 數位滾動',
funEchartsTree: 'echartsTree 樹圖',
funSelector: '圖標選擇器',
funNoticeBar: '滾動通知欄',
funWangEditor: 'wangEditor 編輯器',
funCropper: 'cropper 圖片裁剪',
funQrcode: 'qrcode 二維碼生成',
funCountup: '數位滾動',
funWangEditor: 'Editor 編輯器',
funCropper: '圖片裁剪',
funQrcode: '二維碼生成',
funEchartsMap: '地理座標/地圖',
funPrintJs: '頁面列印',
funClipboard: '複製剪切',
funScreenShort: '自定義截圖',
funGridLayout: '拖拽佈局',
funSplitpanes: '窗格折開器',
funDragVerify: '驗證器',
@ -39,11 +38,11 @@ export default {
pagesFiltering: '過濾篩選組件',
pagesFilteringDetails: '過濾篩選組件詳情',
pagesFilteringDetails1: '過濾篩選組件詳情111',
pagesIocnfont: 'iconfont 字體圖標',
pagesElement: 'element 字體圖標',
pagesAwesome: 'awesome 字體圖標',
pagesCityLinkage: '都市多級聯動',
pagesIocnfont: 'ali 字體圖標',
pagesElement: 'ele 字體圖標',
pagesAwesome: 'awe 字體圖標',
pagesFormAdapt: '表單自我調整',
pagesTableRules: '表單表格驗證',
pagesFormI18n: '表單國際化',
pagesFormRules: '多表單驗證',
pagesDynamicForm: '動態複雜表單',
@ -56,6 +55,10 @@ export default {
pagesTree: '樹形改表格',
pagesDrag: '拖動指令',
pagesLazyImg: '圖片懶加載',
makeIndex: '組件封裝',
makeSelector: '圖標選擇器',
makeNoticeBar: '滾動通知欄',
makeSvgDemo: 'svgIcon 演示',
paramsIndex: '路由參數',
paramsCommon: '普通路由',
paramsDynamic: '動態路由',
@ -83,10 +86,9 @@ export default {
title4: '消息',
title5: '開全屏',
title6: '關全屏',
dropdownLarge: '大型',
dropdownDefault: '默認',
dropdownMedium: '中等',
dropdownSmall: '小型',
dropdownMini: '超小',
dropdown1: '首頁',
dropdown2: '個人中心',
dropdown3: '404',
@ -126,17 +128,18 @@ export default {
layout: {
configTitle: '佈局配寘',
oneTitle: '全域主題',
twoTitle: '選單 / 頂欄',
twoTopTitle: '頂欄設定',
twoMenuTitle: '選單設定',
twoColumnsTitle: '分欄設定',
twoTopBar: '頂欄背景',
twoMenuBar: '選單背景',
twoColumnsMenuBar: '分欄選單背景',
twoTopBarColor: '頂欄默認字體顏色',
twoMenuBarColor: '選單默認字體顏色',
twoColumnsMenuBarColor: '分欄選單默認字體顏色',
twoIsTopBarColorGradual: '頂欄背景漸變',
twoMenuBar: '選單背景',
twoMenuBarColor: '選單默認字體顏色',
twoIsMenuBarColorGradual: '選單背景漸變',
twoColumnsMenuBar: '分欄選單背景',
twoColumnsMenuBarColor: '分欄選單默認字體顏色',
twoIsColumnsMenuBarColorGradual: '分欄選單背景漸變',
twoIsMenuBarColorHighlight: '選單字體背景高亮',
threeTitle: '介面設定',
threeIsCollapse: '選單水准折疊',
threeIsUniqueOpened: '選單手風琴',

View File

@ -1,15 +0,0 @@
// 定义内容
export default {
card: {
title1: 'Commodity sales',
title2: 'environmental monitoring',
title3: 'Early warning information',
title4: 'dynamic information',
title5: 'Performance overtime warning',
},
table: {
th1: 'time',
th2: 'Laboratory name',
th3: 'Alarm content',
},
};

View File

@ -1,15 +0,0 @@
// 定义内容
export default {
card: {
title1: '商品销售情况',
title2: '环境监测',
title3: '预警信息',
title4: '动态信息',
title5: '履约超时预警',
},
table: {
th1: '时间',
th2: '实验室名称',
th3: '报警内容',
},
};

View File

@ -1,15 +0,0 @@
// 定义内容
export default {
card: {
title1: '商品銷售情况',
title2: '環境監測',
title3: '預警資訊',
title4: '動態資訊',
title5: '履約超時預警',
},
table: {
th1: '時間',
th2: '實驗室名稱',
th3: '報警內容',
},
};

View File

@ -1,19 +1,15 @@
// 定义内容
export default {
label: {
one1: 'Account password',
one1: 'User name login',
two2: 'Mobile number',
},
link: {
one3: 'Third party login',
two4: 'Links',
},
copyright: {
one5: 'Copyright: Shenzhen XXX Software Technology Co., Ltd',
two6: 'Copyright: Shenzhen XXX software technology Guangdong ICP preparation no.05010000',
},
account: {
accountPlaceholder1: 'The user name admin or not is test',
accountPlaceholder1: 'The user name admin or not is common',
accountPlaceholder2: 'Password: 123456',
accountPlaceholder3: 'Please enter the verification code',
accountBtnText: 'Sign in',
@ -23,6 +19,11 @@ export default {
placeholder2: 'Please enter the verification code',
codeText: 'Get code',
btnText: 'Sign in',
msgText:
'Warm tip: it is recommended to use Google, Microsoft edge, version 79.0.1072.62 and above browsers, and 360 browser, please use speed mode',
},
scan: {
text: 'Open the mobile phone to scan and quickly log in / register',
},
signInText: 'welcome back!',
};

View File

@ -1,19 +1,15 @@
// 定义内容
export default {
label: {
one1: '账号密码登录',
one1: '用户名登录',
two2: '手机号登录',
},
link: {
one3: '第三方登录',
two4: '友情链接',
},
copyright: {
one5: '版权所有深圳市xxx软件科技有限公司',
two6: 'Copyright: Shenzhen XXX Software Technology 粤ICP备05010000号',
},
account: {
accountPlaceholder1: '用户名 admin 或不输均为 test',
accountPlaceholder1: '用户名 admin 或不输均为 common',
accountPlaceholder2: '密码123456',
accountPlaceholder3: '请输入验证码',
accountBtnText: '登 录',
@ -23,6 +19,10 @@ export default {
placeholder2: '请输入验证码',
codeText: '获取验证码',
btnText: '登 录',
msgText: '* 温馨提示建议使用谷歌、Microsoft Edge版本 79.0.1072.62 及以上浏览器360浏览器请使用极速模式',
},
scan: {
text: '打开手机扫一扫,快速登录/注册',
},
signInText: '欢迎回来!',
};

View File

@ -1,19 +1,15 @@
// 定义内容
export default {
label: {
one1: '帳號密碼登入',
one1: '用戶名登入',
two2: '手機號登入',
},
link: {
one3: '協力廠商登入',
two4: '友情連結',
},
copyright: {
one5: '版權所有深圳市xxx軟件科技有限公司',
two6: 'Copyright: Shenzhen XXX Software Technology 粵ICP備05010000號',
},
account: {
accountPlaceholder1: '用戶名admin或不輸均為test',
accountPlaceholder1: '用戶名admin或不輸均為common',
accountPlaceholder2: '密碼123456',
accountPlaceholder3: '請輸入驗證碼',
accountBtnText: '登入',
@ -23,6 +19,10 @@ export default {
placeholder2: '請輸入驗證碼',
codeText: '獲取驗證碼',
btnText: '登入',
msgText: '* 溫馨提示建議使用穀歌、Microsoft Edge版本79.0.1072.62及以上瀏覽器360瀏覽器請使用極速模式',
},
scan: {
text: '打開手機掃一掃,快速登錄/注册',
},
signInText: '歡迎回來!',
};

View File

@ -10,23 +10,19 @@
</template>
<script lang="ts">
import { toRefs, reactive, computed, watch, getCurrentInstance, onBeforeMount } from 'vue';
import { toRefs, reactive, computed, watch, getCurrentInstance, onBeforeMount, defineComponent } from 'vue';
import { useStore } from '/@/store/index';
import Logo from '/@/layout/logo/index.vue';
import Vertical from '/@/layout/navMenu/vertical.vue';
export default {
export default defineComponent({
name: 'layoutAside',
components: { Logo, Vertical },
setup() {
const { proxy } = getCurrentInstance() as any;
const { proxy } = <any>getCurrentInstance();
const store = useStore();
const state: any = reactive({
const state = reactive({
menuList: [],
clientWidth: '',
});
// 获取布局配置信息
const getThemeConfig = computed(() => {
return store.state.themeConfig.themeConfig;
clientWidth: 0,
});
// 获取卡片全屏信息
const isTagsViewCurrenFull = computed(() => {
@ -35,8 +31,8 @@ export default {
// 设置菜单展开/收起时的宽度
const setCollapseStyle = computed(() => {
const { layout, isCollapse, menuBar } = store.state.themeConfig.themeConfig;
const asideBrColor =
menuBar === '#FFFFFF' || menuBar === '#FFF' || menuBar === '#fff' || menuBar === '#ffffff' ? 'layout-el-aside-br-color' : '';
const asideBrTheme = ['#FFFFFF', '#FFF', '#fff', '#ffffff'];
const asideBrColor = asideBrTheme.includes(menuBar) ? 'layout-el-aside-br-color' : '';
// 判断是否是手机端
if (state.clientWidth <= 1000) {
if (isCollapse) {
@ -73,7 +69,10 @@ export default {
// 关闭移动端蒙版
const closeLayoutAsideMobileMode = () => {
const el = document.querySelector('.layout-aside-mobile-mode');
el && el.parentNode?.removeChild(el);
el?.setAttribute('style', 'animation: error-img-two 0.3s');
setTimeout(() => {
el?.parentNode?.removeChild(el);
}, 300);
const clientWidth = document.body.clientWidth;
if (clientWidth < 1000) store.state.themeConfig.themeConfig.isCollapse = false;
document.body.setAttribute('class', '');
@ -86,7 +85,7 @@ export default {
// 设置/过滤路由(非静态路由/是否显示在菜单中)
const setFilterRoutes = () => {
if (store.state.themeConfig.themeConfig.layout === 'columns') return false;
state.menuList = filterRoutesFun(store.state.routesList.routesList);
(state.menuList as any) = filterRoutesFun(store.state.routesList.routesList);
};
// 路由过滤递归函数
const filterRoutesFun = (arr: Array<object>) => {
@ -149,11 +148,10 @@ export default {
return {
setCollapseStyle,
setShowLogo,
getThemeConfig,
isTagsViewCurrenFull,
onAsideEnterLeave,
...toRefs(state),
};
},
};
});
</script>

View File

@ -16,7 +16,7 @@
: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
@ -27,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
@ -45,19 +45,32 @@
</template>
<script lang="ts">
import { reactive, toRefs, ref, computed, onMounted, nextTick, getCurrentInstance, watch, onUnmounted } from 'vue';
import { useRoute, useRouter, onBeforeRouteUpdate } from 'vue-router';
import { reactive, toRefs, ref, computed, onMounted, nextTick, getCurrentInstance, watch, onUnmounted, defineComponent } from 'vue';
import { useRoute, useRouter, onBeforeRouteUpdate, RouteRecordRaw } from 'vue-router';
import { useStore } from '/@/store/index';
export default {
// 定义接口来定义对象的类型
interface ColumnsAsideState {
columnsAsideList: any[];
liIndex: number;
liOldIndex: null | number;
liHoverIndex: null | number;
liOldPath: null | string;
difference: number;
routeSplit: string[];
isNavHover: boolean;
}
export default defineComponent({
name: 'layoutColumnsAside',
setup() {
const columnsAsideOffsetTopRefs: any = ref([]);
const columnsAsideActiveRef = ref();
const { proxy } = getCurrentInstance() as any;
const { proxy } = <any>getCurrentInstance();
const store = useStore();
const route = useRoute();
const router = useRouter();
const state: any = reactive({
const state = reactive<ColumnsAsideState>({
columnsAsideList: [],
liIndex: 0,
liOldIndex: null,
@ -88,7 +101,7 @@ export default {
else router.push(path);
};
// 鼠标移入时,显示当前的子级菜单
const onColumnsAsideMenuMouseenter = (v: Object, k: number) => {
const onColumnsAsideMenuMouseenter = (v: RouteRecordRaw, k: number) => {
let { path } = v;
state.liOldPath = path;
state.liOldIndex = k;
@ -155,7 +168,7 @@ export default {
if (!currentSplitRoute) return false;
// 延迟拿值,防止取不到
setTimeout(() => {
onColumnsAsideDown(currentSplitRoute.k);
onColumnsAsideDown((<any>currentSplitRoute).k);
}, 0);
};
// 监听布局配置信息的变化,动态增加菜单高亮位置移动像素
@ -200,18 +213,18 @@ export default {
...toRefs(state),
};
},
};
});
</script>
<style scoped lang="scss">
.layout-columns-aside {
width: 70px;
height: 100%;
background: var(--bg-columnsMenuBar);
background: var(--next-bg-columnsMenuBar);
ul {
position: relative;
li {
color: var(--bg-columnsMenuBarColor);
color: var(--next-bg-columnsMenuBarColor);
width: 100%;
height: 50px;
text-align: center;
@ -243,22 +256,22 @@ export default {
}
a {
text-decoration: none;
color: var(--bg-columnsMenuBarColor);
color: var(--next-bg-columnsMenuBarColor);
}
}
.layout-columns-active {
color: var(--color-whites) !important;
color: var(--el-color-white);
transition: 0.3s ease-in-out;
}
.layout-columns-hover {
color: var(--color-primary);
color: var(--el-color-primary);
a {
color: var(--color-primary);
color: var(--el-color-primary);
}
}
.columns-round {
background: var(--color-primary);
color: var(--color-whites);
background: var(--el-color-primary);
color: var(--el-color-white);
position: absolute;
left: 50%;
top: 2px;

View File

@ -5,10 +5,10 @@
</template>
<script lang="ts">
import { computed } from 'vue';
import { computed, defineComponent } from 'vue';
import { useStore } from '/@/store/index';
import NavBarsIndex from '/@/layout/navBars/index.vue';
export default {
export default defineComponent({
name: 'layoutHeader',
components: { NavBarsIndex },
setup() {
@ -28,5 +28,5 @@ export default {
isTagsViewCurrenFull,
};
},
};
});
</script>

View File

@ -3,32 +3,35 @@
<el-scrollbar
class="layout-scrollbar"
ref="layoutScrollbarRef"
:style="{
minHeight: `calc(100vh - ${headerHeight})`,
padding: currentRouteMeta.isLink && currentRouteMeta.isIframe ? 0 : '',
transition: 'padding 0.3s ease-in-out',
}"
:style="{ padding: currentRouteMeta.isLink && currentRouteMeta.isIframe ? 0 : '', transition: 'padding 0.3s ease-in-out' }"
>
<LayoutParentView />
<LayoutParentView :style="{ minHeight: `calc(100vh - ${headerHeight})` }" />
<Footer v-if="getThemeConfig.isFooter" />
</el-scrollbar>
</el-main>
</template>
<script lang="ts">
import { computed, defineComponent, toRefs, reactive, getCurrentInstance, watch, onBeforeMount } from 'vue';
import { computed, defineComponent, toRefs, reactive, getCurrentInstance, watch, onMounted } from 'vue';
import { useStore } from '/@/store/index';
import { useRoute } from 'vue-router';
import LayoutParentView from '/@/layout/routerView/parent.vue';
import Footer from '/@/layout/footer/index.vue';
// 定义接口来定义对象的类型
interface MainState {
headerHeight: string | number;
currentRouteMeta: any;
}
export default defineComponent({
name: 'layoutMain',
components: { LayoutParentView, Footer },
setup() {
const { proxy } = getCurrentInstance() as any;
const { proxy } = <any>getCurrentInstance();
const route = useRoute();
const store = useStore();
const state = reactive({
const state = reactive<MainState>({
headerHeight: '',
currentRouteMeta: {},
});
@ -38,34 +41,40 @@ export default defineComponent({
});
// 设置 main 的高度
const initHeaderHeight = () => {
const bool = state.currentRouteMeta.isLink && state.currentRouteMeta.isIframe;
let { isTagsview } = store.state.themeConfig.themeConfig;
if (isTagsview) return (state.headerHeight = `84px`);
else return (state.headerHeight = `50px`);
if (isTagsview) return (state.headerHeight = bool ? `85px` : `114px`);
else return (state.headerHeight = `51px`);
};
// 初始化获取当前路由 meta用于设置 iframes padding
const initGetMeta = () => {
state.currentRouteMeta = route.meta;
};
// 页面加载前
onBeforeMount(() => {
onMounted(async () => {
await initGetMeta();
initHeaderHeight();
initGetMeta();
});
// 监听 themeConfig 配置文件的变化,更新菜单 el-scrollbar 的高度
watch(store.state.themeConfig.themeConfig, (val) => {
state.headerHeight = val.isTagsview ? '84px' : '50px';
if (val.isFixedHeaderChange !== val.isFixedHeader) {
if (!proxy.$refs.layoutScrollbarRef) return false;
proxy.$refs.layoutScrollbarRef.update();
}
});
// 监听路由变化
watch(
() => route.path,
() => {
state.currentRouteMeta = route.meta;
const bool = state.currentRouteMeta.isLink && state.currentRouteMeta.isIframe;
state.headerHeight = bool ? `85px` : `114px`;
proxy.$refs.layoutScrollbarRef.update();
}
);
// 监听 themeConfig 配置文件的变化,更新菜单 el-scrollbar 的高度
watch(store.state.themeConfig.themeConfig, (val) => {
state.currentRouteMeta = route.meta;
const bool = state.currentRouteMeta.isLink && state.currentRouteMeta.isIframe;
state.headerHeight = val.isTagsview ? (bool ? `85px` : `114px`) : '51px';
if (val.isFixedHeaderChange !== val.isFixedHeader) {
if (!proxy.$refs.layoutScrollbarRef) return false;
proxy.$refs.layoutScrollbarRef.update();
}
});
return {
getThemeConfig,
...toRefs(state),

View File

@ -2,15 +2,15 @@
<div class="layout-footer mt15" v-show="isDelayFooter">
<div class="layout-footer-warp">
<div>vue-next-adminMade by lyt with </div>
<div class="mt5">{{ $t('message.copyright.one5') }}</div>
<div class="mt5">深圳市 xxx 公司版权所有</div>
</div>
</div>
</template>
<script lang="ts">
import { toRefs, reactive } from 'vue';
import { toRefs, reactive, defineComponent } from 'vue';
import { onBeforeRouteUpdate } from 'vue-router';
export default {
export default defineComponent({
name: 'layoutFooter',
setup() {
const state = reactive({
@ -18,16 +18,18 @@ export default {
});
// 路由改变时,等主界面动画加载完毕再显示 footer
onBeforeRouteUpdate(() => {
state.isDelayFooter = false;
setTimeout(() => {
state.isDelayFooter = true;
}, 800);
state.isDelayFooter = false;
setTimeout(() => {
state.isDelayFooter = true;
}, 800);
}, 0);
});
return {
...toRefs(state),
};
},
};
});
</script>
<style scoped lang="scss">
@ -38,7 +40,7 @@ export default {
margin: auto;
color: var(--el-text-color-secondary);
text-align: center;
animation: logoAnimation 0.3s ease-in-out;
animation: error-num 1s ease-in-out;
}
}
</style>

View File

@ -1,23 +1,21 @@
<template>
<Defaults v-if="getThemeConfig.layout === 'defaults'" />
<Classic v-else-if="getThemeConfig.layout === 'classic'" />
<Transverse v-else-if="getThemeConfig.layout === 'transverse'" />
<Columns v-else-if="getThemeConfig.layout === 'columns'" />
<component :is="getThemeConfig.layout" />
</template>
<script lang="ts">
import { computed, onBeforeMount, onUnmounted, getCurrentInstance } from 'vue';
import { computed, onBeforeMount, onUnmounted, getCurrentInstance, defineComponent, defineAsyncComponent } from 'vue';
import { useStore } from '/@/store/index';
import { Local } from '/@/utils/storage';
import Defaults from '/@/layout/main/defaults.vue';
import Classic from '/@/layout/main/classic.vue';
import Transverse from '/@/layout/main/transverse.vue';
import Columns from '/@/layout/main/columns.vue';
export default {
export default defineComponent({
name: 'layout',
components: { Defaults, Classic, Transverse, Columns },
components: {
defaults: defineAsyncComponent(() => import('/@/layout/main/defaults.vue')),
classic: defineAsyncComponent(() => import('/@/layout/main/classic.vue')),
transverse: defineAsyncComponent(() => import('/@/layout/main/transverse.vue')),
columns: defineAsyncComponent(() => import('/@/layout/main/columns.vue')),
},
setup() {
const { proxy } = getCurrentInstance() as any;
const { proxy } = <any>getCurrentInstance();
const store = useStore();
// 获取布局配置信息
const getThemeConfig = computed(() => {
@ -53,5 +51,5 @@ export default {
getThemeConfig,
};
},
};
});
</script>

View File

@ -20,7 +20,7 @@
<div class="layout-lock-screen-date-box-info">{{ time.mdq }}</div>
</div>
<div class="layout-lock-screen-date-top">
<i class="el-icon-top"></i>
<SvgIcon name="ele-Top" />
<div class="layout-lock-screen-date-top-text">上滑解锁</div>
</div>
</div>
@ -39,15 +39,19 @@
@keyup.enter.native.stop="onLockScreenSubmit()"
>
<template #append>
<el-button icon="el-icon-right" @click="onLockScreenSubmit"></el-button>
<el-button @click="onLockScreenSubmit">
<el-icon class="el-input__icon">
<ele-Right />
</el-icon>
</el-button>
</template>
</el-input>
</div>
</div>
<div class="layout-lock-screen-login-icon">
<i class="el-icon-microphone"></i>
<i class="el-icon-alarm-clock"></i>
<i class="el-icon-switch-button"></i>
<SvgIcon name="ele-Microphone" />
<SvgIcon name="ele-AlarmClock" />
<SvgIcon name="ele-SwitchButton" />
</div>
</div>
</transition>
@ -60,13 +64,33 @@ import { nextTick, onMounted, reactive, toRefs, ref, onUnmounted, getCurrentInst
import { useStore } from '/@/store/index';
import { formatDate } from '/@/utils/formatTime';
import { Local } from '/@/utils/storage';
// 定义接口来定义对象的类型
interface LockScreenState {
transparency: number;
downClientY: number;
moveDifference: number;
isShowLoockLogin: boolean;
isFlags: boolean;
querySelectorEl: HTMLElement | string;
time: {
hm: string;
s: string;
mdq: string;
};
setIntervalTime: number;
isShowLockScreen: boolean;
isShowLockScreenIntervalTime: number;
lockScreenPassword: string;
}
export default defineComponent({
name: 'layoutLockScreen',
setup() {
const { proxy } = getCurrentInstance() as any;
const { proxy } = <any>getCurrentInstance();
const layoutLockScreenInputRef = ref();
const store = useStore();
const state: any = reactive({
const state = reactive<LockScreenState>({
transparency: 1,
downClientY: 0,
moveDifference: 0,
@ -91,7 +115,7 @@ export default defineComponent({
// 鼠标移动
const onMove = (move: any) => {
if (state.isFlags) {
const el = state.querySelectorEl;
const el = <HTMLElement>state.querySelectorEl;
const opacitys = (state.transparency -= 1 / 200);
if (move.touches) {
state.moveDifference = move.touches[0].clientY - state.downClientY;
@ -118,7 +142,7 @@ export default defineComponent({
state.isFlags = false;
state.transparency = 1;
if (state.moveDifference >= -400) {
state.querySelectorEl.setAttribute('style', `top:0px;opacity:1;transition:all 0.3s ease;`);
(<HTMLElement>state.querySelectorEl).setAttribute('style', `top:0px;opacity:1;transition:all 0.3s ease;`);
}
};
// 获取要拖拽的初始元素

View File

@ -1,20 +1,22 @@
<template>
<div class="layout-logo" v-if="setShowLogo" @click="onThemeConfigChange">
<img src="https://gitee.com/lyt-top/vue-next-admin-images/raw/master/logo/logo-mini.svg" class="layout-logo-medium-img" />
<img :src="logoMini" class="layout-logo-medium-img" />
<span>{{ getThemeConfig.globalTitle }}</span>
</div>
<div class="layout-logo-size" v-else @click="onThemeConfigChange">
<img src="https://gitee.com/lyt-top/vue-next-admin-images/raw/master/logo/logo-mini.svg" class="layout-logo-size-img" />
<img :src="logoMini" class="layout-logo-size-img" />
</div>
</template>
<script lang="ts">
import { computed, getCurrentInstance } from 'vue';
import { computed, defineComponent } from 'vue';
import { useStore } from '/@/store/index';
export default {
import logoMini from '/@/assets/logo-mini.svg';
export default defineComponent({
name: 'layoutLogo',
setup() {
const { proxy } = getCurrentInstance() as any;
const store = useStore();
// 获取布局配置信息
const getThemeConfig = computed(() => {
@ -28,16 +30,16 @@ export default {
// logo 点击实现菜单展开/收起
const onThemeConfigChange = () => {
if (store.state.themeConfig.themeConfig.layout === 'transverse') return false;
proxy.mittBus.emit('onMenuClick');
store.state.themeConfig.themeConfig.isCollapse = !store.state.themeConfig.themeConfig.isCollapse;
};
return {
logoMini,
setShowLogo,
getThemeConfig,
onThemeConfigChange,
};
},
};
});
</script>
<style scoped lang="scss">
@ -48,7 +50,7 @@ export default {
align-items: center;
justify-content: center;
box-shadow: rgb(0 21 41 / 2%) 0px 1px 4px;
color: var(--color-primary);
color: var(--el-color-primary);
font-size: 16px;
cursor: pointer;
animation: logoAnimation 0.3s ease-in-out;

View File

@ -13,13 +13,13 @@
</template>
<script lang="ts">
import { computed } from 'vue';
import { computed, defineComponent } from 'vue';
import { useStore } from '/@/store/index';
import Aside from '/@/layout/component/aside.vue';
import Header from '/@/layout/component/header.vue';
import Main from '/@/layout/component/main.vue';
import TagsView from '/@/layout/navBars/tagsView/tagsView.vue';
export default {
export default defineComponent({
name: 'layoutClassic',
components: { Aside, Header, Main, TagsView },
setup() {
@ -32,5 +32,5 @@ export default {
getThemeConfig,
};
},
};
});
</script>

View File

@ -16,13 +16,13 @@
</template>
<script lang="ts">
import { computed } from 'vue';
import { computed, defineComponent } from 'vue';
import { useStore } from '/@/store/index';
import Aside from '/@/layout/component/aside.vue';
import Header from '/@/layout/component/header.vue';
import Main from '/@/layout/component/main.vue';
import ColumnsAside from '/@/layout/component/columnsAside.vue';
export default {
export default defineComponent({
name: 'layoutColumns',
components: { Aside, Header, Main, ColumnsAside },
setup() {
@ -34,5 +34,5 @@ export default {
isFixedHeader,
};
},
};
});
</script>

View File

@ -13,13 +13,13 @@
</template>
<script lang="ts">
import { computed, getCurrentInstance, watch } from 'vue';
import { computed, getCurrentInstance, watch, defineComponent } from 'vue';
import { useRoute } from 'vue-router';
import { useStore } from '/@/store/index';
import Aside from '/@/layout/component/aside.vue';
import Header from '/@/layout/component/header.vue';
import Main from '/@/layout/component/main.vue';
export default {
export default defineComponent({
name: 'layoutDefaults',
components: { Aside, Header, Main },
setup() {
@ -33,12 +33,12 @@ export default {
watch(
() => route.path,
() => {
proxy.$refs.layoutDefaultsScrollbarRef.wrap.scrollTop = 0;
proxy.$refs.layoutDefaultsScrollbarRef.wrap$.scrollTop = 0;
}
);
return {
isFixedHeader,
};
},
};
});
</script>

View File

@ -1,18 +1,19 @@
<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 ? 'ele-Expand' : 'ele-Fold'"
:size="16"
@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>
@ -21,17 +22,26 @@
</template>
<script lang="ts">
import { toRefs, reactive, computed, getCurrentInstance, onMounted } from 'vue';
import { toRefs, reactive, computed, onMounted, defineComponent } from 'vue';
import { onBeforeRouteUpdate, useRoute, useRouter } from 'vue-router';
import { useStore } from '/@/store/index';
export default {
import { Local } from '/@/utils/storage';
// 定义接口来定义对象的类型
interface BreadcrumbState {
breadcrumbList: Array<any>;
routeSplit: Array<string>;
routeSplitFirst: string;
routeSplitIndex: number;
}
export default defineComponent({
name: 'layoutBreadcrumb',
setup() {
const { proxy } = getCurrentInstance() as any;
const store = useStore();
const route = useRoute();
const router = useRouter();
const state: any = reactive({
const state = reactive<BreadcrumbState>({
breadcrumbList: [],
routeSplit: [],
routeSplitFirst: '',
@ -45,11 +55,8 @@ export default {
const isShowBreadcrumb = computed(() => {
initRouteSplit(route.path);
const { layout, isBreadcrumb } = store.state.themeConfig.themeConfig;
if (layout === 'classic' || layout === 'transverse') {
return 'none';
} else {
return isBreadcrumb ? '' : 'none';
}
if (layout === 'classic' || layout === 'transverse') return 'none';
else return isBreadcrumb ? '' : 'none';
});
// 面包屑点击时
const onBreadcrumbClick = (v: any) => {
@ -59,8 +66,13 @@ export default {
};
// 展开/收起左侧菜单点击
const onThemeConfigChange = () => {
proxy.mittBus.emit('onMenuClick');
store.state.themeConfig.themeConfig.isCollapse = !store.state.themeConfig.themeConfig.isCollapse;
setLocalThemeConfig();
};
// 存储布局配置
const setLocalThemeConfig = () => {
Local.remove('themeConfig');
Local.set('themeConfig', getThemeConfig.value);
};
// 处理面包屑数据
const getBreadcrumbList = (arr: Array<object>) => {
@ -101,7 +113,7 @@ export default {
...toRefs(state),
};
},
};
});
</script>
<style scoped lang="scss">
@ -115,11 +127,11 @@ export default {
cursor: pointer;
font-size: 18px;
margin-right: 15px;
color: var(--bg-topBarColor);
color: var(--next-bg-topBarColor);
}
.layout-navbars-breadcrumb-span {
opacity: 0.7;
color: var(--bg-topBarColor);
color: var(--next-bg-topBarColor);
}
.layout-navbars-breadcrumb-iconfont {
font-size: 14px;
@ -127,7 +139,14 @@ export default {
}
::v-deep(.el-breadcrumb__separator) {
opacity: 0.7;
color: var(--bg-topBarColor);
color: var(--next-bg-topBarColor);
}
::v-deep(.el-breadcrumb__inner a, .el-breadcrumb__inner.is-link) {
font-weight: unset !important;
color: var(--next-bg-topBarColor);
&:hover {
color: var(--el-color-primary) !important;
}
}
}
</style>

View File

@ -1,19 +1,18 @@
<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="ele-Close" />
</div>
</div>
</template>
<script lang="ts">
import { toRefs, reactive, computed } from 'vue';
import { computed, defineComponent } from 'vue';
import { useStore } from '/@/store/index';
export default {
export default defineComponent({
name: 'layoutCloseFull',
setup() {
const store = useStore();
const state: any = reactive({});
// 获取卡片全屏信息
const isTagsViewCurrenFull = computed(() => {
return store.state.tagsViewRoutes.isTagsViewCurrenFull;
@ -25,10 +24,9 @@ export default {
return {
isTagsViewCurrenFull,
onCloseFullscreen,
...toRefs(state),
};
},
};
});
</script>
<style scoped lang="scss">
@ -56,7 +54,7 @@ export default {
background: rgba(0, 0, 0, 0.2);
transition: all 0.3s ease;
i {
color: var(--color-primary);
color: var(--el-color-primary);
transition: all 0.3s ease;
}
}

View File

@ -8,27 +8,29 @@
</template>
<script lang="ts">
import { computed, reactive, toRefs, onMounted, onUnmounted, getCurrentInstance } from 'vue';
import { computed, reactive, toRefs, onMounted, onUnmounted, getCurrentInstance, defineComponent } from 'vue';
import { useRoute } from 'vue-router';
import { useStore } from '/@/store/index';
import Breadcrumb from '/@/layout/navBars/breadcrumb/breadcrumb.vue';
import User from '/@/layout/navBars/breadcrumb/user.vue';
import Logo from '/@/layout/logo/index.vue';
import Horizontal from '/@/layout/navMenu/horizontal.vue';
export default {
// 定义接口来定义对象的类型
interface IndexState {
menuList: object[];
}
export default defineComponent({
name: 'layoutBreadcrumbIndex',
components: { Breadcrumb, User, Logo, Horizontal },
setup() {
const { proxy } = getCurrentInstance() as any;
const { proxy } = <any>getCurrentInstance();
const store = useStore();
const route = useRoute();
const state: any = reactive({
const state = reactive<IndexState>({
menuList: [],
});
// 获取布局配置信息
const getThemeConfig = computed(() => {
return store.state.themeConfig.themeConfig;
});
// 设置 logo 显示/隐藏
const setIsShowLogo = computed(() => {
let { isShowLogo, layout } = store.state.themeConfig.themeConfig;
@ -93,13 +95,12 @@ export default {
proxy.mittBus.off('getBreadcrumbIndexSetFilterRoutes');
});
return {
getThemeConfig,
setIsShowLogo,
isLayoutTransverse,
...toRefs(state),
};
},
};
});
</script>
<style scoped lang="scss">
@ -108,7 +109,7 @@ export default {
display: flex;
align-items: center;
padding-right: 15px;
background: var(--bg-topBar);
border-bottom: 1px solid #f1f2f3;
background: var(--next-bg-topBar);
border-bottom: 1px solid var(--next-border-color-light);
}
</style>

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">
<ele-Search />
</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>
@ -23,6 +30,20 @@ import { reactive, toRefs, defineComponent, ref, nextTick } from 'vue';
import { useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { useStore } from '/@/store/index';
// 定义接口来定义对象的类型
interface SearchState {
isShowSearch: boolean;
menuQuery: string;
tagsViewList: object[];
}
interface Restaurant {
path: string;
meta: {
title: string;
};
}
export default defineComponent({
name: 'layoutBreadcrumbSearch',
setup() {
@ -30,7 +51,7 @@ export default defineComponent({
const { t } = useI18n();
const store = useStore();
const router = useRouter();
const state: any = reactive({
const state = reactive<SearchState>({
isShowSearch: false,
menuQuery: '',
tagsViewList: [],
@ -49,13 +70,13 @@ export default defineComponent({
state.isShowSearch = false;
};
// 菜单搜索数据过滤
const menuSearch = (queryString: any, cb: any) => {
const menuSearch = (queryString: string, cb: Function) => {
let results = queryString ? state.tagsViewList.filter(createFilter(queryString)) : state.tagsViewList;
cb(results);
};
// 菜单搜索过滤
const createFilter = (queryString: any) => {
return (restaurant: any) => {
const createFilter: any = (queryString: string) => {
return (restaurant: Restaurant) => {
return (
restaurant.path.toLowerCase().indexOf(queryString.toLowerCase()) > -1 ||
restaurant.meta.title.toLowerCase().indexOf(queryString.toLowerCase()) > -1 ||

View File

@ -5,7 +5,7 @@
v-model="getThemeConfig.isDrawer"
direction="rtl"
destroy-on-close
size="240px"
size="260px"
@close="onDrawerClose"
>
<el-scrollbar class="layout-breadcrumb-seting-bar">
@ -14,96 +14,95 @@
<div class="layout-breadcrumb-seting-bar-flex">
<div class="layout-breadcrumb-seting-bar-flex-label">primary</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-color-picker v-model="getThemeConfig.primary" size="small" @change="onColorPickerChange('primary')"> </el-color-picker>
<el-color-picker v-model="getThemeConfig.primary" size="default" @change="onColorPickerChange"> </el-color-picker>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex">
<div class="layout-breadcrumb-seting-bar-flex-label">success</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-color-picker v-model="getThemeConfig.success" size="small" @change="onColorPickerChange('success')"> </el-color-picker>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex">
<div class="layout-breadcrumb-seting-bar-flex-label">info</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-color-picker v-model="getThemeConfig.info" size="small" @change="onColorPickerChange('info')"> </el-color-picker>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex">
<div class="layout-breadcrumb-seting-bar-flex-label">warning</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-color-picker v-model="getThemeConfig.warning" size="small" @change="onColorPickerChange('warning')"> </el-color-picker>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex">
<div class="layout-breadcrumb-seting-bar-flex-label">danger</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-color-picker v-model="getThemeConfig.danger" size="small" @change="onColorPickerChange('danger')"> </el-color-picker>
<el-switch v-model="getThemeConfig.isIsDark" size="small" @change="onAddDarkChange"></el-switch>
</div>
</div>
<!-- 菜单 / 顶栏 -->
<el-divider content-position="left">{{ $t('message.layout.twoTitle') }}</el-divider>
<!-- 顶栏设置 -->
<el-divider content-position="left">{{ $t('message.layout.twoTopTitle') }}</el-divider>
<div class="layout-breadcrumb-seting-bar-flex">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.twoTopBar') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-color-picker v-model="getThemeConfig.topBar" size="small" @change="onBgColorPickerChange('topBar')"> </el-color-picker>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.twoMenuBar') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-color-picker v-model="getThemeConfig.menuBar" size="small" @change="onBgColorPickerChange('menuBar')"> </el-color-picker>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.twoColumnsMenuBar') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-color-picker v-model="getThemeConfig.columnsMenuBar" size="small" @change="onBgColorPickerChange('columnsMenuBar')">
</el-color-picker>
<el-color-picker v-model="getThemeConfig.topBar" size="default" @change="onBgColorPickerChange('topBar')"> </el-color-picker>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.twoTopBarColor') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-color-picker v-model="getThemeConfig.topBarColor" size="small" @change="onBgColorPickerChange('topBarColor')"> </el-color-picker>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.twoMenuBarColor') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-color-picker v-model="getThemeConfig.menuBarColor" size="small" @change="onBgColorPickerChange('menuBarColor')"> </el-color-picker>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.twoColumnsMenuBarColor') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-color-picker v-model="getThemeConfig.columnsMenuBarColor" size="small" @change="onBgColorPickerChange('columnsMenuBarColor')">
</el-color-picker>
<el-color-picker v-model="getThemeConfig.topBarColor" size="default" @change="onBgColorPickerChange('topBarColor')"> </el-color-picker>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex mt10">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.twoIsTopBarColorGradual') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-switch v-model="getThemeConfig.isTopBarColorGradual" @change="onTopBarGradualChange"></el-switch>
<el-switch v-model="getThemeConfig.isTopBarColorGradual" size="small" @change="onTopBarGradualChange"></el-switch>
</div>
</div>
<!-- 菜单设置 -->
<el-divider content-position="left">{{ $t('message.layout.twoMenuTitle') }}</el-divider>
<div class="layout-breadcrumb-seting-bar-flex">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.twoMenuBar') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-color-picker v-model="getThemeConfig.menuBar" size="default" @change="onBgColorPickerChange('menuBar')"> </el-color-picker>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.twoMenuBarColor') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-color-picker v-model="getThemeConfig.menuBarColor" size="default" @change="onBgColorPickerChange('menuBarColor')"> </el-color-picker>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex mt14">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.twoIsMenuBarColorGradual') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-switch v-model="getThemeConfig.isMenuBarColorGradual" @change="onMenuBarGradualChange"></el-switch>
<el-switch v-model="getThemeConfig.isMenuBarColorGradual" size="small" @change="onMenuBarGradualChange"></el-switch>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex mt14">
<!-- 分栏设置 -->
<el-divider content-position="left" :style="{ opacity: getThemeConfig.layout !== 'columns' ? 0.5 : 1 }">{{
$t('message.layout.twoColumnsTitle')
}}</el-divider>
<div class="layout-breadcrumb-seting-bar-flex" :style="{ opacity: getThemeConfig.layout !== 'columns' ? 0.5 : 1 }">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.twoColumnsMenuBar') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-color-picker
v-model="getThemeConfig.columnsMenuBar"
size="default"
@change="onBgColorPickerChange('columnsMenuBar')"
:disabled="getThemeConfig.layout !== 'columns'"
>
</el-color-picker>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex" :style="{ opacity: getThemeConfig.layout !== 'columns' ? 0.5 : 1 }">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.twoColumnsMenuBarColor') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-color-picker
v-model="getThemeConfig.columnsMenuBarColor"
size="default"
@change="onBgColorPickerChange('columnsMenuBarColor')"
:disabled="getThemeConfig.layout !== 'columns'"
>
</el-color-picker>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex mt14" :style="{ opacity: getThemeConfig.layout !== 'columns' ? 0.5 : 1 }">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.twoIsColumnsMenuBarColorGradual') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-switch v-model="getThemeConfig.isColumnsMenuBarColorGradual" @change="onColumnsMenuBarGradualChange"></el-switch>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex mt14">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.twoIsMenuBarColorHighlight') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-switch v-model="getThemeConfig.isMenuBarColorHighlight" @change="onMenuBarHighlightChange"></el-switch>
<el-switch
v-model="getThemeConfig.isColumnsMenuBarColorGradual"
size="small"
@change="onColumnsMenuBarGradualChange"
:disabled="getThemeConfig.layout !== 'columns'"
></el-switch>
</div>
</div>
@ -112,32 +111,37 @@
<div class="layout-breadcrumb-seting-bar-flex">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.threeIsCollapse') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-switch v-model="getThemeConfig.isCollapse" @change="onThemeConfigChange"></el-switch>
<el-switch v-model="getThemeConfig.isCollapse" size="small" @change="onThemeConfigChange"></el-switch>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex mt15">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.threeIsUniqueOpened') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-switch v-model="getThemeConfig.isUniqueOpened" @change="setLocalThemeConfig"></el-switch>
<el-switch v-model="getThemeConfig.isUniqueOpened" size="small" @change="setLocalThemeConfig"></el-switch>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex mt15">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.threeIsFixedHeader') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-switch v-model="getThemeConfig.isFixedHeader" @change="onIsFixedHeaderChange"></el-switch>
<el-switch v-model="getThemeConfig.isFixedHeader" size="small" @change="onIsFixedHeaderChange"></el-switch>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex mt15" :style="{ opacity: getThemeConfig.layout !== 'classic' ? 0.5 : 1 }">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.threeIsClassicSplitMenu') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-switch v-model="getThemeConfig.isClassicSplitMenu" :disabled="getThemeConfig.layout !== 'classic'" @change="onClassicSplitMenuChange">
<el-switch
v-model="getThemeConfig.isClassicSplitMenu"
:disabled="getThemeConfig.layout !== 'classic'"
size="small"
@change="onClassicSplitMenuChange"
>
</el-switch>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex mt15">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.threeIsLockScreen') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-switch v-model="getThemeConfig.isLockScreen" @change="setLocalThemeConfig"></el-switch>
<el-switch v-model="getThemeConfig.isLockScreen" size="small" @change="setLocalThemeConfig"></el-switch>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex mt11">
@ -149,7 +153,7 @@
:min="1"
:max="9999"
@change="setLocalThemeConfig"
size="mini"
size="default"
style="width: 90px"
>
</el-input-number>
@ -161,7 +165,7 @@
<div class="layout-breadcrumb-seting-bar-flex mt15">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fourIsShowLogo') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-switch v-model="getThemeConfig.isShowLogo" @change="onIsShowLogoChange"></el-switch>
<el-switch v-model="getThemeConfig.isShowLogo" size="small" @change="onIsShowLogoChange"></el-switch>
</div>
</div>
<div
@ -173,6 +177,7 @@
<el-switch
v-model="getThemeConfig.isBreadcrumb"
:disabled="getThemeConfig.layout === 'classic' || getThemeConfig.layout === 'transverse'"
size="small"
@change="onIsBreadcrumbChange"
></el-switch>
</div>
@ -180,73 +185,72 @@
<div class="layout-breadcrumb-seting-bar-flex mt15">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fourIsBreadcrumbIcon') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-switch v-model="getThemeConfig.isBreadcrumbIcon" @change="setLocalThemeConfig"></el-switch>
<el-switch v-model="getThemeConfig.isBreadcrumbIcon" size="small" @change="setLocalThemeConfig"></el-switch>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex mt15">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fourIsTagsview') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-switch v-model="getThemeConfig.isTagsview" @change="setLocalThemeConfig"></el-switch>
<el-switch v-model="getThemeConfig.isTagsview" size="small" @change="setLocalThemeConfig"></el-switch>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex mt15">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fourIsTagsviewIcon') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-switch v-model="getThemeConfig.isTagsviewIcon" @change="setLocalThemeConfig"></el-switch>
<el-switch v-model="getThemeConfig.isTagsviewIcon" size="small" @change="setLocalThemeConfig"></el-switch>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex mt15">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fourIsCacheTagsView') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-switch v-model="getThemeConfig.isCacheTagsView" @change="setLocalThemeConfig"></el-switch>
<el-switch v-model="getThemeConfig.isCacheTagsView" size="small" @change="setLocalThemeConfig"></el-switch>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex mt15">
<div class="layout-breadcrumb-seting-bar-flex mt15" :style="{ opacity: isMobile ? 0.5 : 1 }">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fourIsSortableTagsView') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-switch v-model="getThemeConfig.isSortableTagsView" @change="onSortableTagsViewChange"></el-switch>
<el-switch
v-model="getThemeConfig.isSortableTagsView"
:disabled="isMobile ? true : false"
size="small"
@change="onSortableTagsViewChange"
></el-switch>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex mt15">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fourIsShareTagsView') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-switch v-model="getThemeConfig.isShareTagsView" @change="onShareTagsViewChange"></el-switch>
<el-switch v-model="getThemeConfig.isShareTagsView" size="small" @change="onShareTagsViewChange"></el-switch>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex mt15">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fourIsFooter') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-switch v-model="getThemeConfig.isFooter" @change="setLocalThemeConfig"></el-switch>
<el-switch v-model="getThemeConfig.isFooter" size="small" @change="setLocalThemeConfig"></el-switch>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex mt15">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fourIsGrayscale') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-switch v-model="getThemeConfig.isGrayscale" @change="onAddFilterChange('grayscale')"></el-switch>
<el-switch v-model="getThemeConfig.isGrayscale" size="small" @change="onAddFilterChange('grayscale')"></el-switch>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex mt15">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fourIsInvert') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<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>
<el-switch v-model="getThemeConfig.isInvert" size="small" @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.fourIsWartermark') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-switch v-model="getThemeConfig.isWartermark" @change="onWartermarkChange"></el-switch>
<el-switch v-model="getThemeConfig.isWartermark" size="small" @change="onWartermarkChange"></el-switch>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex mt14">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fourWartermarkText') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-input v-model="getThemeConfig.wartermarkText" size="mini" style="width: 90px" @input="onWartermarkTextInput($event)"></el-input>
<el-input v-model="getThemeConfig.wartermarkText" size="default" style="width: 90px" @input="onWartermarkTextInput($event)"></el-input>
</div>
</div>
@ -255,37 +259,50 @@
<div class="layout-breadcrumb-seting-bar-flex mt15">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fiveTagsStyle') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-select v-model="getThemeConfig.tagsStyle" placeholder="请选择" size="mini" style="width: 90px" @change="setLocalThemeConfig">
<el-select v-model="getThemeConfig.tagsStyle" placeholder="请选择" size="default" style="width: 90px" @change="setLocalThemeConfig">
<el-option label="风格1" value="tags-style-one"></el-option>
<el-option label="风格2" value="tags-style-two"></el-option>
<el-option label="风格3" value="tags-style-three"></el-option>
<el-option label="风格4" value="tags-style-four"></el-option>
<el-option label="风格5" value="tags-style-five"></el-option>
</el-select>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex mt15">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fiveAnimation') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-select v-model="getThemeConfig.animation" placeholder="请选择" size="mini" style="width: 90px" @change="setLocalThemeConfig">
<el-select v-model="getThemeConfig.animation" placeholder="请选择" size="default" style="width: 90px" @change="setLocalThemeConfig">
<el-option label="slide-right" value="slide-right"></el-option>
<el-option label="slide-left" value="slide-left"></el-option>
<el-option label="opacitys" value="opacitys"></el-option>
</el-select>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex mt15">
<div class="layout-breadcrumb-seting-bar-flex mt15" :style="{ opacity: getThemeConfig.layout !== 'columns' ? 0.5 : 1 }">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.fiveColumnsAsideStyle') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-select v-model="getThemeConfig.columnsAsideStyle" placeholder="请选择" size="mini" style="width: 90px" @change="setLocalThemeConfig">
<el-select
v-model="getThemeConfig.columnsAsideStyle"
placeholder="请选择"
size="default"
style="width: 90px"
:disabled="getThemeConfig.layout !== 'columns' ? true : false"
@change="setLocalThemeConfig"
>
<el-option label="圆角" value="columns-round"></el-option>
<el-option label="卡片" value="columns-card"></el-option>
</el-select>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex mt15 mb27">
<div class="layout-breadcrumb-seting-bar-flex mt15 mb27" :style="{ opacity: getThemeConfig.layout !== 'columns' ? 0.5 : 1 }">
<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">
<el-select
v-model="getThemeConfig.columnsAsideLayout"
placeholder="请选择"
size="default"
style="width: 90px"
:disabled="getThemeConfig.layout !== 'columns' ? true : false"
@change="setLocalThemeConfig"
>
<el-option label="水平" value="columns-horizontal"></el-option>
<el-option label="垂直" value="columns-vertical"></el-option>
</el-select>
@ -362,17 +379,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="default" class="copy-config-btn" type="primary" ref="copyConfigBtnRef" @click="onCopyConfigClick">
<el-icon class="mr5">
<ele-CopyDocument />
</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="default" class="copy-config-btn-reset" type="info" @click="onResetConfigClick">
<el-icon class="mr5">
<ele-RefreshRight />
</el-icon>
{{ $t('message.layout.resetText') }}
</el-button>
</div>
</el-scrollbar>
@ -381,38 +398,38 @@
</template>
<script lang="ts">
import { nextTick, onUnmounted, onMounted, getCurrentInstance, defineComponent, computed } from 'vue';
import { nextTick, onUnmounted, onMounted, getCurrentInstance, defineComponent, computed, reactive, toRefs } from 'vue';
import { useStore } from '/@/store/index';
import { getLightColor } from '/@/utils/theme';
import { verifyAndSpace } from '/@/utils/toolsValidate';
import { Local } from '/@/utils/storage';
import Watermark from '/@/utils/wartermark';
import commonFunction from '/@/utils/commonFunction';
import other from '/@/utils/other';
export default defineComponent({
name: 'layoutBreadcrumbSeting',
setup() {
const { proxy } = getCurrentInstance() as any;
const { proxy } = <any>getCurrentInstance();
const store = useStore();
const { copyText } = commonFunction();
const state = reactive({
isMobile: false,
});
// 获取布局配置信息
const getThemeConfig = computed(() => {
return store.state.themeConfig.themeConfig;
});
// 1、全局主题
const onColorPickerChange = (color: string) => {
setPropertyFun(`--color-${color}`, getThemeConfig.value[color]);
setDispatchThemeConfig();
};
// 1、全局主题设置函数
const setPropertyFun = (color: string, targetVal: any) => {
document.documentElement.style.setProperty(color, targetVal);
const onColorPickerChange = () => {
document.documentElement.style.setProperty('--el-color-primary', getThemeConfig.value.primary);
for (let i = 1; i <= 9; i++) {
document.documentElement.style.setProperty(`${color}-light-${i}`, getLightColor(targetVal, i / 10));
document.documentElement.style.setProperty(`--el-color-primary-light-${i}`, `${getLightColor(getThemeConfig.value.primary, i / 10)}`);
}
setDispatchThemeConfig();
};
// 2、菜单 / 顶栏
const onBgColorPickerChange = (bg: string) => {
document.documentElement.style.setProperty(`--bg-${bg}`, getThemeConfig.value[bg]);
document.documentElement.style.setProperty(`--next-bg-${bg}`, (<any>getThemeConfig.value)[bg]);
onTopBarGradualChange();
onMenuBarGradualChange();
onColumnsMenuBarGradualChange();
@ -432,35 +449,17 @@ export default defineComponent({
};
// 2、菜单 / 顶栏 --> 背景渐变函数
const setGraduaFun = (el: string, bool: boolean, color: string) => {
nextTick(() => {
setTimeout(() => {
let els = document.querySelector(el);
if (!els) return false;
if (bool) els.setAttribute('style', `background-image:linear-gradient(to bottom left , ${color}, ${getLightColor(color, 0.6)})`);
else els.setAttribute('style', `background-image:${color}`);
document.documentElement.style.setProperty('--el-menu-bg-color', document.documentElement.style.getPropertyValue('--next-bg-menuBar'));
if (bool) els.setAttribute('style', `background:linear-gradient(to bottom left , ${color}, ${getLightColor(color, 0.6)}) !important;`);
else els.setAttribute('style', ``);
setLocalThemeConfig();
});
};
// 2、菜单 / 顶栏 --> 菜单字体背景高亮
const onMenuBarHighlightChange = () => {
nextTick(() => {
setTimeout(() => {
let elsItems = document.querySelectorAll('.el-menu-item');
let elActive = document.querySelector('.el-menu-item.is-active');
if (!elActive) return false;
if (getThemeConfig.value.isMenuBarColorHighlight) {
elsItems.forEach((el: any) => el.setAttribute('id', ``));
elActive.setAttribute('id', `add-is-active`);
Local.set('menuBarHighlightId', elActive.getAttribute('id'));
} else {
elActive.setAttribute('id', ``);
}
setLocalThemeConfig();
}, 0);
});
}, 200);
};
// 3、界面设置 --> 菜单水平折叠
const onThemeConfigChange = () => {
onMenuBarHighlightChange();
setDispatchThemeConfig();
};
// 3、界面设置 --> 固定 Header
@ -534,7 +533,6 @@ export default defineComponent({
getThemeConfig.value.layout = layout;
getThemeConfig.value.isDrawer = false;
initLayoutChangeFun();
onMenuBarHighlightChange();
};
// 设置布局切换函数
const initLayoutChangeFun = () => {
@ -542,6 +540,8 @@ export default defineComponent({
onBgColorPickerChange('menuBarColor');
onBgColorPickerChange('topBar');
onBgColorPickerChange('topBarColor');
onBgColorPickerChange('columnsMenuBar');
onBgColorPickerChange('columnsMenuBarColor');
};
// 关闭弹窗时,初始化变量。变量用于处理 proxy.$refs.layoutScrollbarRef.update()
const onDrawerClose = () => {
@ -581,42 +581,28 @@ export default defineComponent({
Local.clear();
window.location.reload();
};
// 修复防止退出登录再进入界面时,需要刷新样式才生效的问题,初始化布局样式等(登录的时候触发,目前方案)
// 初始化菜单样式等
const initSetStyle = () => {
setTimeout(() => {
// 2、菜单 / 顶栏 --> 顶栏背景渐变
onTopBarGradualChange();
// 2、菜单 / 顶栏 --> 菜单背景渐变
onMenuBarGradualChange();
// 2、菜单 / 顶栏 --> 分栏菜单背景渐变
onColumnsMenuBarGradualChange();
// 2、菜单 / 顶栏 --> 菜单字体背景高亮
onMenuBarHighlightChange();
}, 1300);
// 2、菜单 / 顶栏 --> 顶栏背景渐变
onTopBarGradualChange();
// 2、菜单 / 顶栏 --> 菜单背景渐变
onMenuBarGradualChange();
// 2、菜单 / 顶栏 --> 分栏菜单背景渐变
onColumnsMenuBarGradualChange();
};
onMounted(() => {
nextTick(() => {
// 判断当前布局是否不相同不相同则初始化当前布局的样式防止监听窗口大小改变时布局配置logo、菜单背景等部分布局失效问题
if (!Local.get('frequency')) initLayoutChangeFun();
Local.set('frequency', 1);
// 修复防止退出登录再进入界面时,需要刷新样式才生效的问题,初始化布局样式等(登录的时候触发,目前方案)
proxy.mittBus.on('onSignInClick', () => {
initSetStyle();
});
// 监听菜单点击,菜单字体背景高亮
proxy.mittBus.on('onMenuClick', () => {
onMenuBarHighlightChange();
});
// 监听窗口大小改变,非默认布局,设置成默认布局(适配移动端)
proxy.mittBus.on('layoutMobileResize', (res: any) => {
getThemeConfig.value.layout = res.layout;
getThemeConfig.value.isDrawer = false;
initLayoutChangeFun();
onMenuBarHighlightChange();
state.isMobile = other.isMobile();
});
setTimeout(() => {
// 修复防止退出登录再进入界面时,需要刷新样式才生效的问题,初始化布局样式等(登录的时候触发,目前方案)
initSetStyle();
// 灰色模式
if (getThemeConfig.value.isGrayscale) onAddFilterChange('grayscale');
// 色弱模式
@ -627,13 +613,12 @@ export default defineComponent({
onWartermarkChange();
// 语言国际化
if (Local.get('themeConfig')) proxy.$i18n.locale = Local.get('themeConfig').globalI18n;
// 初始化菜单样式等
initSetStyle();
}, 100);
});
});
onUnmounted(() => {
// 取消监听菜单点击,菜单字体背景高亮
proxy.mittBus.off('onMenuClick');
proxy.mittBus.off('onSignInClick');
proxy.mittBus.off('layoutMobileResize');
});
return {
@ -643,7 +628,6 @@ export default defineComponent({
onTopBarGradualChange,
onMenuBarGradualChange,
onColumnsMenuBarGradualChange,
onMenuBarHighlightChange,
onThemeConfigChange,
onIsFixedHeaderChange,
onIsShowLogoChange,
@ -661,6 +645,7 @@ export default defineComponent({
onShareTagsViewChange,
onCopyConfigClick,
onResetConfigClick,
...toRefs(state),
};
},
});
@ -676,9 +661,10 @@ export default defineComponent({
.layout-breadcrumb-seting-bar-flex {
display: flex;
align-items: center;
margin-bottom: 5px;
&-label {
flex: 1;
color: #666666;
color: var(--el-text-color-primary);
}
}
.layout-drawer-content-flex {
@ -697,16 +683,16 @@ export default defineComponent({
.el-container {
height: 100%;
.el-aside-dark {
background-color: #b3c0d1;
background-color: var(--next-color-seting-header);
}
.el-aside {
background-color: #d3dce6;
background-color: var(--next-color-seting-aside);
}
.el-header {
background-color: #b3c0d1;
background-color: var(--next-color-seting-header);
}
.el-main {
background-color: #e9eef3;
background-color: var(--next-color-seting-main);
}
}
.el-circular {
@ -717,7 +703,7 @@ export default defineComponent({
}
.drawer-layout-active {
border: 1px solid;
border-color: var(--color-primary);
border-color: var(--el-color-primary);
}
.layout-tips-warp,
.layout-tips-warp-active {
@ -727,7 +713,7 @@ export default defineComponent({
top: 50%;
transform: translate(-50%, -50%);
border: 1px solid;
border-color: var(--color-primary-light-4);
border-color: var(--el-color-primary-light-4);
border-radius: 100%;
padding: 4px;
.layout-tips-box {
@ -736,7 +722,7 @@ export default defineComponent({
height: 30px;
z-index: 9;
border: 1px solid;
border-color: var(--color-primary-light-4);
border-color: var(--el-color-primary-light-4);
border-radius: 100%;
.layout-tips-txt {
transition: inherit;
@ -746,11 +732,11 @@ export default defineComponent({
line-height: 1;
letter-spacing: 2px;
white-space: nowrap;
color: var(--color-primary-light-4);
color: var(--el-color-primary-light-4);
text-align: center;
transform: rotate(30deg);
left: -1px;
background-color: #e9eef3;
background-color: var(--next-color-seting-main);
width: 32px;
height: 17px;
line-height: 17px;
@ -759,13 +745,13 @@ export default defineComponent({
}
.layout-tips-warp-active {
border: 1px solid;
border-color: var(--color-primary);
border-color: var(--el-color-primary);
.layout-tips-box {
border: 1px solid;
border-color: var(--color-primary);
border-color: var(--el-color-primary);
.layout-tips-txt {
color: var(--color-primary) !important;
background-color: #e9eef3 !important;
color: var(--el-color-primary) !important;
background-color: var(--next-color-seting-main) !important;
}
}
}
@ -773,18 +759,18 @@ export default defineComponent({
.el-circular {
transition: all 0.3s ease-in-out;
border: 1px solid;
border-color: var(--color-primary);
border-color: var(--el-color-primary);
}
.layout-tips-warp {
transition: all 0.3s ease-in-out;
border-color: var(--color-primary);
border-color: var(--el-color-primary);
.layout-tips-box {
transition: inherit;
border-color: var(--color-primary);
border-color: var(--el-color-primary);
.layout-tips-txt {
transition: inherit;
color: var(--color-primary) !important;
background-color: #e9eef3 !important;
color: var(--el-color-primary) !important;
background-color: var(--next-color-seting-main) !important;
}
}
}

View File

@ -6,10 +6,9 @@
</div>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="" :disabled="disabledSize === ''">{{ $t('message.user.dropdownDefault') }}</el-dropdown-item>
<el-dropdown-item command="medium" :disabled="disabledSize === 'medium'">{{ $t('message.user.dropdownMedium') }}</el-dropdown-item>
<el-dropdown-item command="large" :disabled="disabledSize === 'large'">{{ $t('message.user.dropdownLarge') }}</el-dropdown-item>
<el-dropdown-item command="default" :disabled="disabledSize === 'default'">{{ $t('message.user.dropdownDefault') }}</el-dropdown-item>
<el-dropdown-item command="small" :disabled="disabledSize === 'small'">{{ $t('message.user.dropdownSmall') }}</el-dropdown-item>
<el-dropdown-item command="mini" :disabled="disabledSize === 'mini'">{{ $t('message.user.dropdownMini') }}</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
@ -26,21 +25,23 @@
</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')">
<ele-Search />
</el-icon>
</div>
<div class="layout-navbars-breadcrumb-user-icon" @click="onLayoutSetingClick">
<i class="icon-skin iconfont" :title="$t('message.user.title3')"></i>
</div>
<div class="layout-navbars-breadcrumb-user-icon">
<el-popover placement="bottom" trigger="click" v-model:visible="isShowUserNewsPopover" :width="300" popper-class="el-popover-pupop-user-news">
<el-popover placement="bottom" trigger="click" :width="300">
<template #reference>
<el-badge :is-dot="true" @click="isShowUserNewsPopover = !isShowUserNewsPopover">
<i class="el-icon-bell" :title="$t('message.user.title4')"></i>
<el-badge :is-dot="true">
<el-icon :title="$t('message.user.title4')">
<ele-Bell />
</el-icon>
</el-badge>
</template>
<transition name="el-zoom-in-top">
<UserNews v-show="isShowUserNewsPopover" />
</transition>
<UserNews />
</el-popover>
</div>
<div class="layout-navbars-breadcrumb-user-icon mr10" @click="onScreenfullClick">
@ -53,8 +54,10 @@
<el-dropdown :show-timeout="70" :hide-timeout="50" @command="onHandleCommandClick">
<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>
{{ getUserInfos.userName === '' ? 'common' : getUserInfos.userName }}
<el-icon class="el-icon--right">
<ele-ArrowDown />
</el-icon>
</span>
<template #dropdown>
<el-dropdown-menu>
@ -72,36 +75,34 @@
</template>
<script lang="ts">
import { ref, getCurrentInstance, computed, reactive, toRefs, onMounted } from 'vue';
import { ref, getCurrentInstance, computed, reactive, toRefs, onMounted, defineComponent } from 'vue';
import { useRouter } from 'vue-router';
import { ElMessageBox, ElMessage } from 'element-plus';
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';
export default {
export default defineComponent({
name: 'layoutBreadcrumbUser',
components: { UserNews, Search },
setup() {
const { t } = useI18n();
const { proxy } = getCurrentInstance() as any;
const { proxy } = <any>getCurrentInstance();
const router = useRouter();
const store = useStore();
const title = useTitle();
const searchRef = ref();
const state = reactive({
isScreenfull: false,
isShowUserNewsPopover: false,
disabledI18n: 'zh-cn',
disabledSize: '',
disabledSize: 'large',
});
// 获取用户信息 vuex
const getUserInfos = computed(() => {
return store.state.userInfos.userInfos;
return <any>store.state.userInfos.userInfos;
});
// 获取布局配置信息
const getThemeConfig = computed(() => {
@ -109,10 +110,11 @@ export default {
});
// 设置分割样式
const layoutUserFlexNum = computed(() => {
let { layout, isClassicSplitMenu } = getThemeConfig.value;
let num = '';
if (layout === 'defaults' || (layout === 'classic' && !isClassicSplitMenu) || layout === 'columns') num = 1;
else num = null;
let num: string | number = '';
const { layout, isClassicSplitMenu } = getThemeConfig.value;
const layoutArr: string[] = ['defaults', 'columns'];
if (layoutArr.includes(layout) || (layout === 'classic' && !isClassicSplitMenu)) num = '1';
else num = '';
return num;
});
// 全屏点击时
@ -142,6 +144,7 @@ export default {
showCancelButton: true,
confirmButtonText: t('message.user.logOutConfirm'),
cancelButtonText: t('message.user.logOutCancel'),
buttonSize: 'default',
beforeClose: (action, instance, done) => {
if (action === 'confirm') {
instance.confirmButtonLoading = true;
@ -157,13 +160,13 @@ export default {
}
},
})
.then(() => {
.then(async () => {
Session.clear(); // 清除缓存/token等
resetRoute(); // 删除/重置路由
router.push('/login');
await resetRoute(); // 删除/重置路由
ElMessage.success(t('message.user.logOutSuccess'));
setTimeout(() => {
ElMessage.success(t('message.user.logOutSuccess'));
}, 300);
window.location.href = ''; // 去登录页
}, 500);
})
.catch(() => {});
} else if (path === 'wareHouse') {
@ -181,7 +184,6 @@ export default {
Local.remove('themeConfig');
getThemeConfig.value.globalComponentSize = size;
Local.set('themeConfig', getThemeConfig.value);
proxy.$ELEMENT.size = size;
initComponentSize();
window.location.reload();
};
@ -192,7 +194,7 @@ export default {
Local.set('themeConfig', getThemeConfig.value);
proxy.$i18n.locale = lang;
initI18n();
title();
other.useTitle();
};
// 设置 element plus 组件的国际化
const setI18nConfig = (locale: string) => {
@ -218,18 +220,15 @@ export default {
// 初始化全局组件大小
const initComponentSize = () => {
switch (Local.get('themeConfig').globalComponentSize) {
case '':
state.disabledSize = '';
case 'large':
state.disabledSize = 'large';
break;
case 'medium':
state.disabledSize = 'medium';
case 'default':
state.disabledSize = 'default';
break;
case 'small':
state.disabledSize = 'small';
break;
case 'mini':
state.disabledSize = 'mini';
break;
}
};
// 页面加载时
@ -252,7 +251,7 @@ export default {
...toRefs(state),
};
},
};
});
</script>
<style scoped lang="scss">
@ -274,13 +273,13 @@ export default {
&-icon {
padding: 0 10px;
cursor: pointer;
color: var(--bg-topBarColor);
color: var(--next-bg-topBarColor);
height: 50px;
line-height: 50px;
display: flex;
align-items: center;
&:hover {
background: rgba(0, 0, 0, 0.04);
background: var(--next-color-user-hover);
i {
display: inline-block;
animation: logoAnimation 0.3s ease-in-out;
@ -288,7 +287,7 @@ export default {
}
}
::v-deep(.el-dropdown) {
color: var(--bg-topBarColor);
color: var(--next-bg-topBarColor);
}
::v-deep(.el-badge) {
height: 40px;

View File

@ -21,8 +21,8 @@
</template>
<script lang="ts">
import { reactive, toRefs } from 'vue';
export default {
import { reactive, toRefs, defineComponent } from 'vue';
export default defineComponent({
name: 'layoutBreadcrumbUserNews',
setup() {
const state = reactive({
@ -53,21 +53,21 @@ export default {
...toRefs(state),
};
},
};
});
</script>
<style scoped lang="scss">
.layout-navbars-breadcrumb-user-news {
.head-box {
display: flex;
border-bottom: 1px solid #ebeef5;
border-bottom: 1px solid var(--el-border-color-lighter);
box-sizing: border-box;
color: #333333;
color: var(--el-text-color-primary);
justify-content: space-between;
height: 35px;
align-items: center;
.head-box-btn {
color: var(--color-primary);
color: var(--el-color-primary);
font-size: 13px;
cursor: pointer;
opacity: 0.8;
@ -84,25 +84,25 @@ export default {
padding-bottom: 12px;
}
.content-box-msg {
color: #999999;
color: var(--el-text-color-secondary);
margin-top: 5px;
margin-bottom: 5px;
}
.content-box-time {
color: #999999;
color: var(--el-text-color-secondary);
}
}
}
.foot-box {
height: 35px;
color: var(--color-primary);
color: var(--el-color-primary);
font-size: 13px;
cursor: pointer;
opacity: 0.8;
display: flex;
align-items: center;
justify-content: center;
border-top: 1px solid #ebeef5;
border-top: 1px solid var(--el-border-color-lighter);
&:hover {
opacity: 1;
}

View File

@ -6,11 +6,11 @@
</template>
<script lang="ts">
import { computed } from 'vue';
import { computed, defineComponent } from 'vue';
import { useStore } from '/@/store/index';
import BreadcrumbIndex from '/@/layout/navBars/breadcrumb/index.vue';
import TagsView from '/@/layout/navBars/tagsView/tagsView.vue';
export default {
export default defineComponent({
name: 'layoutNavBars',
components: { BreadcrumbIndex, TagsView },
setup() {
@ -24,7 +24,7 @@ export default {
setShowTagsView,
};
},
};
});
</script>
<style scoped lang="scss">

View File

@ -19,33 +19,39 @@
v-if="!v.affix"
@click="onCurrentContextmenuClick(v.contextMenuClickId)"
>
<i :class="v.icon"></i>
<SvgIcon :name="v.icon" />
<span>{{ $t(v.txt) }}</span>
</li>
</template>
</ul>
<div class="el-popper__arrow" style="left: 10px"></div>
<div class="el-popper__arrow" :style="{ left: `${arrowLeft}px` }"></div>
</div>
</transition>
</template>
<script lang="ts">
import { computed, defineComponent, reactive, toRefs, onMounted, onUnmounted } from 'vue';
import { computed, defineComponent, reactive, toRefs, onMounted, onUnmounted, watch } from 'vue';
export default defineComponent({
name: 'layoutTagsViewContextmenu',
props: {
dropdown: {
type: Object,
default: () => {
return {
x: 0,
y: 0,
};
},
},
},
setup(props, { emit }) {
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: 'ele-RefreshRight' },
{ contextMenuClickId: 1, txt: 'message.tagsView.close', affix: false, icon: 'ele-Close' },
{ contextMenuClickId: 2, txt: 'message.tagsView.closeOther', affix: false, icon: 'ele-CircleClose' },
{ contextMenuClickId: 3, txt: 'message.tagsView.closeAll', affix: false, icon: 'ele-FolderDelete' },
{
contextMenuClickId: 4,
txt: 'message.tagsView.fullscreen',
@ -54,10 +60,19 @@ export default defineComponent({
},
],
item: {},
arrowLeft: 10,
});
// 父级传过来的坐标 x,y 值
const dropdowns = computed(() => {
return props.dropdown;
// 117 为 `Dropdown 下拉菜单` 的宽度
if (props.dropdown.x + 117 > document.documentElement.clientWidth) {
return {
x: document.documentElement.clientWidth - 117 - 5,
y: props.dropdown.y,
};
} else {
return props.dropdown;
}
});
// 当前项菜单点击
const onCurrentContextmenuClick = (contextMenuClickId: number) => {
@ -84,6 +99,17 @@ export default defineComponent({
onUnmounted(() => {
document.body.removeEventListener('click', closeContextmenu);
});
// 监听下拉菜单位置
watch(
() => props.dropdown,
({ x }) => {
if (x + 117 > document.documentElement.clientWidth) state.arrowLeft = 117 - (document.documentElement.clientWidth - x);
else state.arrowLeft = 10;
},
{
deep: true,
}
);
return {
dropdowns,
openContextmenu,

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,27 @@
"
>
<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="ele-RefreshRight"
class="ml5 layout-navbars-tagsview-ul-li-refresh"
@click.stop="refreshCurrentTagsView($route.fullPath)"
/>
<SvgIcon
name="ele-Close"
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="ele-Close"
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>
@ -40,27 +46,69 @@
</template>
<script lang="ts">
import { toRefs, reactive, onMounted, computed, ref, nextTick, onBeforeUpdate, onBeforeMount, onUnmounted, getCurrentInstance, watch } from 'vue';
import {
toRefs,
reactive,
onMounted,
computed,
ref,
nextTick,
onBeforeUpdate,
onBeforeMount,
onUnmounted,
getCurrentInstance,
watch,
defineComponent,
} from 'vue';
import { useRoute, useRouter, onBeforeRouteUpdate } from 'vue-router';
import Sortable from 'sortablejs';
import { ElMessage } from 'element-plus';
import { useStore } from '/@/store/index';
import { Session } from '/@/utils/storage';
import { isObjectValueEqual } from '/@/utils/arrayOperation';
import other from '/@/utils/other';
import Contextmenu from '/@/layout/navBars/tagsView/contextmenu.vue';
export default {
// 定义接口来定义对象的类型
interface TagsViewState {
routeActive: string;
routePath: string | unknown;
dropdown: {
x: string | number;
y: string | number;
};
tagsRefsIndex: number;
tagsViewList: any[];
sortable: any;
tagsViewRoutesList: any[];
}
interface RouteParams {
path: string;
url: string;
}
interface CurrentContextmenu {
meta: {
isDynamic: boolean;
};
params: any;
query: any;
path: string;
contextMenuClickId: string | number;
}
export default defineComponent({
name: 'layoutTagsView',
components: { Contextmenu },
setup() {
const { proxy } = getCurrentInstance() as any;
const tagsRefs = ref([]);
const { proxy } = <any>getCurrentInstance();
const tagsRefs = ref<any[]>([]);
const scrollbarRef = ref();
const contextmenuRef = ref();
const tagsUlRef = ref();
const store = useStore();
const route = useRoute();
const router = useRouter();
const state: any = reactive({
const state = reactive<TagsViewState>({
routeActive: '',
routePath: route.path,
dropdown: { x: '', y: '' },
@ -78,11 +126,11 @@ export default {
return store.state.themeConfig.themeConfig;
});
// 设置 tagsView 高亮
const isActive = (v) => {
const isActive = (v: RouteParams) => {
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 到浏览器临时缓存中,页面刷新时,保留记录
@ -157,7 +205,7 @@ export default {
// 防止拿取不到路由信息
nextTick(async () => {
// 修复https://gitee.com/lyt-top/vue-next-admin/issues/I3YX6G
let item = '';
let item: any = '';
if (to && to.meta.isDynamic) {
// 动态路由xxx/:id/:name"):参数不同,开启多个 tagsview
if (!getThemeConfig.value.isShareTagsView) await solveAddTagsView(path, to);
@ -247,7 +295,7 @@ export default {
};
// 当前项右键菜单点击,拿当前点击的路由路径对比 浏览器缓存中的 tagsView 路由数组,取当前点击项的详细路由信息
// 防止 tagsView 非当前页演示时,操作异常
const getCurrentRouteItem = (path: string, cParams: { [key: string]: any }) => {
const getCurrentRouteItem = (path: string, cParams: any) => {
const itemRoute = Session.get('tagsViewList') ? Session.get('tagsViewList') : state.tagsViewList;
return itemRoute.find((v: any) => {
if (
@ -264,7 +312,7 @@ export default {
});
};
// 当前项右键菜单点击
const onCurrentContextmenuClick = async (item) => {
const onCurrentContextmenuClick = async (item: CurrentContextmenu) => {
const cParams = item.meta.isDynamic ? item.params : item.query;
if (!getCurrentRouteItem(item.path, cParams)) return ElMessage({ type: 'warning', message: '请正确输入路径及完整参数query、params' });
const { path, name, params, query, meta, url } = getCurrentRouteItem(item.path, cParams);
@ -324,7 +372,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 = () => {
@ -341,7 +389,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;
// 当前滚动条偏移宽度
@ -379,7 +427,7 @@ export default {
});
};
// 获取 tagsView 的下标:用于处理 tagsView 点击时的横向滚动
const getTagsRefsIndex = (path: string) => {
const getTagsRefsIndex = (path: string | unknown) => {
nextTick(async () => {
// await 使用该写法,防止拿取不到 tagsViewList 列表数据不完整
let tagsViewList = await state.tagsViewList;
@ -395,19 +443,19 @@ export default {
});
};
// 设置 tagsView 可以进行拖拽
const initSortable = () => {
const el = document.querySelector('.layout-navbars-tagsview-ul') as HTMLElement;
const initSortable = async () => {
const el = <HTMLElement>document.querySelector('.layout-navbars-tagsview-ul');
if (!el) return false;
state.sortable && state.sortable.destroy();
state.sortable.el && 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);
@ -415,11 +463,9 @@ export default {
});
};
// 拖动问题https://gitee.com/lyt-top/vue-next-admin/issues/I3ZRRI
const onSortableResize = () => {
const clientWidth = document.body.clientWidth;
if (clientWidth < 1000) getThemeConfig.value.isSortableTagsView = false;
else getThemeConfig.value.isSortableTagsView = true;
initSortable();
const onSortableResize = async () => {
await initSortable();
if (other.isMobile()) state.sortable.el && state.sortable.destroy();
};
// 页面加载前
onBeforeMount(() => {
@ -428,7 +474,7 @@ export default {
// 拖动问题https://gitee.com/lyt-top/vue-next-admin/issues/I3ZRRI
window.addEventListener('resize', onSortableResize);
// 监听非本页面调用 0 刷新当前1 关闭当前2 关闭其它3 关闭全部 4 当前页全屏
proxy.mittBus.on('onCurrentContextmenuClick', (data: object) => {
proxy.mittBus.on('onCurrentContextmenuClick', (data: CurrentContextmenu) => {
onCurrentContextmenuClick(data);
});
// 监听布局配置界面开启/关闭拖拽
@ -485,7 +531,6 @@ export default {
return {
isActive,
onContextmenu,
getTagsViewRoutes,
onTagsClick,
tagsRefs,
contextmenuRef,
@ -500,15 +545,15 @@ export default {
...toRefs(state),
};
},
};
});
</script>
<style scoped lang="scss">
.layout-navbars-tagsview {
background-color: var(--el-color-white);
border-bottom: 1px solid #f1f2f3;
z-index: 1;
border-bottom: 1px solid var(--next-border-color-light);
position: relative;
z-index: 4;
::v-deep(.el-scrollbar__wrap) {
overflow-x: auto !important;
}
@ -537,9 +582,9 @@ export default {
cursor: pointer;
justify-content: space-between;
&:hover {
background-color: var(--color-primary-light-9);
color: var(--color-primary);
border-color: var(--color-primary-light-6);
background-color: var(--el-color-primary-light-9);
color: var(--el-color-primary);
border-color: var(--el-color-primary-light-6);
}
&-iconfont {
position: relative;
@ -555,8 +600,8 @@ export default {
line-height: 14px;
right: -5px;
&:hover {
color: var(--color-whites);
background-color: var(--color-primary-light-3);
color: var(--el-color-white);
background-color: var(--el-color-primary-light-3);
}
}
.layout-icon-active {
@ -567,64 +612,12 @@ export default {
}
}
.is-active {
color: var(--color-whites);
background: var(--color-primary);
border-color: var(--color-primary);
color: var(--el-color-white);
background: var(--el-color-primary);
border-color: var(--el-color-primary);
transition: border-color 3s ease;
}
}
// 风格2
.tags-style-two {
.layout-navbars-tagsview-ul-li {
height: 34px !important;
line-height: 34px !important;
border: none !important;
.layout-navbars-tagsview-ul-li-iconfont {
display: none;
}
.layout-icon-active {
display: none;
}
.layout-icon-three {
display: block;
}
}
.is-active {
background: none !important;
color: var(--color-primary) !important;
border-bottom: 2px solid !important;
border-color: var(--color-primary) !important;
border-radius: 0 !important;
}
}
// 风格3
.tags-style-three {
.layout-navbars-tagsview-ul-li {
height: 34px !important;
line-height: 34px !important;
border-right: 1px solid #f6f6f6 !important;
border-top: none !important;
border-bottom: none !important;
border-left: none !important;
border-radius: 0 !important;
margin-right: 0 !important;
&:first-of-type {
border-left: 1px solid #f6f6f6 !important;
}
.layout-icon-active {
display: none;
}
.layout-icon-three {
display: block;
}
}
.is-active {
background: var(--el-color-white) !important;
color: var(--color-primary) !important;
border-top: 1px solid !important;
border-top-color: var(--color-primary) !important;
}
}
// 风格4
.tags-style-four {
.layout-navbars-tagsview-ul-li {
@ -644,7 +637,41 @@ export default {
}
.is-active {
background: none !important;
color: var(--color-primary) !important;
color: var(--el-color-primary) !important;
}
}
// 风格5
.tags-style-five {
align-items: flex-end;
.tags-style-five-svg {
-webkit-mask-box-image: url("data:image/svg+xml,%3Csvg width='68' height='34' viewBox='0 0 68 34' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='m27,0c-7.99582,0 -11.95105,0.00205 -12,12l0,6c0,8.284 -0.48549,16.49691 -8.76949,16.49691l54.37857,-0.11145c-8.284,0 -8.60908,-8.10146 -8.60908,-16.38546l0,-6c0.11145,-12.08445 -4.38441,-12 -12,-12l-13,0z' fill='%23409eff'/%3E%3C/svg%3E")
12 27 15;
}
.layout-navbars-tagsview-ul-li {
padding: 0 5px;
border-width: 15px 27px 15px;
border-style: solid;
border-color: transparent;
margin: 0 -15px;
.layout-icon-active,
.layout-navbars-tagsview-ul-li-iconfont,
.layout-navbars-tagsview-ul-li-refresh {
display: none;
}
.layout-icon-three {
display: block;
}
&:hover {
@extend .tags-style-five-svg;
background: var(--el-color-primary-light-9);
color: unset;
}
}
.is-active {
@extend .tags-style-five-svg;
background: var(--el-color-primary-light-9) !important;
color: var(--el-color-primary) !important;
z-index: 1;
}
}
}

View File

@ -5,23 +5,25 @@
<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>
{{ $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>
<template v-else>
<el-menu-item :index="val.path" :key="val.path">
<template #title v-if="!val.meta.isLink || (val.meta.isLink && val.meta.isIframe)">
<SvgIcon :name="val.meta.icon" />
{{ $t(val.meta.title) }}
</a>
</template>
</el-menu-item>
</template>
<template #title v-else>
<a :href="val.meta.isLink" target="_blank" rel="opener" class="w100">
<SvgIcon :name="val.meta.icon" />
{{ $t(val.meta.title) }}
</a>
</template>
</el-menu-item>
</template>
</template>
</el-menu>
</el-scrollbar>
@ -43,7 +45,7 @@ export default defineComponent({
},
},
setup(props) {
const { proxy } = getCurrentInstance() as any;
const { proxy } = <any>getCurrentInstance();
const route = useRoute();
const store = useStore();
const state = reactive({
@ -51,19 +53,19 @@ export default defineComponent({
});
// 获取父级菜单数据
const menuLists = computed(() => {
return props.menuList;
return <any>props.menuList;
});
// 设置横向滚动条可以鼠标滚轮滚动
const onElMenuHorizontalScroll = (e: any) => {
const eventDelta = e.wheelDelta || -e.deltaY * 40;
proxy.$refs.elMenuHorizontalScrollRef.$refs.wrap.scrollLeft = proxy.$refs.elMenuHorizontalScrollRef.$refs.wrap.scrollLeft + eventDelta / 4;
proxy.$refs.elMenuHorizontalScrollRef.$refs.wrap$.scrollLeft = proxy.$refs.elMenuHorizontalScrollRef.$refs.wrap$.scrollLeft + eventDelta / 4;
};
// 初始化数据,页面刷新时,滚动条滚动到对应位置
const initElMenuOffsetLeft = () => {
nextTick(() => {
let els: any = document.querySelector('.el-menu.el-menu--horizontal li.is-active');
if (!els) return false;
proxy.$refs.elMenuHorizontalScrollRef.$refs.wrap.scrollLeft = els.offsetLeft;
proxy.$refs.elMenuHorizontalScrollRef.$refs.wrap$.scrollLeft = els.offsetLeft;
});
};
// 路由过滤递归函数
@ -91,10 +93,10 @@ export default defineComponent({
return currentData;
};
// 设置页面当前路由高亮
const setCurrentRouterHighlight = (currentRoute) => {
const setCurrentRouterHighlight = (currentRoute: any) => {
const { path, meta } = currentRoute;
if (store.state.themeConfig.themeConfig.layout === 'classic') {
state.defaultActive = `/${path.split('/')[1]}`;
(<any>state.defaultActive) = `/${path.split('/')[1]}`;
} else {
const pathSplit = meta.isDynamic ? meta.isDynamicPath.split('/') : path.split('/');
if (pathSplit.length >= 4 && meta.isHide) state.defaultActive = pathSplit.splice(0, 3).join('/');
@ -113,7 +115,6 @@ export default defineComponent({
onBeforeRouteUpdate((to) => {
// 修复https://gitee.com/lyt-top/vue-next-admin/issues/I3YX6G
setCurrentRouterHighlight(to);
proxy.mittBus.emit('onMenuClick');
// 修复经典布局开启切割菜单时点击tagsView后左侧导航菜单数据不变的问题
let { layout, isClassicSplitMenu } = store.state.themeConfig.themeConfig;
if (layout === 'classic' && isClassicSplitMenu) {

View File

@ -2,23 +2,25 @@
<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>
<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>
{{ $t(val.meta.title) }}
</a>
</template>
</el-menu-item>
<template v-else>
<el-menu-item :index="val.path" :key="val.path">
<template v-if="!val.meta.isLink || (val.meta.isLink && val.meta.isIframe)">
<SvgIcon :name="val.meta.icon" />
<span>{{ $t(val.meta.title) }}</span>
</template>
<template v-else>
<a :href="val.meta.isLink" target="_blank" rel="opener" class="w100">
<SvgIcon :name="val.meta.icon" />
{{ $t(val.meta.title) }}
</a>
</template>
</el-menu-item>
</template>
</template>
</template>
@ -35,7 +37,7 @@ export default defineComponent({
setup(props) {
// 获取父级菜单数据
const chils = computed(() => {
return props.chil;
return <any>props.chil;
});
return {
chils,

View File

@ -10,26 +10,28 @@
<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>
<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
>
</el-menu-item>
<template v-else>
<el-menu-item :index="val.path" :key="val.path">
<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" class="w100">{{ $t(val.meta.title) }}</a>
</template>
</el-menu-item>
</template>
</template>
</el-menu>
</template>
<script lang="ts">
import { toRefs, reactive, computed, defineComponent, getCurrentInstance, onMounted, watch } from 'vue';
import { toRefs, reactive, computed, defineComponent, onMounted, watch } from 'vue';
import { useRoute, onBeforeRouteUpdate } from 'vue-router';
import { useStore } from '/@/store/index';
import SubItem from '/@/layout/navMenu/subItem.vue';
@ -43,7 +45,6 @@ export default defineComponent({
},
},
setup(props) {
const { proxy } = getCurrentInstance() as any;
const store = useStore();
const route = useRoute();
const state = reactive({
@ -53,14 +54,14 @@ export default defineComponent({
});
// 获取父级菜单数据
const menuLists = computed(() => {
return props.menuList;
return <any>props.menuList;
});
// 获取布局配置信息
const getThemeConfig = computed(() => {
return store.state.themeConfig.themeConfig;
});
// 菜单高亮(详情时,父级高亮)
const setParentHighlight = (currentRoute) => {
const setParentHighlight = (currentRoute: any) => {
const { path, meta } = currentRoute;
const pathSplit = meta.isDynamic ? meta.isDynamicPath.split('/') : path.split('/');
if (pathSplit.length >= 4 && meta.isHide) return pathSplit.splice(0, 3).join('/');
@ -84,7 +85,6 @@ export default defineComponent({
onBeforeRouteUpdate((to) => {
// 修复https://gitee.com/lyt-top/vue-next-admin/issues/I3YX6G
state.defaultActive = setParentHighlight(to);
proxy.mittBus.emit('onMenuClick');
const clientWidth = document.body.clientWidth;
if (clientWidth < 1000) getThemeConfig.value.isCollapse = false;
});

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>
@ -19,7 +19,7 @@ export default defineComponent({
});
// 初始化页面加载 loading
const initIframeLoad = () => {
state.iframeUrl = route.meta.isLink;
state.iframeUrl = <any>route.meta.isLink;
nextTick(() => {
state.iframeLoading = true;
const iframe = document.getElementById('iframe');
@ -34,10 +34,10 @@ export default defineComponent({
let { isTagsview } = store.state.themeConfig.themeConfig;
let { isTagsViewCurrenFull } = store.state.tagsViewRoutes;
if (isTagsViewCurrenFull) {
return `0px`;
return `1px`;
} else {
if (isTagsview) return `84px`;
else return `50px`;
if (isTagsview) return `85px`;
else return `51px`;
}
});
// 页面加载时

View File

@ -1,22 +1,38 @@
<template>
<div class="layout-view-bg-white flex layout-view-link" :style="{ height: `calc(100vh - ${setLinkHeight}` }">
<a :href="currentRouteMeta.isLink" target="_blank" rel="opener" class="flex-margin"
>{{ $t(currentRouteMeta.title) }}{{ currentRouteMeta.isLink }}</a
>
<a :href="currentRouteMeta.isLink" target="_blank" rel="opener" class="flex-margin">
{{ $t(currentRouteMeta.title) }}{{ currentRouteMeta.isLink }}
</a>
</div>
</template>
<script lang="ts">
import { defineComponent, toRefs, reactive, computed, watch } from 'vue';
import { useRoute } from 'vue-router';
import { useRoute, RouteMeta } from 'vue-router';
import { useStore } from '/@/store/index';
// 定义接口来定义对象的类型
interface LinkViewState {
currentRouteMeta: {
isLink: string;
title: string;
};
}
interface LinkViewRouteMeta extends RouteMeta {
isLink: string;
title: string;
}
export default defineComponent({
name: 'layoutLinkView',
setup() {
const route = useRoute();
const store = useStore();
const state = reactive({
currentRouteMeta: {},
const state = reactive<LinkViewState>({
currentRouteMeta: {
isLink: '',
title: '',
},
});
// 设置 link 的高度
const setLinkHeight = computed(() => {
@ -28,7 +44,7 @@ export default defineComponent({
watch(
() => route.path,
() => {
state.currentRouteMeta = route.meta;
state.currentRouteMeta = <LinkViewRouteMeta>route.meta;
},
{
immediate: true,

View File

@ -3,7 +3,7 @@
<router-view v-slot="{ Component }">
<transition :name="setTransitionName" mode="out-in">
<keep-alive :include="keepAliveNameList">
<component :is="Component" :key="refreshRouterViewKey" class="w100" />
<component :is="Component" :key="refreshRouterViewKey" class="w100" :style="{ minHeight }" />
</keep-alive>
</transition>
</router-view>
@ -14,16 +14,28 @@
import { computed, defineComponent, toRefs, reactive, getCurrentInstance, onBeforeMount, onUnmounted, nextTick, watch } from 'vue';
import { useRoute } from 'vue-router';
import { useStore } from '/@/store/index';
// 定义接口来定义对象的类型
interface ParentViewState {
refreshRouterViewKey: null | string;
keepAliveNameList: string[];
}
export default defineComponent({
name: 'layoutParentView',
props: {
minHeight: {
type: String,
default: '',
},
},
setup() {
const { proxy } = getCurrentInstance() as any;
const { proxy } = <any>getCurrentInstance();
const route = useRoute();
const store = useStore();
const state: any = reactive({
const state = reactive<ParentViewState>({
refreshRouterViewKey: null,
keepAliveNameList: [],
keepAliveNameNewList: [],
});
// 设置主界面切换动画
const setTransitionName = computed(() => {

View File

@ -4,25 +4,19 @@ 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';
import '/@/theme/index.scss';
import mitt from 'mitt';
import screenShort from 'vue-web-screen-shot';
import VueGridLayout from 'vue-grid-layout';
const app = createApp(App);
app
.use(router)
.use(store, key)
.use(ElementPlus, { i18n: i18n.global.t, size: globalComponentSize })
.use(i18n)
.use(screenShort, { enableWebRtc: false })
.use(VueGridLayout)
.mount('#app');
app.config.globalProperties.mittBus = mitt();
directive(app);
other.elSvg(app);
app.use(router).use(store, key).use(ElementPlus, { i18n: i18n.global.t }).use(i18n).use(VueGridLayout).mount('#app');
app.config.globalProperties.mittBus = mitt();

File diff suppressed because one or more lines are too long

View File

@ -3,7 +3,9 @@ import { Session } from '/@/utils/storage';
import { NextLoading } from '/@/utils/loading';
import { setAddRoute, setFilterMenuAndCacheTagsViewRoutes } from '/@/router/index';
import { dynamicRoutes } from '/@/router/route';
import { getMenuAdmin, getMenuTest } from '/@/api/menu/index';
import { useMenuApi } from '/@/api/menu/index';
const menuApi = useMenuApi();
const layouModules: any = import.meta.glob('../layout/routerView/*.{vue,tsx}');
const viewsModules: any = import.meta.glob('../views/**/*.{vue,tsx}');
@ -48,11 +50,11 @@ 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();
if (auth === 'admin') return menuApi.getMenuAdmin();
// 其它用户 test
else return getMenuTest();
else return menuApi.getMenuTest();
}
/**

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 });
});
});
}
@ -163,8 +163,8 @@ export function setFilterRouteEnd() {
* @description 此处循环为 dynamicRoutes/@/router/route第一个顶级 children 的路由一维数组,非多级嵌套
* @link 参考https://next.router.vuejs.org/zh/api/#addroute
*/
export function setAddRoute() {
setFilterRouteEnd().forEach((route: RouteRecordRaw) => {
export async function setAddRoute() {
await setFilterRouteEnd().forEach((route: RouteRecordRaw) => {
const routeName: any = route.name;
if (!router.hasRoute(routeName)) router.addRoute(route);
});
@ -176,8 +176,8 @@ export function setAddRoute() {
* @description 此处循环为 dynamicRoutes/@/router/route第一个顶级 children 的路由一维数组,非多级嵌套
* @link 参考https://next.router.vuejs.org/zh/api/#push
*/
export function resetRoute() {
setFilterRouteEnd().forEach((route: RouteRecordRaw) => {
export async function resetRoute() {
await setFilterRouteEnd().forEach((route: RouteRecordRaw) => {
const routeName: any = route.name;
router.hasRoute(routeName) && router.removeRoute(routeName);
});

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: 'ele-ColdDrink',
},
},
{
path: '/system/user',
name: 'systemUser',
@ -87,10 +102,40 @@ 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: 'ele-OfficeBuilding',
},
},
{
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: 'ele-SetUp',
},
},
],
},
{
@ -105,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: [
@ -121,7 +166,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: '',
},
children: [
{
@ -135,7 +181,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: '',
},
},
{
@ -149,7 +196,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: '',
},
},
],
@ -165,7 +213,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: '',
},
children: [
{
@ -179,7 +228,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: '',
},
},
],
@ -198,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: [
@ -214,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: [
@ -229,7 +279,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-caidan',
},
},
@ -245,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: [
@ -260,7 +310,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-caidan',
},
},
@ -275,7 +325,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-caidan',
},
},
@ -292,7 +342,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-caidan',
},
},
@ -309,7 +359,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-caidan',
},
},
@ -327,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: [
@ -342,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: 'ele-Pointer',
},
},
{
@ -357,53 +407,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'el-icon-odometer',
},
},
{
path: '/fun/echartsTree',
name: 'funEchartsTree',
component: () => import('/@/views/fun/tree/index.vue'),
meta: {
title: 'message.router.funEchartsTree',
isLink: '',
isHide: false,
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'el-icon-connection',
},
},
{
path: '/fun/selector',
name: 'funSelector',
component: () => import('/@/views/fun/selector/index.vue'),
meta: {
title: 'message.router.funSelector',
isLink: '',
isHide: false,
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'iconfont icon-xuanzeqi',
},
},
{
path: '/fun/noticeBar',
name: 'funNoticeBar',
component: () => import('/@/views/fun/noticeBar/index.vue'),
meta: {
title: 'message.router.funNoticeBar',
isLink: '',
isHide: false,
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'el-icon-bell',
roles: ['admin', 'common'],
icon: 'ele-Odometer',
},
},
{
@ -417,7 +422,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-fuwenbenkuang',
},
},
@ -432,7 +437,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-caijian',
},
},
@ -447,7 +452,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-ico',
},
},
@ -462,7 +467,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-ditu',
},
},
@ -477,8 +482,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'el-icon-printer',
roles: ['admin', 'common'],
icon: 'ele-Printer',
},
},
{
@ -492,23 +497,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'el-icon-document-copy',
},
},
{
path: '/fun/screenShort',
name: 'funScreenShort',
component: () => import('/@/views/fun/screenShort/index.vue'),
meta: {
title: 'message.router.funScreenShort',
isLink: '',
isHide: false,
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'el-icon-crop',
roles: ['admin', 'common'],
icon: 'ele-DocumentCopy',
},
},
{
@ -522,7 +512,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-tuodong',
},
},
@ -537,25 +527,10 @@ 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,
auth: ['admin', 'test'],
icon: 'el-icon-s-promotion',
},
},
],
},
{
@ -570,7 +545,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-fuzhiyemian',
},
children: [
@ -585,8 +560,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'el-icon-sell',
roles: ['admin', 'common'],
icon: 'ele-Sell',
},
/**
* 注意此处详情写法:
@ -606,8 +581,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: false,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'el-icon-s-order',
roles: ['admin', 'common'],
icon: 'ele-Sunny',
},
},
],
@ -623,8 +598,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: false,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'el-icon-s-order',
roles: ['admin', 'common'],
icon: 'ele-Sunny',
},
},
{
@ -638,8 +613,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'el-icon-present',
roles: ['admin', 'common'],
icon: 'ele-Present',
},
},
{
@ -653,8 +628,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'el-icon-platform-eleme',
roles: ['admin', 'common'],
icon: 'ele-Eleme',
},
},
{
@ -668,23 +643,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'el-icon-set-up',
},
},
{
path: '/pages/cityLinkage',
name: 'pagesCityLinkage',
component: () => import('/@/views/pages/cityLinkage/index.vue'),
meta: {
title: 'message.router.pagesCityLinkage',
isLink: '',
isHide: false,
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'iconfont icon-jiliandongxuanzeqi',
roles: ['admin', 'common'],
icon: 'ele-SetUp',
},
},
{
@ -698,10 +658,25 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-biaodan',
},
},
{
path: '/pages/tableRules',
name: 'pagesTableRules',
component: () => import('/@/views/pages/tableRules/index.vue'),
meta: {
title: 'message.router.pagesTableRules',
isLink: '',
isHide: false,
isKeepAlive: true,
isAffix: false,
isIframe: false,
roles: ['admin', 'common'],
icon: 'iconfont icon-jiliandongxuanzeqi',
},
},
{
path: '/pages/formI18n',
name: 'pagesFormI18n',
@ -713,7 +688,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-diqiu',
},
},
@ -728,7 +703,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-shuxing',
},
},
@ -743,7 +718,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-chazhaobiaodanliebiao',
},
},
@ -758,7 +733,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-zidingyibuju',
},
},
@ -773,7 +748,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-step',
},
},
@ -788,7 +763,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-15tupianyulan',
},
},
@ -803,7 +778,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-bolangneng',
},
},
@ -818,7 +793,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-shuxingtu',
},
},
@ -833,8 +808,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
icon: 'el-icon-thumb',
roles: ['admin', 'common'],
icon: 'ele-Pointer',
},
},
{
@ -848,8 +823,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin'],
icon: 'el-icon-picture-outline',
roles: ['admin'],
icon: 'ele-PictureFilled',
},
},
{
@ -863,7 +838,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin'],
roles: ['admin'],
icon: 'iconfont icon-diannao',
},
},
@ -878,8 +853,71 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin'],
icon: 'el-icon-connection',
roles: ['admin'],
icon: 'ele-Connection',
},
},
],
},
{
path: '/make',
name: 'makeIndex',
component: () => import('/@/layout/routerView/parent.vue'),
redirect: '/make/selector',
meta: {
title: 'message.router.makeIndex',
isLink: '',
isHide: false,
isKeepAlive: true,
isAffix: false,
isIframe: false,
roles: ['admin'],
icon: 'iconfont icon-siweidaotu',
},
children: [
{
path: '/make/selector',
name: 'makeSelector',
component: () => import('/@/views/make/selector/index.vue'),
meta: {
title: 'message.router.makeSelector',
isLink: '',
isHide: false,
isKeepAlive: true,
isAffix: false,
isIframe: false,
roles: ['admin', 'common'],
icon: 'iconfont icon-xuanzeqi',
},
},
{
path: '/make/noticeBar',
name: 'makeNoticeBar',
component: () => import('/@/views/make/noticeBar/index.vue'),
meta: {
title: 'message.router.makeNoticeBar',
isLink: '',
isHide: false,
isKeepAlive: true,
isAffix: false,
isIframe: false,
roles: ['admin', 'common'],
icon: 'ele-Bell',
},
},
{
path: '/make/svgDemo',
name: 'makeSvgDemo',
component: () => import('/@/views/make/svgDemo/index.vue'),
meta: {
title: 'message.router.makeSvgDemo',
isLink: '',
isHide: false,
isKeepAlive: true,
isAffix: false,
isIframe: false,
roles: ['admin', 'common'],
icon: 'fa fa-thumbs-o-up',
},
},
],
@ -896,7 +934,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin'],
roles: ['admin'],
icon: 'iconfont icon-zhongduancanshu',
},
children: [
@ -911,7 +949,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin'],
roles: ['admin'],
icon: 'iconfont icon-putong',
},
},
@ -926,8 +964,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin'],
icon: 'el-icon-s-order',
roles: ['admin'],
icon: 'ele-Comment',
},
},
{
@ -941,7 +979,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin'],
roles: ['admin'],
icon: 'iconfont icon-dongtai',
},
},
@ -956,8 +994,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin'],
icon: 'el-icon-s-order',
roles: ['admin'],
icon: 'ele-Lightning',
},
},
],
@ -974,8 +1012,8 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin'],
icon: 'el-icon-data-line',
roles: ['admin'],
icon: 'ele-ChatLineRound',
},
children: [
{
@ -989,7 +1027,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: false,
isAffix: false,
isIframe: false,
auth: ['admin'],
roles: ['admin'],
icon: 'iconfont icon-caozuo-wailian',
},
},
@ -1004,7 +1042,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: false,
isAffix: false,
isIframe: false,
auth: ['admin'],
roles: ['admin'],
icon: 'iconfont icon-caozuo-wailian',
},
},
@ -1021,7 +1059,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-ico_shuju',
},
},
@ -1036,7 +1074,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-gerenzhongxin',
},
},
@ -1051,7 +1089,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test'],
roles: ['admin', 'common'],
icon: 'iconfont icon-gongju',
},
},
@ -1066,7 +1104,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
isKeepAlive: false,
isAffix: false,
isIframe: false,
auth: ['admin'],
roles: ['admin'],
icon: 'iconfont icon-caozuo-wailian',
},
},
@ -1076,12 +1114,12 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
component: () => import('/@/layout/routerView/iframes.vue'),
meta: {
title: 'message.router.layoutIfameView',
isLink: 'https://wdd.js.org/jsplumb-chinese-tutorial/#/',
isLink: 'https://nodejs.org/zh-cn/',
isHide: false,
isKeepAlive: false,
isAffix: true,
isIframe: true,
auth: ['admin'],
roles: ['admin'],
icon: 'iconfont icon-neiqianshujuchucun',
},
},

View File

@ -5,20 +5,15 @@ export interface ThemeConfigState {
themeConfig: {
isDrawer: boolean;
primary: string;
success: string;
info: string;
warning: string;
danger: string;
topBar: string;
menuBar: string;
columnsMenuBar: string;
topBarColor: string;
menuBarColor: string;
columnsMenuBarColor: string;
isTopBarColorGradual: boolean;
menuBar: string;
menuBarColor: string;
isMenuBarColorGradual: boolean;
columnsMenuBar: string;
columnsMenuBarColor: string;
isColumnsMenuBarColorGradual: boolean;
isMenuBarColorHighlight: boolean;
isCollapse: boolean;
isUniqueOpened: boolean;
isFixedHeader: boolean;
@ -56,30 +51,36 @@ export interface ThemeConfigState {
// 路由列表
export interface RoutesListState {
routesList: Array<object>;
routesList: object[];
isColumnsMenuHover: Boolean;
isColumnsNavHover: Boolean;
}
// 路由缓存列表
export interface KeepAliveNamesState {
keepAliveNames: Array<string>;
keepAliveNames: string[];
}
// TagsView 路由列表
export interface TagsViewRoutesState {
tagsViewRoutes: Array<object>;
tagsViewRoutes: object[];
isTagsViewCurrenFull: Boolean;
}
// 用户信息
export interface UserInfosState {
userInfos: object;
userInfos: {
authBtnList: string[];
photo: string;
roles: string[];
time: number;
userName: string;
};
}
// 后端返回原始路由(未处理时)
export interface RequestOldRoutesState {
requestOldRoutes: Array<object>;
requestOldRoutes: object[];
}
// 主接口(顶级类型声明)

View File

@ -1,5 +1,4 @@
import { Module } from 'vuex';
// 此处加上 `.ts` 后缀报错,具体原因不详
import { KeepAliveNamesState, RootStateTypes } from '/@/store/interface/index';
const keepAliveNamesModule: Module<KeepAliveNamesState, RootStateTypes> = {

View File

@ -1,5 +1,4 @@
import { Module } from 'vuex';
// 此处加上 `.ts` 后缀报错,具体原因不详
import { RequestOldRoutesState, RootStateTypes } from '/@/store/interface/index';
const requestOldRoutesModule: Module<RequestOldRoutesState, RootStateTypes> = {

View File

@ -1,5 +1,4 @@
import { Module } from 'vuex';
// 此处加上 `.ts` 后缀报错,具体原因不详
import { RoutesListState, RootStateTypes } from '/@/store/interface/index';
const routesListModule: Module<RoutesListState, RootStateTypes> = {

View File

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

View File

@ -1,5 +1,4 @@
import { Module } from 'vuex';
// 此处加上 `.ts` 后缀报错,具体原因不详
import { ThemeConfigState, RootStateTypes } from '/@/store/interface/index';
/**
@ -17,16 +16,8 @@ const themeConfigModule: Module<ThemeConfigState, RootStateTypes> = {
/**
* 全局主题
*/
// 默认 primary 颜色,请注意:需要同时修改 `/@/theme/common/var.scss` 对应的值
// 默认 primary 主题颜色
primary: '#409eff',
// 默认 success 颜色,请注意:需要同时修改 `/@/theme/common/var.scss` 对应的值
success: '#67c23a',
// 默认 info 颜色,请注意:需要同时修改 `/@/theme/common/var.scss` 对应的值
info: '#909399',
// 默认 warning 颜色,请注意:需要同时修改 `/@/theme/common/var.scss` 对应的值
warning: '#e6a23c',
// 默认 danger 颜色,请注意:需要同时修改 `/@/theme/common/var.scss` 对应的值
danger: '#f56c6c',
/**
* 菜单 / 顶栏
@ -34,26 +25,24 @@ const themeConfigModule: Module<ThemeConfigState, RootStateTypes> = {
* 切换布局需手动设置样式,设置的样式自动同步各布局,
* 代码位置:/@/layout/navBars/breadcrumb/setings.vue
*/
// 默认顶栏导航背景颜色,请注意:需要同时修改 `/@/theme/common/var.scss` 对应的值
// 默认顶栏导航背景颜色
topBar: '#ffffff',
// 默认菜单导航背景颜色,请注意:需要同时修改 `/@/theme/common/var.scss` 对应的值
menuBar: '#545c64',
// 默认分栏菜单背景颜色,请注意:需要同时修改 `/@/theme/common/var.scss` 对应的值
columnsMenuBar: '#545c64',
// 默认顶栏导航字体颜色,请注意:需要同时修改 `/@/theme/common/var.scss` 对应的值
// 默认顶栏导航字体颜色
topBarColor: '#606266',
// 默认菜单导航字体颜色,请注意:需要同时修改 `/@/theme/common/var.scss` 对应的值
menuBarColor: '#eaeaea',
// 默认分栏菜单字体颜色,请注意:需要同时修改 `/@/theme/common/var.scss` 对应的值
columnsMenuBarColor: '#e6e6e6',
// 是否开启顶栏背景颜色渐变
isTopBarColorGradual: false,
// 默认菜单导航背景颜色
menuBar: '#545c64',
// 默认菜单导航字体颜色
menuBarColor: '#eaeaea',
// 是否开启菜单背景颜色渐变
isMenuBarColorGradual: false,
// 默认分栏菜单背景颜色
columnsMenuBar: '#545c64',
// 默认分栏菜单字体颜色
columnsMenuBarColor: '#e6e6e6',
// 是否开启分栏菜单背景颜色渐变
isColumnsMenuBarColorGradual: false,
// 是否开启菜单字体背景高亮
isMenuBarColorHighlight: false,
/**
* 界面设置
@ -110,9 +99,9 @@ const themeConfigModule: Module<ThemeConfigState, RootStateTypes> = {
/**
* 其它设置
*/
// Tagsview 风格:可选值"<tags-style-one|tags-style-two|tags-style-three|tags-style-four>",默认 tags-style-one
// Tagsview 风格:可选值"<tags-style-one|tags-style-four|tags-style-five>",默认 tags-style-five
// 定义的值与 `/src/layout/navBars/tagsView/tagsView.vue` 中的 class 同名
tagsStyle: 'tags-style-one',
tagsStyle: 'tags-style-five',
// 主页面切换动画:可选值"<slide-right|slide-left|opacitys>",默认 slide-right
animation: 'slide-right',
// 分栏高亮风格:可选值"<columns-round|columns-card>",默认 columns-round
@ -140,11 +129,11 @@ const themeConfigModule: Module<ThemeConfigState, RootStateTypes> = {
// 网站主标题(菜单导航、浏览器当前网页标题)
globalTitle: 'vue-next-admin',
// 网站副标题(登录页顶部文字)
globalViceTitle: 'SMALL@小柒',
globalViceTitle: 'vueNextAdmin',
// 默认初始语言,可选值"<zh-cn|en|zh-tw>",默认 zh-cn
globalI18n: 'zh-cn',
// 默认全局组件大小,可选值"<|medium|small|mini>",默认 ''
globalComponentSize: '',
// 默认全局组件大小,可选值"<large|'default'|small>",默认 'large'
globalComponentSize: 'large',
},
},
mutations: {

View File

@ -1,22 +1,27 @@
import { Module } from 'vuex';
import { Session } from '/@/utils/storage';
// 此处加上 `.ts` 后缀报错,具体原因不详
import { UserInfosState, RootStateTypes } from '/@/store/interface/index';
const userInfosModule: Module<UserInfosState, RootStateTypes> = {
namespaced: true,
state: {
userInfos: {},
userInfos: {
authBtnList: [],
photo: '',
roles: [],
time: 0,
userName: '',
},
},
mutations: {
// 设置用户信息
getUserInfos(state: any, data: object) {
getUserInfos(state, data: any) {
state.userInfos = data;
},
},
actions: {
// 设置用户信息
async setUserInfos({ commit }, data: object) {
async setUserInfos({ commit }, data: UserInfosState) {
if (data) {
commit('getUserInfos', data);
} else {

View File

@ -7,6 +7,19 @@
outline: none !important;
}
:root {
--next-bg-main-color: #f8f8f8;
--next-bg-color: #f5f5ff;
--next-border-color-light: #f1f2f3;
--next-color-primary-lighter: #ecf5ff;
--next-color-dark-hover: #0000001a;
--next-color-menu-hover: rgba(0, 0, 0, 0.1);
--next-color-user-hover: rgba(0, 0, 0, 0.04);
--next-color-seting-main: #e9eef3;
--next-color-seting-aside: #d3dce6;
--next-color-seting-header: #b3c0d1;
}
html,
body,
#app {
@ -18,7 +31,7 @@ body,
font-weight: 400;
-webkit-font-smoothing: antialiased;
-webkit-tap-highlight-color: transparent;
background-color: #f8f8f8;
background-color: var(--next-bg-main-color);
font-size: 14px;
overflow: hidden;
position: relative;
@ -30,7 +43,7 @@ body,
width: 100%;
height: 100%;
.layout-aside {
background: var(--bg-menuBar);
background: var(--next-bg-menuBar);
box-shadow: 2px 0 6px rgb(0 21 41 / 1%);
height: inherit;
position: relative;
@ -49,7 +62,7 @@ body,
padding: 0 !important;
overflow: hidden;
width: 100%;
background-color: #f8f8f8;
background-color: var(--next-bg-main-color);
}
.el-scrollbar {
width: 100%;
@ -63,7 +76,7 @@ body,
border: 1px solid var(--el-border-color-light, #ebeef5);
}
.layout-el-aside-br-color {
border-right: 1px solid rgb(238, 238, 238);
border-right: 1px solid var(--el-border-color-light, #ebeef5);
}
// pc端左侧导航样式
.layout-aside-pc-220 {
@ -88,11 +101,11 @@ body,
}
.layout-aside-mobile-close {
left: -220px;
transition: all 0.3s cubic-bezier(1, -0.04, 0, 1.32);
transition: all 0.3s cubic-bezier(0.39, 0.58, 0.57, 1);
}
.layout-aside-mobile-open {
left: 0;
transition: all 0.3s cubic-bezier(0.53, -0.26, 0.42, 1.18);
transition: all 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.layout-aside-mobile-mode {
position: fixed;
@ -103,6 +116,7 @@ body,
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 9999998;
animation: error-img 0.3s;
}
.layout-scrollbar {
@extend .el-scrollbar;
@ -133,7 +147,7 @@ body,
------------------------------- */
#nprogress {
.bar {
background: var(--color-primary) !important;
background: var(--el-color-primary) !important;
z-index: 9999999 !important;
}
}
@ -145,6 +159,7 @@ body,
}
.flex-auto {
flex: 1;
overflow: hidden;
}
.flex-center {
@extend .flex;
@ -169,6 +184,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 {
@ -190,19 +224,19 @@ body,
/* 颜色值
------------------------------- */
.color-primary {
color: var(--color-primary);
color: var(--el-color-primary);
}
.color-success {
color: var(--color-success);
color: var(--el-color-success);
}
.color-warning {
color: var(--color-warning);
color: var(--el-color-warning);
}
.color-danger {
color: var(--color-danger);
color: var(--el-color-danger);
}
.color-info {
color: var(--color-info);
color: var(--el-color-info);
}
/* 字体大小全局样式

View File

@ -1,2 +0,0 @@
@import 'common/transition.scss';
@import 'common/var.scss';

View File

@ -38,7 +38,7 @@
------------------------------- */
.breadcrumb-enter-active,
.breadcrumb-leave-active {
transition: all 0.3s;
transition: all 0.5s ease;
}
.breadcrumb-enter-from,
.breadcrumb-leave-active {
@ -47,6 +47,7 @@
}
.breadcrumb-leave-active {
position: absolute;
z-index: -1;
}
/* logo 过渡动画
@ -83,3 +84,11 @@
opacity: 1;
}
}
@keyframes error-img-two {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}

View File

@ -1,127 +0,0 @@
/**
* scss 怎么动态创建变量
* 本来想用 @function@for 好像不可以动态创建
* 2020.12.19 lyt 记录
**/
/* 定义初始颜色
------------------------------- */
$--color-primary: #409eff !default;
$--color-whites: #ffffff !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;
$--color-primary-light-4: mix($--color-whites, $--color-primary, 40%) !default;
$--color-primary-light-5: mix($--color-whites, $--color-primary, 50%) !default;
$--color-primary-light-6: mix($--color-whites, $--color-primary, 60%) !default;
$--color-primary-light-7: mix($--color-whites, $--color-primary, 70%) !default;
$--color-primary-light-8: mix($--color-whites, $--color-primary, 80%) !default;
$--color-primary-light-9: mix($--color-whites, $--color-primary, 90%) !default;
$--color-success: #67c23a !default;
$--color-success-light-1: mix($--color-whites, $--color-success, 10%) !default;
$--color-success-light-2: mix($--color-whites, $--color-success, 20%) !default;
$--color-success-light-3: mix($--color-whites, $--color-success, 30%) !default;
$--color-success-light-4: mix($--color-whites, $--color-success, 40%) !default;
$--color-success-light-5: mix($--color-whites, $--color-success, 50%) !default;
$--color-success-light-6: mix($--color-whites, $--color-success, 60%) !default;
$--color-success-light-7: mix($--color-whites, $--color-success, 70%) !default;
$--color-success-light-8: mix($--color-whites, $--color-success, 80%) !default;
$--color-success-light-9: mix($--color-whites, $--color-success, 90%) !default;
$--color-info: #909399 !default;
$--color-info-light-1: mix($--color-whites, $--color-info, 10%) !default;
$--color-info-light-2: mix($--color-whites, $--color-info, 20%) !default;
$--color-info-light-3: mix($--color-whites, $--color-info, 30%) !default;
$--color-info-light-4: mix($--color-whites, $--color-info, 40%) !default;
$--color-info-light-5: mix($--color-whites, $--color-info, 50%) !default;
$--color-info-light-6: mix($--color-whites, $--color-info, 60%) !default;
$--color-info-light-7: mix($--color-whites, $--color-info, 70%) !default;
$--color-info-light-8: mix($--color-whites, $--color-info, 80%) !default;
$--color-info-light-9: mix($--color-whites, $--color-info, 90%) !default;
$--color-warning: #e6a23c !default;
$--color-warning-light-1: mix($--color-whites, $--color-warning, 10%) !default;
$--color-warning-light-2: mix($--color-whites, $--color-warning, 20%) !default;
$--color-warning-light-3: mix($--color-whites, $--color-warning, 30%) !default;
$--color-warning-light-4: mix($--color-whites, $--color-warning, 40%) !default;
$--color-warning-light-5: mix($--color-whites, $--color-warning, 50%) !default;
$--color-warning-light-6: mix($--color-whites, $--color-warning, 60%) !default;
$--color-warning-light-7: mix($--color-whites, $--color-warning, 70%) !default;
$--color-warning-light-8: mix($--color-whites, $--color-warning, 80%) !default;
$--color-warning-light-9: mix($--color-whites, $--color-warning, 90%) !default;
$--color-danger: #f56c6c !default;
$--color-danger-light-1: mix($--color-whites, $--color-danger, 10%) !default;
$--color-danger-light-2: mix($--color-whites, $--color-danger, 20%) !default;
$--color-danger-light-3: mix($--color-whites, $--color-danger, 30%) !default;
$--color-danger-light-4: mix($--color-whites, $--color-danger, 40%) !default;
$--color-danger-light-5: mix($--color-whites, $--color-danger, 50%) !default;
$--color-danger-light-6: mix($--color-whites, $--color-danger, 60%) !default;
$--color-danger-light-7: mix($--color-whites, $--color-danger, 70%) !default;
$--color-danger-light-8: mix($--color-whites, $--color-danger, 80%) !default;
$--color-danger-light-9: mix($--color-whites, $--color-danger, 90%) !default;
$--bg-topBar: #ffffff;
$--bg-menuBar: #545c64;
$--bg-columnsMenuBar: #545c64;
$--bg-topBarColor: #606266;
$--bg-menuBarColor: #eaeaea;
$--bg-columnsMenuBarColor: #e6e6e6;
/* 赋值给:root
------------------------------- */
:root {
--color-primary: #{$--color-primary};
--color-whites: #{$--color-whites};
--color-primary-light-1: #{$--color-primary-light-1};
--color-primary-light-2: #{$--color-primary-light-2};
--color-primary-light-3: #{$--color-primary-light-3};
--color-primary-light-4: #{$--color-primary-light-4};
--color-primary-light-5: #{$--color-primary-light-5};
--color-primary-light-6: #{$--color-primary-light-6};
--color-primary-light-7: #{$--color-primary-light-7};
--color-primary-light-8: #{$--color-primary-light-8};
--color-primary-light-9: #{$--color-primary-light-9};
--color-success: #{$--color-success};
--color-success-light-1: #{$--color-success-light-1};
--color-success-light-2: #{$--color-success-light-2};
--color-success-light-3: #{$--color-success-light-3};
--color-success-light-4: #{$--color-success-light-4};
--color-success-light-5: #{$--color-success-light-5};
--color-success-light-6: #{$--color-success-light-6};
--color-success-light-7: #{$--color-success-light-7};
--color-success-light-8: #{$--color-success-light-8};
--color-success-light-9: #{$--color-success-light-9};
--color-info: #{$--color-info};
--color-info-light-1: #{$--color-info-light-1};
--color-info-light-2: #{$--color-info-light-2};
--color-info-light-3: #{$--color-info-light-3};
--color-info-light-4: #{$--color-info-light-4};
--color-info-light-5: #{$--color-info-light-5};
--color-info-light-6: #{$--color-info-light-6};
--color-info-light-7: #{$--color-info-light-7};
--color-info-light-8: #{$--color-info-light-8};
--color-info-light-9: #{$--color-info-light-9};
--color-warning: #{$--color-warning};
--color-warning-light-1: #{$--color-warning-light-1};
--color-warning-light-2: #{$--color-warning-light-2};
--color-warning-light-3: #{$--color-warning-light-3};
--color-warning-light-4: #{$--color-warning-light-4};
--color-warning-light-5: #{$--color-warning-light-5};
--color-warning-light-6: #{$--color-warning-light-6};
--color-warning-light-7: #{$--color-warning-light-7};
--color-warning-light-8: #{$--color-warning-light-8};
--color-warning-light-9: #{$--color-warning-light-9};
--color-danger: #{$--color-danger};
--color-danger-light-1: #{$--color-danger-light-1};
--color-danger-light-2: #{$--color-danger-light-2};
--color-danger-light-3: #{$--color-danger-light-3};
--color-danger-light-4: #{$--color-danger-light-4};
--color-danger-light-5: #{$--color-danger-light-5};
--color-danger-light-6: #{$--color-danger-light-6};
--color-danger-light-7: #{$--color-danger-light-7};
--color-danger-light-8: #{$--color-danger-light-8};
--color-danger-light-9: #{$--color-danger-light-9};
--bg-topBar: #{$--bg-topBar};
--bg-menuBar: #{$--bg-menuBar};
--bg-columnsMenuBar: #{$--bg-columnsMenuBar};
--bg-topBarColor: #{$--bg-topBarColor};
--bg-menuBarColor: #{$--bg-menuBarColor};
--bg-columnsMenuBarColor: #{$--bg-columnsMenuBarColor};
}

View File

@ -1,48 +1,219 @@
/* 深色模式样式
------------------------------- */
[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;
}
// 变量(自定义时,只需修改这里的值)
--next-bg-main: #1f1f1f;
--next-color-white: #ffffff;
--next-color-disabled: #191919;
--next-color-bar: #dadada;
--next-color-primary: #303030;
--next-border-color: #424242;
--next-border-black: #333333;
--next-border-columns: #2a2a2a;
--next-color-seting: #505050;
--next-text-color-regular: #9b9da1;
--next-text-color-placeholder: #7a7a7a;
--next-color-hover: #3c3c3c;
--next-color-hover-rgba: rgba(0, 0, 0, 0.3);
// root
--next-bg-main-color: var(--next-bg-main) !important;
--next-bg-topBar: var(--next-color-disabled) !important;
--next-bg-topBarColor: var(--next-color-bar) !important;
--next-bg-menuBar: var(--next-color-disabled) !important;
--next-bg-menuBarColor: var(--next-color-bar) !important;
--next-bg-columnsMenuBar: var(--next-color-disabled) !important;
--next-bg-columnsMenuBarColor: var(--next-color-bar) !important;
--next-border-color-light: var(--next-border-black) !important;
--next-color-primary-lighter: var(--next-color-primary) !important;
--next-bg-color: var(--next-color-primary) !important;
--next-color-dark-hover: var(--next-color-hover) !important;
--next-color-menu-hover: var(--next-color-hover-rgba) !important;
--next-color-user-hover: var(--next-color-hover-rgba) !important;
--next-color-seting-main: var(--next-color-seting) !important;
--next-color-seting-aside: var(--next-color-hover) !important;
--next-color-seting-header: var(--next-color-primary) !important;
// element plus
.el-radio-button__original-radio:checked + .el-radio-button__inner,
.el-image-viewer__close,
.el-image-viewer__actions__inner,
.el-image-viewer__next,
.el-image-viewer__prev {
color: #000000 !important;
}
// 数据可视化演示
.visualizing-container-head {
background: linear-gradient(to bottom, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.02)) !important;
.visualizing-container-head-left-text-box {
color: #000000 !important;
--el-color-white: var(--next-color-disabled) !important;
--el-text-color-primary: var(--next-color-bar) !important;
--el-border-color-base: var(--next-border-black) !important;
--el-border-color-light: var(--next-border-black) !important;
--el-text-color-regular: var(--next-text-color-regular) !important;
--el-bg-color: var(--next-color-hover-rgba) !important;
--el-color-success-lighter: var(--next-color-primary) !important;
--el-color-warning-lighter: var(--next-color-primary) !important;
--el-color-danger-lighter: var(--next-color-primary) !important;
--el-color-primary-lighter: var(--next-color-primary) !important;
--el-color-primary-light-9: var(--next-color-hover) !important;
--el-text-color-disabled-base: var(--el-color-primary) !important;
--el-border-color-lighter: var(--next-border-black) !important;
--el-text-color-placeholder: var(--next-text-color-placeholder) !important;
--el-disabled-bg-color: var(--next-color-disabled) !important;
--el-fill-base: var(--next-color-white) !important;
// button
.el-button {
&:hover {
border-color: var(--next-border-color) !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;
.el-button--primary,
.el-button--info,
.el-button--danger,
.el-button--success,
.el-button--warning {
--el-button-text-color: var(--next-color-white) !important;
--el-button-hover-text-color: var(--next-color-white) !important;
--el-button-disabled-text-color: var(--next-color-white) !important;
&:hover {
border-color: var(--el-button-hover-border-color, var(--el-button-hover-bg-color)) !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;
// drawer
.el-divider__text {
background-color: var(--el-color-white) !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;
.el-drawer {
border-left: 1px solid var(--next-border-color-light) !important;
}
.cropper-modal {
background-color: #ffffff;
// tabs
.el-tabs--border-card {
background-color: var(--el-color-white) !important;
}
.el-tabs--border-card > .el-tabs__header .el-tabs__item.is-active {
background: var(--next-color-primary-lighter);
}
// alert / notice-bar
.home-card-item {
border: 1px solid var(--next-border-color-light) !important;
}
.el-alert,
.notice-bar {
border: 1px solid var(--next-border-color) !important;
background-color: var(--next-color-disabled) !important;
}
// menu
.layout-aside {
border-right: 1px solid var(--next-border-color-light) !important;
}
// colorPicker
.el-color-picker__mask {
background: unset !important;
}
.el-color-picker__trigger {
border: 1px solid var(--next-border-color-light) !important;
}
// popper / dropdown
.el-popper {
border: 1px solid var(--next-border-color) !important;
color: var(--el-text-color-primary) !important;
.el-popper__arrow:before {
background: var(--el-color-white) !important;
border: 1px solid var(--next-border-color);
}
a {
color: var(--el-text-color-primary) !important;
}
}
.el-popper,
.el-dropdown-menu {
background: var(--el-color-white) !important;
}
.el-dropdown-menu__item:hover:not(.is-disabled) {
background: var(--el-bg-color) !important;
}
.el-dropdown-menu__item.is-disabled {
font-weight: 700 !important;
}
// input
.el-input-group__append,
.el-input-group__prepend {
border: var(--el-input-border) !important;
border-right: none !important;
background: var(--next-color-disabled) !important;
border-left: 0 !important;
}
.el-input-number__decrease,
.el-input-number__increase {
background: var(--next-color-disabled) !important;
}
// tag
.el-select .el-select__tags .el-tag {
background-color: var(--next-bg-color) !important;
}
// pagination
.el-pagination.is-background .el-pager li:not(.disabled).active {
color: var(--next-color-white) !important;
}
.el-pagination.is-background .btn-next,
.el-pagination.is-background .btn-prev,
.el-pagination.is-background .el-pager li {
background-color: var(--next-bg-color);
}
// radio
.el-radio-button:not(.is-active) .el-radio-button__inner {
border: 1px solid var(--next-border-color-light) !important;
border-left: 0 !important;
}
.el-radio-button.is-active .el-radio-button__inner {
color: var(--next-color-white) !important;
}
// countup
.countup-card-item-flex {
color: var(--el-text-color-primary) !important;
}
// editor
.editor-container {
.w-e-toolbar {
background: var(--el-color-white) !important;
border: 1px solid var(--next-border-color-light) !important;
.w-e-menu:hover {
background: var(--next-color-user-hover) !important;
i {
color: var(--el-text-color-primary) !important;
}
}
}
.w-e-text-container {
border: 1px solid var(--next-border-color-light) !important;
border-top: none !important;
.w-e-text {
background: var(--el-color-white) !important;
}
}
}
// date-picker
.el-picker-panel {
background: var(--el-color-white) !important;
}
// dialog
.el-dialog {
border: 1px solid var(--el-border-color-lighter);
.el-dialog__header {
color: var(--el-text-color-primary) !important;
}
}
// columns
.layout-columns-aside ul .layout-columns-active {
color: var(--next-color-white) !important;
}
.layout-columns-aside {
border-right: 1px solid var(--next-border-columns);
}
// 其它菜单等
--bg-menuBar: #ffffff !important;
--bg-menuBarColor: #303133 !important;
--bg-columnsMenuBar: #ffffff !important;
--bg-columnsMenuBarColor: #303133 !important;
--color-whites: #000000 !important;
}

File diff suppressed because it is too large Load Diff

View File

@ -9,6 +9,19 @@
height: 40px;
line-height: 40px;
padding: 0 15px;
.icon-selector-warp-title-tab {
span {
cursor: pointer;
&:hover {
color: var(--el-color-primary);
text-decoration: underline;
}
}
.span-active {
color: var(--el-color-primary);
text-decoration: underline;
}
}
}
.icon-selector-warp-row {
height: 230px;
@ -34,21 +47,21 @@
}
&:hover {
cursor: pointer;
background-color: var(--color-primary-light-9);
border: 1px solid var(--color-primary-light-6);
background-color: var(--el-color-primary-light-9);
border: 1px solid var(--el-color-primary-light-6);
.icon-selector-warp-item-value {
i {
color: var(--color-primary);
color: var(--el-color-primary);
}
}
}
}
.icon-selector-active {
background-color: var(--color-primary-light-9);
border: 1px solid var(--color-primary-light-6);
background-color: var(--el-color-primary-light-9);
border: 1px solid var(--el-color-primary-light-6);
.icon-selector-warp-item-value {
i {
color: var(--color-primary);
color: var(--el-color-primary);
}
}
}

View File

@ -1,5 +1,5 @@
@import './app.scss';
@import './base.scss';
@import 'common/transition.scss';
@import './other.scss';
@import './element.scss';
@import './iconSelector.scss';

View File

@ -15,7 +15,7 @@
.loading-next .loading-next-box-warp .loading-next-box-item {
width: 33.333333%;
height: 33.333333%;
background: var(--color-primary);
background: var(--el-color-primary);
float: left;
animation: loading-next-animation 1.2s infinite ease;
border-radius: 1px;

25
src/theme/media/date.scss Normal file
View File

@ -0,0 +1,25 @@
@import './index.scss';
/* 页面宽度小于768px
------------------------------- */
@media screen and (max-width: $sm) {
// 时间选择器适配
.el-date-range-picker {
width: 100vw;
.el-picker-panel__body {
min-width: 100%;
.el-date-range-picker__content {
.el-date-range-picker__header div {
margin-left: 22px;
margin-right: 0px;
}
& + .el-date-range-picker__content {
.el-date-range-picker__header div {
margin-left: 0px;
margin-right: 22px;
}
}
}
}
}
}

View File

@ -3,8 +3,21 @@
/* 页面宽度小于768px
------------------------------- */
@media screen and (max-width: $sm) {
.home-warning-media,
.home-dynamic-media {
.home-media,
.home-media-sm {
margin-top: 15px;
}
}
/* 页面宽度小于1200px
------------------------------- */
@media screen and (max-width: $lg) {
.home-media-lg {
margin-top: 15px;
}
.home-monitor {
.flex-warp-item {
width: 33.33% !important;
}
}
}

View File

@ -1,37 +1,15 @@
/* 栅格布局(媒体查询变量)
* $xs <768px 响应式栅格
* https://developer.mozilla.org/zh-CN/docs/Learn/CSS/CSS_layout/Media_queries
* $us ≥376px 响应式栅格
* $xs ≥576px 响应式栅格
* $sm ≥768px 响应式栅格
* $md ≥992px 响应式栅格
* $lg ≥1200px 响应式栅格
* $xl ≥1920px 响应式栅格
------------------------------- */
$us: 376px;
$xs: 576px;
$sm: 768px;
$md: 992px;
$lg: 1200px;
$xl: 1920px;
/* 页面宽度小于576px
------------------------------- */
@media screen and (max-width: $xs) {
}
/* 页面宽度小于768px
------------------------------- */
@media screen and (max-width: $sm) {
}
/* 页面宽度大于768px小于992px
------------------------------- */
@media screen and (min-width: $sm) and (max-width: $md) {
}
/* 页面宽度大于992px小于1200px
------------------------------- */
@media screen and (min-width: $md) and (max-width: $lg) {
}
/* 页面宽度大于1920px
------------------------------- */
@media screen and (min-width: $xl) {
}

View File

@ -1,12 +1,41 @@
@import './index.scss';
/* 页面宽度小于992px
------------------------------- */
@media screen and (max-width: $lg) {
.login-container {
.login-icon-group {
&::before {
content: '';
height: 70% !important;
transition: all 0.3s ease;
}
&::after {
content: '';
width: 100px !important;
height: 200px !important;
transition: all 0.3s ease;
}
}
}
}
/* 页面宽度小于992px
------------------------------- */
@media screen and (max-width: $md) {
.login-content {
right: unset !important;
left: 50% !important;
transform: translate(-50%, -50%) translate3d(0, 0, 0) !important;
}
}
/* 页面宽度小于576px
------------------------------- */
@media screen and (max-width: $xs) {
.login-container {
background: none !important;
.login-logo {
display: none;
.login-icon-group {
display: none !important;
}
.login-content {
width: 100% !important;
@ -16,9 +45,6 @@
box-shadow: unset !important;
border: none !important;
}
.login-copyright {
display: none !important;
}
.el-form-item {
display: flex !important;
}
@ -27,7 +53,7 @@
/* 页面宽度小于375px
------------------------------- */
@media screen and (max-width: 376px) {
@media screen and (max-width: $us) {
.login-container {
.login-content-title {
font-size: 18px !important;

View File

@ -10,3 +10,4 @@
@import './pagination.scss';
@import './dialog.scss';
@import './cityLinkage.scss';
@import './date.scss';

View File

@ -9,7 +9,7 @@
height: 3px !important;
}
::-webkit-scrollbar-track-piece {
background-color: #f8f8f8;
background-color: var(--next-bg-main-color);
}
// 滚动条的设置
::-webkit-scrollbar-thumb {
@ -40,7 +40,7 @@
height: 7px;
}
::-webkit-scrollbar-track-piece {
background-color: #f8f8f8;
background-color: var(--next-bg-main-color);
}
// 滚动条的设置
::-webkit-scrollbar-thumb {

View File

@ -1,34 +0,0 @@
/* Button 按钮
------------------------------- */
@mixin Button($main, $c1, $c2) {
color: set-color($main);
background: set-color($c1);
border-color: set-color($c2);
}
/* Radio 单选框、Checkbox 多选框
------------------------------- */
@mixin RadioCheckbox($name) {
background-color: set-color($name);
border-color: set-color($name);
}
/* Tag 标签
------------------------------- */
@mixin Tag($main, $c1, $c2) {
color: set-color($main);
background-color: set-color($c1);
border-color: set-color($c2);
}
@mixin TagDark($main, $c1) {
color: set-color($main);
background-color: set-color($c1);
}
/* Alert 警告
------------------------------- */
@mixin Alert($main, $c1, $c2) {
color: set-color($main);
background: set-color($c1);
border: 1px solid set-color($c2);
}

View File

@ -1,5 +0,0 @@
/* 颜色调用函数
------------------------------- */
@function set-color($key) {
@return var(--color-#{$key});
}

View File

@ -4,7 +4,7 @@
* @param old 源数据
* @returns 两数组相同返回 `true`,反之则反
*/
export function judementSameArr(news: Array<string>, old: Array<string>): boolean {
export function judementSameArr(news: unknown[] | string[], old: string[]): boolean {
let count = 0;
const leng = old.length;
for (let i in old) {

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 图标,增加了 ele- 前缀使用时ele-Aim
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(`ele-${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));
});
};

View File

@ -1,25 +1,16 @@
import { nextTick } from 'vue';
import loadingCss from '/@/theme/loading.scss';
import '/@/theme/loading.scss';
/**
* 页面全局 Loading
* @method setCss 载入 css
* @method start 创建 loading
* @method done 移除 loading
*/
export const NextLoading = {
// 载入 css
setCss: () => {
let link = document.createElement('link');
link.rel = 'stylesheet';
link.href = loadingCss;
link.crossOrigin = 'anonymous';
document.getElementsByTagName('head')[0].appendChild(link);
},
// 创建 loading
start: () => {
const bodys: Element = document.body;
const div = document.createElement('div');
const div = <HTMLElement>document.createElement('div');
div.setAttribute('class', 'loading-next');
const htmls = `
<div class="loading-next-box">
@ -43,11 +34,9 @@ export const NextLoading = {
// 移除 loading
done: () => {
nextTick(() => {
setTimeout(() => {
window.nextLoading = false;
const el = document.querySelector('.loading-next');
el && el.parentNode?.removeChild(el);
}, 1000);
window.nextLoading = false;
const el = <HTMLElement>document.querySelector('.loading-next');
el?.parentNode?.removeChild(el);
});
},
};

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

@ -0,0 +1,134 @@
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(`ele-${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 const globalComponentSize: string = Local.get('themeConfig')?.globalComponentSize || store.state.themeConfig.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;
}
/**
* 判断是否是移动端
*/
export function isMobile() {
if (
navigator.userAgent.match(
/('phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone')/i
)
) {
return true;
} else {
return false;
}
}
/**
* 统一批量导出
* @method elSvg 导出全局注册 element plus svg 图标
* @method useTitle 设置浏览器标题国际化
* @method lazyImg 图片懒加载
* @method globalComponentSize element plus 全局组件大小
* @method deepClone 对象深克隆
* @method isMobile 判断是否是移动端
*/
const other = {
elSvg: (app: App) => {
elSvg(app);
},
useTitle: () => {
useTitle();
},
lazyImg: (el: any, arr: any) => {
lazyImg(el, arr);
},
globalComponentSize,
deepClone: (obj: any) => {
deepClone(obj);
},
isMobile: () => {
return isMobile();
},
};
// 统一批量导出
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;
});
};
}

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