Skip to content

Commit b75fd76

Browse files
committed
添加底部版权信息及开关
1 parent 40037b8 commit b75fd76

File tree

6 files changed

+62
-4
lines changed

6 files changed

+62
-4
lines changed

src/layout/components/AppMain.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
</transition>
99
</router-view>
1010
<iframe-toggle />
11+
<copyright />
1112
</section>
1213
</template>
1314

1415
<script setup>
16+
import copyright from "./Copyright/index"
1517
import iframeToggle from "./IframeToggle/index"
1618
import useTagsViewStore from '@/store/modules/tagsView'
1719
@@ -42,6 +44,10 @@ function addIframe() {
4244
overflow: hidden;
4345
}
4446
47+
.app-main:has(.copyright) {
48+
padding-bottom: 36px;
49+
}
50+
4551
.fixed-header + .app-main {
4652
padding-top: 50px;
4753
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<template>
2+
<footer v-if="visible" class="copyright">
3+
<span>{{ content }}</span>
4+
</footer>
5+
</template>
6+
7+
<script setup>
8+
import useSettingsStore from '@/store/modules/settings'
9+
10+
const settingsStore = useSettingsStore()
11+
12+
const visible = computed(() => settingsStore.footerVisible)
13+
const content = computed(() => settingsStore.footerContent)
14+
</script>
15+
16+
<style scoped>
17+
.copyright {
18+
position: fixed;
19+
bottom: 0;
20+
left: 0;
21+
right: 0;
22+
height: 36px;
23+
padding: 10px 20px;
24+
text-align: right;
25+
background-color: #f8f8f8;
26+
color: #666;
27+
font-size: 14px;
28+
border-top: 1px solid #e7e7e7;
29+
z-index: 999;
30+
}
31+
</style>

src/layout/components/Settings/index.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<el-drawer v-model="showSettings" :withHeader="false" direction="rtl" size="300px">
2+
<el-drawer v-model="showSettings" :withHeader="false" :lock-scroll="false" direction="rtl" size="300px">
33
<div class="setting-drawer-title">
44
<h3 class="drawer-title">主题风格设置</h3>
55
</div>
@@ -77,6 +77,13 @@
7777
</span>
7878
</div>
7979

80+
<div class="drawer-item">
81+
<span>底部版权</span>
82+
<span class="comp-style">
83+
<el-switch v-model="settingsStore.footerVisible" class="drawer-switch" />
84+
</span>
85+
</div>
86+
8087
<el-divider />
8188

8289
<el-button type="primary" plain icon="DocumentAdd" @click="saveSetting">保存配置</el-button>
@@ -133,6 +140,7 @@ function saveSetting() {
133140
"fixedHeader": storeSettings.value.fixedHeader,
134141
"sidebarLogo": storeSettings.value.sidebarLogo,
135142
"dynamicTitle": storeSettings.value.dynamicTitle,
143+
"footerVisible": storeSettings.value.footerVisible,
136144
"sideTheme": storeSettings.value.sideTheme,
137145
"theme": storeSettings.value.theme
138146
}

src/layout/components/TagsView/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
@click.middle="!isAffix(tag) ? closeSelectedTag(tag) : ''"
1313
@contextmenu.prevent="openMenu(tag, $event)"
1414
>
15-
<svg-icon v-if="tagsIcon && tag.meta && tag.meta.icon && tag.meta.icon !== '#'" :icon-class="tag.meta.icon"/>
15+
<svg-icon v-if="tagsIcon && tag.meta && tag.meta.icon && tag.meta.icon !== '#'" :icon-class="tag.meta.icon" />
1616
{{ tag.title }}
1717
<span v-if="!isAffix(tag)" @click.prevent.stop="closeSelectedTag(tag)">
1818
<close class="el-icon-close" style="width: 1em; height: 1em;vertical-align: middle;" />

src/settings.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,16 @@ export default {
4242
/**
4343
* 是否显示动态标题
4444
*/
45-
dynamicTitle: false
45+
dynamicTitle: false,
46+
47+
/**
48+
* 是否显示底部版权
49+
*/
50+
footerVisible: false,
51+
52+
/**
53+
* 底部版权文本内容
54+
*/
55+
footerContent: 'Copyright © 2018-2025 RuoYi. All Rights Reserved.'
4656
}
57+

src/store/modules/settings.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { useDynamicTitle } from '@/utils/dynamicTitle'
55
const isDark = useDark()
66
const toggleDark = useToggle(isDark)
77

8-
const { sideTheme, showSettings, topNav, tagsView, tagsIcon, fixedHeader, sidebarLogo, dynamicTitle } = defaultSettings
8+
const { sideTheme, showSettings, topNav, tagsView, tagsIcon, fixedHeader, sidebarLogo, dynamicTitle, footerVisible, footerContent } = defaultSettings
99

1010
const storageSetting = JSON.parse(localStorage.getItem('layout-setting')) || ''
1111

@@ -23,6 +23,8 @@ const useSettingsStore = defineStore(
2323
fixedHeader: storageSetting.fixedHeader === undefined ? fixedHeader : storageSetting.fixedHeader,
2424
sidebarLogo: storageSetting.sidebarLogo === undefined ? sidebarLogo : storageSetting.sidebarLogo,
2525
dynamicTitle: storageSetting.dynamicTitle === undefined ? dynamicTitle : storageSetting.dynamicTitle,
26+
footerVisible: storageSetting.footerVisible === undefined ? footerVisible : storageSetting.footerVisible,
27+
footerContent: footerContent,
2628
isDark: isDark.value
2729
}),
2830
actions: {

0 commit comments

Comments
 (0)