Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
P
pica-professional-exam
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
Close sidebar
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Culm
pica-professional-exam
提交
c08ad782
提交
c08ad782
编写于
8月 26, 2020
作者:
guofeng.chen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改视频
上级
e20d27c3
变更
2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
28 行增加
和
17 行删除
+28
-17
pica-video.vue
src/components/course/pica-video.vue
+27
-16
user.js
src/store/modules/user.js
+1
-1
未找到文件。
src/components/course/pica-video.vue
浏览文件 @
c08ad782
...
@@ -141,6 +141,7 @@ export default {
...
@@ -141,6 +141,7 @@ export default {
this
.
vid
=
`video_${this._uid
}
`
;
this
.
vid
=
`video_${this._uid
}
`
;
const
ua
=
navigator
.
userAgent
;
const
ua
=
navigator
.
userAgent
;
this
.
isWechat
=
ua
.
match
(
/
(
MicroMessenger
)\/([\d
.
]
+
)
/
);
this
.
isWechat
=
ua
.
match
(
/
(
MicroMessenger
)\/([\d
.
]
+
)
/
);
this
.
isAndroid
=
ua
.
match
(
/
(
Android
)
;
?[\s\/]
+
([\d
.
]
+
)?
/
);
}
,
}
,
mounted
()
{
mounted
()
{
if
(
this
.
isWechat
)
{
if
(
this
.
isWechat
)
{
...
@@ -173,14 +174,9 @@ export default {
...
@@ -173,14 +174,9 @@ export default {
return
;
return
;
}
}
if
(
isPaused
)
{
if
(
isPaused
)
{
this
.
player
.
style
.
display
=
'block'
;
this
.
player
.
play
();
this
.
player
.
play
();
if
(
this
.
opts
.
proved
>
0
)
{
this
.
showProved
=
false
;
this
.
showProved
=
true
;
this
.
provedTimer
&&
clearTimeout
(
this
.
provedTimer
);
this
.
provedTimer
=
setTimeout
(()
=>
{
this
.
showProved
=
false
;
}
,
5000
)
}
}
else
{
}
else
{
this
.
player
.
pause
();
this
.
player
.
pause
();
}
}
...
@@ -205,6 +201,7 @@ export default {
...
@@ -205,6 +201,7 @@ export default {
this
.
opts
=
opts
;
this
.
opts
=
opts
;
this
.
currentTime
=
null
;
this
.
currentTime
=
null
;
this
.
duration
=
null
;
this
.
duration
=
null
;
this
.
showProved
=
proved
>
0
;
this
.
showReplay
=
false
;
this
.
showReplay
=
false
;
if
(
this
.
showError
)
this
.
showError
=
false
;
if
(
this
.
showError
)
this
.
showError
=
false
;
}
,
}
,
...
@@ -223,6 +220,7 @@ export default {
...
@@ -223,6 +220,7 @@ export default {
}
}
const
loop
=
()
=>
{
const
loop
=
()
=>
{
if
(
this
.
loaded
)
{
if
(
this
.
loaded
)
{
this
.
player
.
style
.
display
=
'block'
;
this
.
player
.
play
();
this
.
player
.
play
();
this
.
isPaused
=
false
;
this
.
isPaused
=
false
;
this
.
reportOnOff
(
1
);
this
.
reportOnOff
(
1
);
...
@@ -237,11 +235,14 @@ export default {
...
@@ -237,11 +235,14 @@ export default {
}
,
}
,
// 重播
// 重播
onReplay
()
{
onReplay
()
{
this
.
player
.
style
.
display
=
'block'
;
this
.
player
.
currentTime
=
0
;
this
.
player
.
currentTime
=
0
;
this
.
player
.
play
();
this
.
player
.
play
();
this
.
isPaused
=
false
;
this
.
isPaused
=
false
;
this
.
reportOnOff
(
1
);
this
.
reportOnOff
(
1
);
this
.
$emit
(
'onReplay'
)
this
.
$emit
(
'onReplay'
);
this
.
showReplay
=
false
;
this
.
provedOver
=
false
;
}
,
}
,
// 加载完毕,获取总时长和音量。问题:移动端点击播放才会触发,且不一定会获取时长
// 加载完毕,获取总时长和音量。问题:移动端点击播放才会触发,且不一定会获取时长
loadedMetaData
()
{
loadedMetaData
()
{
...
@@ -260,10 +261,14 @@ export default {
...
@@ -260,10 +261,14 @@ export default {
}
,
}
,
// 播放中
// 播放中
onTimeUpdate
(
e
)
{
onTimeUpdate
(
e
)
{
const
{
currentTime
,
duration
}
=
e
.
target
;
// 试看,且超过时间
if
(
this
.
proved
&&
currentTime
>=
this
.
proved
)
{
this
.
provedEnd
();
}
if
(
this
.
provedOver
)
{
if
(
this
.
provedOver
)
{
return
return
}
}
const
{
currentTime
,
duration
}
=
e
.
target
;
if
(
currentTime
)
{
if
(
currentTime
)
{
this
.
playTime
=
this
.
formatTime
(
currentTime
);
this
.
playTime
=
this
.
formatTime
(
currentTime
);
}
}
...
@@ -275,10 +280,6 @@ export default {
...
@@ -275,10 +280,6 @@ export default {
if
(
currentTime
<
0.1
&&
!
this
.
loaded
)
{
if
(
currentTime
<
0.1
&&
!
this
.
loaded
)
{
this
.
loadedMetaData
();
this
.
loadedMetaData
();
}
}
// 试看,且超过时间
if
(
this
.
proved
&&
currentTime
>=
this
.
proved
)
{
this
.
provedEnd
();
}
}
,
}
,
// 设置进度条位置
// 设置进度条位置
setBarPosition
(
percent
,
target
)
{
setBarPosition
(
percent
,
target
)
{
...
@@ -311,6 +312,7 @@ export default {
...
@@ -311,6 +312,7 @@ export default {
this
.
setBarPosition
(
percent
,
'progressBar'
);
this
.
setBarPosition
(
percent
,
'progressBar'
);
this
.
player
.
currentTime
=
percent
*
duration
/
100
;
this
.
player
.
currentTime
=
percent
*
duration
/
100
;
if
(
this
.
isPaused
)
{
if
(
this
.
isPaused
)
{
this
.
player
.
style
.
display
=
'block'
;
this
.
player
.
play
();
this
.
player
.
play
();
this
.
isPaused
=
false
;
this
.
isPaused
=
false
;
this
.
reportOnOff
(
1
);
this
.
reportOnOff
(
1
);
...
@@ -360,17 +362,26 @@ export default {
...
@@ -360,17 +362,26 @@ export default {
}
,
}
,
// 试看结束
// 试看结束
provedEnd
()
{
provedEnd
()
{
this
.
provedOver
=
true
;
this
.
player
.
pause
();
this
.
player
.
pause
();
this
.
$emit
(
'onVideoEnd'
,
{
type
:
2
}
);
this
.
player
.
currentTime
=
this
.
proved
;
if
(
this
.
isAndroid
)
{
this
.
player
.
style
.
display
=
'none'
;
}
if
(
!
this
.
provedOver
)
{
this
.
$emit
(
'onVideoEnd'
,
{
type
:
2
}
);
this
.
reportOnOff
(
2
);
}
this
.
finish
=
true
;
this
.
finish
=
true
;
this
.
showReplay
=
true
;
this
.
showReplay
=
true
;
this
.
reportOnOff
(
2
)
;
this
.
provedOver
=
true
;
}
,
}
,
// 播放结束
// 播放结束
onEnded
()
{
onEnded
()
{
this
.
$emit
(
'onVideoEnd'
,
{
type
:
1
}
);
this
.
$emit
(
'onVideoEnd'
,
{
type
:
1
}
);
this
.
finish
=
true
;
this
.
finish
=
true
;
if
(
this
.
isAndroid
)
{
this
.
player
.
style
.
display
=
'none'
;
}
this
.
reportOnOff
(
2
);
this
.
reportOnOff
(
2
);
}
,
}
,
onError
()
{
onError
()
{
...
...
src/store/modules/user.js
浏览文件 @
c08ad782
...
@@ -32,7 +32,7 @@ const user = {
...
@@ -32,7 +32,7 @@ const user = {
Toast
(
'登录失效,请重新登录~'
)
Toast
(
'登录失效,请重新登录~'
)
}
}
const
res
=
await
fetch
({
const
res
=
await
fetch
({
url
:
getBaseUrl
(
'
/
account/login/web'
),
url
:
getBaseUrl
(
'account/login/web'
),
method
:
'get'
,
method
:
'get'
,
headers
:
{
token
:
state
.
token
}
headers
:
{
token
:
state
.
token
}
}).
catch
(()
=>
{
}).
catch
(()
=>
{
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录