index.vue 21 KB

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