无网络提示
This commit is contained in:
parent
d7b8276c52
commit
c5d3a21299
|
|
@ -11,6 +11,7 @@ Page({
|
||||||
},
|
},
|
||||||
isRecord: false,
|
isRecord: false,
|
||||||
isCamera: false,
|
isCamera: false,
|
||||||
|
netWorkErrorDialog: false,
|
||||||
historicalList: [],
|
historicalList: [],
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
|
|
@ -31,33 +32,41 @@ Page({
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad(option) {
|
||||||
wx.authorize({
|
if (option.redirect) {
|
||||||
scope: 'scope.record',
|
this.setData({
|
||||||
success: () => {
|
netWorkErrorDialog: true,
|
||||||
this.setData({
|
isRecord: true,
|
||||||
isRecord: true,
|
isCamera: true,
|
||||||
})
|
})
|
||||||
},
|
} else {
|
||||||
fail: () => {
|
wx.authorize({
|
||||||
this.setData({
|
scope: 'scope.record',
|
||||||
isRecord: false,
|
success: () => {
|
||||||
})
|
this.setData({
|
||||||
}
|
isRecord: true,
|
||||||
});
|
})
|
||||||
wx.authorize({
|
},
|
||||||
scope: 'scope.camera',
|
fail: () => {
|
||||||
success: () => {
|
this.setData({
|
||||||
this.setData({
|
isRecord: false,
|
||||||
isCamera: true,
|
})
|
||||||
})
|
}
|
||||||
},
|
});
|
||||||
fail: () => {
|
wx.authorize({
|
||||||
this.setData({
|
scope: 'scope.camera',
|
||||||
isCamera: false,
|
success: () => {
|
||||||
})
|
this.setData({
|
||||||
}
|
isCamera: true,
|
||||||
});
|
})
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
this.setData({
|
||||||
|
isCamera: false,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
async getRoomRtcToken(roomNum: string, callBack: Function): Promise<void> {
|
async getRoomRtcToken(roomNum: string, callBack: Function): Promise<void> {
|
||||||
Promise.all([GetRoomRtcToken(roomNum), GetRoomRtcToken(roomNum + 'a'), GetAgoraConf()]).then(res => {
|
Promise.all([GetRoomRtcToken(roomNum), GetRoomRtcToken(roomNum + 'a'), GetAgoraConf()]).then(res => {
|
||||||
|
|
@ -70,7 +79,13 @@ Page({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
closeDialog() {
|
||||||
|
this.setData({
|
||||||
|
netWorkErrorDialog: false
|
||||||
|
})
|
||||||
|
},
|
||||||
joinMeeting() {
|
joinMeeting() {
|
||||||
|
this.closeDialog()
|
||||||
const navigateToMeeting = async (deviceId: string): Promise<void> => {
|
const navigateToMeeting = async (deviceId: string): Promise<void> => {
|
||||||
await PostAnonLogin({
|
await PostAnonLogin({
|
||||||
deviceId,
|
deviceId,
|
||||||
|
|
|
||||||
|
|
@ -18,4 +18,5 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</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" />
|
<t-message id="t-message" />
|
||||||
|
|
@ -125,10 +125,12 @@ Page({
|
||||||
},
|
},
|
||||||
'currentUid': function (currentUid) {
|
'currentUid': function (currentUid) {
|
||||||
this.data.roomUserList.forEach(item => {
|
this.data.roomUserList.forEach(item => {
|
||||||
if (item.uid == currentUid) {
|
if (item.src) {
|
||||||
agora.setRemoteVideoStreamType(Number(item.uid), 0)
|
if (item.uid == currentUid) {
|
||||||
} else {
|
agora.setRemoteVideoStreamType(Number(item.uid), 0)
|
||||||
agora.setRemoteVideoStreamType(Number(item.uid), 1)
|
} else {
|
||||||
|
agora.setRemoteVideoStreamType(Number(item.uid), 1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -174,6 +176,12 @@ Page({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
onReady() {
|
||||||
|
wx.onNetworkStatusChange(this.listener)
|
||||||
|
},
|
||||||
|
onUnload() {
|
||||||
|
wx.offNetworkStatusChange(this.listener)
|
||||||
|
},
|
||||||
startSignalr() {
|
startSignalr() {
|
||||||
onSignalr(async (item) => {
|
onSignalr(async (item) => {
|
||||||
const userInfo: any = await getStorage('user')
|
const userInfo: any = await getStorage('user')
|
||||||
|
|
@ -771,5 +779,14 @@ Page({
|
||||||
top: 10000000000000
|
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