|
|
@ -12,7 +12,7 @@ |
|
|
|
<div v-else class="aui-phone-logo"> |
|
|
|
<div v-else class="aui-phone-logo"> |
|
|
|
<img :src="logoPhoneImg" alt=""> |
|
|
|
<img :src="logoPhoneImg" alt=""> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<header class="aui-title text-white text-center">KLAB系统</header> |
|
|
|
<header class="aui-title text-white text-center">康来生物KLAB系统</header> |
|
|
|
<main class="aui-content"> |
|
|
|
<main class="aui-content"> |
|
|
|
<div class="aui-container"> |
|
|
|
<div class="aui-container"> |
|
|
|
<div class="aui-form"> |
|
|
|
<div class="aui-form"> |
|
|
@ -28,7 +28,7 @@ |
|
|
|
<a-form |
|
|
|
<a-form |
|
|
|
ref="loginRef" |
|
|
|
ref="loginRef" |
|
|
|
:model="formData" |
|
|
|
:model="formData" |
|
|
|
@keypress.enter="loginHandleClick" |
|
|
|
@keypress.enter="handleLogin" |
|
|
|
> |
|
|
|
> |
|
|
|
<div class="aui-account"> |
|
|
|
<div class="aui-account"> |
|
|
|
<div class="aui-inputClear"> |
|
|
|
<div class="aui-inputClear"> |
|
|
@ -57,7 +57,7 @@ |
|
|
|
:loading="loginLoading" |
|
|
|
:loading="loginLoading" |
|
|
|
class="aui-link-login aui-flex-box" |
|
|
|
class="aui-link-login aui-flex-box" |
|
|
|
type="primary" |
|
|
|
type="primary" |
|
|
|
@click="loginHandleClick" |
|
|
|
@click="handleLogin" |
|
|
|
>{{ t('sys.login.loginButton') }}</a-button> |
|
|
|
>{{ t('sys.login.loginButton') }}</a-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -73,7 +73,7 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<script lang="ts" setup> |
|
|
|
<script lang="ts" setup> |
|
|
|
import { reactive, ref, toRaw } from 'vue'; |
|
|
|
import { reactive, ref } from 'vue'; |
|
|
|
import { useUserStore } from '/@/store/modules/user'; |
|
|
|
import { useUserStore } from '/@/store/modules/user'; |
|
|
|
import { useMessage } from '/@/hooks/web/useMessage'; |
|
|
|
import { useMessage } from '/@/hooks/web/useMessage'; |
|
|
|
import { useI18n } from '/@/hooks/web/useI18n'; |
|
|
|
import { useI18n } from '/@/hooks/web/useI18n'; |
|
|
@ -83,35 +83,24 @@ |
|
|
|
import { useLocaleStore } from '/@/store/modules/locale'; |
|
|
|
import { useLocaleStore } from '/@/store/modules/locale'; |
|
|
|
import { useDesign } from '/@/hooks/web/useDesign'; |
|
|
|
import { useDesign } from '/@/hooks/web/useDesign'; |
|
|
|
import { useAppInject } from '/@/hooks/web/useAppInject'; |
|
|
|
import { useAppInject } from '/@/hooks/web/useAppInject'; |
|
|
|
|
|
|
|
import {User} from '/@/api/platform/core/entity/user'; |
|
|
|
|
|
|
|
|
|
|
|
const { prefixCls } = useDesign('mini-login'); |
|
|
|
const { prefixCls } = useDesign('sso-klab-login'); |
|
|
|
const { notification, createMessage } = useMessage(); |
|
|
|
const { notification, createMessage } = useMessage(); |
|
|
|
const userStore = useUserStore(); |
|
|
|
const userStore = useUserStore(); |
|
|
|
const { t } = useI18n(); |
|
|
|
const { t } = useI18n(); |
|
|
|
const localeStore = useLocaleStore(); |
|
|
|
const localeStore = useLocaleStore(); |
|
|
|
const showLocale = localeStore.getShowPicker; |
|
|
|
const showLocale = localeStore.getShowPicker; |
|
|
|
|
|
|
|
|
|
|
|
// 账号登录表单字段 |
|
|
|
const formData = reactive<Recordable>({ |
|
|
|
const formData = reactive<any>({ |
|
|
|
|
|
|
|
realKey: '', |
|
|
|
|
|
|
|
inputCode: '', |
|
|
|
|
|
|
|
username: '', |
|
|
|
username: '', |
|
|
|
password: '', |
|
|
|
password: '', |
|
|
|
}); |
|
|
|
}); |
|
|
|
// 手机登录表单字段 |
|
|
|
|
|
|
|
const phoneFormData = reactive<any>({ |
|
|
|
|
|
|
|
mobile: '', |
|
|
|
|
|
|
|
smscode: '', |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
const loginRef = ref(); |
|
|
|
const loginRef = ref(); |
|
|
|
const loginLoading = ref<boolean>(false); |
|
|
|
const loginLoading = ref<boolean>(false); |
|
|
|
const { getIsMobile } = useAppInject(); |
|
|
|
const { getIsMobile } = useAppInject(); |
|
|
|
|
|
|
|
|
|
|
|
async function loginHandleClick() { |
|
|
|
async function handleLogin() { |
|
|
|
await accountLogin(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function accountLogin() { |
|
|
|
|
|
|
|
if (!formData.username) { |
|
|
|
if (!formData.username) { |
|
|
|
createMessage.warn(t('sys.login.accountPlaceholder')); |
|
|
|
createMessage.warn(t('sys.login.accountPlaceholder')); |
|
|
|
return; |
|
|
|
return; |
|
|
@ -120,28 +109,16 @@ |
|
|
|
createMessage.warn(t('sys.login.passwordPlaceholder')); |
|
|
|
createMessage.warn(t('sys.login.passwordPlaceholder')); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (!formData.inputCode) { |
|
|
|
|
|
|
|
createMessage.warn(t('sys.login.smsPlaceholder')); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
loginLoading.value = true; |
|
|
|
loginLoading.value = true; |
|
|
|
const userInfo = await userStore.login(toRaw({ |
|
|
|
await userStore.login({ |
|
|
|
password: formData.password, |
|
|
|
password: formData.password, |
|
|
|
username: formData.username, |
|
|
|
username: formData.username, |
|
|
|
realKey: formData.realKey, |
|
|
|
goHome: false, |
|
|
|
code: formData.inputCode, |
|
|
|
clientId: 'klab' |
|
|
|
})); |
|
|
|
}); |
|
|
|
if (userInfo) { |
|
|
|
// sso重定向到资源系统 |
|
|
|
notification.success({ |
|
|
|
document.location.reload(); |
|
|
|
message: t('sys.login.loginSuccessTitle'), |
|
|
|
|
|
|
|
description: `${t('sys.login.loginSuccessDesc')}: ${userInfo.nickName}`, |
|
|
|
|
|
|
|
duration: 3, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (error){ |
|
|
|
|
|
|
|
formData.code=''; |
|
|
|
|
|
|
|
formData.realKey=''; |
|
|
|
|
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
loginLoading.value = false; |
|
|
|
loginLoading.value = false; |
|
|
|
} |
|
|
|
} |
|
|
@ -220,7 +197,7 @@ |
|
|
|
</style> |
|
|
|
</style> |
|
|
|
|
|
|
|
|
|
|
|
<style lang="less"> |
|
|
|
<style lang="less"> |
|
|
|
@prefix-cls: ~'@{namespace}-mini-login'; |
|
|
|
@prefix-cls: ~'@{namespace}-sso-klab-login'; |
|
|
|
@dark-bg: #293146; |
|
|
|
@dark-bg: #293146; |
|
|
|
|
|
|
|
|
|
|
|
html[data-theme='dark'] { |
|
|
|
html[data-theme='dark'] { |
|
|
|