-
-
+
+
+
+
+
+
+
+

+
+
新能源智能体
+
sataBotAgent
+
+
+
+
+
+
+
+
+
-
-
-
+ if (!agree) {
+ showToast('请阅读并同意用户协议!');
+ return;
+ }
+ const username = document.getElementById('username').value.trim();
+ const password = document.getElementById('password').value;
+ const rememberMe = document.getElementById('rememberMe').checked;
+ const btn = document.getElementById('loginBtn');
+ if (!username) { showToast('请输入账号'); return; }
+ if (!password) { showToast('请输入密码'); return; }
+ if (rememberMe) {
+ setCookie('username', username, 30);
+ setCookie('password', password, 30);
+ setCookie('rememberMe', true, 30);
+ } else {
+ removeCookie('username');
+ removeCookie('password');
+ removeCookie('rememberMe');
+ }
+ btn.disabled = true;
+ btn.innerText = '登录中...';
+ fetch('https://serviceri.satabot.com/login', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ username, password, sourceType: 1 })
+ })
+ .then(r => r.json())
+ .then(data => {
+
+ if (data && data.code === 200 && data.userId) {
+ const rawUserId = String(data.userId);
+ const encodedUserId = btoa(unescape(encodeURIComponent(rawUserId)));
+ setCookie('token', data.token || ('t_' + Date.now()), 7);
+ setCookie('userId', rawUserId, 7);
+ //if (data.username) setCookie('nickname', data.username, 7);
+ setTimeout(() => {
+ window.location.href = './index.html?userId=' + encodedUserId;
+ }, 100);
+ } else {
+ showToast((data && data.msg) || '账号或密码错误');
+ btn.disabled = false;
+ btn.innerText = '登录';
+ }
+ })
+ .catch(() => {
+ showToast('登录请求失败,请稍后重试');
+ btn.disabled = false;
+ btn.innerText = '登录';
+ });
+ }
+ let wxInited = false;
+ function initWxLogin() {
+ if (wxInited) return;
+ if (typeof window.WxLogin !== 'function') {
+ setTimeout(initWxLogin, 100);
+ return;
+ }
+ try {
+ new window.WxLogin({
+ id: 'weixin_container',
+ appid: WECHAT_APPID,
+ scope: 'snsapi_login',
+ redirect_uri: WECHAT_REDIRECT_URI,
+ state: 'ai'
+ });
+ wxInited = true;
+ } catch (e) {
+ console.error('WxLogin init error:', e);
+ }
+ }
+ history.pushState(null, null, location.href);
+ window.addEventListener('popstate', () => {
+ history.pushState(null, null, location.href);
+ });
+ if (getCookie('token') && getCookie('userId')) {
+ const rawUserId = getCookie('userId');
+ const encodedUserId = btoa(unescape(encodeURIComponent(rawUserId)));
+ window.location.href = './index.html?userId=' + encodedUserId;
+ }
+
-
diff --git a/server2.js b/server2.js
index 6f85cf1..af1b890 100755
--- a/server2.js
+++ b/server2.js
@@ -765,7 +765,7 @@ app.post("/user", async (req, res) => {
if (rows.length === 0) {
res.json({
code: 300,
- error: "http://ri.satabot.com/#/login?goRemote=1",
+ error: "https://ai.satabot.com/login.html",
msg: "未找到该用户"
});
return;