fix: 扫码登录成功后返回空页面并自动关闭

手机端扫码成功后直接关闭并返回飞书,不显示任何页面内容。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
root
2026-02-26 11:08:10 +08:00
parent fd364be4b6
commit ad6984d22a
+10 -37
View File
@@ -261,49 +261,22 @@ class AuthController extends BaseController
$session->user_id = $user->id; $session->user_id = $user->id;
$session->save(); $session->save();
// 返回简单页面,让用户知道可以关闭了 // 返回空页面,自动关闭(飞书APP内会自动返回)
return new \Webman\Http\Response(200, [], '<!DOCTYPE html> return new \Webman\Http\Response(200, ['Content-Type' => 'text/html; charset=utf-8'], '<!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>登录成功</title> <script>
<style> // 尝试关闭窗口(飞书APP内会自动返回)
body { window.close();
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; // 备用:如果无法关闭,显示简单提示
display: flex; setTimeout(function() {
align-items: center; document.body.innerHTML = "<div style=\'display:flex;align-items:center;justify-content:center;min-height:100vh;margin:0;font-family:sans-serif;text-align:center;color:#666;\'><p>登录成功<br>您可以关闭此页面</p></div>";
justify-content: center; }, 100);
min-height: 100vh; </script>
margin: 0;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: #fff;
text-align: center;
}
.container {
padding: 40px 20px;
}
h1 {
margin: 0 0 10px 0;
font-size: 28px;
}
p {
margin: 10px 0 0 0;
font-size: 16px;
opacity: 0.9;
}
.icon {
font-size: 64px;
margin-bottom: 20px;
}
</style>
</head> </head>
<body> <body>
<div class="container">
<div class="icon">✅</div>
<h1>登录成功</h1>
<p>您可以关闭此页面返回电脑端继续操作</p>
</div>
</body> </body>
</html>'); </html>');
} catch (\Exception $e) { } catch (\Exception $e) {