Browse Source

修改手机授权问题

bding 7 months ago
parent
commit
c21edfa4b5
3 changed files with 13 additions and 20 deletions
  1. 1 13
      src/Login2p/Login2p.tsx
  2. 10 5
      src/Login2p/Login2pWechatLanding.tsx
  3. 2 2
      src/styles/NewPage.module.scss

+ 1 - 13
src/Login2p/Login2p.tsx

@@ -65,19 +65,7 @@ const Login2p: React.FC = () => {
     onError: e => message.error('验证码请求失败~')
   })
   const checkLogin = () => {
-    if (login2p.jwt) {
-      if (!login2p.isWechat) {
-        history.push(`/${login2p.inviteCode ? '?invite_code=' + login2p.inviteCode : ''}`)
-        message.info('您已登录').then(r => undefined)
-      } else {
-        //如果是微信小程序则直接退出
-        // wx.miniProgram.navigateBack()
-      }
-    } else if (login2p.isWechat && !wechatToken) {
-      login2p.loginWechatLaunch(
-        `${process.env.REACT_APP_URL}login2p/wechat?next=${next ? next : encodeURIComponent('/')}`
-      )
-    }
+    return
   }
   // 设置、修改密码
   const setUpPasswordHandlern = () => {

+ 10 - 5
src/Login2p/Login2pWechatLanding.tsx

@@ -16,11 +16,16 @@ const Login2pWechatLanding: React.FC = () => {
     const channel = new BroadcastChannel('myChannel')
 
     if (code) {
-      // 向广播通道发送消息
-      channel.postMessage({ code, next })
-      // 关闭频道
-      channel.close()
-      window.close()
+      if (login2p.isWechat) {
+        login2p.loginWechat(code, decodeURIComponent(next ? next : '/')).then(r => console.log(r))
+      } else {
+        // 向广播通道发送消息
+        channel.postMessage({ code, next })
+        // 关闭频道
+        channel.close()
+        window.close()
+      }
+
       // login2p.loginWechat(code, decodeURIComponent(next ? next : '/')).then(r => console.log(r))
     }
   }, [])

+ 2 - 2
src/styles/NewPage.module.scss

@@ -686,11 +686,11 @@
   .login-content-box-mobile {
     width: 100%;
     height: 100%;
-    padding: 220px 30px 0;
+    padding: 115px 30px 0;
     height: auto;
     box-sizing: border-box;
   }
   .custom-style-divider {
-    padding-top: 130px;
+    padding-top: 50px;
   }
 }