liuyu 4 years ago
parent
commit
0b7db9ed7e
3 changed files with 20 additions and 2 deletions
  1. 8 0
      src/store/onlive/room.js
  2. 1 1
      src/views/live/roomDetail.vue
  3. 11 1
      src/views/live/roomMeet.vue

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

@@ -7,6 +7,7 @@ const api = {
   roomInfo: `/api/onlive/room`,
   lookuserInfo: `/api/onlive/lookuser`,
   lookusercount: `/api/onlive/lookuser/roomcount`,
+  lookuserswichrole: `/api/onlive/lookuser/swichrole`,
 };
 const state = () => ({});
 const mutations = {};
@@ -35,6 +36,13 @@ const actions = {
     });
     return res;
   },
+  // 查询用户是否主播
+  async lookuserswichrole({ commit }, { ...info } = {}) {
+    const res = await this.$axios.$get(`${api.lookuserswichrole}`, {
+      ...info,
+    });
+    return res;
+  },
   // 名字查详情
   async roomfetch({ commit }, payload) {
     const res = await this.$axios.$get(`${api.roomInfo}/roomname`, payload);

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

@@ -141,7 +141,7 @@ export default {
         this.content = '';
       }
       this.$nextTick(() => {
-        document.getElementById('chatSell').scrollTop = document.getElementById('chatSell').scrollHeight + 275;
+        //document.getElementById('chatSell').scrollTop = document.getElementById('chatSell').scrollHeight + 275;
       });
     },
     async lookuserSearch() {

+ 11 - 1
src/views/live/roomMeet.vue

@@ -107,6 +107,7 @@ export default {
     this.lookuserSearch();
     this.lookusercountsel();
     this.chatSearch();
+    this.userswichrole();
   },
   mounted() {
     this.channel();
@@ -114,7 +115,7 @@ export default {
   },
   methods: {
     ...gensign(['gensignFetch']),
-    ...room(['lookuserFetch', 'fetch', 'lookusercount']),
+    ...room(['lookuserFetch', 'fetch', 'lookusercount', 'lookuserswichrole']),
     ...chat(['query', 'create']),
     async chatSearch({ skip = 0, limit = 1000 } = {}) {
       const info = { roomid: this.id };
@@ -208,6 +209,15 @@ export default {
         this.$set(this, `total`, result.total);
       }
     },
+    async userswichrole() {
+      // 根据房间id查询房间详细信息
+      let result = await this.lookuserswichrole({ roomid: this.id, userid: this.user.uid });
+      if (this.$checkRes(result)) {
+        if (result.data.switchrole === 'anchor') {
+          this.switchbtn = true;
+        }
+      }
+    },
     async initclient() {
       this.userId_ = this.user.uid;
       const res = await this.gensignFetch({ userid: this.userId_ });