index.vue 22 KB

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