Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CFFP-HB
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chao Sun
CFFP-HB
Commits
6bf7235a
Commit
6bf7235a
authored
Dec 20, 2022
by
kyle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
播放轨迹
parent
f5908be6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
54 deletions
+52
-54
pages/courseDetail/courseDetail.vue
+51
-53
pages/exchangeRecord/exchangeRecord.vue
+1
-1
No files found.
pages/courseDetail/courseDetail.vue
View file @
6bf7235a
...
...
@@ -23,15 +23,14 @@
<view
class=
"courseBannerBox"
v-if=
"!sliceshare"
>
<video
v-if=
"isRenderVideo"
id=
"myVideo"
:src=
"courseInfo.filePathOss"
:initial-time=
"viewTime"
object-fit=
"contain"
class=
"videoBox"
:poster=
"courseInfo.fileFirstImage"
:title=
"courseInfo.fileTitle"
@
loadedmetadata=
"loadedmetadata"
@
play=
"playVideo"
@
pause=
"pause"
@
ended=
"ended"
@
timeupdate=
"timeupdate"
style=
"width: 100vw;height: 320rpx;"
></video>
:title=
"courseInfo.fileTitle"
@
play=
"playVideo"
@
pause=
"pause"
@
timeupdate=
"timeupdate"
style=
"width: 100vw;height: 320rpx;"
></video>
</view>
<!-- 课程详情图 -->
<view
class=
"courseTitleContent"
>
<view
class=
"courseTitle"
>
<view
class=
""
style=
"width: 70%;"
>
<h4>
{{
courseInfo
.
fileTitle
}}
{{
viewTime
}}
</h4>
<h4>
{{
courseInfo
.
fileTitle
}}
</h4>
</view>
<view
class=
"shareF"
>
<view
class=
"awakenApp"
@
click=
"jumpapp()"
v-if=
"coursesharing == 1"
>
...
...
@@ -140,7 +139,6 @@
},
data
()
{
return
{
isPauseFlag
:
true
,
isRenderVideo
:
false
,
fileId
:
null
,
lecturerId
:
null
,
...
...
@@ -172,6 +170,8 @@
shareCode
:
null
,
sharelogin
:
false
,
startTime
:
''
,
newCourseInfo
:{},
isPauseFlag
:
true
};
},
methods
:
{
...
...
@@ -387,41 +387,44 @@
}
else
{
this
.
videoContext
.
pause
();
if
(
this
.
fileId
!=
item
.
fileId
){
if
(
!
this
.
isPauseFlag
){
await
this
.
saveVideoPlayback
();
}
console
.
log
(
'保存之后执行这里'
)
// 当点击的课程和当前播放的课程不一致时,执行此方法
uni
.
showLoading
({
title
:
'加载中'
});
this
.
playbackId
=
null
;
this
.
fileId
=
item
.
fileId
;
this
.
courseInfo
.
packFileId
=
item
.
packFileId
;
this
.
courseDetail
()
this
.
newCourseInfo
=
{
fileId
:
item
.
fileId
,
packFileId
:
item
.
packFileId
,
}
if
(
this
.
isPauseFlag
){
this
.
pause
()
}
}
}
},
saveVideoPlayback
()
{
console
.
log
(
'saveVideoPlayback'
)
// 视频播放轨迹保存
const
param
=
{
id
:
this
.
playbackId
?
this
.
playbackId
:
null
,
systemType
:
1
,
userId
:
this
.
userId
,
fileId
:
this
.
fileId
,
packFileId
:
this
.
courseInfo
.
packFileId
,
totalTime
:
Math
.
floor
(
this
.
totalTime
),
viewTime
:
Math
.
floor
(
this
.
viewTime
),
playbackStatus
:
this
.
viewTime
>=
this
.
totalTime
?
'2'
:
'1'
}
return
new
Promise
((
resolve
,
reject
)
=>
{
// 视频播放轨迹保存
const
param
=
{
id
:
this
.
playbackId
?
this
.
playbackId
:
null
,
systemType
:
1
,
userId
:
this
.
userId
,
fileId
:
this
.
fileId
,
packFileId
:
this
.
courseInfo
.
packFileId
,
totalTime
:
Math
.
floor
(
this
.
totalTime
),
viewTime
:
Math
.
floor
(
this
.
viewTime
),
playbackStatus
:
this
.
viewTime
>=
this
.
totalTime
?
'2'
:
'1'
}
api
.
saveVideoPlayback
(
param
).
then
(
res
=>
{
api
.
saveVideoPlayback
(
param
).
then
(
res
=>
{
if
(
res
[
'success'
])
{
this
.
playbackId
=
res
[
'data'
][
'id'
];
console
.
log
(
'执行了保存成功,入参======='
,
param
)
resolve
();
console
.
log
(
'save已经执行完毕'
);
resolve
(
'success'
);
}
else
{
reject
(
'fail'
)
}
}).
catch
((
err
)
=>
{
reject
(
'fail'
)
})
})
...
...
@@ -439,26 +442,27 @@
if
(
res
[
'success'
])
{
this
.
videoPlaybackInfo
=
res
[
'data'
];
console
.
log
(
'查询视频播放轨迹结果====='
,
this
.
videoPlaybackInfo
)
if
(
this
.
videoPlaybackInfo
.
viewTime
<
this
.
videoPlaybackInfo
.
totalTime
){
this
.
viewTime
=
this
.
videoPlaybackInfo
.
viewTime
;
this
.
totalTime
=
this
.
videoPlaybackInfo
.
totalTime
;
}
else
{
this
.
totalTime
=
this
.
viewTime
=
0
;
}
this
.
viewTime
=
this
.
videoPlaybackInfo
.
viewTime
this
.
viewTime
=
this
.
videoPlaybackInfo
.
viewTime
?
this
.
videoPlaybackInfo
.
viewTime
:
0
;
this
.
totalTime
=
this
.
videoPlaybackInfo
.
totalTime
?
this
.
videoPlaybackInfo
.
totalTime
:
0
;
this
.
packFileId
=
this
.
videoPlaybackInfo
.
id
?
this
.
videoPlaybackInfo
.
id
:
null
;
this
.
isRenderVideo
=
true
;
// 跳转到指定位置
this
.
videoContext
.
seek
(
this
.
viewTime
);
uni
.
hideLoading
();
}
else
{
this
.
isRenderVideo
=
true
;
this
.
totalTime
=
this
.
viewTime
=
0
;
// 跳转到指定位置
this
.
videoContext
.
seek
(
thie
.
viewTime
);
uni
.
hideLoading
();
}
// 跳转到指定位置
this
.
videoContext
.
seek
(
this
.
viewTime
);
uni
.
hideLoading
();
})
},
// 点击播放
playVideo
(
e
)
{
console
.
log
(
'playVideo'
)
console
.
log
(
'playVideo'
,
this
.
totalTime
,
this
.
viewTime
)
this
.
isPauseFlag
=
false
;
console
.
log
(
this
.
viewTime
,
this
.
totalTime
)
if
(
this
.
viewTime
>=
this
.
totalTime
){
this
.
viewTime
=
0
;
this
.
videoContext
.
seek
(
this
.
viewTime
);
...
...
@@ -473,27 +477,21 @@
},
20
*
1000
)
}
},
pause
(
e
)
{
// // 暂停播放
async
pause
()
{
console
.
log
(
'pause'
)
this
.
isPauseFlag
=
true
;
// 暂停播放
if
(
this
.
timer
)
{
clearInterval
(
this
.
timer
)
}
if
(
this
.
viewTime
>=
this
.
totalTime
)
{
// 当播放完成的时候这里不触发
return
;
}
else
{
this
.
saveVideoPlayback
();
}
},
ended
(
e
)
{
console
.
log
(
'ended'
)
// 播放到末尾
if
(
this
.
timer
)
{
clearInterval
(
this
.
timer
)
const
result
=
await
this
.
saveVideoPlayback
()
if
(
result
==
'success'
&&
this
.
newCourseInfo
.
fileId
){
console
.
log
(
'新的课程要进行赋值查询了'
)
this
.
fileId
=
this
.
newCourseInfo
.
fileId
;
this
.
courseInfo
.
packFileId
=
this
.
newCourseInfo
.
packFileId
;
this
.
playbackId
=
null
;
this
.
courseDetail
();
}
this
.
saveVideoPlayback
();
},
timeupdate
(
e
)
{
this
.
totalTime
=
e
.
detail
.
duration
;
...
...
@@ -576,11 +574,11 @@
this
.
switchTab
(
1
);
this
.
loginType
=
uni
.
getStorageSync
(
'loginType'
)
},
onReady
()
{
this
.
videoContext
=
uni
.
createVideoContext
(
'myVideo'
);
},
onUnload
()
{
this
.
videoContext
.
pause
();
this
.
saveVideoPlayback
();
if
(
this
.
timer
)
{
clearInterval
(
this
.
timer
)
...
...
pages/exchangeRecord/exchangeRecord.vue
View file @
6bf7235a
...
...
@@ -15,7 +15,7 @@
</view>
</view>
</view>
<view
style=
"text-align: center;color: #cacaca;"
v-if=
"!cffpFortuneDeductionList
"
>
暂无数据!
</view>
<view
class=
"noListTip"
v-if=
"!cffpFortuneDeductionList || cffpFortuneDeductionList.length
<
=
0
"
>
暂无数据!
</view>
</view>
</
template
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment