|
|
@ -1,7 +1,39 @@ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<div :class="prefixCls" class="login-background-img"> |
|
|
|
<div :class="prefixCls" class="login-background-img"> |
|
|
|
|
|
|
|
<!--多租户选择器--> |
|
|
|
|
|
|
|
<Dropdown |
|
|
|
|
|
|
|
class="absolute top-3 right-40 enter-x" |
|
|
|
|
|
|
|
placement="bottom" |
|
|
|
|
|
|
|
:trigger="['hover']" |
|
|
|
|
|
|
|
:dropMenuList="options.tenantIdList" |
|
|
|
|
|
|
|
:selectedKeys="formData.tenantId" |
|
|
|
|
|
|
|
@menu-event="handleTenantIdMenuEvent" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<span> |
|
|
|
|
|
|
|
<Button shape="circle" ghost size="large"> |
|
|
|
|
|
|
|
<i class="icon icon-tenant" style="float: none; margin: 2px auto -5px auto;"/> |
|
|
|
|
|
|
|
<span style="color: #00000080; font-size: 10px;">租户</span> |
|
|
|
|
|
|
|
</Button> |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
</Dropdown> |
|
|
|
|
|
|
|
<!--身份提供商多选择器--> |
|
|
|
|
|
|
|
<Dropdown |
|
|
|
|
|
|
|
class="absolute top-3 right-26 enter-x" |
|
|
|
|
|
|
|
placement="bottom" |
|
|
|
|
|
|
|
:trigger="['hover']" |
|
|
|
|
|
|
|
:dropMenuList="options.identityProviderList" |
|
|
|
|
|
|
|
:selectedKeys="formData.identityProvider" |
|
|
|
|
|
|
|
@menu-event="handleIdentityProviderMenuEvent" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<span> |
|
|
|
|
|
|
|
<Button shape="circle" ghost size="large"> |
|
|
|
|
|
|
|
<i class="icon icon-role" style="float: none; margin: 2px auto -5px auto;"/> |
|
|
|
|
|
|
|
<span style="color: #00000080; font-size: 10px;">身份</span> |
|
|
|
|
|
|
|
</Button> |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
</Dropdown> |
|
|
|
<AppLocalePicker v-if="!sessionTimeout && showLocale" class="absolute top-4 right-4 enter-x xl:text-gray-600" :showText="false"/> |
|
|
|
<AppLocalePicker v-if="!sessionTimeout && showLocale" class="absolute top-4 right-4 enter-x xl:text-gray-600" :showText="false"/> |
|
|
|
<AppDarkModeToggle v-if="!sessionTimeout" class="absolute top-3 right-10 enter-x"/> |
|
|
|
<AppDarkModeToggle v-if="!sessionTimeout" class="absolute top-4 right-10 enter-x"/> |
|
|
|
<div v-if="!getIsMobile" class="aui-logo"> |
|
|
|
<div v-if="!getIsMobile" class="aui-logo"> |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
<h3> |
|
|
|
<h3> |
|
|
@ -198,6 +230,10 @@ |
|
|
|
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 { GithubFilled, WechatFilled, AlipayCircleFilled, DingtalkCircleFilled } from '@ant-design/icons-vue'; |
|
|
|
import { GithubFilled, WechatFilled, AlipayCircleFilled, DingtalkCircleFilled } from '@ant-design/icons-vue'; |
|
|
|
|
|
|
|
import { Dropdown, DropMenu } from '/@/components/Dropdown'; |
|
|
|
|
|
|
|
import { Button } from '/@/components/Button'; |
|
|
|
|
|
|
|
import { loginTenantList } from '/@/api/platform/system/controller/tenant'; |
|
|
|
|
|
|
|
import { getDataByDictType } from '/@/api/platform/system/controller/dictdata'; |
|
|
|
|
|
|
|
|
|
|
|
defineProps({ |
|
|
|
defineProps({ |
|
|
|
sessionTimeout: { |
|
|
|
sessionTimeout: { |
|
|
@ -225,12 +261,19 @@ |
|
|
|
inputCode: '', |
|
|
|
inputCode: '', |
|
|
|
username: '', |
|
|
|
username: '', |
|
|
|
password: '', |
|
|
|
password: '', |
|
|
|
|
|
|
|
identityProvider: [], |
|
|
|
|
|
|
|
tenantId: [], |
|
|
|
}); |
|
|
|
}); |
|
|
|
// 手机登录表单字段 |
|
|
|
// 手机登录表单字段 |
|
|
|
const phoneFormData = reactive<any>({ |
|
|
|
const phoneFormData = reactive<any>({ |
|
|
|
mobile: '', |
|
|
|
mobile: '', |
|
|
|
smscode: '', |
|
|
|
smscode: '', |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
// 下拉数据字段 |
|
|
|
|
|
|
|
const options = reactive<any>({ |
|
|
|
|
|
|
|
identityProviderList: [], |
|
|
|
|
|
|
|
tenantIdList: [] |
|
|
|
|
|
|
|
}); |
|
|
|
const loginRef = ref(); |
|
|
|
const loginRef = ref(); |
|
|
|
// 扫码登录 |
|
|
|
// 扫码登录 |
|
|
|
const codeRef = ref(); |
|
|
|
const codeRef = ref(); |
|
|
@ -293,6 +336,10 @@ |
|
|
|
createMessage.warn(t('sys.login.smsPlaceholder')); |
|
|
|
createMessage.warn(t('sys.login.smsPlaceholder')); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (!formData.tenantId[0]) { |
|
|
|
|
|
|
|
createMessage.warn(t('sys.login.tenantPlaceholder')); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
try { |
|
|
|
try { |
|
|
|
loginLoading.value = true; |
|
|
|
loginLoading.value = true; |
|
|
|
const userInfo = await userStore.login(toRaw({ |
|
|
|
const userInfo = await userStore.login(toRaw({ |
|
|
@ -300,6 +347,8 @@ |
|
|
|
username: formData.username, |
|
|
|
username: formData.username, |
|
|
|
realKey: formData.realKey, |
|
|
|
realKey: formData.realKey, |
|
|
|
code: formData.inputCode, |
|
|
|
code: formData.inputCode, |
|
|
|
|
|
|
|
identityProvider: formData.identityProvider[0], |
|
|
|
|
|
|
|
tenantId: formData.tenantId[0], |
|
|
|
})); |
|
|
|
})); |
|
|
|
if (userInfo) { |
|
|
|
if (userInfo) { |
|
|
|
notification.success({ |
|
|
|
notification.success({ |
|
|
@ -412,9 +461,36 @@ |
|
|
|
}, 300); |
|
|
|
}, 300); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
function handleTenantIdMenuEvent(menu: DropMenu) { |
|
|
|
|
|
|
|
if (formData.tenantId[0] === menu.event) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
formData.tenantId = [menu.event]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function handleIdentityProviderMenuEvent(menu: DropMenu) { |
|
|
|
|
|
|
|
if (formData.identityProvider[0] === menu.event) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
formData.identityProvider = [menu.event]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(async () => { |
|
|
|
//加载验证码 |
|
|
|
//加载验证码 |
|
|
|
handleChangeCheckCode(); |
|
|
|
await handleChangeCheckCode(); |
|
|
|
|
|
|
|
const tenantIdList = await loginTenantList(); |
|
|
|
|
|
|
|
options.tenantIdList = tenantIdList.map(item => ({ |
|
|
|
|
|
|
|
text: item.name, |
|
|
|
|
|
|
|
event: item.code, |
|
|
|
|
|
|
|
} as DropMenu)); |
|
|
|
|
|
|
|
options.tenantIdList[0] && (formData.tenantId = [options.tenantIdList[0].event]); |
|
|
|
|
|
|
|
const identityProviderList = await getDataByDictType({ type: 'identityProvider', tenantId: formData.tenantId }); |
|
|
|
|
|
|
|
options.identityProviderList = identityProviderList.map(item => ({ |
|
|
|
|
|
|
|
text: item.label, |
|
|
|
|
|
|
|
event: item.value, |
|
|
|
|
|
|
|
} as DropMenu)); |
|
|
|
|
|
|
|
options.identityProviderList[0] && (formData.identityProvider = [options.identityProviderList[0].event]); |
|
|
|
}); |
|
|
|
}); |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|