|
|
|
@ -1,25 +1,30 @@ |
|
|
|
<template> |
|
|
|
<div :class="prefixCls"> |
|
|
|
<a-button type="primary" block @click="handleCopy"> |
|
|
|
<a-button type="primary" block @click="handleCopy" class="my-1"> |
|
|
|
<CopyOutlined class="mr-2" /> |
|
|
|
{{ t('layout.setting.copyBtn') }} |
|
|
|
</a-button> |
|
|
|
|
|
|
|
<a-button color="warning" block @click="handleResetSetting" class="my-3"> |
|
|
|
<a-button color="primary" block @click="handleSyncSetting" :loading="syncLoading" class="my-1"> |
|
|
|
<CloudSyncOutlined class="mr-2" /> |
|
|
|
{{ t('layout.setting.syncBtn') }} |
|
|
|
</a-button> |
|
|
|
|
|
|
|
<a-button color="warning" block @click="handleResetSetting" class="my-1"> |
|
|
|
<RedoOutlined class="mr-2" /> |
|
|
|
{{ t('common.resetText') }} |
|
|
|
</a-button> |
|
|
|
|
|
|
|
<a-button color="error" block @click="handleClearAndRedo"> |
|
|
|
<a-button color="error" block @click="handleClearAndRedo" class="my-1"> |
|
|
|
<RedoOutlined class="mr-2" /> |
|
|
|
{{ t('layout.setting.clearBtn') }} |
|
|
|
</a-button> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
<script lang="ts"> |
|
|
|
import { defineComponent, unref } from 'vue'; |
|
|
|
import { defineComponent, ref, unref } from 'vue'; |
|
|
|
|
|
|
|
import { CopyOutlined, RedoOutlined } from '@ant-design/icons-vue'; |
|
|
|
import { CopyOutlined, RedoOutlined, CloudSyncOutlined } from '@ant-design/icons-vue'; |
|
|
|
|
|
|
|
import { useAppStore } from '/@/store/modules/app'; |
|
|
|
import { usePermissionStore } from '/@/store/modules/permission'; |
|
|
|
@ -35,10 +40,14 @@ |
|
|
|
import { updateGrayMode } from '/@/logics/theme/updateGrayMode'; |
|
|
|
import defaultSetting from '/@/settings/projectSetting'; |
|
|
|
|
|
|
|
import { changeTheme } from '/@/api/sys/theme'; |
|
|
|
import { ThemeSetting } from '/@/api/sys/model/themeModel'; |
|
|
|
|
|
|
|
export default defineComponent({ |
|
|
|
name: 'SettingFooter', |
|
|
|
components: { CopyOutlined, RedoOutlined }, |
|
|
|
components: { CopyOutlined, RedoOutlined, CloudSyncOutlined }, |
|
|
|
setup() { |
|
|
|
const syncLoading = ref(false); |
|
|
|
const permissionStore = usePermissionStore(); |
|
|
|
const { prefixCls } = useDesign('setting-footer'); |
|
|
|
const { t } = useI18n(); |
|
|
|
@ -78,11 +87,29 @@ |
|
|
|
userStore.resetState(); |
|
|
|
location.reload(); |
|
|
|
} |
|
|
|
|
|
|
|
function handleSyncSetting() { |
|
|
|
const themeSetting: ThemeSetting = { |
|
|
|
darkMode: appStore.getDarkMode, |
|
|
|
projectConfig: appStore.getProjectConfig, |
|
|
|
beforeMiniInfo: appStore.getBeforeMiniInfo, |
|
|
|
}; |
|
|
|
|
|
|
|
syncLoading.value = true; |
|
|
|
changeTheme(themeSetting).then(() => { |
|
|
|
createMessage.success(t('layout.setting.operatingTitle')); |
|
|
|
}).finally(() => { |
|
|
|
syncLoading.value = false; |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
return { |
|
|
|
prefixCls, |
|
|
|
t, |
|
|
|
syncLoading, |
|
|
|
handleCopy, |
|
|
|
handleResetSetting, |
|
|
|
handleSyncSetting, |
|
|
|
handleClearAndRedo, |
|
|
|
}; |
|
|
|
}, |
|
|
|
|