header.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <header class="new--header">
  3. <h1 class="logo">
  4. <!-- prettier-ignore -->
  5. {{userCompanyName}} 룰렛 시스템 관리자
  6. </h1>
  7. <nav class="gnb">
  8. <ul class="depth1">
  9. <li v-for="(menu, index) in arrMenuInfo" :key="index">
  10. <button @click="menuAction(menu.menuId, menu.menuName, menu.linkType)">
  11. {{ menu.menuName }}
  12. </button>
  13. </li>
  14. </ul>
  15. <!-- 오버매뉴 사용시 사용 -->
  16. <!-- <div class="gnb-bg"></div> -->
  17. </nav>
  18. <!-- 가청, 화면테마, 언어, 프로필, 로그아웃 -->
  19. <div class="util log--btn">
  20. <span class="user-name">{{ userId }} ( {{ userName }} )</span>
  21. <button type="button" class="btn-profile" @click="myPage(userId)">
  22. <svg
  23. xmlns="http://www.w3.org/2000/svg"
  24. viewBox="0 0 512 512"
  25. width="22"
  26. height="22"
  27. style="color: #fff; vertical-align: top"
  28. >
  29. <path
  30. fill="currentColor"
  31. d="M406.5 399.6C387.4 352.9 341.5 320 288 320l-64 0c-53.5 0-99.4 32.9-118.5 79.6C69.9 362.2 48 311.7 48 256C48 141.1 141.1 48 256 48s208 93.1 208 208c0 55.7-21.9 106.2-57.5 143.6zm-40.1 32.7C334.4 452.4 296.6 464 256 464s-78.4-11.6-110.5-31.7c7.3-36.7 39.7-64.3 78.5-64.3l64 0c38.8 0 71.2 27.6 78.5 64.3zM256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-272a40 40 0 1 1 0-80 40 40 0 1 1 0 80zm-88-40a88 88 0 1 0 176 0 88 88 0 1 0 -176 0z"
  32. />
  33. </svg>
  34. </button>
  35. <button type="button" class="btn-logout" @click="fnLoguOut"></button>
  36. </div>
  37. </header>
  38. </template>
  39. <script setup>
  40. /************************************************************************
  41. | 전역
  42. ************************************************************************/
  43. const { $log } = useNuxtApp();
  44. const pageId = "header";
  45. const arrMenuInfo = ref([]); // 메뉴정보
  46. const useStore = useDetailStore();
  47. const userName = ref("");
  48. const userCompanyName = ref("");
  49. const userId = ref("");
  50. const router = useRouter();
  51. /************************************************************************
  52. | 함수 : 세팅
  53. ************************************************************************/
  54. const fnSetMenu = () => {
  55. let info = [];
  56. arrMenuInfo.value = [];
  57. info.push(
  58. {
  59. menuId: "menu01",
  60. parentMenuId: "menu01",
  61. menuName: "관리자 관리",
  62. linkType: "/view/mng",
  63. },
  64. {
  65. menuId: "menu02",
  66. parentMenuId: "menu02",
  67. menuName: "이벤트 관리",
  68. linkType: "/view/event/evtList",
  69. },
  70. {
  71. menuId: "menu03",
  72. parentMenuId: "menu03",
  73. menuName: "당첨자 관리",
  74. linkType: "/view/winner",
  75. },
  76. {
  77. menuId: "menu04",
  78. parentMenuId: "menu04",
  79. menuName: "룰렛 타입 관리",
  80. linkType: "/",
  81. }
  82. );
  83. arrMenuInfo.value = info;
  84. $log.debug("[header][fnSetMenu][success]");
  85. };
  86. const menuAction = (__MENUID, _MENUROOTNAME, __URL) => {
  87. useStore.menuInfo.menuIndex = "0";
  88. useStore.menuInfo.menuId = __MENUID;
  89. useStore.menuInfo.pageRtName = _MENUROOTNAME;
  90. useStore.menuInfo.pageStatus = null;
  91. useUtil.setPageMove(__URL);
  92. };
  93. const fnLoguOut = () => {
  94. localStorage.removeItem("tempAccess");
  95. useAuthStore().setLogout();
  96. router.push({
  97. path: "/",
  98. });
  99. };
  100. const myPage = (userId) => {
  101. router.push({
  102. path: "/view/mng/mngAdd",
  103. });
  104. useDtStore.adminInfo.adminId = userId;
  105. useDtStore.adminInfo.pageType = "U";
  106. };
  107. /************************************************************************
  108. | 라이프사이클 : onMounted
  109. ************************************************************************/
  110. onMounted(() => {
  111. userId.value = localStorage.getItem("tempAccess");
  112. userName.value = JSON.parse(localStorage.getItem("authStore"))?.auth.name;
  113. userCompanyName.value = JSON.parse(
  114. localStorage.getItem("authStore")
  115. )?.auth.companyName;
  116. fnSetMenu();
  117. });
  118. </script>