|
@@ -5,6 +5,7 @@ const COS = require('../../utils/cos-wx-v5.js');
|
|
const util = require('../../utils/util.js');
|
|
const util = require('../../utils/util.js');
|
|
Page({
|
|
Page({
|
|
data: {
|
|
data: {
|
|
|
|
+ scrollTop:0,
|
|
rtcConfig: {
|
|
rtcConfig: {
|
|
sdkAppID: 1400404379, // 必要参数 开通实时音视频服务创建应用后分配的 sdkAppID
|
|
sdkAppID: 1400404379, // 必要参数 开通实时音视频服务创建应用后分配的 sdkAppID
|
|
userID: '', // 必要参数 用户 ID 可以由您的帐号系统指定
|
|
userID: '', // 必要参数 用户 ID 可以由您的帐号系统指定
|
|
@@ -126,6 +127,7 @@ Page({
|
|
// currentTime: currentTime
|
|
// currentTime: currentTime
|
|
// })
|
|
// })
|
|
console.log(chatContent, "我是收到消息的数组")
|
|
console.log(chatContent, "我是收到消息的数组")
|
|
|
|
+ // _this.toViewBottomFun();
|
|
_this.setData({
|
|
_this.setData({
|
|
chatContent: chatContent,
|
|
chatContent: chatContent,
|
|
bottom: 'scrollBottom'
|
|
bottom: 'scrollBottom'
|
|
@@ -490,7 +492,7 @@ Page({
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
|
|
this.trtcRoomContext.enterRoom({
|
|
this.trtcRoomContext.enterRoom({
|
|
roomID: Number(this.data.roomIdandcourseId) //课程id
|
|
roomID: Number(this.data.roomIdandcourseId) //课程id
|
|
@@ -504,7 +506,19 @@ Page({
|
|
// })
|
|
// })
|
|
// console.log(this.data.roomIdandcourseId)
|
|
// console.log(this.data.roomIdandcourseId)
|
|
// },
|
|
// },
|
|
-
|
|
|
|
|
|
+ toViewBottomFun: function() {
|
|
|
|
+ // 设置屏幕自动滚动到最后一条消息处
|
|
|
|
+ let that = this;
|
|
|
|
+ wx.createSelectorQuery().select('#chatcon').boundingClientRect(function(rect) {
|
|
|
|
+ wx.pageScrollTo({
|
|
|
|
+ scrollTop: rect.height,
|
|
|
|
+ duration: 100 // 滑动速度
|
|
|
|
+ })
|
|
|
|
+ that.setData({
|
|
|
|
+ scrollTop: rect.height - that.data.scrollTop+100
|
|
|
|
+ });
|
|
|
|
+ }).exec();
|
|
|
|
+ },
|
|
async onShow() {
|
|
async onShow() {
|
|
let pages = getCurrentPages();
|
|
let pages = getCurrentPages();
|
|
let currentPage = pages[pages.length - 1];
|
|
let currentPage = pages[pages.length - 1];
|
|
@@ -608,6 +622,24 @@ Page({
|
|
console.log("zbdetail-onUnload")
|
|
console.log("zbdetail-onUnload")
|
|
this.trtcRoomContext.unpublishLocalVideo();
|
|
this.trtcRoomContext.unpublishLocalVideo();
|
|
this.trtcRoomContext.unpublishLocalAudio();
|
|
this.trtcRoomContext.unpublishLocalAudio();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ this.trtcRoomContext.unsubscribeRemoteAudio({
|
|
|
|
+ userID: "0"
|
|
|
|
+ }).then(() => {
|
|
|
|
+ console.log("音频取消订阅")
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ // this.trtcRoomContext.unsubscribeRemoteVideo({
|
|
|
|
+ // userID: "0"
|
|
|
|
+ // }).then(() => {
|
|
|
|
+ // console.log("视频取消订阅")
|
|
|
|
+ // })
|
|
|
|
+
|
|
|
|
+
|
|
this.offTim();
|
|
this.offTim();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
})
|
|
})
|