提交 f0de2a63 编写于 作者: C chenruilong

fix: 修复 web微信登录回调地址不正确

上级 2922ab59
......@@ -61,7 +61,7 @@
"id": "weixin",
"text": "微信登录",
"logo": "/uni_modules/uni-id-pages/static/login/uni-fab-login/weixin.png",
},
},
// #ifndef MP-WEIXIN
{
"id": "apple",
......@@ -107,7 +107,7 @@
"id": "sinaweibo",
"text": "新浪微博", //暂未提供该登录方式的接口示例
"logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/sinaweibo.png",
}
}
// #endif
],
univerifyStyle: { //一键登录弹出窗的样式配置参数
......@@ -201,8 +201,8 @@
}
return '/' + pages[pages.length - n].route
},
toPage(path,index = 0) {
let type = ['navigateTo','redirectTo'][index]
toPage(path,index = 0) {
let type = ['navigateTo','redirectTo'][index]
//console.log('比较', this.getRoute(1),this.getRoute(2), path)
if (this.getRoute(1) == path.split('?')[0] && this.getRoute(1) ==
'/uni_modules/uni-id-pages/pages/login/login-withoutpwd') {
......@@ -294,10 +294,26 @@
// #ifdef H5
if(type == 'weixin'){
// console.log('开始微信网页登录');
let redirectUrl = location.protocol +'//'+
document.domain +
(window.location.href.includes('#')?'/#':'') +
'/uni_modules/uni-id-pages/pages/login/login-withoutpwd?is_weixin_redirect=true&type=weixin'
// let redirectUrl = location.protocol +'//'+
// document.domain +
// (window.location.href.includes('#')?'/#':'') +
// '/uni_modules/uni-id-pages/pages/login/login-withoutpwd?is_weixin_redirect=true&type=weixin'
// #ifdef VUE2
const baseUrl = process.env.BASE_URL
// #endif
// #ifdef VUE3
const baseUrl = import.meta.env.BASE_URL
// #endif
let redirectUrl = location.protocol +
'//' +
location.host +
(baseUrl ? '/': '') +
baseUrl.replace(/^\/|\/$/, '') +
(window.location.href.includes('#')?'/#':'') +
'/uni_modules/uni-id-pages/pages/login/login-withoutpwd?is_weixin_redirect=true&type=weixin'
// console.log('redirectUrl----',redirectUrl);
let ua = window.navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == 'micromessenger'){
// console.log('在微信公众号内');
......@@ -327,20 +343,20 @@
let onButtonsClickFn = async res => {
console.log('点击了第三方登录,provider:', res, res.provider, this.univerifyStyle.buttons.list);
clickAnotherButtons = true
let checkBoxState = await uni.getCheckBoxState();
// 同步一键登录弹出层隐私协议框是否打勾
// #ifdef VUE2
this.agree = checkBoxState[1].state
// #endif
// #ifdef VUE3
this.agree = checkBoxState.state
let checkBoxState = await uni.getCheckBoxState();
// 同步一键登录弹出层隐私协议框是否打勾
// #ifdef VUE2
this.agree = checkBoxState[1].state
// #endif
// #ifdef VUE3
this.agree = checkBoxState.state
// #endif
let {
path
} = this.univerifyStyle.buttons.list[res.index]
if (path) {
if( this.getRoute(1).includes('login-withoutpwd') && path.includes('login-withoutpwd') ){
this.getParentComponent().showCurrentWebview()
if (path) {
if( this.getRoute(1).includes('login-withoutpwd') && path.includes('login-withoutpwd') ){
this.getParentComponent().showCurrentWebview()
}
this.toPage(path,1)
closeUniverify()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册