xc-app/login.html

54 lines
1.8 KiB
HTML
Executable File

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-cache" />
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-store, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
<META HTTP-EQUIV="expires" CONTENT="0">
</head>
<body>
<script type="text/javascript" src="https://cdn.bootcdn.net/ajax/libs/vConsole/3.9.0/vconsole.min.js"></script>
<script>
// init vConsole
// var vConsole = new VConsole();
// console.log('Hello VConsole');
</script>
<script type="text/javascript">
function getUrlParam(name) {
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [,
""
])[1].replace(/\+/g, '%20')) || null
}
window.onload = function() {
var code = getUrlParam('code');
// debugger;
console.log("-------code:",code)
location.href = `./index.html#/pages/login/login?code=${code}`;
// if (!code) { // 没有登入之前
// var redirect_uri = encodeURI(window.location.origin + window.location.pathname);
// var data = {
// appid: 'wx47db6cca5930ce74',
// redirect_uri: redirect_uri,
// response_type: 'code',
// scope: 'snsapi_userinfo',
// state: ''
// };
// location.href =
// `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${data.appid}&redirect_uri=${data.redirect_uri}&response_type=${data.response_type}&scope=${data.scope}&state=${data.state}#wechat_redirect`;
// } else { // 登入后
// localStorage.setItem('code', code);
// setTimeout(() => {
// location.href = './index.html#/pages/login/login';
// }, 500);
// }
};
</script>
</body>
</html>