feat: 微信自动关闭功能
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0, maximum-scale=1, user-scalable=no">
|
||||
<title>登录中转</title>
|
||||
<title>登录</title>
|
||||
<style>
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
@@ -40,6 +40,7 @@
|
||||
<div class="loading">Loading Code...</div>
|
||||
<script type="module">
|
||||
import { loginSuccessUrl } from './config.js';
|
||||
import { closePage } from './is-wechat.js';
|
||||
const url = new URL(window.location.href);
|
||||
const state = url.searchParams.get('state');
|
||||
const code = url.searchParams.get('code');
|
||||
@@ -51,18 +52,13 @@
|
||||
console.error(err);
|
||||
alert('登录失败,请稍后再试');
|
||||
document.body.append('登录失败,请稍后再试');
|
||||
setTimeout(() => {
|
||||
window.close();
|
||||
}, 2000);
|
||||
closePage();
|
||||
});
|
||||
// document.body.append(JSON.stringify(res, null, 2));
|
||||
if (res.code === 200) {
|
||||
localStorage.setItem('token', res.data.token);
|
||||
window.close()
|
||||
setTimeout(() => {
|
||||
window.open(loginSuccessUrl, '_blank');
|
||||
}, 1000);
|
||||
}
|
||||
closePage();
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user