首页加入会议逻辑优化

This commit is contained in:
yj 2025-02-13 16:06:05 +08:00
parent 23f6ea5ba8
commit 739b6161ec
2 changed files with 44 additions and 24 deletions

View File

@ -12,7 +12,8 @@ Page({
isCamera: false, isCamera: false,
netWorkErrorDialog: false, netWorkErrorDialog: false,
historicalList: [], historicalList: [],
isJoin: false isJoin: false,
code: ''
}, },
onShow() { onShow() {
const that = this; const that = this;
@ -55,6 +56,9 @@ Page({
}) })
}, },
onLoad(option) { onLoad(option) {
if (!this.data.code) {
this.getCode()
}
if (option.scene) { if (option.scene) {
const scene = decodeURIComponent(option.scene) const scene = decodeURIComponent(option.scene)
const room = scene.split('r=')[1]; const room = scene.split('r=')[1];
@ -103,6 +107,24 @@ Page({
} }
}) })
}, },
getCode(callBack?) {
wx.login({
success: (res) => {
const { code } = res
GetOpenId(code).then(res => {
if (res.code === 200) {
this.setData({
code: res.data,
})
callBack?.(true)
}
})
},
fail: () => {
callBack?.(false)
}
})
},
closeDialog() { closeDialog() {
wx.setStorage({ wx.setStorage({
key: "isConnected", key: "isConnected",
@ -194,33 +216,28 @@ Page({
}) })
return return
} }
const that = this; GetCheckoutRoomNum(this.data.meetingForm.roomNum).then(async res => {
GetCheckoutRoomNum(this.data.meetingForm.roomNum).then(res => {
if (res.code === 200) { if (res.code === 200) {
if (res.data) { if (res.data) {
wx.login({ if (this.data.code) {
success: (res) => { navigateToMeeting(this.data.code)
const { code } = res } else {
GetOpenId(code).then(res => { this.getCode((bool) => {
if (res.code === 200) { if (bool) {
navigateToMeeting(res.data) navigateToMeeting(this.data.code)
} else { } else {
that.setData({ Message.error({
isJoin: false context: this,
}) offset: [90, 32],
} duration: 3000,
}).catch(() => { content: '登录失败,请重试。',
that.setData({ });
this.setData({
isJoin: false isJoin: false
}) })
}) }
}, })
fail: () => { }
that.setData({
isJoin: false
})
}
})
} else { } else {
this.setData({ this.setData({
isJoin: false isJoin: false

View File

@ -252,6 +252,9 @@ Page({
wx.onNetworkStatusChange(this.listener) wx.onNetworkStatusChange(this.listener)
}, },
onShow() { onShow() {
wx.setKeepScreenOn({
keepScreenOn: true,
});
this.setData({ this.setData({
isCurrePage: false isCurrePage: false
}) })