update pages/index/login.vue.

避免先用手机登录再到付款页面重新微信授权登录时,绑定openId还没执行完就跳转回去,又陷入没登录的循环,这里做一个延迟跳转

Signed-off-by: blue2999 <14265734+blue2999@user.noreply.gitee.com>
pull/52/head
blue2999 2024-05-06 01:36:12 +00:00 committed by Gitee
parent ae3cef3e19
commit 864a057392
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 16 additions and 10 deletions

View File

@ -17,22 +17,28 @@
const event = options.event; const event = options.event;
const code = options.code; const code = options.code;
const state = options.state; const state = options.state;
let time = 10;
if (event === 'login') { // if (event === 'login') { //
const res = await sheep.$platform.useProvider().login(code, state); const res = await sheep.$platform.useProvider().login(code, state);
} else if (event === 'bind') { // } else if (event === 'bind') { //
sheep.$platform.useProvider().bind(code, state); sheep.$platform.useProvider().bind(code, state);
time = 1000;
} }
// H5 // openId
let returnUrl = uni.getStorageSync('returnUrl'); setTimeout(function(){
if (returnUrl) { // H5
uni.removeStorage({key:'returnUrl'}); let returnUrl = uni.getStorageSync('returnUrl');
location.replace(returnUrl); if (returnUrl) {
} else { uni.removeStorage({key:'returnUrl'});
uni.switchTab({ location.replace(returnUrl);
url: '/', } else {
}); uni.switchTab({
} url: '/',
});
}
},time);
// #endif // #endif
}); });
</script> </script>