Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
saas-dml
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
saas-dml
Commits
2a78f8d8
提交
2a78f8d8
authored
11月 18, 2024
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 修改菜单通过接口控制显示隐藏
上级
db1cfddf
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
33 行增加
和
10 行删除
+33
-10
base.ts
src/api/base.ts
+5
-0
index.ts
src/modules/live/test/index.ts
+5
-0
index.ts
src/router/index.ts
+4
-4
menu.ts
src/stores/menu.ts
+0
-0
user.ts
src/stores/user.ts
+17
-6
types.ts
src/types.ts
+2
-0
没有找到文件。
src/api/base.ts
浏览文件 @
2a78f8d8
...
@@ -151,3 +151,8 @@ export function getCategoryList(params?: { name?: string }) {
...
@@ -151,3 +151,8 @@ export function getCategoryList(params?: { name?: string }) {
export
function
getProductList
(
params
?:
{
name
?:
string
})
{
export
function
getProductList
(
params
?:
{
name
?:
string
})
{
return
httpRequest
.
get
(
'/api/lab/v1/experiment/live-commodity/list'
,
{
params
})
return
httpRequest
.
get
(
'/api/lab/v1/experiment/live-commodity/list'
,
{
params
})
}
}
// 获取当前实验下的所有权限 (实验营销配置)
export
function
getAuth
()
{
return
httpRequest
.
get
(
'/api/lab/v1/experiment/auth/all'
)
}
src/modules/live/test/index.ts
浏览文件 @
2a78f8d8
...
@@ -15,6 +15,11 @@ const routes: RouteRecordRaw[] = [
...
@@ -15,6 +15,11 @@ const routes: RouteRecordRaw[] = [
{
path
:
'view'
,
component
:
()
=>
import
(
'./views/Demo.vue'
),
props
:
{
isView
:
true
}
},
{
path
:
'view'
,
component
:
()
=>
import
(
'./views/Demo.vue'
),
props
:
{
isView
:
true
}
},
],
],
},
},
{
path
:
'/one/live/test/view'
,
component
:
()
=>
import
(
'./views/Demo.vue'
),
props
:
{
isView
:
true
},
},
]
]
export
{
routes
}
export
{
routes
}
src/router/index.ts
浏览文件 @
2a78f8d8
...
@@ -3,11 +3,11 @@ import { useUserStore } from '@/stores/user'
...
@@ -3,11 +3,11 @@ import { useUserStore } from '@/stores/user'
const
router
=
createRouter
({
const
router
=
createRouter
({
history
:
createWebHistory
(),
history
:
createWebHistory
(),
routes
:
[{
path
:
'/:pathMatch(.*)*'
,
redirect
:
'/'
}]
routes
:
[{
path
:
'/:pathMatch(.*)*'
,
redirect
:
'/'
}]
,
})
})
router
.
beforeEach
(
async
(
to
,
from
,
next
)
=>
{
router
.
beforeEach
(
async
(
to
,
from
,
next
)
=>
{
const
whiteList
=
[
'/401'
]
const
whiteList
=
[
'/401'
,
'/one/live/test/view'
]
const
user
=
useUserStore
()
const
user
=
useUserStore
()
if
(
!
user
.
isLogin
&&
!
whiteList
.
includes
(
to
.
path
))
{
if
(
!
user
.
isLogin
&&
!
whiteList
.
includes
(
to
.
path
))
{
try
{
try
{
...
@@ -27,8 +27,8 @@ router.beforeEach(async (to, from, next) => {
...
@@ -27,8 +27,8 @@ router.beforeEach(async (to, from, next) => {
...
to
.
query
,
...
to
.
query
,
experiment_id
:
from
.
query
.
experiment_id
||
'7028276368903241728'
,
experiment_id
:
from
.
query
.
experiment_id
||
'7028276368903241728'
,
student_id
:
from
.
query
.
student_id
,
student_id
:
from
.
query
.
student_id
,
force_tgc
:
from
.
query
.
force_tgc
force_tgc
:
from
.
query
.
force_tgc
,
}
}
,
})
})
}
else
{
}
else
{
next
()
next
()
...
...
src/stores/menu.ts
浏览文件 @
2a78f8d8
差异被折叠。
点击展开。
src/stores/user.ts
浏览文件 @
2a78f8d8
import
type
{
UserType
,
ProjectType
,
OrganizationType
,
RoleType
,
PermissionType
}
from
'@/types'
import
type
{
UserType
,
ProjectType
,
OrganizationType
,
RoleType
,
PermissionType
}
from
'@/types'
import
{
defineStore
}
from
'pinia'
import
{
defineStore
}
from
'pinia'
import
{
getUser
,
logout
,
checkDataStatus
}
from
'@/api/base'
import
{
getUser
,
logout
,
checkDataStatus
,
getAuth
}
from
'@/api/base'
import
{
useMapStore
}
from
'@/stores/map'
import
{
useMapStore
}
from
'@/stores/map'
// 角色信息(1学员;5教师; 6管理员)
// 角色信息(1学员;5教师; 6管理员)
...
@@ -16,6 +16,13 @@ interface State {
...
@@ -16,6 +16,13 @@ interface State {
roles
:
RoleType
[]
roles
:
RoleType
[]
permissions
:
PermissionType
[]
permissions
:
PermissionType
[]
status
:
any
status
:
any
menus
:
Menu
[]
}
interface
Menu
{
id
:
number
name
:
string
pid
:
number
}
}
export
const
useUserStore
=
defineStore
({
export
const
useUserStore
=
defineStore
({
...
@@ -27,10 +34,11 @@ export const useUserStore = defineStore({
...
@@ -27,10 +34,11 @@ export const useUserStore = defineStore({
project
:
null
,
project
:
null
,
roles
:
[],
roles
:
[],
permissions
:
[],
permissions
:
[],
status
:
{}
status
:
{},
menus
:
[],
}),
}),
getters
:
{
getters
:
{
isLogin
:
state
=>
!!
state
.
user
isLogin
:
(
state
)
=>
!!
state
.
user
,
},
},
actions
:
{
actions
:
{
async
getUser
()
{
async
getUser
()
{
...
@@ -44,13 +52,16 @@ export const useUserStore = defineStore({
...
@@ -44,13 +52,16 @@ export const useUserStore = defineStore({
this
.
roles
=
roles
this
.
roles
=
roles
this
.
permissions
=
permissions
this
.
permissions
=
permissions
await
useMapStore
().
getMapList
()
await
useMapStore
().
getMapList
()
await
checkDataStatus
().
then
(
res
=>
{
await
checkDataStatus
().
then
(
(
res
)
=>
{
this
.
status
=
res
.
data
this
.
status
=
res
.
data
})
})
await
getAuth
().
then
((
res
)
=>
{
this
.
menus
=
res
.
data
.
items
||
[]
})
},
},
async
logout
()
{
async
logout
()
{
await
logout
()
await
logout
()
this
.
user
=
null
this
.
user
=
null
}
}
,
}
}
,
})
})
src/types.ts
浏览文件 @
2a78f8d8
import
type
{
Component
}
from
'vue'
import
type
{
Component
}
from
'vue'
export
interface
IMenuItem
{
export
interface
IMenuItem
{
id
?:
number
tag
?:
string
|
string
[]
tag
?:
string
|
string
[]
name
:
string
name
:
string
path
:
string
path
:
string
studentPath
?:
string
icon
?:
Component
icon
?:
Component
children
?:
IMenuItem
[]
children
?:
IMenuItem
[]
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论