@yyp92-cli/template-vue-pc 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/package.json +15 -0
- package/template/.env.development +2 -0
- package/template/.env.production +2 -0
- package/template/.env.test +2 -0
- package/template/README.md +30 -0
- package/template/auto-imports.d.ts +11 -0
- package/template/components.d.ts +67 -0
- package/template/index.html +16 -0
- package/template/package.json +43 -0
- package/template/pnpm-lock.yaml +2830 -0
- package/template/public/vite.svg +1 -0
- package/template/src/App.vue +26 -0
- package/template/src/assets/img/login-bg.jpg +0 -0
- package/template/src/assets/img/logo.svg +15 -0
- package/template/src/components/layout/header-crumb/index.vue +38 -0
- package/template/src/components/layout/header-info/index.vue +181 -0
- package/template/src/components/layout/index.vue +83 -0
- package/template/src/components/layout/main-header/index.vue +85 -0
- package/template/src/components/layout/main-menu/index.vue +166 -0
- package/template/src/components/layout-horizontal/header-crumb/index.vue +38 -0
- package/template/src/components/layout-horizontal/header-info/index.vue +185 -0
- package/template/src/components/layout-horizontal/index.vue +55 -0
- package/template/src/components/layout-horizontal/main-header/index.vue +86 -0
- package/template/src/components/layout-horizontal/main-menu/index.vue +135 -0
- package/template/src/global/constants.ts +4 -0
- package/template/src/global/register-icons.ts +10 -0
- package/template/src/main.ts +16 -0
- package/template/src/mock/index.ts +8 -0
- package/template/src/mock/login.ts +5 -0
- package/template/src/mock/userDepartmentList.ts +85 -0
- package/template/src/mock/userInfoMock.ts +24 -0
- package/template/src/mock/userList.ts +115 -0
- package/template/src/mock/userListDelete.ts +1 -0
- package/template/src/mock/userMenuList.ts +466 -0
- package/template/src/mock/userMenus.ts +374 -0
- package/template/src/mock/userRoleList.ts +1846 -0
- package/template/src/router/index.ts +41 -0
- package/template/src/router/routes.ts +189 -0
- package/template/src/service/api/index.ts +90 -0
- package/template/src/service/request/index.ts +268 -0
- package/template/src/service/request/type.ts +5 -0
- package/template/src/store/counter.ts +19 -0
- package/template/src/store/index.ts +14 -0
- package/template/src/store/login/index.ts +142 -0
- package/template/src/store/main/index.ts +54 -0
- package/template/src/store/main/system/index.ts +88 -0
- package/template/src/store/main/system/type.ts +19 -0
- package/template/src/styles/global.scss +33 -0
- package/template/src/styles/index.scss +4 -0
- package/template/src/styles/reset.scss +17 -0
- package/template/src/theme/darkTheme.scss +51 -0
- package/template/src/theme/lightTheme.scss +53 -0
- package/template/src/types/index.ts +1 -0
- package/template/src/types/login.ts +4 -0
- package/template/src/utils/cache.ts +44 -0
- package/template/src/utils/download.ts +27 -0
- package/template/src/utils/format.ts +10 -0
- package/template/src/utils/index.ts +14 -0
- package/template/src/utils/map-menus.ts +174 -0
- package/template/src/views/403/index.vue +22 -0
- package/template/src/views/login/component/login-panel.vue +138 -0
- package/template/src/views/login/component/panel-account.vue +138 -0
- package/template/src/views/login/component/panel-phone.vue +56 -0
- package/template/src/views/login/index.vue +28 -0
- package/template/src/views/main/analysis/dashboard/index.vue +19 -0
- package/template/src/views/main/analysis/overview/index.vue +25 -0
- package/template/src/views/main/detail/index.vue +19 -0
- package/template/src/views/main/fullScreen/images/bg.png +0 -0
- package/template/src/views/main/fullScreen/images/contrast-bg.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-alarm.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-header-btn-bg-l.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-header-btn-bg-r.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-header-center-bg.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-header-left-bg.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-header-right-bg.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-header-warn-bg.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-main-cb.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-main-lb.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-main-lc.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-main-lt.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-main-rb.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-main-rc.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-main-rt.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-title.png +0 -0
- package/template/src/views/main/fullScreen/images/dataScreen-warn-bg.png +0 -0
- package/template/src/views/main/fullScreen/images/line-bg.png +0 -0
- package/template/src/views/main/fullScreen/images/man-bg.png +0 -0
- package/template/src/views/main/fullScreen/images/man.png +0 -0
- package/template/src/views/main/fullScreen/images/map-title-bg.png +0 -0
- package/template/src/views/main/fullScreen/images/rankingChart-bg.png +0 -0
- package/template/src/views/main/fullScreen/images/total.png +0 -0
- package/template/src/views/main/fullScreen/images/woman-bg.png +0 -0
- package/template/src/views/main/fullScreen/images/woman.png +0 -0
- package/template/src/views/main/fullScreen/index.vue +33 -0
- package/template/src/views/main/index.vue +24 -0
- package/template/src/views/main/product/category/index.vue +19 -0
- package/template/src/views/main/product/goods/index.vue +19 -0
- package/template/src/views/main/story/chat/index.vue +70 -0
- package/template/src/views/main/story/list/index.vue +19 -0
- package/template/src/views/main/system/department/index.vue +20 -0
- package/template/src/views/main/system/menu/index.vue +19 -0
- package/template/src/views/main/system/role/index.vue +20 -0
- package/template/src/views/main/system/user/index.vue +141 -0
- package/template/src/views/main/system/user/user-comp/UserContent.vue +211 -0
- package/template/src/views/main/system/user/user-comp/UserModal.vue +225 -0
- package/template/src/views/main/system/user/user-comp/UserSearch.vue +147 -0
- package/template/src/views/not-found/index.vue +22 -0
- package/template/src/vite-env.d.ts +9 -0
- package/template/tsconfig.app.json +26 -0
- package/template/tsconfig.json +7 -0
- package/template/tsconfig.node.json +25 -0
- package/template/vite.config.ts +66 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-config-provider :locale="zhCn">
|
|
3
|
+
<router-view></router-view>
|
|
4
|
+
</el-config-provider>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script
|
|
8
|
+
setup
|
|
9
|
+
lang="ts"
|
|
10
|
+
name="App"
|
|
11
|
+
>
|
|
12
|
+
import {onMounted} from "vue";
|
|
13
|
+
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
|
14
|
+
import {changeTheme} from '@/utils'
|
|
15
|
+
|
|
16
|
+
onMounted(() => {
|
|
17
|
+
changeTheme(false)
|
|
18
|
+
})
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<style
|
|
22
|
+
scoped
|
|
23
|
+
lang="scss"
|
|
24
|
+
>
|
|
25
|
+
|
|
26
|
+
</style>
|
|
Binary file
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<svg width="410" height="404" viewBox="0 0 410 404" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M399.641 59.5246L215.643 388.545C211.844 395.338 202.084 395.378 198.228 388.618L10.5817 59.5563C6.38087 52.1896 12.6802 43.2665 21.0281 44.7586L205.223 77.6824C206.398 77.8924 207.601 77.8904 208.776 77.6763L389.119 44.8058C397.439 43.2894 403.768 52.1434 399.641 59.5246Z" fill="url(#paint0_linear)"/>
|
|
3
|
+
<path d="M292.965 1.5744L156.801 28.2552C154.563 28.6937 152.906 30.5903 152.771 32.8664L144.395 174.33C144.198 177.662 147.258 180.248 150.51 179.498L188.42 170.749C191.967 169.931 195.172 173.055 194.443 176.622L183.18 231.775C182.422 235.487 185.907 238.661 189.532 237.56L212.947 230.446C216.577 229.344 220.065 232.527 219.297 236.242L201.398 322.875C200.278 328.294 207.486 331.249 210.492 326.603L212.5 323.5L323.454 102.072C325.312 98.3645 322.108 94.137 318.036 94.9228L279.014 102.454C275.347 103.161 272.227 99.746 273.262 96.1583L298.731 7.86689C299.767 4.27314 296.636 0.855181 292.965 1.5744Z" fill="url(#paint1_linear)"/>
|
|
4
|
+
<defs>
|
|
5
|
+
<linearGradient id="paint0_linear" x1="6.00017" y1="32.9999" x2="235" y2="344" gradientUnits="userSpaceOnUse">
|
|
6
|
+
<stop stop-color="#41D1FF"/>
|
|
7
|
+
<stop offset="1" stop-color="#BD34FE"/>
|
|
8
|
+
</linearGradient>
|
|
9
|
+
<linearGradient id="paint1_linear" x1="194.651" y1="8.81818" x2="236.076" y2="292.989" gradientUnits="userSpaceOnUse">
|
|
10
|
+
<stop stop-color="#FFEA83"/>
|
|
11
|
+
<stop offset="0.0833333" stop-color="#FFDD35"/>
|
|
12
|
+
<stop offset="1" stop-color="#FFA800"/>
|
|
13
|
+
</linearGradient>
|
|
14
|
+
</defs>
|
|
15
|
+
</svg>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="header-crumb">
|
|
3
|
+
<el-breadcrumb separator-icon="ArrowRight">
|
|
4
|
+
<template
|
|
5
|
+
v-for="item in breadcrumbs"
|
|
6
|
+
:key="item.name"
|
|
7
|
+
>
|
|
8
|
+
<el-breadcrumb-item
|
|
9
|
+
:to="item.path"
|
|
10
|
+
>{{ item.name }}</el-breadcrumb-item>
|
|
11
|
+
</template>
|
|
12
|
+
</el-breadcrumb>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script
|
|
17
|
+
setup
|
|
18
|
+
lang="ts"
|
|
19
|
+
name="HeaderCrumb"
|
|
20
|
+
>
|
|
21
|
+
import {computed} from 'vue'
|
|
22
|
+
import { useRoute } from 'vue-router'
|
|
23
|
+
import {mapPathToBreadcrumbs} from '@/utils/map-menus'
|
|
24
|
+
import useLoginStore from '@/store/login'
|
|
25
|
+
|
|
26
|
+
const route = useRoute()
|
|
27
|
+
const userMenus = useLoginStore().userMenus
|
|
28
|
+
const breadcrumbs = computed(() => mapPathToBreadcrumbs(route.path, userMenus))
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<style
|
|
32
|
+
scoped
|
|
33
|
+
lang="scss"
|
|
34
|
+
>
|
|
35
|
+
.header-crumb {
|
|
36
|
+
background: var(--bg-white-color);
|
|
37
|
+
}
|
|
38
|
+
</style>
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="header-info">
|
|
3
|
+
<div class="operation">
|
|
4
|
+
<span>
|
|
5
|
+
<el-tooltip
|
|
6
|
+
content="切换主题"
|
|
7
|
+
>
|
|
8
|
+
<el-switch
|
|
9
|
+
v-model="theme"
|
|
10
|
+
inactive-action-icon="Sunny"
|
|
11
|
+
active-action-icon="Moon"
|
|
12
|
+
/>
|
|
13
|
+
</el-tooltip>
|
|
14
|
+
</span>
|
|
15
|
+
|
|
16
|
+
<span>
|
|
17
|
+
<el-tooltip
|
|
18
|
+
content="全屏"
|
|
19
|
+
>
|
|
20
|
+
<el-button
|
|
21
|
+
size="small"
|
|
22
|
+
icon="FullScreen"
|
|
23
|
+
circle
|
|
24
|
+
@click="handleFullScreen"
|
|
25
|
+
></el-button>
|
|
26
|
+
</el-tooltip>
|
|
27
|
+
</span>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<div class="info">
|
|
31
|
+
<el-dropdown
|
|
32
|
+
:hide-on-click="false"
|
|
33
|
+
>
|
|
34
|
+
<span class="user-info">
|
|
35
|
+
<el-avatar
|
|
36
|
+
:size="30"
|
|
37
|
+
src="https://upload.jianshu.io/users/upload_avatars/1102036/c3628b478f06.jpeg"
|
|
38
|
+
/>
|
|
39
|
+
|
|
40
|
+
<span class="name">{{ userInfo.name }}</span>
|
|
41
|
+
</span>
|
|
42
|
+
|
|
43
|
+
<template #dropdown>
|
|
44
|
+
<el-dropdown-menu>
|
|
45
|
+
<el-dropdown-item
|
|
46
|
+
@click="handleExitClick"
|
|
47
|
+
>
|
|
48
|
+
<el-icon>
|
|
49
|
+
<CircleCheck />
|
|
50
|
+
</el-icon>
|
|
51
|
+
|
|
52
|
+
<span>退出系统</span>
|
|
53
|
+
</el-dropdown-item>
|
|
54
|
+
|
|
55
|
+
<el-dropdown-item divided>
|
|
56
|
+
<el-icon>
|
|
57
|
+
<InfoFilled />
|
|
58
|
+
</el-icon>
|
|
59
|
+
|
|
60
|
+
<span>个人信息</span>
|
|
61
|
+
</el-dropdown-item>
|
|
62
|
+
|
|
63
|
+
<el-dropdown-item>
|
|
64
|
+
<el-icon>
|
|
65
|
+
<Lock />
|
|
66
|
+
</el-icon>
|
|
67
|
+
|
|
68
|
+
<span>修改密码</span>
|
|
69
|
+
</el-dropdown-item>
|
|
70
|
+
</el-dropdown-menu>
|
|
71
|
+
</template>
|
|
72
|
+
</el-dropdown>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
</template>
|
|
76
|
+
|
|
77
|
+
<script
|
|
78
|
+
setup
|
|
79
|
+
lang="ts"
|
|
80
|
+
name="HeaderInfo"
|
|
81
|
+
>
|
|
82
|
+
import {ref, watch} from 'vue'
|
|
83
|
+
import { useRouter } from 'vue-router'
|
|
84
|
+
import { LOGIN_TOKEN, USER_INFO, USER_MENUS } from '@/global/constants'
|
|
85
|
+
import { localCache } from '@/utils/cache'
|
|
86
|
+
import useLoginStore from '@/store/login'
|
|
87
|
+
import {changeTheme} from '@/utils'
|
|
88
|
+
|
|
89
|
+
const router = useRouter()
|
|
90
|
+
const userStore = useLoginStore()
|
|
91
|
+
const userInfo = userStore.userInfo
|
|
92
|
+
|
|
93
|
+
const theme = ref(false)
|
|
94
|
+
|
|
95
|
+
const handleExitClick = () => {
|
|
96
|
+
localCache.removeCache(LOGIN_TOKEN)
|
|
97
|
+
localCache.removeCache(USER_INFO)
|
|
98
|
+
localCache.removeCache(USER_MENUS)
|
|
99
|
+
|
|
100
|
+
router.push('/login')
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const handleFullScreen = () => {
|
|
104
|
+
// dom对象的一个属性:可以用来判断当前是不是全屏模式
|
|
105
|
+
// 全屏:true, 不是全屏:false
|
|
106
|
+
const full = document.fullscreenElement
|
|
107
|
+
|
|
108
|
+
if (!full) {
|
|
109
|
+
document.documentElement.requestFullscreen()
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
document.exitFullscreen()
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
watch(theme, (newValue) => {
|
|
117
|
+
changeTheme(newValue)
|
|
118
|
+
})
|
|
119
|
+
</script>
|
|
120
|
+
|
|
121
|
+
<style
|
|
122
|
+
scoped
|
|
123
|
+
lang="scss"
|
|
124
|
+
>
|
|
125
|
+
.header-info {
|
|
126
|
+
display: flex;
|
|
127
|
+
align-items: center;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.operation {
|
|
131
|
+
display: flex;
|
|
132
|
+
margin-right: 10px;
|
|
133
|
+
|
|
134
|
+
& > span {
|
|
135
|
+
position: relative;
|
|
136
|
+
display: flex;
|
|
137
|
+
justify-content: center;
|
|
138
|
+
align-items: center;
|
|
139
|
+
margin-right: 12px;
|
|
140
|
+
cursor: pointer;
|
|
141
|
+
|
|
142
|
+
i {
|
|
143
|
+
font-size: 20px;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.dot {
|
|
147
|
+
position: absolute;
|
|
148
|
+
top: 0px;
|
|
149
|
+
right: -5px;
|
|
150
|
+
z-index: 10;
|
|
151
|
+
width: 6px;
|
|
152
|
+
height: 6px;
|
|
153
|
+
background: red;
|
|
154
|
+
border-radius: 100%;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.info {
|
|
160
|
+
.user-info {
|
|
161
|
+
display: flex;
|
|
162
|
+
align-items: center;
|
|
163
|
+
cursor: pointer;
|
|
164
|
+
|
|
165
|
+
.name {
|
|
166
|
+
margin-left: 5px;
|
|
167
|
+
color: var(--text-color);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
:global(.el-dropdown-menu__item) {
|
|
172
|
+
line-height: 36px !important;
|
|
173
|
+
padding: 6px 22px;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
:deep(.el-switch__action) {
|
|
178
|
+
background-color: transparent !important;
|
|
179
|
+
color: var(--primary-text-color) !important;
|
|
180
|
+
}
|
|
181
|
+
</style>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="layout-container">
|
|
3
|
+
<template v-if="route.meta.showFullScreen">
|
|
4
|
+
<router-view></router-view>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<el-container
|
|
8
|
+
class="main-inner"
|
|
9
|
+
v-else
|
|
10
|
+
>
|
|
11
|
+
<el-aside
|
|
12
|
+
:width="isCollapse ? '60px' : '220px'"
|
|
13
|
+
>
|
|
14
|
+
<MainMenu :isCollapse="isCollapse" />
|
|
15
|
+
</el-aside>
|
|
16
|
+
|
|
17
|
+
<el-container>
|
|
18
|
+
<el-header
|
|
19
|
+
height="50px"
|
|
20
|
+
>
|
|
21
|
+
<MainHeader @fold-change="handleFoldChange" />
|
|
22
|
+
</el-header>
|
|
23
|
+
|
|
24
|
+
<el-main>
|
|
25
|
+
<router-view></router-view>
|
|
26
|
+
</el-main>
|
|
27
|
+
</el-container>
|
|
28
|
+
</el-container>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script
|
|
33
|
+
setup
|
|
34
|
+
lang="ts"
|
|
35
|
+
name="Layout"
|
|
36
|
+
>
|
|
37
|
+
import {ref} from 'vue'
|
|
38
|
+
import MainMenu from './main-menu/index.vue'
|
|
39
|
+
import MainHeader from './main-header/index.vue'
|
|
40
|
+
import { useRoute } from 'vue-router'
|
|
41
|
+
|
|
42
|
+
const isCollapse = ref(false)
|
|
43
|
+
const route = useRoute()
|
|
44
|
+
|
|
45
|
+
const handleFoldChange = (isFold: boolean) => {
|
|
46
|
+
isCollapse.value = isFold
|
|
47
|
+
}
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<style
|
|
51
|
+
scoped
|
|
52
|
+
lang="scss"
|
|
53
|
+
>
|
|
54
|
+
.layout-container,
|
|
55
|
+
.main-inner {
|
|
56
|
+
width: 100%;
|
|
57
|
+
height: 100%;
|
|
58
|
+
|
|
59
|
+
.el-aside {
|
|
60
|
+
overflow-x: hidden;
|
|
61
|
+
overflow-y: auto;
|
|
62
|
+
background: var(--bg-white-color);
|
|
63
|
+
cursor: pointer;
|
|
64
|
+
text-align: left;
|
|
65
|
+
transition: width 0.3s linear;
|
|
66
|
+
border-right: 1px solid var(--border-color-base);
|
|
67
|
+
scrollbar-width: none;
|
|
68
|
+
|
|
69
|
+
&::-webkit-scrollbar {
|
|
70
|
+
display: none;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.el-header {
|
|
75
|
+
border-bottom: 1px solid var(--border-color-base);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.el-main {
|
|
79
|
+
--el-main-padding: 16px;
|
|
80
|
+
background: var(--bg-grey-color);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
</style>
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="main-header">
|
|
3
|
+
<div class="left">
|
|
4
|
+
<div
|
|
5
|
+
class="menu-icon"
|
|
6
|
+
@click="handleMenuIconClick"
|
|
7
|
+
>
|
|
8
|
+
<el-icon size="28px">
|
|
9
|
+
<component
|
|
10
|
+
:is="isFold ? 'Expand' : 'Fold'"
|
|
11
|
+
/>
|
|
12
|
+
</el-icon>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<div class="breadcrumb-wraper">
|
|
16
|
+
<HeaderCrumb />
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<div class="right">
|
|
21
|
+
<HeaderInfo />
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script
|
|
27
|
+
setup
|
|
28
|
+
lang="ts"
|
|
29
|
+
name="MainHeader"
|
|
30
|
+
>
|
|
31
|
+
import {ref} from 'vue'
|
|
32
|
+
import HeaderInfo from '../header-info/index.vue'
|
|
33
|
+
import HeaderCrumb from '../header-crumb/index.vue'
|
|
34
|
+
|
|
35
|
+
// 内部自定义事件
|
|
36
|
+
const emit = defineEmits(['foldChange'])
|
|
37
|
+
|
|
38
|
+
const isFold = ref(false)
|
|
39
|
+
|
|
40
|
+
const handleMenuIconClick = () => {
|
|
41
|
+
// 1. 内部改变状态
|
|
42
|
+
isFold.value = !isFold.value
|
|
43
|
+
|
|
44
|
+
// 2. 将事件和状态传递给父组件
|
|
45
|
+
emit('foldChange', isFold.value)
|
|
46
|
+
}
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<style
|
|
50
|
+
scoped
|
|
51
|
+
lang="scss"
|
|
52
|
+
>
|
|
53
|
+
.main-header {
|
|
54
|
+
height: 100%;
|
|
55
|
+
display: flex;
|
|
56
|
+
justify-content: space-between;
|
|
57
|
+
align-items: center;
|
|
58
|
+
font-size: 14px;
|
|
59
|
+
line-height: 20px;
|
|
60
|
+
|
|
61
|
+
.left,
|
|
62
|
+
.right {
|
|
63
|
+
height: 100%;
|
|
64
|
+
display: flex;
|
|
65
|
+
align-items: center;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.left {
|
|
69
|
+
.menu-icon {
|
|
70
|
+
display: flex;
|
|
71
|
+
align-items: center;
|
|
72
|
+
cursor: pointer;
|
|
73
|
+
color: var(--text-color);
|
|
74
|
+
|
|
75
|
+
.el-icon {
|
|
76
|
+
fill: var(--text-color)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.breadcrumb-wraper {
|
|
81
|
+
margin-left: 10px;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
</style>
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="main-menu">
|
|
3
|
+
<div class="logo">
|
|
4
|
+
<img
|
|
5
|
+
class="img"
|
|
6
|
+
src="@/assets/img/logo.svg"
|
|
7
|
+
alt=""
|
|
8
|
+
/>
|
|
9
|
+
|
|
10
|
+
<h2
|
|
11
|
+
class="title"
|
|
12
|
+
v-show="!isCollapse"
|
|
13
|
+
>后台管理系统</h2>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<div class="menu">
|
|
17
|
+
<el-menu
|
|
18
|
+
:collapse="isCollapse"
|
|
19
|
+
:default-active="defaultActive"
|
|
20
|
+
>
|
|
21
|
+
<template
|
|
22
|
+
v-for="item in userMenus"
|
|
23
|
+
:key="item.path"
|
|
24
|
+
>
|
|
25
|
+
<el-sub-menu
|
|
26
|
+
:index="item.path"
|
|
27
|
+
v-if="item.children"
|
|
28
|
+
>
|
|
29
|
+
<template #title>
|
|
30
|
+
<el-icon>
|
|
31
|
+
<component :is="item.icon.split('-icon-')[1]" />
|
|
32
|
+
</el-icon>
|
|
33
|
+
|
|
34
|
+
<span>{{ item.title }}</span>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<template
|
|
38
|
+
v-for="subItem in item.children"
|
|
39
|
+
:key="subItem.path"
|
|
40
|
+
>
|
|
41
|
+
<el-menu-item
|
|
42
|
+
:index="subItem.path"
|
|
43
|
+
@click="handleItemClick(subItem)"
|
|
44
|
+
>{{ subItem.title }}</el-menu-item>
|
|
45
|
+
</template>
|
|
46
|
+
</el-sub-menu>
|
|
47
|
+
|
|
48
|
+
<el-menu-item
|
|
49
|
+
v-else-if="!item.children && !item.hideMenu"
|
|
50
|
+
:index="item.path"
|
|
51
|
+
@click="handleItemClick(item)"
|
|
52
|
+
>
|
|
53
|
+
<template #title>
|
|
54
|
+
<el-icon>
|
|
55
|
+
<component :is="item.icon.split('-icon-')[1]" />
|
|
56
|
+
</el-icon>
|
|
57
|
+
|
|
58
|
+
<span>{{ item.title }}</span>
|
|
59
|
+
</template>
|
|
60
|
+
</el-menu-item>
|
|
61
|
+
</template>
|
|
62
|
+
</el-menu>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</template>
|
|
66
|
+
|
|
67
|
+
<script
|
|
68
|
+
setup
|
|
69
|
+
lang="ts"
|
|
70
|
+
name="MainMenu"
|
|
71
|
+
>
|
|
72
|
+
import { useRoute, useRouter } from 'vue-router'
|
|
73
|
+
import { computed } from 'vue'
|
|
74
|
+
import useLoginStore from '@/store/login'
|
|
75
|
+
import { mapPathToMenu } from '@/utils/map-menus'
|
|
76
|
+
|
|
77
|
+
const router = useRouter()
|
|
78
|
+
// 1. 获取动态菜单
|
|
79
|
+
const loginStore = useLoginStore()
|
|
80
|
+
const userMenus = loginStore.userMenus
|
|
81
|
+
|
|
82
|
+
defineProps({
|
|
83
|
+
isCollapse: {
|
|
84
|
+
type: Boolean,
|
|
85
|
+
default: false
|
|
86
|
+
}
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
const handleItemClick = (item: any) => {
|
|
90
|
+
const url = item.path
|
|
91
|
+
router.push(url)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// menu 的默认菜单
|
|
95
|
+
const route = useRoute()
|
|
96
|
+
|
|
97
|
+
const defaultActive = computed(() => {
|
|
98
|
+
const pathMenu = mapPathToMenu(route.path, userMenus)
|
|
99
|
+
return pathMenu?.path
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
console.log('====defaultActive', defaultActive.value)
|
|
103
|
+
</script>
|
|
104
|
+
|
|
105
|
+
<style
|
|
106
|
+
scoped
|
|
107
|
+
lang="scss"
|
|
108
|
+
>
|
|
109
|
+
.main-menu {
|
|
110
|
+
height: 100%;
|
|
111
|
+
background: var(--bg-white-color);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.logo {
|
|
115
|
+
box-sizing: border-box;
|
|
116
|
+
display: flex;
|
|
117
|
+
flex-direction: row;
|
|
118
|
+
justify-content: flex-start;
|
|
119
|
+
align-items: center;
|
|
120
|
+
height: 50px;
|
|
121
|
+
border-bottom: 1px solid var(--border-color-base);
|
|
122
|
+
padding: 12px 10px 8px 10px;
|
|
123
|
+
overflow: hidden;
|
|
124
|
+
|
|
125
|
+
.img {
|
|
126
|
+
height: 100%;
|
|
127
|
+
margin: 0 10px;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.title {
|
|
131
|
+
font-size: 16px;
|
|
132
|
+
font-weight: 700;
|
|
133
|
+
color: var(--text-color);
|
|
134
|
+
white-space: nowrap;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.el-menu {
|
|
139
|
+
border-right: none;
|
|
140
|
+
background: var(--bg-white-color);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.el-sub-menu,
|
|
144
|
+
.el-popper {
|
|
145
|
+
--el-menu-text-color: var(--text-color);
|
|
146
|
+
--el-menu-hover-bg-color: var(--bg-grey-color);
|
|
147
|
+
|
|
148
|
+
.el-menu-item {
|
|
149
|
+
padding-left: 50px !important;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.el-menu-item.is-active {
|
|
153
|
+
color: var(--primary-text-color);
|
|
154
|
+
background-color: var(--primary-color);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.el-menu-item {
|
|
159
|
+
--el-menu-text-color: var(--text-color);
|
|
160
|
+
background-color: var(--bg-white-color);
|
|
161
|
+
|
|
162
|
+
&:hover {
|
|
163
|
+
background-color: var(--bg-grey-color);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
</style>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="header-crumb">
|
|
3
|
+
<el-breadcrumb separator-icon="ArrowRight">
|
|
4
|
+
<template
|
|
5
|
+
v-for="item in breadcrumbs"
|
|
6
|
+
:key="item.name"
|
|
7
|
+
>
|
|
8
|
+
<el-breadcrumb-item
|
|
9
|
+
:to="item.path"
|
|
10
|
+
>{{ item.name }}</el-breadcrumb-item>
|
|
11
|
+
</template>
|
|
12
|
+
</el-breadcrumb>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script
|
|
17
|
+
setup
|
|
18
|
+
lang="ts"
|
|
19
|
+
name="HeaderCrumb"
|
|
20
|
+
>
|
|
21
|
+
import {computed} from 'vue'
|
|
22
|
+
import { useRoute } from 'vue-router'
|
|
23
|
+
import {mapPathToBreadcrumbs} from '@/utils/map-menus'
|
|
24
|
+
import useLoginStore from '@/store/login'
|
|
25
|
+
|
|
26
|
+
const route = useRoute()
|
|
27
|
+
const userMenus = useLoginStore().userMenus
|
|
28
|
+
const breadcrumbs = computed(() => mapPathToBreadcrumbs(route.path, userMenus))
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<style
|
|
32
|
+
scoped
|
|
33
|
+
lang="scss"
|
|
34
|
+
>
|
|
35
|
+
.header-crumb {
|
|
36
|
+
background: var(--bg-white-color);
|
|
37
|
+
}
|
|
38
|
+
</style>
|