智慧保安互联网APP
zengh
2022-06-21 4efeb31d5b4921d7e851c256009486ad86bc70e2
components/submit/submit.vue
@@ -3,7 +3,7 @@
      <view class="submit">
         <view class="submit-chat">
            <view class="bt-img">
               <image src="../../static/images/chatroom/voice.png" mode="" @tap="records" />
               <image :src="audio" mode="" @tap="records" />
            </view>
            <textarea auto-height="true" class="chat-send btn" :class="{displaynone: isrecord}" @input="inputs"
               v-model="msg" @focus="focus" />
@@ -76,7 +76,7 @@
   const recorderManager = uni.getRecorderManager()
   export default {
      props: ['names'],
      props: ['names','callname'],
      data() {
         return {
            isrecord: false,
@@ -87,7 +87,11 @@
            timer: '',
            vlength: 0,
            pageY: 0,
            audio: "../../static/start-audio.png"
         };
      },
      mounted() {
         console.log(this.callname,1111)
      },
      components: {
         emoji,
@@ -102,12 +106,19 @@
         },
         // 点击切换音频
         records() {
            if (this.audio == "../../static/start-audio.png") {
               this.audio = "../../static/start-input.png"
            } else {
               this.audio = "../../static/start-audio.png"
            }
            this.isrecord = !this.isrecord
            this.isemoji = false
            this.ismore = false
            setTimeout(() => {
               this._getElementHeight()
            }, 10)
         },
         // 点击弹出表情
         emoji() {
@@ -167,10 +178,12 @@
         },
         // 发送消息
         send(msg, type) {
            let data = {
               message: msg,
               types: type
            }
            this.$emit('inputs', data)
            setTimeout(() => {
               this.msg = ''
@@ -248,7 +261,6 @@
                     latitude: res.latitude,
                     longitude: res.longitude
                  }
                  this.send(data, 3)
                  console.log('位置名称' + res.name)
                  console.log('详细地址' + res.address)
                  console.log('维度' + res.latitude)
@@ -259,6 +271,9 @@
         //开始音频
         openAudio(val) { //Mains
            // console.log(this.names)
            // var socketOpen = false;
            uni.navigateTo({
               url: '../videoCall/videoCall?state=' + val + '&type=audio'
            });
@@ -271,17 +286,38 @@
         },
         //开始视频
         openVideo(val) { //Mains
            // uni.onSocketOpen(function(res) {
            //    // socketOpen = true;
            //    console.log('持续连接成功')
            //    sendSocketMessage();
            // });
            // function sendSocketMessage() {
            //    var data = {
            //       name: this.$store.state.puserName,
            //       id: this.names[1],
            //       // id: state.puserID,
            //       type: 'video'
            //    }
            //    // if (socketOpen) {
            //    uni.sendSocketMessage({
            //       data: JSON.stringify(data)
            //    });
            //    // }
            // }
            var url = '../videoCall/videoCall?state=' + val + '&type=video' + '&myname=' + this.names[0] +
                  '&toname=' + this.names[1] + '&callname=' + this.callname
         console.log(url)
            uni.navigateTo({
               url: '../videoCall/videoCall?state=' + val + '&type=video' + '&myname=' + this.names[0] +
                  '&toname=' + this.names[1]
               url: url
            });
         },
         //接收视频
         receiveVideo(val, room) { //Receiver
            uni.navigateTo({
               url: '../videoCall/videoCall?state=' + val + '&type=video' + '&room=' + room
            });
         }
         // receiveVideo(val, room) { //Receiver
         //    uni.navigateTo({
         //       url: '../videoCall/videoCall?state=' + val + '&type=video' + '&room=' + room
         //    });
         // }
      },
      mounted() {
         // uni.onSocketMessage(function(res) {