From f0de2a63664a86ee58a5fa7544afb1ccc3f936d5 Mon Sep 17 00:00:00 2001 From: chenruilong Date: Fri, 24 Feb 2023 15:21:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20web=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E7=99=BB=E5=BD=95=E5=9B=9E=E8=B0=83=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E4=B8=8D=E6=AD=A3=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../uni-id-pages-fab-login.vue | 52 ++++++++++++------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/uni_modules/uni-id-pages/components/uni-id-pages-fab-login/uni-id-pages-fab-login.vue b/uni_modules/uni-id-pages/components/uni-id-pages-fab-login/uni-id-pages-fab-login.vue index 9a10443..98e1be9 100644 --- a/uni_modules/uni-id-pages/components/uni-id-pages-fab-login/uni-id-pages-fab-login.vue +++ b/uni_modules/uni-id-pages/components/uni-id-pages-fab-login/uni-id-pages-fab-login.vue @@ -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() -- GitLab