Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
啊嘞嘞EC
vue-vben-admin
提交
67962f1d
V
vue-vben-admin
项目概览
啊嘞嘞EC
/
vue-vben-admin
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vue-vben-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
67962f1d
编写于
3月 18, 2021
作者:
V
Vben
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(v-auth): ensure the background mode is correct close #330
上级
8360b1d6
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
24 addition
and
47 deletion
+24
-47
build/config/themeConfig.ts
build/config/themeConfig.ts
+5
-5
src/components/SimpleMenu/src/components/menu.less
src/components/SimpleMenu/src/components/menu.less
+0
-19
src/design/var/index.less
src/design/var/index.less
+0
-3
src/directives/permission.ts
src/directives/permission.ts
+0
-13
src/layouts/default/header/index.less
src/layouts/default/header/index.less
+5
-0
src/store/modules/permission.ts
src/store/modules/permission.ts
+11
-0
src/views/demo/permission/back/Btn.vue
src/views/demo/permission/back/Btn.vue
+3
-7
未找到文件。
build/config/themeConfig.ts
浏览文件 @
67962f1d
...
...
@@ -38,22 +38,22 @@ export function generateColors({
tinycolor
,
}:
GenerateColorsParams
)
{
const
arr
=
new
Array
(
19
).
fill
(
0
);
const
lightens
=
arr
.
map
((
t
,
i
)
=>
{
const
lightens
=
arr
.
map
((
_
t
,
i
)
=>
{
return
mixLighten
(
color
,
i
/
5
);
});
const
darkens
=
arr
.
map
((
t
,
i
)
=>
{
const
darkens
=
arr
.
map
((
_
t
,
i
)
=>
{
return
mixDarken
(
color
,
i
/
5
);
});
const
alphaColors
=
arr
.
map
((
t
,
i
)
=>
{
const
alphaColors
=
arr
.
map
((
_
t
,
i
)
=>
{
return
tinycolor
(
color
)
.
setAlpha
(
i
/
20
)
.
toRgbString
();
});
const
tinycolorLightens
=
arr
.
map
((
t
,
i
)
=>
{
.
map
((
_
t
,
i
)
=>
{
return
tinycolor
(
color
)
.
lighten
(
i
*
5
)
.
toHexString
();
...
...
@@ -61,7 +61,7 @@ export function generateColors({
.
filter
((
item
)
=>
item
!==
'
#ffffff
'
);
const
tinycolorDarkens
=
arr
.
map
((
t
,
i
)
=>
{
.
map
((
_
t
,
i
)
=>
{
return
tinycolor
(
color
)
.
darken
(
i
*
5
)
.
toHexString
();
...
...
src/components/SimpleMenu/src/components/menu.less
浏览文件 @
67962f1d
...
...
@@ -111,7 +111,6 @@
.@{menu-prefix-cls}-submenu-active {
color: @primary-color !important;
// background: fade(@primary-color, 8);
&-border {
.light-border();
...
...
@@ -120,8 +119,6 @@
}
&-dark {
// background: @menu-dark;
.@{menu-prefix-cls}-submenu-active {
color: #fff !important;
}
...
...
@@ -137,7 +134,6 @@
cursor: pointer;
outline: none;
align-items: center;
// transition: all @transition-time @ease-in-out;
&:hover,
&:active {
...
...
@@ -264,12 +260,7 @@
&:hover {
color: #fff;
// background: @menu-dark;
}
// &-active:not(.@{menu-prefix-cls}-submenu) {
// color: @primary-color;
// }
}
&-dark&-vertical&-collapse {
...
...
@@ -296,11 +287,6 @@
}
&-dark&-vertical &-submenu &-item {
// &:hover {
// color: #fff;
// background: transparent;
// }
&-active,
&-active:hover {
color: #fff;
...
...
@@ -313,11 +299,6 @@
}
&-dark&-vertical &-opened {
// background: @menu-dark-active-bg;
// .@{menu-prefix-cls}-submenu-title {
// background: @menu-dark;
// }
.@{menu-prefix-cls}-submenu-has-parent-submenu {
.@{menu-prefix-cls}-submenu-title {
background: transparent;
...
...
src/design/var/index.less
浏览文件 @
67962f1d
...
...
@@ -32,9 +32,6 @@
@page-footer-z-index: 99;
// left-menu
@app-menu-item-height: 42px;
.bem(@n; @content) {
@{namespace}-@{n} {
@content();
...
...
src/directives/permission.ts
浏览文件 @
67962f1d
...
...
@@ -5,9 +5,7 @@
*/
import
type
{
App
,
Directive
,
DirectiveBinding
}
from
'
vue
'
;
import
projectSetting
from
'
/@/settings/projectSetting
'
;
import
{
usePermission
}
from
'
/@/hooks/web/usePermission
'
;
import
{
PermissionModeEnum
}
from
'
/@/enums/appEnum
'
;
function
isAuth
(
el
:
Element
,
binding
:
any
)
{
const
{
hasPermission
}
=
usePermission
();
...
...
@@ -19,23 +17,12 @@ function isAuth(el: Element, binding: any) {
}
}
function
isBackMode
()
{
return
projectSetting
.
permissionMode
===
PermissionModeEnum
.
BACK
;
}
const
mounted
=
(
el
:
Element
,
binding
:
DirectiveBinding
<
any
>
)
=>
{
if
(
isBackMode
())
return
;
isAuth
(
el
,
binding
);
};
const
updated
=
(
el
:
Element
,
binding
:
DirectiveBinding
<
any
>
)
=>
{
if
(
!
isBackMode
())
return
;
isAuth
(
el
,
binding
);
};
const
authDirective
:
Directive
=
{
mounted
,
updated
,
};
export
function
setupPermissionDirective
(
app
:
App
)
{
...
...
src/layouts/default/header/index.less
浏览文件 @
67962f1d
...
...
@@ -175,6 +175,11 @@
.@{header-prefix-cls}-action {
&__item {
.app-iconify {
padding: 0 10px;
font-size: 16px !important;
}
&:hover {
background: @header-dark-bg-hover-color;
}
...
...
src/store/modules/permission.ts
浏览文件 @
67962f1d
...
...
@@ -13,6 +13,7 @@ import { asyncRoutes } from '/@/router/routes';
import
{
filter
}
from
'
/@/utils/helper/treeHelper
'
;
import
{
toRaw
}
from
'
vue
'
;
import
{
getMenuListById
}
from
'
/@/api/sys/menu
'
;
import
{
getPermCodeByUserId
}
from
'
/@/api/sys/user
'
;
import
{
transformObjToRoute
,
flatRoutes
}
from
'
/@/router/helper/routeHelper
'
;
import
{
transformRouteToMenu
}
from
'
/@/router/helper/menuHelper
'
;
...
...
@@ -82,6 +83,12 @@ class Permission extends VuexModule {
this
.
lastBuildMenuTimeState
=
0
;
}
@
Action
async
changePermissionCode
(
userId
:
string
)
{
const
codeList
=
await
getPermCodeByUserId
({
userId
});
this
.
commitPermCodeListState
(
codeList
);
}
@
Action
async
buildRoutesAction
(
id
?:
number
|
string
):
Promise
<
AppRouteRecordRaw
[]
>
{
const
{
t
}
=
useI18n
();
...
...
@@ -106,6 +113,10 @@ class Permission extends VuexModule {
});
// Here to get the background routing menu logic to modify by yourself
const
paramId
=
id
||
userStore
.
getUserInfoState
.
userId
;
// !Simulate to obtain permission codes from the background,
// this function may only need to be executed once, and the actual project can be put at the right time by itself
this
.
changePermissionCode
(
'
1
'
);
if
(
!
paramId
)
{
throw
new
Error
(
'
paramId is undefined!
'
);
}
...
...
src/views/demo/permission/back/Btn.vue
浏览文件 @
67962f1d
...
...
@@ -59,7 +59,6 @@
import
CurrentPermissionMode
from
'
../CurrentPermissionMode.vue
'
;
import
{
usePermission
}
from
'
/@/hooks/web/usePermission
'
;
import
{
Authority
}
from
'
/@/components/Authority
'
;
import
{
getPermCodeByUserId
}
from
'
/@/api/sys/user
'
;
import
{
permissionStore
}
from
'
/@/store/modules/permission
'
;
import
{
PermissionModeEnum
}
from
'
/@/enums/appEnum
'
;
import
{
PageWrapper
}
from
'
/@/components/Page
'
;
...
...
@@ -69,13 +68,10 @@
setup
()
{
const
{
hasPermission
}
=
usePermission
();
// !模拟从后台获取权限编码, 该函数可能只需要执行一次,实际项目可以自行放到合适的时机
async
function
changePermissionCode
(
userId
:
string
)
{
const
codeList
=
await
getPermCodeByUserId
({
userId
});
permissionStore
.
commitPermCodeListState
(
codeList
);
function
changePermissionCode
(
userId
:
string
)
{
permissionStore
.
changePermissionCode
(
userId
);
}
// 默认初始化为1
changePermissionCode
(
'
1
'
);
return
{
hasPermission
,
permissionStore
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录