2000 lines
55 KiB
Vue
2000 lines
55 KiB
Vue
<template>
|
||
<div class="login-layout">
|
||
<div class="animated-bg">
|
||
<div class="knowledge-node node-1">
|
||
<svg class="node-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||
<path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20" />
|
||
<path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z" />
|
||
</svg>
|
||
</div>
|
||
<div class="knowledge-node node-2">
|
||
<svg class="node-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||
<path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z" />
|
||
</svg>
|
||
</div>
|
||
<div class="knowledge-node node-3">
|
||
<svg class="node-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||
<path d="M12 2L2 7l10 5 10-5-10-5z" />
|
||
<path d="M2 17l10 5 10-5" />
|
||
<path d="M2 12l10 5 10-5" />
|
||
</svg>
|
||
</div>
|
||
<div class="knowledge-node node-4">
|
||
<svg class="node-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||
<ellipse cx="12" cy="5" rx="9" ry="3" />
|
||
<path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3" />
|
||
<path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5" />
|
||
</svg>
|
||
</div>
|
||
<div class="knowledge-node node-5">
|
||
<svg class="node-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||
<circle cx="11" cy="11" r="8" />
|
||
<path d="m21 21-4.35-4.35" />
|
||
</svg>
|
||
</div>
|
||
<div class="knowledge-node node-6">
|
||
<svg class="node-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||
<path
|
||
d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z" />
|
||
<polyline points="3.27 6.96 12 12.01 20.73 6.96" />
|
||
<line x1="12" y1="22.08" x2="12" y2="12" />
|
||
</svg>
|
||
</div>
|
||
<div class="knowledge-node node-7">
|
||
<svg class="node-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
|
||
<polyline points="14 2 14 8 20 8" />
|
||
</svg>
|
||
</div>
|
||
<div class="knowledge-node node-8">
|
||
<svg class="node-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||
<path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2" />
|
||
<circle cx="9" cy="7" r="4" />
|
||
<path d="M23 21v-2a4 4 0 0 0-3-3.87" />
|
||
<path d="M16 3.13a4 4 0 0 1 0 7.75" />
|
||
</svg>
|
||
</div>
|
||
<div class="knowledge-node node-9">
|
||
<svg class="node-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" />
|
||
</svg>
|
||
</div>
|
||
<div class="knowledge-node node-10">
|
||
<svg class="node-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||
<circle cx="12" cy="12" r="3" />
|
||
<path
|
||
d="M12 1v6m0 6v6M5.64 5.64l4.24 4.24m4.24 4.24l4.24 4.24M1 12h6m6 0h6M5.64 18.36l4.24-4.24m4.24-4.24l4.24-4.24" />
|
||
</svg>
|
||
</div>
|
||
<div class="knowledge-node node-11">
|
||
<svg class="node-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||
<path d="M9 11l3 3L22 4" />
|
||
<path d="M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11" />
|
||
</svg>
|
||
</div>
|
||
<div class="knowledge-node node-12">
|
||
<svg class="node-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||
<polygon
|
||
points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" />
|
||
</svg>
|
||
</div>
|
||
|
||
<svg class="knowledge-lines" viewBox="0 0 100 100" preserveAspectRatio="none">
|
||
<line class="connection-line line-1" x1="20" y1="15" x2="35" y2="25" />
|
||
<line class="connection-line line-2" x1="35" y1="25" x2="55" y2="20" />
|
||
<line class="connection-line line-3" x1="55" y1="20" x2="85" y2="12" />
|
||
<line class="connection-line line-4" x1="8" y1="35" x2="25" y2="45" />
|
||
<line class="connection-line line-5" x1="25" y1="45" x2="65" y2="48" />
|
||
<line class="connection-line line-6" x1="20" y1="60" x2="60" y2="75" />
|
||
<line class="connection-line line-7" x1="20" y1="15" x2="20" y2="60" />
|
||
<line class="connection-line line-8" x1="55" y1="20" x2="45" y2="50" />
|
||
<line class="connection-line line-9" x1="65" y1="48" x2="90" y2="38" />
|
||
<line class="connection-line line-10" x1="40" y1="70" x2="75" y2="80" />
|
||
<line class="connection-line line-11" x1="35" y1="25" x2="25" y2="45" />
|
||
<line class="connection-line line-12" x1="75" y1="30" x2="65" y2="48" />
|
||
</svg>
|
||
</div>
|
||
|
||
<!-- Logo - Top Left -->
|
||
<a href="https://github.com/Tencent/WeKnora" target="_blank" class="header-logo" :title="$t('common.github')">
|
||
<span class="aido-logo" aria-label="和信智汇学院">
|
||
<span class="aido-logo__text">和信智汇学院</span>
|
||
<span class="aido-logo__dot"></span>
|
||
</span>
|
||
</a>
|
||
|
||
<!-- Header Links - Top Right(仅保留语言切换) -->
|
||
<div class="header-links">
|
||
<div class="language-switch">
|
||
<button @click="toggleLanguageMenu" class="header-link" :title="currentLangOption?.label">
|
||
<span class="lang-flag-icon">{{ currentLangOption?.flag }}</span>
|
||
<span class="link-text">{{ currentLangOption?.shortLabel }}</span>
|
||
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"
|
||
stroke-linecap="round">
|
||
<polyline points="6 9 12 15 18 9" />
|
||
</svg>
|
||
</button>
|
||
|
||
<!-- Language Dropdown -->
|
||
<div v-if="showLanguageMenu" class="language-dropdown">
|
||
<div v-for="lang in languageOptions" :key="lang.value" @click="selectLanguage(lang.value)"
|
||
class="language-option" :class="{ active: currentLanguage === lang.value }">
|
||
<span class="lang-flag">{{ lang.flag }}</span>
|
||
<span class="lang-label">{{ lang.label }}</span>
|
||
<span v-if="currentLanguage === lang.value" class="check-icon">✓</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Left Showcase Section -->
|
||
<div class="showcase-section">
|
||
<div class="showcase-content">
|
||
<p class="showcase-subtitle">{{ $t('platform.subtitle') }}</p>
|
||
<p class="showcase-description">{{ $t('platform.description') }}</p>
|
||
|
||
<div class="feature-tags">
|
||
<span class="tag">{{ $t('platform.rag') }}</span>
|
||
<span class="tag">{{ $t('platform.agent') }}</span>
|
||
<span class="tag">{{ $t('platform.wiki') }}</span>
|
||
<span class="tag">{{ $t('platform.hybridSearch') }}</span>
|
||
</div>
|
||
|
||
<!-- Swiper Carousel -->
|
||
<div class="carousel-container">
|
||
<swiper :modules="modules" :slides-per-view="1" :loop="true" :autoplay="{
|
||
delay: 4000,
|
||
disableOnInteraction: false,
|
||
}" :effect="'fade'" :fade-effect="{ crossFade: true }"
|
||
:pagination="{ clickable: true, dynamicBullets: false }" :speed="800" class="screenshot-swiper">
|
||
<swiper-slide v-for="(slide, index) in slides" :key="index">
|
||
<div class="slide-content">
|
||
<img :src="slide.image" :alt="slide.title" class="slide-image" />
|
||
</div>
|
||
</swiper-slide>
|
||
</swiper>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Right Form Section -->
|
||
<div class="form-section">
|
||
<div class="form-panel">
|
||
<!-- Login Card -->
|
||
<div class="form-card" v-if="!isRegisterMode">
|
||
<!-- 登录已有账号时保留邀请上下文。 -->
|
||
<div v-if="inviteLookup" class="invite-banner">
|
||
<t-icon name="link" class="invite-banner__icon" />
|
||
<div class="invite-banner__text">
|
||
<div class="invite-banner__title">
|
||
{{ $t('inviteRegister.bannerTitle', { tenant: inviteLookup.tenant_name || '' }) }}
|
||
</div>
|
||
<div class="invite-banner__hint">
|
||
{{ $t('inviteRegister.bannerHintLogin') }}
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div v-else-if="inviteLookupError" class="invite-banner invite-banner--error">
|
||
{{ inviteLookupError }}
|
||
</div>
|
||
<div class="form-header">
|
||
<h2 class="form-title">{{ $t('auth.login') }}</h2>
|
||
<p class="form-welcome">{{ $t('auth.subtitle') }}</p>
|
||
</div>
|
||
|
||
<div class="form-content">
|
||
<!-- 工号直登(password grant)与本地邮箱登录的模式切换 -->
|
||
<div v-if="oidcPasswordEnabled" class="login-mode-switch">
|
||
<button type="button" class="mode-button" :class="{ active: loginMode === 'casdoor' }" :disabled="loading"
|
||
@click="switchLoginMode('casdoor')">
|
||
{{ $t('auth.loginModeCasdoor') }}
|
||
</button>
|
||
<button type="button" class="mode-button" :class="{ active: loginMode === 'local' }" :disabled="loading"
|
||
@click="switchLoginMode('local')">
|
||
{{ $t('auth.loginModeLocal') }}
|
||
</button>
|
||
</div>
|
||
<t-form ref="formRef" :data="formData" :rules="formRules" @submit="handleLogin" layout="vertical"
|
||
label-align="top">
|
||
<t-form-item :label="loginMode === 'casdoor' ? $t('auth.employeeId') : $t('auth.email')"
|
||
:name="loginMode === 'casdoor' ? 'username' : 'email'">
|
||
<t-input v-if="loginMode === 'casdoor'" v-model="formData.username"
|
||
:placeholder="$t('auth.employeeIdPlaceholder')" type="text" autocomplete="username" size="large"
|
||
:disabled="loading" />
|
||
<t-input v-else v-model="formData.email" :placeholder="$t('auth.emailPlaceholder')" type="text"
|
||
autocomplete="email" size="large" :disabled="loading" />
|
||
</t-form-item>
|
||
|
||
<t-form-item :label="$t('auth.password')" name="password">
|
||
<t-input v-model="formData.password" :placeholder="$t('auth.passwordPlaceholder')" type="password"
|
||
autocomplete="current-password" size="large" :disabled="loading" @enter="handleLogin" />
|
||
</t-form-item>
|
||
|
||
<t-button type="submit" theme="primary" size="large" block :loading="loading" class="submit-button">
|
||
{{ loading ? $t('auth.loggingIn') : $t('auth.login') }}
|
||
</t-button>
|
||
|
||
<div class="register-cta" v-if="registrationEnabled">
|
||
<div class="register-cta__divider">
|
||
<span>{{ $t('auth.firstTime') }}</span>
|
||
</div>
|
||
<t-button theme="default" variant="outline" size="large" block class="register-cta__button"
|
||
:disabled="loading" @click="toggleMode">
|
||
{{ $t('auth.createAccount') }}
|
||
</t-button>
|
||
</div>
|
||
|
||
<div v-if="oidcEnabled" class="oidc-divider">
|
||
<span>{{ $t('auth.orContinueWith') }}</span>
|
||
</div>
|
||
|
||
<t-button v-if="oidcEnabled" theme="default" size="large" block :loading="oidcLoading" :disabled="loading"
|
||
class="oidc-button" @click="handleOIDCLogin">
|
||
{{ oidcLoading ? $t('auth.redirectingToOIDC') : oidcLoginText }}
|
||
</t-button>
|
||
</t-form>
|
||
|
||
<!-- Features list -->
|
||
<div class="login-features">
|
||
<div class="feature-item">
|
||
<span class="feature-icon">✓</span>
|
||
<span class="feature-text">{{ $t('platform.multimodalParsing') }}</span>
|
||
</div>
|
||
<div class="feature-item">
|
||
<span class="feature-icon">✓</span>
|
||
<span class="feature-text">{{ $t('platform.hybridSearchEngine') }}</span>
|
||
</div>
|
||
<div class="feature-item">
|
||
<span class="feature-icon">✓</span>
|
||
<span class="feature-text">{{ $t('platform.ragQandA') }}</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Registration must be allowed for this mode and invitation. -->
|
||
<div class="form-card" v-if="isRegisterMode && registrationEnabled">
|
||
<!-- Share-link banner: shown only when ?token= resolved to a
|
||
real invitation row. Sits above the form header so the
|
||
invitee instantly sees who invited them and into which
|
||
workspace, without bumping the existing register UX. -->
|
||
<div v-if="inviteLookup" class="invite-banner">
|
||
<t-icon name="link" class="invite-banner__icon" />
|
||
<div class="invite-banner__text">
|
||
<div class="invite-banner__title">
|
||
{{ $t('inviteRegister.bannerTitle', { tenant: inviteLookup.tenant_name || '' }) }}
|
||
</div>
|
||
<div class="invite-banner__hint">
|
||
{{ $t('inviteRegister.bannerHint') }}
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div v-else-if="inviteLookupError" class="invite-banner invite-banner--error">
|
||
{{ inviteLookupError }}
|
||
</div>
|
||
<div class="form-header">
|
||
<h2 class="form-title">{{ $t('auth.createAccount') }}</h2>
|
||
<p class="form-subtitle">{{ $t('auth.registerSubtitle') }}</p>
|
||
</div>
|
||
|
||
<div class="form-content">
|
||
<t-form ref="registerFormRef" :data="registerData" :rules="registerRules" @submit="handleRegister"
|
||
layout="vertical" label-align="top">
|
||
<t-form-item :label="$t('auth.username')" name="username">
|
||
<t-input v-model="registerData.username" :placeholder="$t('auth.usernamePlaceholder')" size="large"
|
||
:disabled="loading" />
|
||
</t-form-item>
|
||
|
||
<t-form-item :label="$t('auth.email')" name="email">
|
||
<t-input v-model="registerData.email" :placeholder="$t('auth.emailPlaceholder')" type="text"
|
||
autocomplete="email" size="large" :disabled="loading" />
|
||
</t-form-item>
|
||
|
||
<t-form-item :label="$t('auth.password')" name="password">
|
||
<t-input v-model="registerData.password" :placeholder="$t('auth.passwordPlaceholder')" type="password"
|
||
autocomplete="new-password" size="large" :disabled="loading" />
|
||
</t-form-item>
|
||
|
||
<t-form-item :label="$t('auth.confirmPassword')" name="confirmPassword">
|
||
<t-input v-model="registerData.confirmPassword" :placeholder="$t('auth.confirmPasswordPlaceholder')"
|
||
type="password" autocomplete="new-password" size="large" :disabled="loading"
|
||
@enter="handleRegister" />
|
||
</t-form-item>
|
||
|
||
<t-button type="submit" theme="primary" size="large" block :loading="loading" class="submit-button">
|
||
{{ loading ? $t('auth.registering') : $t('auth.register') }}
|
||
</t-button>
|
||
</t-form>
|
||
|
||
<div class="form-footer">
|
||
<span>{{ $t('auth.haveAccount') }}</span>
|
||
<a href="#" @click.prevent="toggleMode" class="link-button">
|
||
{{ $t('auth.backToLogin') }}
|
||
</a>
|
||
</div>
|
||
|
||
<!-- Features list for register -->
|
||
<div class="login-features">
|
||
<div class="feature-item">
|
||
<span class="feature-icon">✓</span>
|
||
<span class="feature-text">{{ $t('platform.independentTenant') }}</span>
|
||
</div>
|
||
<div class="feature-item">
|
||
<span class="feature-icon">✓</span>
|
||
<span class="feature-text">{{ $t('platform.fullApiAccess') }}</span>
|
||
</div>
|
||
<div class="feature-item">
|
||
<span class="feature-icon">✓</span>
|
||
<span class="feature-text">{{ $t('platform.knowledgeBaseManagement') }}</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<script setup lang="ts">
|
||
import { ref, reactive, nextTick, onMounted, onBeforeUnmount, computed } from 'vue'
|
||
import { useRoute, useRouter } from 'vue-router'
|
||
import { MessagePlugin } from 'tdesign-vue-next'
|
||
import { useRoleLabel } from '@/composables/useRoleLabel'
|
||
import { notifyLoginSuccess } from '@/utils/loginNotify'
|
||
import { canRegister } from './registrationPolicy'
|
||
import { newPasswordRules } from '@/utils/passwordPolicy'
|
||
import { Swiper, SwiperSlide } from 'swiper/vue'
|
||
import { Autoplay, EffectFade, Pagination } from 'swiper/modules'
|
||
import 'swiper/css'
|
||
import 'swiper/css/effect-fade'
|
||
import 'swiper/css/pagination'
|
||
import {
|
||
login,
|
||
loginWithOIDCPassword,
|
||
register,
|
||
getOIDCAuthorizationURL,
|
||
getOIDCConfig,
|
||
autoSetup,
|
||
getAuthConfig,
|
||
userInfoFromApi,
|
||
getInvitationByToken,
|
||
registerByInvite,
|
||
type InviteLookup,
|
||
} from '@/api/auth'
|
||
import { useAuthStore } from '@/stores/auth'
|
||
import { useI18n } from 'vue-i18n'
|
||
|
||
// Import screenshot images
|
||
import screenshot1 from '@/assets/img/screenshot-1.svg'
|
||
import screenshot2 from '@/assets/img/screenshot-2.svg'
|
||
import screenshot3 from '@/assets/img/screenshot-3.svg'
|
||
import screenshot4 from '@/assets/img/screenshot-4.svg'
|
||
|
||
const router = useRouter()
|
||
const route = useRoute()
|
||
const authStore = useAuthStore()
|
||
const { t, tm, locale } = useI18n()
|
||
const { formatRole, roleIcon } = useRoleLabel()
|
||
|
||
// Swiper modules
|
||
const modules = [Autoplay, EffectFade, Pagination]
|
||
|
||
// Carousel slides data
|
||
const slides = [
|
||
{
|
||
image: screenshot4,
|
||
title: t('platform.carousel.agenticRagTitle'),
|
||
description: t('platform.carousel.agenticRagDesc')
|
||
},
|
||
{
|
||
image: screenshot2,
|
||
title: t('platform.carousel.hybridSearchTitle'),
|
||
description: t('platform.carousel.hybridSearchDesc')
|
||
},
|
||
{
|
||
image: screenshot3,
|
||
title: t('platform.carousel.wikiTitle'),
|
||
description: t('platform.carousel.wikiDesc')
|
||
},
|
||
{
|
||
image: screenshot1,
|
||
title: t('platform.carousel.smartDocRetrievalTitle'),
|
||
description: t('platform.carousel.smartDocRetrievalDesc')
|
||
}
|
||
]
|
||
|
||
// Form references
|
||
const formRef = ref()
|
||
const registerFormRef = ref()
|
||
|
||
// State management
|
||
const loading = ref(false)
|
||
const oidcLoading = ref(false)
|
||
const isRegisterMode = ref(false)
|
||
const showLanguageMenu = ref(false)
|
||
const oidcEnabled = ref(false)
|
||
const oidcProviderName = ref('')
|
||
// 工号直登(password grant):后端 /auth/oidc/config 的 password_login_enabled 驱动。
|
||
// 启用时表单默认切到工号模式;未启用时保持纯本地邮箱登录。
|
||
const oidcPasswordEnabled = ref(false)
|
||
const loginMode = ref<'casdoor' | 'local'>('casdoor')
|
||
// Wait for configuration before showing a registration entry.
|
||
const registrationMode = ref('')
|
||
const registrationEnabled = computed(() => canRegister(registrationMode.value, !!inviteLookup.value))
|
||
const complexPasswordEnabled = ref(false)
|
||
|
||
// invite-link state. When the URL carries ?token=xxx we resolve it to
|
||
// the originating tenant + role and switch the form into a "register
|
||
// via invitation" mode when invitation registration is enabled. Submitting the register
|
||
// form with this set hits /auth/register-by-invite (auto-login on
|
||
// success) instead of /auth/register.
|
||
const inviteToken = ref('')
|
||
const inviteLookup = ref<InviteLookup | null>(null)
|
||
const inviteLookupError = ref('')
|
||
const inviteLookupLoading = ref(false)
|
||
|
||
// Language options
|
||
const languageOptions = [
|
||
{ value: 'zh-CN', label: '简体中文', shortLabel: '中文', flag: '🇨🇳' },
|
||
{ value: 'zh-TW', label: '繁體中文', shortLabel: '繁中', flag: '繁' },
|
||
{ value: 'en-US', label: 'English', shortLabel: 'EN', flag: '🇺🇸' },
|
||
{ value: 'ru-RU', label: 'Русский', shortLabel: 'RU', flag: '🇷🇺' },
|
||
{ value: 'ko-KR', label: '한국어', shortLabel: '한국어', flag: '🇰🇷' },
|
||
{ value: 'ja-JP', label: '日本語', shortLabel: '日本語', flag: '🇯🇵' }
|
||
]
|
||
|
||
const currentLanguage = computed(() => locale.value)
|
||
const oidcLoginText = computed(() => {
|
||
if (oidcProviderName.value) {
|
||
return t('auth.oidcLoginWithProvider', { provider: oidcProviderName.value })
|
||
}
|
||
return t('auth.oidcLogin')
|
||
})
|
||
const currentLangOption = computed(() => languageOptions.find(l => l.value === currentLanguage.value))
|
||
|
||
// Login form data
|
||
const formData = reactive<{ [key: string]: any }>({
|
||
username: '',
|
||
email: '',
|
||
password: '',
|
||
})
|
||
|
||
// Register form data
|
||
const registerData = reactive<{ [key: string]: any }>({
|
||
username: '',
|
||
email: '',
|
||
password: '',
|
||
confirmPassword: ''
|
||
})
|
||
|
||
// Login form validation rules:工号模式的密码策略由 Casdoor 自管,
|
||
// 前端只做必填校验(本地模式的 8 位下限/邮箱格式不适用于 IdP 账号)。
|
||
const formRules = computed(() => {
|
||
if (oidcPasswordEnabled.value && loginMode.value === 'casdoor') {
|
||
return {
|
||
username: [
|
||
{ required: true, message: t('auth.usernameRequired'), type: 'error' }
|
||
],
|
||
password: [
|
||
{ required: true, message: t('auth.passwordRequired'), type: 'error' }
|
||
]
|
||
}
|
||
}
|
||
return {
|
||
email: [
|
||
{ required: true, message: t('auth.emailRequired'), type: 'error' },
|
||
{ email: true, message: t('auth.emailInvalid'), type: 'error' }
|
||
],
|
||
password: [
|
||
{ required: true, message: t('auth.passwordRequired'), type: 'error' },
|
||
{ min: 8, message: t('auth.passwordMinLength'), type: 'error' },
|
||
{ max: 32, message: t('auth.passwordMaxLength'), type: 'error' }
|
||
],
|
||
}
|
||
})
|
||
|
||
// Register form validation rules
|
||
const registerRules = computed(() => ({
|
||
username: [
|
||
{ required: true, message: t('auth.usernameRequired'), type: 'error' },
|
||
{ min: 2, message: t('auth.usernameMinLength'), type: 'error' },
|
||
{ max: 20, message: t('auth.usernameMaxLength'), type: 'error' },
|
||
{
|
||
pattern: /^[a-zA-Z0-9_\u4e00-\u9fa5]+$/,
|
||
message: t('auth.usernameInvalid'),
|
||
type: 'error'
|
||
}
|
||
],
|
||
email: [
|
||
{ required: true, message: t('auth.emailRequired'), type: 'error' },
|
||
{ email: true, message: t('auth.emailInvalid'), type: 'error' }
|
||
],
|
||
password: newPasswordRules(t, complexPasswordEnabled.value),
|
||
confirmPassword: [
|
||
{ required: true, message: t('auth.confirmPasswordRequired'), type: 'error' },
|
||
{
|
||
validator: (val: string) => val === registerData.password,
|
||
message: t('auth.passwordMismatch'),
|
||
type: 'error'
|
||
}
|
||
]
|
||
}))
|
||
|
||
// Toggle login/register mode
|
||
const toggleMode = () => {
|
||
isRegisterMode.value = !isRegisterMode.value && registrationEnabled.value
|
||
|
||
Object.keys(registerData).forEach(key => {
|
||
(registerData as any)[key] = ''
|
||
})
|
||
}
|
||
|
||
// Toggle language menu
|
||
const toggleLanguageMenu = () => {
|
||
showLanguageMenu.value = !showLanguageMenu.value
|
||
}
|
||
|
||
// Select language
|
||
const selectLanguage = (lang: string) => {
|
||
locale.value = lang
|
||
localStorage.setItem('locale', lang)
|
||
showLanguageMenu.value = false
|
||
MessagePlugin.success(t('language.languageSaved'))
|
||
}
|
||
|
||
// Close language menu when clicking outside
|
||
const handleClickOutside = (event: MouseEvent) => {
|
||
const target = event.target as HTMLElement
|
||
if (!target.closest('.language-switch')) {
|
||
showLanguageMenu.value = false
|
||
}
|
||
}
|
||
|
||
// Add click outside listener
|
||
onMounted(() => {
|
||
document.addEventListener('click', handleClickOutside)
|
||
})
|
||
|
||
onBeforeUnmount(() => {
|
||
document.removeEventListener('click', handleClickOutside)
|
||
})
|
||
|
||
const persistLoginResponse = async (response: any, skipRedirect = false) => {
|
||
// Backend renamed `tenant` to `active_tenant` and added `memberships`
|
||
// when tenant-level RBAC landed (issue #1303). The two are otherwise
|
||
// identical — `active_tenant` is the tenant whose ID is encoded in the
|
||
// JWT, defaulting to the user's home tenant on a fresh login.
|
||
const activeTenant = response.active_tenant || response.tenant
|
||
if (response.user && response.token) {
|
||
// user.tenant_id must be the user's HOME tenant (the immutable row
|
||
// on the users table); useHomeTenant() and the home-badge logic both
|
||
// assume so. The ACTIVE tenant (which can differ from home when the
|
||
// server honoured a remembered last-active-tenant preference) is
|
||
// expressed separately via setSelectedTenant below.
|
||
const homeTenantIdRaw = response.user.tenant_id ?? activeTenant?.id ?? ''
|
||
authStore.setUser(userInfoFromApi(response.user, homeTenantIdRaw))
|
||
authStore.setToken(response.token)
|
||
if (response.refresh_token) {
|
||
authStore.setRefreshToken(response.refresh_token)
|
||
}
|
||
if (activeTenant) {
|
||
authStore.setTenant({
|
||
id: String(activeTenant.id) || '',
|
||
name: activeTenant.name || '',
|
||
owner_id: response.user.id || '',
|
||
created_at: activeTenant.created_at || new Date().toISOString(),
|
||
updated_at: activeTenant.updated_at || new Date().toISOString()
|
||
})
|
||
} else {
|
||
authStore.setTenant(null)
|
||
}
|
||
if (Array.isArray(response.memberships)) {
|
||
authStore.setMemberships(response.memberships)
|
||
}
|
||
// If the backend dropped us into a non-home tenant (honoured a
|
||
// remembered "last active tenant" preference), set the override so
|
||
// subsequent requests carry X-Tenant-ID and the UI stays consistent.
|
||
// Otherwise clear any stale override left in localStorage by a
|
||
// previous session for a different account.
|
||
const activeIdNum = Number(activeTenant?.id)
|
||
const homeIdNum = Number(homeTenantIdRaw)
|
||
if (Number.isFinite(activeIdNum) && Number.isFinite(homeIdNum) && activeIdNum !== homeIdNum) {
|
||
authStore.setSelectedTenant(activeIdNum, activeTenant?.name || null)
|
||
} else {
|
||
authStore.setSelectedTenant(null, null)
|
||
}
|
||
}
|
||
|
||
// Pull runtime capabilities (including whether ordinary users may create
|
||
// workspaces) before entering the main UI so create actions never flash
|
||
// briefly when the deployment is invitation-only.
|
||
await authStore.refreshFromAuthMe()
|
||
await nextTick()
|
||
if (skipRedirect) return
|
||
router.replace(authStore.hasValidTenant ? '/platform/creatChat' : '/onboarding/workspace')
|
||
}
|
||
|
||
const getBackendOIDCRedirectURI = () => `${window.location.origin}/api/v1/auth/oidc/callback`
|
||
|
||
const loadOIDCConfig = async () => {
|
||
try {
|
||
const response = await getOIDCConfig()
|
||
oidcEnabled.value = !!response.success && !!response.enabled
|
||
oidcProviderName.value = response.provider_display_name || ''
|
||
oidcPasswordEnabled.value = oidcEnabled.value && !!response.password_login_enabled
|
||
} catch {
|
||
oidcEnabled.value = false
|
||
oidcProviderName.value = ''
|
||
oidcPasswordEnabled.value = false
|
||
}
|
||
// password 直登未启用时回落到本地邮箱模式,避免提交走错端点。
|
||
if (!oidcPasswordEnabled.value) {
|
||
loginMode.value = 'local'
|
||
}
|
||
}
|
||
|
||
// 切换工号/邮箱模式:清空两套字段与校验痕迹,防止串台。
|
||
const switchLoginMode = (mode: 'casdoor' | 'local') => {
|
||
if (loginMode.value === mode) return
|
||
loginMode.value = mode
|
||
formData.username = ''
|
||
formData.email = ''
|
||
formData.password = ''
|
||
formRef.value?.clearValidate?.()
|
||
}
|
||
|
||
// Registration stays hidden if configuration cannot be loaded.
|
||
const loadAuthConfig = async () => {
|
||
try {
|
||
const response = await getAuthConfig()
|
||
registrationMode.value = response.success ? response.registration_mode : ''
|
||
complexPasswordEnabled.value = response.complex_password_enabled
|
||
} catch {
|
||
registrationMode.value = ''
|
||
complexPasswordEnabled.value = false
|
||
}
|
||
}
|
||
|
||
const handleOIDCLogin = async () => {
|
||
try {
|
||
oidcLoading.value = true
|
||
const response = await getOIDCAuthorizationURL(getBackendOIDCRedirectURI())
|
||
const authorizationURL = response.authorization_url
|
||
|
||
if (!response.success || !authorizationURL) {
|
||
MessagePlugin.error(response.message || t('auth.oidcLoginFailed'))
|
||
return
|
||
}
|
||
|
||
// 跳转 IdP 会丢失 URL 中的 token,暂存到 sessionStorage,回调后由 App.vue 兑换。
|
||
if (inviteToken.value) {
|
||
sessionStorage.setItem('academy_pending_invite_token', inviteToken.value)
|
||
}
|
||
window.location.href = authorizationURL
|
||
} catch (error: any) {
|
||
console.error('OIDC 登录跳转失败:', error)
|
||
MessagePlugin.error(error.message || t('auth.oidcLoginFailed'))
|
||
} finally {
|
||
oidcLoading.value = false
|
||
}
|
||
}
|
||
|
||
// 用 token 加入空间并进入应用。会话此时已有效,故即便 token 失效也照常进入(避免困在登录页)。
|
||
const acceptAndEnter = async (token: string) => {
|
||
loading.value = true
|
||
try {
|
||
const result = await authStore.acceptInvitationByTokenAndRefresh(token)
|
||
if (result.ok) {
|
||
MessagePlugin.success(t('inviteRegister.joined'))
|
||
} else {
|
||
MessagePlugin.warning(t('inviteRegister.invalidBody'))
|
||
}
|
||
} catch {
|
||
MessagePlugin.warning(t('inviteRegister.invalidBody'))
|
||
} finally {
|
||
loading.value = false
|
||
await nextTick()
|
||
router.replace('/platform/creatChat')
|
||
}
|
||
}
|
||
|
||
// Handle login
|
||
const handleLogin = async () => {
|
||
try {
|
||
const valid = await formRef.value?.validate()
|
||
if (valid !== true) return
|
||
|
||
loading.value = true
|
||
|
||
// 工号模式走 password grant(后端转发 Casdoor 校验,响应与本地登录同构,
|
||
// 持久化路径完全复用);邮箱模式保持本地账密。
|
||
const response = oidcPasswordEnabled.value && loginMode.value === 'casdoor'
|
||
? await loginWithOIDCPassword({
|
||
username: formData.username,
|
||
password: formData.password,
|
||
})
|
||
: await login({
|
||
email: formData.email,
|
||
password: formData.password,
|
||
})
|
||
|
||
if (response.success) {
|
||
if (inviteToken.value) {
|
||
// 从邀请链接登录:持久化会话后兑换 token 并进入对应空间。
|
||
await persistLoginResponse(response, true)
|
||
await acceptAndEnter(inviteToken.value)
|
||
return
|
||
}
|
||
await persistLoginResponse(response)
|
||
notifyLoginSuccess(response, t, tm, formatRole, roleIcon)
|
||
} else {
|
||
MessagePlugin.error(response.message ||
|
||
(oidcPasswordEnabled.value && loginMode.value === 'casdoor' ? t('auth.casdoorLoginError') : t('auth.loginError')))
|
||
}
|
||
} catch (error: any) {
|
||
console.error('登录错误:', error)
|
||
if (oidcPasswordEnabled.value && loginMode.value === 'casdoor') {
|
||
// 401(工号/密码错误)与 503(IdP 未开 password grant)统一落到
|
||
// 本地化文案;上游部署问题在后端日志与烟测里定位。
|
||
MessagePlugin.error(error?.message || t('auth.casdoorLoginError'))
|
||
} else {
|
||
MessagePlugin.error(error.message || t('auth.loginErrorRetry'))
|
||
}
|
||
} finally {
|
||
loading.value = false
|
||
}
|
||
}
|
||
|
||
// Handle registration. Dispatches based on whether the user arrived
|
||
// with a share-link token: with token -> register-by-invite (auto-
|
||
// login on success); without -> the normal self-service register
|
||
// (drops back to the login form for the user to sign in).
|
||
const handleRegister = async () => {
|
||
if (!registrationEnabled.value) return
|
||
try {
|
||
const valid = await registerFormRef.value?.validate()
|
||
if (valid !== true) return
|
||
|
||
loading.value = true
|
||
|
||
if (inviteToken.value) {
|
||
const response = await registerByInvite({
|
||
token: inviteToken.value,
|
||
username: registerData.username,
|
||
email: registerData.email,
|
||
password: registerData.password,
|
||
})
|
||
if (!response.success) {
|
||
MessagePlugin.error(response.message || t('auth.registerFailed'))
|
||
return
|
||
}
|
||
MessagePlugin.success(t('auth.registerSuccess'))
|
||
// register-by-invite returns the same shape as login (token +
|
||
// active_tenant + memberships), so reuse the login persistence
|
||
// path — same store writes, same redirect target.
|
||
await persistLoginResponse(response)
|
||
return
|
||
}
|
||
|
||
const response = await register({
|
||
username: registerData.username,
|
||
email: registerData.email,
|
||
password: registerData.password
|
||
})
|
||
|
||
if (response.success) {
|
||
MessagePlugin.success(t('auth.registerSuccess'))
|
||
|
||
// Switch to login mode and fill in email
|
||
isRegisterMode.value = false
|
||
formData.email = registerData.email
|
||
|
||
// Clear register form
|
||
Object.keys(registerData).forEach(key => {
|
||
(registerData as any)[key] = ''
|
||
})
|
||
} else {
|
||
MessagePlugin.error(response.message || t('auth.registerFailed'))
|
||
}
|
||
} catch (error: any) {
|
||
console.error('注册错误:', error)
|
||
MessagePlugin.error(error.message || t('auth.registerError'))
|
||
} finally {
|
||
loading.value = false
|
||
}
|
||
}
|
||
|
||
// Check if already logged in; for lite edition, attempt transparent auto-setup
|
||
onMounted(async () => {
|
||
// Share-link landing: ?token=xxx switches the form into invite-
|
||
// register mode before any other auto-flow (logged-in redirect /
|
||
// auto-setup / OIDC) gets a chance to redirect. Resolution failure
|
||
// surfaces inline; the user can still log in normally if they
|
||
// already have an account. We check this BEFORE the isLoggedIn
|
||
// redirect so an existing session doesn't bounce the user to
|
||
// /platform (and possibly back to /login if the session is stale),
|
||
// dropping the invite token along the way.
|
||
const tokenFromQuery = String(route.query.token || '').trim()
|
||
if (tokenFromQuery) {
|
||
inviteToken.value = tokenFromQuery
|
||
inviteLookupLoading.value = true
|
||
// 1. 先校验 token:无效/过期则停在登录页报错,不进注册模式。
|
||
try {
|
||
const resp = await getInvitationByToken(tokenFromQuery)
|
||
if (resp.success && resp.data) {
|
||
inviteLookup.value = resp.data
|
||
} else {
|
||
inviteLookupError.value = resp.message || t('inviteRegister.invalidBody')
|
||
loadOIDCConfig()
|
||
loadAuthConfig()
|
||
return
|
||
}
|
||
} catch {
|
||
inviteLookupError.value = t('inviteRegister.invalidBody')
|
||
loadOIDCConfig()
|
||
loadAuthConfig()
|
||
return
|
||
} finally {
|
||
inviteLookupLoading.value = false
|
||
}
|
||
|
||
// 2. 已登录则直接兑换 token 进入空间(三种模式通用)。
|
||
if (authStore.isLoggedIn && (await authStore.refreshFromAuthMe())) {
|
||
await acceptAndEnter(tokenFromQuery)
|
||
return
|
||
}
|
||
|
||
// 3. Only enabled registration modes may create an invited account.
|
||
await loadAuthConfig()
|
||
isRegisterMode.value = registrationEnabled.value
|
||
loadOIDCConfig()
|
||
return
|
||
}
|
||
|
||
if (authStore.isLoggedIn) {
|
||
router.replace('/platform/creatChat')
|
||
return
|
||
}
|
||
|
||
localStorage.removeItem('academy_auto_setup_failed')
|
||
try {
|
||
const response = await autoSetup()
|
||
if (response.success) {
|
||
authStore.setLiteMode(true)
|
||
await persistLoginResponse(response)
|
||
return
|
||
}
|
||
} catch {
|
||
// Auto-setup may be unavailable outside the native Lite shell.
|
||
}
|
||
|
||
loadOIDCConfig()
|
||
loadAuthConfig()
|
||
})
|
||
</script>
|
||
|
||
<style lang="less" scoped>
|
||
.login-layout {
|
||
display: flex;
|
||
width: 100%;
|
||
min-height: 100%;
|
||
overflow: hidden;
|
||
position: relative;
|
||
background: linear-gradient(225deg, #022c22 0%, #064e3b 15%, #065f46 25%, #047857 38%, #059669 50%, #07C05F 65%, #10B981 78%, #34D399 90%, #6EE7B7 100%);
|
||
|
||
&::before {
|
||
content: '';
|
||
position: absolute;
|
||
top: 0;
|
||
left: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
background: radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.06) 0%, transparent 50%),
|
||
radial-gradient(circle at 80% 50%, rgba(255, 255, 255, 0.04) 0%, transparent 50%);
|
||
pointer-events: none;
|
||
}
|
||
}
|
||
|
||
.animated-bg {
|
||
position: absolute;
|
||
top: 0;
|
||
left: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
pointer-events: none;
|
||
z-index: 1;
|
||
overflow: hidden;
|
||
contain: strict;
|
||
}
|
||
|
||
.knowledge-node {
|
||
position: absolute;
|
||
width: 40px;
|
||
height: 40px;
|
||
border-radius: 50%;
|
||
background: rgba(255, 255, 255, 0.15);
|
||
border: 2px solid rgba(255, 255, 255, 0.3);
|
||
box-shadow:
|
||
0 0 15px rgba(255, 255, 255, 0.35),
|
||
0 0 30px rgba(16, 185, 129, 0.2),
|
||
inset 0 0 8px rgba(255, 255, 255, 0.1);
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
animation: nodePulse 5s infinite ease-in-out;
|
||
will-change: transform, opacity;
|
||
}
|
||
|
||
.node-icon {
|
||
width: 20px;
|
||
height: 20px;
|
||
color: rgba(255, 255, 255, 0.9);
|
||
}
|
||
|
||
.node-1 {
|
||
top: 15%;
|
||
left: 20%;
|
||
animation-delay: 0s;
|
||
}
|
||
|
||
.node-2 {
|
||
top: 25%;
|
||
left: 35%;
|
||
animation-delay: 0.5s;
|
||
}
|
||
|
||
.node-3 {
|
||
top: 20%;
|
||
left: 55%;
|
||
animation-delay: 1s;
|
||
}
|
||
|
||
.node-4 {
|
||
top: 30%;
|
||
left: 75%;
|
||
animation-delay: 1.5s;
|
||
}
|
||
|
||
.node-5 {
|
||
top: 45%;
|
||
left: 25%;
|
||
animation-delay: 2s;
|
||
}
|
||
|
||
.node-6 {
|
||
top: 50%;
|
||
left: 45%;
|
||
animation-delay: 2.5s;
|
||
}
|
||
|
||
.node-7 {
|
||
top: 48%;
|
||
left: 65%;
|
||
animation-delay: 3s;
|
||
}
|
||
|
||
.node-8 {
|
||
top: 60%;
|
||
left: 20%;
|
||
animation-delay: 0.3s;
|
||
}
|
||
|
||
.node-9 {
|
||
top: 12%;
|
||
right: 15%;
|
||
animation-delay: 1.8s;
|
||
}
|
||
|
||
.node-10 {
|
||
top: 38%;
|
||
right: 10%;
|
||
animation-delay: 2.3s;
|
||
}
|
||
|
||
.node-11 {
|
||
top: 70%;
|
||
left: 40%;
|
||
animation-delay: 0.8s;
|
||
}
|
||
|
||
.node-12 {
|
||
top: 65%;
|
||
left: 80%;
|
||
animation-delay: 1.3s;
|
||
}
|
||
|
||
@keyframes nodePulse {
|
||
|
||
0%,
|
||
100% {
|
||
transform: scale(1);
|
||
opacity: 0.65;
|
||
}
|
||
|
||
50% {
|
||
transform: scale(1.08);
|
||
opacity: 0.9;
|
||
}
|
||
}
|
||
|
||
.knowledge-lines {
|
||
position: absolute;
|
||
top: 0;
|
||
left: 0;
|
||
width: 100%;
|
||
height: 100%;
|
||
opacity: 0.35;
|
||
}
|
||
|
||
.connection-line {
|
||
stroke: rgba(255, 255, 255, 0.5);
|
||
stroke-width: 1.5;
|
||
stroke-dasharray: 6, 3;
|
||
stroke-linecap: round;
|
||
animation: lineFlow 10s infinite linear;
|
||
will-change: stroke-dashoffset;
|
||
}
|
||
|
||
.line-1 {
|
||
animation-delay: 0s;
|
||
}
|
||
|
||
.line-2 {
|
||
animation-delay: 0.5s;
|
||
}
|
||
|
||
.line-3 {
|
||
animation-delay: 1s;
|
||
}
|
||
|
||
.line-4 {
|
||
animation-delay: 0.3s;
|
||
}
|
||
|
||
.line-5 {
|
||
animation-delay: 0.8s;
|
||
}
|
||
|
||
.line-6 {
|
||
animation-delay: 1.3s;
|
||
}
|
||
|
||
.line-7 {
|
||
animation-delay: 1.8s;
|
||
}
|
||
|
||
.line-8 {
|
||
animation-delay: 2.3s;
|
||
}
|
||
|
||
.line-9 {
|
||
animation-delay: 0.2s;
|
||
}
|
||
|
||
.line-10 {
|
||
animation-delay: 0.7s;
|
||
}
|
||
|
||
.line-11 {
|
||
animation-delay: 0.9s;
|
||
}
|
||
|
||
.line-12 {
|
||
animation-delay: 1.5s;
|
||
}
|
||
|
||
@keyframes lineFlow {
|
||
0% {
|
||
stroke-dashoffset: 0;
|
||
}
|
||
|
||
100% {
|
||
stroke-dashoffset: 18;
|
||
}
|
||
}
|
||
|
||
@media (prefers-reduced-motion: reduce) {
|
||
.knowledge-node {
|
||
animation: none;
|
||
opacity: 0.65;
|
||
}
|
||
|
||
.connection-line {
|
||
animation: none;
|
||
}
|
||
}
|
||
|
||
/* Left Showcase Section */
|
||
.showcase-section {
|
||
flex: 0 0 52%;
|
||
display: flex;
|
||
align-items: flex-end;
|
||
padding: 100px 30px 100px 50px;
|
||
box-sizing: border-box;
|
||
position: relative;
|
||
}
|
||
|
||
.showcase-content {
|
||
width: 100%;
|
||
max-width: 600px;
|
||
position: relative;
|
||
z-index: 2;
|
||
display: flex;
|
||
flex-direction: column;
|
||
margin-bottom: 60px;
|
||
}
|
||
|
||
.showcase-subtitle {
|
||
margin-top: 0;
|
||
font-size: 22px;
|
||
color: rgba(255, 255, 255, 0.95);
|
||
margin: 0 0 8px 0;
|
||
font-family: var(--app-font-family);
|
||
line-height: 1.4;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.showcase-description {
|
||
font-size: var(--app-text-lg);
|
||
color: rgba(255, 255, 255, 0.8);
|
||
margin: 0 0 28px 0;
|
||
font-family: var(--app-font-family);
|
||
line-height: 1.5;
|
||
}
|
||
|
||
.feature-tags {
|
||
display: flex;
|
||
gap: 12px;
|
||
margin-bottom: 40px;
|
||
flex-wrap: wrap;
|
||
}
|
||
|
||
.tag {
|
||
display: inline-block;
|
||
padding: 8px 20px;
|
||
background: rgba(255, 255, 255, 0.2);
|
||
border-radius: 20px;
|
||
color: var(--td-text-color-anti);
|
||
font-size: var(--app-text-base);
|
||
font-weight: 500;
|
||
font-family: var(--app-font-family);
|
||
}
|
||
|
||
/* Carousel */
|
||
.carousel-container {
|
||
width: 100%;
|
||
margin-top: 48px;
|
||
}
|
||
|
||
.screenshot-swiper {
|
||
width: 100%;
|
||
border-radius: 16px;
|
||
overflow: hidden;
|
||
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
|
||
padding-bottom: 40px;
|
||
|
||
:deep(.swiper-wrapper) {
|
||
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
||
}
|
||
|
||
:deep(.swiper-pagination) {
|
||
bottom: 15px !important;
|
||
z-index: 10;
|
||
}
|
||
|
||
:deep(.swiper-pagination-bullet) {
|
||
width: 10px;
|
||
height: 10px;
|
||
background: rgba(255, 255, 255, 0.5);
|
||
opacity: 1;
|
||
transition: all var(--app-motion-slow) ease;
|
||
margin: 0 6px !important;
|
||
}
|
||
|
||
:deep(.swiper-pagination-bullet-active) {
|
||
background: var(--td-bg-color-container);
|
||
width: 28px;
|
||
border-radius: 5px;
|
||
}
|
||
}
|
||
|
||
.slide-content {
|
||
width: 100%;
|
||
height: 100%;
|
||
background: var(--td-bg-color-container);
|
||
border-radius: 16px;
|
||
overflow: hidden;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.slide-image {
|
||
width: 100%;
|
||
height: 100%;
|
||
display: block;
|
||
object-fit: contain;
|
||
}
|
||
|
||
/* Right Form Section */
|
||
.form-section {
|
||
flex: 0 0 48%;
|
||
display: flex;
|
||
align-items: flex-end;
|
||
justify-content: center;
|
||
padding: 112px 50px 100px 30px;
|
||
box-sizing: border-box;
|
||
position: relative;
|
||
}
|
||
|
||
.form-panel {
|
||
width: 100%;
|
||
max-width: 480px;
|
||
margin-bottom: 60px;
|
||
position: relative;
|
||
z-index: 2;
|
||
}
|
||
|
||
.header-logo {
|
||
position: fixed;
|
||
top: 32px;
|
||
left: 50px;
|
||
z-index: 100;
|
||
cursor: pointer;
|
||
|
||
.logo-image {
|
||
width: 120px;
|
||
height: auto;
|
||
}
|
||
|
||
// 品牌标识增强(测试反馈 2026-11-26):登录页为深绿渐变背景,共用 Logo 的
|
||
// 绿色渐变文字对比度不足 —— 此处覆写为白色高亮文字(保留流光动效)并放大字号,
|
||
// 光点同步提亮;侧边栏(白底)不受影响,仍用共用样式。
|
||
.aido-logo__text {
|
||
font-size: 23px;
|
||
letter-spacing: 2.5px;
|
||
background-image:
|
||
linear-gradient(110deg, rgba(255, 255, 255, 0) 42%, rgba(255, 255, 255, 0.95) 50%, rgba(255, 255, 255, 0) 58%),
|
||
linear-gradient(180deg, #ffffff 0%, #e8fff2 100%);
|
||
-webkit-text-fill-color: transparent;
|
||
filter: drop-shadow(0 1px 8px rgba(0, 64, 32, 0.6));
|
||
}
|
||
|
||
.aido-logo__dot {
|
||
background: radial-gradient(circle at 35% 35%, #ffffff, #7df7c3 60%);
|
||
box-shadow: 0 0 7px 2px rgba(255, 255, 255, 0.65);
|
||
}
|
||
}
|
||
|
||
.header-links {
|
||
position: fixed;
|
||
top: 28px;
|
||
right: 28px;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 10px;
|
||
z-index: 100;
|
||
}
|
||
|
||
.header-link {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 7px;
|
||
padding: 9px 15px;
|
||
border-radius: 20px;
|
||
background: rgba(255, 255, 255, 0.2);
|
||
border: 1px solid rgba(255, 255, 255, 0.25);
|
||
color: var(--td-text-color-anti);
|
||
text-decoration: none;
|
||
font-size: var(--app-text-md);
|
||
font-weight: 600;
|
||
font-family: var(--app-font-family);
|
||
letter-spacing: 0.2px;
|
||
cursor: pointer;
|
||
position: relative;
|
||
|
||
svg {
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.link-text {
|
||
line-height: 1;
|
||
}
|
||
|
||
&:hover {
|
||
background: rgba(255, 255, 255, 0.3);
|
||
border-color: rgba(255, 255, 255, 0.4);
|
||
color: var(--td-text-color-anti);
|
||
}
|
||
}
|
||
|
||
.language-switch {
|
||
position: relative;
|
||
|
||
button {
|
||
background: rgba(255, 255, 255, 0.2);
|
||
border: 1px solid rgba(255, 255, 255, 0.25);
|
||
color: var(--td-text-color-anti);
|
||
|
||
.lang-flag-icon {
|
||
font-size: var(--app-text-xl);
|
||
line-height: 1;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
&:hover {
|
||
background: rgba(255, 255, 255, 0.3);
|
||
border-color: rgba(255, 255, 255, 0.4);
|
||
}
|
||
|
||
svg:last-child {
|
||
margin-left: 2px;
|
||
flex-shrink: 0;
|
||
}
|
||
}
|
||
}
|
||
|
||
.language-dropdown {
|
||
position: absolute;
|
||
top: calc(100% + 8px);
|
||
right: 0;
|
||
min-width: 160px;
|
||
background: rgba(255, 255, 255, 0.97);
|
||
border: 1px solid var(--td-component-stroke);
|
||
border-radius: var(--app-radius-md);
|
||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
|
||
overflow: hidden;
|
||
z-index: 1000;
|
||
}
|
||
|
||
.language-option {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 10px;
|
||
padding: 10px 14px;
|
||
cursor: pointer;
|
||
font-size: var(--app-text-md);
|
||
font-family: var(--app-font-family);
|
||
color: var(--td-text-color-primary);
|
||
|
||
.lang-flag {
|
||
font-size: var(--app-text-xl);
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.lang-label {
|
||
flex: 1;
|
||
}
|
||
|
||
.check-icon {
|
||
color: var(--td-success-color);
|
||
font-weight: 700;
|
||
font-size: var(--app-text-base);
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
&:hover {
|
||
background: var(--td-bg-color-secondarycontainer);
|
||
}
|
||
|
||
&.active {
|
||
background: var(--td-success-color-light);
|
||
color: var(--td-brand-color-active);
|
||
}
|
||
}
|
||
|
||
.form-card {
|
||
background: rgba(255, 255, 255, 0.97);
|
||
border-radius: 16px;
|
||
padding: 40px;
|
||
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
|
||
box-sizing: border-box;
|
||
border: none;
|
||
width: 100%;
|
||
}
|
||
|
||
/* Share-link invitation banner. Sits above the register form when the
|
||
* user arrived via /register?token=xxx; gives them confirmation of who
|
||
* invited them before they fill anything in. Subtle, neutral card —
|
||
* the page background is heavily brand-coloured already, so a loud
|
||
* tinted banner clashes; we lean on the form's own surface tokens. */
|
||
.invite-banner {
|
||
display: flex;
|
||
align-items: flex-start;
|
||
gap: 10px;
|
||
padding: 12px 14px;
|
||
margin-bottom: 20px;
|
||
border-radius: var(--app-radius-lg);
|
||
background: var(--td-bg-color-container-hover);
|
||
border: 1px solid var(--td-component-stroke);
|
||
color: var(--td-text-color-primary);
|
||
}
|
||
|
||
.invite-banner__icon {
|
||
margin-top: 2px;
|
||
font-size: var(--app-text-2xl);
|
||
flex-shrink: 0;
|
||
color: var(--td-text-color-secondary);
|
||
}
|
||
|
||
.invite-banner__text {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 2px;
|
||
min-width: 0;
|
||
}
|
||
|
||
.invite-banner__title {
|
||
font-size: var(--app-text-base);
|
||
font-weight: 600;
|
||
line-height: 1.4;
|
||
color: var(--td-text-color-primary);
|
||
}
|
||
|
||
.invite-banner__hint {
|
||
font-size: var(--app-text-sm);
|
||
color: var(--td-text-color-secondary);
|
||
line-height: 1.5;
|
||
}
|
||
|
||
.invite-banner--error {
|
||
background: var(--td-error-color-1);
|
||
border-color: var(--td-error-color-3);
|
||
color: var(--td-error-color);
|
||
font-size: var(--app-text-md);
|
||
}
|
||
|
||
.form-header {
|
||
text-align: center;
|
||
margin-bottom: 32px;
|
||
}
|
||
|
||
.form-title {
|
||
font-size: var(--app-text-4xl);
|
||
font-weight: 600;
|
||
color: var(--td-text-color-primary);
|
||
margin: 0 0 6px 0;
|
||
font-family: var(--app-font-family);
|
||
}
|
||
|
||
.form-welcome {
|
||
font-size: var(--app-text-md);
|
||
color: var(--td-text-color-secondary);
|
||
margin: 0;
|
||
font-family: var(--app-font-family);
|
||
}
|
||
|
||
.form-hint {
|
||
margin: 10px 0 0;
|
||
padding: 8px 12px;
|
||
border-radius: var(--app-radius-md);
|
||
background: var(--td-success-color-light);
|
||
color: var(--td-brand-color-active);
|
||
font-size: 12.5px;
|
||
line-height: 1.5;
|
||
font-family: var(--app-font-family);
|
||
}
|
||
|
||
/* 注册入口:从底部小字链接升级为带分隔线的醒目次级按钮,
|
||
让首次访客一眼就能找到「创建账户」。 */
|
||
.register-cta {
|
||
margin-top: 8px;
|
||
|
||
&__divider {
|
||
position: relative;
|
||
text-align: center;
|
||
margin: 4px 0 14px;
|
||
color: var(--td-text-color-secondary);
|
||
font-size: var(--app-text-md);
|
||
font-family: var(--app-font-family);
|
||
|
||
span {
|
||
position: relative;
|
||
z-index: 1;
|
||
padding: 0 12px;
|
||
background: rgba(255, 255, 255, 0.97);
|
||
}
|
||
|
||
&::before {
|
||
content: '';
|
||
position: absolute;
|
||
left: 0;
|
||
right: 0;
|
||
top: 50%;
|
||
border-top: 1px solid var(--td-component-stroke);
|
||
}
|
||
}
|
||
|
||
&__button {
|
||
height: 46px;
|
||
border-radius: var(--app-radius-md);
|
||
font-size: var(--app-text-lg);
|
||
font-weight: 500;
|
||
border-color: var(--td-brand-color);
|
||
color: var(--td-brand-color);
|
||
|
||
&:hover {
|
||
border-color: var(--td-brand-color-active);
|
||
color: var(--td-brand-color-active);
|
||
background: var(--td-success-color-light);
|
||
}
|
||
}
|
||
}
|
||
|
||
.form-subtitle {
|
||
font-size: var(--app-text-md);
|
||
color: var(--td-text-color-secondary);
|
||
margin: 0;
|
||
font-family: var(--app-font-family);
|
||
}
|
||
|
||
.form-content {
|
||
:deep(.t-form-item__label) {
|
||
font-size: var(--app-text-base);
|
||
color: var(--td-text-color-primary);
|
||
font-weight: 500;
|
||
margin-bottom: 8px;
|
||
font-family: var(--app-font-family);
|
||
display: block;
|
||
text-align: left;
|
||
}
|
||
|
||
:deep(.t-input) {
|
||
border: 1px solid var(--td-component-stroke);
|
||
border-radius: var(--app-radius-md);
|
||
background: var(--td-bg-color-container);
|
||
transition: all var(--app-motion-base);
|
||
|
||
&:focus-within {
|
||
border-color: var(--td-brand-color);
|
||
box-shadow: 0 0 0 3px color-mix(in srgb, var(--td-brand-color) 10%, transparent);
|
||
}
|
||
|
||
&:hover {
|
||
border-color: var(--td-brand-color);
|
||
}
|
||
|
||
.t-input__inner {
|
||
border: none !important;
|
||
box-shadow: none !important;
|
||
outline: none !important;
|
||
background: transparent;
|
||
font-size: var(--app-text-lg);
|
||
font-family: var(--app-font-family);
|
||
|
||
&:focus {
|
||
border: none !important;
|
||
box-shadow: none !important;
|
||
outline: none !important;
|
||
}
|
||
}
|
||
|
||
.t-input__wrap {
|
||
border: none !important;
|
||
box-shadow: none !important;
|
||
}
|
||
}
|
||
|
||
:deep(.t-form-item) {
|
||
margin-bottom: 18px;
|
||
|
||
&:last-child {
|
||
margin-bottom: 0;
|
||
}
|
||
}
|
||
|
||
:deep(.t-form-item__control) {
|
||
width: 100%;
|
||
}
|
||
}
|
||
|
||
.submit-button {
|
||
height: 46px;
|
||
border-radius: var(--app-radius-md);
|
||
font-size: var(--app-text-xl);
|
||
font-weight: 500;
|
||
font-family: var(--app-font-family);
|
||
margin: 20px 0 16px 0;
|
||
}
|
||
|
||
/* 工号直登 / 邮箱登录 模式切换(password grant) */
|
||
.login-mode-switch {
|
||
display: flex;
|
||
gap: 8px;
|
||
margin-bottom: 20px;
|
||
background: var(--td-bg-color-secondarycontainer);
|
||
border-radius: var(--app-radius-md);
|
||
padding: 4px;
|
||
|
||
.mode-button {
|
||
flex: 1;
|
||
height: 36px;
|
||
border: none;
|
||
border-radius: calc(var(--app-radius-md) - 2px);
|
||
background: transparent;
|
||
color: var(--td-text-color-secondary);
|
||
font-size: var(--app-text-md);
|
||
font-family: var(--app-font-family);
|
||
cursor: pointer;
|
||
transition: all var(--app-motion-base);
|
||
|
||
&.active {
|
||
background: var(--td-bg-color-container);
|
||
color: var(--td-brand-color-active);
|
||
font-weight: 600;
|
||
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
|
||
}
|
||
|
||
&:hover:not(.active) {
|
||
color: var(--td-text-color-primary);
|
||
}
|
||
|
||
&:disabled {
|
||
cursor: not-allowed;
|
||
opacity: 0.6;
|
||
}
|
||
}
|
||
}
|
||
|
||
.oidc-divider {
|
||
position: relative;
|
||
margin: 4px 0 6px;
|
||
text-align: center;
|
||
color: var(--td-text-color-placeholder);
|
||
font-size: var(--app-text-sm);
|
||
span {
|
||
position: relative;
|
||
z-index: 1;
|
||
padding: 0 12px;
|
||
background: rgba(255, 255, 255, 0.95);
|
||
}
|
||
|
||
&::before {
|
||
content: '';
|
||
position: absolute;
|
||
left: 0;
|
||
right: 0;
|
||
top: 50%;
|
||
border-top: 1px solid var(--td-component-stroke);
|
||
}
|
||
}
|
||
|
||
.oidc-button {
|
||
height: 46px;
|
||
border-radius: var(--app-radius-md);
|
||
font-size: var(--app-text-lg);
|
||
font-weight: 500;
|
||
}
|
||
|
||
.form-footer {
|
||
text-align: center;
|
||
font-size: var(--app-text-base);
|
||
color: var(--td-text-color-secondary);
|
||
font-family: var(--app-font-family);
|
||
margin-top: 16px;
|
||
padding-bottom: 16px;
|
||
border-bottom: 1px solid var(--td-component-stroke);
|
||
|
||
.link-button {
|
||
color: var(--td-brand-color);
|
||
text-decoration: none;
|
||
margin-left: 4px;
|
||
font-weight: 500;
|
||
transition: all var(--app-motion-base);
|
||
|
||
&:hover {
|
||
color: var(--td-brand-color);
|
||
text-decoration: underline;
|
||
}
|
||
}
|
||
}
|
||
|
||
.login-form-footer {
|
||
border-bottom: none;
|
||
padding-bottom: 8px;
|
||
margin-top: 12px;
|
||
}
|
||
|
||
.login-features {
|
||
margin-top: 20px;
|
||
padding: 0;
|
||
|
||
.feature-item {
|
||
display: flex;
|
||
align-items: center;
|
||
margin-bottom: 12px;
|
||
font-size: var(--app-text-md);
|
||
color: var(--td-text-color-secondary);
|
||
font-family: var(--app-font-family);
|
||
|
||
&:last-child {
|
||
margin-bottom: 0;
|
||
}
|
||
|
||
.feature-icon {
|
||
width: 20px;
|
||
height: 20px;
|
||
border-radius: 50%;
|
||
background: var(--td-success-color-light);
|
||
color: var(--td-brand-color-active);
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
font-size: var(--app-text-sm);
|
||
font-weight: 700;
|
||
margin-right: 10px;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.feature-text {
|
||
line-height: 1.4;
|
||
}
|
||
}
|
||
}
|
||
|
||
/* Responsive Design */
|
||
@media (max-width: 1024px) {
|
||
.knowledge-node:nth-of-type(n + 13) {
|
||
display: none;
|
||
}
|
||
|
||
.connection-line:nth-of-type(n + 13) {
|
||
display: none;
|
||
}
|
||
|
||
.showcase-subtitle {
|
||
font-size: var(--app-text-2xl);
|
||
}
|
||
|
||
.header-logo {
|
||
top: 26px;
|
||
left: 40px;
|
||
|
||
.logo-image {
|
||
width: 100px;
|
||
}
|
||
}
|
||
|
||
.header-links {
|
||
top: 22px;
|
||
right: 22px;
|
||
gap: 8px;
|
||
|
||
.link-text {
|
||
display: none;
|
||
}
|
||
|
||
.header-link {
|
||
padding: 10px;
|
||
gap: 0;
|
||
}
|
||
}
|
||
}
|
||
|
||
@media (max-width: 768px) {
|
||
.login-layout {
|
||
flex-direction: column;
|
||
padding-top: 64px;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.knowledge-node:nth-of-type(n + 9) {
|
||
display: none;
|
||
}
|
||
|
||
.connection-line:nth-of-type(n + 9) {
|
||
display: none;
|
||
}
|
||
|
||
.showcase-section {
|
||
flex: 0 0 auto;
|
||
min-height: 50vh;
|
||
padding: 40px 24px;
|
||
}
|
||
|
||
.showcase-content {
|
||
max-width: 100%;
|
||
}
|
||
|
||
.header-logo {
|
||
top: 22px;
|
||
left: 30px;
|
||
|
||
.logo-image {
|
||
width: 80px;
|
||
}
|
||
}
|
||
|
||
.showcase-subtitle {
|
||
font-size: var(--app-text-xl);
|
||
margin-bottom: 24px;
|
||
}
|
||
|
||
.feature-tags {
|
||
margin-bottom: 24px;
|
||
}
|
||
|
||
.carousel-container {
|
||
margin-top: 24px;
|
||
}
|
||
|
||
.form-section {
|
||
order: -1;
|
||
flex: 0 0 auto;
|
||
padding: 24px;
|
||
}
|
||
|
||
.header-links {
|
||
top: 18px;
|
||
right: 18px;
|
||
gap: 8px;
|
||
|
||
.link-text {
|
||
display: inline;
|
||
}
|
||
|
||
.header-link {
|
||
padding: 8px 12px;
|
||
font-size: var(--app-text-sm);
|
||
}
|
||
}
|
||
|
||
.form-card {
|
||
padding: 32px 24px;
|
||
}
|
||
|
||
.form-title {
|
||
font-size: 22px;
|
||
}
|
||
}
|
||
|
||
@media (max-width: 480px) {
|
||
.animated-bg {
|
||
display: none;
|
||
}
|
||
|
||
.showcase-section {
|
||
padding: 32px 20px;
|
||
}
|
||
|
||
.header-logo {
|
||
top: 18px;
|
||
left: 20px;
|
||
|
||
.logo-image {
|
||
width: 70px;
|
||
}
|
||
}
|
||
|
||
.showcase-subtitle {
|
||
font-size: var(--app-text-base);
|
||
}
|
||
|
||
.tag {
|
||
font-size: var(--app-text-sm);
|
||
padding: 6px 16px;
|
||
}
|
||
|
||
.form-section {
|
||
padding: 20px;
|
||
}
|
||
|
||
.header-links {
|
||
top: 14px;
|
||
right: 14px;
|
||
gap: 6px;
|
||
flex-wrap: wrap;
|
||
|
||
.link-text {
|
||
display: none;
|
||
}
|
||
|
||
.header-link {
|
||
padding: 7px 10px;
|
||
font-size: var(--app-text-xs);
|
||
}
|
||
}
|
||
|
||
.form-card {
|
||
padding: 28px 20px;
|
||
}
|
||
|
||
.form-header {
|
||
margin-bottom: 24px;
|
||
}
|
||
}
|
||
|
||
@media (prefers-reduced-motion: reduce) {
|
||
|
||
.knowledge-node,
|
||
.connection-line {
|
||
animation: none !important;
|
||
transition: none !important;
|
||
}
|
||
|
||
.animated-bg {
|
||
display: none;
|
||
}
|
||
}
|
||
</style>
|
||
|
||
<style lang="less">
|
||
html[theme-mode="dark"] {
|
||
.login-layout {
|
||
background: linear-gradient(225deg, #011a14 0%, #032e22 15%, #043a2c 25%, #05503d 38%, #046647 50%, #038a56 65%, #049b60 78%, #06a06a 90%, #07b074 100%);
|
||
}
|
||
|
||
.knowledge-node {
|
||
background: rgba(255, 255, 255, 0.1);
|
||
border-color: rgba(255, 255, 255, 0.2);
|
||
box-shadow: 0 0 8px rgba(255, 255, 255, 0.15);
|
||
}
|
||
|
||
.connection-line {
|
||
stroke: rgba(255, 255, 255, 0.25);
|
||
}
|
||
|
||
.header-logo .logo-image {
|
||
filter: invert(1) hue-rotate(180deg) brightness(1.1);
|
||
}
|
||
|
||
.header-link {
|
||
background: rgba(255, 255, 255, 0.12);
|
||
border-color: rgba(255, 255, 255, 0.15);
|
||
|
||
&:hover {
|
||
background: rgba(255, 255, 255, 0.2);
|
||
}
|
||
}
|
||
|
||
.language-switch button {
|
||
background: rgba(255, 255, 255, 0.12);
|
||
border-color: rgba(255, 255, 255, 0.15);
|
||
|
||
&:hover {
|
||
background: rgba(255, 255, 255, 0.2);
|
||
}
|
||
}
|
||
|
||
.language-dropdown {
|
||
background: rgba(36, 36, 36, 0.97) !important;
|
||
border-color: var(--td-component-stroke) !important;
|
||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) !important;
|
||
}
|
||
|
||
.tag {
|
||
background: rgba(255, 255, 255, 0.12);
|
||
}
|
||
|
||
.form-card {
|
||
background: rgba(36, 36, 36, 0.97) !important;
|
||
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4) !important;
|
||
}
|
||
|
||
.register-cta__divider span {
|
||
background: rgba(36, 36, 36, 0.97);
|
||
}
|
||
|
||
.form-content .t-input {
|
||
background: var(--td-bg-color-page) !important;
|
||
border-color: rgba(255, 255, 255, 0.1) !important;
|
||
|
||
&:hover {
|
||
border-color: var(--td-brand-color) !important;
|
||
}
|
||
|
||
&:focus-within {
|
||
border-color: var(--td-brand-color) !important;
|
||
}
|
||
}
|
||
|
||
.screenshot-swiper .swiper-pagination-bullet-active {
|
||
background: rgba(255, 255, 255, 0.9) !important;
|
||
}
|
||
|
||
.login-features .feature-icon {
|
||
background: rgba(6, 176, 77, 0.15);
|
||
}
|
||
}
|
||
</style>
|