|
@@ -52,7 +52,7 @@ import MDialog from '@/components/m-dialog';
|
|
|
import icon3 from './images/new/icon-3.png';
|
|
|
// import icon5 from './images/new/icon-7.png';
|
|
|
// import icon6 from './images/new/icon-6.png';
|
|
|
-import giftTip from './images/new/icon-4.png';
|
|
|
+import giftTip from './images/new/icon-9.png';
|
|
|
import iconGift from './images/new/icon-gift.png';
|
|
|
import icon10 from './images/new/icon-n-10.png';
|
|
|
import icon11 from './images/new/icon-n-11.png';
|
|
@@ -68,6 +68,7 @@ import MPopup from '@/components/m-popup';
|
|
|
import UserAuth from './component/user-auth';
|
|
|
import MMessageTip from '@/components/m-message-tip';
|
|
|
import SelectStudent from './modal/select-student';
|
|
|
+import { Timer } from './timer';
|
|
|
|
|
|
const classList: any = [];
|
|
|
for (let i = 1; i <= 40; i++) {
|
|
@@ -250,8 +251,11 @@ export default defineComponent({
|
|
|
});
|
|
|
|
|
|
// 播放视频总时长
|
|
|
- const videoIntervalRef = useInterval(1000, { controls: true });
|
|
|
+ const videoIntervalRef = useInterval(1000, {
|
|
|
+ controls: true
|
|
|
+ });
|
|
|
videoIntervalRef.pause();
|
|
|
+ const timer = new Timer();
|
|
|
|
|
|
// 页面定时
|
|
|
const pageTimer = useInterval(1000, { controls: true });
|
|
@@ -596,6 +600,7 @@ export default defineComponent({
|
|
|
*/
|
|
|
const onSubmit = async () => {
|
|
|
forms.submitLoading = true;
|
|
|
+ forms.intervalFnRef.pause();
|
|
|
try {
|
|
|
if (checkForm() || checkSubmit()) {
|
|
|
forms.submitLoading = false;
|
|
@@ -692,6 +697,7 @@ export default defineComponent({
|
|
|
changeTipStatus(forms.isRegister === 'create' ? false : true, false);
|
|
|
} finally {
|
|
|
forms.submitLoading = false;
|
|
|
+ forms.intervalFnRef.resume();
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -1197,6 +1203,12 @@ export default defineComponent({
|
|
|
(time / Math.floor(videoForms.player.duration())) * 100
|
|
|
);
|
|
|
|
|
|
+ console.log(
|
|
|
+ videoIntervalRef.counter.value,
|
|
|
+ timer.getTime(),
|
|
|
+ videoForms.player.currentTime(),
|
|
|
+ 'timer count'
|
|
|
+ );
|
|
|
const params = {
|
|
|
id: forms.saveId,
|
|
|
useTime: pageBrowseTime, // 固定5秒
|
|
@@ -1210,8 +1222,8 @@ export default defineComponent({
|
|
|
videoBrowseData: JSON.stringify(videoBrowseData), // 视屏播放数据
|
|
|
videoBrowseDataTime: time || 0, // 有效的视频观看时长
|
|
|
videoBrowsePercentage: rate || 0, // 有效的视频观看时长百分比
|
|
|
- videoBrowseTime: videoIntervalRef?.counter.value, // 视频观看时长
|
|
|
- videoBrowsePoint: Math.floor(videoForms.player.currentTime() || 0) // 视频最后观看点 - 向下取整
|
|
|
+ videoBrowseTime: timer.getTime(), // 视频观看时长
|
|
|
+ videoBrowsePoint: videoForms.player.currentTime() // 视频最后观看点 - 向下取整
|
|
|
};
|
|
|
}
|
|
|
|
|
@@ -1335,18 +1347,21 @@ export default defineComponent({
|
|
|
videoForms.player.on('seeking', () => {
|
|
|
console.log('seeking');
|
|
|
videoIntervalRef.isActive.value && videoIntervalRef.pause();
|
|
|
+ timer.pause();
|
|
|
});
|
|
|
|
|
|
// // 拖动结束时
|
|
|
videoForms.player.on('seeked', () => {
|
|
|
console.log('seeked');
|
|
|
videoIntervalRef.isActive.value && videoIntervalRef.pause();
|
|
|
+ timer.pause();
|
|
|
});
|
|
|
|
|
|
// 正在搜索中
|
|
|
videoForms.player.on('waiting', () => {
|
|
|
// console.log('waiting pause')
|
|
|
videoIntervalRef.isActive.value && videoIntervalRef.pause();
|
|
|
+ timer.pause();
|
|
|
});
|
|
|
|
|
|
// 如何视频在缓存不会触发
|
|
@@ -1361,6 +1376,7 @@ export default defineComponent({
|
|
|
) {
|
|
|
// console.log('timeupdate play')
|
|
|
videoIntervalRef.resume();
|
|
|
+ timer.resume();
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -1374,6 +1390,7 @@ export default defineComponent({
|
|
|
console.log('play');
|
|
|
// 判断视频计时器是否暂停,如果暂停则恢复
|
|
|
videoIntervalRef.resume();
|
|
|
+ timer.resume();
|
|
|
});
|
|
|
|
|
|
// 暂停播放
|
|
@@ -1381,6 +1398,7 @@ export default defineComponent({
|
|
|
console.log('pause', videoIntervalRef.isActive.value);
|
|
|
|
|
|
videoIntervalRef.pause();
|
|
|
+ timer.pause();
|
|
|
});
|
|
|
|
|
|
videoForms.player.on('fullscreenchange', () => {
|
|
@@ -1427,28 +1445,34 @@ export default defineComponent({
|
|
|
if (repeat) {
|
|
|
if (tempTime.length > 0) {
|
|
|
// console.log('join video', tempTime, 'initTime', initTime)
|
|
|
- tempTime[1] = Math.floor(videoForms.player.currentTime());
|
|
|
+ tempTime[1] =
|
|
|
+ Math.floor(videoForms.player.currentTime() * 1000) / 1000;
|
|
|
+ // tempTime[1] = videoForms.player.currentTime();
|
|
|
}
|
|
|
} else {
|
|
|
if (newVal) {
|
|
|
- console.log(
|
|
|
- videoForms.player.currentTime(),
|
|
|
- 'videoForms.player.currentTime()'
|
|
|
- );
|
|
|
- tempTime[0] = Math.floor(videoForms.player.currentTime());
|
|
|
+ // console.log(
|
|
|
+ // videoForms.player.currentTime(),
|
|
|
+ // 'videoForms.player.currentTime()'
|
|
|
+ // );
|
|
|
+ tempTime[0] =
|
|
|
+ Math.floor(videoForms.player.currentTime() * 1000) / 1000;
|
|
|
+ // tempTime[0] = videoForms.player.currentTime();
|
|
|
} else {
|
|
|
- tempTime[1] = Math.floor(videoForms.player.currentTime());
|
|
|
+ tempTime[1] =
|
|
|
+ Math.floor(videoForms.player.currentTime() * 1000) / 1000;
|
|
|
+ // tempTime[1] = videoForms.player.currentTime();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- console.log(
|
|
|
- newVal,
|
|
|
- repeat,
|
|
|
- tempTime,
|
|
|
- tempTime.length,
|
|
|
- 'videoIntervalRef.isActive.value in'
|
|
|
- );
|
|
|
- console.log(videoForms.player.playbackRate(), 'speed');
|
|
|
+ // console.log(
|
|
|
+ // newVal,
|
|
|
+ // repeat,
|
|
|
+ // tempTime,
|
|
|
+ // tempTime.length,
|
|
|
+ // 'videoIntervalRef.isActive.value in'
|
|
|
+ // );
|
|
|
+ // console.log(videoForms.player.playbackRate(), 'speed');
|
|
|
|
|
|
if (tempTime.length >= 2) {
|
|
|
// console.log(tempTime, 'tempTime', moreTime.value)
|
|
@@ -1507,14 +1531,17 @@ export default defineComponent({
|
|
|
// 间隔多少时间同步数据
|
|
|
forms.intervalFnRef = useIntervalFn(async () => {
|
|
|
// 页面时间恢复
|
|
|
+ forms.intervalFnRef.pause();
|
|
|
pageTimer.counter.value = 0;
|
|
|
pageTimer.resume();
|
|
|
// 同步数据时先进行有效时间进行保存
|
|
|
initVideoCount(false, true);
|
|
|
await updateStat();
|
|
|
|
|
|
+ timer.resetTime();
|
|
|
videoIntervalRef.counter.value = 0;
|
|
|
- }, 5000);
|
|
|
+ forms.intervalFnRef.resume();
|
|
|
+ }, 5020);
|
|
|
} catch {}
|
|
|
};
|
|
|
|