header.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <header class="new--header">
  3. <h1 class="logo">
  4. <!-- prettier-ignore -->
  5. SHOPDELI
  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/item",
  63. },
  64. {
  65. menuId: "menu02",
  66. parentMenuId: "menu02",
  67. menuName: "배송 관리",
  68. linkType: "/view/deli",
  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. menuId: "menu05",
  84. parentMenuId: "menu05",
  85. menuName: "고객센터",
  86. linkType: "/",
  87. }
  88. );
  89. arrMenuInfo.value = info;
  90. $log.debug("[header][fnSetMenu][success]");
  91. };
  92. const menuAction = (__MENUID, _MENUROOTNAME, __URL) => {
  93. useStore.menuInfo.menuIndex = "0";
  94. useStore.menuInfo.menuId = __MENUID;
  95. useStore.menuInfo.pageRtName = _MENUROOTNAME;
  96. useStore.menuInfo.pageStatus = null;
  97. useUtil.setPageMove(__URL);
  98. };
  99. const fnLoguOut = () => {
  100. localStorage.removeItem("tempAccess");
  101. useAuthStore().setLogout();
  102. router.push({
  103. path: "/",
  104. });
  105. };
  106. const myPage = (userId) => {
  107. router.push({
  108. path: "/view/mng/mngAdd",
  109. });
  110. useDtStore.adminInfo.adminId = userId;
  111. useDtStore.adminInfo.pageType = "U";
  112. };
  113. /************************************************************************
  114. | 라이프사이클 : onMounted
  115. ************************************************************************/
  116. onMounted(() => {
  117. userId.value = localStorage.getItem("tempAccess");
  118. userName.value = JSON.parse(localStorage.getItem("authStore"))?.auth.name;
  119. userCompanyName.value = JSON.parse(
  120. localStorage.getItem("authStore")
  121. )?.auth.companyName;
  122. fnSetMenu();
  123. });
  124. </script>