index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729
  1. <template>
  2. <div class="login-wrap">
  3. <div class="login--gate" v-show="loginVisible == 'Y'">
  4. <div
  5. class="inf--gate"
  6. :class="gate1 ? 'actv' : ''"
  7. @mousemove.stop="handleInfluenceMove"
  8. >
  9. <div class="btn--contents">
  10. <h2>influence</h2>
  11. <v-btn class="loc--btn" @click.stop="location('influence')"
  12. >Discover more ></v-btn
  13. >
  14. </div>
  15. </div>
  16. <div
  17. class="ven--gate"
  18. :class="gate2 ? 'actv' : ''"
  19. @mousemove.stop="handleVendorMove"
  20. >
  21. <div class="btn--contents">
  22. <h2>vendor</h2>
  23. <v-btn class="loc--btn" @click.stop="location('vendor')">Discover more ></v-btn>
  24. </div>
  25. </div>
  26. </div>
  27. <div class="login--cock" v-show="loginVisible == 'N'">
  28. <!-- header -->
  29. <div class="login--header">
  30. <div class="login--header--l">
  31. <div class="logo">
  32. <!-- prettier-ignore -->
  33. SHOPDELI
  34. </div>
  35. </div>
  36. <div class="login--header--r"></div>
  37. </div>
  38. <!-- login -->
  39. <div class="login-box">
  40. <div class="login-l">
  41. <div class="login-l-center">
  42. <span class="logo">
  43. <!-- prettier-ignore -->
  44. SHOPDELI
  45. </span>
  46. <!-- <p>We Make Scalable Mobility Life</p> -->
  47. </div>
  48. </div>
  49. <div class="login-r">
  50. <div class="tit-login">
  51. <strong>로그인</strong>
  52. </div>
  53. <div class="login-input-wrap">
  54. <div
  55. class="txt-field-box"
  56. :class="!loginForm.validCheck.input.userId ? 'error' : ''"
  57. >
  58. <v-text-field
  59. v-model="loginForm.userId"
  60. placeholder="아이디를 입력해주세요"
  61. class="custom-input"
  62. @keyup.enter="loginAction(loginForm.userId, loginForm.passwd)"
  63. @input="setInputField('main_userId')"
  64. ></v-text-field>
  65. <i class="ico"></i>
  66. </div>
  67. <div
  68. class="txt-field-box"
  69. :class="!loginForm.validCheck.input.passwd ? 'error' : ''"
  70. >
  71. <v-text-field
  72. v-model="loginForm.passwd"
  73. :type="visible ? 'text' : 'password'"
  74. placeholder="비밀번호를 입력해주세요"
  75. class="custom-input"
  76. id="password"
  77. @keyup.enter="loginAction(loginForm.userId, loginForm.passwd)"
  78. @input="setInputField('main_passwd')"
  79. ></v-text-field>
  80. <i
  81. class="ico-eye"
  82. @click.stop="toggleVisibility"
  83. :class="visible ? 'eye-on' : 'eye-off'"
  84. ></i>
  85. <i class="ico"></i>
  86. </div>
  87. <!-- <p class="error-txt" v-if="!loginForm.validCheck.inputErrorCheck">
  88. {{ loginForm.validCheck.passwd }}
  89. </p> -->
  90. </div>
  91. <div class="login-btn-wrap">
  92. <v-btn
  93. v-if="loginForm.loginType == 'influence'"
  94. class="custom-btn btn-blue"
  95. @keyup.enter="loginAction(loginForm.userId, loginForm.passwd, 'influence')"
  96. @click="loginAction(loginForm.userId, loginForm.passwd, 'influence')"
  97. >로그인</v-btn
  98. >
  99. <v-btn
  100. v-else-if="loginForm.loginType == 'vendor'"
  101. class="custom-btn btn-blue"
  102. @keyup.enter="loginAction(loginForm.userId, loginForm.passwd, 'vendor')"
  103. @click="loginAction(loginForm.userId, loginForm.passwd, 'vendor')"
  104. >로그인</v-btn
  105. >
  106. </div>
  107. <div class="join--btn--wrap">
  108. <v-btn class="custom-btn text--btn">아이디 찾기</v-btn>
  109. <v-btn class="custom-btn text--btn">비밀번호 찾기</v-btn>
  110. <v-btn class="custom-btn text--btn" @click="location('join')">회원가입</v-btn>
  111. </div>
  112. <div class="short--login--wrap" v-if="loginForm.loginType == 'influence'">
  113. <v-btn class="btn--google" @click.stop="onGoogleLogin"></v-btn>
  114. <v-btn class="btn--kakao" @click.stop="onKakaoLogin"></v-btn>
  115. <v-btn class="btn--naver" @click.stop="onNaverLogin"></v-btn>
  116. </div>
  117. </div>
  118. </div>
  119. <!-- footer -->
  120. <div class="login-footer">
  121. <div class="login--footer--l">
  122. <p>COPYRIGHT@2025 SHOPDELI INC. ALL RIGHTS RESERVED.</p>
  123. <p>마포구 합정동</p>
  124. </div>
  125. </div>
  126. </div>
  127. </div>
  128. </template>
  129. <script setup>
  130. /************************
  131. * import
  132. ************************/
  133. //import PrivacyPop from "@/components/login/privacyPop.vue";
  134. //import AgrNPop from "@/components/terms/agreeNListPop.vue";
  135. import apiUrl from "@/composables/useApi";
  136. import QRCode from "qrcode";
  137. import { useI18n } from "vue-i18n";
  138. /************************
  139. * layout setting
  140. ************************/
  141. definePageMeta({
  142. layout: "loginlayout",
  143. });
  144. /************************
  145. * plugins inject
  146. ************************/
  147. const { $dayjs, $log, $eventBus, $toast, $userAgent } = useNuxtApp();
  148. const useStore = useDetailStore();
  149. const route = useRoute();
  150. /************************
  151. * data & created
  152. ************************/
  153. // 현재 입력 중인 필드를 설정하는 함수
  154. const setInputField = (name) => {
  155. fnValidCheck(name);
  156. };
  157. const pageId = "login";
  158. const gate1 = ref(false);
  159. const gate2 = ref(false);
  160. const loginVisible = ref("N");
  161. const i18n = useI18n();
  162. // 다국어
  163. let listObj = ref({
  164. langTypeList: {},
  165. });
  166. // 로그인 정보
  167. const loginForm = ref({
  168. userId: "",
  169. passwd: "",
  170. otpNum: "",
  171. username: "",
  172. authType: "GOOGLE",
  173. userAgent: "",
  174. loginType: "",
  175. validCheck: {
  176. input: {
  177. userId: true,
  178. passwd: true,
  179. },
  180. otp: {
  181. otpNum: true,
  182. },
  183. inputErrorCheck: true,
  184. inputValidTxt: "",
  185. otpValidTxt: "",
  186. loginValidCheck: false,
  187. btnTxt: "",
  188. btnTxtType: "",
  189. },
  190. });
  191. // 구글 OTP 1차 팝업
  192. const authPop1 = ref({
  193. popYn: false,
  194. certifyYN: false,
  195. userId: "",
  196. passwd: "",
  197. otpNum: "",
  198. validOtpKey: true,
  199. validOtpTxt: "",
  200. btnTxt: "",
  201. btnTxtType: "",
  202. applyBtn: false,
  203. succOtpYn: false,
  204. businessName: "",
  205. agreeChk1: false,
  206. agreeChk2: false,
  207. validCheck: {
  208. userId: true,
  209. passwd: true,
  210. },
  211. validTxt: "",
  212. errorCheck: false,
  213. });
  214. // 구글 OTP 2차 팝업
  215. const authPop2 = ref({
  216. popYn: false,
  217. otpNum: "",
  218. validOtpKey: true,
  219. validOtpTxt: "",
  220. errorCheck: false,
  221. });
  222. // 아이디 찾기
  223. const findId = ref({
  224. popYn: false,
  225. //tenantName: '',
  226. email: "",
  227. otpNum: "",
  228. validCheck: {
  229. input: {
  230. //tenantName: true,
  231. email: true,
  232. },
  233. otp: {
  234. otpNum: true,
  235. },
  236. inputErrorCheck: true,
  237. inputValidTxt: "",
  238. otpValidTxt: "",
  239. findIdValidCheck: false,
  240. },
  241. btnTxt: "",
  242. });
  243. // 비밀번호 초기화
  244. const resetPw = ref({
  245. popYn: false,
  246. userId: "",
  247. email: "",
  248. otpNum: "",
  249. validCheck: {
  250. input: {
  251. userId: true,
  252. email: true,
  253. },
  254. otp: {
  255. otpNum: true,
  256. },
  257. inputErrorCheck: true,
  258. inputValidTxt: "",
  259. otpValidTxt: "",
  260. resetPwValidCheck: false,
  261. },
  262. btnTxt: "",
  263. });
  264. // 초기 패스워드 변경
  265. const initPw = ref({
  266. popYn: false,
  267. passwd: "",
  268. passwd2: "",
  269. validCheck: {
  270. passwd: true,
  271. passwd2: true,
  272. },
  273. passwdCheck: false,
  274. errorTxt: "",
  275. });
  276. const selectPlaceholder = ref("");
  277. const initAuthPop1 = ref({});
  278. const initAuthPop2 = ref({});
  279. const initFindId = ref({});
  280. const initResetPw = ref({});
  281. const initInitPw = ref({});
  282. const googleOtpQrCode = ref("");
  283. const googleOtpSecretKey = ref("");
  284. const loginInfo = ref({});
  285. const checkbox = ref(false);
  286. const langType = ref("");
  287. const toggleVisibility = () => {
  288. visible.value = !visible.value;
  289. };
  290. const visible = ref(false);
  291. const isAgrNPop = ref(false);
  292. const isShowAgrNPop = ref(false);
  293. let saveId = localStorage.getItem("saveId");
  294. if (saveId) {
  295. checkbox.value = true;
  296. loginForm.value.userId = saveId;
  297. }
  298. const handleInfluenceMove = (event) => {
  299. const el = event.currentTarget;
  300. const rect = el.getBoundingClientRect();
  301. const mouseX = event.clientX;
  302. // 요소 너비의 15%를 좌우 여백으로 계산 (중앙 70% 영역)
  303. const margin = rect.width * 0.15;
  304. const leftBound = rect.left + margin;
  305. const rightBound = rect.right - margin;
  306. if (mouseX >= leftBound && mouseX <= rightBound) {
  307. gate1.value = true;
  308. gate2.value = false;
  309. } else {
  310. gate1.value = false;
  311. }
  312. };
  313. const handleVendorMove = (event) => {
  314. const el = event.currentTarget;
  315. const rect = el.getBoundingClientRect();
  316. const mouseX = event.clientX;
  317. // 요소 너비의 15%를 좌우 여백으로 계산 (중앙 70% 영역)
  318. const margin = rect.width * 0.15;
  319. const leftBound = rect.left + margin;
  320. const rightBound = rect.right - margin;
  321. if (mouseX >= leftBound && mouseX <= rightBound) {
  322. gate2.value = true;
  323. gate1.value = false;
  324. } else {
  325. gate2.value = false;
  326. }
  327. };
  328. // 개인정보처리방침 이용약관 팝업
  329. //const privacyPop = ref(false);
  330. const privacyDetail = ref({
  331. kr: {
  332. title: "",
  333. contents: "",
  334. },
  335. en: {
  336. title: "",
  337. contents: "",
  338. },
  339. });
  340. const systemInfo = ref({
  341. mode: "",
  342. });
  343. const loginAction = (__ID, __PASS, __TYPE) => {
  344. let _req = {
  345. id: __ID,
  346. password: __PASS,
  347. logintype: __TYPE,
  348. };
  349. useAxios()
  350. .post("/roulette/login", _req)
  351. .then((res) => {
  352. if (res.data) {
  353. // console.log(res.data);
  354. useAuthStore().setAuth(res.data);
  355. useAuthStore().setAccessToken(res.data.accessToken);
  356. useAuthStore().setRefreshToken(res.data.refreshToken);
  357. localStorage.setItem("tempAccess", __ID);
  358. useUtil.setPageMove("/view/item");
  359. useStore.menuInfo.menuIndex = "0";
  360. useStore.menuInfo.menuId = "menu01";
  361. useStore.menuInfo.pageRtName = "제품 관리";
  362. useStore.menuInfo.pageStatus = null;
  363. }
  364. })
  365. .catch((error) => {
  366. if (error.response) {
  367. console.log("status:", error.response.status, "data:", error.response.data);
  368. // 안전하게 errCode, message 접근
  369. const errData = error.response.data || {};
  370. const errCode = errData.errCode || errData.errorCode || errData.code || "";
  371. const errMsg = errData.message || "알 수 없는 오류가 발생했습니다.";
  372. console.log("errCode:", errCode, "message:", errMsg);
  373. } else {
  374. console.log("error:", error.message, error.code);
  375. }
  376. if (error.response?.status) {
  377. fnLoginSet(error.response.data.messages.message);
  378. }
  379. $log.debug("[login][fnIdPwCheck][error]");
  380. })
  381. .finally(() => {
  382. $log.debug("[login][fnIdPwCheck][finished]");
  383. });
  384. };
  385. const location = (__id) => {
  386. switch (__id) {
  387. case "join":
  388. useUtil.setPageMove("/auth/join?type=" + loginForm.value.loginType);
  389. break;
  390. case "findId":
  391. findId.value.popYn = true;
  392. break;
  393. case "resetPw":
  394. resetPw.value.popYn = true;
  395. break;
  396. case "influence":
  397. useUtil.setPageMove("/?type=influence");
  398. loginVisible.value = "Y";
  399. break;
  400. case "vendor":
  401. useUtil.setPageMove("/?type=vendor");
  402. loginVisible.value = "N";
  403. break;
  404. default:
  405. break;
  406. }
  407. };
  408. // onMounted
  409. onMounted(() => {
  410. //로그인페이지 접근시 파라미터 체크하여 인플루언서, 밴더 구분
  411. const typeParam = route.query.type;
  412. if (typeParam == "influence") {
  413. loginForm.value.loginType = "influence";
  414. } else if (typeParam == "vendor") {
  415. loginForm.value.loginType = "vendor";
  416. } else {
  417. loginVisible.value = "Y";
  418. }
  419. //구글 인증 프로세스
  420. function handleMessage(event) {
  421. const appBaseUrl = import.meta.env.VITE_APP_API_URL;
  422. // 개발환경이면 아래처럼 확인
  423. const allowedOrigins = [
  424. "http://0.0.0.0:3000",
  425. "http://localhost:3000",
  426. appBaseUrl,
  427. ].filter(Boolean);
  428. if (allowedOrigins.includes(event.origin)) {
  429. const { accessToken, refreshToken, user } = event.data;
  430. if (user?.JOIN === "1") {
  431. useAuthStore().setTempData(user);
  432. useUtil.setPageMove("/auth/join?type=" + loginForm.value.loginType);
  433. } else {
  434. //useAuthStore().setAuth(res.data);
  435. const result = {
  436. refreshToken: refreshToken,
  437. user: user,
  438. };
  439. //console.log(result);
  440. //return;
  441. useAuthStore().setTempData(result);
  442. useAuthStore().setAccessToken(accessToken);
  443. useAuthStore().setRefreshToken(refreshToken);
  444. localStorage.setItem("tempAccess", result.user);
  445. useUtil.setPageMove("/view/item");
  446. useStore.menuInfo.menuIndex = "0";
  447. useStore.menuInfo.menuId = "menu02";
  448. useStore.menuInfo.pageRtName = "이벤트 관리";
  449. useStore.menuInfo.pageStatus = null;
  450. }
  451. }
  452. }
  453. window.addEventListener("message", handleMessage);
  454. onBeforeUnmount(() => window.removeEventListener("message", handleMessage));
  455. });
  456. watch(
  457. () => route.query.type,
  458. (newType) => {
  459. if (newType === "influence" || newType === "vendor") {
  460. loginForm.value.loginType = newType;
  461. loginVisible.value = "N"; // 로그인 폼 보이기
  462. } else {
  463. loginVisible.value = "Y"; // 게이트 페이지 보이기
  464. }
  465. },
  466. {
  467. immediate: true, // 컴포넌트가 마운트될 때 즉시 실행
  468. }
  469. );
  470. watchEffect(() => {
  471. // 감시하고자 하는 데이터를 해당 블럭내에서 사용하면 호출된다.
  472. // getLang.value를 감시하는 상태
  473. //QfnGetEnumCode(useLangStore().getLang);
  474. });
  475. // $eventBus.off("SET_SUCCESS_POPUP");
  476. // $eventBus.on("SET_SUCCESS_POPUP", () => {
  477. // // 안내 팝업 확인 클릭 팝업 초기화처리
  478. // fnOtpPopClose("findId");
  479. // fnOtpPopClose("resetPw");
  480. // });
  481. // $eventBus.off("PASSWD_CHANGE");
  482. // $eventBus.on("PASSWD_CHANGE", () => {
  483. // fnPasswdChange();
  484. // });
  485. // $eventBus.off("INIT_PASSWORD");
  486. // $eventBus.on("INIT_PASSWORD", () => {
  487. // initPw.value.popYn = true;
  488. // });
  489. // $eventBus.off("SET_LOGIN");
  490. // $eventBus.on("SET_LOGIN", () => {
  491. // fnLogin();
  492. // });
  493. /************************
  494. * Methods
  495. ************************/
  496. const fnLoginSet = (__MSG) => {
  497. let param = {
  498. id: pageId,
  499. title: "로그인",
  500. content: __MSG,
  501. yes: {
  502. text: "확인",
  503. isProc: true,
  504. event: "FN_LOGIN",
  505. param: "",
  506. },
  507. no: {
  508. text: "취소",
  509. isProc: false,
  510. },
  511. };
  512. $eventBus.emit("OPEN_CONFIRM_POP_UP", param);
  513. };
  514. // 구글 로그인 인증 시퀀스
  515. function onGoogleLogin() {
  516. const appBaseUrl = import.meta.env.VITE_APP_API_URL;
  517. const clientId =
  518. "373780605211-diojebh7mug45urv9rnqdil6n0b1ogge.apps.googleusercontent.com"; // 실제 클라이언트 ID로 교체
  519. //const redirectUri = "https://shopdeli.mycafe24.com/auth/callback"; // 실제 리디렉션 URI로 교체
  520. const redirectUri = `${appBaseUrl}/auth/callback`;
  521. const scope = "openid email profile";
  522. const responseType = "code"; // 또는 'code' (백엔드 연동 시)
  523. const state = Math.random().toString(36).substring(2);
  524. const googleAuthUrl = `https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&client_id=${clientId}&redirect_uri=${encodeURIComponent(
  525. redirectUri
  526. )}&response_type=${responseType}&scope=${encodeURIComponent(scope)}&state=${state}`;
  527. const width = 500;
  528. const height = 600;
  529. const dualScreenLeft =
  530. window.screenLeft !== undefined ? window.screenLeft : window.screenX;
  531. const dualScreenTop =
  532. window.screenTop !== undefined ? window.screenTop : window.screenY;
  533. const currentWidth = window.innerWidth
  534. ? window.innerWidth
  535. : document.documentElement.clientWidth
  536. ? document.documentElement.clientWidth
  537. : screen.width;
  538. const currentHeight = window.innerHeight
  539. ? window.innerHeight
  540. : document.documentElement.clientHeight
  541. ? document.documentElement.clientHeight
  542. : screen.height;
  543. const left = dualScreenLeft + (currentWidth - width) / 2;
  544. const top = dualScreenTop + (currentHeight - height) / 2;
  545. window.open(
  546. googleAuthUrl,
  547. "googleLogin",
  548. `width=${width},height=${height},left=${left},top=${top},resizable=yes,scrollbars=yes`
  549. );
  550. }
  551. //카카오 인증 시퀀스
  552. function onKakaoLogin() {
  553. const appBaseUrl = import.meta.env.VITE_APP_API_URL;
  554. const kakaoAuthUrl = `${appBaseUrl}/auth/kakaoLogin`; // 실제 리디렉션 URI로 교체
  555. const width = 500;
  556. const height = 600;
  557. const dualScreenLeft =
  558. window.screenLeft !== undefined ? window.screenLeft : window.screenX;
  559. const dualScreenTop =
  560. window.screenTop !== undefined ? window.screenTop : window.screenY;
  561. const currentWidth = window.innerWidth
  562. ? window.innerWidth
  563. : document.documentElement.clientWidth
  564. ? document.documentElement.clientWidth
  565. : screen.width;
  566. const currentHeight = window.innerHeight
  567. ? window.innerHeight
  568. : document.documentElement.clientHeight
  569. ? document.documentElement.clientHeight
  570. : screen.height;
  571. const left = dualScreenLeft + (currentWidth - width) / 2;
  572. const top = dualScreenTop + (currentHeight - height) / 2;
  573. window.open(
  574. kakaoAuthUrl,
  575. "kakaoLogin",
  576. `width=${width},height=${height},left=${left},top=${top},resizable=yes,scrollbars=yes`
  577. );
  578. }
  579. //네이버 인증 시퀀스
  580. function onNaverLogin() {
  581. const appBaseUrl = import.meta.env.VITE_APP_API_URL;
  582. const naverAuthUrl = `${appBaseUrl}/auth/naverLogin`; // 실제 리디렉션 URI로 교체
  583. const width = 500;
  584. const height = 600;
  585. const dualScreenLeft =
  586. window.screenLeft !== undefined ? window.screenLeft : window.screenX;
  587. const dualScreenTop =
  588. window.screenTop !== undefined ? window.screenTop : window.screenY;
  589. const currentWidth = window.innerWidth
  590. ? window.innerWidth
  591. : document.documentElement.clientWidth
  592. ? document.documentElement.clientWidth
  593. : screen.width;
  594. const currentHeight = window.innerHeight
  595. ? window.innerHeight
  596. : document.documentElement.clientHeight
  597. ? document.documentElement.clientHeight
  598. : screen.height;
  599. const left = dualScreenLeft + (currentWidth - width) / 2;
  600. const top = dualScreenTop + (currentHeight - height) / 2;
  601. window.open(
  602. naverAuthUrl,
  603. "naverLogin",
  604. `width=${width},height=${height},left=${left},top=${top},resizable=yes,scrollbars=yes`
  605. );
  606. }
  607. /**
  608. * @API
  609. * 최종 로그인 버튼 클릭 시 API
  610. */
  611. function fnLogin(__USERID, __USERPASS) {
  612. // 파라미터 전달 값 [아이디, 비밀번호, otpNum, 브라우저정보]
  613. //userId: loginForm.value.userId,
  614. // let _req = {
  615. // username: loginForm.value.userId,
  616. // password: btoa(loginForm.value.passwd),
  617. // };
  618. localStorage.setItem("tempAccess", __USERID);
  619. if (__USERID == "admin" && __USERPASS == "1234") {
  620. useUtil.setPageMove("/view/media/newsList");
  621. } else {
  622. fnLoginSet("비밀번호가 맞지 않습니다. 확인해주세요.");
  623. }
  624. // useAxios()
  625. // .post(apiUrl.otpCheck, _req)
  626. // .then((res) => {
  627. // loginInfo.value = res.data.data;
  628. // useAuthStore().setAccessToken(loginInfo.value.accessToken);
  629. // useAuthStore().setRefreshToken(loginInfo.value.refreshToken);
  630. // // OTP key체크 성공 후 개인정보에 대한 API를 호출 한다.
  631. // fnServiceModeCheck();
  632. // $log.debug("[login][fnLogin][success]");
  633. // })
  634. // .catch((error) => {
  635. // $log.debug("[login][fnLogin][error]");
  636. // let errorData = error.response.data;
  637. // errorData.type = "fnLogin";
  638. // fnLoginFail(errorData);
  639. // })
  640. // .finally(() => {
  641. // $log.debug("[login][fnLogin][finished]");
  642. // });
  643. }
  644. /**
  645. * @SCRIPT
  646. * 비밀번호확인 validation
  647. */
  648. function fnValidCheck(type) {
  649. // 아이디 체크
  650. if (type === "id") {
  651. const id = loginForm.value.userId;
  652. // 1. 기본 유효성 검사
  653. if (!id) {
  654. $toast.error("아이디를 입력해주세요.");
  655. return false;
  656. }
  657. // 2. 아이디 형식 검사 (영문, 숫자 조합 6~20자)
  658. const idRegex = /^[a-zA-Z0-9]{6,20}$/;
  659. if (!idRegex.test(id)) {
  660. $toast.error("아이디는 영문, 숫자 조합 6~20자로 입력해주세요.");
  661. return false;
  662. }
  663. }
  664. // 다른 유효성 검사가 필요한 경우 여기에 추가
  665. return true;
  666. }
  667. </script>