diff --git a/src/assets/styles/variables.module.scss b/src/assets/styles/variables.module.scss index e7d66cd..3aa871b 100644 --- a/src/assets/styles/variables.module.scss +++ b/src/assets/styles/variables.module.scss @@ -16,7 +16,12 @@ // ele --brder-color: #e8e8e8; + + // 添加 tag 相关变量 + --tags-view-active-bg: var(--el-color-primary); + --tags-view-active-border-color: var(--el-color-primary); } + html.dark { --menuBg: #1d1e1f; --menuColor: #bfcbd9; @@ -36,6 +41,25 @@ html.dark { .el-tree-node__content { --el-color-primary-light-9: #262727; } + + .el-button--primary { + --el-button-bg-color: var(--el-color-primary-dark-6); + --el-button-border-color: var(--el-color-primary-light-2); + } + + .el-switch { + --el-switch-on-color: var(--el-color-primary-dark-6); + --el-switch-border-color: var(--el-color-primary-light-2); + } + + .el-tag--primary { + --el-tag-bg-color: var(--el-color-primary-dark-6); + --el-tag-border-color: var(--el-color-primary-light-2); + } + + // 在深色模式下使用更深的颜色 + --tags-view-active-bg: var(--el-color-primary-dark-6); + --tags-view-active-border-color: var(--el-color-primary-light-2); // vxe-table 主题 --vxe-font-color: #98989e; --vxe-primary-color: #2c7ecf; @@ -108,4 +132,4 @@ $base-sidebar-width: 200px; dangerColor: $--color-danger; infoColor: $--color-info; warningColor: $--color-warning; -} +} \ No newline at end of file diff --git a/src/components/TopNav/index.vue b/src/components/TopNav/index.vue index e93e005..cfe2cd7 100644 --- a/src/components/TopNav/index.vue +++ b/src/components/TopNav/index.vue @@ -91,8 +91,8 @@ const activeMenu = computed(() => { let activePath = path; if (path !== undefined && path.lastIndexOf('/') > 0 && hideList.indexOf(path) === -1) { const tmpPath = path.substring(1, path.length); - activePath = '/' + tmpPath.substring(0, tmpPath.indexOf('/')); if (!route.meta.link) { + activePath = '/' + tmpPath.substring(0, tmpPath.indexOf('/')); appStore.toggleSideBarHide(false); } } else if (!route.children) { diff --git a/src/directive/permission/index.ts b/src/directive/permission/index.ts index afde332..eb2dccc 100644 --- a/src/directive/permission/index.ts +++ b/src/directive/permission/index.ts @@ -31,7 +31,7 @@ export const hasRoles: Directive = { const { roles } = useUserStore(); if (value && value instanceof Array && value.length > 0) { const hasRole = roles.some((role: string) => { - return role === 'admin' || value.includes(role); + return role === 'superadmin' || role === 'admin' || value.includes(role); }); if (!hasRole) { el.parentNode && el.parentNode.removeChild(el); diff --git a/src/layout/components/TagsView/index.vue b/src/layout/components/TagsView/index.vue index 0812feb..9bcf285 100644 --- a/src/layout/components/TagsView/index.vue +++ b/src/layout/components/TagsView/index.vue @@ -70,8 +70,8 @@ const isActive = (r: RouteLocationNormalized): boolean => { const activeStyle = (tag: RouteLocationNormalized) => { if (!isActive(tag)) return {}; return { - 'background-color': theme.value, - 'border-color': theme.value + 'background-color': 'var(--tags-view-active-bg)', + 'border-color': 'var(--tags-view-active-border-color)' }; }; const isAffix = (tag: RouteLocationNormalized) => { diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index 72b1655..430c55a 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -68,7 +68,7 @@ - + 删除 @@ -81,8 +81,8 @@ @@ -579,15 +579,6 @@ function submitFileForm() { uploadRef.value?.submit(); } -/** 初始化部门数据 */ -const initTreeData = async () => { - // 判断部门的数据是否存在,存在不获取,不存在则获取 - if (deptOptions.value === undefined) { - const row = await treeselect(); - deptOptions.value = row.data; - } -}; - /** 重置操作表单 */ const reset = () => { form.value = { ...initFormData }; @@ -605,7 +596,6 @@ const handleAdd = async () => { const { data } = await api.getUser(); dialog.visible = true; dialog.title = '新增用户'; - await initTreeData(); postOptions.value = data.posts; roleOptions.value = data.roles; form.value.password = initPassword.value.toString(); @@ -618,7 +608,6 @@ const handleUpdate = async (row?: UserForm) => { const { data } = await api.getUser(userId); dialog.visible = true; dialog.title = '修改用户'; - await initTreeData(); Object.assign(form.value, data.user); postOptions.value = data.posts; roleOptions.value = data.roles;