From 65aaba218b9b8a84c7df1c2a31bc0e858add32be Mon Sep 17 00:00:00 2001 From: kola-web Date: Sat, 14 Dec 2024 18:39:13 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E6=B5=81=E7=A8=8B=E5=85=BC?= =?UTF-8?q?=E5=AE=B9=E7=83=AD=E5=90=AF=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.ts | 29 ++++++++++++++++++----------- typings/index.d.ts | 1 + 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/app.ts b/src/app.ts index a1db8c4..edcfc2f 100644 --- a/src/app.ts +++ b/src/app.ts @@ -46,6 +46,24 @@ App({ wx.ajax = licia.curry(request)({ gUrl: this.globalData.url }); + this.initLogin(); + + wx.setInnerAudioOption({ + obeyMuteSwitch: false, + mixWithOther: false, + }); + }, + onShow(options) { + if (options.query.scene) { + this.globalData.scene = parseScene(options.query.scene); + } + if (this.globalData.loginState) { + this.globalData.loginState = ""; + this.initLogin(); + } + // this.startLogin(); + }, + initLogin() { wx.login({ success: (res) => { wx.ajax({ @@ -61,17 +79,6 @@ App({ }); }, }); - - wx.setInnerAudioOption({ - obeyMuteSwitch: false, - mixWithOther: false, - }); - }, - onShow(options) { - if (options.query.scene) { - this.globalData.scene = parseScene(options.query.scene); - } - // this.startLogin(); }, waitLogin(waitLoginState = false) { let time: number; diff --git a/typings/index.d.ts b/typings/index.d.ts index 0c2c220..fe869d9 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -16,6 +16,7 @@ interface IAppOption { newFeedback: string; }; userInfoReadyCallback?: WechatMiniprogram.GetUserInfoSuccessCallback; + initLogin: (callback?: () => void) => void; waitLogin: (waitLoginState?: boolean) => Promise; getMenuInfo: (arg0: WechatMiniprogram.Page.Instance) => void; getUserInfo: (arg0: WechatMiniprogram.Page.Instance, arg1?: (arg0: any) => void) => void;