This commit is contained in:
dap 2025-03-23 16:51:34 +08:00
commit a8f20a2baa
5 changed files with 23 additions and 21 deletions

View File

@ -17,6 +17,7 @@ interface Props {
toolbar?: boolean; toolbar?: boolean;
copyright?: boolean; copyright?: boolean;
toolbarList?: ToolbarType[]; toolbarList?: ToolbarType[];
clickLogo?: () => void;
} }
withDefaults(defineProps<Props>(), { withDefaults(defineProps<Props>(), {
@ -28,6 +29,7 @@ withDefaults(defineProps<Props>(), {
sloganImage: '', sloganImage: '',
toolbar: true, toolbar: true,
toolbarList: () => ['color', 'language', 'layout', 'theme'], toolbarList: () => ['color', 'language', 'layout', 'theme'],
clickLogo: () => {},
}); });
const { authPanelCenter, authPanelLeft, authPanelRight, isDark } = const { authPanelCenter, authPanelLeft, authPanelRight, isDark } =
@ -61,7 +63,11 @@ const { authPanelCenter, authPanelLeft, authPanelRight, isDark } =
</AuthenticationFormView> </AuthenticationFormView>
<!-- 头部 Logo 和应用名称 --> <!-- 头部 Logo 和应用名称 -->
<div v-if="logo || appName" class="absolute left-0 top-0 z-10 flex flex-1"> <div
v-if="logo || appName"
class="absolute left-0 top-0 z-10 flex flex-1"
@click="clickLogo"
>
<div <div
class="text-foreground lg:text-foreground ml-4 mt-4 flex flex-1 items-center sm:left-6 sm:top-6" class="text-foreground lg:text-foreground ml-4 mt-4 flex flex-1 items-center sm:left-6 sm:top-6"
> >

View File

@ -34,7 +34,7 @@ import { LayoutTabbar } from './tabbar';
defineOptions({ name: 'BasicLayout' }); defineOptions({ name: 'BasicLayout' });
const emit = defineEmits<{ clearPreferencesAndLogout: [] }>(); const emit = defineEmits<{ clearPreferencesAndLogout: []; clickLogo: [] }>();
const { const {
isDark, isDark,
@ -149,6 +149,10 @@ function clearPreferencesAndLogout() {
emit('clearPreferencesAndLogout'); emit('clearPreferencesAndLogout');
} }
function clickLogo() {
emit('clickLogo');
}
watch( watch(
() => preferences.app.layout, () => preferences.app.layout,
async (val) => { async (val) => {
@ -221,6 +225,7 @@ const headerSlots = computed(() => {
:src="preferences.logo.source" :src="preferences.logo.source"
:text="preferences.app.name" :text="preferences.app.name"
:theme="showHeaderNav ? headerTheme : theme" :theme="showHeaderNav ? headerTheme : theme"
@click="clickLogo"
/> />
</template> </template>
<!-- 头部区域 --> <!-- 头部区域 -->

View File

@ -8,6 +8,7 @@ import { $t } from '#/locales';
const appName = computed(() => preferences.app.name); const appName = computed(() => preferences.app.name);
const logo = computed(() => preferences.logo.source); const logo = computed(() => preferences.logo.source);
const clickLogo = () => {};
</script> </script>
<template> <template>
@ -16,6 +17,7 @@ const logo = computed(() => preferences.logo.source);
:logo="logo" :logo="logo"
:page-description="$t('authentication.pageDesc')" :page-description="$t('authentication.pageDesc')"
:page-title="$t('authentication.pageTitle')" :page-title="$t('authentication.pageTitle')"
:click-logo="clickLogo"
> >
<!-- 自定义工具栏 --> <!-- 自定义工具栏 -->
<!-- <template #toolbar></template> --> <!-- <template #toolbar></template> -->

View File

@ -106,6 +106,8 @@ function handleMakeAll() {
notifications.value.forEach((item) => (item.isRead = true)); notifications.value.forEach((item) => (item.isRead = true));
} }
function handleClickLogo() {}
watch( watch(
() => preferences.app.watermark, () => preferences.app.watermark,
async (enable) => { async (enable) => {
@ -124,7 +126,10 @@ watch(
</script> </script>
<template> <template>
<BasicLayout @clear-preferences-and-logout="handleLogout"> <BasicLayout
@clear-preferences-and-logout="handleLogout"
@click-logo="handleClickLogo"
>
<template #user-dropdown> <template #user-dropdown>
<UserDropdown <UserDropdown
:avatar :avatar

View File

@ -32,7 +32,6 @@ const emit = defineEmits<{
success: []; success: [];
}>(); }>();
const formData = ref<SystemMenuApi.SystemMenu>(); const formData = ref<SystemMenuApi.SystemMenu>();
const loading = ref(false);
const titleSuffix = ref<string>(); const titleSuffix = ref<string>();
const schema: VbenFormSchema[] = [ const schema: VbenFormSchema[] = [
{ {
@ -445,9 +444,6 @@ const [Form, formApi] = useVbenForm({
}); });
const [Drawer, drawerApi] = useVbenDrawer({ const [Drawer, drawerApi] = useVbenDrawer({
onBeforeClose() {
if (loading.value) return false;
},
onConfirm: onSubmit, onConfirm: onSubmit,
onOpenChange(isOpen) { onOpenChange(isOpen) {
if (isOpen) { if (isOpen) {
@ -474,13 +470,7 @@ const [Drawer, drawerApi] = useVbenDrawer({
async function onSubmit() { async function onSubmit() {
const { valid } = await formApi.validate(); const { valid } = await formApi.validate();
if (valid) { if (valid) {
loading.value = true; drawerApi.lock();
drawerApi.setState({
closeOnClickModal: false,
closeOnPressEscape: false,
confirmLoading: true,
loading: true,
});
const data = const data =
await formApi.getValues< await formApi.getValues<
Omit<SystemMenuApi.SystemMenu, 'children' | 'id'> Omit<SystemMenuApi.SystemMenu, 'children' | 'id'>
@ -498,13 +488,7 @@ async function onSubmit() {
drawerApi.close(); drawerApi.close();
emit('success'); emit('success');
} finally { } finally {
loading.value = false; drawerApi.unlock();
drawerApi.setState({
closeOnClickModal: true,
closeOnPressEscape: true,
confirmLoading: false,
loading: false,
});
} }
} }
} }