智慧保安互联网APP
liuyg
2021-08-12 f4a4c7709e09bb7c31f802ea8187d1e117efda2b
pages/videoCall/videoCall.nvue
@@ -4,7 +4,7 @@
      <view class="index" v-if="!videoShow">
         <view class="Mains" v-if="isMain">
            <view class="Mains-t">
               <text class="activetext">正在呼叫{{MainName}}</text>
               <text class="activetext">正在呼叫{{toName}}</text>
               <u-loading size="36" mode="flower"></u-loading>
            </view>
            <!-- 挂断 -->
@@ -15,7 +15,8 @@
         </view>
         <view class="Receiver" v-if="!isMain">
            <view class="Mains-t">
               <text class="activetext">是否接收来自{{userName}}的视频请求</text>
               <text class="activetext">是否接收来自{{formName}}的{{Otype}}请求</text>
               <text class="activetext">接受进入{{channel}}</text>
               <u-loading size="36" mode="flower"></u-loading>
            </view>
            <view class="i-control">
@@ -34,7 +35,7 @@
      </view>
      <!-- 视频 -->
      <view class="vedioWatch" v-else>
      <view class="vedioWatch" v-if="videoShow && Otype == 'video'">
         <view class="video_bg">
            <image class="video_bg_img" src="../../static/BG.png" mode=""></image>
@@ -98,6 +99,61 @@
            <!-- </view> -->
         </view>
      </view>
      <!-- 音频 -->
      <view class="vedioWatch" v-if="videoShow && Otype == 'audio'">
         <view class="video_bg">
            <image class="video_bg_img" src="../../static/BG.png" mode=""></image>
            <!-- <text class="activetext" v-if="videoShowBg"></text> -->
            <!--    <view class="video_bg video_bg_text">
               <text class="activetext">{{promptText}}</text>
            </view> -->
         </view>
         <!-- 文字提示 -->
         <view class="Mains-t">
            <text class="activetext">语音通话中</text>
            <u-loading size="36" mode="flower"></u-loading>
         </view>
         <!-- 音视频基本开关 -->
         <view class="videoshow_control position">
            <!-- 音频开关 -->
            <view class="open" @click="audioSwitchFn" v-if="role == 1">
               <image class="video_bg_img" src="../../static/au_in.png" mode="" v-if="audioSwitch == 'open'">
               </image>
               <image class="video_bg_img" src="../../static/au_on.png" mode="" v-else></image>
               <text class="open_text">音频</text>
            </view>
            <!-- 挂断 -->
            <view class="open" @click="phoneFn">
               <image class="video_bg_img" src="../../static/over.png" mode=""></image>
               <text class="open_text">挂断</text>
            </view>
            <!-- 视频开关 -->
            <!-- <view class="open" @click="vedioSwitchFn" v-if="role == 1">
               <image class="video_bg_img" src="../../static/vi_on.png" mode="" v-if="vedioSwitch == 'open'">
               </image>
               <image class="video_bg_img" src="../../static/vi_in.png" mode="" v-else></image>
               <text class="open_text">视频</text>
            </view> -->
            <!--    <scroll-view scroll-y="true" style="height: 500px;padding: 20px;">
               <view v-for="(item,value) in closeArray" :key='item+value'>{{item}}</view>
            </scroll-view> -->
         </view>
         <!-- 提示文字 -->
         <view class="video_bg video_bg_text" v-if="promptText">
            <!-- <view class="video_bg video_bg_text"> -->
            <text class="activetext">{{promptText}}</text>
            <!-- </view> -->
         </view>
      </view>
      <uni-popup ref="popup" type="center">
         <uni-popup-message :type="popupType" :message="popupMessage" :duration="2000"></uni-popup-message>
      </uni-popup>
@@ -147,30 +203,44 @@
            isMain: true,
            userName: '111'
            userName: '111',
            toName: '',
            Otype: '',
            formName:''
         }
      },
      // 页面初始加载(仅执行一次)
      onReady() {
         // 初始化
         this.channel = 2554;
         // this.channel = 2554;
         this.init();
      },
      onLoad(option) {
         console.log(option)
         if (option.type) {
            this.Otype = option.type;
         } else {
            return
         }
         console.log(option.state);
         if (option.state == "Mains") {
            this.isMain = true;
            this.userName = 'faqiren';
            // this.userName = 'faqiren';
            this.userName = option.myname;
            this.toName = option.toname;
            setTimeout(res => {
               // this.join();
               //发起请求  给后端双方姓名
               //得到返回值   开始视频  或者拒绝视频
            }, 2000)
               this.join();
            }, 5000)
         } else if (option.state == "Receiver") {
            this.userName = 'jieshouren';
            this.formName = 'wo';
            this.channel = option.room;
            this.isMain = false;
         }
      },
@@ -288,24 +358,25 @@
         phoneFnMain() {
            // RtcModule.leaveChannel((res) => {});
            console.log("等待时候挂断");
            uni.navigateBack();
            // uni.navigateBack();
            this.closeAll();
         },
         joinit(){//接受进入视频
         joinit() { //接受进入视频
            // 传输接受的值
            // 开始进入视频通话
            },
            this.join();
         },
         //拒绝进入视频
         comeBack() {
            // 传输拒绝的值
            console.log("拒绝进入视频");
            uni.navigateBack();
            // RtcModule.leaveChannel((res) => {});
            // this.closeAll();
         },
@@ -492,9 +563,9 @@
            // console.log('成功关闭')
            // uni.navigateBack();
            RtcModule.destroyRtc((res) => {
                        console.log("页面销毁", res.code);
               console.log("页面销毁", res.code);
               console.log('成功关闭')
               uni.navigateBack();
               // uni.navigateBack();
            });
            // }
            // });