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

View File

@@ -1530,8 +1530,8 @@
<!-- 左侧侧边栏 --> <!-- 左侧侧边栏 -->
<div class="sidebar" id="sidebar"> <div class="sidebar" id="sidebar">
<button class="toggle-btn" id="toggleBtn" onclick="toggleSidebar()"><svg width="50" height="24" viewBox="0 0 30 18" <button class="toggle-btn" id="toggleBtn" onclick="toggleSidebar()"><svg width="50" height="24"
xmlns="http://www.w3.org/2000/svg"> viewBox="0 0 30 18" xmlns="http://www.w3.org/2000/svg">
<!-- 上面较粗的横线 --> <!-- 上面较粗的横线 -->
<rect x="2" y="3" width="26" height="3.2" rx="1.6" fill="#222" /> <rect x="2" y="3" width="26" height="3.2" rx="1.6" fill="#222" />
@@ -1546,16 +1546,16 @@
<div class="chat-list" id="chatList"></div> <div class="chat-list" id="chatList"></div>
<div class="fourquestion sidequestion"> <div class="fourquestion sidequestion">
<div> <div>
<div class='question' data-value='分析这个场站' data-pre-value="详细分析这个光伏场站,根据图片给出详细的运维方案"><img src="./img/1.png" <div class='question' data-value='分析这个场站' data-pre-value="详细分析这个光伏场站,根据图片给出详细的运维方案"><img
alt="">分析这个场站</div> src="./img/1.png" alt="">分析这个场站</div>
<div class='question' data-value='详细的割草计划' data-pre-value="如果这个光伏场站需要割草怎么做,给出一份详细的计划"><img src="./img/3.png" <div class='question' data-value='详细的割草计划' data-pre-value="如果这个光伏场站需要割草怎么做,给出一份详细的计划"><img
alt="">详细的割草计划</div> src="./img/3.png" alt="">详细的割草计划</div>
<div class='question' data-value='详细的清洗计划' data-pre-value="如果这个光伏场站需要用无人机清洗怎么做,给出一份详细的计划"><img src="./img/4.png" <div class='question' data-value='详细的清洗计划' data-pre-value="如果这个光伏场站需要用无人机清洗怎么做,给出一份详细的计划"><img
alt="">详细的清洗计划</div> src="./img/4.png" alt="">详细的清洗计划</div>
</div> </div>
<div> <div>
<div class='question' data-value='详细的巡检计划' data-pre-value="如果这个光伏场站需要巡检怎么做,给出一份详细的计划"><img src="./img/2.png" <div class='question' data-value='详细的巡检计划' data-pre-value="如果这个光伏场站需要巡检怎么做,给出一份详细的计划"><img
alt="">详细的巡检计划</div> src="./img/2.png" alt="">详细的巡检计划</div>
</div> </div>
@@ -1569,8 +1569,9 @@
<!-- 折叠面板 --> <!-- 折叠面板 -->
<div class="userinfo-panel"> <div class="userinfo-panel">
<!-- <p style="margin:0px"><img src="" alt=""><span class="username">用户</span></p> --> <!-- <p style="margin:0px"><img src="" alt=""><span class="username">用户</span></p> -->
<span class="logout logout1" onclick="logout()"><svg t="1764305134824" class="icon" viewBox="0 0 1024 1024" <span class="logout logout1" onclick="logout()"><svg t="1764305134824" class="icon"
version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="20125" width="16" height="16"> viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="20125" width="16"
height="16">
<path <path
d="M874.666667 855.744a19.093333 19.093333 0 0 1-19.136 18.922667H168.469333A19.2 19.2 0 0 1 149.333333 855.530667V168.469333A19.2 19.2 0 0 1 168.469333 149.333333h687.061334c10.581333 0 19.136 8.533333 19.136 18.922667V320h42.666666V168.256A61.717333 61.717333 0 0 0 855.530667 106.666667H168.469333A61.866667 61.866667 0 0 0 106.666667 168.469333v687.061334A61.866667 61.866667 0 0 0 168.469333 917.333333h687.061334A61.76 61.76 0 0 0 917.333333 855.744V704h-42.666666v151.744zM851.84 533.333333l-131.797333 131.754667a21.141333 21.141333 0 0 0 0.213333 29.973333 21.141333 21.141333 0 0 0 29.973333 0.192l165.589334-165.589333a20.821333 20.821333 0 0 0 6.122666-14.976 21.44 21.44 0 0 0-6.314666-14.997333l-168.533334-168.533334a21.141333 21.141333 0 0 0-29.952-0.213333 21.141333 21.141333 0 0 0 0.213334 29.973333L847.296 490.666667H469.333333v42.666666h382.506667z" d="M874.666667 855.744a19.093333 19.093333 0 0 1-19.136 18.922667H168.469333A19.2 19.2 0 0 1 149.333333 855.530667V168.469333A19.2 19.2 0 0 1 168.469333 149.333333h687.061334c10.581333 0 19.136 8.533333 19.136 18.922667V320h42.666666V168.256A61.717333 61.717333 0 0 0 855.530667 106.666667H168.469333A61.866667 61.866667 0 0 0 106.666667 168.469333v687.061334A61.866667 61.866667 0 0 0 168.469333 917.333333h687.061334A61.76 61.76 0 0 0 917.333333 855.744V704h-42.666666v151.744zM851.84 533.333333l-131.797333 131.754667a21.141333 21.141333 0 0 0 0.213333 29.973333 21.141333 21.141333 0 0 0 29.973333 0.192l165.589334-165.589333a20.821333 20.821333 0 0 0 6.122666-14.976 21.44 21.44 0 0 0-6.314666-14.997333l-168.533334-168.533334a21.141333 21.141333 0 0 0-29.952-0.213333 21.141333 21.141333 0 0 0 0.213334 29.973333L847.296 490.666667H469.333333v42.666666h382.506667z"
fill="#3D3D3D" p-id="20126"></path> fill="#3D3D3D" p-id="20126"></path>
@@ -1637,8 +1638,8 @@
src="./img/1.png" alt="">分析这个场站</div> src="./img/1.png" alt="">分析这个场站</div>
<div class='question mainauestion' data-value='详细的割草计划' data-pre-value="如果这个光伏场站需要割草怎么做,给出一份详细的计划"><img <div class='question mainauestion' data-value='详细的割草计划' data-pre-value="如果这个光伏场站需要割草怎么做,给出一份详细的计划"><img
src="./img/3.png" alt="">详细的割草计划</div> src="./img/3.png" alt="">详细的割草计划</div>
<div class='question mainauestion' data-value='详细的清洗计划' data-pre-value="如果这个光伏场站需要用无人机清洗怎么做,给出一份详细的计划"><img <div class='question mainauestion' data-value='详细的清洗计划' data-pre-value="如果这个光伏场站需要用无人机清洗怎么做,给出一份详细的计划">
src="./img/4.png" alt="">详细的清洗计划</div> <img src="./img/4.png" alt="">详细的清洗计划</div>
<div class='question mainauestion' data-value='详细的巡检计划' data-pre-value="如果这个光伏场站需要巡检怎么做,给出一份详细的计划"><img <div class='question mainauestion' data-value='详细的巡检计划' data-pre-value="如果这个光伏场站需要巡检怎么做,给出一份详细的计划"><img
src="./img/2.png" alt="">详细的巡检计划</div> src="./img/2.png" alt="">详细的巡检计划</div>
@@ -1650,9 +1651,11 @@
<div class="img-row none"> <div class="img-row none">
<div class="img-box"> <div class="img-box">
<img src="" alt=""> <img src="" alt="">
<span class="delete-btn" onclick="deleteImg()"><svg t="1757836617046" class="icon" viewBox="0 0 1024 1024" <span class="delete-btn" onclick="deleteImg()"><svg t="1757836617046" class="icon"
version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="16945" width="16" height="16"> viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="16945"
<path d="M512 512m-512 0a512 512 0 1 0 1024 0 512 512 0 1 0-1024 0Z" fill="#EF4631" p-id="16946"> width="16" height="16">
<path d="M512 512m-512 0a512 512 0 1 0 1024 0 512 512 0 1 0-1024 0Z" fill="#EF4631"
p-id="16946">
</path> </path>
<path <path
d="M733.6 733.6c-16.7 16.7-43.7 16.6-60.2 0.1l-151-151-151 151c-16.6 16.6-43.4 16.6-60.2-0.1-16.7-16.7-16.6-43.7-0.1-60.2l151-151-151-151c-16.6-16.6-16.6-43.4 0.1-60.2 16.7-16.7 43.7-16.6 60.2-0.1l151 151 151-151c16.6-16.6 43.4-16.6 60.2 0.1 16.7 16.7 16.6 43.7 0.1 60.2l-151 151 151 151c16.6 16.6 16.7 43.4-0.1 60.2z" d="M733.6 733.6c-16.7 16.7-43.7 16.6-60.2 0.1l-151-151-151 151c-16.6 16.6-43.4 16.6-60.2-0.1-16.7-16.7-16.6-43.7-0.1-60.2l151-151-151-151c-16.6-16.6-16.6-43.4 0.1-60.2 16.7-16.7 43.7-16.6 60.2-0.1l151 151 151-151c16.6-16.6 43.4-16.6 60.2 0.1 16.7 16.7 16.6 43.7 0.1 60.2l-151 151 151 151c16.6 16.6 16.7 43.4-0.1 60.2z"
@@ -1712,8 +1715,8 @@
<div class='question mainauestion' data-value='详细的割草计划' data-pre-value="如果这个光伏场站需要割草怎么做,给出一份详细的计划"><img <div class='question mainauestion' data-value='详细的割草计划' data-pre-value="如果这个光伏场站需要割草怎么做,给出一份详细的计划"><img
src="./img/3.png" alt="">详细的割草计划</div> src="./img/3.png" alt="">详细的割草计划</div>
<div class='question mainauestion' data-value='详细的清洗计划' data-pre-value="如果这个光伏场站需要用无人机清洗怎么做,给出一份详细的计划"><img <div class='question mainauestion' data-value='详细的清洗计划' data-pre-value="如果这个光伏场站需要用无人机清洗怎么做,给出一份详细的计划">
src="./img/4.png" alt="">详细的清洗计划</div> <img src="./img/4.png" alt="">详细的清洗计划</div>
<div class='question mainauestion' data-value='详细的巡检计划' data-pre-value="如果这个光伏场站需要巡检怎么做,给出一份详细的计划"><img <div class='question mainauestion' data-value='详细的巡检计划' data-pre-value="如果这个光伏场站需要巡检怎么做,给出一份详细的计划"><img
src="./img/2.png" alt="">详细的巡检计划</div> src="./img/2.png" alt="">详细的巡检计划</div>
@@ -1724,9 +1727,11 @@
<div class="img-row none"> <div class="img-row none">
<div class="img-box"> <div class="img-box">
<img src="" alt=""> <img src="" alt="">
<span class="delete-btn" onclick="deleteImg()"><svg t="1757836617046" class="icon" viewBox="0 0 1024 1024" <span class="delete-btn" onclick="deleteImg()"><svg t="1757836617046" class="icon"
version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="16945" width="16" height="16"> viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="16945"
<path d="M512 512m-512 0a512 512 0 1 0 1024 0 512 512 0 1 0-1024 0Z" fill="#EF4631" p-id="16946"> width="16" height="16">
<path d="M512 512m-512 0a512 512 0 1 0 1024 0 512 512 0 1 0-1024 0Z" fill="#EF4631"
p-id="16946">
</path> </path>
<path <path
d="M733.6 733.6c-16.7 16.7-43.7 16.6-60.2 0.1l-151-151-151 151c-16.6 16.6-43.4 16.6-60.2-0.1-16.7-16.7-16.6-43.7-0.1-60.2l151-151-151-151c-16.6-16.6-16.6-43.4 0.1-60.2 16.7-16.7 43.7-16.6 60.2-0.1l151 151 151-151c16.6-16.6 43.4-16.6 60.2 0.1 16.7 16.7 16.6 43.7 0.1 60.2l-151 151 151 151c16.6 16.6 16.7 43.4-0.1 60.2z" d="M733.6 733.6c-16.7 16.7-43.7 16.6-60.2 0.1l-151-151-151 151c-16.6 16.6-43.4 16.6-60.2-0.1-16.7-16.7-16.6-43.7-0.1-60.2l151-151-151-151c-16.6-16.6-16.6-43.4 0.1-60.2 16.7-16.7 43.7-16.6 60.2-0.1l151 151 151-151c16.6-16.6 43.4-16.6 60.2 0.1 16.7 16.7 16.6 43.7 0.1 60.2l-151 151 151 151c16.6 16.6 16.7 43.4-0.1 60.2z"
@@ -1881,6 +1886,18 @@
let token = params.get("token");//app的token let token = params.get("token");//app的token
let localtoken = params.get("localtoken");//公众号的localtoken let localtoken = params.get("localtoken");//公众号的localtoken
function clearOldRootDomainCookies() {
const names = ['Admin-Token', 'token', 'userId', 'username', 'nickname', 'headimgurl', 'headingimg'];
const parts = location.hostname.split('.');
const rootDomain = parts.length >= 2 ? '.' + parts.slice(-2).join('.') : '';
if (!rootDomain || rootDomain === '.') return;
names.forEach(name => {
document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/; domain=' + rootDomain + ';';
});
console.log('[cookie] 已清除旧 root-domain cookie:', rootDomain);
}
clearOldRootDomainCookies();
// app会得到token; // app会得到token;
// 手机端会验证token // 手机端会验证token
@@ -1889,6 +1906,10 @@
if ((!getCookie("token") || localtoken != getCookie("token")) && isMobile() && !token) { if ((!getCookie("token") || localtoken != getCookie("token")) && isMobile() && !token) {
window.location.href = './middle.html'; window.location.href = './middle.html';
} }
if (!isMobile() && !getCookie("token") && !token && !params.get("nickname")) {
location.replace('./login.html');
}
// } // }
// else if (!isMobile() && !getCookie('sharetoken')) {//网页端token // else if (!isMobile() && !getCookie('sharetoken')) {//网页端token
// // // //
@@ -2126,6 +2147,7 @@
} }
questions.forEach(q => { questions.forEach(q => {
q.addEventListener("click", () => { q.addEventListener("click", () => {
@@ -2205,6 +2227,8 @@
function logout() { function logout() {
deleteCookie('userId'); deleteCookie('userId');
deleteCookie('token'); deleteCookie('token');
deleteCookie('nickname');
deleteCookie('headimgurl');
deleteCookie("sharetoken", "ai.satabot.com") deleteCookie("sharetoken", "ai.satabot.com")
// 清空历史记录(黑科技) // 清空历史记录(黑科技)
history.pushState(null, null, location.href); history.pushState(null, null, location.href);
@@ -2212,7 +2236,7 @@
history.pushState(null, null, location.href); history.pushState(null, null, location.href);
}); });
location.replace('https://ri.satabot.com/#/login?goRemote=1&clear=1'); location.replace('./login.html');
} }
function createSession(userId, sessionId) { function createSession(userId, sessionId) {
@@ -2719,7 +2743,6 @@
</div>` </div>`
loadingDiv.innerHTML = thinkinghtml; loadingDiv.innerHTML = thinkinghtml;
debugger;
msgDiv.appendChild(loadingDiv); msgDiv.appendChild(loadingDiv);
// ========================= // =========================

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