@sugarat/easypicker2-client 2.4.1
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/.env +6 -0
- package/.env.production +3 -0
- package/.env.test +4 -0
- package/.eslintignore +0 -0
- package/.eslintrc.json +57 -0
- package/.github/workflows/main.yml +61 -0
- package/.prettierrc.js +9 -0
- package/LICENSE +21 -0
- package/README.md +86 -0
- package/auto-imports.d.ts +6 -0
- package/components.d.ts +56 -0
- package/docker/ep_backup/easypicker2.sql +214 -0
- package/docker/ep_backup/mongodb/easypicker2/action.bson +0 -0
- package/docker/ep_backup/mongodb/easypicker2/action.metadata.json +1 -0
- package/docker/ep_backup/mongodb/easypicker2/log.bson +0 -0
- package/docker/ep_backup/mongodb/easypicker2/log.metadata.json +1 -0
- package/docker/ep_backup/user-config.json +176 -0
- package/docs/.env +1 -0
- package/docs/.env.production +2 -0
- package/docs/.vitepress/config.ts +204 -0
- package/docs/.vitepress/theme/bg.png +0 -0
- package/docs/.vitepress/theme/index.scss +41 -0
- package/docs/.vitepress/theme/index.ts +5 -0
- package/docs/author.md +24 -0
- package/docs/auto-imports.d.ts +6 -0
- package/docs/components.d.ts +17 -0
- package/docs/deploy/design/api.md +3 -0
- package/docs/deploy/design/db.md +3 -0
- package/docs/deploy/design/index.md +3 -0
- package/docs/deploy/design/shell.md +9 -0
- package/docs/deploy/faq.md +86 -0
- package/docs/deploy/index.md +9 -0
- package/docs/deploy/local.md +275 -0
- package/docs/deploy/online-new.md +610 -0
- package/docs/deploy/online.md +683 -0
- package/docs/deploy/qiniu.md +183 -0
- package/docs/index.md +40 -0
- package/docs/introduction/about/code.md +26 -0
- package/docs/introduction/about/index.md +33 -0
- package/docs/introduction/feature/index.md +3 -0
- package/docs/plan/log.md +333 -0
- package/docs/plan/todo.md +127 -0
- package/docs/plan/wish.md +29 -0
- package/docs/praise/index.md +45 -0
- package/docs/public/favicon.ico +0 -0
- package/docs/public/logo.png +0 -0
- package/docs/public/robots.txt +2 -0
- package/docs/src/apis/ajax.ts +66 -0
- package/docs/src/apis/index.ts +1 -0
- package/docs/src/apis/modules/wish.ts +20 -0
- package/docs/src/components/Avatar.vue +60 -0
- package/docs/src/components/Home.vue +85 -0
- package/docs/src/components/Picture.vue +13 -0
- package/docs/src/components/Praise.vue +52 -0
- package/docs/src/components/WishBtn.vue +98 -0
- package/docs/src/components/WishPanel.vue +170 -0
- package/docs/src/components/callme/index.vue +72 -0
- package/docs/vite.config.ts +42 -0
- package/index.html +127 -0
- package/package.json +52 -0
- package/public/favicon.ico +0 -0
- package/public/logo.png +0 -0
- package/scripts/deploy/docs.mjs +24 -0
- package/scripts/deploy/prod.mjs +24 -0
- package/scripts/deploy/test.mjs +26 -0
- package/src/@types/ajax.d.ts +5 -0
- package/src/@types/api.d.ts +305 -0
- package/src/@types/lib.d.ts +26 -0
- package/src/@types/page.d.ts +18 -0
- package/src/App.vue +36 -0
- package/src/apis/ajax.ts +70 -0
- package/src/apis/index.ts +20 -0
- package/src/apis/modules/action.ts +17 -0
- package/src/apis/modules/category.ts +20 -0
- package/src/apis/modules/config.ts +19 -0
- package/src/apis/modules/file.ts +150 -0
- package/src/apis/modules/people.ts +81 -0
- package/src/apis/modules/public.ts +49 -0
- package/src/apis/modules/super/overview.ts +56 -0
- package/src/apis/modules/super/user.ts +62 -0
- package/src/apis/modules/task.ts +67 -0
- package/src/apis/modules/user.ts +56 -0
- package/src/apis/modules/wish.ts +31 -0
- package/src/assets/i/EasyPicker.png +0 -0
- package/src/assets/logo.png +0 -0
- package/src/assets/styles/app.css +69 -0
- package/src/components/HomeFooter/index.vue +134 -0
- package/src/components/HomeHeader/index.vue +156 -0
- package/src/components/InfosForm/index.vue +73 -0
- package/src/components/MessageList/index.vue +155 -0
- package/src/components/MessagePanel/index.vue +42 -0
- package/src/components/Praise/index.vue +102 -0
- package/src/components/QrCode.vue +44 -0
- package/src/components/linkDialog.vue +104 -0
- package/src/components/loginPanel.vue +92 -0
- package/src/constants/index.ts +83 -0
- package/src/env.d.ts +8 -0
- package/src/main.ts +19 -0
- package/src/pages/404/index.vue +59 -0
- package/src/pages/about/index.vue +152 -0
- package/src/pages/callme/index.vue +155 -0
- package/src/pages/dashboard/config/index.vue +264 -0
- package/src/pages/dashboard/files/index.vue +1152 -0
- package/src/pages/dashboard/index.vue +335 -0
- package/src/pages/dashboard/manage/config/index.vue +97 -0
- package/src/pages/dashboard/manage/index.vue +105 -0
- package/src/pages/dashboard/manage/overview/index.vue +488 -0
- package/src/pages/dashboard/manage/user/index.vue +679 -0
- package/src/pages/dashboard/manage/wish/index.vue +257 -0
- package/src/pages/dashboard/tasks/components/CategoryPanel.vue +208 -0
- package/src/pages/dashboard/tasks/components/CreateTask.vue +93 -0
- package/src/pages/dashboard/tasks/components/TaskInfo.vue +129 -0
- package/src/pages/dashboard/tasks/components/infoPanel/ddl.vue +96 -0
- package/src/pages/dashboard/tasks/components/infoPanel/file.vue +175 -0
- package/src/pages/dashboard/tasks/components/infoPanel/info.vue +477 -0
- package/src/pages/dashboard/tasks/components/infoPanel/people.vue +567 -0
- package/src/pages/dashboard/tasks/components/infoPanel/template.vue +146 -0
- package/src/pages/dashboard/tasks/components/infoPanel/tip.vue +55 -0
- package/src/pages/dashboard/tasks/components/infoPanel/tipInfo.vue +196 -0
- package/src/pages/dashboard/tasks/index.vue +302 -0
- package/src/pages/dashboard/tasks/public.ts +32 -0
- package/src/pages/disabled/index.vue +47 -0
- package/src/pages/feedback/index.vue +5 -0
- package/src/pages/home/index.vue +72 -0
- package/src/pages/login/index.vue +270 -0
- package/src/pages/register/index.vue +211 -0
- package/src/pages/reset/index.vue +186 -0
- package/src/pages/task/index.vue +897 -0
- package/src/pages/wish/index.vue +152 -0
- package/src/router/Interceptor/index.ts +112 -0
- package/src/router/index.ts +13 -0
- package/src/router/routes/index.ts +197 -0
- package/src/shims-vue.d.ts +6 -0
- package/src/store/index.ts +17 -0
- package/src/store/modules/category.ts +44 -0
- package/src/store/modules/public.ts +27 -0
- package/src/store/modules/task.ts +55 -0
- package/src/store/modules/user.ts +57 -0
- package/src/utils/elementUI.ts +8 -0
- package/src/utils/networkUtil.ts +236 -0
- package/src/utils/other.ts +25 -0
- package/src/utils/regExp.ts +11 -0
- package/src/utils/stringUtil.ts +242 -0
- package/tsconfig.json +24 -0
- package/vite.config.ts +55 -0
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="dashboard">
|
|
3
|
+
<div class="pc-nav">
|
|
4
|
+
<div class="nav">
|
|
5
|
+
<!-- LOGO -->
|
|
6
|
+
<div class="logo">
|
|
7
|
+
<router-link to="/">
|
|
8
|
+
<img
|
|
9
|
+
src="https://img.cdn.sugarat.top/easypicker/EasyPicker.png"
|
|
10
|
+
alt="logo"
|
|
11
|
+
/>
|
|
12
|
+
</router-link>
|
|
13
|
+
</div>
|
|
14
|
+
<input v-if="isMobile" type="checkbox" id="navActive" />
|
|
15
|
+
<nav>
|
|
16
|
+
<label v-if="isMobile" for="navActive" class="nav-item">
|
|
17
|
+
<span>Hello💐,</span>
|
|
18
|
+
{{ userName }}
|
|
19
|
+
</label>
|
|
20
|
+
<label
|
|
21
|
+
for="navActive"
|
|
22
|
+
class="nav-item"
|
|
23
|
+
v-for="(n, idx) in navList"
|
|
24
|
+
:key="idx"
|
|
25
|
+
:class="{
|
|
26
|
+
active: navActiveIdx === idx
|
|
27
|
+
}"
|
|
28
|
+
@click="handleNav(idx)"
|
|
29
|
+
>{{ n.title }}</label
|
|
30
|
+
>
|
|
31
|
+
<label
|
|
32
|
+
@click="handleLogout"
|
|
33
|
+
v-if="isMobile"
|
|
34
|
+
for="navActive"
|
|
35
|
+
class="nav-item"
|
|
36
|
+
>
|
|
37
|
+
<span style="margin-right: 6px">退出</span>
|
|
38
|
+
<el-icon size="16">
|
|
39
|
+
<svg
|
|
40
|
+
width="16"
|
|
41
|
+
height="16"
|
|
42
|
+
viewBox="0 0 16 16"
|
|
43
|
+
fill="none"
|
|
44
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
45
|
+
data-v-53d86618
|
|
46
|
+
>
|
|
47
|
+
<path
|
|
48
|
+
fill-rule="evenodd"
|
|
49
|
+
clip-rule="evenodd"
|
|
50
|
+
d="M10.6667 2.55473C13.0212 3.58347 14.6667 5.93291 14.6667 8.66667C14.6667 12.3486 11.6819 15.3333 8 15.3333C4.3181 15.3333 1.33333 12.3486 1.33333 8.66667C1.33333 5.93291 2.97879 3.58347 5.33333 2.55473V4.04684C3.7392 4.969 2.66667 6.69259 2.66667 8.66667C2.66667 11.6122 5.05448 14 8 14C10.9455 14 13.3333 11.6122 13.3333 8.66667C13.3333 6.69259 12.2608 4.969 10.6667 4.04684V2.55473ZM7.33333 8.66667V1.33333C7.33333 1.14924 7.48257 1 7.66667 1H8.33333C8.51743 1 8.66667 1.14924 8.66667 1.33333V8.66667C8.66667 8.85076 8.51743 9 8.33333 9H7.66667C7.48257 9 7.33333 8.85076 7.33333 8.66667Z"
|
|
51
|
+
fill="#86909C"
|
|
52
|
+
data-v-53d86618
|
|
53
|
+
/>
|
|
54
|
+
</svg>
|
|
55
|
+
</el-icon>
|
|
56
|
+
</label>
|
|
57
|
+
</nav>
|
|
58
|
+
<div class="mask"></div>
|
|
59
|
+
</div>
|
|
60
|
+
<!-- 移动端展示 -->
|
|
61
|
+
<span id="navMenu">
|
|
62
|
+
<message-panel v-if="isMobile" class="mobile-message-bell" />
|
|
63
|
+
<label for="navActive">
|
|
64
|
+
<el-icon size="32">
|
|
65
|
+
<Expand />
|
|
66
|
+
</el-icon>
|
|
67
|
+
</label>
|
|
68
|
+
</span>
|
|
69
|
+
<div class="flex fac" v-if="!isMobile">
|
|
70
|
+
<message-panel />
|
|
71
|
+
<span>Hello 💐,</span>
|
|
72
|
+
<el-dropdown class="exit">
|
|
73
|
+
<span class="exit-info">
|
|
74
|
+
<span class="ellipsis">{{ userName }}</span>
|
|
75
|
+
<el-icon>
|
|
76
|
+
<ArrowDown />
|
|
77
|
+
</el-icon>
|
|
78
|
+
</span>
|
|
79
|
+
<template #dropdown>
|
|
80
|
+
<el-dropdown-menu>
|
|
81
|
+
<el-dropdown-item @click="handleLogout" :icon="Close"
|
|
82
|
+
>退出</el-dropdown-item
|
|
83
|
+
>
|
|
84
|
+
</el-dropdown-menu>
|
|
85
|
+
</template>
|
|
86
|
+
</el-dropdown>
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
<router-view></router-view>
|
|
90
|
+
<div>
|
|
91
|
+
<home-footer type="dashboard"></home-footer>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
</template>
|
|
95
|
+
<script lang="ts" setup>
|
|
96
|
+
import { Expand, Close, ArrowDown, Bell } from '@element-plus/icons-vue'
|
|
97
|
+
import HomeFooter from '@components/HomeFooter/index.vue'
|
|
98
|
+
|
|
99
|
+
import { onMounted, reactive, ref, computed, watch } from 'vue'
|
|
100
|
+
import { useRoute, useRouter } from 'vue-router'
|
|
101
|
+
import { useStore } from 'vuex'
|
|
102
|
+
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
103
|
+
import MessagePanel from '@/components/MessagePanel/index.vue'
|
|
104
|
+
import { UserApi } from '@/apis'
|
|
105
|
+
|
|
106
|
+
const $router = useRouter()
|
|
107
|
+
const $store = useStore()
|
|
108
|
+
const $route = useRoute()
|
|
109
|
+
const isMobile = computed(() => $store.getters['public/isMobile'])
|
|
110
|
+
const navList = reactive<
|
|
111
|
+
{ title: string; path: string; isExternal?: boolean }[]
|
|
112
|
+
>([
|
|
113
|
+
{
|
|
114
|
+
title: '文件管理',
|
|
115
|
+
path: '/dashboard/files'
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
title: '任务管理',
|
|
119
|
+
path: '/dashboard/tasks'
|
|
120
|
+
}
|
|
121
|
+
])
|
|
122
|
+
const navActiveIdx = ref(0)
|
|
123
|
+
const handleNav = (idx: number) => {
|
|
124
|
+
const n = navList[idx]
|
|
125
|
+
if (!n.isExternal && idx !== navActiveIdx.value) {
|
|
126
|
+
$router.push({
|
|
127
|
+
path: n.path
|
|
128
|
+
})
|
|
129
|
+
}
|
|
130
|
+
if (n.isExternal) {
|
|
131
|
+
window.open(n.path, '_blank')
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// 自动切换激活的标题栏
|
|
136
|
+
watch(
|
|
137
|
+
() => $route.path,
|
|
138
|
+
(path: string) => {
|
|
139
|
+
const idx = navList.findIndex((n) => path.startsWith(n.path))
|
|
140
|
+
if (idx !== -1) {
|
|
141
|
+
navActiveIdx.value = idx
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
const handleLogout = () => {
|
|
147
|
+
ElMessageBox.confirm('确认退出登录?', '登出提示', {
|
|
148
|
+
draggable: true
|
|
149
|
+
})
|
|
150
|
+
.then(() => {
|
|
151
|
+
// 登出接口
|
|
152
|
+
UserApi.logout().finally(() => {
|
|
153
|
+
$store.commit('user/setToken', null)
|
|
154
|
+
$router.replace({
|
|
155
|
+
name: 'home'
|
|
156
|
+
})
|
|
157
|
+
})
|
|
158
|
+
})
|
|
159
|
+
.catch(() => {
|
|
160
|
+
ElMessage.info('取消')
|
|
161
|
+
})
|
|
162
|
+
}
|
|
163
|
+
const userName = ref('World')
|
|
164
|
+
|
|
165
|
+
const refreshActiveTab = () => {
|
|
166
|
+
// 动态修改active的项
|
|
167
|
+
navActiveIdx.value = navList.findIndex((v) => $route.path.startsWith(v.path))
|
|
168
|
+
}
|
|
169
|
+
onMounted(() => {
|
|
170
|
+
// 动态添加管理页面入口
|
|
171
|
+
UserApi.checkPower().then((r) => {
|
|
172
|
+
const isSuperAdmin = r.data?.power
|
|
173
|
+
userName.value = r.data?.name
|
|
174
|
+
$store.commit('user/setSuperAdmin', isSuperAdmin)
|
|
175
|
+
if (isSuperAdmin) {
|
|
176
|
+
const superNavList = [
|
|
177
|
+
{
|
|
178
|
+
title: '应用管理',
|
|
179
|
+
path: '/dashboard/manage'
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
title: '网站监控',
|
|
183
|
+
path: 'https://www.frontjs.com/app/87c1ef7667a513f313b4abb22a88dc78',
|
|
184
|
+
isExternal: true
|
|
185
|
+
}
|
|
186
|
+
]
|
|
187
|
+
navList.push(...superNavList)
|
|
188
|
+
}
|
|
189
|
+
const isSystem = r.data?.system
|
|
190
|
+
if (isSystem) {
|
|
191
|
+
navList.splice(0, navList.length)
|
|
192
|
+
navList.push({
|
|
193
|
+
title: '系统管理',
|
|
194
|
+
path: '/dashboard/config'
|
|
195
|
+
})
|
|
196
|
+
}
|
|
197
|
+
refreshActiveTab()
|
|
198
|
+
})
|
|
199
|
+
})
|
|
200
|
+
</script>
|
|
201
|
+
<style scoped lang="scss">
|
|
202
|
+
.dashboard {
|
|
203
|
+
background-color: #fafafa;
|
|
204
|
+
}
|
|
205
|
+
.pc-nav {
|
|
206
|
+
background-color: #fff;
|
|
207
|
+
display: flex;
|
|
208
|
+
padding: 10px;
|
|
209
|
+
justify-content: space-between;
|
|
210
|
+
align-items: center;
|
|
211
|
+
.exit {
|
|
212
|
+
cursor: pointer;
|
|
213
|
+
display: flex;
|
|
214
|
+
align-items: center;
|
|
215
|
+
.exit-info {
|
|
216
|
+
display: flex;
|
|
217
|
+
justify-content: center;
|
|
218
|
+
align-items: center;
|
|
219
|
+
> span {
|
|
220
|
+
margin-right: 5px;
|
|
221
|
+
display: block;
|
|
222
|
+
max-width: 70px;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
.nav {
|
|
227
|
+
display: flex;
|
|
228
|
+
nav {
|
|
229
|
+
display: flex;
|
|
230
|
+
align-items: center;
|
|
231
|
+
.nav-item {
|
|
232
|
+
font-size: 1rem;
|
|
233
|
+
color: #595959;
|
|
234
|
+
padding: 10px;
|
|
235
|
+
cursor: pointer;
|
|
236
|
+
display: flex;
|
|
237
|
+
align-items: center;
|
|
238
|
+
justify-content: center;
|
|
239
|
+
&.active {
|
|
240
|
+
color: #409eff !important;
|
|
241
|
+
font-weight: 600;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
.exit {
|
|
246
|
+
color: #595959;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
.logo {
|
|
250
|
+
width: 180px;
|
|
251
|
+
margin: 0 10px;
|
|
252
|
+
img {
|
|
253
|
+
height: 40px;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
#navActive {
|
|
258
|
+
display: none;
|
|
259
|
+
opacity: 0;
|
|
260
|
+
}
|
|
261
|
+
#navMenu {
|
|
262
|
+
display: none;
|
|
263
|
+
}
|
|
264
|
+
.mobile-message-bell {
|
|
265
|
+
display: none;
|
|
266
|
+
position: fixed;
|
|
267
|
+
right: 0;
|
|
268
|
+
top: 0;
|
|
269
|
+
}
|
|
270
|
+
@media screen and (max-width: 700px) {
|
|
271
|
+
#navActive {
|
|
272
|
+
display: block;
|
|
273
|
+
position: fixed;
|
|
274
|
+
left: 0;
|
|
275
|
+
top: 0;
|
|
276
|
+
}
|
|
277
|
+
.mobile-message-bell {
|
|
278
|
+
display: block;
|
|
279
|
+
}
|
|
280
|
+
#navMenu {
|
|
281
|
+
cursor: pointer;
|
|
282
|
+
display: block;
|
|
283
|
+
position: absolute;
|
|
284
|
+
left: 10px;
|
|
285
|
+
top: 5px;
|
|
286
|
+
font-size: 2rem;
|
|
287
|
+
}
|
|
288
|
+
.pc-nav {
|
|
289
|
+
position: fixed;
|
|
290
|
+
left: 0;
|
|
291
|
+
right: 0;
|
|
292
|
+
top: 0;
|
|
293
|
+
z-index: 6;
|
|
294
|
+
.nav {
|
|
295
|
+
flex-wrap: wrap;
|
|
296
|
+
width: 100%;
|
|
297
|
+
.logo {
|
|
298
|
+
width: 100%;
|
|
299
|
+
text-align: center;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
#navActive {
|
|
303
|
+
& + nav {
|
|
304
|
+
display: none;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
#navActive:checked {
|
|
308
|
+
& + nav {
|
|
309
|
+
display: flex;
|
|
310
|
+
flex-direction: column;
|
|
311
|
+
width: 100%;
|
|
312
|
+
position: absolute;
|
|
313
|
+
z-index: 1;
|
|
314
|
+
background: #fff;
|
|
315
|
+
left: 0;
|
|
316
|
+
top: 50px;
|
|
317
|
+
+ .mask {
|
|
318
|
+
display: block;
|
|
319
|
+
position: fixed;
|
|
320
|
+
left: 0;
|
|
321
|
+
right: 0;
|
|
322
|
+
bottom: 0;
|
|
323
|
+
top: 50px;
|
|
324
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
.exit {
|
|
329
|
+
position: absolute;
|
|
330
|
+
right: 10px;
|
|
331
|
+
top: 20px;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
</style>
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="user">
|
|
3
|
+
<div class="panel">
|
|
4
|
+
<el-divider>部分路由管理</el-divider>
|
|
5
|
+
<ul class="routes">
|
|
6
|
+
<li v-for="r in showRoutes" :key="r.name">
|
|
7
|
+
<el-switch
|
|
8
|
+
@change="handleChangeRoute(r)"
|
|
9
|
+
:value="!r.disabled"
|
|
10
|
+
style="
|
|
11
|
+
--el-switch-on-color: #13ce66;
|
|
12
|
+
--el-switch-off-color: #ff4949;
|
|
13
|
+
"
|
|
14
|
+
/>
|
|
15
|
+
<span class="title">{{ r.title }}</span>
|
|
16
|
+
<span class="path">{{ r.path }}</span>
|
|
17
|
+
</li>
|
|
18
|
+
</ul>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
<script lang="ts" setup>
|
|
23
|
+
import { ElMessage } from 'element-plus'
|
|
24
|
+
import { computed, onMounted, reactive, ref } from 'vue'
|
|
25
|
+
import { useStore } from 'vuex'
|
|
26
|
+
import { useRouter } from 'vue-router'
|
|
27
|
+
import { SuperOverviewApi } from '@/apis'
|
|
28
|
+
|
|
29
|
+
const $store = useStore()
|
|
30
|
+
const $router = useRouter()
|
|
31
|
+
const routes = computed(() =>
|
|
32
|
+
$router.options.routes.filter((v) => v.meta?.allowDisabled)
|
|
33
|
+
)
|
|
34
|
+
const showRoutes = reactive<
|
|
35
|
+
{
|
|
36
|
+
path: string
|
|
37
|
+
name: string
|
|
38
|
+
title: string
|
|
39
|
+
disabled: boolean
|
|
40
|
+
}[]
|
|
41
|
+
>([])
|
|
42
|
+
|
|
43
|
+
const handleChangeRoute = (r: typeof showRoutes[0]) => {
|
|
44
|
+
SuperOverviewApi.addDisabledRoute(r.path, !r.disabled).then(() => {
|
|
45
|
+
r.disabled = !r.disabled
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
onMounted(() => {
|
|
49
|
+
for (const r of routes.value) {
|
|
50
|
+
SuperOverviewApi.checkDisabledRoute(r.path).then((v) => {
|
|
51
|
+
showRoutes.push({
|
|
52
|
+
path: r.path,
|
|
53
|
+
name: r.name.toString(),
|
|
54
|
+
title: r.meta.title,
|
|
55
|
+
disabled: !!v.data?.status
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
const isMobile = computed(() => $store.getters['public/isMobile'])
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
<style scoped lang="scss">
|
|
64
|
+
@media screen and (max-width: 700px) {
|
|
65
|
+
.user {
|
|
66
|
+
margin-top: 40px !important;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.user {
|
|
71
|
+
margin: 0 auto;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.panel {
|
|
75
|
+
max-width: 1256px;
|
|
76
|
+
padding: 1em;
|
|
77
|
+
background-color: #fff;
|
|
78
|
+
margin: 10px auto;
|
|
79
|
+
box-sizing: border-box;
|
|
80
|
+
box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
|
|
81
|
+
border-radius: 4px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.routes {
|
|
85
|
+
max-width: 500px;
|
|
86
|
+
margin: 0 auto;
|
|
87
|
+
li {
|
|
88
|
+
display: flex;
|
|
89
|
+
padding: 20px;
|
|
90
|
+
align-items: center;
|
|
91
|
+
.title {
|
|
92
|
+
font-weight: bold;
|
|
93
|
+
margin: 0 10px;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
</style>
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="monitor">
|
|
3
|
+
<div class="navs">
|
|
4
|
+
<el-menu
|
|
5
|
+
:default-active="defaultActive"
|
|
6
|
+
class="el-menu-nav"
|
|
7
|
+
:collapse="isCollapse"
|
|
8
|
+
@select="handleSelect"
|
|
9
|
+
>
|
|
10
|
+
<el-menu-item index="overview">
|
|
11
|
+
<el-icon>
|
|
12
|
+
<DataAnalysis />
|
|
13
|
+
</el-icon>
|
|
14
|
+
<template #title>概况</template>
|
|
15
|
+
</el-menu-item>
|
|
16
|
+
<el-menu-item index="user">
|
|
17
|
+
<el-icon>
|
|
18
|
+
<User />
|
|
19
|
+
</el-icon>
|
|
20
|
+
<template #title>用户</template>
|
|
21
|
+
</el-menu-item>
|
|
22
|
+
<el-menu-item index="wish">
|
|
23
|
+
<el-icon>
|
|
24
|
+
<DataBoard />
|
|
25
|
+
</el-icon>
|
|
26
|
+
<template #title>需求</template>
|
|
27
|
+
</el-menu-item>
|
|
28
|
+
<el-menu-item index="config">
|
|
29
|
+
<el-icon>
|
|
30
|
+
<Setting />
|
|
31
|
+
</el-icon>
|
|
32
|
+
<template #title>配置</template>
|
|
33
|
+
</el-menu-item>
|
|
34
|
+
</el-menu>
|
|
35
|
+
</div>
|
|
36
|
+
<div class="container">
|
|
37
|
+
<router-view></router-view>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</template>
|
|
41
|
+
<script lang="ts" setup>
|
|
42
|
+
import { onMounted, ref } from 'vue'
|
|
43
|
+
import { useRoute, useRouter } from 'vue-router'
|
|
44
|
+
import { User, DataBoard, DataAnalysis, Setting } from '@element-plus/icons-vue'
|
|
45
|
+
|
|
46
|
+
const defaultActive = ref('overview')
|
|
47
|
+
const isCollapse = ref(false)
|
|
48
|
+
const $router = useRouter()
|
|
49
|
+
const $route = useRoute()
|
|
50
|
+
const handleSelect = (path: string) => {
|
|
51
|
+
if ($route.path.endsWith(path)) {
|
|
52
|
+
return
|
|
53
|
+
}
|
|
54
|
+
$router.replace({
|
|
55
|
+
path
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
onMounted(() => {
|
|
59
|
+
const value = $route.path.split('/').slice(-1)[0]
|
|
60
|
+
defaultActive.value = value
|
|
61
|
+
})
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<style scoped>
|
|
65
|
+
.monitor {
|
|
66
|
+
width: 96%;
|
|
67
|
+
/* min-height: 100vh; */
|
|
68
|
+
padding: 10px;
|
|
69
|
+
overflow: hidden;
|
|
70
|
+
display: flex;
|
|
71
|
+
}
|
|
72
|
+
.navs {
|
|
73
|
+
min-width: 140px;
|
|
74
|
+
}
|
|
75
|
+
.container {
|
|
76
|
+
padding-left: 20px;
|
|
77
|
+
flex-grow: 1;
|
|
78
|
+
width: calc(100% - 150px);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@media screen and (max-width: 700px) {
|
|
82
|
+
.monitor {
|
|
83
|
+
margin-top: 70px;
|
|
84
|
+
padding: 10px 0;
|
|
85
|
+
width: 100%;
|
|
86
|
+
}
|
|
87
|
+
.navs {
|
|
88
|
+
position: absolute;
|
|
89
|
+
left: 50%;
|
|
90
|
+
transform: translateX(-50%);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.el-radio-group {
|
|
94
|
+
display: none;
|
|
95
|
+
}
|
|
96
|
+
.el-menu-nav {
|
|
97
|
+
display: flex;
|
|
98
|
+
}
|
|
99
|
+
.container {
|
|
100
|
+
padding-left: 0;
|
|
101
|
+
margin-top: 30px;
|
|
102
|
+
width: 100%;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
</style>
|