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>({ @@ -46,6 +46,24 @@ App<IAppOption>({
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<IAppOption>({ @@ -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) {
let time: number;

1
typings/index.d.ts vendored

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

Loading…
Cancel
Save