|
@@ -411,7 +411,7 @@
|
|
|
</popupBottom>
|
|
</popupBottom>
|
|
|
|
|
|
|
|
<!-- 右侧悬浮框 -->
|
|
<!-- 右侧悬浮框 -->
|
|
|
- <answerFloatBox :typeNum="4" @handleShowAnswer="handleAnswerMethods"
|
|
|
|
|
|
|
+ <answerFloatBox :typeNum="4" :remainSeconds="pageEntryRequiredTime" @handleShowAnswer="handleAnswerMethods"
|
|
|
@showTomorrowTipMethods="handleTomorrowTipMethods" />
|
|
@showTomorrowTipMethods="handleTomorrowTipMethods" />
|
|
|
|
|
|
|
|
<!-- 答题弹窗 -->
|
|
<!-- 答题弹窗 -->
|
|
@@ -619,8 +619,7 @@ export default {
|
|
|
socket: null,
|
|
socket: null,
|
|
|
// 页面一进入-答题奖励相关
|
|
// 页面一进入-答题奖励相关
|
|
|
pageEntryTimer: null, // 页面一进入-答题奖励计时器
|
|
pageEntryTimer: null, // 页面一进入-答题奖励计时器
|
|
|
- pageEntryDuration: 0, // 页面一进入-答题奖励当前累计计时(秒)
|
|
|
|
|
- pageEntryRequiredTime: 0, // 页面一进入-答题奖励当前小节后台设定的奖励时间(秒)
|
|
|
|
|
|
|
+ pageEntryRequiredTime: 0, // 页面一进入-答题奖励当前小节后台设定的奖励时间(秒)(倒计时总时长)
|
|
|
hasGotPageEntryReward: false, // 页面一进入-答题奖励当前小节是否已领取奖励
|
|
hasGotPageEntryReward: false, // 页面一进入-答题奖励当前小节是否已领取奖励
|
|
|
isSocketOpen: false,
|
|
isSocketOpen: false,
|
|
|
isSend: true,
|
|
isSend: true,
|
|
@@ -666,11 +665,6 @@ export default {
|
|
|
this.checkFavorite();
|
|
this.checkFavorite();
|
|
|
this.getNewCommentArrList();
|
|
this.getNewCommentArrList();
|
|
|
this.checkLike();
|
|
this.checkLike();
|
|
|
-
|
|
|
|
|
- // 一进入页面显示时启动答题奖励计时器(需要先获取当前章节ID)
|
|
|
|
|
- if (this.pickCatalog.videoId) {
|
|
|
|
|
- this.startPageEntryTimer(this.pickCatalog.videoId);
|
|
|
|
|
- }
|
|
|
|
|
// #ifndef H5
|
|
// #ifndef H5
|
|
|
uni.onKeyboardHeightChange(this.keyboardHeightChange);
|
|
uni.onKeyboardHeightChange(this.keyboardHeightChange);
|
|
|
// #endif
|
|
// #endif
|
|
@@ -842,52 +836,40 @@ export default {
|
|
|
this.allLookTimer = null;
|
|
this.allLookTimer = null;
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ // 检查章节奖励领取状态
|
|
|
|
|
+ checkPageEntryStatus(videoId) {
|
|
|
|
|
+ // 检查该章节是否已领取章节奖励
|
|
|
|
|
+ this.hasGotPageEntryReward = false;
|
|
|
|
|
+ // 启动答题奖励计时器(需要先获取当前章节ID)
|
|
|
|
|
+ console.log('欧克111',this.pageEntryRequiredTime)
|
|
|
|
|
+ if (videoId && !this.hasGotPageEntryReward) {
|
|
|
|
|
+ this.startPageEntryTimer();
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
// 启动章节奖励计时器
|
|
// 启动章节奖励计时器
|
|
|
- startPageEntryTimer(videoId) {
|
|
|
|
|
|
|
+ startPageEntryTimer() {
|
|
|
// 如果已领取章节奖励,不再计时
|
|
// 如果已领取章节奖励,不再计时
|
|
|
if (this.hasGotPageEntryReward) {
|
|
if (this.hasGotPageEntryReward) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 如果切换了章节,重置计时
|
|
|
|
|
- if (this.videoId !== videoId) {
|
|
|
|
|
- this.resetPageEntryTimer();
|
|
|
|
|
- this.videoId = videoId;
|
|
|
|
|
- // 获取该章节的奖励时间(假设后台接口返回)
|
|
|
|
|
- this.getPageEntryRequiredTime(videoId);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 启动前或切换章节都先重置计时
|
|
|
|
|
+ this.resetPageEntryTimer();
|
|
|
|
|
|
|
|
// 如果章节奖励计时器已在运行,不再重复启动
|
|
// 如果章节奖励计时器已在运行,不再重复启动
|
|
|
if (this.pageEntryTimer) {
|
|
if (this.pageEntryTimer) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ console.log('欧克',this.pageEntryRequiredTime)
|
|
|
// 每秒计时
|
|
// 每秒计时
|
|
|
this.pageEntryTimer = setInterval(() => {
|
|
this.pageEntryTimer = setInterval(() => {
|
|
|
- this.pageEntryDuration++;
|
|
|
|
|
- console.log(`当前章节奖励计时: ${this.pageEntryDuration}秒,目标: ${this.pageEntryRequiredTime}秒`);
|
|
|
|
|
|
|
+ this.pageEntryRequiredTime--;
|
|
|
|
|
+ console.log(`当前章节奖励剩余计时: ${this.pageEntryRequiredTime}秒`);
|
|
|
|
|
|
|
|
// 检查是否满足章节奖励条件
|
|
// 检查是否满足章节奖励条件
|
|
|
this.checkPageEntryCondition();
|
|
this.checkPageEntryCondition();
|
|
|
}, 1000);
|
|
}, 1000);
|
|
|
},
|
|
},
|
|
|
- // 获取章节奖励所需时间(模拟后台接口)
|
|
|
|
|
- getPageEntryRequiredTime(videoId) {
|
|
|
|
|
- // TODO: 调用后台接口获取该章节的章节奖励时间(单位:分钟)
|
|
|
|
|
- // 这里先模拟一个默认值,实际应该从接口获取
|
|
|
|
|
- // 假设后台返回的是分钟,转换为秒
|
|
|
|
|
- const requiredMinutes = 5; // 示例:5分钟
|
|
|
|
|
- this.pageEntryRequiredTime = requiredMinutes * 60;
|
|
|
|
|
-
|
|
|
|
|
- // 同时检查该章节是否已领取章节奖励
|
|
|
|
|
- this.checkPageEntryStatus(videoId);
|
|
|
|
|
- },
|
|
|
|
|
- // 检查章节奖励领取状态
|
|
|
|
|
- checkPageEntryStatus(videoId) {
|
|
|
|
|
- // TODO: 调用后台接口检查该章节是否已领取章节奖励
|
|
|
|
|
- // 这里先模拟未领取状态
|
|
|
|
|
- this.hasGotPageEntryReward = false;
|
|
|
|
|
- },
|
|
|
|
|
// 检查章节奖励条件
|
|
// 检查章节奖励条件
|
|
|
checkPageEntryCondition() {
|
|
checkPageEntryCondition() {
|
|
|
if (this.hasGotPageEntryReward) {
|
|
if (this.hasGotPageEntryReward) {
|
|
@@ -895,7 +877,7 @@ export default {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (this.pageEntryDuration >= this.pageEntryRequiredTime) {
|
|
|
|
|
|
|
+ if (this.pageEntryRequiredTime <= 0) {
|
|
|
// 满足条件,领取章节奖励
|
|
// 满足条件,领取章节奖励
|
|
|
this.getPageEntryReward();
|
|
this.getPageEntryReward();
|
|
|
}
|
|
}
|
|
@@ -913,7 +895,7 @@ export default {
|
|
|
this.hasGotPageEntryReward = true;
|
|
this.hasGotPageEntryReward = true;
|
|
|
this.stopPageEntryTimer();
|
|
this.stopPageEntryTimer();
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
|
- title: '恭喜获得章节奖励!',
|
|
|
|
|
|
|
+ title: '恭喜获得章节奖励!',
|
|
|
icon: 'success'
|
|
icon: 'success'
|
|
|
});
|
|
});
|
|
|
// } else {
|
|
// } else {
|
|
@@ -939,9 +921,9 @@ export default {
|
|
|
// 重置章节奖励计时
|
|
// 重置章节奖励计时
|
|
|
resetPageEntryTimer() {
|
|
resetPageEntryTimer() {
|
|
|
this.stopPageEntryTimer();
|
|
this.stopPageEntryTimer();
|
|
|
- this.pageEntryDuration = 0;
|
|
|
|
|
this.hasGotPageEntryReward = false;
|
|
this.hasGotPageEntryReward = false;
|
|
|
},
|
|
},
|
|
|
|
|
+
|
|
|
getCourseInfo() {
|
|
getCourseInfo() {
|
|
|
this.showDes = false
|
|
this.showDes = false
|
|
|
getCourseById(this.courseId).then(res => {
|
|
getCourseById(this.courseId).then(res => {
|
|
@@ -1450,6 +1432,14 @@ export default {
|
|
|
type: type
|
|
type: type
|
|
|
});
|
|
});
|
|
|
this.pickCatalog = this.catalogueList[index];
|
|
this.pickCatalog = this.catalogueList[index];
|
|
|
|
|
+ console.log(6666, this.pickCatalog)
|
|
|
|
|
+ // 获取章节奖励所需时间
|
|
|
|
|
+ // this.pageEntryRequiredTime = Number(this.pickCatalog.watchDurationMinutes) * 60;
|
|
|
|
|
+ this.pageEntryRequiredTime = Number(0.5) * 60;
|
|
|
|
|
+ console.log(`倒计时目标: ${this.pageEntryRequiredTime}秒`)
|
|
|
|
|
+ // 同时检查该章节是否已领取章节奖励
|
|
|
|
|
+ this.checkPageEntryStatus(this.pickCatalog.videoId);
|
|
|
|
|
+
|
|
|
this.pickCatalog.isFast = this.data.isFast
|
|
this.pickCatalog.isFast = this.data.isFast
|
|
|
this.packageJsonList = this.pickCatalog && this.pickCatalog.packageJson ? JSON.parse(this.pickCatalog
|
|
this.packageJsonList = this.pickCatalog && this.pickCatalog.packageJson ? JSON.parse(this.pickCatalog
|
|
|
.packageJson) : []
|
|
.packageJson) : []
|