Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
查尔斯-BUG万象集
Continew Admin
提交
36fda57d
Continew Admin
项目概览
查尔斯-BUG万象集
/
Continew Admin
8 个月 前同步成功
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
分析
仓库
DevOps
项目成员
Pages
Continew Admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
36fda57d
编写于
9月 11, 2023
作者:
查尔斯-BUG万象集
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 完善仪表盘最近访问区块内容(来自 @Bull-BCLS)
上级
36d38aec
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
100 addition
and
9 deletion
+100
-9
continew-admin-ui/src/api/common/dashboard.ts
continew-admin-ui/src/api/common/dashboard.ts
+6
-0
continew-admin-ui/src/router/index.ts
continew-admin-ui/src/router/index.ts
+50
-1
continew-admin-ui/src/store/modules/app/index.ts
continew-admin-ui/src/store/modules/app/index.ts
+21
-0
continew-admin-ui/src/views/dashboard/workplace/components/geo-distribution.vue
...views/dashboard/workplace/components/geo-distribution.vue
+1
-1
continew-admin-ui/src/views/dashboard/workplace/components/recently-visited.vue
...views/dashboard/workplace/components/recently-visited.vue
+22
-7
未找到文件。
continew-admin-ui/src/api/common/dashboard.ts
浏览文件 @
36fda57d
...
...
@@ -32,6 +32,12 @@ export interface DashboardAnnouncementRecord {
type
:
number
;
}
export
interface
DashboardRecentlyVisitedRecord
{
title
?:
string
;
path
:
string
;
icon
?:
string
;
}
export
function
getTotal
()
{
return
axios
.
get
<
DashboardTotalRecord
>
(
`
${
BASE_URL
}
/total`
);
}
...
...
continew-admin-ui/src/router/index.ts
浏览文件 @
36fda57d
import
{
createRouter
,
createWebHistory
}
from
'
vue-router
'
;
import
{
createRouter
,
createWebHistory
,
RouteRecordNormalized
,
}
from
'
vue-router
'
;
import
{
useAppStore
}
from
'
@/store
'
;
import
NProgress
from
'
nprogress
'
;
// progress bar
import
'
nprogress/nprogress.css
'
;
import
{
DashboardRecentlyVisitedRecord
}
from
'
@/api/common/dashboard
'
;
import
{
appRoutes
,
fixedRoutes
,
demoRoutes
}
from
'
./routes
'
;
import
{
REDIRECT_MAIN
,
NOT_FOUND_ROUTE
}
from
'
./routes/base
'
;
import
createRouteGuard
from
'
./guard
'
;
...
...
@@ -36,4 +42,47 @@ const router = createRouter({
createRouteGuard
(
router
);
router
.
afterEach
((
to
)
=>
{
const
allMenuList
=
useAppStore
().
appAsyncMenusAll
as
RouteRecordNormalized
[];
const
toMenu
=
allMenuList
.
find
((
m
)
=>
to
.
path
===
m
.
path
)
||
undefined
;
if
(
toMenu
===
undefined
)
{
return
;
}
const
recentlyVisitedList
=
window
.
localStorage
.
getItem
(
'
recently-visited
'
);
let
copyRecentlyVisitedList
:
DashboardRecentlyVisitedRecord
[];
if
(
recentlyVisitedList
===
null
)
{
copyRecentlyVisitedList
=
[];
}
else
{
copyRecentlyVisitedList
=
JSON
.
parse
(
recentlyVisitedList
);
}
// 是否有重复点击的菜单
copyRecentlyVisitedList
.
forEach
(
(
item
:
DashboardRecentlyVisitedRecord
,
index
:
number
)
=>
{
if
(
item
.
path
===
to
.
path
)
{
copyRecentlyVisitedList
.
splice
(
index
,
1
);
}
}
);
// 最多存储 3 个
const
menuMeta
=
toMenu
?.
meta
;
const
recentlyVisited
:
DashboardRecentlyVisitedRecord
=
{
title
:
menuMeta
?.
locale
,
path
:
to
.
path
,
icon
:
menuMeta
?.
icon
,
};
copyRecentlyVisitedList
.
reverse
();
copyRecentlyVisitedList
.
push
(
recentlyVisited
);
copyRecentlyVisitedList
.
reverse
();
if
(
copyRecentlyVisitedList
.
length
>=
4
)
{
copyRecentlyVisitedList
=
copyRecentlyVisitedList
.
splice
(
0
,
3
);
}
window
.
localStorage
.
setItem
(
'
recently-visited
'
,
JSON
.
stringify
(
copyRecentlyVisitedList
)
);
});
export
default
router
;
continew-admin-ui/src/store/modules/app/index.ts
浏览文件 @
36fda57d
...
...
@@ -6,6 +6,19 @@ import defaultSettings from '@/config/settings.json';
import
{
listRoute
}
from
'
@/api/auth/login
'
;
import
{
AppState
}
from
'
./types
'
;
const
recursionMenu
=
(
appMenu
:
RouteRecordNormalized
[],
list
:
Array
<
RouteRecordNormalized
>
)
=>
{
appMenu
.
forEach
((
item
)
=>
{
const
childrenAppMenu
=
item
.
children
as
RouteRecordNormalized
[];
if
(
childrenAppMenu
!=
null
&&
childrenAppMenu
.
length
>
0
)
{
recursionMenu
(
childrenAppMenu
,
list
);
}
else
{
list
.
push
(
item
);
}
});
};
const
useAppStore
=
defineStore
(
'
app
'
,
{
state
:
():
AppState
=>
({
...
defaultSettings
}),
...
...
@@ -19,6 +32,14 @@ const useAppStore = defineStore('app', {
appAsyncMenus
(
state
:
AppState
):
RouteRecordNormalized
[]
{
return
state
.
serverMenu
as
unknown
as
RouteRecordNormalized
[];
},
appAsyncMenusAll
(
state
:
AppState
):
RouteRecordNormalized
[]
{
const
menuList
:
RouteRecordNormalized
[]
=
[];
recursionMenu
(
state
.
serverMenu
as
unknown
as
RouteRecordNormalized
[],
menuList
);
return
menuList
;
},
},
actions
:
{
...
...
continew-admin-ui/src/views/dashboard/workplace/components/geo-distribution.vue
浏览文件 @
36fda57d
...
...
@@ -88,6 +88,6 @@
<
style
scoped
lang=
"less"
>
.general-card {
min-height: 56
8
px;
min-height: 56
6.14
px;
}
</
style
>
continew-admin-ui/src/views/dashboard/workplace/components/recently-visited.vue
浏览文件 @
36fda57d
...
...
@@ -7,13 +7,18 @@
>
<div
style=
"margin-bottom: -1rem"
>
<a-row
:gutter=
"8"
>
<a-col
v-for=
"link in links"
:key=
"link.text"
:span=
"8"
class=
"wrapper"
>
<a-col
v-for=
"link in links"
:key=
"link.title"
:span=
"8"
class=
"wrapper"
>
<div
@
click=
"router.replace(
{ path: link.path })">
<div
class=
"icon"
>
<svg-icon
:icon-class=
"link.icon"
/>
</div>
<a-typography-paragraph
class=
"text"
>
{{
link
.
t
ext
}}
{{
link
.
t
itle
}}
</a-typography-paragraph>
</div>
</a-col>
...
...
@@ -23,14 +28,24 @@
</
template
>
<
script
lang=
"ts"
setup
>
import
{
ref
,
onMounted
}
from
'
vue
'
;
import
{
useRouter
}
from
'
vue-router
'
;
import
{
DashboardRecentlyVisitedRecord
}
from
'
@/api/common/dashboard
'
;
const
router
=
useRouter
();
const
links
=
[
{
text
:
'
在线用户
'
,
icon
:
'
anonymity
'
,
path
:
'
/monitor/online
'
},
{
text
:
'
代码生成
'
,
icon
:
'
code
'
,
path
:
'
/tool/generator
'
},
{
text
:
'
角色管理
'
,
icon
:
'
safe
'
,
path
:
'
/system/role
'
},
];
const
links
=
ref
<
DashboardRecentlyVisitedRecord
[]
>
();
/**
* 加载最近访问菜单列表
*/
onMounted
(()
=>
{
const
recentlyVisitedList
=
window
.
localStorage
.
getItem
(
'
recently-visited
'
);
if
(
recentlyVisitedList
===
null
)
{
links
.
value
=
[];
}
else
{
links
.
value
=
JSON
.
parse
(
recentlyVisitedList
);
}
});
</
script
>
<
style
lang=
"less"
scoped
>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录