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->save();
// 返回简单页面,让用户知道可以关闭了
return new \Webman\Http\Response(200, [], '<!DOCTYPE html>
// 返回空页面,自动关闭(飞书APP内会自动返回)
return new \Webman\Http\Response(200, ['Content-Type' => 'text/html; charset=utf-8'], '<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>登录成功</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
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>
<script>
// 尝试关闭窗口(飞书APP内会自动返回)
window.close();
// 备用:如果无法关闭,显示简单提示
setTimeout(function() {
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>";
}, 100);
</script>
</head>
<body>
<div class="container">
<div class="icon">✅</div>
<h1>登录成功</h1>
<p>您可以关闭此页面返回电脑端继续操作</p>
</div>
</body>
</html>');
} catch (\Exception $e) {