From b8a91ba497d2f0a7d11520305f80c8bfbd27b000 Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Thu, 12 Aug 2021 15:53:31 +0800
Subject: [PATCH] 初版集成

---
 pages/videoCall/videoCall.nvue |   68 +++++++++++++++++++++------------
 store/mutations.js             |    2 
 2 files changed, 44 insertions(+), 26 deletions(-)

diff --git a/pages/videoCall/videoCall.nvue b/pages/videoCall/videoCall.nvue
index c8ca717..195d894 100644
--- a/pages/videoCall/videoCall.nvue
+++ b/pages/videoCall/videoCall.nvue
@@ -207,7 +207,11 @@
 				toName: '',
 				Otype: '',
 
-				formName: ''
+				formName: '',
+				
+				faqiid: '',
+				jieshouid:''
+				
 			}
 		},
 		// 页面初始加载(仅执行一次)
@@ -228,6 +232,9 @@
 			console.log(option.state);
 			if (option.state == "Mains") {
 				
+				that.jieshouid = option.toname;
+				that.faqiid = that.$store.state.puserID;
+
 				that.isMain = true;
 				var call = false;
 				this.userName = that.$store.state.puserID + '-faqiren';
@@ -241,6 +248,7 @@
 					url: that.$store.state.api + '/pushMsg/inviteVideoCall',
 					data: {
 						userId: option.toname,
+						faaqiid: that.$store.state.puserID,
 						name: that.$store.state.puserName,
 						type: 'video'
 					},
@@ -260,16 +268,16 @@
 								uni.navigateBack();
 								// console.log(111)
 							}, 2000)
-						
+
 						} else if (d.res == 1) {
 							that.channel = d.roomId;
-							console.log('对方在线-- 等待对方接受',d);
+							console.log('对方在线-- 等待对方接受', d);
 							// call = true;
 							setTimeout(res => {
 								// uni.navigateBack();
 								// console.log(111)
-							that.join();
-							console.log('成功进入')
+								that.join();
+								console.log('成功进入')
 							}, 2000)
 						}
 					}
@@ -282,7 +290,7 @@
 					// if (call && ) {
 
 					// }
-					if (data.type = 'close') {
+					if (data.type == 'close') {
 						console.log('对方已挂断');
 						that.closeAll();
 					}
@@ -291,9 +299,11 @@
 
 				// }, 5000)
 			} else if (option.state == "Receiver") {
-				that.userName = that.$store.state.puserID  + '-jieshouren';
+				that.userName = that.$store.state.puserID + '-jieshouren';
 				// that.formName = 'wo';
 				that.channel = option.room;
+				that.faqiid = option.faqiid;
+				that.jieshouid = that.$store.state.puserID;
 				that.init();
 				that.isMain = false;
 			}
@@ -337,18 +347,25 @@
 			async init() {
 				// 查看权限
 				console.log('开始初始化')
-				// if (uni.getSystemInfoSync().platform == 'ios') {
-				// 	//查看相机权限
-				// 	await this.requestAndroidPermission("camera", 'ios');
-				// 	//查看录音权限
-				// 	await this.requestAndroidPermission("record", 'ios');
+				this.uid = this.userName;
+				console.log('初始化完成’', this.uid, '当前id码');
+				uni.showToast({
+					title: this.uid,
+					duration: 2000,
+					// icon: 'none'
+				});
+				if (uni.getSystemInfoSync().platform == 'ios') {
+					//查看相机权限
+					await this.requestAndroidPermission("camera", 'ios');
+					//查看录音权限
+					await this.requestAndroidPermission("record", 'ios');
 
-				// } else if (uni.getSystemInfoSync().platform === 'android') {
+				} else if (uni.getSystemInfoSync().platform === 'android') {
 					//查看相机权限
 					await this.requestAndroidPermission("android.permission.CAMERA", 'android');
 					//查看录音权限
 					await this.requestAndroidPermission("android.permission.RECORD_AUDIO", 'android');
-				// }
+				}
 				// 初始化 setCallBack
 				await this.callbackFn();
 				// 初始化 create
@@ -356,15 +373,10 @@
 				await RtcModule.create({
 					"appId": this.appid
 				}, (res) => {
-					console.log(res,11111111111111111111111111111111);
+					console.log(res, 11111111111111111111111111111111);
 				});
-				this.uid = this.randomFn(6);
-				console.log('初始化完成’',this.uid, '当前id码');
-				uni.showToast({
-					title: this.uid,
-					duration: 2000,
-					// icon: 'none'
-				});
+				// this.uid = this.randomFn(6);
+
 			},
 			//设置角色
 			setClientRole(num) {
@@ -387,7 +399,7 @@
 					mask: true
 				});
 				//加入房间
-				console.log('room', this.channel,'useid',this.uid)
+				console.log('room', this.channel, 'useid', this.uid)
 				await RtcModule.joinChannel({
 					"token": "",
 					"channelId": this.channel,
@@ -445,9 +457,15 @@
 			// 挂断 离开
 			phoneFn() {
 				//离开频道
-				RtcModule.leaveChannel((res) => {});
-				this.closeAll();
+				// RtcModule.leaveChannel((res) => {});
+				// this.closeAll();
 				// uni.navigateBack();
+				uni.request({
+					url: this.$store.state.api + 'pushMsg/closeVideoCall',
+					data:{
+						
+					}
+				})
 			},
 
 			//添加本地视频到页面
diff --git a/store/mutations.js b/store/mutations.js
index 9fcaae0..1af9752 100644
--- a/store/mutations.js
+++ b/store/mutations.js
@@ -78,7 +78,7 @@
 				// this.receiveVideo('Receiver', );
 				console.log('进入接受 跳转',data.type)
 				uni.navigateTo({
-					url: '../videoCall/videoCall?state=Receiver&type=' + data.type +'&room=' + data.roomId + '&name=' + data.name
+					url: '../videoCall/videoCall?state=Receiver&type=' + data.type +'&room=' + data.roomId + '&name=' + data.name + '&faqiid=' + data.faqiid
 				});
 			}
 			// console.log('收到服务器内容:' + res.data);

--
Gitblit v1.9.3