ソースを参照

Merge branch 'master' of https://gogs.interscope.i234.me/mo0647/influence

DESKTOP-T61HUSC\user 5 ヶ月 前
コミット
615131ea75

+ 14 - 0
assets/img/ic_google.svg

@@ -0,0 +1,14 @@
+<svg width="100" height="100" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">
+<circle cx="50" cy="50" r="49.5" fill="white" stroke="#666666"/>
+<g clip-path="url(#clip0_168_1253)">
+<path fill-rule="evenodd" clip-rule="evenodd" d="M71.9999 50.5078C71.9999 48.9534 71.8544 47.4404 71.6049 46.0104H50.8136V54.5285H62.6854C62.1656 57.285 60.6271 59.6062 58.2777 61.1606V66.6736H65.4091C69.5881 62.8394 71.9999 57.2021 71.9999 50.5078Z" fill="#3E82F1"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M50.7928 72C56.7599 72 61.7498 70.0311 65.4091 66.6736L58.2776 61.1606C56.3025 62.487 53.7659 63.2539 50.8136 63.2539C45.0752 63.2539 40.21 59.3782 38.4635 54.1761H31.0826V59.8756C34.7211 67.0673 42.1852 72 50.7928 72Z" fill="#32A753"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M38.4636 54.1762C38.027 52.8498 37.7775 51.4405 37.7775 49.9897C37.7775 48.5389 38.027 47.1296 38.4636 45.8031V40.1244H31.0827C29.5857 43.0881 28.7333 46.4456 28.7333 49.9897C28.7333 53.5337 29.5857 56.8912 31.0827 59.8757L38.4636 54.1762Z" fill="#F9BB00"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M50.7928 36.7461C54.0362 36.7461 56.947 37.8653 59.234 40.0414L65.5546 33.7409C61.7498 30.1762 56.7599 28 50.7928 28C42.1852 28 34.7211 32.9326 31.0826 40.1244L38.4635 45.8238C40.1892 40.6218 45.0544 36.7461 50.7928 36.7461Z" fill="#E74133"/>
+</g>
+<defs>
+<clipPath id="clip0_168_1253">
+<rect width="44" height="44" fill="white" transform="translate(28 28)"/>
+</clipPath>
+</defs>
+</svg>

+ 4 - 0
assets/img/ic_kakao.svg

@@ -0,0 +1,4 @@
+<svg width="100" height="100" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">
+<circle cx="50" cy="50" r="50" fill="#FAE100"/>
+<path d="M50.0234 27C63.81 27 75 35.8398 75 46.8066C74.9999 57.7733 63.763 66.6132 49.9766 66.6133C48.4186 66.6133 46.8604 66.5186 45.3496 66.2822C42.564 68.1258 36.1427 72.522 35.7178 72.8057C35.1984 73.1365 34.3482 73.1833 34.6787 71.8125C34.9621 70.725 36.3312 65.5728 36.8506 63.6348C29.7214 60.1367 25.0001 53.8971 25 46.8066C25 35.8399 36.2369 27.0001 50.0234 27ZM44.7354 40.7559C44.1216 40.7087 43.5075 40.9455 43.2715 41.5127C42.6573 42.932 40.3442 49.5012 39.5889 51.25C39.0225 52.5263 41.4309 53.5663 41.9502 52.29L42.4697 50.4941H47.1904C47.1826 50.5014 47.0689 50.6415 47.6631 52.2432C48.1828 53.5661 50.6375 52.6676 50.1182 51.2969C49.4099 49.4059 46.9082 42.507 46.4355 41.5127C46.2467 41.04 45.4908 40.7559 44.7354 40.7559ZM67.4932 42.5518C68.0586 41.9842 66.3128 40.2365 65.7461 40.8027C65.1824 41.3201 61.3934 45.1608 61.3555 45.1992C61.3559 45.1766 61.4025 42.7822 61.3555 41.4648C61.3554 40.945 60.741 40.709 60.0801 40.709C59.4191 40.709 58.7109 40.9924 58.7109 41.5596C58.7581 42.5523 58.6641 51.4363 58.6641 52.1006C58.6641 53.1405 61.3076 53.1405 61.3076 52.1006V48.6025L62.0635 47.9883L65.5098 52.5732C66.218 53.4714 68.3426 51.8644 67.6816 50.9189L64.0938 46.1445C64.1224 46.1137 66.5544 43.4916 67.4932 42.5518ZM32.5547 40.6611C31.0438 40.6611 31.0438 43.1191 32.5547 43.1191H35.1514C35.1514 43.1191 35.1514 50.2092 35.1514 51.8643C35.1514 53.046 37.8428 53.0933 37.8428 51.8643V43.2139H40.3916C41.9969 43.2139 41.9969 40.709 40.3916 40.709C38.6055 40.709 32.6109 40.6616 32.5547 40.6611ZM52.4316 40.709C51.6762 40.709 51.0146 41.1343 51.0146 41.8906V51.3447C51.0121 51.3643 50.8349 52.7626 52.0537 52.7627H57.2002C58.4277 52.7627 58.3805 50.21 57.2002 50.21H53.8008V41.8906C53.8008 41.0871 53.0926 40.709 52.4316 40.709ZM46.2939 48.083H43.3193L44.877 43.5918L46.2939 48.083Z" fill="#371D1E"/>
+</svg>

+ 4 - 0
assets/img/ic_naver.svg

@@ -0,0 +1,4 @@
+<svg width="100" height="100" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">
+<circle cx="50" cy="50" r="50" fill="#2DB400"/>
+<path d="M54.7634 36V49.8672L45.2639 36H35V63.4886H45.2366V49.6215L54.7361 63.4886H65V36H54.7634Z" fill="white"/>
+</svg>

+ 52 - 0
assets/scss/style.scss

@@ -6027,3 +6027,55 @@ body:has(.darkmode) {
   color:red;
   font-weight: 700;
 }
+
+
+.short--login--wrap{
+  border-top: 1px solid #ddd;
+  margin-top:55px;
+  padding-top:35px;
+  position: relative;
+
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  gap:20px;
+
+  &:after{
+    content:'간편 로그인';
+    display: inline-block;
+    padding:5px 10px;
+    background: #fff;
+    position: absolute;
+    top: -13px;
+    left: 50%;
+    transform: translateX(-50%);
+    font-size: 15px;
+    font-weight: 700;
+    color: #333;
+    z-index: 1;
+  }
+
+  .v-btn{    
+    display: flex;
+    align-items: center;
+    justify-content: center;    
+    border-radius: 100px;
+    padding:0px!important;
+    min-width: 70px;
+    width:70px;
+    height:70px!important;
+    box-shadow: none;
+
+    background-size: contain!important;
+    &.btn--google{
+      background: url(../img/ic_google.svg) no-repeat center;
+    }
+    &.btn--kakao{      
+      background: url(../img/ic_kakao.svg) no-repeat center;
+    }
+    &.btn--naver{      
+      background: url(../img/ic_naver.svg) no-repeat center;
+    }
+  }
+
+}

+ 1 - 1
middleware/auth.global.js

@@ -3,7 +3,7 @@ import { useAuthStore } from '@/stores/auth'
 export default defineNuxtRouteMiddleware(async (to, from) => {
   const { $log } = useNuxtApp()
   // 로그인 없이 접근 가능한 페이지 배열에 '/roulette' 추가
-  const tokenPassPages = ['/', '/roulette','/roulette/']
+  const tokenPassPages = ['/', '/roulette','/roulette/','/auth/popupClose','auth/popupClose']
   //let accountValue = useAuthStore().getAccountRole.charAt(0).toUpperCase()
 
   // 1. 로그인 없이 접근 가능한 페이지 예외 허용 (이미 로그인 상태면 메인으로 이동)

+ 26 - 0
pages/auth/popupClose.vue

@@ -0,0 +1,26 @@
+<script setup>
+  import { onMounted } from "vue";
+
+  onMounted(() => {
+    const q = new URLSearchParams(window.location.search);
+    const accessToken = q.get("accessToken");
+    const refreshToken = q.get("refreshToken");
+    const user = q.get("user") ? JSON.parse(decodeURIComponent(q.get("user"))) : null;
+    if (accessToken && window.opener) {
+      window.opener.postMessage(
+        {
+          accessToken,
+          refreshToken,
+          user,
+        },
+        "https://shopdeli.mycafe24.com"
+      );
+
+      window.close();
+    }
+  });
+</script>
+
+<template>
+  <div>로그인 완료, 창을 닫습니다...</div>
+</template>

+ 47 - 16
pages/index.vue

@@ -73,7 +73,9 @@
           >
         </div>
         <div class="short--login--wrap">
-          <v-btn @click="onGoogleLogin">구글 로그인</v-btn>
+          <v-btn class="btn--google" @click="onGoogleLogin"></v-btn>
+          <v-btn class="btn--kakao"></v-btn>
+          <v-btn class="btn--naver"></v-btn>
         </div>
       </div>
     </div>
@@ -317,19 +319,22 @@ import { useI18n } from "vue-i18n";
 
   // onMounted
   onMounted(() => {
-    //loginForm.value.userAgent = $userAgent;
-    // if (loginForm.value.authType === "GOOGLE") {
-    //   selectPlaceholder.value = i18n.t("login.googleOTPNum");
-    // } else if (loginForm.value.authType === "EMAIL") {
-    //   selectPlaceholder.value = i18n.t("login.emailAuthNum");
-    // } else {
-    //   selectPlaceholder.value = i18n.t("login.smsAuthNum");
-    // }
-    // let saveId = localStorage.getItem("saveId");
-    // if (saveId) {
-    //   checkbox.value = true;
-    //   loginForm.value.username = saveId;
-    // }
+    const handler = (event) => {
+      if (event.origin !== "https://shopdeli.mycafe24.com") return;
+      if (event.data?.accessToken) {
+        useAuthStore().setAuth(event.data);
+        useAuthStore().setAccessToken(event.data.accessToken);
+        useAuthStore().setRefreshToken(event.data.refreshToken);
+        localStorage.setItem("tempAccess", event.data.user?.ID);
+        useUtil.setPageMove("/view/event/evtList");
+        useStore.menuInfo.menuIndex = "0";
+        useStore.menuInfo.menuId = "menu02";
+        useStore.menuInfo.pageRtName = "이벤트 관리";
+        useStore.menuInfo.pageStatus = null;
+      }
+    };
+    window.addEventListener("message", handler);
+    onBeforeUnmount(() => window.removeEventListener("message", handler));
   });
 
   watchEffect(() => {
@@ -805,14 +810,40 @@ import { useI18n } from "vue-i18n";
       "373780605211-diojebh7mug45urv9rnqdil6n0b1ogge.apps.googleusercontent.com"; // 실제 클라이언트 ID로 교체
     const redirectUri = "https://shopdeli.mycafe24.com/auth/callback"; // 실제 리디렉션 URI로 교체
     const scope = "openid email profile";
-    const responseType = "token"; // 또는 'code' (백엔드 연동 시)
+    const responseType = "code"; // 또는 'code' (백엔드 연동 시)
     const state = Math.random().toString(36).substring(2);
 
     const googleAuthUrl = `https://accounts.google.com/o/oauth2/v2/auth?client_id=${clientId}&redirect_uri=${encodeURIComponent(
       redirectUri
     )}&response_type=${responseType}&scope=${encodeURIComponent(scope)}&state=${state}`;
 
-    window.location.href = googleAuthUrl;
+    const width = 500;
+    const height = 600;
+    const dualScreenLeft =
+      window.screenLeft !== undefined ? window.screenLeft : window.screenX;
+    const dualScreenTop =
+      window.screenTop !== undefined ? window.screenTop : window.screenY;
+
+    const currentWidth = window.innerWidth
+      ? window.innerWidth
+      : document.documentElement.clientWidth
+      ? document.documentElement.clientWidth
+      : screen.width;
+
+    const currentHeight = window.innerHeight
+      ? window.innerHeight
+      : document.documentElement.clientHeight
+      ? document.documentElement.clientHeight
+      : screen.height;
+
+    const left = dualScreenLeft + (currentWidth - width) / 2;
+    const top = dualScreenTop + (currentHeight - height) / 2;
+
+    window.open(
+      googleAuthUrl,
+      "googleLogin",
+      `width=${width},height=${height},left=${left},top=${top},resizable=yes,scrollbars=yes`
+    );
   }
 
   /**