This commit is contained in:
yj 2024-11-26 11:53:27 +08:00
parent 85cfd2e39f
commit 7209fa2cd0
2 changed files with 61 additions and 43 deletions

View File

@ -1,7 +1,7 @@
import { GetCheckoutRoomNum, PostAnonLogin, GetAgoraConf, GetRoomRtcToken } from '../../api/form/index'
import { getUUID } from '../../utils/utils'
import { Message } from 'tdesign-miniprogram';
import { onStop, startSignalr } from '../../utils/singlr';
import { startSignalr, onStop } from '../../utils/singlr';
import { agora } from '../../utils/agora'
Page({
data: {
@ -15,8 +15,26 @@ Page({
historicalList: [],
},
onShow() {
// wx.login({
// //成功放回
// success: (res) => {
// const { code } = res
// // appid=wx99885b1c181cda72&secret=edd9cdb04c3f59fe70f2a70c396e5b0d
// }
// })
onStop()
const that = this;
wx.getStorage({
key: 'isConnected',
success(res: any) {
if (res.data) {
this.setData({
netWorkErrorDialog: true,
})
}
},
})
wx.getStorage({
key: 'historicalList',
success(res: any) {
@ -32,14 +50,7 @@ Page({
},
})
},
onLoad(option) {
if (option.redirect) {
this.setData({
netWorkErrorDialog: true,
isRecord: true,
isCamera: true,
})
} else {
onLoad() {
wx.authorize({
scope: 'scope.record',
success: () => {
@ -66,7 +77,6 @@ Page({
})
}
});
}
},
async getRoomRtcToken(roomNum: string, callBack: Function): Promise<void> {
Promise.all([GetRoomRtcToken(roomNum), GetRoomRtcToken(roomNum + 'a'), GetAgoraConf()]).then(res => {
@ -80,6 +90,10 @@ Page({
})
},
closeDialog() {
wx.setStorage({
key: "isConnected",
data: false
})
this.setData({
netWorkErrorDialog: false
})

View File

@ -785,9 +785,11 @@ Page({
if (res.isConnected && (res.networkType !== 'none' || res.networkType !== 'unknown')) {
} else {
wx.navigateTo({
url: `/pages/form/index?redirect=true`
wx.setStorage({
key: "isConnected",
data: true
})
wx.navigateBack()
}
},
scroll() {
@ -797,6 +799,7 @@ Page({
query.exec((res) => {
const listItemRects = res[1];
listItemRects.forEach(rect => {
if (rect.dataset.item.src && rect.dataset.item.enableCamera) {
if (rect.top < res[0].height && rect.top + rect.height > 0) {
agora.unmute(Number(rect.dataset.item.uid), 'video')
} else {
@ -804,6 +807,7 @@ Page({
agora.mute(Number(rect.dataset.item.uid), 'video')
}
}
}
});
})
},