|
@@ -1,7 +1,14 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
<van-nav-bar title="学习" left-arrow @click-left="onClickLeft" />
|
|
|
+ <div v-if="seconds>0">剩余学习时间: 0:0:{{seconds}}</div>
|
|
|
<div>{{ contentObj.contents }}</div>
|
|
|
+ <div @click="clickCollection()">收藏</div>
|
|
|
+ <div @click="clickRemoveCollection()">取消收藏</div>
|
|
|
+ <div>阅读 {{contentObj.readerCount}}</div>
|
|
|
+ <div>点赞 {{contentObj.likesCount}}</div>
|
|
|
+ <div>评论:</div>
|
|
|
+ <div></div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -14,13 +21,15 @@ export default {
|
|
|
components: {},
|
|
|
data() {
|
|
|
return {
|
|
|
- contentObj: null
|
|
|
+ contentObj: { contents: "" },
|
|
|
+ seconds: 10
|
|
|
};
|
|
|
},
|
|
|
computed: {},
|
|
|
created() {},
|
|
|
mounted() {
|
|
|
this.getContent();
|
|
|
+ this.caculateTime();
|
|
|
},
|
|
|
methods: {
|
|
|
// 查询具体内容
|
|
@@ -40,6 +49,59 @@ export default {
|
|
|
},
|
|
|
onClickLeft() {
|
|
|
this.$router.back();
|
|
|
+ },
|
|
|
+ caculateTime() {
|
|
|
+ var interval = setInterval(() => {
|
|
|
+ if (this.seconds > 0) {
|
|
|
+ this.seconds--;
|
|
|
+ } else {
|
|
|
+ clearInterval(interval);
|
|
|
+ }
|
|
|
+ }, 1000);
|
|
|
+ },
|
|
|
+ // 点击收藏
|
|
|
+ clickCollection() {
|
|
|
+ let path = {
|
|
|
+ userName: "testuser-ztdxxDGdNj"
|
|
|
+ };
|
|
|
+ let params = {
|
|
|
+ id: this.materialId
|
|
|
+ };
|
|
|
+ this.$_http
|
|
|
+ .get(this.$pathParams(this.$_API.JTXT_POST_FAVORITE_MATERIALID, path), {
|
|
|
+ params
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ console.log("--收藏--" + JSON.stringify(res.data));
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.$store.commit("toggleLoading", false);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 移除收藏
|
|
|
+ clickRemoveCollection() {
|
|
|
+ let path = {
|
|
|
+ userName: "testuser-ztdxxDGdNj"
|
|
|
+ };
|
|
|
+ let params = {
|
|
|
+ id: this.materialId
|
|
|
+ };
|
|
|
+ this.$_http
|
|
|
+ .delete(
|
|
|
+ this.$pathParams(
|
|
|
+ this.$_API.JTXT_DELETE_REMOVE_FAVORITE_MATERIALID,
|
|
|
+ path
|
|
|
+ ),
|
|
|
+ {
|
|
|
+ params
|
|
|
+ }
|
|
|
+ )
|
|
|
+ .then(res => {
|
|
|
+ console.log("--取消收藏--" + JSON.stringify(res.data));
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.$store.commit("toggleLoading", false);
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
};
|