|
@@ -219,7 +219,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
-import { getCourseDetail, addStudyCourse as addStudyCourseApi, getCourseVideoList,addCommentt, getCommentList,videoDetails } from '@/api/class.js'
|
|
|
|
|
|
|
+import { getCourseDetail, addStudyCourse as addStudyCourseApi, getCourseVideoList,addCommentt, getCommentList,videoDetails ,courseAnswer,courseAnswerStatus,getIntegral} from '@/api/class.js'
|
|
|
export default {
|
|
export default {
|
|
|
computed: {
|
|
computed: {
|
|
|
poster() {
|
|
poster() {
|
|
@@ -297,7 +297,7 @@ export default {
|
|
|
maxAttempts: 3,
|
|
maxAttempts: 3,
|
|
|
attemptsLeft: 3,
|
|
attemptsLeft: 3,
|
|
|
correctAnswer: "C",
|
|
correctAnswer: "C",
|
|
|
- awardScore: 20,
|
|
|
|
|
|
|
+ awardScore:0,
|
|
|
hasAward: false,
|
|
hasAward: false,
|
|
|
answerQuestion: [],
|
|
answerQuestion: [],
|
|
|
courseInfo: {
|
|
courseInfo: {
|
|
@@ -519,6 +519,7 @@ export default {
|
|
|
if (resumeInfo && resumeInfo.item) {
|
|
if (resumeInfo && resumeInfo.item) {
|
|
|
item = resumeInfo.item;
|
|
item = resumeInfo.item;
|
|
|
this.activeIndex = item.videoId;
|
|
this.activeIndex = item.videoId;
|
|
|
|
|
+ this.awardScore = item.integralReward;
|
|
|
this.playTime = resumeInfo.seekTime;
|
|
this.playTime = resumeInfo.seekTime;
|
|
|
this.pendingSeekTime = resumeInfo.seekTime;
|
|
this.pendingSeekTime = resumeInfo.seekTime;
|
|
|
this.hasAppliedInitialStudyLog = true;
|
|
this.hasAppliedInitialStudyLog = true;
|
|
@@ -904,29 +905,61 @@ export default {
|
|
|
this.selectedAnswer = value;
|
|
this.selectedAnswer = value;
|
|
|
},
|
|
},
|
|
|
submitAnswer() {
|
|
submitAnswer() {
|
|
|
- if (!this.answerQuestion.options || this.answerQuestion.options.length === 0) {
|
|
|
|
|
- uni.showToast({
|
|
|
|
|
- title: "当前课时暂无题目",
|
|
|
|
|
- icon: "none"
|
|
|
|
|
- });
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // if (!this.answerQuestion.options || this.answerQuestion.options.length == 0) {
|
|
|
|
|
+ // uni.showToast({
|
|
|
|
|
+ // title: "当前课时暂无题目",
|
|
|
|
|
+ // icon: "none"
|
|
|
|
|
+ // });
|
|
|
|
|
+ // return;
|
|
|
|
|
+ // }
|
|
|
if (!this.canAnswer || !this.selectedAnswer) {
|
|
if (!this.canAnswer || !this.selectedAnswer) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
this.attemptsLeft -= 1;
|
|
this.attemptsLeft -= 1;
|
|
|
this.showAnswerPopup = false;
|
|
this.showAnswerPopup = false;
|
|
|
- // 无标准答案时(例如满意度问卷)默认按成功处理
|
|
|
|
|
- if (!this.correctAnswer || this.selectedAnswer === this.correctAnswer) {
|
|
|
|
|
- this.answerResultType = "success";
|
|
|
|
|
- this.hasAward = true;
|
|
|
|
|
- } else if (this.attemptsLeft <= 0) {
|
|
|
|
|
- this.answerResultType = "exhausted";
|
|
|
|
|
- } else {
|
|
|
|
|
- this.answerResultType = "fail";
|
|
|
|
|
|
|
+ const questions = this.answerQuestion.map(obj => {
|
|
|
|
|
+ const {
|
|
|
|
|
+ options,
|
|
|
|
|
+ ...rest
|
|
|
|
|
+ } = obj;
|
|
|
|
|
+ return rest;
|
|
|
|
|
+ });
|
|
|
|
|
+ const param={
|
|
|
|
|
+ courseId:this.activeIndex,
|
|
|
|
|
+ videoId:this.videoId,
|
|
|
|
|
+ questions:questions
|
|
|
}
|
|
}
|
|
|
- this.showAnswerResultPopup = true;
|
|
|
|
|
- this.selectedAnswer = "";
|
|
|
|
|
|
|
+ courseAnswer(param).then(
|
|
|
|
|
+ res => {
|
|
|
|
|
+ if (res.code == 200) {
|
|
|
|
|
+ if (res.msg == '答题成功') {
|
|
|
|
|
+ this.answerResultType = "success";
|
|
|
|
|
+ this.hasAward = true;
|
|
|
|
|
+ }else{
|
|
|
|
|
+ this.answerResultType = "exhausted";
|
|
|
|
|
+ }
|
|
|
|
|
+ this.showAnswerResultPopup = true;
|
|
|
|
|
+ this.selectedAnswer = "";
|
|
|
|
|
+ } else {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ icon: 'none',
|
|
|
|
|
+ title: res.msg,
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ rej => {}
|
|
|
|
|
+ );
|
|
|
|
|
+ // 无标准答案时(例如满意度问卷)默认按成功处理
|
|
|
|
|
+ // if (!this.correctAnswer || this.selectedAnswer === this.correctAnswer) {
|
|
|
|
|
+ // this.answerResultType = "success";
|
|
|
|
|
+ // this.hasAward = true;
|
|
|
|
|
+ // } else if (this.attemptsLeft <= 0) {
|
|
|
|
|
+ // this.answerResultType = "exhausted";
|
|
|
|
|
+ // } else {
|
|
|
|
|
+ // this.answerResultType = "fail";
|
|
|
|
|
+ // }
|
|
|
|
|
+ // this.showAnswerResultPopup = true;
|
|
|
|
|
+ // this.selectedAnswer = "";
|
|
|
},
|
|
},
|
|
|
goToIntegralMall() {
|
|
goToIntegralMall() {
|
|
|
this.showAnswerResultPopup = false;
|
|
this.showAnswerResultPopup = false;
|