feat: 联邦主页加守渊留言面板 — 给守渊留言等铸渊处理
This commit is contained in:
parent
56794326f6
commit
24d5170e0e
@ -353,7 +353,23 @@ body{
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 问铸渊 · 在线对话区 -->
|
||||
<!-- 给守渊留言 -->
|
||||
<div class="card">
|
||||
<div class="card-header"><span class="hd violet" style="background:var(--amber-glow);box-shadow:0 0 10px var(--amber-glow)"></span>给守渊留言<span class="r">铸渊不在 · 留言等他回来</span></div>
|
||||
<div style="display:flex;flex-direction:column;gap:12px">
|
||||
<div style="display:flex;gap:10px">
|
||||
<input id="msg-name" placeholder="你的名字" style="flex:1;padding:10px 14px;background:rgba(255,255,255,.03);border:1px solid var(--glass-edge);border-radius:12px;color:var(--text);font-size:13px;outline:none;font-family:inherit" onfocus="this.style.borderColor='rgba(90,208,224,.2)'" onblur="this.style.borderColor=''">
|
||||
<input id="msg-title" placeholder="标题" style="flex:2;padding:10px 14px;background:rgba(255,255,255,.03);border:1px solid var(--glass-edge);border-radius:12px;color:var(--text);font-size:13px;outline:none;font-family:inherit" onfocus="this.style.borderColor='rgba(90,208,224,.2)'" onblur="this.style.borderColor=''">
|
||||
</div>
|
||||
<textarea id="msg-content" placeholder="写下你想说的话… 守渊会保管好,等铸渊醒来时交给他。" style="width:100%;min-height:80px;padding:12px 14px;background:rgba(255,255,255,.03);border:1px solid var(--glass-edge);border-radius:12px;color:var(--text);font-size:13px;outline:none;resize:vertical;font-family:inherit;line-height:1.6" onfocus="this.style.borderColor='rgba(90,208,224,.2)'" onblur="this.style.borderColor=''"></textarea>
|
||||
<div style="display:flex;gap:10px;align-items:center">
|
||||
<button onclick="sendMessage()" id="msg-btn" style="padding:10px 24px;background:linear-gradient(135deg,rgba(212,160,48,.25),rgba(123,93,191,.15));border:1px solid var(--glass-edge);border-radius:12px;color:var(--light);font-size:13px;font-weight:500;cursor:pointer;transition:all .25s;font-family:inherit">发送留言 ✦</button>
|
||||
<span id="msg-status" style="font-size:12px;color:var(--text-faint)"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 问铸渊 · 在线对话区 -->
|
||||
<div class="card" id="chat-card">
|
||||
<div class="card-header" style="justify-content:space-between">
|
||||
<span><span class="hd heart" style="animation:led-pulse 2s ease-in-out infinite"></span>问铸渊 · 引导主控</span>
|
||||
@ -515,6 +531,23 @@ setInterval(checkNt,15000);checkNt();
|
||||
/* ── 浮窗对话 ── */
|
||||
let chatOpen=false;
|
||||
function toggleChat(){chatOpen=!chatOpen;document.getElementById('chat-panel').classList.toggle('open')}
|
||||
|
||||
/* ── 给守渊留言 ── */
|
||||
async function sendMessage(){
|
||||
const n=document.getElementById('msg-name').value.trim()||'匿名';
|
||||
const t=document.getElementById('msg-title').value.trim()||'未命名留言';
|
||||
const c=document.getElementById('msg-content').value.trim();
|
||||
if(!c){document.getElementById('msg-status').textContent='请写点什么';return}
|
||||
const btn=document.getElementById('msg-btn');btn.disabled=true;btn.textContent='发送中...';
|
||||
try{
|
||||
const r=await fetch('/api/message',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({name:n,title:t,content:c})});
|
||||
const d=await r.json();
|
||||
document.getElementById('msg-status').textContent=d.ok?'✅ 守渊已收到。':'❌ '+d.error;
|
||||
if(d.ok){document.getElementById('msg-title').value='';document.getElementById('msg-content').value=''}
|
||||
}catch(e){document.getElementById('msg-status').textContent='❌ 连接失败'}
|
||||
btn.disabled=false;btn.textContent='发送留言 ✦'
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user