|
|
@@ -4,7 +4,9 @@ import DownloadKLNPortal from './components/DownloadKLNPortal.vue'
|
|
|
import ChangePasswordDialog from './components/ChangePasswordDialog.vue'
|
|
|
import LogoutDialog from './components/LogoutDialog.vue'
|
|
|
import { useRouter } from 'vue-router'
|
|
|
+import { useUserStore } from '@/stores/modules/user'
|
|
|
|
|
|
+const userStore = useUserStore()
|
|
|
const router = useRouter()
|
|
|
const input1 = ref('')
|
|
|
|
|
|
@@ -27,14 +29,6 @@ const handleLogout = () => {
|
|
|
const handleLogin = () => {
|
|
|
router.push('/login')
|
|
|
}
|
|
|
-
|
|
|
-const test = () => {
|
|
|
- if (localStorage.getItem('token')) {
|
|
|
- localStorage.removeItem('token')
|
|
|
- } else {
|
|
|
- localStorage.setItem('token', '123')
|
|
|
- }
|
|
|
-}
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
@@ -50,7 +44,6 @@ const test = () => {
|
|
|
<!-- <span class="font_family icon-icon_notice_b" style="font-size: 18px"></span>
|
|
|
<span class="font_family icon-icon_language_b" style="font-size: 16px"></span> -->
|
|
|
|
|
|
- <el-button @click="test">测试</el-button>
|
|
|
<el-popover
|
|
|
placement="bottom-end"
|
|
|
:width="256"
|
|
|
@@ -59,11 +52,8 @@ const test = () => {
|
|
|
content="this is content, this is content, this is content"
|
|
|
>
|
|
|
<div class="title">
|
|
|
- <el-avatar
|
|
|
- :size="48"
|
|
|
- src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"
|
|
|
- />
|
|
|
- <span class="name">John Doe</span>
|
|
|
+ <div class="avatar">{{ userStore.username?.slice(0, 1) }}</div>
|
|
|
+ <span class="name">{{ userStore.username }}</span>
|
|
|
</div>
|
|
|
<div class="options">
|
|
|
<div class="item" @click="handleChangePassword">
|
|
|
@@ -76,17 +66,24 @@ const test = () => {
|
|
|
</div>
|
|
|
</div>
|
|
|
<template #reference>
|
|
|
- <el-avatar
|
|
|
- :size="24"
|
|
|
- src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"
|
|
|
- />
|
|
|
+ <div class="avatar" v-if="userStore.username">{{ userStore.username?.slice(0, 1) }}</div>
|
|
|
</template>
|
|
|
</el-popover>
|
|
|
- <el-button class="el-button--main" style="padding: 8px 10px" plain @click="handleDownload">
|
|
|
+ <el-button
|
|
|
+ v-if="!userStore.username"
|
|
|
+ class="el-button--main"
|
|
|
+ style="padding: 8px 10px"
|
|
|
+ plain
|
|
|
+ @click="handleDownload"
|
|
|
+ >
|
|
|
<span class="font_family icon-icon_download_b" style="margin-right: 4px"></span>
|
|
|
Download KLN Portal
|
|
|
</el-button>
|
|
|
- <el-button class="el-button--main" style="margin-left: -10px" @click="handleLogin"
|
|
|
+ <el-button
|
|
|
+ v-if="!userStore.username"
|
|
|
+ class="el-button--main"
|
|
|
+ style="margin-left: -10px"
|
|
|
+ @click="handleLogin"
|
|
|
>Log in</el-button
|
|
|
>
|
|
|
</div>
|
|
|
@@ -97,6 +94,18 @@ const test = () => {
|
|
|
</template>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
+.avatar {
|
|
|
+ width: 24px;
|
|
|
+ height: 24px;
|
|
|
+ border-radius: 50%;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 24px;
|
|
|
+ color: #fff;
|
|
|
+ font-size: 16px;
|
|
|
+ font-weight: 700;
|
|
|
+ background-color: var(--color-theme);
|
|
|
+ cursor: pointer;
|
|
|
+}
|
|
|
.layout-toolbar {
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
|
@@ -140,6 +149,17 @@ div.el-popover.el-popper.user-config-popover {
|
|
|
gap: 8px;
|
|
|
height: 70px;
|
|
|
border-bottom: 1px solid #eeeeed;
|
|
|
+ .avatar {
|
|
|
+ width: 48px;
|
|
|
+ height: 48px;
|
|
|
+ border-radius: 50%;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 48px;
|
|
|
+ color: #fff;
|
|
|
+ font-size: 32px;
|
|
|
+ font-weight: 700;
|
|
|
+ background-color: var(--color-theme);
|
|
|
+ }
|
|
|
}
|
|
|
.options {
|
|
|
.item {
|