|
@@ -63,32 +63,32 @@ Page({
|
|
|
})
|
|
|
_this.getjyList(imResponse.data.groupList[i])
|
|
|
}
|
|
|
- if (_this.data.currentGroup == null) {
|
|
|
- let promise = _this.data.tim.joinGroup({
|
|
|
- groupID: _this.data.roomIdandcourseId,
|
|
|
- type: TIM.TYPES.GRP_MEETING
|
|
|
- });
|
|
|
- promise.then((imResponse) => {
|
|
|
- switch (imResponse.data.status) {
|
|
|
- case TIM.TYPES.JOIN_STATUS_WAIT_APPROVAL:
|
|
|
- break; // 等待管理员同意
|
|
|
- case TIM.TYPES.JOIN_STATUS_SUCCESS: // 加群成功
|
|
|
- console.log(imResponse.data.group, "加群成功"); // 加入的群组资料
|
|
|
- break;
|
|
|
- case TIM.TYPES.JOIN_STATUS_ALREADY_IN_GROUP: // 已经在群中
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- _this.setData({
|
|
|
- currentGroup: imResponse.data.group
|
|
|
- })
|
|
|
- _this.getjyList(imResponse.data.group)
|
|
|
- console.log(_this.data.currentGroup, "0000000000000000")
|
|
|
- }).catch(function (imError) {
|
|
|
- console.warn('申请加群失败的相关信息', imError); // 申请加群失败的相关信息
|
|
|
- });
|
|
|
- }
|
|
|
+ }
|
|
|
+ if (_this.data.currentGroup == null) {
|
|
|
+ let promise = _this.data.tim.joinGroup({
|
|
|
+ groupID: _this.data.roomIdandcourseId,
|
|
|
+ type: TIM.TYPES.GRP_MEETING
|
|
|
+ });
|
|
|
+ promise.then((imResponse) => {
|
|
|
+ switch (imResponse.data.status) {
|
|
|
+ case TIM.TYPES.JOIN_STATUS_WAIT_APPROVAL:
|
|
|
+ break; // 等待管理员同意
|
|
|
+ case TIM.TYPES.JOIN_STATUS_SUCCESS: // 加群成功
|
|
|
+ console.log(imResponse.data.group, "加群成功"); // 加入的群组资料
|
|
|
+ break;
|
|
|
+ case TIM.TYPES.JOIN_STATUS_ALREADY_IN_GROUP: // 已经在群中
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ _this.setData({
|
|
|
+ currentGroup: imResponse.data.group
|
|
|
+ })
|
|
|
+ _this.getjyList(imResponse.data.group)
|
|
|
+ console.log(_this.data.currentGroup, "0000000000000000")
|
|
|
+ }).catch(function (imError) {
|
|
|
+ console.warn('申请加群失败的相关信息', imError); // 申请加群失败的相关信息
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
}).catch(function (imError) {
|
|
@@ -422,35 +422,32 @@ Page({
|
|
|
});
|
|
|
},
|
|
|
bindTRTCRoomEvent: function () {
|
|
|
- console.log(this.data.roomIdandcourseId, typeof (this.data.roomIdandcourseId), "我开始监听了。。。。。")
|
|
|
- this.trtcRoomContext.enterRoom({
|
|
|
- roomID: Number(this.data.roomIdandcourseId) //课程id
|
|
|
- // userID: this.data.rtcConfig.userID
|
|
|
- })
|
|
|
+ console.log(this.data.roomIdandcourseId, typeof (this.data.roomIdandcourseId), "bindTRTCRoomEvent 绑定监听")
|
|
|
+
|
|
|
const TRTC_EVENT = this.trtcRoomContext.EVENT
|
|
|
this.trtcRoomContext.on(TRTC_EVENT.LOCAL_JOIN, (event) => {
|
|
|
- console.log('我加入房间了', event)
|
|
|
+ console.log('zbdetail绑定-我加入房间了', event)
|
|
|
})
|
|
|
this.trtcRoomContext.on(TRTC_EVENT.LOCAL_LEAVE, (event) => {
|
|
|
- console.log('我离开房间了', event)
|
|
|
+ console.log('zbdetail-绑定我离开房间了', event)
|
|
|
})
|
|
|
this.trtcRoomContext.on(TRTC_EVENT.ERROR, (event) => {
|
|
|
- console.log('进入房间出错了', event)
|
|
|
+ console.log('zbdetail-绑定进入房间出错了', event)
|
|
|
})
|
|
|
// 远端用户进入房间
|
|
|
this.trtcRoomContext.on(TRTC_EVENT.REMOTE_USER_JOIN, (event) => {
|
|
|
- console.log('远端用户进入房间')
|
|
|
+ console.log('zbdetail绑定-远端用户进入房间')
|
|
|
})
|
|
|
// 远端用户退出
|
|
|
this.trtcRoomContext.on(TRTC_EVENT.REMOTE_USER_LEAVE, (event) => {
|
|
|
- console.log('远端用户退出')
|
|
|
+ console.log('zbdetail绑定-远端用户退出')
|
|
|
})
|
|
|
this.trtcRoomContext.on(TRTC_EVENT.REMOTE_AUDIO_ADD, (event) => {
|
|
|
- console.log(event, "lalalallalalalalal")
|
|
|
+ console.log(event, "zbdetail绑定-远程音频加入事件")
|
|
|
this.trtcRoomContext.subscribeRemoteAudio({
|
|
|
userID: event.data.userID
|
|
|
}).then(() => {
|
|
|
- console.log("音频订阅成功")
|
|
|
+ console.log("zbdetail绑定-音频订阅成功")
|
|
|
})
|
|
|
})
|
|
|
// 远端用户取消推送音频
|
|
@@ -477,14 +474,39 @@ Page({
|
|
|
console.log("远端视频取消订阅")
|
|
|
})
|
|
|
})
|
|
|
- },
|
|
|
- onLoad(options) {
|
|
|
- console.log(options, "99999");
|
|
|
- this.setData({
|
|
|
- roomIdandcourseId: options.id
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ this.trtcRoomContext.enterRoom({
|
|
|
+ roomID: Number(this.data.roomIdandcourseId) //课程id
|
|
|
+ // userID: this.data.rtcConfig.userID
|
|
|
})
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
+ // onLoad(options) {
|
|
|
+ // console.log(options, "99999");
|
|
|
+ // this.setData({
|
|
|
+ // roomIdandcourseId: options.id
|
|
|
+ // })
|
|
|
+ // },
|
|
|
async onShow() {
|
|
|
+ // 获取当前小程序的页面栈
|
|
|
+ let pages = getCurrentPages();
|
|
|
+ // 数组中索引最大的页面--当前页面
|
|
|
+ let currentPage = pages[pages.length - 1];
|
|
|
+ // 打印出当前页面中的 options
|
|
|
+ console.log(currentPage.options.id, 'wwww')
|
|
|
+ this.setData({
|
|
|
+ roomIdandcourseId: currentPage.options.id
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
|
|
|
const sessionKey = await tools.checkSessionAndLogin();
|
|
|
const information = await tools.request('/wx/student/selStudentSessionKeyEcho', {
|
|
@@ -517,13 +539,13 @@ Page({
|
|
|
this.onTim();
|
|
|
},
|
|
|
onHide() {
|
|
|
- console.log("我onhide了")
|
|
|
+ console.log("zbdetail-onhide了")
|
|
|
this.trtcRoomContext.unpublishLocalVideo();
|
|
|
this.trtcRoomContext.unpublishLocalAudio();
|
|
|
this.offTim();
|
|
|
},
|
|
|
onUnload() {
|
|
|
- console.log("onUnload")
|
|
|
+ console.log("zbdetail-onUnload")
|
|
|
this.trtcRoomContext.unpublishLocalVideo();
|
|
|
this.trtcRoomContext.unpublishLocalAudio();
|
|
|
this.offTim();
|