| | |
| | | |
| | | import closeEye from '@/assets/svgIcons/close_eye.svg?component'; |
| | | import openEye from '@/assets/svgIcons/close_eye.svg?component'; |
| | | import * as accountServices from '@/services/api/Account'; |
| | | import SendVerificationCodeView from './components/SendVerificationCodeView.vue'; |
| | | // import { useSettingStoreHook } from '@/store/modules/settings'; |
| | | import { getAppSetting } from '@config/config'; |
| | | import Config from '@config/config'; |
| | | |
| | | // const boleSetting = useSettingStoreHook(); |
| | | const ctx = useProvideContext(); |
| | |
| | | return; |
| | | } |
| | | loading.value = true; |
| | | await userStore.loginByUsername({ |
| | | userName: unref(user), |
| | | userPassword: unref(pwd), |
| | | }); |
| | | loading.value = false; |
| | | router.push({ |
| | | path: redirect.value || '/', |
| | | query: otherQuery.value, |
| | | }); |
| | | let systemInfo = await getSystemInfo(); |
| | | if (systemInfo.openTwoFactorLogin) { |
| | | let twoFactorLoginPasswordRes = await accountServices.twoFactorLoginPassword({ |
| | | loginName: unref(user), |
| | | password: unref(pwd), |
| | | clientId: 'goverend-admin-app-client', |
| | | }); |
| | | loading.value = false; |
| | | ElMessageBox({ |
| | | title: `发送验证码到${twoFactorLoginPasswordRes.phoneNumber}`, |
| | | customClass: 'send-code-message-box', |
| | | //@ts-ignore |
| | | modalClass: 'send-code-message-box-model', |
| | | showConfirmButton: false, |
| | | message: h(SendVerificationCodeView, { |
| | | phoneNumber: twoFactorLoginPasswordRes.phoneNumber, |
| | | loginKey: twoFactorLoginPasswordRes.loginKey, |
| | | onSuccess: () => { |
| | | router.push({ |
| | | path: redirect.value || '/', |
| | | query: otherQuery.value, |
| | | }); |
| | | document.querySelector('.send-code-message-box-model').remove(); |
| | | }, |
| | | }), |
| | | }); |
| | | } else { |
| | | await userStore.loginByUsername({ |
| | | userName: unref(user), |
| | | userPassword: unref(pwd), |
| | | clientId: 'goverend-admin-app-client', |
| | | }); |
| | | loading.value = false; |
| | | router.push({ |
| | | path: redirect.value || '/', |
| | | query: otherQuery.value, |
| | | }); |
| | | } |
| | | } catch (error) { |
| | | console.log(error); |
| | | // ElMessage({ |
| | |
| | | }; |
| | | const beforeLog = useDebounceFn(onLogin, 1000); |
| | | |
| | | async function getSystemInfo() { |
| | | let res = await accountServices.getSystemInfo({ |
| | | showLoading: false, |
| | | }); |
| | | return res; |
| | | } |
| | | |
| | | function onUserFocus() { |
| | | addClass(document.querySelector('.user'), 'focus'); |
| | | } |