feat: oauth登录(页面 不包含逻辑)
This commit is contained in:
parent
bc46c65c7f
commit
1589292bbb
@ -3,6 +3,7 @@ import { onMounted, ref } from 'vue';
|
|||||||
|
|
||||||
import { AuthenticationLogin } from '@vben/common-ui';
|
import { AuthenticationLogin } from '@vben/common-ui';
|
||||||
|
|
||||||
|
import { message } from 'ant-design-vue';
|
||||||
import { omit } from 'lodash-es';
|
import { omit } from 'lodash-es';
|
||||||
|
|
||||||
import { tenantList, type TenantResp } from '#/api';
|
import { tenantList, type TenantResp } from '#/api';
|
||||||
@ -73,6 +74,18 @@ async function handleAccountLogin(values: LoginForm) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleOauthLogin(provider: string) {
|
||||||
|
switch (provider) {
|
||||||
|
case 'gitee': {
|
||||||
|
message.success('todo gitee login');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
message.warn('暂不支持该登录方式');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -80,12 +93,14 @@ async function handleAccountLogin(values: LoginForm) {
|
|||||||
ref="loginRef"
|
ref="loginRef"
|
||||||
:captcha-base64="captchaInfo.img"
|
:captcha-base64="captchaInfo.img"
|
||||||
:loading="authStore.loginLoading"
|
:loading="authStore.loginLoading"
|
||||||
|
:show-register="false"
|
||||||
:tenant-options="tenantInfo.voList"
|
:tenant-options="tenantInfo.voList"
|
||||||
:use-captcha="captchaInfo.captchaEnabled"
|
:use-captcha="captchaInfo.captchaEnabled"
|
||||||
:use-tenant="tenantInfo.tenantEnabled"
|
:use-tenant="tenantInfo.tenantEnabled"
|
||||||
password-placeholder="密码"
|
password-placeholder="密码"
|
||||||
username-placeholder="用户名"
|
username-placeholder="用户名"
|
||||||
@captcha-click="loadCaptcha"
|
@captcha-click="loadCaptcha"
|
||||||
|
@oauth-login="handleOauthLogin"
|
||||||
@submit="handleAccountLogin"
|
@submit="handleAccountLogin"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
@ -25,3 +25,5 @@ export const CommandLineIcon = createIconifyIcon(
|
|||||||
'flat-color-icons:command-line',
|
'flat-color-icons:command-line',
|
||||||
);
|
);
|
||||||
export const MemoryIcon = createIconifyIcon('la:memory');
|
export const MemoryIcon = createIconifyIcon('la:memory');
|
||||||
|
|
||||||
|
export const GiteeIcon = createIconifyIcon('simple-icons:gitee');
|
||||||
|
@ -69,6 +69,10 @@ const emit = defineEmits<{
|
|||||||
* 验证码点击
|
* 验证码点击
|
||||||
*/
|
*/
|
||||||
captchaClick: [];
|
captchaClick: [];
|
||||||
|
/**
|
||||||
|
* 第三方登录 platfrom 对应平台的string
|
||||||
|
*/
|
||||||
|
oauthLogin: [plateform: string];
|
||||||
submit: LoginEmits['submit'];
|
submit: LoginEmits['submit'];
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
@ -269,7 +273,10 @@ defineExpose({ resetCaptcha });
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 第三方登录 -->
|
<!-- 第三方登录 -->
|
||||||
<ThirdPartyLogin v-if="showThirdPartyLogin" />
|
<ThirdPartyLogin
|
||||||
|
v-if="showThirdPartyLogin"
|
||||||
|
@oauth-login="(e) => emit('oauthLogin', e)"
|
||||||
|
/>
|
||||||
|
|
||||||
<div v-if="showRegister" class="text-center text-sm">
|
<div v-if="showRegister" class="text-center text-sm">
|
||||||
{{ $t('authentication.accountTip') }}
|
{{ $t('authentication.accountTip') }}
|
||||||
|
@ -1,11 +1,18 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { MdiGithub, MdiGoogle, MdiQqchat, MdiWechat } from '@vben/icons';
|
import { GiteeIcon, MdiGithub, MdiQqchat, MdiWechat } from '@vben/icons';
|
||||||
import { $t } from '@vben/locales';
|
import { $t } from '@vben/locales';
|
||||||
import { VbenIconButton } from '@vben-core/shadcn-ui';
|
import { VbenIconButton } from '@vben-core/shadcn-ui';
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'ThirdPartyLogin',
|
name: 'ThirdPartyLogin',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
defineEmits<{
|
||||||
|
/**
|
||||||
|
* 第三方登录 platfrom 对应平台的string
|
||||||
|
*/
|
||||||
|
oauthLogin: [plateform: string];
|
||||||
|
}>();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -18,18 +25,18 @@ defineOptions({
|
|||||||
<span class="border-input w-[35%] border-b dark:border-gray-600"></span>
|
<span class="border-input w-[35%] border-b dark:border-gray-600"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-4 flex flex-wrap justify-center">
|
<div class="mt-4 flex flex-wrap justify-around">
|
||||||
<VbenIconButton class="mb-3">
|
<VbenIconButton class="mb-3" @click="$emit('oauthLogin', 'wechat')">
|
||||||
<MdiWechat />
|
<MdiWechat class="size-[24px] text-green-600" />
|
||||||
</VbenIconButton>
|
</VbenIconButton>
|
||||||
<VbenIconButton class="mb-3">
|
<VbenIconButton class="mb-3" @click="$emit('oauthLogin', 'qq')">
|
||||||
<MdiQqchat />
|
<MdiQqchat class="size-[24px]" />
|
||||||
</VbenIconButton>
|
</VbenIconButton>
|
||||||
<VbenIconButton class="mb-3">
|
<VbenIconButton class="mb-3" @click="$emit('oauthLogin', 'github')">
|
||||||
<MdiGithub />
|
<MdiGithub class="size-[24px]" />
|
||||||
</VbenIconButton>
|
</VbenIconButton>
|
||||||
<VbenIconButton class="mb-3">
|
<VbenIconButton class="mb-3" @click="$emit('oauthLogin', 'gitee')">
|
||||||
<MdiGoogle />
|
<GiteeIcon class="size-[24px] text-red-700" />
|
||||||
</VbenIconButton>
|
</VbenIconButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user