Commit c8c08bda by yanju

博客发布页添加心跳

parent 9c52c6d7
...@@ -54,6 +54,7 @@ export default { ...@@ -54,6 +54,7 @@ export default {
active:'/api/user/actives',//活跃用户 active:'/api/user/actives',//活跃用户
repliers:'/api/user/hotRepliers',//热门答主 repliers:'/api/user/hotRepliers',//热门答主
logout:'/api/user/logout',//注销登录 logout:'/api/user/logout',//注销登录
keepAlive:'/api/user/keepAlive',//心跳接口
}, },
......
...@@ -169,6 +169,15 @@ export default { ...@@ -169,6 +169,15 @@ export default {
}; };
} }
}, },
created(){
this.keepAlive()
},
destroyed() {
this.keepAliveTimer = null;
},
mounted() { mounted() {
if (this.$route.query.id) { if (this.$route.query.id) {
this.blogTitle = this.detailContent.blogTitle; this.blogTitle = this.detailContent.blogTitle;
...@@ -198,6 +207,7 @@ export default { ...@@ -198,6 +207,7 @@ export default {
components: {SelectCard, CardContainer}, components: {SelectCard, CardContainer},
data() { data() {
return { return {
keepAliveTimer:null,
markdownOption: { markdownOption: {
bold: true, // 粗体 bold: true, // 粗体
italic: true, // 斜体 italic: true, // 斜体
...@@ -250,6 +260,13 @@ export default { ...@@ -250,6 +260,13 @@ export default {
} }
}, },
methods: { methods: {
keepAlive(){
this.keepAliveTimer = setInterval(()=>{
this.$axios.$get(config.api.get.User.keepAlive).then((response)=>{
})
},10000)
},
preview() { preview() {
this.$nextTick(() => { this.$nextTick(() => {
// this.$refs.content.readmodel(); // this.$refs.content.readmodel();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment