refactor(chat + workspace): chat和workspace重构,子路由、懒加载等
This commit is contained in:
1 parent
0a647a0b79
commit
1f1f7236b0
57 files changed
+4356
-3798
No files matched your search
@@ -0,0 +1,195 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* features/auth/components/LoginModals.vue
|
||||
* 登录相关弹窗:找回密码、公告详情、企微登录/绑定提示、注册。
|
||||
*/
|
||||
import { inject } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { Lock, User, X } from 'lucide-vue-next';
|
||||
import { formatWecomFieldLabel } from '@/utils/wecom';
|
||||
import { LOGIN_KEY } from '../composables/login.context';
|
||||
|
||||
const { t } = useI18n();
|
||||
const lk = inject(LOGIN_KEY)! as any;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div
|
||||
v-if="lk.showForgotPasswordModal"
|
||||
class="dialog-overlay z-50 items-center animate-fade-in"
|
||||
@click.self="lk.showForgotPasswordModal = false"
|
||||
>
|
||||
<div class="dialog-panel max-w-md animate-slide-up">
|
||||
<div class="dialog-header dialog-header--compact relative border-0 pb-0">
|
||||
<div class="flex-1" />
|
||||
<button type="button" class="btn-icon-ds" :aria-label="$t('admin.close')" @click="lk.showForgotPasswordModal = false">
|
||||
<X class="w-5 h-5" />
|
||||
</button>
|
||||
</div>
|
||||
<div class="dialog-body pt-0 text-center">
|
||||
<div class="mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-xl bg-brand-100 text-brand-600">
|
||||
<Lock class="w-6 h-6" />
|
||||
</div>
|
||||
<h3 class="text-xl font-bold text-primary">{{ $t('login.forgotPassword') }}</h3>
|
||||
<p class="mt-2 text-sm text-muted">{{ $t('login.forgotPasswordDesc') }}</p>
|
||||
<div class="mt-6 space-y-2 text-left">
|
||||
<label class="label-field ml-1">{{ $t('register.email') }}</label>
|
||||
<input v-model="lk.forgotPasswordForm.email" :placeholder="$t('register.email')" class="input-field" @keyup.enter="lk.handleForgotPassword" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="dialog-footer">
|
||||
<button type="button" @click="lk.showForgotPasswordModal = false" class="btn-secondary flex-1">{{ $t('register.cancel') }}</button>
|
||||
<button type="button" @click="lk.handleForgotPassword" class="btn-primary flex-1">{{ $t('login.findPassword') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="lk.showAnnouncementModal && lk.selectedAnnouncement"
|
||||
class="dialog-overlay z-50 items-center animate-fade-in"
|
||||
@click.self="lk.showAnnouncementModal = false"
|
||||
>
|
||||
<div class="dialog-panel max-w-2xl max-h-[85vh] animate-slide-up">
|
||||
<div class="dialog-header">
|
||||
<div class="min-w-0">
|
||||
<span class="inline-flex rounded-full bg-brand-50 px-2 py-1 text-xs font-bold text-brand-600">{{ new Date(lk.selectedAnnouncement.created_at).toLocaleDateString() }}</span>
|
||||
<h3 class="mt-2 text-2xl font-bold text-primary">{{ lk.selectedAnnouncement.title }}</h3>
|
||||
</div>
|
||||
<button type="button" class="btn-icon-ds shrink-0" :aria-label="$t('admin.close')" @click="lk.showAnnouncementModal = false">
|
||||
<X class="w-5 h-5" />
|
||||
</button>
|
||||
</div>
|
||||
<div class="dialog-body">
|
||||
<p class="whitespace-pre-wrap leading-relaxed text-secondary">{{ lk.selectedAnnouncement.content }}</p>
|
||||
</div>
|
||||
<div class="dialog-footer">
|
||||
<button type="button" @click="lk.showAnnouncementModal = false" class="btn-primary">
|
||||
{{ $t('admin.close') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="lk.wecomLoginDialog"
|
||||
class="dialog-overlay z-50 items-center animate-fade-in"
|
||||
@click.self="lk.wecomLoginDialog = null"
|
||||
>
|
||||
<div class="dialog-panel max-w-lg animate-slide-up">
|
||||
<div class="dialog-header dialog-header--compact">
|
||||
<div class="flex items-start gap-3 min-w-0">
|
||||
<div class="flex h-12 w-12 shrink-0 items-center justify-center rounded-xl bg-amber-100 text-amber-700">
|
||||
<Lock class="w-6 h-6" />
|
||||
</div>
|
||||
<div class="min-w-0">
|
||||
<h3 class="text-xl font-bold text-primary">{{ lk.wecomLoginDialog.title }}</h3>
|
||||
<p class="mt-2 text-sm leading-6 text-secondary">{{ lk.wecomLoginDialog.summary }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="btn-icon-ds shrink-0" :aria-label="$t('admin.close')" @click="lk.wecomLoginDialog = null">
|
||||
<X class="w-5 h-5" />
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
v-if="lk.wecomLoginDialog?.details?.length || lk.wecomLoginDialog?.technical"
|
||||
class="dialog-body border-t-0 pt-0 space-y-4"
|
||||
>
|
||||
<div v-if="lk.wecomLoginDialog?.details?.length" class="rounded-2xl border border-default bg-surface-soft/80 px-4 py-4 space-y-3">
|
||||
<p v-for="(detail, index) in lk.wecomLoginDialog.details" :key="`${detail}-${index}`" class="text-sm leading-6 text-secondary">
|
||||
{{ detail }}
|
||||
</p>
|
||||
</div>
|
||||
<p v-if="lk.wecomLoginDialog.technical" class="break-all text-xs text-muted">
|
||||
{{ $t('login.wecomTechnicalInfo', { detail: lk.wecomLoginDialog.technical }) }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="dialog-footer">
|
||||
<button type="button" @click="lk.wecomLoginDialog = null" class="btn-secondary">{{ $t('admin.close') }}</button>
|
||||
<button type="button" @click="lk.wecomLoginDialog = null; lk.handleWecomLogin()" class="btn-primary" :disabled="lk.isWecomLoggingIn">
|
||||
{{ $t('login.wecomRetry') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="lk.wecomBindPrompt"
|
||||
class="dialog-overlay z-50 items-center animate-fade-in"
|
||||
@click.self="lk.wecomBindPrompt = null"
|
||||
>
|
||||
<div class="dialog-panel max-w-lg animate-slide-up">
|
||||
<div class="dialog-header dialog-header--compact">
|
||||
<div class="flex items-start gap-3 min-w-0">
|
||||
<div class="mb-0 flex h-12 w-12 shrink-0 items-center justify-center rounded-xl bg-blue-100 text-blue-700">
|
||||
<User class="w-6 h-6" />
|
||||
</div>
|
||||
<div class="min-w-0">
|
||||
<h3 class="text-xl font-bold text-primary">{{ $t('login.wecomBindPromptTitle') }}</h3>
|
||||
<p class="mt-2 text-sm leading-6 text-secondary">
|
||||
{{ $t('login.wecomBindPromptDesc', { name: lk.wecomBindPrompt.wecom_name || '-' }) }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="btn-icon-ds shrink-0" :aria-label="$t('admin.close')" @click="lk.wecomBindPrompt = null">
|
||||
<X class="w-5 h-5" />
|
||||
</button>
|
||||
</div>
|
||||
<div class="dialog-body space-y-4 border-t-0 pt-0">
|
||||
<div>
|
||||
<label class="label-field mb-1.5 block">{{ $t('login.wecomBindField') }}</label>
|
||||
<select v-model="lk.wecomBindPrompt.field" class="input-field">
|
||||
<option v-for="field in lk.wecomBindPrompt.allowed_fields" :key="field" :value="field">
|
||||
{{ formatWecomFieldLabel(field, t) }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="label-field mb-1.5 block">{{ $t('login.wecomBindValue') }}</label>
|
||||
<input
|
||||
v-model="lk.wecomBindPrompt.value"
|
||||
class="input-field"
|
||||
:placeholder="$t('login.wecomBindValuePlaceholder', { field: formatWecomFieldLabel(lk.wecomBindPrompt.field, t) })"
|
||||
@keyup.enter="lk.submitWecomCompleteBind"
|
||||
/>
|
||||
</div>
|
||||
<p class="text-xs leading-5 text-muted">{{ $t('login.wecomBindPromptHint') }}</p>
|
||||
<p v-if="lk.wecomBindPrompt.error" class="text-sm leading-6 text-red-600">{{ lk.wecomBindPrompt.error }}</p>
|
||||
</div>
|
||||
<div class="dialog-footer">
|
||||
<button type="button" @click="lk.wecomBindPrompt = null" class="btn-secondary">{{ $t('admin.close') }}</button>
|
||||
<button type="button" @click="lk.submitWecomCompleteBind" class="btn-primary" :disabled="lk.wecomBindPrompt.submitting">
|
||||
{{ lk.wecomBindPrompt.submitting ? $t('login.wecomConnecting') : $t('login.wecomBindSubmit') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="lk.showRegisterModal"
|
||||
class="dialog-overlay z-50 items-center animate-fade-in"
|
||||
@click.self="lk.showRegisterModal = false"
|
||||
>
|
||||
<div class="dialog-panel max-w-md animate-slide-up">
|
||||
<div class="dialog-header">
|
||||
<h3 class="section-title">{{ $t('register.title') }}</h3>
|
||||
<button type="button" class="btn-icon-ds" :aria-label="$t('admin.close')" @click="lk.showRegisterModal = false">
|
||||
<X class="w-5 h-5" />
|
||||
</button>
|
||||
</div>
|
||||
<div class="dialog-body space-y-4">
|
||||
<input v-model="lk.registerForm.real_name" :placeholder="$t('register.fields.realName')" class="input-field" />
|
||||
<input v-model="lk.registerForm.employee_id" :placeholder="$t('register.fields.employeeId')" class="input-field" />
|
||||
<input v-model="lk.registerForm.phone_number" :placeholder="$t('register.fields.phone')" class="input-field" />
|
||||
<input v-model="lk.registerForm.username" :placeholder="$t('register.username')" class="input-field" />
|
||||
<input v-model="lk.registerForm.email" :placeholder="$t('register.email')" class="input-field" />
|
||||
<input v-model="lk.registerForm.password" type="password" :placeholder="$t('register.password')" class="input-field" />
|
||||
</div>
|
||||
<div class="dialog-footer">
|
||||
<button type="button" @click="lk.showRegisterModal = false" class="btn-secondary">{{ $t('register.cancel') }}</button>
|
||||
<button type="button" @click="lk.handleRegister" class="btn-primary">{{ $t('register.submit') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,109 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* features/auth/components/LoginPage.vue
|
||||
* 登录页主内容:营销文案、公告列表与用户名/密码/企微登录表单。
|
||||
*/
|
||||
import { inject } from 'vue';
|
||||
import { Bot, Megaphone } from 'lucide-vue-next';
|
||||
import { LOGIN_KEY } from '../composables/login.context';
|
||||
|
||||
const lk = inject(LOGIN_KEY)! as any;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div v-if="lk.isLoading" class="animate-pulse space-y-8">
|
||||
<div class="h-48 bg-gray-200 rounded-2xl"></div>
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
|
||||
<div class="h-40 bg-gray-200 rounded-2xl"></div>
|
||||
<div class="h-40 bg-gray-200 rounded-2xl"></div>
|
||||
<div class="h-40 bg-gray-200 rounded-2xl"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-else
|
||||
class="relative min-h-[calc(100vh-4rem)] overflow-hidden rounded-[2rem] flex items-center justify-center"
|
||||
:style="lk.loginBackgroundStyle"
|
||||
>
|
||||
<div class="absolute inset-0 bg-white/55 backdrop-blur-[1px]"></div>
|
||||
<div class="relative z-10 w-full max-w-6xl grid grid-cols-1 lg:grid-cols-2 gap-12 items-center p-4">
|
||||
<div class="hidden lg:block space-y-8 animate-slide-up">
|
||||
<h1 class="text-5xl font-bold text-black leading-tight drop-shadow-sm">
|
||||
{{ $t('landing.hero.prefix') }} <br/>
|
||||
<span class="text-transparent bg-clip-text bg-gradient-to-r from-[#005a9c] to-[#7a1fd0] drop-shadow-sm">{{ $t('landing.hero.highlight') }}</span>
|
||||
</h1>
|
||||
<p class="text-lg text-primary max-w-md leading-relaxed font-semibold drop-shadow-sm">
|
||||
{{ $t('landing.hero.subtitle') }}
|
||||
</p>
|
||||
|
||||
<div v-if="lk.announcements.length > 0" class="bg-white/70 backdrop-blur-sm rounded-2xl border border-default p-6 shadow-sm">
|
||||
<h3 class="text-sm font-bold text-slate-950 mb-4 flex items-center gap-2">
|
||||
<Megaphone class="w-4 h-4 text-brand-600" />
|
||||
{{ $t('login.announcements') }}
|
||||
</h3>
|
||||
<div class="space-y-3">
|
||||
<div
|
||||
v-for="ann in lk.announcements.slice(0, 3)"
|
||||
:key="ann.id"
|
||||
class="group cursor-pointer hover:bg-white/50 p-2 rounded-lg transition-colors"
|
||||
@click="lk.openAnnouncement(ann)"
|
||||
>
|
||||
<div class="flex justify-between items-start gap-2">
|
||||
<h4 class="text-sm font-semibold text-primary group-hover:text-brand-800 line-clamp-1">{{ ann.title }}</h4>
|
||||
<span class="text-[10px] text-muted whitespace-nowrap">{{ new Date(ann.created_at).toLocaleDateString() }}</span>
|
||||
</div>
|
||||
<p class="text-xs text-secondary line-clamp-2 mt-1">{{ ann.content }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="w-full max-w-md mx-auto">
|
||||
<div class="bg-white/90 backdrop-blur-xl rounded-3xl border border-white/20 shadow-2xl shadow-brand-900/10 p-8 md:p-10 animate-fade-in relative overflow-hidden">
|
||||
<div class="absolute top-0 left-0 w-full h-1.5 bg-gradient-to-r from-brand-500 to-purple-600"></div>
|
||||
|
||||
<div class="text-center mb-8">
|
||||
<div class="w-12 h-12 bg-brand-600 rounded-xl mx-auto flex items-center justify-center text-white shadow-lg shadow-brand-600/30 mb-4 lg:hidden">
|
||||
<Bot class="w-7 h-7" />
|
||||
</div>
|
||||
<h2 class="text-2xl font-bold text-primary">{{ $t('login.submit') }}</h2>
|
||||
<p class="text-secondary text-sm mt-2">{{ $t('login.subtitle') }}</p>
|
||||
</div>
|
||||
|
||||
<div class="space-y-5">
|
||||
<div class="space-y-1.5">
|
||||
<label class="text-xs font-semibold text-primary uppercase ml-1">{{ $t('login.username') }}</label>
|
||||
<input v-model="lk.loginUsername" type="text" class="input-field" :placeholder="$t('login.placeholder.username')" @keyup.enter="lk.handleLogin" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="text-xs font-semibold text-primary uppercase ml-1">{{ $t('login.password') }}</label>
|
||||
<input v-model="lk.loginPassword" type="password" class="input-field" :placeholder="$t('login.placeholder.password')" @keyup.enter="lk.handleLogin" />
|
||||
</div>
|
||||
|
||||
<button type="button" @click="lk.handleLogin" class="btn-primary w-full py-3 text-base shadow-brand-500/40 hover:shadow-brand-500/50 transform hover:-translate-y-0.5 transition-all mt-4">
|
||||
{{ $t('login.submit') }}
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
v-if="lk.config.auth?.wecom?.enabled && (!lk.config.auth?.wecom?.loginViaCasdoor || lk.config.auth?.casdoor?.enabled)"
|
||||
@click="lk.handleWecomLogin"
|
||||
:disabled="lk.isWecomLoggingIn"
|
||||
class="btn-secondary w-full py-3 text-base mt-3 disabled:opacity-60 disabled:cursor-not-allowed"
|
||||
>
|
||||
{{ lk.isWecomLoggingIn ? $t('login.wecomConnecting') : $t('login.wecomLogin') }}
|
||||
</button>
|
||||
|
||||
<div class="flex justify-between items-center pt-4 mt-2 border-t border-subtle/50">
|
||||
<button type="button" @click="lk.showForgotPasswordModal = true" class="text-sm text-secondary hover:text-brand-700 transition-colors">
|
||||
{{ $t('login.forgotPassword') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
Reference in new issue
Block a user