|
@@ -291,7 +291,7 @@
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
<!-- h5下载 -->
|
|
<!-- h5下载 -->
|
|
|
- <!-- <h5-down-app-tip :pageUrl="pageUrl" :type="'course'" :courseId="courseId" /> -->
|
|
|
|
|
|
|
+ <h5-down-app-tip :pageUrl="pageUrl" :type="'course'" :courseId="courseId" />
|
|
|
|
|
|
|
|
<!-- 分享弹窗 -->
|
|
<!-- 分享弹窗 -->
|
|
|
<u-popup :show="showShare" @close="closeShareAct()">
|
|
<u-popup :show="showShare" @close="closeShareAct()">
|
|
@@ -411,16 +411,18 @@
|
|
|
</popupBottom>
|
|
</popupBottom>
|
|
|
|
|
|
|
|
<!-- 右侧悬浮框 -->
|
|
<!-- 右侧悬浮框 -->
|
|
|
- <answerFloatBox :typeNum="4" :remainSeconds="pageEntryRequiredTime" @handleShowAnswer="handleAnswerMethods"
|
|
|
|
|
- @showTomorrowTipMethods="handleTomorrowTipMethods" />
|
|
|
|
|
|
|
+ <answerFloatBox v-if="pickCatalog && pickCatalog.videoId && isShowPageEntryTimer"
|
|
|
|
|
+ :typeNum="isShowPageEntryTimer" :pointsNum="answerPointsNum" :remainSeconds="pageEntryRequiredTime"
|
|
|
|
|
+ @handleShowAnswer="handleAnswerMethods" @showTomorrowTipMethods="handleTomorrowTipMethods" />
|
|
|
|
|
|
|
|
<!-- 答题弹窗 -->
|
|
<!-- 答题弹窗 -->
|
|
|
- <questionsPopup :isShow="isShowQuestions" :typeStatus="1" @closeMethod="questionsCloseMethod"
|
|
|
|
|
|
|
+ <questionsPopup v-if="pickCatalog && pickCatalog.videoId && isShowPageEntryTimer" :isShow="isShowQuestions"
|
|
|
|
|
+ :remainSeconds="pageEntryRequiredTime" :videoId="pickCatalog.videoId" @closeMethod="questionsCloseMethod"
|
|
|
@submitAnswer="handleSubmitAnswer" />
|
|
@submitAnswer="handleSubmitAnswer" />
|
|
|
|
|
|
|
|
<!-- 答题提示框和明日再来提示框 -->
|
|
<!-- 答题提示框和明日再来提示框 -->
|
|
|
- <answerPromptPopup :isShow="isShowAnswerPrompt" :typeStatus="answerPromptType"
|
|
|
|
|
- @closeMethod="isShowAnswerPrompt = false" />
|
|
|
|
|
|
|
+ <answerPromptPopup v-if="pickCatalog && pickCatalog.videoId" :pointsNum="answerPointsNum"
|
|
|
|
|
+ :isShow="isShowAnswerPrompt" :typeStatus="answerPromptType" @closeMethod="isShowAnswerPrompt = false" />
|
|
|
</view>
|
|
</view>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -449,7 +451,10 @@ import {
|
|
|
getComments,
|
|
getComments,
|
|
|
saveMsg,
|
|
saveMsg,
|
|
|
getNewCommentListApi,
|
|
getNewCommentListApi,
|
|
|
- addNewCommentApi
|
|
|
|
|
|
|
+ addNewCommentApi,
|
|
|
|
|
+ newPublicCourseAnswerApi,
|
|
|
|
|
+ publicCourseAnswerStatusApi,
|
|
|
|
|
+ publicCourseAnswerClaimIntegralApi,
|
|
|
} from '@/api/course'
|
|
} from '@/api/course'
|
|
|
import commentList from "./components/commentList.vue";
|
|
import commentList from "./components/commentList.vue";
|
|
|
import newCommentList from "./components/newCommentList.vue";
|
|
import newCommentList from "./components/newCommentList.vue";
|
|
@@ -484,11 +489,12 @@ export default {
|
|
|
textHeight: 0, //文本高度
|
|
textHeight: 0, //文本高度
|
|
|
courseId: null,
|
|
courseId: null,
|
|
|
isShare: false,
|
|
isShare: false,
|
|
|
- videoId: null,//当前视频(小节)章节ID
|
|
|
|
|
|
|
+ videoId: null,//当前视频(小节)章节ID(旧的,页面进入时带入的,后面没有更新,需要的话用pickCatalog.videoId来判断)
|
|
|
isLearning: false,
|
|
isLearning: false,
|
|
|
isShowQuestions: false,
|
|
isShowQuestions: false,
|
|
|
isShowAnswerPrompt: false,
|
|
isShowAnswerPrompt: false,
|
|
|
answerPromptType: 1,
|
|
answerPromptType: 1,
|
|
|
|
|
+ answerPointsNum: 0, // 答题获得的积分
|
|
|
inputComment: '',
|
|
inputComment: '',
|
|
|
newCommentArrList: [],
|
|
newCommentArrList: [],
|
|
|
data: {
|
|
data: {
|
|
@@ -620,7 +626,7 @@ export default {
|
|
|
// 页面一进入-答题奖励相关
|
|
// 页面一进入-答题奖励相关
|
|
|
pageEntryTimer: null, // 页面一进入-答题奖励计时器
|
|
pageEntryTimer: null, // 页面一进入-答题奖励计时器
|
|
|
pageEntryRequiredTime: 0, // 页面一进入-答题奖励当前小节后台设定的奖励时间(秒)(倒计时总时长)
|
|
pageEntryRequiredTime: 0, // 页面一进入-答题奖励当前小节后台设定的奖励时间(秒)(倒计时总时长)
|
|
|
- hasGotPageEntryReward: false, // 页面一进入-答题奖励当前小节是否已领取奖励
|
|
|
|
|
|
|
+ hasGotPageEntryReward: 0, // 页面一进入-答题奖励当前小节是否已领取奖励-答题状态:1未答题 2可以答题 3达到上限 4已完成;-1学习缺失 -2无看课 -3未完课
|
|
|
isSocketOpen: false,
|
|
isSocketOpen: false,
|
|
|
isSend: true,
|
|
isSend: true,
|
|
|
reOpenSocket: false,
|
|
reOpenSocket: false,
|
|
@@ -635,6 +641,28 @@ export default {
|
|
|
},
|
|
},
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ computed: {
|
|
|
|
|
+ isShowPageEntryTimer() {
|
|
|
|
|
+ let newData = 0
|
|
|
|
|
+ if (this.hasGotPageEntryReward == 1) {
|
|
|
|
|
+ // 未答题
|
|
|
|
|
+ newData = 4
|
|
|
|
|
+ }
|
|
|
|
|
+ if (this.hasGotPageEntryReward == 2) {
|
|
|
|
|
+ // 答错了但未达上限- 可以答题
|
|
|
|
|
+ newData = 3
|
|
|
|
|
+ }
|
|
|
|
|
+ if (this.hasGotPageEntryReward == 3) {
|
|
|
|
|
+ // 答错了且达上限- 达到上限
|
|
|
|
|
+ newData = 2
|
|
|
|
|
+ }
|
|
|
|
|
+ if (this.hasGotPageEntryReward == 4) {
|
|
|
|
|
+ // 答对了获得积分- 已完成
|
|
|
|
|
+ newData = 1
|
|
|
|
|
+ }
|
|
|
|
|
+ return newData
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
onLoad(options) {
|
|
onLoad(options) {
|
|
|
this.courseId = options.courseId;
|
|
this.courseId = options.courseId;
|
|
|
this.isShare = options.isShare || false
|
|
this.isShare = options.isShare || false
|
|
@@ -772,15 +800,35 @@ export default {
|
|
|
this.isShowQuestions = false
|
|
this.isShowQuestions = false
|
|
|
},
|
|
},
|
|
|
// 点击提交答案后
|
|
// 点击提交答案后
|
|
|
- handleSubmitAnswer() {
|
|
|
|
|
- if (true) {
|
|
|
|
|
- // 答对
|
|
|
|
|
- this.answerPromptType = 1
|
|
|
|
|
- } else {
|
|
|
|
|
- // 答错
|
|
|
|
|
- this.answerPromptType = 2
|
|
|
|
|
|
|
+ handleSubmitAnswer(quesList) {
|
|
|
|
|
+ let newData = quesList.map(item => ({ ...item, question: JSON.stringify(item.question) }));
|
|
|
|
|
+ let param = {
|
|
|
|
|
+ questions: newData,
|
|
|
|
|
+ videoId: this.pickCatalog.videoId,
|
|
|
|
|
+ courseId: this.courseId
|
|
|
}
|
|
}
|
|
|
- this.isShowAnswerPrompt = true
|
|
|
|
|
|
|
+ newPublicCourseAnswerApi(param).then(res => {
|
|
|
|
|
+ this.questionsCloseMethod()
|
|
|
|
|
+ if (res.code == 200) {
|
|
|
|
|
+ if (res.msg == "答题成功") {
|
|
|
|
|
+ // 答对
|
|
|
|
|
+ this.answerPromptType = 1
|
|
|
|
|
+ this.handleClaimIntegralMethods()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 答错
|
|
|
|
|
+ this.answerPromptType = 2
|
|
|
|
|
+ }
|
|
|
|
|
+ this.checkPageEntryStatus();
|
|
|
|
|
+ this.isShowAnswerPrompt = true
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ // 答题成功后领取本节答题积分
|
|
|
|
|
+ handleClaimIntegralMethods() {
|
|
|
|
|
+ publicCourseAnswerClaimIntegralApi({
|
|
|
|
|
+ videoId: this.pickCatalog.videoId,
|
|
|
|
|
+ })
|
|
|
},
|
|
},
|
|
|
// 点击提示明日再来
|
|
// 点击提示明日再来
|
|
|
handleTomorrowTipMethods() {
|
|
handleTomorrowTipMethods() {
|
|
@@ -837,92 +885,42 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
// 检查章节奖励领取状态
|
|
// 检查章节奖励领取状态
|
|
|
- checkPageEntryStatus(videoId) {
|
|
|
|
|
|
|
+ checkPageEntryStatus() {
|
|
|
|
|
+ this.hasGotPageEntryReward = 0;
|
|
|
// 检查该章节是否已领取章节奖励
|
|
// 检查该章节是否已领取章节奖励
|
|
|
- this.hasGotPageEntryReward = false;
|
|
|
|
|
- // 启动答题奖励计时器(需要先获取当前章节ID)
|
|
|
|
|
- console.log('欧克111',this.pageEntryRequiredTime)
|
|
|
|
|
- if (videoId && !this.hasGotPageEntryReward) {
|
|
|
|
|
- this.startPageEntryTimer();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ publicCourseAnswerStatusApi({
|
|
|
|
|
+ videoId: this.pickCatalog.videoId,
|
|
|
|
|
+ courseId: this.courseId
|
|
|
|
|
+ }).then(res => {
|
|
|
|
|
+ if (res.code == 200) {
|
|
|
|
|
+ this.hasGotPageEntryReward = Number(res.data.status);
|
|
|
|
|
+
|
|
|
|
|
+ // 启动答题奖励计时器(需要先获取当前章节ID)
|
|
|
|
|
+ if (this.pickCatalog.videoId && (this.hasGotPageEntryReward == 1 || this.hasGotPageEntryReward == 2)) {
|
|
|
|
|
+ this.startPageEntryTimer();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
},
|
|
},
|
|
|
// 启动章节奖励计时器
|
|
// 启动章节奖励计时器
|
|
|
startPageEntryTimer() {
|
|
startPageEntryTimer() {
|
|
|
- // 如果已领取章节奖励,不再计时
|
|
|
|
|
- if (this.hasGotPageEntryReward) {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
// 启动前或切换章节都先重置计时
|
|
// 启动前或切换章节都先重置计时
|
|
|
- this.resetPageEntryTimer();
|
|
|
|
|
-
|
|
|
|
|
- // 如果章节奖励计时器已在运行,不再重复启动
|
|
|
|
|
- if (this.pageEntryTimer) {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- console.log('欧克',this.pageEntryRequiredTime)
|
|
|
|
|
|
|
+ this.stopPageEntryTimer();
|
|
|
// 每秒计时
|
|
// 每秒计时
|
|
|
this.pageEntryTimer = setInterval(() => {
|
|
this.pageEntryTimer = setInterval(() => {
|
|
|
this.pageEntryRequiredTime--;
|
|
this.pageEntryRequiredTime--;
|
|
|
- console.log(`当前章节奖励剩余计时: ${this.pageEntryRequiredTime}秒`);
|
|
|
|
|
-
|
|
|
|
|
- // 检查是否满足章节奖励条件
|
|
|
|
|
- this.checkPageEntryCondition();
|
|
|
|
|
|
|
+ if (this.pageEntryRequiredTime <= 0) {
|
|
|
|
|
+ this.stopPageEntryTimer();
|
|
|
|
|
+ }
|
|
|
}, 1000);
|
|
}, 1000);
|
|
|
},
|
|
},
|
|
|
- // 检查章节奖励条件
|
|
|
|
|
- checkPageEntryCondition() {
|
|
|
|
|
- if (this.hasGotPageEntryReward) {
|
|
|
|
|
- this.stopPageEntryTimer();
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (this.pageEntryRequiredTime <= 0) {
|
|
|
|
|
- // 满足条件,领取章节奖励
|
|
|
|
|
- this.getPageEntryReward();
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- // 领取章节奖励
|
|
|
|
|
- async getPageEntryReward() {
|
|
|
|
|
- if (this.hasGotPageEntryReward) {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // TODO: 调用后台领取章节奖励接口
|
|
|
|
|
- try {
|
|
|
|
|
- // const res = await getPageEntryApi({ videoId: this.videoId });
|
|
|
|
|
- // if (res.code === 200) {
|
|
|
|
|
- this.hasGotPageEntryReward = true;
|
|
|
|
|
- this.stopPageEntryTimer();
|
|
|
|
|
- uni.showToast({
|
|
|
|
|
- title: '恭喜获得章节奖励!',
|
|
|
|
|
- icon: 'success'
|
|
|
|
|
- });
|
|
|
|
|
- // } else {
|
|
|
|
|
- // uni.showToast({
|
|
|
|
|
- // title: res.msg || '领取失败',
|
|
|
|
|
- // icon: 'none'
|
|
|
|
|
- // });
|
|
|
|
|
- // }
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- uni.showToast({
|
|
|
|
|
- title: '领取失败',
|
|
|
|
|
- icon: 'none'
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- // 停止章节奖励计时器
|
|
|
|
|
|
|
+ // 重置-停止-清除章节奖励计时器
|
|
|
stopPageEntryTimer() {
|
|
stopPageEntryTimer() {
|
|
|
if (this.pageEntryTimer) {
|
|
if (this.pageEntryTimer) {
|
|
|
clearInterval(this.pageEntryTimer);
|
|
clearInterval(this.pageEntryTimer);
|
|
|
this.pageEntryTimer = null;
|
|
this.pageEntryTimer = null;
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- // 重置章节奖励计时
|
|
|
|
|
- resetPageEntryTimer() {
|
|
|
|
|
- this.stopPageEntryTimer();
|
|
|
|
|
- this.hasGotPageEntryReward = false;
|
|
|
|
|
- },
|
|
|
|
|
|
|
|
|
|
getCourseInfo() {
|
|
getCourseInfo() {
|
|
|
this.showDes = false
|
|
this.showDes = false
|
|
@@ -979,6 +977,9 @@ export default {
|
|
|
//开始播放计时
|
|
//开始播放计时
|
|
|
if (this.data.isAutoPlay == 1) {
|
|
if (this.data.isAutoPlay == 1) {
|
|
|
this.pickCatalogMethod(this.pickCatalogIdx);
|
|
this.pickCatalogMethod(this.pickCatalogIdx);
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ this.addStudyCourse();
|
|
|
|
|
+ }, 1000);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -1432,13 +1433,13 @@ 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.answerPointsNum = this.pickCatalog.integralReward;
|
|
|
|
|
+ // 获取章节看视频答题奖励所需时间
|
|
|
|
|
+ this.pageEntryRequiredTime = Number(this.pickCatalog.watchDurationMinutes) * 60;
|
|
|
|
|
+ // 检查该章节是否已领取章节奖励-获取答题状态
|
|
|
|
|
+ this.checkPageEntryStatus();
|
|
|
|
|
|
|
|
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
|