Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
Vue-Dashboard
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
高源
Vue-Dashboard
Commits
3faf04c4
Commit
3faf04c4
authored
Apr 27, 2025
by
User
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录角色名称修改
parent
2190a231
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
42 deletions
+24
-42
index.html
dist/index.html
+2
-2
user-avatar.vue
src/layouts/modules/global-header/components/user-avatar.vue
+22
-40
No files found.
dist/index.html
View file @
3faf04c4
<!doctype html>
<html
lang=
"zh-cmn-Hans"
>
<head>
<meta
name=
"buildTime"
content=
"2025-04-25 1
5:49:09
"
>
<meta
name=
"buildTime"
content=
"2025-04-25 1
7:56:27
"
>
<meta
charset=
"UTF-8"
/>
<link
rel=
"icon"
href=
"/favicon.svg"
/>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
/>
<meta
name=
"color-scheme"
content=
"light dark"
/>
<title>
VueDashboard
</title>
<script
type=
"module"
crossorigin
src=
"/Content/VueDashboardUi/VueDashboard1/assets/index-C
rvCiZyA
.js"
></script>
<script
type=
"module"
crossorigin
src=
"/Content/VueDashboardUi/VueDashboard1/assets/index-C
sI39EZy
.js"
></script>
<link
rel=
"stylesheet"
crossorigin
href=
"/Content/VueDashboardUi/VueDashboard1/assets/index-DhhgO4aJ.css"
>
</head>
<body>
...
...
src/layouts/modules/global-header/components/user-avatar.vue
View file @
3faf04c4
<
script
setup
lang=
"ts"
>
import
{
computed
}
from
'vue'
;
import
type
{
VNode
}
from
'vue'
;
import
type
{
DropdownOption
}
from
'naive-ui'
;
import
type
{
RouteKey
}
from
'@elegant-router/types'
;
import
{
useAuthStore
}
from
'@/store/modules/auth'
;
import
{
$t
}
from
'@/locales'
;
import
{
useRouterPush
}
from
'@/hooks/common/router'
;
import
{
useSvgIcon
}
from
'@/hooks/common/icon'
;
import
{
$t
}
from
'@/locales'
;
defineOptions
({
name
:
'UserAvatar'
...
...
@@ -14,59 +15,40 @@ const authStore = useAuthStore();
const
{
routerPushByKey
,
toLogin
}
=
useRouterPush
();
const
{
SvgIconVNode
}
=
useSvgIcon
();
// 计算属性获取认证状态
const
isAuthenticated
=
computed
(()
=>
{
const
globalConfig
=
(
window
as
any
).
uiGlobalConfig
;
return
globalConfig
?.
IsAuthenticated
??
false
;
});
function
loginOrRegister
()
{
toLogin
();
}
type
DropdownKey
=
'logout'
;
type
DropdownOption
=
|
{
key
:
DropdownKey
;
label
:
string
;
icon
?:
()
=>
VNode
;
}
|
{
type
:
'divider'
;
key
:
string
;
};
const
options
=
computed
(()
=>
{
const
opts
:
DropdownOption
[]
=
[
const
options
=
computed
<
DropdownOption
[]
>
(()
=>
[
// {
// label: $t('common.userCenter'),
// key: 'user_center',
// icon: SvgIconVNode({ icon: 'carbon:user-avatar', fontSize: 18 })
// },
{
label
:
$t
(
'common.logout'
),
key
:
'logout'
,
icon
:
SvgIconVNode
({
icon
:
'ph:sign-
out'
,
fontSize
:
18
})
icon
:
SvgIconVNode
({
icon
:
'carbon:log
out'
,
fontSize
:
18
})
}
]
;
])
;
return
opts
;
});
function
logout
()
{
window
.
$dialog
?.
info
({
title
:
$t
(
'common.tip'
),
content
:
$t
(
'common.logoutConfirm'
),
positiveText
:
$t
(
'common.confirm'
),
negativeText
:
$t
(
'common.cancel'
),
onPositiveClick
:
()
=>
{
authStore
.
resetStore
();
}
});
}
function
handleDropdown
(
key
:
DropdownKey
)
{
function
handleDropdown
(
key
:
string
)
{
if
(
key
===
'logout'
)
{
logout
();
}
else
{
// If your other options are jumps from other routes, they will be directly supported here
routerPushByKey
(
key
);
authStore
.
resetStore
();
}
else
if
(
key
===
'user_center'
)
{
routerPushByKey
(
key
as
RouteKey
);
}
}
</
script
>
<
template
>
<NButton
v-if=
"!
authStore.isLogin
"
quaternary
@
click=
"loginOrRegister"
>
<NButton
v-if=
"!
isAuthenticated
"
quaternary
@
click=
"loginOrRegister"
>
{{
$t
(
'page.login.common.loginOrRegister'
)
}}
</NButton>
<NDropdown
v-else
placement=
"bottom"
trigger=
"click"
:options=
"options"
@
select=
"handleDropdown"
>
...
...
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