Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
saas-dml
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
saas-dml
Commits
570559b3
提交
570559b3
authored
11月 20, 2024
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bug fixes
上级
32b21cbc
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
34 行增加
和
17 行删除
+34
-17
LivePlayback.vue
src/modules/live/test/components/LivePlayback.vue
+8
-2
useLive.ts
src/modules/live/test/composables/useLive.ts
+2
-2
menu.ts
src/stores/menu.ts
+24
-13
没有找到文件。
src/modules/live/test/components/LivePlayback.vue
浏览文件 @
570559b3
...
...
@@ -18,8 +18,14 @@ const video = ref(null)
const
playing
=
ref
(
false
)
const
duration
=
ref
(
0
)
onMounted
(()
=>
{
video
.
value
.
onloadedmetadata
=
(
e
)
=>
{
video
.
value
.
ondurationchange
=
(
e
)
=>
{
if
(
e
.
target
.
duration
===
Infinity
)
{
video
.
value
.
currentTime
=
1
e101
}
else
{
video
.
value
.
currentTime
=
0
}
duration
.
value
=
e
.
target
.
duration
===
Infinity
?
parseFloat
(
record
.
value
.
live_duration
)
:
e
.
target
.
duration
console
.
log
(
'ondurationchange'
,
e
.
target
.
duration
)
}
video
.
value
.
ontimeupdate
=
()
=>
{
currentTime
.
value
=
video
.
value
.
currentTime
...
...
@@ -52,7 +58,7 @@ const hover = ref(false)
<p>
主播:
{{
userName
}}
</p>
</div>
<div
class=
"live-bd"
>
<video
:src=
"record.live_video_addres"
ref=
"video"
></video>
<video
:src=
"record.live_video_addres"
preload=
"metadata"
ref=
"video"
></video>
<LiveCover
:messages=
"messages"
:stats=
"stats"
...
...
src/modules/live/test/composables/useLive.ts
浏览文件 @
570559b3
...
...
@@ -28,7 +28,7 @@ interface UseLiveProps {
export
function
useLive
({
enabledUserMedia
=
true
,
onStart
,
onRecord
,
onStop
}:
UseLiveProps
)
{
const
startTime
=
ref
(
0
)
const
endTime
=
ref
(
0
)
const
duration
=
computed
(()
=>
Math
.
floor
((
endTime
.
value
-
startTime
.
value
)
/
1000
)
)
const
duration
=
computed
(()
=>
(
endTime
.
value
-
startTime
.
value
)
/
1000
)
const
currentTime
=
ref
(
0
)
// 获取设备列表并设置默认设备
...
...
@@ -78,7 +78,7 @@ export function useLive({ enabledUserMedia = true, onStart, onRecord, onStop }:
// 录像停止时处理
const
handleStop
=
()
=>
{
endTime
.
value
=
Date
.
now
()
const
blob
=
new
Blob
(
recordedChunks
.
value
,
{
type
:
'video/mp4'
})
const
blob
=
new
Blob
(
recordedChunks
.
value
,
{
type
:
mediaRecorder
?.
mimeType
})
onStop
&&
onStop
(
blob
)
recordedChunks
.
value
=
[]
...
...
src/stores/menu.ts
浏览文件 @
570559b3
...
...
@@ -365,19 +365,30 @@ export const useMenuStore = defineStore({
getters
:
{
menus
:
(
state
)
=>
{
const
userStore
=
useUserStore
()
// const menus = userStore.role?.id === 1 ? state.studentMenus : state.adminMenus
return
state
.
adminMenus
.
filter
((
item
)
=>
{
// 过滤有权限的菜单
return
userStore
.
menus
.
find
((
menu
)
=>
menu
.
id
==
item
.
id
)
})
.
map
((
item
)
=>
{
// 如果当前角色是学生,则使用学生的路径
if
(
userStore
.
role
?.
id
===
1
&&
item
.
studentPath
)
{
item
.
path
=
item
.
studentPath
}
return
item
})
const
userRole
=
userStore
.
role
?.
id
const
userPermissions
=
userStore
.
menus
||
[]
// 递归过滤菜单及其子菜单
const
filterMenus
=
(
menus
:
IMenuItem
[]):
IMenuItem
[]
=>
{
return
menus
.
filter
((
menu
)
=>
userPermissions
.
some
((
perm
)
=>
perm
.
id
===
menu
.
id
))
.
map
((
menu
)
=>
{
const
filteredMenu
:
IMenuItem
=
{
...
menu
,
// 替换路径为学生路径(如果有学生路径并且角色为学生)
path
:
userRole
===
1
&&
menu
.
studentPath
?
menu
.
studentPath
:
menu
.
path
,
}
// 如果存在子菜单,则递归过滤
if
(
menu
.
children
)
{
filteredMenu
.
children
=
filterMenus
(
menu
.
children
)
}
return
filteredMenu
})
}
// 根据用户角色选择基础菜单
// const baseMenus = userRole === 1 ? state.studentMenus : state.adminMenus
return
filterMenus
(
state
.
adminMenus
)
},
},
})
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论