增加线上配置分享功能+用户后台登录,不影响首页渲染

This commit is contained in:
chenglijuan
2026-05-20 14:24:54 +08:00
parent dbfc8011c4
commit 643f37b06e
8 changed files with 153 additions and 157 deletions
+29 -29
View File
@@ -13,19 +13,16 @@ Page({
},
onLoad() {
if (app.globalData.isLoggedIn) {
this.onLoginReady()
} else if (app.globalData.loginFailed) {
this.onLoginFailed()
this._awaitLoginAndLoad()
},
async _awaitLoginAndLoad() {
const userInfo = await app.waitLogin(true)
if (userInfo) {
this.setData({ isLoggedIn: true, loginFailed: false })
this.loadRecords()
} else {
app.loginReadyCallback = (userInfo) => {
app.loginReadyCallback = null
if (userInfo) {
this.onLoginReady()
} else {
this.onLoginFailed()
}
}
this.setData({ isLoggedIn: false, loginFailed: true, loading: false })
}
},
@@ -36,25 +33,15 @@ Page({
}
},
onLoginReady() {
this.setData({ isLoggedIn: true, loginFailed: false })
this.loadRecords()
},
onLoginFailed() {
this.setData({ isLoggedIn: false, loginFailed: true, loading: false })
},
onRetry() {
async onRetry() {
this.setData({ loginFailed: false, loading: true })
app.silentLogin()
app.loginReadyCallback = (userInfo) => {
app.loginReadyCallback = null
if (userInfo) {
this.onLoginReady()
} else {
this.onLoginFailed()
}
const userInfo = await app.waitLogin()
if (userInfo) {
this.setData({ isLoggedIn: true, loginFailed: false })
this.loadRecords()
} else {
this.setData({ loginFailed: true })
}
},
@@ -122,5 +109,18 @@ Page({
showQrcode(e) {
this.selectComponent('#qrcodeModal').show(e.currentTarget.dataset.id)
},
onShareAppMessage(res) {
return {
title: '访客预约',
path: '/pages/index/index'
}
},
onShareTimeline() {
return {
title: '访客预约'
}
}
})