|
|
@ -18,6 +18,7 @@ import { computed, ref } from 'vue'; |
|
|
import { $t, loadLocaleMessages } from '@vben/locales'; |
|
|
import { $t, loadLocaleMessages } from '@vben/locales'; |
|
|
import { IcRoundFolderCopy, IcRoundRestartAlt } from '@vben-core/iconify'; |
|
|
import { IcRoundFolderCopy, IcRoundRestartAlt } from '@vben-core/iconify'; |
|
|
import { |
|
|
import { |
|
|
|
|
|
clearPreferencesCache, |
|
|
preferences, |
|
|
preferences, |
|
|
resetPreferences, |
|
|
resetPreferences, |
|
|
usePreferences, |
|
|
usePreferences, |
|
|
@ -53,6 +54,8 @@ import { |
|
|
import Trigger from './trigger.vue'; |
|
|
import Trigger from './trigger.vue'; |
|
|
import { useOpenPreferences } from './use-open-preferences'; |
|
|
import { useOpenPreferences } from './use-open-preferences'; |
|
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits<{ clearPreferencesAndLogout: [] }>(); |
|
|
|
|
|
|
|
|
const appLocale = defineModel<SupportedLanguagesType>('appLocale'); |
|
|
const appLocale = defineModel<SupportedLanguagesType>('appLocale'); |
|
|
const appDynamicTitle = defineModel<boolean>('appDynamicTitle'); |
|
|
const appDynamicTitle = defineModel<boolean>('appDynamicTitle'); |
|
|
const appAiAssistant = defineModel<boolean>('appAiAssistant'); |
|
|
const appAiAssistant = defineModel<boolean>('appAiAssistant'); |
|
|
@ -166,6 +169,12 @@ async function handleCopy() { |
|
|
toast($t('preferences.copy-success')); |
|
|
toast($t('preferences.copy-success')); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async function handleClearCache() { |
|
|
|
|
|
resetPreferences(); |
|
|
|
|
|
clearPreferencesCache(); |
|
|
|
|
|
emit('clearPreferencesAndLogout'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
async function handleReset() { |
|
|
async function handleReset() { |
|
|
if (!diffPreference.value) { |
|
|
if (!diffPreference.value) { |
|
|
return; |
|
|
return; |
|
|
@ -187,17 +196,19 @@ async function handleReset() { |
|
|
<Trigger /> |
|
|
<Trigger /> |
|
|
</template> |
|
|
</template> |
|
|
<template #extra> |
|
|
<template #extra> |
|
|
<VbenIconButton |
|
|
<div class="flex items-center"> |
|
|
:disabled="!diffPreference" |
|
|
<VbenIconButton |
|
|
:tooltip="$t('preferences.reset-tip')" |
|
|
:disabled="!diffPreference" |
|
|
class="relative" |
|
|
:tooltip="$t('preferences.reset-tip')" |
|
|
> |
|
|
class="relative" |
|
|
<span |
|
|
> |
|
|
v-if="diffPreference" |
|
|
<span |
|
|
class="bg-primary absolute right-0.5 top-0.5 h-2 w-2 rounded" |
|
|
v-if="diffPreference" |
|
|
></span> |
|
|
class="bg-primary absolute right-0.5 top-0.5 h-2 w-2 rounded" |
|
|
<IcRoundRestartAlt class="size-5" @click="handleReset" /> |
|
|
></span> |
|
|
</VbenIconButton> |
|
|
<IcRoundRestartAlt class="size-5" @click="handleReset" /> |
|
|
|
|
|
</VbenIconButton> |
|
|
|
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<div class="p-4 pt-4"> |
|
|
<div class="p-4 pt-4"> |
|
|
@ -328,9 +339,18 @@ async function handleReset() { |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<template #footer> |
|
|
<template #footer> |
|
|
|
|
|
<VbenButton |
|
|
|
|
|
class="mx-4 w-full" |
|
|
|
|
|
size="sm" |
|
|
|
|
|
variant="outline" |
|
|
|
|
|
@click="handleClearCache" |
|
|
|
|
|
> |
|
|
|
|
|
<IcRoundRestartAlt class="mr-2 size-4" /> |
|
|
|
|
|
{{ $t('preferences.clear-and-logout') }} |
|
|
|
|
|
</VbenButton> |
|
|
<VbenButton |
|
|
<VbenButton |
|
|
:disabled="!diffPreference" |
|
|
:disabled="!diffPreference" |
|
|
class="mx-6 w-full" |
|
|
class="mr-4 w-full" |
|
|
size="sm" |
|
|
size="sm" |
|
|
variant="default" |
|
|
variant="default" |
|
|
@click="handleCopy" |
|
|
@click="handleCopy" |
|
|
|