无网络提示
This commit is contained in:
parent
d7b8276c52
commit
c5d3a21299
|
|
@ -11,6 +11,7 @@ Page({
|
|||
},
|
||||
isRecord: false,
|
||||
isCamera: false,
|
||||
netWorkErrorDialog: false,
|
||||
historicalList: [],
|
||||
},
|
||||
onShow() {
|
||||
|
|
@ -31,33 +32,41 @@ Page({
|
|||
},
|
||||
})
|
||||
},
|
||||
onLoad() {
|
||||
wx.authorize({
|
||||
scope: 'scope.record',
|
||||
success: () => {
|
||||
this.setData({
|
||||
isRecord: true,
|
||||
})
|
||||
},
|
||||
fail: () => {
|
||||
this.setData({
|
||||
isRecord: false,
|
||||
})
|
||||
}
|
||||
});
|
||||
wx.authorize({
|
||||
scope: 'scope.camera',
|
||||
success: () => {
|
||||
this.setData({
|
||||
isCamera: true,
|
||||
})
|
||||
},
|
||||
fail: () => {
|
||||
this.setData({
|
||||
isCamera: false,
|
||||
})
|
||||
}
|
||||
});
|
||||
onLoad(option) {
|
||||
if (option.redirect) {
|
||||
this.setData({
|
||||
netWorkErrorDialog: true,
|
||||
isRecord: true,
|
||||
isCamera: true,
|
||||
})
|
||||
} else {
|
||||
wx.authorize({
|
||||
scope: 'scope.record',
|
||||
success: () => {
|
||||
this.setData({
|
||||
isRecord: true,
|
||||
})
|
||||
},
|
||||
fail: () => {
|
||||
this.setData({
|
||||
isRecord: false,
|
||||
})
|
||||
}
|
||||
});
|
||||
wx.authorize({
|
||||
scope: 'scope.camera',
|
||||
success: () => {
|
||||
this.setData({
|
||||
isCamera: true,
|
||||
})
|
||||
},
|
||||
fail: () => {
|
||||
this.setData({
|
||||
isCamera: false,
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
async getRoomRtcToken(roomNum: string, callBack: Function): Promise<void> {
|
||||
Promise.all([GetRoomRtcToken(roomNum), GetRoomRtcToken(roomNum + 'a'), GetAgoraConf()]).then(res => {
|
||||
|
|
@ -70,7 +79,13 @@ Page({
|
|||
}
|
||||
})
|
||||
},
|
||||
closeDialog() {
|
||||
this.setData({
|
||||
netWorkErrorDialog: false
|
||||
})
|
||||
},
|
||||
joinMeeting() {
|
||||
this.closeDialog()
|
||||
const navigateToMeeting = async (deviceId: string): Promise<void> => {
|
||||
await PostAnonLogin({
|
||||
deviceId,
|
||||
|
|
|
|||
|
|
@ -18,4 +18,5 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<t-dialog visible="{{netWorkErrorDialog}}" content="网络已断开!" confirm-btn="{{ { content: '立刻重连', variant: 'base', theme: 'primary' } }}" cancel-btn="取消" bind:confirm="joinMeeting" bind:cancel="closeDialog" close-btn="{{false}}" />
|
||||
<t-message id="t-message" />
|
||||
|
|
@ -125,10 +125,12 @@ Page({
|
|||
},
|
||||
'currentUid': function (currentUid) {
|
||||
this.data.roomUserList.forEach(item => {
|
||||
if (item.uid == currentUid) {
|
||||
agora.setRemoteVideoStreamType(Number(item.uid), 0)
|
||||
} else {
|
||||
agora.setRemoteVideoStreamType(Number(item.uid), 1)
|
||||
if (item.src) {
|
||||
if (item.uid == currentUid) {
|
||||
agora.setRemoteVideoStreamType(Number(item.uid), 0)
|
||||
} else {
|
||||
agora.setRemoteVideoStreamType(Number(item.uid), 1)
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
@ -174,6 +176,12 @@ Page({
|
|||
}
|
||||
})
|
||||
},
|
||||
onReady() {
|
||||
wx.onNetworkStatusChange(this.listener)
|
||||
},
|
||||
onUnload() {
|
||||
wx.offNetworkStatusChange(this.listener)
|
||||
},
|
||||
startSignalr() {
|
||||
onSignalr(async (item) => {
|
||||
const userInfo: any = await getStorage('user')
|
||||
|
|
@ -771,5 +779,14 @@ Page({
|
|||
top: 10000000000000
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
async listener(res) {
|
||||
if (res.isConnected && (res.networkType !== 'none' || res.networkType !== 'unknown')) {
|
||||
|
||||
} else {
|
||||
wx.navigateTo({
|
||||
url: `/pages/form/index?redirect=true`
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
Loading…
Reference in New Issue