feat: lighten ai agent admin frontend
This commit is contained in:
@@ -5,7 +5,7 @@ import type { VbenFormSchema } from '@vben-core/form-ui';
|
||||
|
||||
import type { AuthenticationProps } from './types';
|
||||
|
||||
import { computed, defineAsyncComponent, onMounted, reactive, ref } from 'vue';
|
||||
import { computed, onMounted, reactive, ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import { $t } from '@vben/locales';
|
||||
@@ -15,10 +15,6 @@ import { VbenButton, VbenCheckbox } from '@vben-core/shadcn-ui';
|
||||
|
||||
import Title from './auth-title.vue';
|
||||
|
||||
const ThirdPartyLogin = defineAsyncComponent(
|
||||
() => import('./third-party-login.vue'),
|
||||
);
|
||||
|
||||
interface Props extends AuthenticationProps {
|
||||
formSchema?: VbenFormSchema[];
|
||||
}
|
||||
@@ -62,9 +58,7 @@ const [Form, formApi] = useVbenForm(
|
||||
const router = useRouter();
|
||||
|
||||
const REMEMBER_ME_KEY = `REMEMBER_ME_USERNAME_${location.hostname}`;
|
||||
|
||||
const localUsername = localStorage.getItem(REMEMBER_ME_KEY) || '';
|
||||
|
||||
const rememberMe = ref(!!localUsername);
|
||||
|
||||
async function handleSubmit() {
|
||||
@@ -99,7 +93,7 @@ defineExpose({
|
||||
<slot name="title">
|
||||
<Title>
|
||||
<slot name="title">
|
||||
{{ title || `${$t('authentication.welcomeBack')} 👋🏻` }}
|
||||
{{ title || $t('authentication.welcomeBack') }}
|
||||
</slot>
|
||||
<template #desc>
|
||||
<span class="text-muted-foreground">
|
||||
@@ -113,28 +107,29 @@ defineExpose({
|
||||
|
||||
<Form />
|
||||
|
||||
<!-- <div-->
|
||||
<!-- v-if="showRememberMe || showForgetPassword"-->
|
||||
<!-- class="mb-6 flex justify-between"-->
|
||||
<!-- >-->
|
||||
<!-- <div class="flex-center">-->
|
||||
<!-- <VbenCheckbox-->
|
||||
<!-- v-if="showRememberMe"-->
|
||||
<!-- v-model:checked="rememberMe"-->
|
||||
<!-- name="rememberMe"-->
|
||||
<!-- >-->
|
||||
<!-- {{ $t('authentication.rememberMe') }}-->
|
||||
<!-- </VbenCheckbox>-->
|
||||
<!-- </div>-->
|
||||
<div
|
||||
v-if="showRememberMe || showForgetPassword"
|
||||
class="mb-6 flex justify-between"
|
||||
>
|
||||
<div class="flex-center">
|
||||
<VbenCheckbox
|
||||
v-if="showRememberMe"
|
||||
v-model:checked="rememberMe"
|
||||
name="rememberMe"
|
||||
>
|
||||
{{ $t('authentication.rememberMe') }}
|
||||
</VbenCheckbox>
|
||||
</div>
|
||||
|
||||
<span
|
||||
v-if="showForgetPassword"
|
||||
class="vben-link text-sm font-normal"
|
||||
@click="handleGo(forgetPasswordPath)"
|
||||
>
|
||||
{{ $t('authentication.forgetPassword') }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- <span-->
|
||||
<!-- v-if="showForgetPassword"-->
|
||||
<!-- class="vben-link text-sm font-normal"-->
|
||||
<!-- @click="handleGo(forgetPasswordPath)"-->
|
||||
<!-- >-->
|
||||
<!-- {{ $t('authentication.forgetPassword') }}-->
|
||||
<!-- </span>-->
|
||||
<!-- </div>-->
|
||||
<VbenButton
|
||||
:class="{
|
||||
'cursor-wait': loading,
|
||||
@@ -169,21 +164,18 @@ defineExpose({
|
||||
</VbenButton>
|
||||
</div>
|
||||
|
||||
<!-- 第三方登录 -->
|
||||
<slot name="third-party-login">
|
||||
<ThirdPartyLogin v-if="showThirdPartyLogin" />
|
||||
</slot>
|
||||
<slot v-if="showThirdPartyLogin" name="third-party-login"></slot>
|
||||
|
||||
<!-- <slot name="to-register">-->
|
||||
<!-- <div v-if="showRegister" class="mt-3 text-center text-sm">-->
|
||||
<!-- {{ $t('authentication.accountTip') }}-->
|
||||
<!-- <span-->
|
||||
<!-- class="vben-link text-sm font-normal"-->
|
||||
<!-- @click="handleGo(registerPath)"-->
|
||||
<!-- >-->
|
||||
<!-- {{ $t('authentication.createAccount') }}-->
|
||||
<!-- </span>-->
|
||||
<!-- </div>-->
|
||||
<!-- </slot>-->
|
||||
<slot name="to-register">
|
||||
<div v-if="showRegister" class="mt-3 text-center text-sm">
|
||||
{{ $t('authentication.accountTip') }}
|
||||
<span
|
||||
class="vben-link text-sm font-normal"
|
||||
@click="handleGo(registerPath)"
|
||||
>
|
||||
{{ $t('authentication.createAccount') }}
|
||||
</span>
|
||||
</div>
|
||||
</slot>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -1,27 +1,11 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed, defineAsyncComponent, useSlots } from 'vue';
|
||||
|
||||
import { preferences, usePreferences } from '@vben/preferences';
|
||||
import { useAccessStore } from '@vben/stores';
|
||||
import { preferences } from '@vben/preferences';
|
||||
|
||||
const GlobalSearch = defineAsyncComponent(
|
||||
() => import('../../widgets/global-search/global-search.vue'),
|
||||
);
|
||||
const LanguageToggle = defineAsyncComponent(
|
||||
() => import('../../widgets/language-toggle.vue'),
|
||||
);
|
||||
const ThemeToggle = defineAsyncComponent(
|
||||
() => import('../../widgets/theme-toggle/theme-toggle.vue'),
|
||||
);
|
||||
const TimezoneButton = defineAsyncComponent(
|
||||
() => import('../../widgets/timezone/timezone-button.vue'),
|
||||
);
|
||||
const VbenFullScreen = defineAsyncComponent(
|
||||
() =>
|
||||
import(
|
||||
'../../../../../@core/ui-kit/shadcn-ui/src/components/full-screen/full-screen.vue'
|
||||
),
|
||||
);
|
||||
|
||||
interface Props {
|
||||
/**
|
||||
@@ -40,18 +24,10 @@ withDefaults(defineProps<Props>(), {
|
||||
|
||||
const REFERENCE_VALUE = 50;
|
||||
|
||||
const accessStore = useAccessStore();
|
||||
const { globalSearchShortcutKey } = usePreferences();
|
||||
const slots = useSlots();
|
||||
|
||||
const rightSlots = computed(() => {
|
||||
const list = [{ index: REFERENCE_VALUE + 100, name: 'user-dropdown' }];
|
||||
if (preferences.widget.globalSearch) {
|
||||
list.push({
|
||||
index: REFERENCE_VALUE,
|
||||
name: 'global-search',
|
||||
});
|
||||
}
|
||||
|
||||
if (preferences.widget.themeToggle) {
|
||||
list.push({
|
||||
@@ -59,24 +35,6 @@ const rightSlots = computed(() => {
|
||||
name: 'theme-toggle',
|
||||
});
|
||||
}
|
||||
if (preferences.widget.languageToggle) {
|
||||
list.push({
|
||||
index: REFERENCE_VALUE + 30,
|
||||
name: 'language-toggle',
|
||||
});
|
||||
}
|
||||
if (preferences.widget.timezone) {
|
||||
list.push({
|
||||
index: REFERENCE_VALUE + 40,
|
||||
name: 'timezone',
|
||||
});
|
||||
}
|
||||
if (preferences.widget.fullscreen) {
|
||||
list.push({
|
||||
index: REFERENCE_VALUE + 50,
|
||||
name: 'fullscreen',
|
||||
});
|
||||
}
|
||||
if (preferences.widget.notification) {
|
||||
list.push({
|
||||
index: REFERENCE_VALUE + 60,
|
||||
@@ -133,26 +91,9 @@ const leftSlots = computed(() => {
|
||||
<div class="flex h-full min-w-0 flex-shrink-0 items-center">
|
||||
<template v-for="slot in rightSlots" :key="slot.name">
|
||||
<slot :name="slot.name">
|
||||
<template v-if="slot.name === 'global-search'">
|
||||
<GlobalSearch
|
||||
:enable-shortcut-key="globalSearchShortcutKey"
|
||||
:menus="accessStore.accessMenus"
|
||||
class="mr-1 sm:mr-4"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template v-else-if="slot.name === 'theme-toggle'">
|
||||
<template v-if="slot.name === 'theme-toggle'">
|
||||
<ThemeToggle class="mr-1 mt-[2px]" />
|
||||
</template>
|
||||
<template v-else-if="slot.name === 'language-toggle'">
|
||||
<LanguageToggle class="mr-1" />
|
||||
</template>
|
||||
<template v-else-if="slot.name === 'fullscreen'">
|
||||
<VbenFullScreen class="mr-1" />
|
||||
</template>
|
||||
<template v-else-if="slot.name === 'timezone'">
|
||||
<TimezoneButton class="mr-1 mt-[2px]" />
|
||||
</template>
|
||||
</slot>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user