laosan2382995021@163.com 3 роки тому
батько
коміт
63481148dd
69 змінених файлів з 937 додано та 161 видалено
  1. 5 0
      src/config/config.ts
  2. 39 0
      src/config/plugs/cache.ts
  3. 3 0
      src/config/plugs/index.ts
  4. 42 2
      src/mixins/cate.ts
  5. 25 1
      src/pages/home/src/main.vue
  6. 16 0
      src/pages/home/style.scss
  7. BIN
      src/pages/talking/components/room-broadcast/images/background.png
  8. 3 0
      src/pages/talking/components/room-broadcast/index.ts
  9. 24 0
      src/pages/talking/components/room-broadcast/mixins/handle.ts
  10. 4 0
      src/pages/talking/components/room-broadcast/mixins/index.ts
  11. 47 0
      src/pages/talking/components/room-broadcast/src/main.vue
  12. 68 0
      src/pages/talking/components/room-broadcast/style.scss
  13. 5 0
      src/pages/talking/components/room-footer/mixins/wheat.ts
  14. 6 1
      src/pages/talking/components/room-footer/props.ts
  15. 1 1
      src/pages/talking/components/room-footer/src/main.vue
  16. 4 2
      src/pages/talking/components/room-info/src/main.vue
  17. 9 0
      src/pages/talking/components/room-ranking/components/room-chat/props.ts
  18. 7 2
      src/pages/talking/components/room-ranking/components/room-chat/src/main.vue
  19. 3 0
      src/pages/talking/components/room-ranking/components/room-chat/style.scss
  20. 9 0
      src/pages/talking/components/room-ranking/props.ts
  21. 5 2
      src/pages/talking/components/room-ranking/src/main.vue
  22. 4 4
      src/pages/talking/components/room-wheat/mixins/follow.ts
  23. 7 0
      src/pages/talking/mixins/agora.ts
  24. 83 0
      src/pages/talking/mixins/controls.ts
  25. 4 1
      src/pages/talking/mixins/handle.ts
  26. 3 1
      src/pages/talking/mixins/index.ts
  27. 22 0
      src/pages/talking/mixins/socket.ts
  28. 9 0
      src/pages/talking/mixins/utils.ts
  29. 10 2
      src/pages/talking/src/main.vue
  30. 1 5
      src/popup/popup-chat/components/chat-content/mixins/follow.ts
  31. 2 1
      src/popup/popup-chat/components/chat-content/mixins/userInfo.ts
  32. 0 2
      src/popup/popup-chat/components/chat-list/mixins/handle.ts
  33. 1 1
      src/popup/popup-detail/components/game/components/comment-list/src/main.vue
  34. 25 0
      src/popup/popup-detail/components/game/components/gift-wall/mixins/handle.ts
  35. 7 0
      src/popup/popup-detail/components/game/components/gift-wall/props.ts
  36. 34 29
      src/popup/popup-detail/components/game/components/gift-wall/src/main.vue
  37. 9 1
      src/popup/popup-detail/components/game/components/gift-wall/style.scss
  38. 7 7
      src/popup/popup-detail/mixins/handle.ts
  39. 13 13
      src/popup/popup-detail/mixins/watch.ts
  40. 5 2
      src/popup/popup-personal/components/index.ts
  41. 2 1
      src/popup/popup-personal/components/my-dress-up/components/dress-up-list/mixins/handle.ts
  42. 0 1
      src/popup/popup-personal/components/my-dress-up/components/dress-up-list/src/main.vue
  43. 3 0
      src/popup/popup-personal/components/my-dress-up/components/dress-up-list/style.scss
  44. 1 3
      src/popup/popup-personal/components/my-follow/components/follow-user/mixins/handle.ts
  45. 3 0
      src/popup/popup-personal/components/my-naming/index.ts
  46. 74 0
      src/popup/popup-personal/components/my-naming/mixins/handle.ts
  47. 4 0
      src/popup/popup-personal/components/my-naming/mixins/index.ts
  48. 45 0
      src/popup/popup-personal/components/my-naming/src/main.vue
  49. 0 0
      src/popup/popup-personal/components/my-naming/style.scss
  50. 9 1
      src/popup/popup-personal/data/menu.ts
  51. 2 2
      src/popup/popup-personal/style.scss
  52. 4 4
      src/popup/popup-user/mixins/follow.ts
  53. 1 1
      src/popup/popup-user/mixins/handle.ts
  54. 2 3
      src/store/modules/cate.ts
  55. 0 2
      src/types/config.d.ts
  56. 7 3
      src/utils/control/personal-detail/index.ts
  57. 37 0
      src/utils/control/update_cache/getPlayerList.ts
  58. 20 0
      src/utils/request/cache/cache.ts
  59. 93 35
      src/utils/socket/agoraRTM/agoraRTMIM.ts
  60. 27 3
      src/utils/socket/agoraRTM/const/channel.ts
  61. 1 1
      src/views/view-header/mixins/login.ts
  62. 3 1
      src/views/view-menu/components/view-menu-tab/src/main.vue
  63. 2 1
      src/views/view-menu/mixins/index.ts
  64. 7 10
      src/views/view-menu/src/main.vue
  65. 8 3
      src/views/view-play-with/mixins/handle.ts
  66. 2 1
      src/views/view-room/mixins/index.ts
  67. 5 1
      src/views/view-room/src/main.vue
  68. 1 1
      src/views/view-room/style.scss
  69. 3 3
      src/views/view-talking-cate/src/main.vue

+ 5 - 0
src/config/config.ts

@@ -19,6 +19,11 @@ export default <Config>{
         // @ts-ignore
         this.emoji = RongIMLib.RongIMEmoji.list;
         this.app = vm;
+
+        // 安装插件
+        import('./plugs').then((plugs)=>{
+            plugs.default && plugs.default.map((item)=> item.install && item.install());
+        });
     }
 
 }

+ 39 - 0
src/config/plugs/cache.ts

@@ -0,0 +1,39 @@
+import {NoticeType} from "$utils/socket/const";
+import getPlayerList from "$utils/control/update_cache/getPlayerList";
+import personalDetail from '$utils/control/personal-detail';
+import socket from "$utils/socket";
+
+export default {
+
+    watch:{
+      [NoticeType.naming]:{
+          target: getPlayerList,
+          call:'updateNaming'
+      },
+      [NoticeType.follow]:{
+          target: personalDetail,
+          call:'updateCache'
+      }
+    },
+
+    install(){
+
+        for (let key in this.watch) {
+
+            if (this.watch.hasOwnProperty(key)) {
+                socket.on('config-watch-'+key, (data)=> {
+                    try {
+                        return this.watch[key].target[this.watch[key].call](data);
+                    } catch (e) {
+                        console.log(e);
+                    }
+
+                }, key as unknown as NoticeType)
+            }
+
+        }
+
+    }
+
+
+}

+ 3 - 0
src/config/plugs/index.ts

@@ -0,0 +1,3 @@
+import cache from './cache';
+
+export default [cache];

+ 42 - 2
src/mixins/cate.ts

@@ -1,4 +1,6 @@
 import { mapState } from 'vuex';
+import user from "$config/user";
+import cate from "$config/cate";
 
 export default {
 
@@ -7,7 +9,45 @@ export default {
         gameCate: state => state.cate.gameCate,
         recommendGameCate: state => state.cate.recommendGameCate,
         roomCate:state=>state.cate.roomCate,
-        recommendRoomCate:state => state.cate.recommendRoomCate
+        roomLoginCate:function (state){
+            let roomCate = state.cate.roomCate || [];
+            let resultData = [];
+            roomCate.map((item,index)=>{
+
+                if ( !item.options || !item.options.collect || item.options.collect&& this.$store.getters.isLogin ) {
+                    resultData.push({
+                        ...item,
+                        slot:'room-cate-'+index
+                    });
+                }
+
+            });
+
+            return resultData;
+        },
+        recommendRoomCate:function () {
+            let maxSize = cate.roomCate.config.size - cate.roomCate.config.footer.length;
+            let recommendGameCate = [];
+
+            this.roomLoginCate.map((item)=>{
+                if (item.type_name) {
+                    item = {
+                        label: item.type_name,
+                        tid: item.tid,
+                        image: item.image
+                    };
+                }
+
+                if (recommendGameCate.length < maxSize) {
+                    recommendGameCate.push(item);
+                }
+
+            });
+
+            recommendGameCate.push(...cate.roomCate.config.footer);
+
+            return recommendGameCate;
+        }
     })
 
-}
+}

+ 25 - 1
src/pages/home/src/main.vue

@@ -1,5 +1,11 @@
 <template>
   <section class="screen flex home-container" >
+    <article
+        v-for="(item,index) in advertisement"
+        :class="{'home-advertisement-right': index %2!==0}"
+        class="absolute home-advertisement aCenter"
+      :style="{'background':'url('+item.image+') no-repeat center'}"
+    ></article>
     <view-header></view-header>
     <section class="flex-1 row container">
       <article class="flex-1 content-container">
@@ -41,13 +47,29 @@ import tabData from "../data/tabData";
 
 import socket from '$utils/socket';
 import {NoticeType} from "../../../utils/socket/const";
+import {InstructionsCacheType} from "../../../utils/request";
 
 export default {
   name: "home",
   data(){
     return {
       tabData,
-      value:0
+      value:0,
+      advertisement:[]
+    }
+  },
+
+  methods:{
+    fetchAdvertisement(){
+      return this.$request({
+        url:'banner/get_homepage_pc',
+        cache:{
+          type:InstructionsCacheType.storage,
+          expireTime:24 * 60 * 60
+        }
+      }).then((data)=>{
+        this.advertisement = data.data || [];
+      })
     }
   },
 
@@ -68,6 +90,8 @@ export default {
       }
     },NoticeType.home)
 
+    this.fetchAdvertisement();
+
   },
 
   beforeUnmount() {

+ 16 - 0
src/pages/home/style.scss

@@ -15,3 +15,19 @@
   padding-left: 20px;
 }
 /* 内容容器 */
+
+/* 广告 */
+$advertisement-width:241px;
+$advertisement-diff:20px;
+.home-advertisement{
+  left: -$advertisement-width - $advertisement-diff;
+  top: 0;
+  bottom: 0;
+  width:$advertisement-width;
+  background-size: 100% !important;
+}
+.home-advertisement-right{
+  right: -$advertisement-width - $advertisement-diff;
+  left: auto;
+}
+/* 广告 */

BIN
src/pages/talking/components/room-broadcast/images/background.png


+ 3 - 0
src/pages/talking/components/room-broadcast/index.ts

@@ -0,0 +1,3 @@
+import main from './src/main.vue';
+
+export default main;

+ 24 - 0
src/pages/talking/components/room-broadcast/mixins/handle.ts

@@ -0,0 +1,24 @@
+export default {
+
+    data(){
+        return {
+            queueTime:0,
+            queueDelayTime:5000
+        }
+    },
+
+    methods:{
+
+        triggerChangeQueue(){
+            this.watchQueueTime = setTimeout(()=>{
+                this.triggerQueueItem();
+            },this.queueDelayTime);
+        }
+
+    },
+
+    beforeUnmount() {
+        clearTimeout(this.queueDelayTime);
+    }
+
+}

+ 4 - 0
src/pages/talking/components/room-broadcast/mixins/index.ts

@@ -0,0 +1,4 @@
+import queue from '$mixins/queue';
+import handle from './handle';
+
+export default [queue,handle];

+ 47 - 0
src/pages/talking/components/room-broadcast/src/main.vue

@@ -0,0 +1,47 @@
+<template>
+<!--  v-show="triggerStatus"-->
+  <div  class="room-broadcast-container absolute overflow">
+    <div class="room-broadcast row center room-broadcast-animate"
+      :style="{background:'url('+background+') no-repeat','animation-duration':queueDelayTime+'ms'}"
+      v-if="useQueueItem"
+         :key="useQueueItem._id"
+    >
+      <v-image class="room-broadcast-avatar" radius="50%" :src="useQueueItem.headimgurl"></v-image>
+      <span class="room-broadcast-crux">{{useQueueItem.nickName}}</span>
+      <span>在</span>
+      <div class="room-broadcast-home line-1">{{useQueueItem.roomInfo.name}}</div>
+      <div>赠送</div>
+      <span v-if="useQueueItem.userInfo && useQueueItem.userInfo.length > 1" class="room-broadcast-crux">全部麦序</span>
+      <div  v-else class="room-broadcast-crux room-broadcast-home line-1">
+        <span v-for="(cItem,cIndex) in useQueueItem.userInfo" :key="cItem.uid">{{cIndex!==0?',':''}}{{cItem.nickname}}</span>
+      </div>
+      <span>{{useQueueItem.e_name}}</span>
+      <v-image :src="useQueueItem.show_img" class="room-broadcast-gift" mode="center" backgroundColor="transparent"></v-image>
+      <icon type="close" class="room-broadcast-close"></icon>
+      <span class="room-broadcast-number">{{useQueueItem.giftNum}}</span>
+    </div>
+  </div>
+</template>
+
+<script>
+import mixins from '../mixins';
+import {
+    vImage,
+    icon
+} from '$components';
+export default {
+  name: "room-broadcast",
+  data(){
+    return {
+      background: require('../images/background.png')
+    }
+  },
+  mixins,
+  components:{
+    vImage,
+    icon
+  }
+}
+</script>
+
+<style scoped lang="scss" src="../style.scss"></style>

+ 68 - 0
src/pages/talking/components/room-broadcast/style.scss

@@ -0,0 +1,68 @@
+/* 进场模块 */
+.room-broadcast-container{
+  width: 80%;
+  height: 45px;
+  z-index: 99;
+  top: 20px;
+  left: 10%;
+  pointer-events: none;
+}
+.room-broadcast-animate{
+  animation: toBroadcast 5s linear forwards;
+}
+
+@keyframes toBroadcast {
+  0% {
+    transform: translateX(100%);
+  }
+  20%{
+    transform: translateX(0);
+  }
+  80%{
+    transform: translateX(0);
+  }
+  100%{
+    transform: translateX(-100%);
+  }
+}
+.room-broadcast{
+  background-size: 100% !important;
+  height: 100%;
+  width: 100%;
+  font-size:16px;
+  line-height: 24px;
+  color: #fff;
+}
+/* 进场模块 */
+
+/* 内容 */
+.room-broadcast-avatar{
+  @include square(30px);
+}
+.room-broadcast-home{
+  //max-width: ;
+  max-width: 22%;
+  width: auto;
+  margin-right: 10px;
+}
+.room-broadcast-crux{
+  margin: 0 5px;
+}
+.room-broadcast-close,.room-broadcast-crux,.room-broadcast-number{
+  color: #ff6000;
+}
+.room-broadcast-number{
+  font-size: 20px;
+  line-height: 24px;
+}
+.room-broadcast-gift{
+  @include square(32px);
+  margin: 0 5px;
+}
+.room-broadcast-close{
+  font-size: 12px;
+  line-height: 14px;
+  font-weight: bold;
+  transform: scale(0.8);
+}
+/* 内容 */

+ 5 - 0
src/pages/talking/components/room-footer/mixins/wheat.ts

@@ -14,6 +14,11 @@ export default {
             if (this.agoraStatus === AgoraStatus.published || this.agoraStatus === AgoraStatus.listener) {
                 this.loadingAgora = false;
             }
+        },
+        forWheatStatus(){
+            if (!this.forWheatStatus) {
+                this.useAgora.unPublish();
+            }
         }
     },
 

+ 6 - 1
src/pages/talking/components/room-footer/props.ts

@@ -8,6 +8,11 @@ export default {
     agoraStatus:{
         type:[Number,String],
         default:0
+    },
+
+    forWheatStatus:{
+        type:Boolean,
+        default:false
     }
 
-}
+}

+ 1 - 1
src/pages/talking/components/room-footer/src/main.vue

@@ -10,7 +10,7 @@
       :class="{'cursor-pointer':!loadingAgora}"
          @click="toggleWheat"
     >
-      <div v-if="!loadingAgora && AgoraStatus.listener === agoraStatus" class="absolute room-footer-wheat-disabled"></div>
+      <div v-if="!loadingAgora && AgoraStatus.listener === agoraStatus || !forWheatStatus" class="absolute room-footer-wheat-disabled"></div>
       <svg v-else-if="AgoraStatus.microphoneFail === agoraStatus" class="absolute room-footer-wheat-fail" t="1626500322171" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2083" width="200" height="200"><path d="M512 981.333333C252.8 981.333333 42.666667 771.2 42.666667 512S252.8 42.666667 512 42.666667s469.333333 210.133333 469.333333 469.333333-210.133333 469.333333-469.333333 469.333333z m44.245333-469.333333l159.914667-159.914667a31.274667 31.274667 0 1 0-44.245333-44.245333L512 467.754667 352.085333 307.84a31.274667 31.274667 0 1 0-44.245333 44.245333L467.754667 512l-159.914667 159.914667a31.274667 31.274667 0 1 0 44.245333 44.245333L512 556.245333l159.914667 159.914667a31.274667 31.274667 0 1 0 44.245333-44.245333L556.245333 512z" fill="#F5222D" p-id="2084"></path></svg>
       <svg t="1625625418358" class="screen" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4731" width="200" height="200"><path d="M512 691.2c99.84 0 179.2-79.36 179.2-179.2V256c0-99.84-79.36-179.2-179.2-179.2s-179.2 79.36-179.2 179.2v256c0 99.84 79.36 179.2 179.2 179.2z m-128-435.2c0-71.68 56.32-128 128-128s128 56.32 128 128v256c0 71.68-56.32 128-128 128s-128-56.32-128-128V256z m409.6 307.2h-51.2c-23.04 102.4-120.32 179.2-230.4 179.2s-207.36-76.8-230.4-179.2H230.4c23.04 122.88 130.56 217.6 256 230.4v51.2h-25.6c-15.36 0-25.6 10.24-25.6 25.6s10.24 25.6 25.6 25.6h102.4c15.36 0 25.6-10.24 25.6-25.6s-10.24-25.6-25.6-25.6h-25.6v-51.2c125.44-12.8 232.96-107.52 256-230.4z" p-id="4732" fill="#ffffff"></path></svg>
     </div>

+ 4 - 2
src/pages/talking/components/room-info/src/main.vue

@@ -7,8 +7,10 @@
           <div class="flex-1">
             <div class="room-info-name overflow"><div class="room-info-name-animate"
               :style="{'animation-duration': (info.room_name.length)+'s'}"
-              v-if="info.room_name"
-            ><span>{{info.room_name}}</span><span>{{info.room_name}}</span></div></div>
+              v-if="info.room_name && info.room_name.length >= 6"
+            ><span>{{info.room_name}}</span><span>{{info.room_name}}</span></div>
+              <div v-else >{{info.room_name}}</div>
+            </div>
           </div>
           <div @click="report" class="room-info-span cursor-pointer">举报</div>
         </div>

+ 9 - 0
src/pages/talking/components/room-ranking/components/room-chat/props.ts

@@ -0,0 +1,9 @@
+export default {
+
+    // 是否禁言
+    forbiddenWords:{
+        type:Boolean,
+        default:false
+    }
+
+}

+ 7 - 2
src/pages/talking/components/room-ranking/components/room-chat/src/main.vue

@@ -69,9 +69,10 @@
 
       <footer class="row">
         <div class="flex-1 room-chat-input">
-          <input v-model="message" @keydown.enter="sendMessage" :maxlength="maxLength" type="text" placeholder="和大家打个招呼吧~" />
+          <input v-if="forbiddenWords" disabled class="room-chat-input-disabled" :maxlength="maxLength" type="text" placeholder="您已被禁言" />
+          <input v-else v-model="message" @keydown.enter="sendMessage" :maxlength="maxLength" type="text" placeholder="和大家打个招呼吧~" />
         </div>
-        <div class="room-chat-send button" @click.stop="sendMessage">发送</div>
+        <div class="room-chat-send button" v-if="!forbiddenWords" @click.stop="sendMessage">发送</div>
       </footer>
     </section>
 
@@ -87,6 +88,8 @@ import {
   radio
 } from "$components";
 
+import props from '../props';
+
 import controlData from '../data/control';
 
 import mixins from '../mixins';
@@ -108,6 +111,8 @@ export default {
 
   mixins,
 
+  props,
+
   components:{
     scrollView,
     vImage,

+ 3 - 0
src/pages/talking/components/room-ranking/components/room-chat/style.scss

@@ -54,6 +54,9 @@
   background-color: rgba(255,255,255,0.05);
   padding: 0 12px;
 }
+.room-chat-input-disabled{
+  text-align: center;
+}
 .room-chat-input input{
   height: 100%;
   resize: none;

+ 9 - 0
src/pages/talking/components/room-ranking/props.ts

@@ -0,0 +1,9 @@
+export default {
+
+    // 是否禁言
+    forbiddenWords:{
+        type:Boolean,
+        default:false
+    }
+
+}

+ 5 - 2
src/pages/talking/components/room-ranking/src/main.vue

@@ -42,7 +42,7 @@
 
     </tab>
     <div class="flex-1">
-      <room-chat></room-chat>
+      <room-chat :forbiddenWords="forbiddenWords"></room-chat>
     </div>
   </section>
 </template>
@@ -54,6 +54,7 @@ import {
 import tabData from '../data/tab';
 import roomRankingList from '../components/room-ranking-list';
 import roomChat from '../components/room-chat';
+import props from '../props';
 export default {
   name: "room-ranking",
   data(){
@@ -69,6 +70,8 @@ export default {
     }
   },
 
+  props,
+
   components:{
     tab,
     roomRankingList,
@@ -77,4 +80,4 @@ export default {
 }
 </script>
 
-<style scoped lang="scss" src="../style.scss"></style>
+<style scoped lang="scss" src="../style.scss"></style>

+ 4 - 4
src/pages/talking/components/room-wheat/mixins/follow.ts

@@ -55,10 +55,10 @@ export default {
         },
         toggleFollow(){
             this.follow = !this.follow;
-            personalDetail.updateCache({
-                uid: this.now_use_host_id,
-                status: this.follow ? 1 : 0
-            },['get_room_user_info-'+this.now_use_host_id+'-'+this.room_info.rid]);
+            // personalDetail.updateCache({
+            //     uid: this.now_use_host_id,
+            //     status: this.follow ? 1 : 0
+            // },['get_room_user_info-'+this.now_use_host_id+'-'+this.room_info.rid]);
 
             socket.triggerNotice(NoticeType.follow, {
                 uid: this.now_use_host_id,

+ 7 - 0
src/pages/talking/mixins/agora.ts

@@ -17,10 +17,15 @@ export default <LibMixins>{
 
     created(){
 
+        // 订阅本频道
         this.useAgora = new Agora(this.$params.rid.toString(),user.uid() || null);
 
+
         this.agoraRTMIM = new AgoraRTMIM();
 
+        // 订阅全局频道
+        this.globalRTMIM = new AgoraRTMIM();
+
         // 监听设置状态
         this.useAgora.on(AgoraEvent.status,(item)=>{
             this.agoraStatus = item;
@@ -33,6 +38,8 @@ export default <LibMixins>{
         this.useAgora && this.useAgora.destroy();
         // 释放聊天
         this.agoraRTMIM && this.agoraRTMIM.destroy();
+        // 释放全服订阅
+        this.globalRTMIM && this.globalRTMIM.destroy();
     }
 
 }

+ 83 - 0
src/pages/talking/mixins/controls.ts

@@ -0,0 +1,83 @@
+import {AgoraRTMessage} from "$utils/socket/agoraRTM/const/channel";
+import popup from "$utils/tool/popup";
+
+import user from '$config/user';
+
+export default {
+
+    data(){
+        return {
+            // 是否被禁言
+            forbiddenWords:false,
+            // 是否开麦
+            forWheatStatus:true
+        }
+    },
+
+    methods:{
+
+        // 踢出房间
+        [AgoraRTMessage.kickOut](){
+            popup.$toast('您被踢出房间');
+            return this.$router.replace({
+                name:'home'
+            });
+        },
+
+        // 禁言
+        [AgoraRTMessage.forbidden](){
+            if (!this.forbiddenWords) this.forbiddenWords = true;
+        },
+
+        // 解除禁言
+        [AgoraRTMessage.unForbidden](){
+            if (this.forbiddenWords) this.forbiddenWords = false;
+        },
+
+        // 设置管理员
+        [AgoraRTMessage.setAdmin](){
+            let uid = user.uid();
+            if (this.roomInfo && uid) {
+                uid = uid.toString();
+                let useRoomInfo = (this.roomInfo.room_admin_uid || '').split(',') || [];
+
+                if (useRoomInfo.indexOf(uid) < 0){
+                    useRoomInfo.push(uid);
+                    this.roomInfo.room_admin_uid = useRoomInfo.join(',');
+                }
+            }
+        },
+
+        // 取消设置管理员
+        [AgoraRTMessage.unSetAdmin](){
+            let uid = user.uid();
+            if (this.roomInfo && uid) {
+                uid = uid.toString();
+                let useRoomInfo = (this.roomInfo.room_admin_uid || '').split(',') || [];
+
+                if (useRoomInfo.indexOf(uid) >= 0){
+                    useRoomInfo.splice(uid,1);
+                    this.roomInfo.room_admin_uid = useRoomInfo.join(',');
+                }
+            }
+        },
+
+        // 管理员闭麦
+        [AgoraRTMessage.closeWheat](){
+            if (this.forWheatStatus) this.forWheatStatus = false;
+        },
+
+        // 管理员开麦
+        [AgoraRTMessage.openWheat](){
+            if (!this.forWheatStatus) this.forWheatStatus = true;
+        },
+
+    },
+
+    created() {
+        this.agoraRTMIM.on(AgoraRTMessage.userMessage,(data)=>{
+            this[data.type] && this[data.type](data.data);
+        })
+    }
+
+}

+ 4 - 1
src/pages/talking/mixins/handle.ts

@@ -3,6 +3,7 @@ import user from "$config/user";
 import Shield from '$utils/control/user/const/shield';
 import {RowWheat} from "@/pages/talking/const";
 import {AgoraRTMIMStatus} from "$utils/socket/agoraRTM/const/status";
+import {AgoraRTMessage} from "$utils/socket/agoraRTM/const/channel";
 
 
 export default <LibMixins>{
@@ -61,7 +62,7 @@ export default <LibMixins>{
                     return resolve(this.$params.infoData);
                 } else {
                     return this.$request({
-                        url:'room/enter_room_info',
+                        url:'room/get_room_info',
                         data:{
                             rid: this.$params.rid,
                             password: this.$params.password
@@ -100,6 +101,8 @@ export default <LibMixins>{
                 // 安装 socket
                 this.agoraRTMIM.install(this.$params.rid.toString()).then(()=>{
                     this.sendSystem(data.room_welcome);
+                    // 装载全服消息
+                    this.globalRTMIM.install('global_channel');
                     resolve();
                 }).catch(reject);
             }

+ 3 - 1
src/pages/talking/mixins/index.ts

@@ -18,5 +18,7 @@ import socket from "./socket";
 import gift from './gift';
 // 统计数量
 import number from './number';
+// 功能
+import controls from './controls';
 
-export default [user,params,handle,wheat,agora,micro,utils,socket,gift,number];
+export default [user,params,handle,wheat,agora,micro,utils,socket,gift,number,controls];

+ 22 - 0
src/pages/talking/mixins/socket.ts

@@ -67,6 +67,11 @@ export default {
 
                 if (send) {
                     this.agoraRTMIM.send(resultData,AgoraRTMessage.gift);
+
+                    if (data.gift.is_public_server) {
+                        this.sendBroadCast(resultData);
+                    }
+
                 } else {
                     this.socketItem.triggerPushMessage(AgoraRTMessage.gift,resultData);
                 }
@@ -74,6 +79,14 @@ export default {
 
         },
 
+        // 全服播报
+        sendBroadCast(data){
+
+            let resultData = this.globalRTMIM.addGlobal(data,this.roomInfo);
+
+            return this.globalRTMIM.send(resultData,AgoraRTMessage.gift);
+        },
+
         // 向大家公布麦位信息
         sendWheatInfo(){
             // 提醒大家麦位信息得到了更新
@@ -138,6 +151,15 @@ export default {
             }
 
         });
+
+        // 全服礼物播报
+        this.globalRTMIM.on(AgoraRTMessage.gift,({data})=>{
+            console.log(data,this.roomInfo);
+            if (data.roomInfo && data.roomInfo.id !== this.roomInfo.rid) {
+                this.sendGiveBroadCastGift(data);
+            }
+        })
+
     }
 
 }

+ 9 - 0
src/pages/talking/mixins/utils.ts

@@ -46,6 +46,15 @@ export default <LibMixins>{
                 // 添加入场动画
                 this.$refs.queueGift && this.$refs.queueGift.pushGift(item,uid);
             }
+        },
+
+        // 全服播报
+        sendGiveBroadCastGift(item:Record<string, any>){
+            // 检查权限是否屏蔽了进场特效
+            if (!user.getDataItem(UserConfigType.shield,Shield.giftBanner)) {
+                // 添加入场动画
+                this.$refs.broadcast && this.$refs.broadcast.pushQueue(item);
+            }
         }
 
     }

+ 10 - 2
src/pages/talking/src/main.vue

@@ -11,6 +11,8 @@
           <section class="talking-center flex relative">
             <!--  礼物特效  -->
             <room-queue-gift v-if="!userShield[Shield.gift]" ref="queueGift"></room-queue-gift>
+            <!--  全服播报  -->
+            <room-broadcast v-if="!userShield[Shield.giftBanner]" ref="broadcast"></room-broadcast>
             <room-wheat
               :info="roomInfo"
               :microInfo="microInfo"
@@ -22,11 +24,14 @@
               :give-user="giveUser"
             ></room-gift>
           </section>
-          <room-ranking></room-ranking>
+          <room-ranking
+            :forbiddenWords="forbiddenWords"
+          ></room-ranking>
         </section>
         <room-footer
             :inWheat="inWheat"
             :agoraStatus="agoraStatus"
+            :forWheatStatus="forWheatStatus"
         ></room-footer>
       </section>
     </section>
@@ -40,6 +45,8 @@ import roomInfo from '../components/room-info';
 
 import roomFooter from '../components/room-footer';
 
+import roomBroadcast from '../components/room-broadcast';
+
 import roomWheat from '../components/room-wheat';
 
 import roomGift from '../components/room-gift';
@@ -67,7 +74,8 @@ export default {
     roomGift,
     roomRanking,
     roomAdmission,
-    roomQueueGift
+    roomQueueGift,
+    roomBroadcast
   },
   mixins
 }

+ 1 - 5
src/popup/popup-chat/components/chat-content/mixins/follow.ts

@@ -21,10 +21,6 @@ export default {
 
         toggleFollow(){
             this.control.follow = !this.control.follow;
-            personalDetail.updateCache({
-                uid: this.uid,
-                status: this.control.follow ? 1 : 0
-            });
 
             socket.triggerNotice(NoticeType.follow, {
                 uid: this.uid,
@@ -78,4 +74,4 @@ export default {
         socket.off('popup-chat-content');
     }
 
-}
+}

+ 2 - 1
src/popup/popup-chat/components/chat-content/mixins/userInfo.ts

@@ -34,7 +34,8 @@ export default {
                     pageSize:1
                 },
                 cache:{
-                    type: InstructionsCacheType.memory
+                    type: InstructionsCacheType.memory,
+                    id:'get_player_list_'+this.uid
                 }
             });
         },

+ 0 - 2
src/popup/popup-chat/components/chat-list/mixins/handle.ts

@@ -69,8 +69,6 @@ export default <LibMixins>{
                     }
                 }
 
-                personalDetail.updateCache(params);
-
             },NoticeType.follow);
         }
 

+ 1 - 1
src/popup/popup-detail/components/game/components/comment-list/src/main.vue

@@ -44,7 +44,7 @@ export default {
         data:{
           pid: this.config.pid
         },
-        page:obj
+        page:obj.data
       }).then((data)=>{
         return obj.success((data.data || []).map((item)=>{
           item.comment_time = DateFormat(item.comment_time,'MM-DD hh:mm');

+ 25 - 0
src/popup/popup-detail/components/game/components/gift-wall/mixins/handle.ts

@@ -1,4 +1,5 @@
 import unit from "$utils/unit/unit";
+import {InstructionsCacheType} from "$utils/request";
 
 export default {
 
@@ -11,7 +12,31 @@ export default {
                 slidesPerColumn:3,
                 slidesPerColumnFill:'row'
             },
+            sum_price_total:0,
+            data:[]
         }
+    },
+    methods:{
+
+        fetch(obj){
+            return this.$request({
+                url:'user/get_receive_gift_sumdata',
+                data:{
+                    uid:this.config.uid
+                },
+                token:true,
+                cache:{
+                    type: InstructionsCacheType.memory,
+                    id:'get_receive_gift_sumdata_'+this.config.uid
+                }
+            }).then((data)=>{
+                data.data = data.data || {};
+                this.data = data.data.list || [];
+                this.sum_price_total = data.data.sum_price_total;
+                return obj.success(this.data);
+            }).catch(obj.fail);
+        }
+
     }
 
 }

+ 7 - 0
src/popup/popup-detail/components/game/components/gift-wall/props.ts

@@ -3,6 +3,13 @@ export default {
     height:{
         type:Number,
         default:0
+    },
+
+    config:{
+        type:Object,
+        default:function () {
+            return {}
+        }
     }
 
 }

+ 34 - 29
src/popup/popup-detail/components/game/components/gift-wall/src/main.vue

@@ -1,25 +1,35 @@
 <template>
-  <section :style="{height:height+'px'}" class="flex">
-    <header class="rowACenter gift-wall-header">
-      <span>礼物总价值:</span>
-      <span><img src="@/assets/images/currency.png" class="gift-wall-currency" /><span class="gift-wall-price">21456</span></span>
-    </header>
-    <section class="flex-1">
-      <swiper class="screen chat-gift-swiper"
-              :swiper-option="swiperOption"
-              :pagination="true"
-              v-if="giftData && giftData.length>0"
-      >
-        <swiper-item
-          v-for="(item,index) in giftData"
-          :key="'gift-'+index"
-          class="gift-wall-item center"
-        >
-          <v-image :src="item.base_image" class="gift-wall-icon" backgroundColor="transparent"></v-image>
-          <div class="gift-wall-number line-1">12</div>
-        </swiper-item>
-      </swiper>
-    </section>
+  <section :style="{height:height+'px'}" class="flex gift-wall-flat">
+    <flat-list
+        @fetch="fetch"
+        :paging="false"
+        emptyText="暂未收到礼物"
+    >
+      <template v-slot:page>
+        <section class="screen">
+          <header class="rowACenter gift-wall-header">
+            <span>礼物总价值:</span>
+            <span><img src="@/assets/images/currency.png" class="gift-wall-currency" /><span class="gift-wall-price">{{sum_price_total || 0}}</span></span>
+          </header>
+          <section class="flex-1">
+            <swiper class="screen chat-gift-swiper"
+                    :swiper-option="swiperOption"
+                    :pagination="true"
+            >
+              <swiper-item
+                  v-for="(item,index) in data"
+                  :key="'gift-'+index"
+                  class="gift-wall-item center"
+              >
+                <v-image :src="item.base_image" class="gift-wall-icon" backgroundColor="transparent"></v-image>
+                <div class="gift-wall-number line-1">{{item.sum_gift_num || 1}}</div>
+              </swiper-item>
+            </swiper>
+          </section>
+        </section>
+      </template>
+    </flat-list>
+
   </section>
 </template>
 
@@ -32,22 +42,17 @@ import {
 import props from '../props';
 import mixins from '../mixins';
 import {mapState} from "vuex";
+import FlatList from "$components/flat-list/src/main";
 export default {
   name: "gift-wall",
   components: {
+    FlatList,
     vImage,
     swiper,
     swiperItem
   },
-  computed:mapState({
-    // @ts-ignore
-    giftData:(state)=> state.gift.giftData
-  }),
   mixins,
-  props,
-  created() {
-    return this.$store.dispatch('initializationGiftPromise');
-  }
+  props
 }
 </script>
 

+ 9 - 1
src/popup/popup-detail/components/game/components/gift-wall/style.scss

@@ -35,7 +35,7 @@
   background-color: #FF56C5;
 }
 .chat-gift-swiper::v-deep .swiper-pagination{
-  bottom: -6px;
+  bottom: 2px;
 }
 
 .gift-wall-icon{
@@ -52,3 +52,11 @@
   text-align: center;
   padding: 0 10px;
 }
+
+.gift-wall-flat::v-deep .empty-title{
+  color: #666666 !important;
+}
+
+.gift-wall-flat::v-deep svg path{
+  fill: #666;
+}

+ 7 - 7
src/popup/popup-detail/mixins/handle.ts

@@ -8,6 +8,7 @@ import personalDetail from '$utils/control/personal-detail';
 
 import socket from '$utils/socket';
 import {NoticeType} from "$utils/socket/const";
+import {cache} from "$utils/request/cache";
 
 export default <LibMixins>{
 
@@ -87,12 +88,11 @@ export default <LibMixins>{
         // 关注
         followUser(){
             // 设置当前的关注状态
-            this.followStatus = this.followStatus ? 1 : 0;
-
-            personalDetail.updateCache({
-                uid: this.option.uid,
-                status: this.followStatus
-            });
+            this.followStatus = !this.followStatus;
+            // personalDetail.updateCache({
+            //     uid: this.option.uid,
+            //     status: this.followStatus
+            // });
 
             // 设置是否关注
             return this.triggerFollow();
@@ -144,6 +144,7 @@ export default <LibMixins>{
 
     beforeUnmount() {
         this.Throttle && this.Throttle.destroy();
+        cache.deleteCache('get_receive_gift_sumdata_'+this.option.uid,true);
         if(this.followStatus !== this.option.is_follow) {
             this.triggerFollowImplement();
 
@@ -153,7 +154,6 @@ export default <LibMixins>{
                 followUserInfo:this.option
             });
         }
-
     }
 
 }

+ 13 - 13
src/popup/popup-detail/mixins/watch.ts

@@ -3,18 +3,18 @@ import {NoticeType} from "$utils/socket/const";
 
 export default <LibMixins>{
 
-    created(){
-
-        socket.on('popup-detail', (data)=>{
-            if (this.option) {
-                this.option.guanming = data.naming;
-            }
-        },NoticeType.naming);
-
-    },
-
-    beforeUnmount() {
-        socket.off('popup-detail',NoticeType.naming);
-    }
+    // created(){
+    //
+    //     socket.on('popup-detail', (data)=>{
+    //         if (this.option) {
+    //             this.option.guanming = data.naming;
+    //         }
+    //     },NoticeType.naming);
+    //
+    // },
+    //
+    // beforeUnmount() {
+    //     socket.off('popup-detail',NoticeType.naming);
+    // }
 
 }

+ 5 - 2
src/popup/popup-personal/components/index.ts

@@ -18,7 +18,10 @@ export default {
     myGift: defineAsyncComponent(()=> import('./my-gift')),
 
     // 个性装扮
-    myDressUp: defineAsyncComponent(()=> import('./my-dress-up'))
+    myDressUp: defineAsyncComponent(()=> import('./my-dress-up')),
 
+    // 我的冠名
+    myNaming: defineAsyncComponent(()=> import('./my-naming'))
 
-}
+
+}

+ 2 - 1
src/popup/popup-personal/components/my-dress-up/components/dress-up-list/mixins/handle.ts

@@ -8,7 +8,8 @@ export default <LibMixins>{
                 data:{
                     type:this.type
                 },
-                token:true
+                token:true,
+                page:obj.data
             }).then((data)=>{
 
                 (data.data || []).map((item)=>{

+ 0 - 1
src/popup/popup-personal/components/my-dress-up/components/dress-up-list/src/main.vue

@@ -99,7 +99,6 @@ export default {
             this.user = resultUseData;
           }
 
-
         }
       });
     }

+ 3 - 0
src/popup/popup-personal/components/my-dress-up/components/dress-up-list/style.scss

@@ -44,4 +44,7 @@
   margin-top: 5px;
   font-weight: 400;
 }
+.dress-up-use-button-disabled{
+  opacity: 0.5;
+}
 /* 底部 */

+ 1 - 3
src/popup/popup-personal/components/my-follow/components/follow-user/mixins/handle.ts

@@ -65,8 +65,6 @@ export default <LibMixins>{
                 this.$refs.flat && this.$refs.flat.flat_delete(params.uid);
             }
 
-            personalDetail.updateCache(params);
-
         },NoticeType.follow);
     },
 
@@ -74,4 +72,4 @@ export default <LibMixins>{
         socket.off('my-follow-user',NoticeType.follow);
     }
 
-}
+}

+ 3 - 0
src/popup/popup-personal/components/my-naming/index.ts

@@ -0,0 +1,3 @@
+import main from './src/main.vue';
+
+export default main;

+ 74 - 0
src/popup/popup-personal/components/my-naming/mixins/handle.ts

@@ -0,0 +1,74 @@
+import popup from "$utils/tool/popup";
+import socket from "$utils/socket";
+import {NoticeType} from "$utils/socket/const";
+import globalUser from "$config/user";
+
+export default <LibMixins>{
+
+    data(){
+      return {
+          useId:0
+      }
+    },
+
+    methods:{
+
+        fetch(obj){
+            return this.$request({
+                url:'player/get_user_guanming_list',
+                data:{
+                  to_uid: this.user.uid,
+                },
+                token:true,
+                page:obj.data
+            }).then((data)=>{
+
+                return obj.success((data.data).map((item)=>{
+
+                    if (item.is_using === 1) {
+                        this.useId = item.id;
+                    }
+
+                    item.naming = {
+                        image: item.image,
+                        nick_name: item.nick_name
+                    }
+                    return item;
+                }));
+            });
+        },
+
+        setUseDress(item){
+            if (this.useId !== item.id) {
+
+                popup.$confirm({
+                    title:'是否使用此冠名',
+                    confirm:()=>{
+                        this.$request({
+                            url:'player/change_user_guanming',
+                            token:true,
+                            data:{
+                                id: item.id
+                            }
+                        });
+
+                        this.useId = item.id;
+
+                        // 通知更新冠名
+                        socket.triggerNotice(NoticeType.naming, {
+                            uid: item.to_uid,
+                            naming:{
+                                nick_name: item.nick_name,
+                                image: item.image
+                            }
+                        });
+
+                    }
+                })
+
+            }
+        }
+
+    }
+
+}

+ 4 - 0
src/popup/popup-personal/components/my-naming/mixins/index.ts

@@ -0,0 +1,4 @@
+import handle from './handle';
+import user from '$mixins/user';
+
+export default [handle,user];

+ 45 - 0
src/popup/popup-personal/components/my-naming/src/main.vue

@@ -0,0 +1,45 @@
+<template>
+  <section class="screen row wrap">
+    <flat-list
+        @fetch="fetch"
+        :pageSize="15"
+    >
+      <template v-slot:item="{item,index}">
+        <aside class="dress-up-item flex overflow">
+          <div class="flex-1 center">
+            <layout-naming :naming="item.naming" :nickName="user.nick_name"></layout-naming>
+          </div>
+          <footer class="dress-up-footer center">
+            <div class="dress-up-title line-1">{{item.name}}</div>
+            <div @click="setUseDress(item)" class="dress-up-use-button center button"
+                 :class="{'dress-up-use-button-disabled':useId === item.id}"
+            >{{ useId === item.id?'使用中':'使用' }}</div>
+          </footer>
+        </aside>
+      </template>
+
+    </flat-list>
+  </section>
+</template>
+
+<script>
+import {
+  FlatList,
+  vImage
+} from '$components';
+import layoutNaming from '$layout/layout-naming';
+import popup from "$utils/tool/popup";
+import {cache} from '$utils/request/cache';
+import mixins from '../mixins';
+export default {
+  name: "my-naming",
+  components:{
+    FlatList,
+    vImage,
+    layoutNaming
+  },
+  mixins
+}
+</script>
+
+<style scoped lang="scss" src="../../my-dress-up/components/dress-up-list/style.scss"></style>

+ 0 - 0
src/popup/popup-personal/components/my-naming/style.scss


+ 9 - 1
src/popup/popup-personal/data/menu.ts

@@ -34,6 +34,14 @@ export default [
         }
     },
     {
+        label:'冠名列表',
+        icon:require('../images/gift.png'),
+        component:'myNaming',
+        attrs:{
+            mode: GiftGetType.player
+        }
+    },
+    {
         label:'个性装扮',
         icon:require('../images/dress.png'),
         component:'myDressUp'
@@ -43,4 +51,4 @@ export default [
         icon:require('../images/attention.png'),
         component:"myFollow"
     }
-] as LibDataArray
+] as LibDataArray

+ 2 - 2
src/popup/popup-personal/style.scss

@@ -79,7 +79,7 @@ $popup-personal-size:200px;
 .personal-menu-item{
   width: 100%;
   height: 30px;
-  margin-top: 20px;
+  margin-top: 15px;
   font-size: 14px;
   line-height: 30px;
   cursor: pointer;
@@ -109,4 +109,4 @@ $popup-personal-size:200px;
   font-weight: bold;
   color: #C1BED5;
 }
-/* 关闭按钮 */
+/* 关闭按钮 */

+ 4 - 4
src/popup/popup-user/mixins/follow.ts

@@ -21,10 +21,10 @@ export default {
 
         toggleFollow(){
             this.control.follow = !this.control.follow;
-            personalDetail.updateCache({
-                uid: this.vItem.uid,
-                status: this.control.follow ? 1 : 0
-            },['get_room_user_info-'+this.vParams.uid+'-'+this.vParams.rid]);
+            // personalDetail.updateCache({
+            //     uid: this.vItem.uid,
+            //     status: this.control.follow ? 1 : 0
+            // },['get_room_user_info-'+this.vParams.uid+'-'+this.vParams.rid]);
 
             socket.triggerNotice(NoticeType.follow, {
                 uid: this.vItem.uid,

+ 1 - 1
src/popup/popup-user/mixins/handle.ts

@@ -98,7 +98,7 @@ export default <LibMixins>{
                     token:true,
                     cache:{
                         type: InstructionsCacheType.memory,
-                        id:'get_room_user_info-'+this.vParams.uid+'-'+this.vParams.rid
+                        id:'get_room_user_info_'+this.vParams.uid
                     },
                     next:({status})=> this.loadingStatus = status
                 }).then((data)=>{

+ 2 - 3
src/store/modules/cate.ts

@@ -10,8 +10,7 @@ export default <Module<any,any>>{
         gameCate:[],
         recommendGameCate:[],
         gameStatusCate:[],
-        roomCate:[],
-        recommendRoomCate:[]
+        roomCate:[]
     },
 
     mutations:{
@@ -200,4 +199,4 @@ export default <Module<any,any>>{
 
     }
 
-}
+}

+ 0 - 2
src/types/config.d.ts

@@ -35,7 +35,5 @@ interface Config {
 
     useRoutesName:Array<string>
 
-
-
 }
 

+ 7 - 3
src/utils/control/personal-detail/index.ts

@@ -17,11 +17,15 @@ export default {
 
     openUnique:'',
 
-    updateCache(data:Record<string, any>,ids:Array<string>=[]){
+    updateCache(data:Record<string, any>){
 
-        if (!data) return;
+        console.log(data);
 
-        ids.push('get_base_user_info-'+data.uid);
+        if (!data) return;
+        let ids = [
+            'get_base_user_info-'+data.uid,
+            'get_room_user_info_'+data.uid
+        ];
 
         ids.map((item)=> this.triggerUpdateCache(data,item));
 

+ 37 - 0
src/utils/control/update_cache/getPlayerList.ts

@@ -0,0 +1,37 @@
+import {cache} from "$utils/request/cache";
+
+export default {
+
+    updateCache(id:number|string,item:Record<string, any>,callback?:Function) {
+
+        let sign = cache.getSign('get_player_list_'+id);
+        sign && cache.getCachePromise(sign).then((cacheData)=>{
+            let cacheItem = cache.getCacheItem(cacheData);
+            if (cacheItem && cacheItem[0]) {
+                if (callback) {
+                    cacheItem = callback(cacheItem,item);
+                } else {
+                    cacheItem[0] = item;
+                }
+
+                cache.updateCache(sign,cacheData.data);
+            }
+        });
+
+    },
+
+    updateNaming(data){
+
+        return this.updateCache(data.uid,data,function (cacheItem,item) {
+
+            if (cacheItem[0] && !cacheItem[0].guanming) {
+                cacheItem[0].guanming = item.naming;
+            }
+
+            return cacheItem;
+
+        });
+
+    }
+
+}

+ 20 - 0
src/utils/request/cache/cache.ts

@@ -65,6 +65,26 @@ export default  class Cache {
 		return undefined;
 
 	}
+	// 获取缓存
+	getCachePromise(sign:string,expire:boolean = true){
+		return new Promise<Record<string, any>>((resolve, reject)=>{
+			let cacheData = this.getCache(sign,expire);
+			if (cacheData) {
+				resolve(cacheData);
+			} else {
+				reject();
+			}
+
+		});
+	}
+
+	getCacheItem(cacheData){
+		try {
+			return  cacheData.data.data.data;
+		} catch (e) {
+			return undefined;
+		}
+	}
 
 	// 设置缓存
 	setCache(sign:string,cache:InstructionsCache):InstructionsCache{

+ 93 - 35
src/utils/socket/agoraRTM/agoraRTMIM.ts

@@ -13,14 +13,16 @@ export {AgoraRTMessage,AgoraRTMIMStatus,AgoraRTPcMessage}
 
 export default class AgoraRTMIM extends Notice {
 
-    socket:any = undefined
+    static socket:any = undefined
+
+    static socketStatus:AgoraRTMIMStatus
 
     socketChannel:any = undefined
 
     constructor() {
         super();
-        if (this.socket === undefined) {
-            this.socket = AgoraRTM.createInstance(config.appKey);
+        if (AgoraRTMIM.socket === undefined) {
+            AgoraRTMIM.socket = AgoraRTM.createInstance(config.appKey);
         }
     }
 
@@ -28,28 +30,52 @@ export default class AgoraRTMIM extends Notice {
         return new Promise((resolve, reject)=>{
             this.setStatus(AgoraRTMIMStatus.loginIng);
 
-            return this.socket.login({
-                // token: user.user  && user.user.login_token || '',
-                uid: user.uid().toString()
-            }).then((data)=>{
+            if (AgoraRTMIM.socketStatus === AgoraRTMIMStatus.login) {
+                this.joinSocket(roomId,resolve, reject);
+            } else {
+
+                AgoraRTMIM.socket.on(AgoraRTMessage.userMessage,(data)=>{
 
-                this.setStatus(AgoraRTMIMStatus.joinIng);
-                this.socketChannel = this.socket.createChannel(roomId);
-                this.installSocketMessage();
-                return this.socketChannel.join().then(()=>{
-                    this.setStatus(AgoraRTMIMStatus.join);
+                    let resultData;
+                    // 解析数据
+                    try {
+                        resultData = JSON.parse(data.text);
+                    } catch (e) {
+                        resultData = {
+                            messageType: data.text
+                        };
+                    }
+
+                    this.triggerMessage(resultData,data,AgoraRTMessage.userMessage);
+                });
 
-                    return resolve(data);
+                return AgoraRTMIM.socket.login({
+                    // token: user.user  && user.user.login_token || '',
+                    uid: user.uid().toString()
+                }).then((data)=>{
+                    AgoraRTMIM.socketStatus = AgoraRTMIMStatus.login;
+                    this.joinSocket(roomId,resolve, reject);
                 }).catch(()=>{
-                    this.setStatus(AgoraRTMIMStatus.joinFail);
+                    this.setStatus(AgoraRTMIMStatus.loginFail);
                     reject();
                 });
+            }
 
+        });
+    }
 
-            }).catch(()=>{
-                this.setStatus(AgoraRTMIMStatus.loginFail);
-                reject();
-            });
+    // join
+    joinSocket(roomId,resolve, reject){
+        this.setStatus(AgoraRTMIMStatus.joinIng);
+        this.socketChannel = AgoraRTMIM.socket.createChannel(roomId);
+        this.installSocketMessage();
+        this.socketChannel.join().then(()=>{
+            this.setStatus(AgoraRTMIMStatus.join);
+
+            return resolve();
+        }).catch(()=>{
+            this.setStatus(AgoraRTMIMStatus.joinFail);
+            reject();
         });
     }
 
@@ -72,19 +98,20 @@ export default class AgoraRTMIM extends Notice {
                 resultData = {};
             }
 
+
             this.triggerMessage(resultData,data);
         });
 
     }
 
-    triggerMessage(resultData,data={}){
+    triggerMessage(resultData,data={},type=AgoraRTMessage.message){
 
         if (this.watch[resultData.messageType]) {
             resultData = this.watch[resultData.messageType](resultData);
         }
 
         // 触发 消息
-        this.triggerListener(AgoraRTMessage.message, {
+        this.triggerListener(type, {
             ...(data || {}),
             data:resultData,
             type: resultData.messageType
@@ -98,16 +125,32 @@ export default class AgoraRTMIM extends Notice {
     }
 
     watch = {
-      [AgoraRTMessage.chat]:function(item){
-
-          // 如果存在进场转换消息类型
-          if (item.star_img || item.star_play_img || item.star_entry_room) {
-              item.messageType = AgoraRTMessage.joinHome;
-          }
-
-          return item;
+      // [AgoraRTMessage.chat]:function(item){
+      //     // 如果存在进场转换消息类型
+      //     if ((item.star_img || item.star_play_img || item.star_entry_room) && item.message.indexOf('进入直播间') >= 0 ) {
+      //         item.messageType = AgoraRTMessage.joinHome;
+      //     }
+      //
+      //     return item;
+      //
+      // }
+    }
 
-      }
+    // 发送点对点消息
+    sendUser(data,type=AgoraRTMessage.chat,uid:number | string){
+        return new Promise((resolve, reject)=>{
+            if (this.status === AgoraRTMIMStatus.join) {
+                data.messageType = type;
+                if (this.sendWatch[type]) {
+                    data = this.sendWatch[type](data);
+                }
+                AgoraRTMIM.socket && AgoraRTMIM.socket.sendMessageToPeer({
+                    text:JSON.stringify(data)
+                },uid.toString()).then(resolve).catch(reject);
+            } else {
+                reject();
+            }
+        });
     }
 
     // 发送消息
@@ -128,10 +171,10 @@ export default class AgoraRTMIM extends Notice {
     }
 
     sendWatch = {
-        [AgoraRTMessage.joinHome]:function(item){
-            item.messageType = AgoraRTMessage.chat;
-            return item;
-        }
+        // [AgoraRTMessage.joinHome]:function(item){
+        //     item.messageType = AgoraRTMessage.chat;
+        //     return item;
+        // }
     }
 
     // 追加用户信息
@@ -165,6 +208,21 @@ export default class AgoraRTMIM extends Notice {
 
     }
 
+    // 追加全服消息
+    addGlobal(data,roomInfo){
+        if (data) {
+
+            data.roomInfo = {
+                id: roomInfo.rid,
+                name: roomInfo.room_name
+            }
+
+            return data;
+        }  else {
+            return data;
+        }
+    }
+
     // 追加礼物信息
     addGiftInfo(data,toGiftData){
         if (data) {
@@ -219,8 +277,8 @@ export default class AgoraRTMIM extends Notice {
     destroy() {
         super.destroy();
         this.socketChannel && this.socketChannel.leave();
-        this.socket && this.socket.logout();
-        this.socket = undefined;
+        AgoraRTMIM.socket && AgoraRTMIM.socket.logout();
+        AgoraRTMIM.socket = undefined;
         this.socketChannel = undefined;
     }
 

+ 27 - 3
src/utils/socket/agoraRTM/const/channel.ts

@@ -1,8 +1,11 @@
 enum AgoraRTMessage {
 
-    // 用户消息
+    // 全体消息
     message='ChannelMessage',
 
+    // 个人消息
+    userMessage='MessageFromPeer',
+
     // 加入频道
     join='MemberJoined',
 
@@ -19,7 +22,7 @@ enum AgoraRTMessage {
     gift='4',
 
     // 加入房间
-    joinHome='5',
+    joinHome='2',
 
     // 清空消息
     clearMessage='6',
@@ -28,7 +31,28 @@ enum AgoraRTMessage {
     userRowWheat='user-row-wheat',
 
     // 系统消息
-    system='system'
+    system='system',
+
+    // 禁言
+    forbidden='nfgk184grdgdfggdfghfhrthmkBeiJinYan',
+
+    // 解除禁言
+    unForbidden='nfgk184grdgdfggdfghfhrthmkBeiJinYan2',
+
+    // 踢出房间
+    kickOut='nfgk184grdgdfggunaliyuantichu',
+
+    // 设置管理员
+    setAdmin='nfgk184grdgdfggdfghfhrthmkShezhiguanliyuan',
+
+    // 取消管理员
+    unSetAdmin='nfgk184grdgdfggdfghfhrthmkQuxiaoiguanliyuan',
+
+    // 闭麦
+    closeWheat='nfgk184grdgdfggunaliyuanbimai',
+
+    // 开麦
+    openWheat='nfgk184grdgdfggdfghfhrthmkkaimai'
 
 }
 

+ 1 - 1
src/views/view-header/mixins/login.ts

@@ -16,7 +16,7 @@ export default <LibMixins>{
             return this.$confirm({
                 title:'您确定要退出登录吗',
                 confirm:()=>{
-                    return this.$store.dispatch('outLogin');
+                    this.$store.dispatch('outLogin');
                 }
             });
         }

+ 3 - 1
src/views/view-menu/components/view-menu-tab/src/main.vue

@@ -2,12 +2,14 @@
   <tab
     :data="data"
     v-if="data && data.length > 0"
+    :key="'use-'+data.length"
   >
     <template v-slot:header="{data,select,trigger}">
       <header class="rowACenter view-tabs-header">
         <swiper
           :swiper-option="swiperOption"
           v-if="swiper"
+
         >
           <swiper-item
               v-for="(item,index) in data"
@@ -85,4 +87,4 @@ export default {
 }
 </script>
 
-<style scoped lang="scss" src="../style.scss"></style>
+<style scoped lang="scss" src="../style.scss"></style>

+ 2 - 1
src/views/view-menu/mixins/index.ts

@@ -2,5 +2,6 @@ import trigger from '$mixins/trigger';
 import ranking from './ranking';
 import user from '$mixins/user';
 import banner from './banner';
+import cate from '$mixins/cate';
 
-export default [trigger,ranking,user,banner];
+export default [trigger,ranking,user,banner,cate];

+ 7 - 10
src/views/view-menu/src/main.vue

@@ -125,18 +125,15 @@ export default {
     }
   },
 
-  created() {
-
-    this.$store.dispatch('initializationRoomCatePromise').then(()=>{
+  watch:{
+    roomLoginCate(){
+      this.tabData[0].data = this.roomLoginCate;
+    }
+  },
 
-      this.tabData[0].data = this.$store.state.cate.roomCate.map((item,index)=>{
-        return {
-          ...item,
-          slot:'room-cate-'+index
-        }
-      });
+  created() {
 
-    });
+    this.$store.dispatch('initializationRoomCatePromise');
 
   }
 }

+ 8 - 3
src/views/view-play-with/mixins/handle.ts

@@ -4,6 +4,8 @@ import cateData from '$config/cate';
 import socket from "$utils/socket";
 import {NoticeType} from "$utils/socket/const";
 
+import getPlayerList from "$utils/control/update_cache/getPlayerList";
+
 export default <LibMixins>{
 
     data(){
@@ -26,6 +28,8 @@ export default <LibMixins>{
                 if (cateData.gameCate.object) {
                     data.data.map((item)=>{
                         item.game_name = cateData.gameCate.object[item.gid].game_name;
+
+                        getPlayerList.updateCache(item.uid,item);
                     });
                 }
 
@@ -55,11 +59,12 @@ export default <LibMixins>{
     created(){
 
         socket.on('view-play-with', (data)=>{
-            console.log(data);
             if (this.$refs.fetch) {
                 let item = this.$refs.fetch.flat_get_data(data.uid);
-                item.guanming = data.naming;
-                this.$refs.fetch.flat_update(data.uid,item);
+                if (!item.guanming) {
+                    item.guanming = data.naming;
+                    this.$refs.fetch.flat_update(data.uid,item);
+                }
             }
         },NoticeType.naming);
 

+ 2 - 1
src/views/view-room/mixins/index.ts

@@ -1,3 +1,4 @@
 import handle from './handle';
+import user from '$mixins/user';
 
-export default [handle];
+export default [handle,user];

+ 5 - 1
src/views/view-room/src/main.vue

@@ -1,9 +1,13 @@
 <template>
   <section class="view-room-container screen">
+    <div class="screen center" v-if="!$store.getters.isLogin && options.collect">
+<!--      <div class="button view-room-login">授权登录</div>-->
+    </div>
     <flat-list
       @fetch="fetch"
       indexes="rid"
       ref="flat"
+      v-else
     >
       <template v-slot:item="{item,index}">
         <aside class="view-room-item rowACenter cursor-pointer relative" @click="openDetail(item)">
@@ -47,4 +51,4 @@ export default {
 }
 </script>
 
-<style scoped lang="scss" src="../style.scss"></style>
+<style scoped lang="scss" src="../style.scss"></style>

+ 1 - 1
src/views/view-room/style.scss

@@ -51,4 +51,4 @@
 .view-room-footer{
   margin-top: 13px;
 }
-/* 房间模块样式 */
+/* 房间模块样式 */

+ 3 - 3
src/views/view-talking-cate/src/main.vue

@@ -15,7 +15,7 @@
     </aside>
     <transition name="skewHeight">
       <section v-show="value" class="absolute view-cate-container talking-view-cate-container">
-        <scroll-view v-if="roomCate">
+        <scroll-view v-if="roomLoginCate">
           <section>
             <article class="row wrap cate-all">
               <aside
@@ -23,7 +23,7 @@
                   :class="{'cate-item-select': item.tid === useCheckedId}"
                   :key="'view-cate-'+item.tid"
                   @click="triggerItem(item)"
-                  v-for="(item,index) in roomCate"
+                  v-for="(item,index) in roomLoginCate"
               >
                 <v-image mode="center" backgroundColor="transparent"
                    class="cate-all-icon"
@@ -139,4 +139,4 @@ export default {
 }
 </script>
 
-<style scoped lang="scss" src="../style.scss"></style>
+<style scoped lang="scss" src="../style.scss"></style>