智慧保安互联网APP
zengh
2022-06-21 4efeb31d5b4921d7e851c256009486ad86bc70e2
pages/groupChat/chating.vue
@@ -3,12 +3,12 @@
      <!-- 头部 -->
      <u-navbar style="position: relative;" :is-fixed="false" :border-bottom="true" :is-back="true" :title="recName"
         back-icon-color="#fff" :background="{ background: '#0BB9C8' }" title-color="#fff">
         back-icon-color="#fff" :background="{ background: '#0BB9C8' }" :placeholder="true" title-color="#fff">
         <view slot='right'>
         <!--    <view slot='right'>
            <u-icon @click="chatMessageDetail" class="set-icon" name="more-dot-fill" color="#fff" size="28">
            </u-icon>
         </view>
         </view> -->
      </u-navbar>
@@ -36,7 +36,7 @@
                  </view>
                  <!-- voice -->
                  <view class="message" v-if="item.messageType == 2">
                     <view class="msg-text voice" :style="{width:item.postMessage.time * 4 + 50 + 'px'}"
                     <view class="msg-text voice" :style="{width:item.postMessage.time * 4 + 60 + 'px'}"
                        @tap="playVoice(item.postMessage)">
                        <image src="../../static/images/chatroom/sound.png" mode="" class="voice-img" />
@@ -66,7 +66,7 @@
                  </view>
                  <!-- voice -->
                  <view class="message" v-if="item.messageType == 2">
                     <view class="msg-text voice" :style="{width:item.postMessage.time * 4 + 50 + 'px'}"
                     <view class="msg-text voice" :style="{width:item.postMessage.time * 4 + 60 + 'px'}"
                        @tap="playVoice(item.postMessage)">
                        {{ item.postMessage.time }}"
                        <image src="@/static/images/chatroom/sound.png" mode="" class="voice-img" />
@@ -140,12 +140,10 @@
         if (this.isJSON(option.data) == true) {
            data = JSON.parse(option.data)
         }
         console.log(data, 55555555555555555555555)
         this.name = ['wo', option.chatID];
         // console.log(data)
         if (typeof data.recipientName == "undefined") {
            this.callName = data.realName;
         } else {
@@ -158,7 +156,6 @@
         let that = this;
         uni.getSystemInfo({
            success(e) {
               // console.log(e);
               let {
                  windowWidth,
                  windowHeight,
@@ -175,6 +172,12 @@
                  .exec();
            }
         });
      },
      onUnload() {
         var innerAudioContext = this.innerAudioContext = uni.createInnerAudioContext()
         innerAudioContext.destroy()
      },
      methods: {
@@ -247,6 +250,7 @@
                        that.recAvatar = resdata[i].avatar;
                        that.recName = resdata[i].realName;
                     }
                  }
                  let msg = res.data.data.chatRecordsIPage
                  that.getData = msg;
@@ -282,6 +286,7 @@
                     }
                     that.msgs.unshift(msg[i])
                  }
                  that.$nextTick(() => {
@@ -346,7 +351,6 @@
         },
         // 音频播放
         playVoice(e) {
            console.log(e, 'ok')
            var innerAudioContext = this.innerAudioContext = uni.createInnerAudioContext()
            // innerAudioContext.autoplay = false
@@ -360,9 +364,6 @@
         },
         // 接收输入内容
         inputs(e) {
            console.log(e, 999)
            var that = this;
            this.isanimation = true
            let len = this.msgs.length - 1
@@ -390,7 +391,6 @@
               mesagess = e.message
            }
            uni.request({
               url: this.$store.state.piAPI + "/chat-records/insertSingleChat",
               method: "post",
@@ -404,12 +404,14 @@
               },
               success: (res) => {
                  console.log(res, 89898)
               }
            });
            this.msgs.push(sendMsg)
            console.log(this.msgs, 789)
            this.$nextTick(() => {
               this.scrollToView = 'msg' + len
            })
@@ -421,7 +423,6 @@
         heights(e) {
            this.inputh = e
            this.goBottom()
            // console.log('高度' + e)
         },
         // 滚动到底部
         goBottom() {