refactor(login): 重构登录页面并优化账号绑定逻辑
- 调整页面布局,使内容居中显示 - 移除不必要的键盘事件监听代码 - 抽离 handleBind 和 processLogin 函数,提高代码复用性 - 修改按钮点击事件处理方式,使用 onclick 属性
This commit is contained in:
		
							
								
								
									
										26
									
								
								linuxdo.php
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								linuxdo.php
									
									
									
									
									
								
							| @@ -162,23 +162,7 @@ function get_curl($url, $post = 0, $referer = 0, $cookie = 0, $header = 0, $ua = | |||||||
|     <meta name="keywords" content="<?= $_CONFIG['game_name'] ?>,<?= $_CONFIG['game_description'] ?>"> |     <meta name="keywords" content="<?= $_CONFIG['game_name'] ?>,<?= $_CONFIG['game_description'] ?>"> | ||||||
|  |  | ||||||
|     <link rel="stylesheet" href="static/css/login.css?v=1.1.6" /> |     <link rel="stylesheet" href="static/css/login.css?v=1.1.6" /> | ||||||
|     <script> |  | ||||||
|         document.onkeydown = document.onkeyup = document.onkeypress = function (event) { |  | ||||||
|             var e = event || window.event || arguments.callee.caller.arguments[0]; |  | ||||||
|             if (e && e.keyCode == 123) { |  | ||||||
|                 e.returnValue = false; |  | ||||||
|                 return false; |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|     </script> |  | ||||||
| </head> |  | ||||||
|  |  | ||||||
| <body oncontextmenu="return false" onselectstart="return false" ondragstart="return false"> |  | ||||||
|     <?php if (empty($row)) { ?> |  | ||||||
|         <div style="width:400px"> |  | ||||||
|             当前尚未有你的游戏账号,请选择<br> |  | ||||||
|             <a onclick="registerDirect" style="cursor:pointer"><b>Linuxdo账号绑定</b></a></br> |  | ||||||
|             <input type="hidden" id="linuxdo" value="<?= $userInfo['user_username'] ?>"> |  | ||||||
|     <script> |     <script> | ||||||
|         function handleBind(account, linuxdo_account) { |         function handleBind(account, linuxdo_account) { | ||||||
|             return fetch("/linuxdo?act=bind&account=" + account + "&connect_id=" + linuxdo_account).then(res => { |             return fetch("/linuxdo?act=bind&account=" + account + "&connect_id=" + linuxdo_account).then(res => { | ||||||
| @@ -211,6 +195,14 @@ function get_curl($url, $post = 0, $referer = 0, $cookie = 0, $header = 0, $ua = | |||||||
|         } |         } | ||||||
|  |  | ||||||
|     </script> |     </script> | ||||||
|  | </head> | ||||||
|  |  | ||||||
|  | <body oncontextmenu="return false" onselectstart="return false" ondragstart="return false"> | ||||||
|  |     <?php if (empty($row)) { ?> | ||||||
|  |         <div style="width:400px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);display:flex;justify-content:center;align-items:center;flex-direction:column;"> | ||||||
|  |             当前尚未有你的游戏账号,请选择<br> | ||||||
|  |             <a onclick="registerDirect" style="cursor:pointer"><b>Linuxdo账号绑定</b></a></br> | ||||||
|  |             <input type="hidden" id="linuxdo" value="<?= $userInfo['user_username'] ?>"> | ||||||
|             <br> |             <br> | ||||||
|             如果已有账号,请输入账号和密码<br> |             如果已有账号,请输入账号和密码<br> | ||||||
|             <input type="text" id="account" placeholder="请输入账号" onKeyUp="value = value.replace(/[\W]/g, '')" |             <input type="text" id="account" placeholder="请输入账号" onKeyUp="value = value.replace(/[\W]/g, '')" | ||||||
| @@ -218,7 +210,7 @@ function get_curl($url, $post = 0, $referer = 0, $cookie = 0, $header = 0, $ua = | |||||||
|             <br> |             <br> | ||||||
|             <input type="password" id="password" placeholder="请输入密码"> |             <input type="password" id="password" placeholder="请输入密码"> | ||||||
|             <br> |             <br> | ||||||
|             <button type="submit" @click="linkAccount">绑定并登录</button> |             <button type="submit" onclick="linkAccount">绑定并登录</button> | ||||||
|         </div> |         </div> | ||||||
|     <?php } ?> |     <?php } ?> | ||||||
| </body> | </body> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user