header.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <header class="new--header">
  3. <div class="pro--wrap">
  4. <div class="pro--img"></div>
  5. <div class="pro--id" @click="proOn ? proOn = false : proOn = true ">
  6. {{ userId }} <i class="ico" :class="[proOn ? 'on' : '']">></i>
  7. <div class="id--box" v-show="proOn">
  8. <button type="button" class="btn-profile" @click="myPage(userId)">
  9. 마이페이지
  10. </button>
  11. <button type="button" class="btn-logout" @click="fnLoguOut">로그아웃</button>
  12. </div>
  13. </div>
  14. <div class="pro--info inf">
  15. 인플루언서
  16. </div>
  17. </div>
  18. <nav class="gnb">
  19. <ul class="depth1">
  20. <li v-for="(menu, index) in arrMenuInfo" :key="index">
  21. <button @click="menuAction(menu.menuId, menu.menuName, menu.linkType)" :class="{ actv: menu.linkType === $route.path }">
  22. {{ menu.menuName }}
  23. </button>
  24. </li>
  25. </ul>
  26. </nav>
  27. </header>
  28. </template>
  29. <script setup>
  30. /************************************************************************
  31. | 전역
  32. ************************************************************************/
  33. const { $log } = useNuxtApp();
  34. const proOn = ref(false);
  35. const pageId = "header";
  36. const arrMenuInfo = ref([]); // 메뉴정보
  37. const useStore = useDetailStore();
  38. const userName = ref("");
  39. const userCompanyName = ref("");
  40. const userId = ref("");
  41. const route = useRoute();
  42. const router = useRouter();
  43. /************************************************************************
  44. | 함수 : 세팅
  45. ************************************************************************/
  46. const fnSetMenu = () => {
  47. let info = [];
  48. arrMenuInfo.value = [];
  49. info.push(
  50. {
  51. menuId: "menu00",
  52. parentMenuId: "menu00",
  53. menuName: "주문 관리",
  54. linkType: "/view/order",
  55. },
  56. {
  57. menuId: "menu01",
  58. parentMenuId: "menu01",
  59. menuName: "제품 관리",
  60. linkType: "/view/item",
  61. },
  62. {
  63. menuId: "menu02",
  64. parentMenuId: "menu02",
  65. menuName: "배송 관리",
  66. linkType: "/view/deli",
  67. },
  68. {
  69. menuId: "menu03",
  70. parentMenuId: "menu03",
  71. menuName: "벤더 관리",
  72. linkType: "/view/vendor",
  73. },
  74. {
  75. menuId: "menu04",
  76. parentMenuId: "menu04",
  77. menuName: "정산 관리",
  78. linkType: "/view/settle",
  79. },
  80. {
  81. menuId: "menu05",
  82. parentMenuId: "menu05",
  83. menuName: "고객센터",
  84. linkType: "/view/cs",
  85. }
  86. );
  87. arrMenuInfo.value = info;
  88. $log.debug("[header][fnSetMenu][success]");
  89. };
  90. const menuAction = (__MENUID, _MENUROOTNAME, __URL) => {
  91. useStore.menuInfo.menuIndex = "0";
  92. useStore.menuInfo.menuId = __MENUID;
  93. useStore.menuInfo.pageRtName = _MENUROOTNAME;
  94. useStore.menuInfo.pageStatus = null;
  95. useUtil.setPageMove(__URL);
  96. };
  97. const fnLoguOut = () => {
  98. localStorage.removeItem("tempAccess");
  99. useAuthStore().setLogout();
  100. router.push({
  101. path: "/",
  102. });
  103. };
  104. const myPage = (userId) => {
  105. router.push({
  106. path: "/view/mng/mngAdd",
  107. });
  108. useDtStore.adminInfo.adminId = userId;
  109. useDtStore.adminInfo.pageType = "U";
  110. };
  111. /************************************************************************
  112. | 라이프사이클 : onMounted
  113. ************************************************************************/
  114. onMounted(() => {
  115. userId.value = localStorage.getItem("tempAccess");
  116. userName.value = JSON.parse(localStorage.getItem("authStore"))?.auth.name;
  117. userCompanyName.value = JSON.parse(
  118. localStorage.getItem("authStore")
  119. )?.auth.companyName;
  120. fnSetMenu();
  121. });
  122. </script>