index.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941
  1. <template>
  2. <div class="login-wrap">
  3. <div class="login--gate" v-show="loginVisible == 'Y'">
  4. <div class="gate-container">
  5. <div
  6. class="gate-card influencer-gate"
  7. :class="gate1 ? 'actv' : ''"
  8. @mouseover="handleInfluenceMove"
  9. @click.stop="location('influence')"
  10. @mouseleave="gate1 = false"
  11. >
  12. <div class="gate-icon">
  13. <div class="icon-circle influencer-bg">
  14. ❤️
  15. </div>
  16. </div>
  17. <div class="gate-content">
  18. <h3>인플루언서</h3>
  19. <p>크리에이터와 함께하세요</p>
  20. </div>
  21. </div>
  22. <div
  23. @click.stop="location('vendor')"
  24. class="gate-card vendor-gate"
  25. :class="gate2 ? 'actv' : ''"
  26. @mouseover="handleVendorMove"
  27. @mouseleave="gate2 = false"
  28. >
  29. <div class="gate-icon">
  30. <div class="icon-circle vendor-bg">
  31. 🛍️
  32. </div>
  33. </div>
  34. <div class="gate-content" >
  35. <h3>벤더사</h3>
  36. <p>상품을 판매해보세요</p>
  37. </div>
  38. </div>
  39. <div
  40. @click.stop="location('brand')"
  41. class="gate-card brand-gate"
  42. :class="gate3 ? 'actv' : ''"
  43. @mouseover="handleBrandMove"
  44. @mouseleave="gate3 = false"
  45. >
  46. <div class="gate-icon">
  47. <div class="icon-circle brand-bg">
  48. 💎
  49. </div>
  50. </div>
  51. <div class="gate-content">
  52. <h3>브랜드사</h3>
  53. <p>브랜드를 성장시켜보세요</p>
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. <div class="login--cock" v-show="loginVisible == 'N'">
  59. <!-- header -->
  60. <div class="login--header">
  61. <div class="login--header--l">
  62. <div class="logo">
  63. SHOPDELI
  64. </div>
  65. </div>
  66. <div class="login--header--r"></div>
  67. </div>
  68. <!-- login -->
  69. <div class="login-box">
  70. <div class="login-l">
  71. <div class="login-l-center">
  72. <span class="logo">
  73. <!-- prettier-ignore -->
  74. SHOPDELI
  75. </span>
  76. <!-- <p>We Make Scalable Mobility Life</p> -->
  77. </div>
  78. </div>
  79. <div class="login-r">
  80. <div class="tit-login">
  81. <strong>{{ route.query.type == 'brand' ? '브랜드사' : route.query.type == 'vendor' ? '벤더사' : '' }} 로그인</strong>
  82. </div>
  83. <div class="login-input-wrap">
  84. <div
  85. class="txt-field-box"
  86. :class="!loginForm.validCheck.input.userId ? 'error' : ''"
  87. >
  88. <v-text-field
  89. v-model="loginForm.userId"
  90. placeholder="아이디를 입력해주세요"
  91. class="custom-input"
  92. @keyup.enter="
  93. loginAction(loginForm.userId, loginForm.passwd, loginForm.loginType)
  94. "
  95. @input="setInputField('main_userId')"
  96. ></v-text-field>
  97. <i class="ico"></i>
  98. </div>
  99. <div
  100. class="txt-field-box"
  101. :class="!loginForm.validCheck.input.passwd ? 'error' : ''"
  102. >
  103. <v-text-field
  104. v-model="loginForm.passwd"
  105. :type="visible ? 'text' : 'password'"
  106. placeholder="비밀번호를 입력해주세요"
  107. class="custom-input"
  108. id="password"
  109. @keyup.enter="
  110. loginAction(loginForm.userId, loginForm.passwd, loginForm.loginType)
  111. "
  112. @input="setInputField('main_passwd')"
  113. ></v-text-field>
  114. <i
  115. class="ico-eye"
  116. @click.stop="toggleVisibility"
  117. :class="visible ? 'eye-on' : 'eye-off'"
  118. ></i>
  119. <i class="ico"></i>
  120. </div>
  121. <!-- <p class="error-txt" v-if="!loginForm.validCheck.inputErrorCheck">
  122. {{ loginForm.validCheck.passwd }}
  123. </p> -->
  124. </div>
  125. <div class="login-btn-wrap">
  126. <v-btn
  127. v-if="loginForm.loginType == 'influence'"
  128. class="custom-btn btn-blue"
  129. @keyup.enter="loginAction(loginForm.userId, loginForm.passwd, 'influence')"
  130. @click="loginAction(loginForm.userId, loginForm.passwd, 'influence')"
  131. >로그인</v-btn
  132. >
  133. <v-btn
  134. v-else-if="loginForm.loginType == 'vendor'"
  135. class="custom-btn btn-blue"
  136. @keyup.enter="loginAction(loginForm.userId, loginForm.passwd, 'vendor')"
  137. @click="loginAction(loginForm.userId, loginForm.passwd, 'vendor')"
  138. >로그인</v-btn
  139. >
  140. <v-btn
  141. v-else-if="loginForm.loginType == 'brand'"
  142. class="custom-btn btn-blue"
  143. @keyup.enter="loginAction(loginForm.userId, loginForm.passwd, 'brand')"
  144. @click="loginAction(loginForm.userId, loginForm.passwd, 'brand')"
  145. >로그인</v-btn
  146. >
  147. </div>
  148. <div class="join--btn--wrap">
  149. <v-btn class="custom-btn text--btn" @click="showComingSoon">아이디 찾기</v-btn>
  150. <v-btn class="custom-btn text--btn" @click="showComingSoon">비밀번호 찾기</v-btn>
  151. <v-btn class="custom-btn text--btn" @click="location('join')">회원가입</v-btn>
  152. </div>
  153. <div class="short--login--wrap" v-if="loginForm.loginType == 'influence'">
  154. <v-btn class="btn--google" @click.stop="onGoogleLogin"></v-btn>
  155. <v-btn class="btn--kakao" @click.stop="onKakaoLogin"></v-btn>
  156. <v-btn class="btn--naver" @click.stop="onNaverLogin"></v-btn>
  157. </div>
  158. </div>
  159. </div>
  160. <!-- footer -->
  161. <div class="login-footer">
  162. <div class="login--footer--l">
  163. <p>COPYRIGHT@2025 SHOPDELI INC. ALL RIGHTS RESERVED.</p>
  164. <p>마포구 합정동</p>
  165. </div>
  166. </div>
  167. </div>
  168. </div>
  169. </template>
  170. <script setup>
  171. /************************
  172. * import
  173. ************************/
  174. //import PrivacyPop from "@/components/login/privacyPop.vue";
  175. //import AgrNPop from "@/components/terms/agreeNListPop.vue";
  176. import { useI18n } from "vue-i18n";
  177. /************************
  178. * layout setting
  179. ************************/
  180. definePageMeta({
  181. layout: "loginlayout",
  182. });
  183. /************************
  184. * plugins inject
  185. ************************/
  186. const { $dayjs, $log, $eventBus, $toast, $userAgent } = useNuxtApp();
  187. const useStore = useDetailStore();
  188. const route = useRoute();
  189. /************************
  190. * data & created
  191. ************************/
  192. // 현재 입력 중인 필드를 설정하는 함수
  193. const setInputField = (name) => {
  194. fnValidCheck(name);
  195. };
  196. const pageId = "login";
  197. const gate1 = ref(false);
  198. const gate2 = ref(false);
  199. const gate3 = ref(false);
  200. const loginVisible = ref("N");
  201. const i18n = useI18n();
  202. // 다국어
  203. let listObj = ref({
  204. langTypeList: {},
  205. });
  206. // 로그인 정보
  207. const loginForm = ref({
  208. userId: "",
  209. passwd: "",
  210. otpNum: "",
  211. username: "",
  212. authType: "GOOGLE",
  213. userAgent: "",
  214. loginType: "",
  215. validCheck: {
  216. input: {
  217. userId: true,
  218. passwd: true,
  219. },
  220. otp: {
  221. otpNum: true,
  222. },
  223. inputErrorCheck: true,
  224. inputValidTxt: "",
  225. otpValidTxt: "",
  226. loginValidCheck: false,
  227. btnTxt: "",
  228. btnTxtType: "",
  229. },
  230. });
  231. // 구글 OTP 1차 팝업
  232. const authPop1 = ref({
  233. popYn: false,
  234. certifyYN: false,
  235. userId: "",
  236. passwd: "",
  237. otpNum: "",
  238. validOtpKey: true,
  239. validOtpTxt: "",
  240. btnTxt: "",
  241. btnTxtType: "",
  242. applyBtn: false,
  243. succOtpYn: false,
  244. businessName: "",
  245. agreeChk1: false,
  246. agreeChk2: false,
  247. validCheck: {
  248. userId: true,
  249. passwd: true,
  250. },
  251. validTxt: "",
  252. errorCheck: false,
  253. });
  254. // 구글 OTP 2차 팝업
  255. const authPop2 = ref({
  256. popYn: false,
  257. otpNum: "",
  258. validOtpKey: true,
  259. validOtpTxt: "",
  260. errorCheck: false,
  261. });
  262. // 아이디 찾기
  263. const findId = ref({
  264. popYn: false,
  265. //tenantName: '',
  266. email: "",
  267. otpNum: "",
  268. validCheck: {
  269. input: {
  270. //tenantName: true,
  271. email: true,
  272. },
  273. otp: {
  274. otpNum: true,
  275. },
  276. inputErrorCheck: true,
  277. inputValidTxt: "",
  278. otpValidTxt: "",
  279. findIdValidCheck: false,
  280. },
  281. btnTxt: "",
  282. });
  283. // 비밀번호 초기화
  284. const resetPw = ref({
  285. popYn: false,
  286. userId: "",
  287. email: "",
  288. otpNum: "",
  289. validCheck: {
  290. input: {
  291. userId: true,
  292. email: true,
  293. },
  294. otp: {
  295. otpNum: true,
  296. },
  297. inputErrorCheck: true,
  298. inputValidTxt: "",
  299. otpValidTxt: "",
  300. resetPwValidCheck: false,
  301. },
  302. btnTxt: "",
  303. });
  304. // 초기 패스워드 변경
  305. const initPw = ref({
  306. popYn: false,
  307. passwd: "",
  308. passwd2: "",
  309. validCheck: {
  310. passwd: true,
  311. passwd2: true,
  312. },
  313. passwdCheck: false,
  314. errorTxt: "",
  315. });
  316. const selectPlaceholder = ref("");
  317. const initAuthPop1 = ref({});
  318. const initAuthPop2 = ref({});
  319. const initFindId = ref({});
  320. const initResetPw = ref({});
  321. const initInitPw = ref({});
  322. const googleOtpQrCode = ref("");
  323. const googleOtpSecretKey = ref("");
  324. const loginInfo = ref({});
  325. const checkbox = ref(false);
  326. const langType = ref("");
  327. const toggleVisibility = () => {
  328. visible.value = !visible.value;
  329. };
  330. const visible = ref(false);
  331. const isAgrNPop = ref(false);
  332. const isShowAgrNPop = ref(false);
  333. let saveId = localStorage.getItem("saveId");
  334. if (saveId) {
  335. checkbox.value = true;
  336. loginForm.value.userId = saveId;
  337. }
  338. const handleInfluenceMove = (event) => {
  339. gate1.value = true;
  340. gate2.value = false;
  341. gate3.value = false;
  342. };
  343. const handleVendorMove = (event) => {
  344. gate2.value = true;
  345. gate1.value = false;
  346. gate3.value = false;
  347. };
  348. const handleBrandMove = (event) => {
  349. gate3.value = true;
  350. gate1.value = false;
  351. gate2.value = false;
  352. };
  353. // 개인정보처리방침 이용약관 팝업
  354. //const privacyPop = ref(false);
  355. const privacyDetail = ref({
  356. kr: {
  357. title: "",
  358. contents: "",
  359. },
  360. en: {
  361. title: "",
  362. contents: "",
  363. },
  364. });
  365. const systemInfo = ref({
  366. mode: "",
  367. });
  368. const loginAction = (__ID, __PASS, __TYPE) => {
  369. let _req = {
  370. id: __ID,
  371. password: __PASS,
  372. logintype: __TYPE,
  373. };
  374. useAxios()
  375. .post("/roulette/login", _req)
  376. .then((res) => {
  377. if (res.data) {
  378. // console.log(res.data);
  379. useAuthStore().setAuth(res.data);
  380. useAuthStore().setAccessToken(res.data.accessToken);
  381. useAuthStore().setRefreshToken(res.data.refreshToken);
  382. // 디버깅: 로그인 후 사용자 정보 확인
  383. console.log('=== 로그인 성공 디버깅 ===');
  384. console.log('원본 데이터:', res.data);
  385. console.log('설정된 auth 정보:', useAuthStore().auth);
  386. console.log('COMPANY_NUMBER:', useAuthStore().auth.companyNumber);
  387. console.log('memberType:', useAuthStore().auth.memberType);
  388. console.log('===========================');
  389. localStorage.setItem("tempAccess", __ID);
  390. // vendor/brand 타입이면 dashboard로, 그 외에는 기존 item 페이지로
  391. const memberType = useAuthStore().auth.memberType;
  392. if (memberType === 'VENDOR' || memberType === 'BRAND') {
  393. useUtil.setPageMove("/view/common/dashboard");
  394. useStore.menuInfo.menuIndex = "0";
  395. useStore.menuInfo.menuId = "menu00";
  396. useStore.menuInfo.pageRtName = "대시보드";
  397. useStore.menuInfo.pageStatus = null;
  398. } else {
  399. useUtil.setPageMove("/view/common/item");
  400. useStore.menuInfo.menuIndex = "0";
  401. useStore.menuInfo.menuId = "menu01";
  402. useStore.menuInfo.pageRtName = "제품 관리";
  403. useStore.menuInfo.pageStatus = null;
  404. }
  405. }
  406. })
  407. .catch((error) => {
  408. if (error.response) {
  409. console.log("status:", error.response.status, "data:", error.response.data);
  410. // 안전하게 errCode, message 접근
  411. const errData = error.response.data || {};
  412. const errCode = errData.errCode || errData.errorCode || errData.code || "";
  413. const errMsg = errData.message || "알 수 없는 오류가 발생했습니다.";
  414. console.log("errCode:", errCode, "message:", errMsg);
  415. } else {
  416. console.log("error:", error.message, error.code);
  417. }
  418. if (error.response?.status) {
  419. fnLoginSet(error.response.data.messages.message);
  420. }
  421. $log.debug("[login][fnIdPwCheck][error]");
  422. })
  423. .finally(() => {
  424. $log.debug("[login][fnIdPwCheck][finished]");
  425. });
  426. };
  427. const location = (__id) => {
  428. switch (__id) {
  429. case "join":
  430. useUtil.setPageMove("/auth/join?type=" + loginForm.value.loginType);
  431. break;
  432. case "findId":
  433. findId.value.popYn = true;
  434. break;
  435. case "resetPw":
  436. resetPw.value.popYn = true;
  437. break;
  438. case "influence":
  439. useUtil.setPageMove("/?type=influence");
  440. loginVisible.value = "Y";
  441. break;
  442. case "vendor":
  443. useUtil.setPageMove("/?type=vendor");
  444. loginVisible.value = "N";
  445. break;
  446. case "brand":
  447. useUtil.setPageMove("/?type=brand");
  448. loginVisible.value = "N";
  449. break;
  450. default:
  451. break;
  452. }
  453. };
  454. // onMounted
  455. onMounted(() => {
  456. //로그인페이지 접근시 파라미터 체크하여 인플루언서, 밴더 구분
  457. const typeParam = route.query.type;
  458. if (typeParam == "influence") {
  459. loginForm.value.loginType = "influence";
  460. } else if (typeParam == "vendor") {
  461. loginForm.value.loginType = "vendor";
  462. } else if (typeParam == "brand") {
  463. loginForm.value.loginType = "brand";
  464. } else {
  465. loginVisible.value = "Y";
  466. }
  467. //구글 인증 프로세스
  468. function handleMessage(event) {
  469. const appBaseUrl = import.meta.env.VITE_APP_API_URL;
  470. // 개발환경이면 아래처럼 확인
  471. const allowedOrigins = [
  472. "http://0.0.0.0:3000",
  473. "http://localhost:3000",
  474. appBaseUrl,
  475. ].filter(Boolean);
  476. if (allowedOrigins.includes(event.origin)) {
  477. const { accessToken, refreshToken, user } = event.data;
  478. if (user?.JOIN === "1") {
  479. useAuthStore().setTempData(user);
  480. useUtil.setPageMove("/auth/join?type=" + loginForm.value.loginType);
  481. } else {
  482. // SNS 로그인 성공 시 인증 정보 제대로 설정
  483. const authData = {
  484. refreshToken: refreshToken,
  485. user: user,
  486. };
  487. // setAuth를 호출하여 auth 스토어에 사용자 정보 저장
  488. useAuthStore().setAuth(authData);
  489. useAuthStore().setTempData(authData);
  490. useAuthStore().setAccessToken(accessToken);
  491. useAuthStore().setRefreshToken(refreshToken);
  492. localStorage.setItem("tempAccess", user.ID || user.id || user.SEQ);
  493. useUtil.setPageMove("/view/common/item");
  494. useStore.menuInfo.menuIndex = "0";
  495. useStore.menuInfo.menuId = "menu02";
  496. useStore.menuInfo.pageRtName = "이벤트 관리";
  497. useStore.menuInfo.pageStatus = null;
  498. }
  499. }
  500. }
  501. window.addEventListener("message", handleMessage);
  502. onBeforeUnmount(() => window.removeEventListener("message", handleMessage));
  503. });
  504. watch(
  505. () => route.query.type,
  506. (newType) => {
  507. if (newType === "influence" || newType === "vendor" || newType === "brand") {
  508. loginForm.value.loginType = newType;
  509. loginVisible.value = "N"; // 로그인 폼 보이기
  510. } else {
  511. loginVisible.value = "Y"; // 게이트 페이지 보이기
  512. }
  513. },
  514. {
  515. immediate: true, // 컴포넌트가 마운트될 때 즉시 실행
  516. }
  517. );
  518. watchEffect(() => {
  519. // 감시하고자 하는 데이터를 해당 블럭내에서 사용하면 호출된다.
  520. // getLang.value를 감시하는 상태
  521. //QfnGetEnumCode(useLangStore().getLang);
  522. });
  523. // $eventBus.off("SET_SUCCESS_POPUP");
  524. // $eventBus.on("SET_SUCCESS_POPUP", () => {
  525. // // 안내 팝업 확인 클릭 팝업 초기화처리
  526. // fnOtpPopClose("findId");
  527. // fnOtpPopClose("resetPw");
  528. // });
  529. // $eventBus.off("PASSWD_CHANGE");
  530. // $eventBus.on("PASSWD_CHANGE", () => {
  531. // fnPasswdChange();
  532. // });
  533. // $eventBus.off("INIT_PASSWORD");
  534. // $eventBus.on("INIT_PASSWORD", () => {
  535. // initPw.value.popYn = true;
  536. // });
  537. // $eventBus.off("SET_LOGIN");
  538. // $eventBus.on("SET_LOGIN", () => {
  539. // fnLogin();
  540. // });
  541. /************************
  542. * Methods
  543. ************************/
  544. const showComingSoon = () => {
  545. $eventBus.emit('OPEN_CONFIRM_POP_UP', {
  546. id: 'coming-soon',
  547. title: '안내',
  548. content: '준비중입니다.',
  549. yes: {
  550. text: '확인',
  551. isProc: false
  552. }
  553. });
  554. };
  555. const fnLoginSet = (__MSG) => {
  556. let param = {
  557. id: pageId,
  558. title: "로그인",
  559. content: __MSG,
  560. yes: {
  561. text: "확인",
  562. isProc: true,
  563. event: "FN_LOGIN",
  564. param: "",
  565. },
  566. };
  567. $eventBus.emit("OPEN_CONFIRM_POP_UP", param);
  568. };
  569. // 구글 로그인 인증 시퀀스
  570. function onGoogleLogin() {
  571. const appBaseUrl = import.meta.env.VITE_APP_API_URL;
  572. const clientId =
  573. "373780605211-diojebh7mug45urv9rnqdil6n0b1ogge.apps.googleusercontent.com"; // 실제 클라이언트 ID로 교체
  574. //const redirectUri = "https://shopdeli.mycafe24.com/auth/callback"; // 실제 리디렉션 URI로 교체
  575. const redirectUri = `${appBaseUrl}/auth/callback`;
  576. const scope = "openid email profile";
  577. const responseType = "code"; // 또는 'code' (백엔드 연동 시)
  578. const state = Math.random().toString(36).substring(2);
  579. const googleAuthUrl = `https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&client_id=${clientId}&redirect_uri=${encodeURIComponent(
  580. redirectUri
  581. )}&response_type=${responseType}&scope=${encodeURIComponent(scope)}&state=${state}`;
  582. const width = 500;
  583. const height = 600;
  584. const dualScreenLeft =
  585. window.screenLeft !== undefined ? window.screenLeft : window.screenX;
  586. const dualScreenTop =
  587. window.screenTop !== undefined ? window.screenTop : window.screenY;
  588. const currentWidth = window.innerWidth
  589. ? window.innerWidth
  590. : document.documentElement.clientWidth
  591. ? document.documentElement.clientWidth
  592. : screen.width;
  593. const currentHeight = window.innerHeight
  594. ? window.innerHeight
  595. : document.documentElement.clientHeight
  596. ? document.documentElement.clientHeight
  597. : screen.height;
  598. const left = dualScreenLeft + (currentWidth - width) / 2;
  599. const top = dualScreenTop + (currentHeight - height) / 2;
  600. window.open(
  601. googleAuthUrl,
  602. "googleLogin",
  603. `width=${width},height=${height},left=${left},top=${top},resizable=yes,scrollbars=yes`
  604. );
  605. }
  606. //카카오 인증 시퀀스
  607. function onKakaoLogin() {
  608. const appBaseUrl = import.meta.env.VITE_APP_API_URL;
  609. const kakaoAuthUrl = `${appBaseUrl}/auth/kakaoLogin`; // 실제 리디렉션 URI로 교체
  610. const width = 500;
  611. const height = 600;
  612. const dualScreenLeft =
  613. window.screenLeft !== undefined ? window.screenLeft : window.screenX;
  614. const dualScreenTop =
  615. window.screenTop !== undefined ? window.screenTop : window.screenY;
  616. const currentWidth = window.innerWidth
  617. ? window.innerWidth
  618. : document.documentElement.clientWidth
  619. ? document.documentElement.clientWidth
  620. : screen.width;
  621. const currentHeight = window.innerHeight
  622. ? window.innerHeight
  623. : document.documentElement.clientHeight
  624. ? document.documentElement.clientHeight
  625. : screen.height;
  626. const left = dualScreenLeft + (currentWidth - width) / 2;
  627. const top = dualScreenTop + (currentHeight - height) / 2;
  628. window.open(
  629. kakaoAuthUrl,
  630. "kakaoLogin",
  631. `width=${width},height=${height},left=${left},top=${top},resizable=yes,scrollbars=yes`
  632. );
  633. }
  634. //네이버 인증 시퀀스
  635. function onNaverLogin() {
  636. const appBaseUrl = import.meta.env.VITE_APP_API_URL;
  637. const naverAuthUrl = `${appBaseUrl}/auth/naverLogin`; // 실제 리디렉션 URI로 교체
  638. const width = 500;
  639. const height = 600;
  640. const dualScreenLeft =
  641. window.screenLeft !== undefined ? window.screenLeft : window.screenX;
  642. const dualScreenTop =
  643. window.screenTop !== undefined ? window.screenTop : window.screenY;
  644. const currentWidth = window.innerWidth
  645. ? window.innerWidth
  646. : document.documentElement.clientWidth
  647. ? document.documentElement.clientWidth
  648. : screen.width;
  649. const currentHeight = window.innerHeight
  650. ? window.innerHeight
  651. : document.documentElement.clientHeight
  652. ? document.documentElement.clientHeight
  653. : screen.height;
  654. const left = dualScreenLeft + (currentWidth - width) / 2;
  655. const top = dualScreenTop + (currentHeight - height) / 2;
  656. window.open(
  657. naverAuthUrl,
  658. "naverLogin",
  659. `width=${width},height=${height},left=${left},top=${top},resizable=yes,scrollbars=yes`
  660. );
  661. }
  662. /**
  663. * @API
  664. * 최종 로그인 버튼 클릭 시 API
  665. */
  666. function fnLogin(__USERID, __USERPASS) {
  667. // 파라미터 전달 값 [아이디, 비밀번호, otpNum, 브라우저정보]
  668. //userId: loginForm.value.userId,
  669. // let _req = {
  670. // username: loginForm.value.userId,
  671. // password: btoa(loginForm.value.passwd),
  672. // };
  673. localStorage.setItem("tempAccess", __USERID);
  674. if (__USERID == "admin" && __USERPASS == "1234") {
  675. useUtil.setPageMove("/view/media/newsList");
  676. } else {
  677. fnLoginSet("비밀번호가 맞지 않습니다. 확인해주세요.");
  678. }
  679. // useAxios()
  680. // .post(apiUrl.otpCheck, _req)
  681. // .then((res) => {
  682. // loginInfo.value = res.data.data;
  683. // useAuthStore().setAccessToken(loginInfo.value.accessToken);
  684. // useAuthStore().setRefreshToken(loginInfo.value.refreshToken);
  685. // // OTP key체크 성공 후 개인정보에 대한 API를 호출 한다.
  686. // fnServiceModeCheck();
  687. // $log.debug("[login][fnLogin][success]");
  688. // })
  689. // .catch((error) => {
  690. // $log.debug("[login][fnLogin][error]");
  691. // let errorData = error.response.data;
  692. // errorData.type = "fnLogin";
  693. // fnLoginFail(errorData);
  694. // })
  695. // .finally(() => {
  696. // $log.debug("[login][fnLogin][finished]");
  697. // });
  698. }
  699. /**
  700. * @SCRIPT
  701. * 비밀번호확인 validation
  702. */
  703. function fnValidCheck(type) {
  704. // 아이디 체크
  705. if (type === "id") {
  706. const id = loginForm.value.userId;
  707. // 1. 기본 유효성 검사
  708. if (!id) {
  709. $toast.error("아이디를 입력해주세요.");
  710. return false;
  711. }
  712. // 2. 아이디 형식 검사 (영문, 숫자 조합 6~20자)
  713. const idRegex = /^[a-zA-Z0-9]{6,20}$/;
  714. if (!idRegex.test(id)) {
  715. $toast.error("아이디는 영문, 숫자 조합 6~20자로 입력해주세요.");
  716. return false;
  717. }
  718. }
  719. // 다른 유효성 검사가 필요한 경우 여기에 추가
  720. return true;
  721. }
  722. </script>
  723. <style scoped>
  724. /* 게이트 컨테이너 */
  725. .gate-container {
  726. width: 100%;
  727. display: flex;
  728. justify-content: center;
  729. align-items: center;
  730. gap: 1rem;
  731. min-height: 100vh;
  732. padding: 2rem;
  733. }
  734. /* 게이트 카드 */
  735. .gate-card {
  736. background: white;
  737. border-radius: 20px;
  738. padding: 2.5rem 2rem;
  739. text-align: center;
  740. box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  741. transition: all 0.3s ease;
  742. cursor: pointer;
  743. position: relative;
  744. overflow: hidden;
  745. width: 18rem;
  746. min-height: 320px;
  747. display: flex;
  748. flex-direction: column;
  749. justify-content: center;
  750. }
  751. .gate-card:hover {
  752. transform: translateY(-10px);
  753. box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  754. }
  755. .gate-card.actv {
  756. transform: translateY(-15px) scale(1.05);
  757. box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
  758. }
  759. /* 게이트 아이콘 */
  760. .gate-icon {
  761. margin-bottom: 1.5rem;
  762. }
  763. .icon-circle {
  764. width: 80px;
  765. height: 80px;
  766. border-radius: 50%;
  767. display: flex;
  768. align-items: center;
  769. justify-content: center;
  770. font-size: 2.5rem;
  771. margin: 0 auto;
  772. transition: all 0.3s ease;
  773. }
  774. .influencer-bg {
  775. background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
  776. }
  777. .vendor-bg {
  778. background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
  779. }
  780. .brand-bg {
  781. background: linear-gradient(135deg, #d299c2 0%, #fef9d7 100%);
  782. }
  783. .gate-card:hover .icon-circle {
  784. transform: scale(1.1);
  785. }
  786. /* 게이트 콘텐츠 */
  787. .gate-content h3 {
  788. font-size: 1.5rem;
  789. font-weight: 700;
  790. color: #333;
  791. margin-bottom: 0.5rem;
  792. }
  793. .gate-content p {
  794. color: #666;
  795. font-size: 1rem;
  796. margin-bottom: 2rem;
  797. line-height: 1.5;
  798. }
  799. /* 게이트 버튼 */
  800. .gate-btn {
  801. border-radius: 25px !important;
  802. padding: 12px 30px !important;
  803. font-weight: 600 !important;
  804. text-transform: none !important;
  805. transition: all 0.3s ease !important;
  806. border: none !important;
  807. box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
  808. }
  809. .influencer-btn {
  810. background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%) !important;
  811. color: white !important;
  812. }
  813. .vendor-btn {
  814. background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%) !important;
  815. color: white !important;
  816. }
  817. .brand-btn {
  818. background: linear-gradient(135deg, #d299c2 0%, #fef9d7 100%) !important;
  819. color: white !important;
  820. }
  821. .gate-btn:hover {
  822. transform: translateY(-2px) !important;
  823. box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
  824. }
  825. /* 반응형 디자인 */
  826. @media (max-width: 768px) {
  827. .gate-container {
  828. flex-direction: column;
  829. gap: 1.5rem;
  830. padding: 1rem;
  831. }
  832. .gate-card {
  833. width: 100%;
  834. max-width: 300px;
  835. min-height: 280px;
  836. padding: 2rem 1.5rem;
  837. }
  838. .icon-circle {
  839. width: 60px;
  840. height: 60px;
  841. font-size: 2rem;
  842. }
  843. .gate-content h3 {
  844. font-size: 1.3rem;
  845. }
  846. .gate-content p {
  847. font-size: 0.9rem;
  848. margin-bottom: 1.5rem;
  849. }
  850. }
  851. /* 기존 스타일과 충돌 방지 */
  852. .login--gate {
  853. position: relative;
  854. z-index: 1;
  855. }
  856. </style>