You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
OneAuth/ui/ico.html

88 lines
1.5 KiB
HTML

7 months ago
<!DOCTYPE html>
<html>
6 months ago
<head>
<meta name="description" content="用户头像和登录状态组件">
</head>
7 months ago
6 months ago
<style>
7 months ago
.header-user {
display: flex;
align-items: center;
6 months ago
gap: 12px;
padding: 8px 12px;
border-radius: 20px;
transition: all 0.2s ease;
}
.header-user:hover {
background: rgba(0, 0, 0, 0.05);
7 months ago
}
.user-avatar {
6 months ago
width: 36px;
height: 36px;
7 months ago
border-radius: 50%;
object-fit: cover;
6 months ago
border: 2px solid #f8f9fa;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
7 months ago
}
.user-name {
font-size: 14px;
6 months ago
font-weight: 500;
color: #333;
text-decoration: none;
}
.user-name:hover {
color: #1e88e5;
}
.auth-btn {
padding: 6px 16px;
border-radius: 20px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: all 0.2s ease;
}
.login-btn {
background: #1e88e5;
color: white;
border: none;
}
.login-btn:hover {
background: #1565c0;
}
.logout-btn {
background: transparent;
color: #f44336;
border: 1px solid #f44336;
}
.logout-btn:hover {
background: rgba(244, 67, 54, 0.1);
7 months ago
}
</style>
<body>
3 months ago
<div class="header-user ml-auto" v-if="$G.user.name">
<img :src="$G.user.icon" class="user-avatar" alt="用户头像">
<a href='/profile' class="user-name">{{ $G.user.name }}</a>
<button @click="$G.token.logout()" class="auth-btn logout-btn">
7 months ago
退出
6 months ago
</button>
7 months ago
</div>
<div class="header-user" v-else>
6 months ago
<a href="/login" class="auth-btn login-btn">
7 months ago
登录
</a>
</div>
</body>
6 months ago
</html>