Browse Source

登录流程兼容热启动

dev
kola-web 2 months ago
parent
commit
65aaba218b
  1. 29
      src/app.ts
  2. 1
      typings/index.d.ts

29
src/app.ts

@ -46,6 +46,24 @@ App<IAppOption>({
wx.ajax = licia.curry(request)({ gUrl: this.globalData.url }); 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({ wx.login({
success: (res) => { success: (res) => {
wx.ajax({ wx.ajax({
@ -61,17 +79,6 @@ App<IAppOption>({
}); });
}, },
}); });
wx.setInnerAudioOption({
obeyMuteSwitch: false,
mixWithOther: false,
});
},
onShow(options) {
if (options.query.scene) {
this.globalData.scene = parseScene(options.query.scene);
}
// this.startLogin();
}, },
waitLogin(waitLoginState = false) { waitLogin(waitLoginState = false) {
let time: number; let time: number;

1
typings/index.d.ts vendored

@ -16,6 +16,7 @@ interface IAppOption {
newFeedback: string; newFeedback: string;
}; };
userInfoReadyCallback?: WechatMiniprogram.GetUserInfoSuccessCallback; userInfoReadyCallback?: WechatMiniprogram.GetUserInfoSuccessCallback;
initLogin: (callback?: () => void) => void;
waitLogin: (waitLoginState?: boolean) => Promise<any>; waitLogin: (waitLoginState?: boolean) => Promise<any>;
getMenuInfo: (arg0: WechatMiniprogram.Page.Instance<any, any>) => void; getMenuInfo: (arg0: WechatMiniprogram.Page.Instance<any, any>) => void;
getUserInfo: (arg0: WechatMiniprogram.Page.Instance<any, any>, arg1?: (arg0: any) => void) => void; getUserInfo: (arg0: WechatMiniprogram.Page.Instance<any, any>, arg1?: (arg0: any) => void) => void;

Loading…
Cancel
Save