liuyu 4 年 前
コミット
a248e17717
2 ファイル変更16 行追加1 行削除
  1. 6 0
      src/store/onlive/room.js
  2. 10 1
      src/views/live/roomDetail.vue

+ 6 - 0
src/store/onlive/room.js

@@ -49,6 +49,12 @@ const actions = {
     });
     return res;
   },
+  async lookupdateonline({ commit }, { ...info } = {}) {
+    const res = await this.$axios.$post(`${api.lookuserInfo}/updateonline`, {
+      ...info,
+    });
+    return res;
+  },
   async lookusercount({ commit }, { ...info } = {}) {
     const res = await this.$axios.$get(`${api.lookusercount}`, {
       ...info,

+ 10 - 1
src/views/live/roomDetail.vue

@@ -229,12 +229,14 @@ export default {
     this.lookusercountsel();
     this.chatSearch();
     this.userswichrole();
+    this.lookonlineup('1');
   },
   mounted() {
     this.channel();
   },
   destroyed() {
     const that = this;
+    this.lookonlineup('0');
     window.addEventListener('pagehide', function() {
       console.log('页面要关闭了');
       that.recordSave();
@@ -242,11 +244,18 @@ export default {
   },
   methods: {
     ...gensign(['gensignFetch']),
-    ...room(['lookuserFetch', 'fetch', 'lookusercount', 'lookquery', 'lookupdate', 'lookrecord', 'lookuserswichrole']),
+    ...room(['lookuserFetch', 'fetch', 'lookusercount', 'lookquery', 'lookupdate', 'lookrecord', 'lookuserswichrole', 'lookupdateonline']),
     ...chat(['query', 'create']),
     ...quest(['questfetch']),
     ...uploadquestion({ upcreate: 'create', upquery: 'query' }),
     ...mapWeiXin(['support']),
+    async lookonlineup(isonline) {
+      const data = {};
+      data.roomid = this.id;
+      data.userid = this.user.uid;
+      data.isonline = isonline;
+      const res = await this.lookupdateonline(data);
+    },
     reviewVideo(newstrem, newid, oldstrem, oldid) {
       oldstrem.stop();
       newstrem.stop();