Skip to content

Commit e24962c

Browse files
committed
feat: 新增底部版权信息及开关
1 parent 4e45daf commit e24962c

File tree

5 files changed

+75
-6
lines changed

5 files changed

+75
-6
lines changed

ruoyi-fastapi-frontend/src/layout/components/AppMain.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@
66
</keep-alive>
77
</transition>
88
<iframe-toggle />
9+
<copyright />
910
</section>
1011
</template>
1112

1213
<script>
14+
import copyright from "./Copyright/index"
1315
import iframeToggle from "./IframeToggle/index"
1416
1517
export default {
1618
name: 'AppMain',
17-
components: { iframeToggle },
19+
components: { iframeToggle, copyright },
1820
computed: {
1921
cachedViews() {
2022
return this.$store.state.tagsView.cachedViews
@@ -33,7 +35,7 @@ export default {
3335
},
3436
methods: {
3537
addIframe() {
36-
const {name} = this.$route
38+
const { name } = this.$route
3739
if (name && this.$route.meta.link) {
3840
this.$store.dispatch('tagsView/addIframeView', this.$route)
3941
}
@@ -51,6 +53,10 @@ export default {
5153
overflow: hidden;
5254
}
5355
56+
.app-main:has(.copyright) {
57+
padding-bottom: 36px;
58+
}
59+
5460
.fixed-header + .app-main {
5561
padding-top: 50px;
5662
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<template>
2+
<footer v-if="visible" class="copyright">
3+
<span>{{ content }}</span>
4+
</footer>
5+
</template>
6+
7+
<script>
8+
export default {
9+
computed: {
10+
visible() {
11+
return this.$store.state.settings.footerVisible
12+
},
13+
content() {
14+
return this.$store.state.settings.footerContent
15+
}
16+
}
17+
}
18+
</script>
19+
20+
<style scoped>
21+
.copyright {
22+
position: fixed;
23+
bottom: 0;
24+
left: 0;
25+
right: 0;
26+
height: 36px;
27+
padding: 10px 20px;
28+
text-align: right;
29+
background-color: #f8f8f8;
30+
color: #666;
31+
font-size: 14px;
32+
border-top: 1px solid #e7e7e7;
33+
z-index: 999;
34+
}
35+
</style>

ruoyi-fastapi-frontend/src/layout/components/Settings/index.vue

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<el-drawer size="280px" :visible="showSettings" :with-header="false" :append-to-body="true" :before-close="closeSetting">
2+
<el-drawer size="280px" :visible="showSettings" :with-header="false" :append-to-body="true" :before-close="closeSetting" :lock-scroll="false">
33
<div class="drawer-container">
44
<div>
55
<div class="setting-drawer-content">
@@ -69,6 +69,11 @@
6969
<el-switch v-model="dynamicTitle" class="drawer-switch" />
7070
</div>
7171

72+
<div class="drawer-item">
73+
<span>底部版权</span>
74+
<el-switch v-model="footerVisible" class="drawer-switch" />
75+
</div>
76+
7277
<el-divider/>
7378

7479
<el-button size="small" type="primary" plain icon="el-icon-document-add" @click="saveSetting">保存配置</el-button>
@@ -163,6 +168,17 @@ export default {
163168
this.$store.dispatch('settings/setTitle', this.$store.state.settings.title)
164169
}
165170
},
171+
footerVisible: {
172+
get() {
173+
return this.$store.state.settings.footerVisible
174+
},
175+
set(val) {
176+
this.$store.dispatch('settings/changeSetting', {
177+
key: 'footerVisible',
178+
value: val
179+
})
180+
}
181+
}
166182
},
167183
methods: {
168184
themeChange(val) {
@@ -196,6 +212,7 @@ export default {
196212
"fixedHeader":${this.fixedHeader},
197213
"sidebarLogo":${this.sidebarLogo},
198214
"dynamicTitle":${this.dynamicTitle},
215+
"footerVisible":${this.footerVisible},
199216
"sideTheme":"${this.sideTheme}",
200217
"theme":"${this.theme}"
201218
}`

ruoyi-fastapi-frontend/src/settings.js

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

ruoyi-fastapi-frontend/src/store/modules/settings.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import defaultSettings from '@/settings'
22
import { useDynamicTitle } from '@/utils/dynamicTitle'
33

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

66
const storageSetting = JSON.parse(localStorage.getItem('layout-setting')) || ''
77
const state = {
@@ -14,7 +14,8 @@ const state = {
1414
tagsIcon: storageSetting.tagsIcon === undefined ? tagsIcon : storageSetting.tagsIcon,
1515
fixedHeader: storageSetting.fixedHeader === undefined ? fixedHeader : storageSetting.fixedHeader,
1616
sidebarLogo: storageSetting.sidebarLogo === undefined ? sidebarLogo : storageSetting.sidebarLogo,
17-
dynamicTitle: storageSetting.dynamicTitle === undefined ? dynamicTitle : storageSetting.dynamicTitle
17+
dynamicTitle: storageSetting.dynamicTitle === undefined ? dynamicTitle : storageSetting.dynamicTitle,
18+
footerVisible: storageSetting.footerVisible === undefined ? footerVisible : storageSetting.footerVisible,
1819
}
1920
const mutations = {
2021
CHANGE_SETTING: (state, { key, value }) => {

0 commit comments

Comments
 (0)