| | |
| | | <view class="index" v-if="!videoShow"> |
| | | <view class="Mains" v-if="isMain"> |
| | | <view class="Mains-t"> |
| | | <text class="activetext">正在呼叫{{toName}}</text> |
| | | <text class="activetext">正在呼叫{{callname}}</text> |
| | | <u-loading size="36" mode="flower"></u-loading> |
| | | </view> |
| | | <!-- 挂断 --> |
| | |
| | | </view> |
| | | <view class="Receiver" v-if="!isMain"> |
| | | <view class="Mains-t"> |
| | | <text class="activetext">是否接收来自{{formName}}的{{Otype}}请求</text> |
| | | <text class="activetext">接受进入{{channel}}</text> |
| | | <text class="activetext">是否接收来自{{callname}}的{{Otype == 'video'? '视频': '音频'}}邀请</text> |
| | | <!-- <text class="activetext">接受进入{{channel}}</text> --> |
| | | <u-loading size="36" mode="flower"></u-loading> |
| | | </view> |
| | | <view class="i-control"> |
| | |
| | | |
| | | formName: '', |
| | | |
| | | callname: '', |
| | | |
| | | |
| | | |
| | | faqiid: '', |
| | | jieshouid: '' |
| | | |
| | |
| | | onLoad(option) { |
| | | var that = this; |
| | | that.toName = option.toname; |
| | | that.callname = option.callname; |
| | | console.log(option) |
| | | if (option.type) { |
| | | that.Otype = option.type; |
| | |
| | | // if (call && ) { |
| | | |
| | | // } |
| | | // console.log(that,1111111111111) |
| | | if (data.type == 'close') { |
| | | |
| | | console.log('对方已挂断'); |
| | | RtcModule.leaveChannel((res) => {}); |
| | | that.closeAll(); |
| | | // RtcModule.leaveChannel((res) => {}); |
| | | // that.closeAll(); |
| | | |
| | | |
| | | |
| | | RtcModule.leaveChannel((res) => { |
| | | console.log('成功退出房间'); |
| | | // uni.navigateBack(); |
| | | }) |
| | | // await RtcModule.destroyRtc((res) => {}); |
| | | that.videoShow = false; //视频展示 |
| | | // this.videoShowBg = true; //背景展示 |
| | | that.promptText = "loading..."; |
| | | |
| | | that.PeerVideoUser = []; //远端用户加入存储 |
| | | // 本地 |
| | | that.audioSwitch = "open"; //音频开关 |
| | | that.vedioSwitch = "open"; //视频开关 |
| | | // 重新创建实例 |
| | | that.init(); |
| | | // 如果需要跳转其它页面请按下边步骤 |
| | | // await uni.redirectTo({ |
| | | // url: '..', |
| | | // uni.showToast({ |
| | | // title: '正在退出视频', |
| | | // duration: 2000, |
| | | // icon: 'none' |
| | | // }); |
| | | // success: () => { |
| | | |
| | | // uni.navigateBack(); |
| | | RtcModule.destroyRtc((res) => { |
| | | console.log("页面销毁", res.code); |
| | | console.log('成功销毁') |
| | | // uni.navigateBack(); |
| | | }); |
| | | uni.navigateBack(); |
| | | |
| | | } |
| | | }); |
| | | |
| | |
| | | } else if (option.state == "Receiver") { |
| | | that.userName = 'jieshouren'; |
| | | // that.formName = 'wo'; |
| | | that.callname = option.name; |
| | | that.channel = option.room; |
| | | that.faqiid = option.faqiid; |
| | | that.jieshouid = that.$store.state.puserID; |
| | |
| | | console.log('开始初始化') |
| | | this.uid = this.userName; |
| | | console.log('初始化完成’', this.uid, '当前id码'); |
| | | uni.showToast({ |
| | | title: this.uid, |
| | | duration: 2000, |
| | | // icon: 'none' |
| | | }); |
| | | // uni.showToast({ |
| | | // title: this.uid, |
| | | // duration: 2000, |
| | | // // icon: 'none' |
| | | // }); |
| | | if (uni.getSystemInfoSync().platform == 'ios') { |
| | | //查看相机权限 |
| | | await this.requestAndroidPermission("camera", 'ios'); |
| | |
| | | // 离开清空 |
| | | async closeAll() { |
| | | // 销毁实例 |
| | | await RtcModule.leaveChannel((res) => {}) |
| | | // uni.navigateBack(); |
| | | await RtcModule.leaveChannel((res) => { |
| | | // uni.navigateBack(); |
| | | }) |
| | | // await RtcModule.destroyRtc((res) => {}); |
| | | this.videoShow = false; //视频展示 |
| | | // this.videoShowBg = true; //背景展示 |
| | |
| | | // 如果需要跳转其它页面请按下边步骤 |
| | | // await uni.redirectTo({ |
| | | // url: '..', |
| | | // uni.showToast({ |
| | | // title: '正在退出视频', |
| | | // duration: 2000, |
| | | // icon: 'none' |
| | | // }); |
| | | // success: () => { |
| | | // console.log('成功关闭') |
| | | |
| | | // uni.navigateBack(); |
| | | RtcModule.destroyRtc((res) => { |
| | | console.log("页面销毁", res.code); |
| | | console.log('成功关闭') |
| | | uni.navigateBack(); |
| | | // uni.navigateBack(); |
| | | }); |
| | | // } |
| | | // }); |
| | |
| | | |
| | | }, |
| | | destroyed() { |
| | | console.log('this.closeAll();'); |
| | | this.closeAll(); |
| | | // console.log('this.closeAll();'); |
| | | // this.closeAll(); |
| | | var that = this; |
| | | uni.hideLoading(); |
| | | // uni.onSocketMessage(function(res) { |
| | | // console.log(res.data); |
| | | // var data = JSON.parse(res.data) |
| | | // // if (call && ) { |
| | | |
| | | // // } |
| | | // if (data.type == 'close') { |
| | | |
| | | // console.log('对方已挂断'); |
| | | // // RtcModule.leaveChannel((res) => {}); |
| | | // that.closeAll(); |
| | | // } |
| | | // }); |
| | | uni.onSocketMessage(function(res) { |
| | | console.log(res.data); |
| | | var data = JSON.parse(res.data) |
| | | if (data.type == 'video') { |
| | | // this.receiveVideo('Receiver', ); |
| | | console.log('进入接受 跳转', data.type) |
| | | uni.navigateTo({ |
| | | url: '../videoCall/videoCall?state=Receiver&type=' + data.type + '&room=' + data |
| | | .roomId + '&name=' + data.name + '&faqiid=' + data.faqiid |
| | | }); |
| | | } |
| | | // console.log('收到服务器内容:' + res.data); |
| | | }); |
| | | } |
| | | |
| | | } |