Skip to content

Commit 4d945ac

Browse files
committed
Merge branch 'hutu'
2 parents a3c0389 + 612c24d commit 4d945ac

File tree

15 files changed

+294
-26
lines changed

15 files changed

+294
-26
lines changed

src/assets/iconfont/iconfont.scss

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
@font-face {
22
font-family: "iconfont"; /* Project id 3001982 */
3-
src: url('//at.alicdn.com/t/font_3001982_gtz8nwcwhtu.woff2?t=1642128452351') format('woff2'),
4-
url('//at.alicdn.com/t/font_3001982_gtz8nwcwhtu.woff?t=1642128452351') format('woff'),
5-
url('//at.alicdn.com/t/font_3001982_gtz8nwcwhtu.ttf?t=1642128452351') format('truetype');
3+
src: url('//at.alicdn.com/t/font_3001982_5gxtvcz3vvk.woff2?t=1642402696715') format('woff2'),
4+
url('//at.alicdn.com/t/font_3001982_5gxtvcz3vvk.woff?t=1642402696715') format('woff'),
5+
url('//at.alicdn.com/t/font_3001982_5gxtvcz3vvk.ttf?t=1642402696715') format('truetype');
66
}
77

88
.iconfont {
@@ -13,6 +13,14 @@
1313
-moz-osx-font-smoothing: grayscale;
1414
}
1515

16+
.icon-skin-fill:before {
17+
content: "\e865";
18+
}
19+
20+
.icon-signal-fill:before {
21+
content: "\e8e9";
22+
}
23+
1624
.icon-sync:before {
1725
content: "\e786";
1826
}

src/components/Breadcrumb/Index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
* @Author: hutu
44
* @Date: 2021-12-13 08:41:23
55
* @LastEditors: hutu
6-
* @LastEditTime: 2021-12-21 17:12:21
6+
* @LastEditTime: 2022-01-17 10:50:56
77
-->
88
<template>
99
<div class="breadcrumb">
1010
<el-breadcrumb separator="/">
1111
<transition-group name="breadcrumb">
12-
<el-breadcrumb-item v-for="(item, key) in state.leveList" :key="key" :to="{ path: item.path }">{{ item.title }}</el-breadcrumb-item>
12+
<el-breadcrumb-item v-for="(item, key) in state.leveList" :key="key" :to="{ path: key === 1 ? '' : item.path }">{{ item.title }}</el-breadcrumb-item>
1313
</transition-group>
1414
</el-breadcrumb>
1515
</div>

src/components/Hamburger/Index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @Author: hutu
44
* @Date: 2021-12-22 14:53:31
55
* @LastEditors: hutu
6-
* @LastEditTime: 2021-12-30 08:46:09
6+
* @LastEditTime: 2022-01-17 15:53:02
77
-->
88
<template>
99
<div class="hamburger" @click="emitMenuCollapse">
@@ -15,7 +15,7 @@ const props = defineProps<{
1515
collapse: boolean
1616
}>()
1717
const emit = defineEmits(['emitMenuCollapse'])
18-
const emitMenuCollapse = (): void => {
18+
const emitMenuCollapse = () => {
1919
emit('emitMenuCollapse', !props.collapse)
2020
}
2121
</script>

src/components/HeaderIcon/Index.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
* @Author: hutu
44
* @Date: 2021-12-22 15:59:15
55
* @LastEditors: hutu
6-
* @LastEditTime: 2021-12-30 08:48:03
6+
* @LastEditTime: 2022-01-17 15:52:03
77
-->
88
<template>
99
<el-tooltip class="item" effect="dark" :content="props.title" placement="bottom">
10-
<div class="header-icon">
10+
<div class="header-icon" @click="emitClick">
1111
<el-icon class="iconfont" :class="props.icon"></el-icon>
1212
</div>
1313
</el-tooltip>
@@ -17,6 +17,10 @@ const props = defineProps<{
1717
title: string
1818
icon: string
1919
}>()
20+
const emit = defineEmits(['emitClick'])
21+
const emitClick = () => {
22+
emit('emitClick')
23+
}
2024
</script>
2125
<style lang="scss">
2226
.header-icon {

src/components/SkinTheme/Index.vue

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<!--
2+
* @Description: 换肤
3+
* @Author: hutu
4+
* @Date: 2022-01-17 15:36:50
5+
* @LastEditors: hutu
6+
* @LastEditTime: 2022-01-17 15:40:17
7+
-->
8+
<template>
9+
<div class="skin-theme">
10+
<div class="theme-color">
11+
<div class="theme-color-label">头部背景颜色</div>
12+
<div><el-color-picker v-model="styles.headerBg" /></div>
13+
</div>
14+
<div class="theme-color">
15+
<div class="theme-color-label">主体内容背景颜色</div>
16+
<div><el-color-picker v-model="styles.mainBg" /></div>
17+
</div>
18+
<div class="theme-color">
19+
<div class="theme-color-label">侧边栏背景颜色</div>
20+
<div><el-color-picker v-model="styles.sidebarBg" /></div>
21+
</div>
22+
<div class="theme-color">
23+
<div class="theme-color-label">菜单栏背景颜色</div>
24+
<div><el-color-picker v-model="styles.menuBg" /></div>
25+
</div>
26+
<div class="theme-color">
27+
<div class="theme-color-label">菜单栏字体颜色</div>
28+
<div><el-color-picker v-model="styles.menuTextColor" /></div>
29+
</div>
30+
<div class="theme-color">
31+
<div class="theme-color-label">菜单栏选中字体颜色</div>
32+
<div><el-color-picker v-model="styles.menuTextActiveColor" /></div>
33+
</div>
34+
<div class="theme-color">
35+
<div class="theme-color-label">子菜单栏背景颜色</div>
36+
<div><el-color-picker v-model="styles.subMenuBg" /></div>
37+
</div>
38+
<div class="theme-color">
39+
<div class="theme-color-label">子菜单栏悬浮颜色</div>
40+
<div><el-color-picker v-model="styles.subMenuHover" /></div>
41+
</div>
42+
</div>
43+
</template>
44+
<script lang="ts" setup>
45+
import { computed } from 'vue'
46+
import { useStore } from 'vuex'
47+
const store = useStore()
48+
const styles = computed(() => store.state.theme.styles)
49+
</script>
50+
<style lang="scss" scoped>
51+
.skin-theme {
52+
.theme-color {
53+
display: flex;
54+
align-items: center;
55+
margin-bottom: 15px;
56+
&-label {
57+
min-width: 150px;
58+
}
59+
}
60+
}
61+
</style>

src/layout/components/AppMain.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
.app-main {
1414
height: calc(100vh - 51px);
1515
width: 100%;
16-
overflow: hidden;
1716
}
1817
.fade-leave-active,
1918
.fade-enter-active {

src/layout/components/Navbar.vue

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @Author: hutu
44
* @Date: 2021-12-09 22:36:40
55
* @LastEditors: hutu
6-
* @LastEditTime: 2021-12-30 08:56:09
6+
* @LastEditTime: 2022-01-17 15:56:26
77
-->
88
<template>
99
<div class="navbar">
@@ -15,8 +15,11 @@
1515
<HeaderIcon :icon="'icon-home'" :title="'主页'" />
1616
<Screenfull />
1717
<HeaderAvatar />
18-
<HeaderIcon :icon="'icon-setting'" :title="'设置'" />
18+
<HeaderIcon :icon="'icon-setting'" :title="'设置'" @emitClick="drawerFlag = true" />
1919
</div>
20+
<el-drawer v-model="drawerFlag" title="自定义主题颜色" size="350px">
21+
<SkinTheme style="padding-left: 20px" />
22+
</el-drawer>
2023
</div>
2124
</template>
2225
<script lang="ts" setup>
@@ -25,19 +28,21 @@ import Hamburger from '@/components/Hamburger/Index.vue'
2528
import Screenfull from '@/components/Screenfull/Index.vue'
2629
import HeaderAvatar from '@/components/HeaderAvatar/Index.vue'
2730
import HeaderIcon from '@/components/HeaderIcon/Index.vue'
31+
import SkinTheme from '@/components/SkinTheme/Index.vue'
2832
29-
import { computed } from 'vue'
33+
import { computed, ref } from 'vue'
3034
import { useStore } from 'vuex'
3135
import { SET_MENU_COLLAPSE } from '@/store/type'
3236
37+
const drawerFlag = ref<boolean>(false)
3338
const store = useStore()
3439
const menuCollapse = computed(() => store.state.permission.menuCollapse)
3540
/**
3641
* @desc: 侧边栏展开||折叠
3742
* @param {boolean} flag
38-
* @return {void}
43+
* @return {*}
3944
*/
40-
const handleMenuCollapse = (flag: boolean): void => {
45+
const handleMenuCollapse = (flag: boolean) => {
4146
store.commit(SET_MENU_COLLAPSE, flag)
4247
}
4348
</script>

src/main.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import '@/styles/index.scss' //全局样式
66
import '@/assets/iconfont/iconfont.scss'
77
const app = createApp(App)
88

9-
import { ElDialog, ElConfigProvider, ElPagination, ElLoading, ElTag, ElButton, ElMenu, ElIcon, ElBreadcrumb, ElBreadcrumbItem, ElInput, ElForm, ElFormItem, ElTooltip, ElDropdown, ElDropdownItem, ElDropdownMenu, ElRow, ElCol, ElScrollbar, ElTable, ElTableColumn } from 'element-plus'
9+
import { ElDrawer, ElColorPicker, ElDialog, ElConfigProvider, ElPagination, ElLoading, ElTag, ElButton, ElMenu, ElIcon, ElBreadcrumb, ElBreadcrumbItem, ElInput, ElForm, ElFormItem, ElTooltip, ElDropdown, ElDropdownItem, ElDropdownMenu, ElRow, ElCol, ElScrollbar, ElTable, ElTableColumn } from 'element-plus'
1010
import 'element-plus/theme-chalk/index.css'
1111
app.use(ElButton)
1212
app.use(ElMenu)
@@ -30,6 +30,8 @@ app.use(ElLoading)
3030
app.use(ElPagination)
3131
app.use(ElConfigProvider)
3232
app.use(ElDialog)
33+
app.use(ElColorPicker)
34+
app.use(ElDrawer)
3335
import './permission'
3436

3537
import './mock/index'

src/router/asyncRoutes.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
/*
2-
* @Descripttion:
2+
* @Description:模拟动态路由
33
* @Author: hutu
4-
* @Date: 2021-12-07 08:36:02
4+
* @Date: 2022-01-13 16:57:13
55
* @LastEditors: hutu
6-
* @LastEditTime: 2022-01-13 09:04:03
6+
* @LastEditTime: 2022-01-17 14:58:26
77
*/
8+
89
import { IAsyncRoutes } from '@/interface/index'
910
/**
1011
* 模拟请求后的路由数据
@@ -41,6 +42,18 @@ export const asyncRoutes: IAsyncRoutes[] = [
4142
}
4243
]
4344
},
45+
{
46+
father: 'sys.blog',
47+
identifier: 'charts',
48+
title: '图表',
49+
type: 'menu',
50+
url: '/charts',
51+
icon: 'icon-signal-fill',
52+
children: [
53+
{ father: 'charts', identifier: 'bar', title: '柱状图', type: 'menu', url: '/bar', icon: 'icon-signal-fill' },
54+
{ father: 'charts', identifier: 'line', title: '折线图', type: 'menu', url: '/line', icon: 'icon-signal-fill' }
55+
]
56+
},
4457
{
4558
father: 'sys.blog',
4659
identifier: 'table',
@@ -53,5 +66,5 @@ export const asyncRoutes: IAsyncRoutes[] = [
5366
{ father: 'table', identifier: 'complex-table', title: '综合表格', type: 'menu', url: '/complex-table', icon: 'icon-table' }
5467
]
5568
},
56-
{ father: 'sys.blog', identifier: 'attachment', title: '附件管理', type: 'menu', url: '/attachment', icon: 'icon-folder' }
69+
{ father: 'sys.blog', identifier: 'theme', title: '换肤', type: 'menu', url: '/theme', icon: 'icon-skin-fill' }
5770
]

src/store/modules/permission.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @Author: hutu
44
* @Date: 2021-12-21 16:57:25
55
* @LastEditors: hutu
6-
* @LastEditTime: 2021-12-24 17:26:54
6+
* @LastEditTime: 2022-01-17 15:52:39
77
*/
88
import { IAsyncRoutes, IPermission } from '@/interface'
99
import { SET_ROUTES, GENERATE_ROUTES, SET_MENU_COLLAPSE } from '../type'
@@ -19,11 +19,11 @@ const state: IPermission = {
1919
}
2020
const mutations = {
2121
//设置路由
22-
[SET_ROUTES]: (state: IPermission, routes: RouteRecordRaw[]): void => {
22+
[SET_ROUTES]: (state: IPermission, routes: RouteRecordRaw[]) => {
2323
state.accessRoutes = routes
2424
},
2525
//设置侧边栏折叠、展开
26-
[SET_MENU_COLLAPSE]: (state: IPermission, flag: boolean): void => {
26+
[SET_MENU_COLLAPSE]: (state: IPermission, flag: boolean) => {
2727
state.menuCollapse = flag
2828
}
2929
}

0 commit comments

Comments
 (0)