140 lines
3.3 KiB
Vue
140 lines
3.3 KiB
Vue
<script setup>
|
|
import { onMounted, ref } from "vue";
|
|
import NavbarItem from "./NavbarItem.vue";
|
|
import NavbarBuilding from "./NavbarBuilding.vue";
|
|
import Logo from "@/assets/img/logo.svg";
|
|
import useGetCookie from "@/hooks/useGetCookie";
|
|
import AlarmDrawer from "@/components/alarm/AlarmDrawer.vue";
|
|
|
|
const user = ref("");
|
|
|
|
onMounted(() => {
|
|
const name = useGetCookie("niagara_userid");
|
|
if (name) {
|
|
user.value = name;
|
|
}
|
|
});
|
|
|
|
const src = import.meta.env.MODE === "production" ? "./logo.svg" : Logo;
|
|
</script>
|
|
|
|
<template>
|
|
<header class="navbar bg-dark text-success py-2 mb-3 w-full relative z-50">
|
|
<div class="navbar-start">
|
|
<div class="dropdown">
|
|
<div tabindex="0" role="button" class="btn btn-ghost lg:hidden">
|
|
<svg
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
class="h-5 w-5"
|
|
fill="none"
|
|
viewBox="0 0 24 24"
|
|
stroke="currentColor"
|
|
>
|
|
<path
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
stroke-width="2"
|
|
d="M4 6h16M4 12h8m-8 6h16"
|
|
/>
|
|
</svg>
|
|
</div>
|
|
<ul
|
|
class="menu menu-sm dropdown-content mt-3 z-[1] p-2 shadow bg-base-100 rounded-box w-52"
|
|
>
|
|
<NavbarItem />
|
|
</ul>
|
|
</div>
|
|
<router-link to="/dashboard" class="rounded-lg pl-14 text-xl">
|
|
<img :src="src" alt="logo" class="w-52" />
|
|
</router-link>
|
|
<NavbarBuilding />
|
|
</div>
|
|
|
|
<div class="navbar-center hidden lg:flex">
|
|
<NavbarItem />
|
|
</div>
|
|
<div class="navbar-end mr-4">
|
|
<ul class="menu-box">
|
|
<li>
|
|
<AlarmDrawer />
|
|
</li>
|
|
<li>
|
|
<div class="dropdown dropdown-bottom dropdown-end">
|
|
<button
|
|
tabindex="0"
|
|
type="link"
|
|
class="flex flex-col justify-center items-center btn-group"
|
|
>
|
|
<font-awesome-icon
|
|
:icon="['fas', 'user-circle']"
|
|
size="2x"
|
|
class="text-white menu-icon"
|
|
/>
|
|
<span class="text-white"> {{ user || "webUser" }}</span>
|
|
</button>
|
|
<ul
|
|
tabindex="0"
|
|
class="dropdown-content translate-y-2 z-[100] menu py-3 shadow rounded w-32 bg-[#4c625e] border text-center"
|
|
>
|
|
<li class="text-white">
|
|
<a
|
|
href="/logout"
|
|
class="flex flex-col justify-center items-center"
|
|
>登出</a
|
|
>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</header>
|
|
</template>
|
|
|
|
<style lang="css">
|
|
.sub-drawer {
|
|
@apply bg-dark bg-opacity-80 shadow-xl !important;
|
|
}
|
|
/**menu**/
|
|
.menu-box {
|
|
@apply flex justify-center;
|
|
position: relative;
|
|
z-index: 0;
|
|
}
|
|
|
|
|
|
.menu-box .btn-group {
|
|
background: transparent;
|
|
width: 95px;
|
|
}
|
|
|
|
.menu-box li {
|
|
position: relative;
|
|
}
|
|
|
|
.menu-box li:not(:last-child)::after {
|
|
content: "";
|
|
position: absolute;
|
|
top: 20px;
|
|
bottom: 0;
|
|
left: 84px;
|
|
right: 0px;
|
|
display: block;
|
|
width: 25px;
|
|
height: 2px;
|
|
background-color: #7cedc1;
|
|
z-index: 0;
|
|
}
|
|
|
|
.menu-icon {
|
|
width: 40px;
|
|
margin: auto;
|
|
}
|
|
|
|
.menu-box .btn-group span {
|
|
color: #fff;
|
|
display: block;
|
|
margin-top: 0px;
|
|
}
|
|
</style>
|