Compare commits

...

4 Commits

Author SHA1 Message Date
geyun
5741135f2a 登陆界面 样式美化 修复一些bug 2026-10-15 10:58:43 +08:00
geyun
8acce63d8f 跳出到 登录功能 重构 2026-10-15 10:07:42 +08:00
mmc
988a0aee34 增加登录界面 2026-10-15 09:53:54 +08:00
geyun
2c0f835098 删除 debugger 2026-10-15 09:20:03 +08:00
5 changed files with 5624 additions and 3160 deletions

6337
index.html

File diff suppressed because one or more lines are too long

633
login.html Normal file
View File

@@ -0,0 +1,633 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="Thu, 01 Jan 1970 00:00:00 GMT">
<title>新能源智能体</title>
<link rel="icon" href="./img/logo.png" type="image/x-icon">
<script src="https://res.wx.qq.com/connect/zh_CN/htmledition/js/wxloginqrcode.js"></script>
<style>
*,
*::after,
*::before {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html,
body {
height: 100%;
width: 100%;
}
body {
display: flex;
justify-content: center;
align-items: center;
font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft Yahei", "Segoe UI", Arial, sans-serif;
font-size: 12px;
/* 美化背景:柔和蓝渐变 + 微弱径向光晕 */
background: linear-gradient(135deg, #e8f2ff 0%, #d6e8fc 100%);
color: #a0a5a8;
overflow: hidden;
/* 页面载入淡入 */
animation: pageFadeIn .8s ease;
}
@keyframes pageFadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
/* 可选:微弱浮动光点背景,不想用直接删掉这一段 */
body::before{
content:"";
position:fixed;
width:600px;
height:600px;
border-radius:50%;
background: radial-gradient(circle, rgba(22,119,255,0.08) 0%, transparent 70%);
top:-100px;
right:-100px;
z-index:-1;
}
body::after{
content:"";
position:fixed;
width:450px;
height:450px;
border-radius:50%;
background: radial-gradient(circle, rgba(22,119,255,0.06) 0%, transparent 70%);
bottom:-80px;
left:-80px;
z-index:-1;
}
.main {
position: relative;
width: 1100px;
height: 620px;
padding: 0;
background-color: #fff;
box-shadow: 0 12px 40px rgba(22, 119, 255, 0.12), 0 4px 12px rgba(0,0,0,0.06);
border-radius: 20px;
overflow: hidden;
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.main:hover{
box-shadow: 0 16px 50px rgba(22, 119, 255, 0.15), 0 6px 16px rgba(0,0,0,0.08);
}
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
position: absolute;
top: 0;
width: 600px;
height: 100%;
padding: 40px 30px;
background-color: #fff;
transition: 1.25s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.a-container {
z-index: 100;
left: calc(100% - 600px);
}
.form {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
width: 100%;
height: 100%;
}
.tab {
display: flex;
border-bottom: 1px solid #f0f0f0;
margin-bottom: 32px;
width: 70%;
}
.tab-item {
flex: 1;
text-align: center;
padding: 14px 0;
cursor: pointer;
font-size: 16px;
color: #666;
transition: all .24s;
}
.tab-item:hover{
color:#1677ff88;
}
.tab-item.active {
color: #1677ff;
border-bottom: 2px solid #1677ff;
font-weight:500;
}
.form-panel {
display: none;
width: 360px;
}
.form-panel.active {
display: block;
animation: panelFade 0.4s ease;
}
@keyframes panelFade {
from {opacity:0;transform: translateY(8px);}
to {opacity:1;transform: translateY(0);}
}
.input-group {
margin-bottom: 24px;
width: 100%;
}
.label {
font-size: 14px;
color: #333;
margin-bottom: 8px;
font-weight:500;
}
.username,
.password {
position: relative;
}
.username .icon,
.password .icon.left {
position: absolute;
top: 50%;
left: 0.75rem;
transform: translateY(-50%);
color: #b0b8c4;
width: 20px;
height: 20px;
transition: color .2s;
}
.password .icon.right {
position: absolute;
top: 50%;
right: 0.75rem;
transform: translateY(-50%);
color: #b0b8c4;
cursor: pointer;
width: 22px;
height: 22px;
transition: color .2s;
}
.username:focus-within .icon,
.password:focus-within .icon{
color:#1677ff;
}
.form__input {
width: 100%;
height: 44px;
margin: 4px 0;
padding-left: 2.5rem;
padding-right: 2.8rem;
font-size: 14px;
letter-spacing: 0.15px;
border: 1px solid #f0f2f5;
outline: none;
background-color: #fcfcfd;
transition: 0.25s ease;
border-radius: 10px;
}
.form__input:focus {
border-color:#1677ff;
box-shadow: 0 0 0 3px rgba(22,119,255,0.12);
background:#fff;
}
.remember {
width: 100%;
display: flex;
align-items: center;
gap: 6px;
margin: 8px 0 0;
font-size: 13px;
color: #333;
cursor: pointer;
user-select: none;
}
.remember input {
accent-color: #1677ff;
cursor: pointer;
}
.button {
width: 100%;
height: 48px;
border-radius: 10px;
margin-top: 24px;
font-weight: 600;
font-size: 15px;
letter-spacing: 0.5px;
background-color: #1677ff;
color: #ffffff;
border: none;
outline: none;
cursor: pointer;
transition: all 0.24s ease;
}
.button:hover {
background-color:#0f66dd;
transform: translateY(-2px);
box-shadow: 0 6px 16px rgba(22,119,255,0.28);
}
.button:active {
transform: translateY(0px);
box-shadow: 0 2px 8px rgba(22,119,255,0.2);
}
.button:disabled {
opacity: 0.6;
cursor: not-allowed;
transform:none;
box-shadow:none;
}
.agree {
font-size: 12px;
color: #666;
margin-top: 16px;
display: flex;
align-items: center;
gap: 4px;
}
.agree input {
accent-color: #1677ff;
}
.link {
color: #1677ff;
cursor: pointer;
transition: .2s;
}
.link:hover{
text-decoration:underline;
}
#weixin_container {
width: 300px;
height: 300px;
margin: 0 auto;
}
.wechat-tip {
text-align: center;
margin-top: 16px;
font-size: 13px;
color: #666;
}
.switch {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 500px;
padding: 50px;
z-index: 200;
transition: 1.25s cubic-bezier(0.25, 0.8, 0.25, 1);
background: linear-gradient(145deg,#1677ff,#4096ff);
overflow: hidden;
}
.switch__circle {
position: absolute;
width: 550px;
height: 550px;
border-radius: 50%;
background-color: rgba(255,255,255,0.12);
bottom: -70%;
left: -65%;
transition: 1.25s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.switch__container {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
position: absolute;
width: 480px;
transition: 1.25s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.switch__title {
font-size: 36px;
font-weight: 700;
line-height: 1.4;
color: #ffffff;
margin-left: 10px;
}
.switch__subtitle {
font-size: 20px;
font-weight: 400;
color: rgba(255,255,255,0.85);
margin-left: 10px;
margin-top:6px;
}
.logo-row {
display: flex;
align-items: center;
}
.logo-row img {
width: 64px;
}
.toast {
position: fixed;
top: 22%;
left: 50%;
transform: translateX(-50%);
background: rgba(0, 0, 0, 0.72);
color: #fff;
padding: 12px 20px;
border-radius: 10px;
font-size: 14px;
opacity: 0;
transition: opacity 0.3s ease, transform 0.3s ease;
z-index: 9999;
pointer-events: none;
white-space: nowrap;
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
transform: translate(-50%, -8px);
}
.toast.show {
opacity: 1;
transform: translate(-50%, 0);
}
@media (max-width: 1200px) {
.main {
transform: scale(0.92);
}
.switch {
width: 42%;
}
.container {
width: 58%;
}
}
@media (max-width: 1000px) {
.main {
transform: scale(0.85);
}
}
@media (max-width: 800px) {
body {
padding: 0;
}
.main {
transform: scale(1);
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
width: 100%;
border-radius:0;
box-shadow: none;
}
.a-container {
position: absolute;
z-index: 100;
left: 50%;
transform: translateX(-50%);
width:100%;
}
.switch {
display: none;
}
.tab {
width: 100%;
}
}
@media (max-width: 600px) {
.main {
transform: scale(1);
width:100%;
height:100vh;
border-radius:0;
}
.a-container {
width: 100%;
left: 50%;
transform: translateX(-50%);
}
.form-panel{
width:90%;
}
#weixin_container{
width:260px;
height:260px;
}
.switch {
display: none;
}
}
</style>
</head>
<body>
<div class="login">
<div class="main">
<div class="container a-container" id="a-container">
<div class="tab">
<div class="tab-item active" data-tab="password">密码登录</div>
<div class="tab-item" data-tab="weixin">微信登录</div>
</div>
<div class="form-panel active" id="password-panel">
<div class="input-group">
<div class="label">账号</div>
<div class="username">
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2" />
<circle cx="12" cy="7" r="4" />
</svg>
<input class="form__input" type="text" id="username" placeholder="请输入账号"
autocomplete="off" />
</div>
</div>
<div class="input-group">
<div class="label">密码</div>
<div class="password">
<svg class="icon left" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2">
<rect x="3" y="11" width="18" height="11" rx="2" />
<path d="M7 11V7a5 5 0 0 1 10 0v4" />
</svg>
<input class="form__input" type="password" id="password" placeholder="请输入密码"
autocomplete="off" onkeydown="if(event.key==='Enter') handleLogin()" />
<svg class="icon right" id="eyeBtn" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2">
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" />
<circle cx="12" cy="12" r="3" />
</svg>
</div>
</div>
<label class="remember">
<input type="checkbox" id="rememberMe" />
记住密码
</label>
<button class="button" id="loginBtn" onclick="handleLogin()">登录</button>
<div class="agree">
<input type="checkbox" id="agree" checked />
我已阅读并同意
<span class="link">《用户服务协议》</span>、
<span class="link">《隐私政策》</span>
</div>
</div>
<div class="form-panel" id="weixin-panel">
<div id="weixin_container"></div>
</div>
</div>
<div class="switch" id="switch-cnt">
<div class="switch__circle"></div>
<div class="switch__container">
<div class="logo-row">
<img src="./img/logo.png" alt="logo" onerror="this.style.display='none'">
<div>
<div class="switch__title">新能源智能体</div>
<div class="switch__subtitle">sataBotAgent</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="toast" id="toast"></div>
<script src="./wxLogin.js"></script>
<script>
const WECHAT_APPID = 'wx0eeb7556d60121db';
const WECHAT_REDIRECT_URI = encodeURIComponent('https://serviceai.satabot.com/webCallback/');
removeCookie('username');
removeCookie('nickname');
removeCookie('headimgurl');
function setCookie(name, value, days) {
days = days || 30;
const d = new Date();
d.setTime(d.getTime() + days * 24 * 60 * 60 * 1000);
document.cookie = name + '=' + encodeURIComponent(value) + ';expires=' + d.toUTCString() + ';path=/';
}
function getCookie(name) {
const m = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)'));
return m ? decodeURIComponent(m[2]) : undefined;
}
function removeCookie(name) {
document.cookie = name + '=;expires=Thu, 01 Jan 1970 00:00 UTC;path=/;';
}
function showToast(msg) {
const t = document.getElementById('toast');
t.innerText = msg;
t.classList.add('show');
clearTimeout(t._timer);
t._timer = setTimeout(() => t.classList.remove('show'), 2200);
}
const tabs = document.querySelectorAll('.tab-item');
const panels = document.querySelectorAll('.form-panel');
tabs.forEach(tab => {
tab.addEventListener('click', () => {
const target = tab.dataset.tab;
tabs.forEach(t => t.classList.remove('active'));
panels.forEach(p => p.classList.remove('active'));
tab.classList.add('active');
document.getElementById(target + '-panel').classList.add('active');
if (target === 'weixin') {
initWxLogin();
}
});
});
const eyeBtn = document.getElementById('eyeBtn');
const pwdInput = document.getElementById('password');
eyeBtn.addEventListener('click', () => {
const isPwd = pwdInput.type === 'password';
pwdInput.type = isPwd ? 'text' : 'password';
eyeBtn.innerHTML = isPwd
? '<path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"/><line x1="1" y1="1" x2="23" y2="23"/>'
: '<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/>';
});
function getCookieCredentials() {
const username = getCookie('username');
const password = getCookie('password');
const rememberMe = getCookie('rememberMe');
if (username !== undefined) document.getElementById('username').value = username;
if (password !== undefined) document.getElementById('password').value = password;
if (rememberMe !== undefined) document.getElementById('rememberMe').checked = Boolean(rememberMe === 'true' || rememberMe === true);
}
getCookieCredentials();
function handleLogin() {
const agree = document.getElementById('agree').checked;
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;
}
</script>
</body>
</html>

1807
logintest.vue Normal file

File diff suppressed because it is too large Load Diff

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;
@@ -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;
@@ -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);