fix: 快捷语句改为横向扁平布局,支持左右滑动

This commit is contained in:
2026-04-12 20:15:46 +08:00
parent 6e87f59fab
commit c6f157aa97

View File

@@ -68,23 +68,25 @@
/* 输入区域 */
.input-container { padding: 16px 24px; border-top: 1px solid #e5e5e5; }
.input-area { max-width: 800px; margin: 0 auto; display: flex; gap: 12px; align-items: flex-start; }
.input-box { flex: 1; display: flex; gap: 8px; align-items: flex-end; }
.input-box textarea { flex: 1; padding: 12px 16px; border: 1px solid #ddd; border-radius: 12px; font-size: 16px; resize: none; outline: none; max-height: 200px; line-height: 1.5; }
.input-box textarea:focus { border-color: #10a37f; }
.input-area { max-width: 800px; margin: 0 auto; }
.input-row { display: flex; gap: 12px; align-items: center; }
.input-row textarea { flex: 1; padding: 12px 16px; border: 1px solid #ddd; border-radius: 12px; font-size: 16px; resize: none; outline: none; max-height: 200px; min-height: 48px; line-height: 1.5; }
.input-row textarea:focus { border-color: #10a37f; }
.send-btn { width: 48px; height: 48px; border-radius: 12px; background: #10a37f; border: none; color: #fff; cursor: pointer; font-size: 20px; display: flex; align-items: center; justify-content: center; transition: background 0.2s; }
.send-btn:hover { background: #0d8c6d; }
.send-btn:disabled { background: #ccc; cursor: not-allowed; }
/* 快捷语句 - 右侧 */
.quick-phrases-panel { width: 200px; padding: 8px; background: #f8f9fa; border-radius: 12px; max-height: 300px; overflow-y: auto; }
.quick-phrases-title { font-size: 12px; color: #999; margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; }
.quick-phrases-title button { background: none; border: 1px solid #ddd; padding: 2px 6px; border-radius: 4px; cursor: pointer; font-size: 12px; }
.quick-phrases-list { display: flex; flex-direction: column; gap: 6px; }
.quick-phrase-item { padding: 8px 12px; background: #fff; border: 1px solid #e0e0e0; border-radius: 6px; cursor: pointer; font-size: 13px; color: #333; transition: all 0.2s; position: relative; }
.quick-phrase-item:hover { background: #e8f5e9; border-color: #10a37f; }
.quick-phrase-item .phrase-delete { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); opacity: 0; cursor: pointer; color: #999; }
.quick-phrase-item:hover .phrase-delete { opacity: 1; }
/* 快捷语句 - 横向扁平 */
.quick-phrases-bar { display: flex; align-items: center; gap: 8px; margin-top: 12px; overflow-x: auto; padding: 4px 0; }
.quick-phrases-bar::-webkit-scrollbar { height: 4px; }
.quick-phrases-bar::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }
.add-phrase-btn { padding: 6px 10px; background: #f0f0f0; border: 1px solid #ddd; border-radius: 6px; cursor: pointer; font-size: 12px; color: #666; white-space: nowrap; }
.add-phrase-btn:hover { background: #e8e8e8; }
.phrase-list { display: flex; gap: 6px; flex: 1; }
.phrase-tag { padding: 6px 12px; background: #f5f5f5; border: 1px solid #e0e0e0; border-radius: 16px; cursor: pointer; font-size: 13px; color: #333; white-space: nowrap; transition: all 0.2s; position: relative; }
.phrase-tag:hover { background: #e8f5e9; border-color: #10a37f; }
.phrase-tag .tag-delete { display: none; margin-left: 6px; color: #999; }
.phrase-tag:hover .tag-delete { display: inline; }
/* 弹窗 */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: none; align-items: center; justify-content: center; z-index: 1000; }
@@ -127,17 +129,13 @@
<div class="input-container">
<div class="input-area">
<div class="input-box">
<div class="input-row">
<textarea id="messageInput" placeholder="输入消息..." rows="1"></textarea>
<button class="send-btn" id="sendBtn" onclick="sendMessage()"><i class="ri-send-plane-fill"></i></button>
</div>
<!-- 快捷语句右侧 -->
<div class="quick-phrases-panel">
<div class="quick-phrases-title">
<span><i class="ri-flashlight-line"></i> 快捷语句</span>
<button onclick="showAddPhraseModal()"><i class="ri-add-line"></i></button>
</div>
<div class="quick-phrases-list" id="quickPhrasesList"></div>
<div class="quick-phrases-bar">
<button class="add-phrase-btn" onclick="showAddPhraseModal()"><i class="ri-add-line"></i> 添加</button>
<div class="phrase-list" id="quickPhrasesList"></div>
</div>
</div>
</div>
@@ -400,7 +398,7 @@
function renderQuickPhrases() {
const container = document.getElementById('quickPhrasesList');
container.innerHTML = quickPhrases.map((p, i) => `
<div class="quick-phrase-item" onclick="usePhrase('${escapeHtml(p)}')">${p}<span class="phrase-delete" onclick="deletePhrase(${i},event)"><i class="ri-close-line"></i></span></div>
<span class="phrase-tag" onclick="usePhrase('${escapeHtml(p)}')">${p}<span class="tag-delete" onclick="deletePhrase(${i},event)"><i class="ri-close-line"></i></span></span>
`).join('');
}