|
@@ -456,7 +456,12 @@ import {
|
|
|
newPublicCourseAnswerApi,
|
|
newPublicCourseAnswerApi,
|
|
|
publicCourseAnswerStatusApi,
|
|
publicCourseAnswerStatusApi,
|
|
|
publicCourseAnswerClaimIntegralApi,
|
|
publicCourseAnswerClaimIntegralApi,
|
|
|
|
|
+ newGetInternetTrafficApi,
|
|
|
} from '@/api/course'
|
|
} from '@/api/course'
|
|
|
|
|
+import {
|
|
|
|
|
+ generateRandomString
|
|
|
|
|
+} from '@/utils/common.js';
|
|
|
|
|
+import dayjs from 'dayjs';
|
|
|
import commentList from "./components/commentList.vue";
|
|
import commentList from "./components/commentList.vue";
|
|
|
import newCommentList from "./components/newCommentList.vue";
|
|
import newCommentList from "./components/newCommentList.vue";
|
|
|
import hallItem from "./components/hallItem.vue";
|
|
import hallItem from "./components/hallItem.vue";
|
|
@@ -640,6 +645,8 @@ export default {
|
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
|
total: 0,
|
|
total: 0,
|
|
|
},
|
|
},
|
|
|
|
|
+ // 流量记录相关
|
|
|
|
|
+ lastInternetTrafficDuration: 0, // 上次触发时的播放时长
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
@@ -1603,6 +1610,9 @@ export default {
|
|
|
onTimeUpdate(data) {
|
|
onTimeUpdate(data) {
|
|
|
this.playDuration = Math.round(data.time)
|
|
this.playDuration = Math.round(data.time)
|
|
|
this.initStudyTime(this.playDuration)
|
|
this.initStudyTime(this.playDuration)
|
|
|
|
|
+ if (!this.$isLogin()) {
|
|
|
|
|
+ this.handleInternetTraffic(this.playDuration)
|
|
|
|
|
+ }
|
|
|
if (data.time >= this.pickCatalog.seconds) {
|
|
if (data.time >= this.pickCatalog.seconds) {
|
|
|
this.countdowning = false; //观看时长开关关闭
|
|
this.countdowning = false; //观看时长开关关闭
|
|
|
}
|
|
}
|
|
@@ -1625,6 +1635,31 @@ export default {
|
|
|
}
|
|
}
|
|
|
// uni.$u.throttle(this.checkTherapy, 1000,false);
|
|
// uni.$u.throttle(this.checkTherapy, 1000,false);
|
|
|
},
|
|
},
|
|
|
|
|
+ // 新版视频播放中-流量记录
|
|
|
|
|
+ handleInternetTraffic(duration) {
|
|
|
|
|
+ // 使用视频播放时长判断是否是6秒的倍数
|
|
|
|
|
+ let currentDuration = Number(Math.round(duration).toFixed(2));
|
|
|
|
|
+ // 当前视频的时长
|
|
|
|
|
+ let curVideoDuration = Number(Math.round(this.pickCatalog.seconds).toFixed(2));
|
|
|
|
|
+ let trafficUuId = generateRandomString(16)
|
|
|
|
|
+ // 判断是否是6秒的倍数,且只在进入新的6秒区间时触发一次
|
|
|
|
|
+ if (currentDuration > 0 && currentDuration % 6 === 0) {
|
|
|
|
|
+ // 检查是否已经在这个时间点触发过(防止拖动到6倍数位置时重复触发)
|
|
|
|
|
+ if (this.lastInternetTrafficDuration !== currentDuration) {
|
|
|
|
|
+ let params = {
|
|
|
|
|
+ appId: "wx40dcfa2797d6fc2d",
|
|
|
|
|
+ bufferRate: Math.ceil((currentDuration / curVideoDuration) * 100),
|
|
|
|
|
+ companyId: 101,
|
|
|
|
|
+ courseId: this.courseId,
|
|
|
|
|
+ duration: currentDuration,
|
|
|
|
|
+ uuId: dayjs().format('YYYYMMDD') + trafficUuId,
|
|
|
|
|
+ videoId: this.pickCatalog.videoId,
|
|
|
|
|
+ };
|
|
|
|
|
+ newGetInternetTrafficApi(params)
|
|
|
|
|
+ this.lastInternetTrafficDuration = currentDuration;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
// 展示疗法
|
|
// 展示疗法
|
|
|
checkTherapy() {
|
|
checkTherapy() {
|
|
|
let currentTime = Math.round(this.tempAudioDuration || 0)
|
|
let currentTime = Math.round(this.tempAudioDuration || 0)
|