index.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737
  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. // 디버깅: 로그인 후 사용자 정보 확인
  360. console.log('=== 로그인 성공 디버깅 ===');
  361. console.log('원본 데이터:', res.data);
  362. console.log('설정된 auth 정보:', useAuthStore().auth);
  363. console.log('COMPANY_NUMBER:', useAuthStore().auth.companyNumber);
  364. console.log('memberType:', useAuthStore().auth.memberType);
  365. console.log('===========================');
  366. localStorage.setItem("tempAccess", __ID);
  367. useUtil.setPageMove("/view/common/item");
  368. useStore.menuInfo.menuIndex = "0";
  369. useStore.menuInfo.menuId = "menu01";
  370. useStore.menuInfo.pageRtName = "제품 관리";
  371. useStore.menuInfo.pageStatus = null;
  372. }
  373. })
  374. .catch((error) => {
  375. if (error.response) {
  376. console.log("status:", error.response.status, "data:", error.response.data);
  377. // 안전하게 errCode, message 접근
  378. const errData = error.response.data || {};
  379. const errCode = errData.errCode || errData.errorCode || errData.code || "";
  380. const errMsg = errData.message || "알 수 없는 오류가 발생했습니다.";
  381. console.log("errCode:", errCode, "message:", errMsg);
  382. } else {
  383. console.log("error:", error.message, error.code);
  384. }
  385. if (error.response?.status) {
  386. fnLoginSet(error.response.data.messages.message);
  387. }
  388. $log.debug("[login][fnIdPwCheck][error]");
  389. })
  390. .finally(() => {
  391. $log.debug("[login][fnIdPwCheck][finished]");
  392. });
  393. };
  394. const location = (__id) => {
  395. switch (__id) {
  396. case "join":
  397. useUtil.setPageMove("/auth/join?type=" + loginForm.value.loginType);
  398. break;
  399. case "findId":
  400. findId.value.popYn = true;
  401. break;
  402. case "resetPw":
  403. resetPw.value.popYn = true;
  404. break;
  405. case "influence":
  406. useUtil.setPageMove("/?type=influence");
  407. loginVisible.value = "Y";
  408. break;
  409. case "vendor":
  410. useUtil.setPageMove("/?type=vendor");
  411. loginVisible.value = "N";
  412. break;
  413. default:
  414. break;
  415. }
  416. };
  417. // onMounted
  418. onMounted(() => {
  419. //로그인페이지 접근시 파라미터 체크하여 인플루언서, 밴더 구분
  420. const typeParam = route.query.type;
  421. if (typeParam == "influence") {
  422. loginForm.value.loginType = "influence";
  423. } else if (typeParam == "vendor") {
  424. loginForm.value.loginType = "vendor";
  425. } else {
  426. loginVisible.value = "Y";
  427. }
  428. //구글 인증 프로세스
  429. function handleMessage(event) {
  430. const appBaseUrl = import.meta.env.VITE_APP_API_URL;
  431. // 개발환경이면 아래처럼 확인
  432. const allowedOrigins = [
  433. "http://0.0.0.0:3000",
  434. "http://localhost:3000",
  435. appBaseUrl,
  436. ].filter(Boolean);
  437. if (allowedOrigins.includes(event.origin)) {
  438. const { accessToken, refreshToken, user } = event.data;
  439. if (user?.JOIN === "1") {
  440. useAuthStore().setTempData(user);
  441. useUtil.setPageMove("/auth/join?type=" + loginForm.value.loginType);
  442. } else {
  443. // SNS 로그인 성공 시 인증 정보 제대로 설정
  444. const authData = {
  445. refreshToken: refreshToken,
  446. user: user,
  447. };
  448. // setAuth를 호출하여 auth 스토어에 사용자 정보 저장
  449. useAuthStore().setAuth(authData);
  450. useAuthStore().setTempData(authData);
  451. useAuthStore().setAccessToken(accessToken);
  452. useAuthStore().setRefreshToken(refreshToken);
  453. localStorage.setItem("tempAccess", user.ID || user.id || user.SEQ);
  454. useUtil.setPageMove("/view/common/item");
  455. useStore.menuInfo.menuIndex = "0";
  456. useStore.menuInfo.menuId = "menu02";
  457. useStore.menuInfo.pageRtName = "이벤트 관리";
  458. useStore.menuInfo.pageStatus = null;
  459. }
  460. }
  461. }
  462. window.addEventListener("message", handleMessage);
  463. onBeforeUnmount(() => window.removeEventListener("message", handleMessage));
  464. });
  465. watch(
  466. () => route.query.type,
  467. (newType) => {
  468. if (newType === "influence" || newType === "vendor") {
  469. loginForm.value.loginType = newType;
  470. loginVisible.value = "N"; // 로그인 폼 보이기
  471. } else {
  472. loginVisible.value = "Y"; // 게이트 페이지 보이기
  473. }
  474. },
  475. {
  476. immediate: true, // 컴포넌트가 마운트될 때 즉시 실행
  477. }
  478. );
  479. watchEffect(() => {
  480. // 감시하고자 하는 데이터를 해당 블럭내에서 사용하면 호출된다.
  481. // getLang.value를 감시하는 상태
  482. //QfnGetEnumCode(useLangStore().getLang);
  483. });
  484. // $eventBus.off("SET_SUCCESS_POPUP");
  485. // $eventBus.on("SET_SUCCESS_POPUP", () => {
  486. // // 안내 팝업 확인 클릭 팝업 초기화처리
  487. // fnOtpPopClose("findId");
  488. // fnOtpPopClose("resetPw");
  489. // });
  490. // $eventBus.off("PASSWD_CHANGE");
  491. // $eventBus.on("PASSWD_CHANGE", () => {
  492. // fnPasswdChange();
  493. // });
  494. // $eventBus.off("INIT_PASSWORD");
  495. // $eventBus.on("INIT_PASSWORD", () => {
  496. // initPw.value.popYn = true;
  497. // });
  498. // $eventBus.off("SET_LOGIN");
  499. // $eventBus.on("SET_LOGIN", () => {
  500. // fnLogin();
  501. // });
  502. /************************
  503. * Methods
  504. ************************/
  505. const fnLoginSet = (__MSG) => {
  506. let param = {
  507. id: pageId,
  508. title: "로그인",
  509. content: __MSG,
  510. yes: {
  511. text: "확인",
  512. isProc: true,
  513. event: "FN_LOGIN",
  514. param: "",
  515. },
  516. no: {
  517. text: "취소",
  518. isProc: false,
  519. },
  520. };
  521. $eventBus.emit("OPEN_CONFIRM_POP_UP", param);
  522. };
  523. // 구글 로그인 인증 시퀀스
  524. function onGoogleLogin() {
  525. const appBaseUrl = import.meta.env.VITE_APP_API_URL;
  526. const clientId =
  527. "373780605211-diojebh7mug45urv9rnqdil6n0b1ogge.apps.googleusercontent.com"; // 실제 클라이언트 ID로 교체
  528. //const redirectUri = "https://shopdeli.mycafe24.com/auth/callback"; // 실제 리디렉션 URI로 교체
  529. const redirectUri = `${appBaseUrl}/auth/callback`;
  530. const scope = "openid email profile";
  531. const responseType = "code"; // 또는 'code' (백엔드 연동 시)
  532. const state = Math.random().toString(36).substring(2);
  533. const googleAuthUrl = `https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&client_id=${clientId}&redirect_uri=${encodeURIComponent(
  534. redirectUri
  535. )}&response_type=${responseType}&scope=${encodeURIComponent(scope)}&state=${state}`;
  536. const width = 500;
  537. const height = 600;
  538. const dualScreenLeft =
  539. window.screenLeft !== undefined ? window.screenLeft : window.screenX;
  540. const dualScreenTop =
  541. window.screenTop !== undefined ? window.screenTop : window.screenY;
  542. const currentWidth = window.innerWidth
  543. ? window.innerWidth
  544. : document.documentElement.clientWidth
  545. ? document.documentElement.clientWidth
  546. : screen.width;
  547. const currentHeight = window.innerHeight
  548. ? window.innerHeight
  549. : document.documentElement.clientHeight
  550. ? document.documentElement.clientHeight
  551. : screen.height;
  552. const left = dualScreenLeft + (currentWidth - width) / 2;
  553. const top = dualScreenTop + (currentHeight - height) / 2;
  554. window.open(
  555. googleAuthUrl,
  556. "googleLogin",
  557. `width=${width},height=${height},left=${left},top=${top},resizable=yes,scrollbars=yes`
  558. );
  559. }
  560. //카카오 인증 시퀀스
  561. function onKakaoLogin() {
  562. const appBaseUrl = import.meta.env.VITE_APP_API_URL;
  563. const kakaoAuthUrl = `${appBaseUrl}/auth/kakaoLogin`; // 실제 리디렉션 URI로 교체
  564. const width = 500;
  565. const height = 600;
  566. const dualScreenLeft =
  567. window.screenLeft !== undefined ? window.screenLeft : window.screenX;
  568. const dualScreenTop =
  569. window.screenTop !== undefined ? window.screenTop : window.screenY;
  570. const currentWidth = window.innerWidth
  571. ? window.innerWidth
  572. : document.documentElement.clientWidth
  573. ? document.documentElement.clientWidth
  574. : screen.width;
  575. const currentHeight = window.innerHeight
  576. ? window.innerHeight
  577. : document.documentElement.clientHeight
  578. ? document.documentElement.clientHeight
  579. : screen.height;
  580. const left = dualScreenLeft + (currentWidth - width) / 2;
  581. const top = dualScreenTop + (currentHeight - height) / 2;
  582. window.open(
  583. kakaoAuthUrl,
  584. "kakaoLogin",
  585. `width=${width},height=${height},left=${left},top=${top},resizable=yes,scrollbars=yes`
  586. );
  587. }
  588. //네이버 인증 시퀀스
  589. function onNaverLogin() {
  590. const appBaseUrl = import.meta.env.VITE_APP_API_URL;
  591. const naverAuthUrl = `${appBaseUrl}/auth/naverLogin`; // 실제 리디렉션 URI로 교체
  592. const width = 500;
  593. const height = 600;
  594. const dualScreenLeft =
  595. window.screenLeft !== undefined ? window.screenLeft : window.screenX;
  596. const dualScreenTop =
  597. window.screenTop !== undefined ? window.screenTop : window.screenY;
  598. const currentWidth = window.innerWidth
  599. ? window.innerWidth
  600. : document.documentElement.clientWidth
  601. ? document.documentElement.clientWidth
  602. : screen.width;
  603. const currentHeight = window.innerHeight
  604. ? window.innerHeight
  605. : document.documentElement.clientHeight
  606. ? document.documentElement.clientHeight
  607. : screen.height;
  608. const left = dualScreenLeft + (currentWidth - width) / 2;
  609. const top = dualScreenTop + (currentHeight - height) / 2;
  610. window.open(
  611. naverAuthUrl,
  612. "naverLogin",
  613. `width=${width},height=${height},left=${left},top=${top},resizable=yes,scrollbars=yes`
  614. );
  615. }
  616. /**
  617. * @API
  618. * 최종 로그인 버튼 클릭 시 API
  619. */
  620. function fnLogin(__USERID, __USERPASS) {
  621. // 파라미터 전달 값 [아이디, 비밀번호, otpNum, 브라우저정보]
  622. //userId: loginForm.value.userId,
  623. // let _req = {
  624. // username: loginForm.value.userId,
  625. // password: btoa(loginForm.value.passwd),
  626. // };
  627. localStorage.setItem("tempAccess", __USERID);
  628. if (__USERID == "admin" && __USERPASS == "1234") {
  629. useUtil.setPageMove("/view/media/newsList");
  630. } else {
  631. fnLoginSet("비밀번호가 맞지 않습니다. 확인해주세요.");
  632. }
  633. // useAxios()
  634. // .post(apiUrl.otpCheck, _req)
  635. // .then((res) => {
  636. // loginInfo.value = res.data.data;
  637. // useAuthStore().setAccessToken(loginInfo.value.accessToken);
  638. // useAuthStore().setRefreshToken(loginInfo.value.refreshToken);
  639. // // OTP key체크 성공 후 개인정보에 대한 API를 호출 한다.
  640. // fnServiceModeCheck();
  641. // $log.debug("[login][fnLogin][success]");
  642. // })
  643. // .catch((error) => {
  644. // $log.debug("[login][fnLogin][error]");
  645. // let errorData = error.response.data;
  646. // errorData.type = "fnLogin";
  647. // fnLoginFail(errorData);
  648. // })
  649. // .finally(() => {
  650. // $log.debug("[login][fnLogin][finished]");
  651. // });
  652. }
  653. /**
  654. * @SCRIPT
  655. * 비밀번호확인 validation
  656. */
  657. function fnValidCheck(type) {
  658. // 아이디 체크
  659. if (type === "id") {
  660. const id = loginForm.value.userId;
  661. // 1. 기본 유효성 검사
  662. if (!id) {
  663. $toast.error("아이디를 입력해주세요.");
  664. return false;
  665. }
  666. // 2. 아이디 형식 검사 (영문, 숫자 조합 6~20자)
  667. const idRegex = /^[a-zA-Z0-9]{6,20}$/;
  668. if (!idRegex.test(id)) {
  669. $toast.error("아이디는 영문, 숫자 조합 6~20자로 입력해주세요.");
  670. return false;
  671. }
  672. }
  673. // 다른 유효성 검사가 필요한 경우 여기에 추가
  674. return true;
  675. }
  676. </script>