首页加入会议逻辑优化
This commit is contained in:
parent
23f6ea5ba8
commit
739b6161ec
|
|
@ -12,7 +12,8 @@ Page({
|
|||
isCamera: false,
|
||||
netWorkErrorDialog: false,
|
||||
historicalList: [],
|
||||
isJoin: false
|
||||
isJoin: false,
|
||||
code: ''
|
||||
},
|
||||
onShow() {
|
||||
const that = this;
|
||||
|
|
@ -55,6 +56,9 @@ Page({
|
|||
})
|
||||
},
|
||||
onLoad(option) {
|
||||
if (!this.data.code) {
|
||||
this.getCode()
|
||||
}
|
||||
if (option.scene) {
|
||||
const scene = decodeURIComponent(option.scene)
|
||||
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() {
|
||||
wx.setStorage({
|
||||
key: "isConnected",
|
||||
|
|
@ -194,33 +216,28 @@ Page({
|
|||
})
|
||||
return
|
||||
}
|
||||
const that = this;
|
||||
GetCheckoutRoomNum(this.data.meetingForm.roomNum).then(res => {
|
||||
GetCheckoutRoomNum(this.data.meetingForm.roomNum).then(async res => {
|
||||
if (res.code === 200) {
|
||||
if (res.data) {
|
||||
wx.login({
|
||||
success: (res) => {
|
||||
const { code } = res
|
||||
GetOpenId(code).then(res => {
|
||||
if (res.code === 200) {
|
||||
navigateToMeeting(res.data)
|
||||
} else {
|
||||
that.setData({
|
||||
isJoin: false
|
||||
})
|
||||
}
|
||||
}).catch(() => {
|
||||
that.setData({
|
||||
if (this.data.code) {
|
||||
navigateToMeeting(this.data.code)
|
||||
} else {
|
||||
this.getCode((bool) => {
|
||||
if (bool) {
|
||||
navigateToMeeting(this.data.code)
|
||||
} else {
|
||||
Message.error({
|
||||
context: this,
|
||||
offset: [90, 32],
|
||||
duration: 3000,
|
||||
content: '登录失败,请重试。',
|
||||
});
|
||||
this.setData({
|
||||
isJoin: false
|
||||
})
|
||||
})
|
||||
},
|
||||
fail: () => {
|
||||
that.setData({
|
||||
isJoin: false
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
isJoin: false
|
||||
|
|
|
|||
|
|
@ -252,6 +252,9 @@ Page({
|
|||
wx.onNetworkStatusChange(this.listener)
|
||||
},
|
||||
onShow() {
|
||||
wx.setKeepScreenOn({
|
||||
keepScreenOn: true,
|
||||
});
|
||||
this.setData({
|
||||
isCurrePage: false
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue