Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
ops_2024_vue
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
ops_2024_vue
Commits
754206f1
Commit
754206f1
authored
Mar 31, 2024
by
heduo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(hd):切换角色
parent
3cde9213
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
21 deletions
+40
-21
src/layouts/default/header/components/user-dropdown/index.vue
...layouts/default/header/components/user-dropdown/index.vue
+40
-21
No files found.
src/layouts/default/header/components/user-dropdown/index.vue
View file @
754206f1
...
...
@@ -17,6 +17,13 @@
<!-- :text="t('layout.header.tooltipLock')"-->
<!-- icon="ion:lock-closed-outline"-->
<!-- />-->
<MenuItem
v-for=
"item in roleList"
:key=
"item.roleNum"
:text=
"t(item.roleName)"
icon=
"ant-design:user-outlined"
/>
<Menu
.
Divider
/>
<MenuItem
key=
"logout"
:text=
"t('layout.header.dropdownItemLoginOut')"
...
...
@@ -31,9 +38,9 @@
// components
import
{
Dropdown
,
Menu
}
from
'
ant-design-vue
'
;
import
{
defineComponent
,
computed
}
from
'
vue
'
;
import
{
defineComponent
,
computed
,
ref
}
from
'
vue
'
;
import
{
DOC_URL
}
from
'
/@/settings/siteSetting
'
;
//
import { DOC_URL } from '/@/settings/siteSetting';
import
{
useUserStore
}
from
'
/@/store/modules/user
'
;
import
{
useHeaderSetting
}
from
'
/@/hooks/setting/useHeaderSetting
'
;
...
...
@@ -43,9 +50,11 @@
import
headerImg
from
'
/@/assets/images/header.jpg
'
;
import
{
propTypes
}
from
'
/@/utils/propTypes
'
;
import
{
openWindow
}
from
'
/@/utils
'
;
//
import { openWindow } from '/@/utils';
import
{
createAsyncComponent
}
from
'
/@/utils/factory/createAsyncComponent
'
;
import
{
RoleEnum
}
from
'
/@/enums/roleEnum
'
;
import
{
usePermission
}
from
'
/@/hooks/web/usePermission
'
;
type
MenuEvent
=
'
logout
'
|
'
doc
'
|
'
lock
'
;
...
...
@@ -72,12 +81,15 @@
const
{
userName
:
realName
=
''
,
avatar
,
desc
}
=
userStore
.
getUserInfo
||
{};
return
{
realName
,
avatar
:
avatar
||
headerImg
,
desc
};
});
const
{
changeRole
}
=
usePermission
();
const
roleList
=
ref
([]);
roleList
.
value
=
userStore
.
getUserInfo
.
roleList
;
// const [register, { openModal }] = useModal();
const
[
register
]
=
useModal
();
const
[
register
,
{
openModal
}]
=
useModal
();
function
handleLock
()
{
openModal
(
true
);
}
// function handleLock() {
// openModal(true);
// }
// login out
function
handleLoginOut
()
{
...
...
@@ -85,21 +97,26 @@
}
// open doc
function
openDoc
()
{
openWindow
(
DOC_URL
);
}
//
function openDoc() {
//
openWindow(DOC_URL);
//
}
function
handleMenuClick
(
e
:
{
key
:
MenuEvent
})
{
switch
(
e
.
key
)
{
case
'
logout
'
:
handleLoginOut
();
break
;
case
'
doc
'
:
openDoc
();
break
;
case
'
lock
'
:
handleLock
();
break
;
// switch (e.key) {
// case 'logout':
// handleLoginOut();
// break;
// case 'doc':
// openDoc();
// break;
// case 'lock':
// handleLock();
// break;
// }
if
(
e
.
key
===
'
logout
'
)
{
handleLoginOut
();
}
else
{
changeRole
(
RoleEnum
[
e
.
key
]);
}
}
...
...
@@ -111,6 +128,8 @@
getShowDoc
,
register
,
getUseLockPage
,
changeRole
,
roleList
,
};
},
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment