跳出到 登录功能 重构

This commit is contained in:
geyun
2026-10-15 10:07:42 +08:00
parent 988a0aee34
commit 8acce63d8f
3 changed files with 7 additions and 5 deletions

View File

@@ -460,7 +460,6 @@
<div class="form-panel" id="weixin-panel">
<div id="weixin_container"></div>
<p class="wechat-tip">请使用微信扫描二维码登录</p>
</div>
</div>
@@ -480,6 +479,8 @@
</div>
<div class="toast" id="toast"></div>
<script src="./wxLogin.js"></script>
<script>
const WECHAT_APPID = 'wx0eeb7556d60121db';
@@ -572,7 +573,7 @@
btn.disabled = true;
btn.innerText = '登陆中...';
fetch('http://1.95.137.212:8081/login', {
fetch('https://serviceri.satabot.com/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username, password, sourceType: 1 })
@@ -587,7 +588,7 @@
if (data.userName) setCookie('nickname', data.userName, 7);
setTimeout(() => {
window.location.href = './index.html?userId=' + encodedUserId;
}, 500);
}, 100);
} else {
showToast((data && data.msg) || '账号或密码错误');
btn.disabled = false;

View File

@@ -750,7 +750,7 @@ app.post("/user", async (req, res) => {
if (!userId && userId != "NaN") {
res.json({
code: 300,
error: "http://ri.satabot.com/#/login?goRemote=1",
error: "https://ai.satabot.com/login.html",
msg: "未找到该用户"
});
return;
@@ -836,7 +836,7 @@ app.get("/sessions", async (req, res) => {
code: 300,
// error:'https://gsgg.com'
// error: "http://ri.satabot.com/#/dhhdghgbshwadhg"
error: "http://ri.satabot.com/#/login?goRemote=1"
error: "https://ai.satabot.com/login.html"
});
return;
// return res.status(500).json({ code: 505, error: "http://1.95.137.212/#/login?redirect=%2Findex&goRemote=1" });

1
wxLogin.js Normal file
View File

@@ -0,0 +1 @@
!function (e, t) { e.WxLogin = function (o) { var n = "default"; !0 === o.self_redirect ? n = "true" : !1 === o.self_redirect && (n = "false"); var r = t.createElement("iframe"), s = (new Date).getTime(), a = "https://open.weixin.qq.com/connect/qrconnect?appid=" + o.appid + "&scope=" + o.scope + "&redirect_uri=" + o.redirect_uri + "&state=" + o.state + "&login_type=jssdk&self_redirect=" + n + "&styletype=" + (o.styletype || "") + "&sizetype=" + (o.sizetype || "") + "&bgcolor=" + (o.bgcolor || "") + "&rst=" + (o.rst || "") + "&ts=" + s; a += o.style ? "&style=" + o.style : "", a += o.href ? "&href=" + o.href : "", a += "en" === o.lang ? "&lang=en" : "", a += 1 === o.stylelite ? "&stylelite=1" : "", a += 0 === o.fast_login ? "&fast_login=0" : "", "auto" === o.color_scheme ? a += "&color_scheme=auto" : "dark" === o.color_scheme ? a += "&color_scheme=dark" : "light" === o.color_scheme && (a += "&color_scheme=light"), r.src = a, r.frameBorder = "0", r.allowTransparency = "true", r.scrolling = "no", r.width = "300px", r.height = "400px", r.allow = "local-network-access"; var c = t.getElementById(o.id); if (c.innerHTML = "", c.appendChild(r), e.addEventListener && e.JSON) { var i = function (t) { if ("https://open.weixin.qq.com" === t.origin) try { var n = JSON.parse(t.data); if (n && "status" === n.type) { var r = "wxReady" === n.status; r && o.onReady && "function" == typeof o.onReady && o.onReady(r), "wxQRcodeReady" === n.status && o.onQRcodeReady && "function" == typeof o.onQRcodeReady && o.onQRcodeReady() } } catch (t) { e.console && "function" == typeof e.console.log && e.console.log("wxLogin postMessage error", t) } }; e.addEventListener("message", i, !1); var l = !1; o.onCleanup = function () { !l && e.removeEventListener && (e.removeEventListener("message", i, !1), l = !0) } } } }(window, document);