From 4a71c6beb268ba17ca472f45401c8ee97846e97e Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 26 六月 2026 13:14:57 +0800
Subject: [PATCH] 项目多余功能删除
---
src/views/_core/authentication/login.vue | 97 +++++++++++++-----------------------------------
1 files changed, 27 insertions(+), 70 deletions(-)
diff --git a/src/views/_core/authentication/login.vue b/src/views/_core/authentication/login.vue
index 9df6483..e63e399 100644
--- a/src/views/_core/authentication/login.vue
+++ b/src/views/_core/authentication/login.vue
@@ -4,7 +4,6 @@
import type { AuthApi } from '#/api/core/auth';
import { computed, onMounted, ref } from 'vue';
-import { useRoute } from 'vue-router';
import { AuthenticationLogin, Verification, z } from '../../../packages/effects/common-ui/src';
import { isCaptchaEnable, isTenantEnable } from '../../../packages/effects/hooks/src';
@@ -16,13 +15,11 @@
getCaptcha,
getTenantByWebsite,
getTenantSimpleList,
- socialAuthRedirect,
} from '#/api/core/auth';
import { useAuthStore } from '#/store';
defineOptions({ name: 'Login' });
-const { query } = useRoute();
const authStore = useAuthStore();
const accessStore = useAccessStore();
const tenantEnable = isTenantEnable();
@@ -33,35 +30,15 @@
const captchaType = 'blockPuzzle'; // 楠岃瘉鐮佺被鍨嬶細'blockPuzzle' | 'clickWord'
-/** 鑾峰彇绉熸埛鍒楄〃锛屽苟榛樿閫変腑 */
+/** 鑾峰彇绉熸埛鍒楄〃 */
const tenantList = ref<AuthApi.TenantResult[]>([]); // 绉熸埛鍒楄〃
async function fetchTenantList() {
if (!tenantEnable) {
return;
}
try {
- // 鑾峰彇绉熸埛鍒楄〃銆佸煙鍚嶅搴旂鎴�
- const websiteTenantPromise = getTenantByWebsite(window.location.hostname);
+ // 鑾峰彇绉熸埛鍒楄〃
tenantList.value = await getTenantSimpleList();
-
- // 閫変腑绉熸埛锛氬煙鍚� > store 涓殑绉熸埛 > 棣栦釜绉熸埛
- let tenantId: null | number = null;
- const websiteTenant = await websiteTenantPromise;
- if (websiteTenant?.id) {
- tenantId = websiteTenant.id;
- }
- // 濡傛灉娌℃湁浠庡煙鍚嶈幏鍙栧埌绉熸埛锛屽皾璇曚粠 store 涓幏鍙�
- if (!tenantId && accessStore.tenantId) {
- tenantId = accessStore.tenantId;
- }
- // 濡傛灉杩樻槸娌℃湁绉熸埛锛屼娇鐢ㄥ垪琛ㄤ腑鐨勭涓�涓�
- if (!tenantId && tenantList.value?.[0]?.id) {
- tenantId = tenantList.value[0].id;
- }
-
- // 璁剧疆閫変腑鐨勭鎴风紪鍙�
- accessStore.setTenantId(tenantId);
- loginRef.value.getFormApi().setFieldValue('tenantId', tenantId?.toString());
} catch (error) {
console.error('鑾峰彇绉熸埛鍒楄〃澶辫触:', error);
}
@@ -90,28 +67,6 @@
}
}
-/** 澶勭悊绗笁鏂圭櫥褰� */
-const redirect = query?.redirect;
-async function handleThirdLogin(type: number) {
- if (type <= 0) {
- return;
- }
- try {
- // 璁$畻 redirectUri
- // tricky: type銆乺edirect 闇�瑕佸厛 encode 涓�娆★紝鍚﹀垯閽夐拤鍥炶皟浼氫涪澶便�傞厤鍚� social-login.vue#getUrlValue() 浣跨敤
- const redirectUri = `${
- location.origin
- }/auth/social-login?${encodeURIComponent(
- `type=${type}&redirect=${redirect || '/'}`,
- )}`;
-
- // 杩涜璺宠浆
- window.location.href = await socialAuthRedirect(type, redirectUri);
- } catch (error) {
- console.error('绗笁鏂圭櫥褰曞鐞嗗け璐�:', error);
- }
-}
-
/** 缁勪欢鎸傝浇鏃惰幏鍙栫鎴蜂俊鎭� */
onMounted(() => {
fetchTenantList();
@@ -119,28 +74,25 @@
const formSchema = computed((): VbenFormSchema[] => {
return [
- {
- component: 'VbenSelect',
- componentProps: {
- options: tenantList.value.map((item) => ({
- label: item.name,
- value: item.id.toString(),
- })),
- placeholder: $t('authentication.tenantTip'),
- },
- fieldName: 'tenantId',
- label: $t('authentication.tenant'),
- rules: z.string().min(1, { message: $t('authentication.tenantTip') }),
- dependencies: {
- triggerFields: ['tenantId'],
- if: tenantEnable,
- trigger(values) {
- if (values.tenantId) {
- accessStore.setTenantId(Number(values.tenantId));
- }
- },
- },
- },
+ // {
+ // component: 'VbenSelect',
+ // componentProps: {
+ // options: tenantList.value.map((item) => ({
+ // label: item.name,
+ // value: item.id.toString(),
+ // })),
+ // placeholder: $t('authentication.tenantTip'),
+ // },
+ // fieldName: 'tenantId',
+ // label: $t('authentication.tenant'),
+ // dependencies: {
+ // triggerFields: ['tenantId'],
+ // if: tenantEnable,
+ // trigger(values) {
+ // accessStore.setTenantId(values.tenantId ? Number(values.tenantId) : null);
+ // },
+ // },
+ // },
{
component: 'VbenInput',
componentProps: {
@@ -175,8 +127,13 @@
ref="loginRef"
:form-schema="formSchema"
:loading="authStore.loginLoading"
+ :show-code-login="false"
+ :show-qrcode-login="false"
+ :show-third-party-login="false"
+ :show-register="false"
+ :show-forget-password="false"
+ :show-doc-link="false"
@submit="handleLogin"
- @third-login="handleThirdLogin"
/>
<Verification
ref="verifyRef"
--
Gitblit v1.9.3