From 583be96a44fc7ffa873473906a568e9d85a8bc7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=B9=8F?= <zp4185024@163.com> Date: Tue, 25 Feb 2025 17:10:06 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E9=99=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Login/Login.vue | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/views/Login/Login.vue b/src/views/Login/Login.vue index 9a0b1b5..3910ff5 100644 --- a/src/views/Login/Login.vue +++ b/src/views/Login/Login.vue @@ -34,9 +34,10 @@ class="m-auto h-[calc(100%-60px)] w-[100%] flex items-center at-2xl:max-w-500px at-lg:max-w-500px at-md:max-w-500px at-xl:max-w-500px" > - - <!-- 二维码登录 --> - <QrCodeForm class="m-auto h-auto p-20px lt-xl:(rounded-3xl light:bg-white)" /> + <!-- 账号登录 --> + <LoginForm v-if="isIpAccess" class="m-auto h-auto p-20px lt-xl:(rounded-3xl light:bg-white)" /> + <!-- 二维码登录 --> + <QrCodeForm v-else class="m-auto h-auto p-20px lt-xl:(rounded-3xl light:bg-white)" /> </div> </Transition> @@ -55,7 +56,17 @@ import { LocaleDropdown } from '@/layout/components/LocaleDropdown' import { LoginForm, MobileForm, QrCodeForm, RegisterForm, SSOLoginVue, ForgetPasswordForm } from './components' defineOptions({ name: 'Login' }) - +const isIpAccess = ref(false) +onMounted(() => { + const hostname = window.location.hostname + if(hostname == 'localhost'){ + isIpAccess.value = true; + } + else{ + isIpAccess.value = /^(\d{1,3}\.){3}\d{1,3}$/.test(hostname) + } + // 判断是否为IP地址访问 +}) const { t } = useI18n() const appStore = useAppStore() const { getPrefixCls } = useDesign()