uni-im-msg-list.vue 22.5 KB
Newer Older
DCloud_JSON's avatar
DCloud_JSON 已提交
1
<template>
2 3 4 5 6
  <view class="uni-im-msg-list-root">
    <uni-im-list class="uni-im-list" :scrollTop="scrollTop"
      :scroll-into-view="scrollIntoView" ref="uni-im-list"
      @scroll="onScroll" @scrolltolower="onScrollToLower"
    >
7
     <template v-for="(msg,index) in visibleMsgList" :key="msg.unique_id || msg._id">
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
       <view class="uni-im-list-item" :ref="'item-'+index">
         <view v-if="index === 0" class="data-state-tip-box">
           <uni-im-load-state :status="hasMore?'loading':'noMore'" 
              :contentText='{"contentrefresh": "正在加载历史消息","contentnomore": "没有更多历史消息"}'></uni-im-load-state>
         </view>
         <view :class="['item',msg.type]" :id="'item-'+index" @click="clickItem">
           <label class="msg-box" :class="{'active-msg':msg._id === activeMsgId || msg.unique_id === activeMsgId}" @click="checkMsg(msg)">
             <template v-if="chooseMore">
              <checkbox :checked="checkedMsgList.find(i=>i._id == msg._id) != undefined" class="checkbox" />
              <view class="mask"></view>
             </template>
             <!-- <text style="width: 750rpx;text-align: center;border: 1px solid #000;">{{'item-'+index}}</text> -->
             <uni-im-msg :msg="msg" :id="msg._id" :self="current_uid() == msg.from_uid" :index="index"
             @putChatInputContent="putChatInputContent" :equalPrevTime="equalPrevTime(index)" 
             :avatar_file="conversation.avatar_file" @showMsgById="showMsgById" @showControl="showControl" 
             @loadMore="loadMore" @longpressMsgAvatar="longpressMsgAvatar" @retriesSendMsg="retriesSendMsg" 
             @viewMsg="viewMsg" :ref="'uni-im-msg'" class="uni-im-msg"
             >
             </uni-im-msg>
           </label>
         </view>
       </view>
DCloud_JSON's avatar
DCloud_JSON 已提交
30
     </template>
31
     <uni-im-load-state v-if="visibleMsgList.length === 0" :status="hasMore?'loading':'noMore'" class="uni-im-list-item" :contentText='{"contentrefresh": "加载中","contentnomore": "- 没有聊天记录 -"}'></uni-im-load-state>
DCloud_JSON's avatar
DCloud_JSON 已提交
32
    </uni-im-list>
33 34 35 36 37 38 39 40 41 42 43 44 45
    
    <view v-if="hasNewMsg" class="new-msg-bar" @click="showLast">
      <uni-icons type="pulldown" size="18" color="#007fff"></uni-icons>
      <text>有新消息</text>
    </view>
    
    <view style="position: fixed;top: 100px;width: 500rpx;">
      <!-- hasNewMsg:{{hasNewMsg}} -->
      <!-- scrollTop:{{scrollTop}} -->
      <!-- scrollIntoView:{{scrollIntoView}}
			visibleMsgList.length:{{visibleMsgList.length}} -->
			<!-- <button @click="showLast">showLast</button> -->
		</view>
DCloud_JSON's avatar
DCloud_JSON 已提交
46 47 48

    <view v-if="call_list.length" class="showCallMe" @click="showCallMe">@回复我({{call_list.length}})</view>

49
    <uni-popup @change="$event.show?'':closeGroupNotification()" ref="group-notification-popup" type="center" class="group-notification-popup">
DCloud_JSON's avatar
DCloud_JSON 已提交
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
      <uni-im-group-notification ref="group-notification"></uni-im-group-notification>
    </uni-popup>

    <uni-im-view-msg ref="view-msg"></uni-im-view-msg>
  </view>
</template>

<script>
/**
 * uni-im-msg-list 组件,渲染一个会话列表。
 * 
 * 内部使用 {@link module:uni-im-list} 组件实现列表功能,使用 {@link module:uni-im-msg} 组件实现每条消息的渲染。
 * 
 * @module
 * @see module:chat
 * @see module:uni-im-list
 */
  import uniIm from '@/uni_modules/uni-im/sdk/index.js';
  import {
    store as uniIdStore
  } from '@/uni_modules/uni-id-pages/common/store';

  import uniImList from './components/uni-im-list/uni-im-list';

  // 一页多少条数据
  let pageLimit = 30
  // 当前页面滚动条高度
  let currentScrollTop = 0
  
  let appearObj = {};

  export default {
    components: {
83
      uniImList
DCloud_JSON's avatar
DCloud_JSON 已提交
84
    },
85
    emits:['checkedMsgList','longpressMsgAvatar','showControl','clickItem','retriesSendMsg','putChatInputContent'],
DCloud_JSON's avatar
DCloud_JSON 已提交
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
    computed: {
      ...uniIm.mapState(['systemInfo', 'isWidescreen']),
      loadState() {
        return this.hasMore ? '正在加载历史消息' : '没有更多历史消息'
      },
      hasMore() {
        return this.conversation.hasMore
      },
      visibleMsgList() {
        const msgList = this.conversation.msgList || []
        // 过滤掉,撤回消息的指令型消息 、 群头像更新(指令型)消息
        const visibleMsgList = uniIm.utils.filterMsgList(msgList)
        // 返回倒数 laterRenderIndex 条消息,实现懒渲染
                                    .slice(-this.laterRenderIndex)
        this.$nextTick(() => {
101
          uniIm.utils.throttle(this.setIntersectionObserver, 3000);
DCloud_JSON's avatar
DCloud_JSON 已提交
102 103 104 105 106 107
        })
        return visibleMsgList
      }
    },
    data() {
      return {
108
        conversation: {
109
          hasMore: true,
110 111 112 113 114
          has_unread_group_notification: false,
          group_info: {
            notification: false
          }
        },
DCloud_JSON's avatar
DCloud_JSON 已提交
115 116 117 118 119 120
        scrollIntoView: "",
        scrollTop: 0,
        hasNewMsg: false,
        call_list: [],
        activeMsgId: "",
        loadMoreIng: false,
121
        // 延迟渲染,避免页面卡顿
DCloud_JSON's avatar
DCloud_JSON 已提交
122 123 124 125 126 127 128
        laterRenderIndex: pageLimit
      }
    },
    watch: {
      'conversation.call_list'(call_list) {
        this.call_list = call_list
      },
129 130 131
      'conversation.has_unread_group_notification': {
        async handler(hasUnreadGroupNotification) {
          const group_notification = this.conversation?.group_info?.notification
132
          const conversation_id = this.conversationId
DCloud_JSON's avatar
DCloud_JSON 已提交
133
          // 弹出群公告
134 135
          if (hasUnreadGroupNotification && group_notification && group_notification.content) {
            await uniIm.utils.sleep(1000)
136 137 138 139
            // TODO 临时解决,公告还没弹出来就切换会话,导致弹出多次
            if(conversation_id !== this.conversationId){
              return
            }
DCloud_JSON's avatar
DCloud_JSON 已提交
140 141 142
            // 判断列表中是否已经渲染了此群公告,是则 call 当前用户。否则弹框提示
            let groupNotificationMsg = [...this.visibleMsgList].reverse().find(msg => msg.action ===
              'update-group-info-notification')
143
            // console.log('groupNotificationMsg', groupNotificationMsg,this.visibleMsgList);
144
            
DCloud_JSON's avatar
DCloud_JSON 已提交
145 146
            if (groupNotificationMsg) {
              this.conversation.call_list.push(groupNotificationMsg._id)
147
              this.closeGroupNotification()
DCloud_JSON's avatar
DCloud_JSON 已提交
148 149 150
            } else {
              this.$refs["group-notification-popup"].open()
              this.$nextTick(() => {
151
                this.$refs["group-notification"].notification = group_notification
DCloud_JSON's avatar
DCloud_JSON 已提交
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
              })
            }
          }
        },
        immediate: true
      }
    },
    props: {
      conversationId: {
        default () {
          return false
        }
      },
      chooseMore: {
        default: false
      },
      checkedMsgList: {
        default () {
          return []
        }
      }
    },
    async mounted() {
      // for (var i = 0; i < 10; i++) {
      // 	this.msgList.unshift({
      // 		t:i
      // 	})
      // }
180
      //
DCloud_JSON's avatar
DCloud_JSON 已提交
181 182 183
    },
    destroyed() {
      // console.log('destroyed')
184 185
      if (this.intersectionObserver){
        this.intersectionObserver.disconnect()
DCloud_JSON's avatar
DCloud_JSON 已提交
186 187 188 189
      }
    },
    methods: {
      async init() {
190 191
        if (this.intersectionObserver){
          this.intersectionObserver.disconnect()
DCloud_JSON's avatar
DCloud_JSON 已提交
192 193 194 195 196 197
        }
        this.conversation = await uniIm.conversation.get(this.conversationId)
        // init data --start
        this.scrollIntoView = ''
        this.scrollTop = 0
        currentScrollTop = 0
198
        this.laterRenderIndex = pageLimit
DCloud_JSON's avatar
DCloud_JSON 已提交
199 200 201 202 203 204 205 206 207 208 209

        if (!this.conversation.isInit) {
          this.conversation.hasMore = true
          await this.loadMore()
          this.conversation.isInit = true
          if (this.conversation.hasMore && this.visibleMsgList.length < pageLimit) {
            console.log('不满一屏时,再loadMore一次');
            await this.loadMore()
          }
        }

210 211 212 213 214 215 216 217 218
        if(this.isWidescreen){
          this.$nextTick(()=>{
            this.showLast()
            // TODO:未知原因,部分情况下 $nextTick时机执行不能定位到最后一条,需要用setTimeout 500再次定位
            setTimeout(() => {
              this.showLast()
            },500)
          })
        }
DCloud_JSON's avatar
DCloud_JSON 已提交
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249
      },
      async loadMore(callback) {
        let datas = []
        if(this.laterRenderIndex < this.conversation.msgList.length){
          let oldVisibleMsgList = JSON.parse(JSON.stringify(this.visibleMsgList))
          await this.canHoldScrollDo(()=>{
            this.laterRenderIndex += pageLimit
          })
          await this.$nextTick()
          // 新加载到的数据为:oldVisibleMsgList和this.visibleMsgList的差集
          datas = this.visibleMsgList.filter(i => !oldVisibleMsgList.some(j => j._id == i._id))
          // console.log('beforeLoadMore 懒渲染=>',this.laterRenderIndex,this.conversation.msgList.length);
        }else{
          datas = await this.conversation.msgManager.getHistory()
          // console.error(`加载到${datas.length}条,历史聊天数据`);
          // console.log('加载到历史聊天数据:', datas);
          if (datas.length === 0) {
            this.conversation.hasMore = false
          } else {
            await this.insertMsg(datas)
          }
        }
        if (typeof callback === 'function') {
          // 为兼容 web pc端特殊场景 不能使用$nextTick
          setTimeout(() => {
            callback(datas)
          }, 0)
        }
        return datas
      },
      async beforeLoadMore() {
250
        if (!this.loadMoreIng && this.hasMore) {
DCloud_JSON's avatar
DCloud_JSON 已提交
251 252 253 254 255 256 257 258 259 260 261
          this.loadMoreIng = true
          await this.loadMore()
          this.loadMoreIng = false
        }
      },
      msgOnAppear(msgId){
        uniIm.utils.throttle(()=>{
          let index = this.visibleMsgList.findIndex(i => i._id == msgId)
          if (index == -1) {
            return //因为是异步的,可能已经被销毁了替换了新对象
          }
262
          // console.log('msgOnAppear',index);
DCloud_JSON's avatar
DCloud_JSON 已提交
263 264 265 266
        }, 1000);
      },
      async setIntersectionObserver() {
        // console.log('setIntersectionObserver');
267 268 269
        if (this.intersectionObserver) {
          // console.log('this.intersectionObserver存在','执行销毁');
          this.intersectionObserver.disconnect()
DCloud_JSON's avatar
DCloud_JSON 已提交
270
        }
271 272 273 274 275
        
        await uniIm.utils.sleep(1000)
        
        this.intersectionObserver = uni.createIntersectionObserver(this, { observeAll: true })
          .relativeTo('.uni-im-list', {})
DCloud_JSON's avatar
DCloud_JSON 已提交
276 277 278 279
          .observe('.uni-im-msg', (res) => {
            const msgId = res.id
            const msgRef = this.$refs['uni-im-msg'].find(item => item.msg._id == msgId)
            if (!msgRef) {
280
              // console.error('找不到msgRef,或会话已切走', msgId);
DCloud_JSON's avatar
DCloud_JSON 已提交
281 282
              return
            }
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299
            
            // hasBeenDisplayed表示是否已经显示过了
            const hasBeenDisplayed = appearObj[msgId] || false;
            // 新显示的
            const isAppear = res.intersectionRatio > 0 && !hasBeenDisplayed
            
            
            // 是否为最后一条消息
            const isLastMsg = [...this.visibleMsgList].pop()?._id === msgId
            if(isLastMsg){
              this.lastMsgIsShow = isAppear
              if(this.lastMsgIsShow){
                this.hasNewMsg = false
              }
            }
            
            if (isAppear) {
DCloud_JSON's avatar
DCloud_JSON 已提交
300 301 302
              appearObj[msgId] = true;
              msgRef.onAppear()
              this.msgOnAppear(msgId)
303
              
DCloud_JSON's avatar
DCloud_JSON 已提交
304
              // console.error('出现了',msgRef.msg.body)
305 306 307 308 309 310
              const isFirstMsg = this.visibleMsgList[0]?._id === msgId
              // 是否为第一个消息
              if (isFirstMsg) {
                // console.log('第一个消息出现在视窗内,加载更多',this.visibleMsgList[0]?._id , msgId);
                this.beforeLoadMore()
              }
DCloud_JSON's avatar
DCloud_JSON 已提交
311 312 313 314 315
              // 调用扩展点,通知消息列表某条消息进入显示区。
              uniIm.extensions.invokeExts('msg-appear', msgRef.msg, {
                user_id: uniCloud.getCurrentUserInfo().uid,
                isInternalUser: this.uniIDHasRole('staff'),
              })
316
            } else if (!res.intersectionRatio > 0 && hasBeenDisplayed) {
DCloud_JSON's avatar
DCloud_JSON 已提交
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331
              appearObj[msgId] = false;
              msgRef.onDisappear()
              // console.error('消失了',msgRef.msg.body)
              // 调用扩展点,通知消息列表某条消息离开显示区。
              uniIm.extensions.invokeExts('msg-disappear', msgRef.msg, {
                user_id: uniCloud.getCurrentUserInfo().uid,
                isInternalUser: this.uniIDHasRole('staff'),
              })
            }
          })
      },
      viewMsg(msgList) {
        this.$refs['view-msg'].open(msgList);
      },
      async onScroll(e) {
332 333 334 335 336
        // 记录当前滚动条高度
        currentScrollTop = e.detail.scrollTop
        // console.log('onScroll', e.detail.scrollTop)
        
        // TODO:滚动停止后,将end置为true
DCloud_JSON's avatar
DCloud_JSON 已提交
337 338 339 340 341 342 343 344 345 346 347
        this.onScroll.end = false
        if (this.onScroll.timeoutId) {
          clearTimeout(this.onScroll.timeoutId)
        }
        this.onScroll.timeoutId = setTimeout(() => {
          this.onScroll.end = true
        }, 500)
      },
      async onScrollToLower() {
      },
      async canHoldScrollDo(fn){
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367
        /**
         * 解决web-pc端,部分情况下插入消息滚动内容会跳动的问题
         */
        // #ifdef H5
        if(this.isWidescreen){
          if(this.systemInfo.browserName === "chrome"){
            // console.error('currentScrollTop',currentScrollTop)
            if(currentScrollTop === 0 && this.visibleMsgList.length != 0){
              this.scrollTop = currentScrollTop
              currentScrollTop += 1
              await this.$nextTick(()=>this.scrollTop = currentScrollTop)
              
              if(!this.canHoldScrollDo.tryIndex){
                this.canHoldScrollDo.tryIndex = 1
              }else{
                this.canHoldScrollDo.tryIndex ++
              }
              
              if(this.canHoldScrollDo.tryIndex > 100){
                console.error('canHoldScrollDo tryIndex > 100')
DCloud_JSON's avatar
DCloud_JSON 已提交
368
                fn()
369 370
              }else{
                this.$nextTick(()=>this.canHoldScrollDo(fn))
DCloud_JSON's avatar
DCloud_JSON 已提交
371
              }
372 373
            }else{
              fn()
DCloud_JSON's avatar
DCloud_JSON 已提交
374
            }
375 376 377 378 379 380 381 382 383 384 385
          }else{
            const getScrollContentHeight = ()=>document.querySelector('.scroll-content').offsetHeight
            let scrollContent = getScrollContentHeight()
            fn()
            this.$nextTick(()=>{
              const diff = getScrollContentHeight() - scrollContent
              console.error( diff, diff)
              this.scrollTop = currentScrollTop
              currentScrollTop += diff
              this.$nextTick(()=> this.scrollTop = currentScrollTop)
            })
DCloud_JSON's avatar
DCloud_JSON 已提交
386
          }
387 388 389 390
          return
        }
        // #endif
        fn()
DCloud_JSON's avatar
DCloud_JSON 已提交
391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417
      },
      async insertMsg(data) {
        // 重新获取会话对象,防止web pc端 切换太快引起的会话对象指向错误
        const conversation = await uniIm.conversation.get(data[0].conversation_id)
        this.canHoldScrollDo(()=>{
          conversation.msgList.unshift(...data)
          // 有新消息插入laterRenderIndex的值重新设置
          this.laterRenderIndex += data.length
        })
      },
      equalPrevTime(index) {
        if (index === 0) {
          return false
        } else if (index == this.visibleMsgList.length - 1) {
          return false
        } else {
          const getFriendlyTime = (msg) => {
            return uniIm.utils.toFriendlyTime(msg.create_time || msg.client_create_time)
          }
          return getFriendlyTime(this.visibleMsgList[index]) == getFriendlyTime(this.visibleMsgList[index - 1])
        }
      },
      async showCallMe() {
        let msgId = this.conversation.call_list.pop()
        console.log('msgId', msgId)
        this.showMsgById(msgId)
      },
418
      showLast() {
DCloud_JSON's avatar
DCloud_JSON 已提交
419
        let mLength = this.visibleMsgList.length
420
        this.showMsgByIndex(mLength - 1)
DCloud_JSON's avatar
DCloud_JSON 已提交
421 422 423 424
        this.hasNewMsg = false
      },
      notifyNewMsg() {
        this.hasNewMsg = true
425 426
        // 如果当前在底部,则自动显示最新消息
        if (this.lastMsgIsShow) {
DCloud_JSON's avatar
DCloud_JSON 已提交
427 428 429
          this.showLast()
        }
      },
430
      async getElInfo(select){
DCloud_JSON's avatar
DCloud_JSON 已提交
431 432
        return await new Promise((resolve, rejece) => {
          const query = uni.createSelectorQuery().in(this);
433
          query.select(select).boundingClientRect(data => {
DCloud_JSON's avatar
DCloud_JSON 已提交
434
            if (!data) {
435 436
              console.log('找不到 showMsgByIndex' + select);
              return rejece(false)
DCloud_JSON's avatar
DCloud_JSON 已提交
437
            }
438
            resolve(data)
DCloud_JSON's avatar
DCloud_JSON 已提交
439 440 441
          }).exec()
        })
      },
442
      async showMsgByIndex(index) {
DCloud_JSON's avatar
DCloud_JSON 已提交
443 444 445
        if (index == -1) {
          return
        }
446 447 448 449 450 451 452 453 454
        const listHeight = (await this.getElInfo('.uni-im-list')).height
        const targetInfo = await this.getElInfo('#item-' + index)
        const itemScrollTop = targetInfo.top
        // console.error('currentScrollTop',currentScrollTop)
        // console.error('itemScrollTop',itemScrollTop,listHeight,currentScrollTop,index)
        let val = 0;
        let m = listHeight - targetInfo.height
        if(m < 0){
          m = 10
DCloud_JSON's avatar
DCloud_JSON 已提交
455
        }
456 457 458 459 460 461 462
         if(this.isWidescreen){
           val = itemScrollTop + currentScrollTop - 0.5 * m
         }else{
           val = itemScrollTop * -1 + currentScrollTop + 0.3 * m
         }
        
        // console.error('val',val)
DCloud_JSON's avatar
DCloud_JSON 已提交
463 464 465 466 467 468
        // 赋值为当前滚动条的高度
        this.scrollTop = currentScrollTop
        // 设置一个新值触发视图更新 -> 滚动
        this.$nextTick(async () => {
          this.scrollTop = val
          currentScrollTop = val
469
          // console.error('currentScrollTop',currentScrollTop)
DCloud_JSON's avatar
DCloud_JSON 已提交
470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494
        })
      },
      async showMsgById(msgId) {
        // 找到消息的索引
        let index = this.visibleMsgList.findIndex(i => i._id == msgId)
        if (index === -1) {
          // 如果找不到,先加载更多,再找
          uni.showLoading();
          const {_findIndex} = this.showMsgById
          if (!_findIndex) {
            this.showMsgById._findIndex = 0
          } else if (_findIndex > 30) {
            uni.hideLoading()
            this.showMsgById._findIndex = false
            return console.error('防止特殊情况下死循环,不加载30屏以外的引用数据');
          }
          this.showMsgById._findIndex++
          await this.loadMore()
          this.showMsgById._findIndex = false
          await uniIm.utils.sleep(300)
          uni.hideLoading()
          return await this.showMsgById(msgId)
        }
        
        this.activeMsgId = msgId
495 496 497 498
        if(this.showMsgActiveColorActionT){
          clearTimeout(this.showMsgActiveColorActionT)
        }
        this.showMsgActiveColorActionT = setTimeout(() => {
DCloud_JSON's avatar
DCloud_JSON 已提交
499 500 501 502 503 504
          this.activeMsgId = ''
        }, 2000);
        this.showMsgByIndex(index)

        // 如果是显示群公告,则设置未读的群公告内容为 false
        if (this.visibleMsgList[index].action === "update-group-info-notification") {
505
          this.closeGroupNotification()
DCloud_JSON's avatar
DCloud_JSON 已提交
506 507 508
        }

      },
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526
      closeGroupNotification() {
        // console.log('######关闭群公告',this.conversationId)
        
        const db = uniCloud.database();
        
        db.collection('uni-im-conversation')
        .where({
          id:this.conversationId,
          user_id: uniCloud.getCurrentUserInfo().uid
        })
        .update({
          has_unread_group_notification: false
        }).then(res => {
          this.conversation.has_unread_group_notification = false
          // console.log('关闭群公告成功', res)
        }).catch(err => {
          console.error('关闭群公告失败', err)
        })
DCloud_JSON's avatar
DCloud_JSON 已提交
527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549
      },
      isChecked(msg) {
        return this.checkedMsgList.some(i => i._id === msg._id)
      },
      checkMsg(msg) {
        if (!this.chooseMore) {
          return
        }
        let checkedMsgList = this.checkedMsgList
        if (this.isChecked(msg)) {
          checkedMsgList.splice(checkedMsgList.findIndex(i => i._id === msg._id), 1)
        } else {
          checkedMsgList.push(msg)
        }
        this.$emit('update:checkedMsgList', checkedMsgList)
      },
      //当前用户自己的uid
      current_uid() {
        return uniCloud.getCurrentUserInfo().uid;
      },
      showControl(e) {
        this.$emit('showControl', e)
      },
550 551
      longpressMsgAvatar(e) {
        this.$emit('longpressMsgAvatar', e)
DCloud_JSON's avatar
DCloud_JSON 已提交
552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567
      },
      retriesSendMsg(e) {
        this.$emit('retriesSendMsg', e)
      },
      clickItem() {
        this.$emit('clickItem')
      },
      putChatInputContent(msgBody) {
        this.$emit('putChatInputContent', msgBody)
      }
    }
  }

</script>

<style lang="scss" scoped>
568
  .uni-im-msg-list-root,
DCloud_JSON's avatar
DCloud_JSON 已提交
569 570
  .uni-im-list {
    background-color: transparent;
571
    height: 100%;
DCloud_JSON's avatar
DCloud_JSON 已提交
572
  }
573 574 575 576 577 578 579 580 581 582 583 584 585
  
  .uni-im-list-item {
    transform: scale(1, -1);
  }
  /* #ifdef H5 */
  @media screen and (min-device-width:960px) {
    .uni-im-list-item {
       // 关闭上下翻转
       transform: scale(1, 1);
     }
  }
  /* #endif */
  
DCloud_JSON's avatar
DCloud_JSON 已提交
586 587 588 589 590

  .item {
	  margin:10px 0;
    // border: solid 1px #0055ff;
  }
591 592
  .uni-im-list-item .system .checkbox {
    display: none;
DCloud_JSON's avatar
DCloud_JSON 已提交
593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678
  }

  .data-state-tip-box {
    // height: 35px;
    align-items: center;
    justify-content: center;
    flex-direction: row;
    color: #999999;
    margin-bottom: -5px;
    margin-top: 10px;
  }

  .data-state-tip-text {
    height: 36px;
    line-height: 36px;
    font-size: 12px;
    margin: 0 5px;
    color: #999999;
  }

  /* #ifdef H5 */
  .loadMore-btn {
    font-size: 14px;
    color: #666;
  }

  .loadMore-btn::after {
    display: none;
  }

  /* #endif */
  .msg-box {
    position: relative;
    transition-property: background-color;
    transition-duration: 2s;
    flex-direction: row;
  }

  .msg-box .checkbox {
    margin: 30px 0 0 10px;
    // transform: translateX(20px);
  }

  .msg-box .mask {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 999;
    width: 100%;
    height: 100%;
  }

  .active-msg {
    background-color: #f9f9f9;
  }

  .showCallMe {
    background-color: #62caf8;
    border-radius: 50px;
    padding: 2px 15px;
    font-size: 12px;
    color: #FFF;
    position: fixed;
    right: 5px;
    top: 10px;
    /* #ifdef H5 */
    top: 55px;
    cursor: pointer;

    @media screen and (min-device-width:960px) {
      top: calc(7vh + 20px);
      right: 30px;
      font-size: 16px;
    }

    /* #endif */
  }

  .group-notification-popup {
    z-index: 9999;
  }

  .new-msg-bar {
    position: absolute;
    display: flex;
    flex-direction: row;
DCloud_JSON's avatar
DCloud_JSON 已提交
679
    align-items: flex-start;
680
    right: 40px;
DCloud_JSON's avatar
DCloud_JSON 已提交
681 682 683
    bottom: 10px;
    font-size: 12px;
    background-color: white;
684
    color: #007fff;
DCloud_JSON's avatar
DCloud_JSON 已提交
685
    padding: 5px 8px 5px 5px;
686
    border-radius: 15px 15px 15px 15px;
DCloud_JSON's avatar
DCloud_JSON 已提交
687 688 689 690 691 692
    /* #ifdef H5 */
    pointer-events: auto;
    cursor: pointer;
    /* #endif */
  }
</style>