|
@@ -119,7 +119,8 @@ export default {
|
|
isCollected: false, // 是否被收藏了
|
|
isCollected: false, // 是否被收藏了
|
|
commentList: [], // 评论列表内容
|
|
commentList: [], // 评论列表内容
|
|
commentValue: "", // 即将评论的内容
|
|
commentValue: "", // 即将评论的内容
|
|
- startStudyInterval: null
|
|
|
|
|
|
+ startStudyInterval: null,
|
|
|
|
+ isRead: false
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -130,6 +131,7 @@ export default {
|
|
created() {},
|
|
created() {},
|
|
mounted() {
|
|
mounted() {
|
|
this.getContent();
|
|
this.getContent();
|
|
|
|
+ this.checkReadMaterial();
|
|
},
|
|
},
|
|
beforeDestroy() {
|
|
beforeDestroy() {
|
|
clearInterval(this.startStudyInterval);
|
|
clearInterval(this.startStudyInterval);
|
|
@@ -185,6 +187,9 @@ export default {
|
|
this.seconds--;
|
|
this.seconds--;
|
|
} else {
|
|
} else {
|
|
Toast("学习完成");
|
|
Toast("学习完成");
|
|
|
|
+ if (this.isRead) {
|
|
|
|
+ this.ReadMaterial();
|
|
|
|
+ }
|
|
clearInterval(this.startStudyInterval);
|
|
clearInterval(this.startStudyInterval);
|
|
}
|
|
}
|
|
}, 1000);
|
|
}, 1000);
|
|
@@ -246,7 +251,7 @@ export default {
|
|
materialId: this.materialId
|
|
materialId: this.materialId
|
|
};
|
|
};
|
|
let params = {
|
|
let params = {
|
|
- userId: "testuser-ztdxxDGdNj",
|
|
|
|
|
|
+ userId: this.user.userInfo.userName,
|
|
content: inputVal,
|
|
content: inputVal,
|
|
materialId: this.materialId
|
|
materialId: this.materialId
|
|
};
|
|
};
|
|
@@ -268,6 +273,48 @@ export default {
|
|
// 操作:取消评论
|
|
// 操作:取消评论
|
|
canclePostCommentFun() {
|
|
canclePostCommentFun() {
|
|
this.commentValue = "";
|
|
this.commentValue = "";
|
|
|
|
+ },
|
|
|
|
+ // 检查是否可以阅读
|
|
|
|
+ checkReadMaterial() {
|
|
|
|
+ let path = {
|
|
|
|
+ materialId: this.materialId
|
|
|
|
+ };
|
|
|
|
+ let params = {
|
|
|
|
+ user: this.user.userInfo.userName
|
|
|
|
+ };
|
|
|
|
+ this.$_http
|
|
|
|
+ .get(this.$pathParams(this.$_API.JTXT_GET_MATERIALS_READ, path), {
|
|
|
|
+ params
|
|
|
|
+ })
|
|
|
|
+ .then(res => {
|
|
|
|
+ this.isRead = res;
|
|
|
|
+ console.log(this.isRead);
|
|
|
|
+ if (this.isRead) {
|
|
|
|
+ this.ReadMaterial();
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {
|
|
|
|
+ this.$store.commit("toggleLoading", false);
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ ReadMaterial() {
|
|
|
|
+ let path = {
|
|
|
|
+ materialId: this.materialId
|
|
|
|
+ };
|
|
|
|
+ let params = {
|
|
|
|
+ user: this.user.userInfo
|
|
|
|
+ };
|
|
|
|
+ this.$_http
|
|
|
|
+ .post(
|
|
|
|
+ this.$pathParams(this.$_API.JTXT_POST_MATERIALS_READ, path),
|
|
|
|
+ params
|
|
|
|
+ )
|
|
|
|
+ .then(res => {
|
|
|
|
+ console.log(res);
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {
|
|
|
|
+ this.$store.commit("toggleLoading", false);
|
|
|
|
+ });
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|