388 lines
9.0 KiB
HTML
388 lines
9.0 KiB
HTML
|
|
<!DOCTYPE html>
|
||
|
|
<html lang="zh-CN">
|
||
|
|
<head>
|
||
|
|
<meta charset="UTF-8">
|
||
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||
|
|
<title>员工端结束会话固定按钮 - 交互原型</title>
|
||
|
|
<style>
|
||
|
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||
|
|
body {
|
||
|
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||
|
|
background: #f5f5f5;
|
||
|
|
display: flex;
|
||
|
|
justify-content: center;
|
||
|
|
align-items: center;
|
||
|
|
min-height: 100vh;
|
||
|
|
}
|
||
|
|
|
||
|
|
.phone-frame {
|
||
|
|
width: 390px;
|
||
|
|
height: 844px;
|
||
|
|
background: #fff;
|
||
|
|
border-radius: 36px;
|
||
|
|
box-shadow: 0 20px 60px rgba(0,0,0,.15);
|
||
|
|
overflow: hidden;
|
||
|
|
position: relative;
|
||
|
|
}
|
||
|
|
|
||
|
|
/* 标题栏 */
|
||
|
|
.header {
|
||
|
|
height: 56px;
|
||
|
|
background: #fff;
|
||
|
|
border-bottom: 1px solid #eee;
|
||
|
|
display: flex;
|
||
|
|
align-items: center;
|
||
|
|
justify-content: space-between;
|
||
|
|
padding: 0 16px;
|
||
|
|
position: relative;
|
||
|
|
}
|
||
|
|
.header-left {
|
||
|
|
display: flex;
|
||
|
|
align-items: center;
|
||
|
|
gap: 8px;
|
||
|
|
}
|
||
|
|
.logo-block {
|
||
|
|
width: 28px; height: 28px;
|
||
|
|
background: #07C160;
|
||
|
|
color: #fff;
|
||
|
|
border-radius: 6px;
|
||
|
|
display: flex;
|
||
|
|
align-items: center;
|
||
|
|
justify-content: center;
|
||
|
|
font-size: 11px;
|
||
|
|
font-weight: 700;
|
||
|
|
}
|
||
|
|
.header-title {
|
||
|
|
font-size: 15px;
|
||
|
|
font-weight: 600;
|
||
|
|
color: #333;
|
||
|
|
}
|
||
|
|
.header-actions {
|
||
|
|
display: flex;
|
||
|
|
align-items: center;
|
||
|
|
gap: 12px;
|
||
|
|
}
|
||
|
|
|
||
|
|
/* 头像区域 - 纯展示 */
|
||
|
|
.user-info {
|
||
|
|
display: flex;
|
||
|
|
align-items: center;
|
||
|
|
gap: 8px;
|
||
|
|
}
|
||
|
|
.avatar {
|
||
|
|
width: 32px; height: 32px;
|
||
|
|
border-radius: 6px;
|
||
|
|
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='11' r='6' fill='%2307C160'/%3E%3Cellipse cx='16' cy='28' rx='12' ry='8' fill='%2307C160'/%3E%3C/svg%3E");
|
||
|
|
background-size: cover;
|
||
|
|
}
|
||
|
|
.username {
|
||
|
|
font-size: 13px;
|
||
|
|
color: #666;
|
||
|
|
max-width: 60px;
|
||
|
|
overflow: hidden;
|
||
|
|
text-overflow: ellipsis;
|
||
|
|
white-space: nowrap;
|
||
|
|
}
|
||
|
|
|
||
|
|
/* "结束会话"固定按钮 */
|
||
|
|
.exit-btn {
|
||
|
|
padding: 4px 12px;
|
||
|
|
font-size: 12px;
|
||
|
|
color: #ee0a24;
|
||
|
|
background: transparent;
|
||
|
|
border: 1px solid #ee0a24;
|
||
|
|
border-radius: 14px;
|
||
|
|
cursor: pointer;
|
||
|
|
transition: all 0.15s ease;
|
||
|
|
white-space: nowrap;
|
||
|
|
line-height: 1.4;
|
||
|
|
font-family: inherit;
|
||
|
|
}
|
||
|
|
.exit-btn:hover, .exit-btn.hover {
|
||
|
|
background: #ee0a24;
|
||
|
|
color: #fff;
|
||
|
|
}
|
||
|
|
|
||
|
|
/* 聊天区 */
|
||
|
|
.chat-area {
|
||
|
|
height: calc(100% - 56px);
|
||
|
|
display: flex;
|
||
|
|
flex-direction: column;
|
||
|
|
background: #ededed;
|
||
|
|
}
|
||
|
|
.messages {
|
||
|
|
flex: 1;
|
||
|
|
padding: 16px;
|
||
|
|
display: flex;
|
||
|
|
flex-direction: column;
|
||
|
|
gap: 12px;
|
||
|
|
overflow-y: auto;
|
||
|
|
}
|
||
|
|
.msg {
|
||
|
|
max-width: 75%;
|
||
|
|
padding: 10px 14px;
|
||
|
|
border-radius: 10px;
|
||
|
|
font-size: 14px;
|
||
|
|
line-height: 1.5;
|
||
|
|
}
|
||
|
|
.msg-ai {
|
||
|
|
align-self: flex-start;
|
||
|
|
background: #fff;
|
||
|
|
color: #333;
|
||
|
|
border-top-left-radius: 2px;
|
||
|
|
}
|
||
|
|
.msg-user {
|
||
|
|
align-self: flex-end;
|
||
|
|
background: #07C160;
|
||
|
|
color: #fff;
|
||
|
|
border-top-right-radius: 2px;
|
||
|
|
}
|
||
|
|
.msg-label {
|
||
|
|
font-size: 11px;
|
||
|
|
color: #07C160;
|
||
|
|
margin-bottom: 4px;
|
||
|
|
}
|
||
|
|
|
||
|
|
/* 确认对话框 */
|
||
|
|
.dialog-overlay {
|
||
|
|
position: fixed;
|
||
|
|
top: 0; left: 0; right: 0; bottom: 0;
|
||
|
|
background: rgba(0,0,0,.5);
|
||
|
|
z-index: 200;
|
||
|
|
display: flex;
|
||
|
|
align-items: center;
|
||
|
|
justify-content: center;
|
||
|
|
animation: fadeIn .2s ease;
|
||
|
|
}
|
||
|
|
@keyframes fadeIn {
|
||
|
|
from { opacity: 0; }
|
||
|
|
to { opacity: 1; }
|
||
|
|
}
|
||
|
|
.dialog {
|
||
|
|
background: #fff;
|
||
|
|
border-radius: 16px;
|
||
|
|
width: 300px;
|
||
|
|
overflow: hidden;
|
||
|
|
animation: scaleIn .25s ease;
|
||
|
|
}
|
||
|
|
@keyframes scaleIn {
|
||
|
|
from { opacity: 0; transform: scale(.9); }
|
||
|
|
to { opacity: 1; transform: scale(1); }
|
||
|
|
}
|
||
|
|
.dialog-body {
|
||
|
|
padding: 28px 20px 20px;
|
||
|
|
text-align: center;
|
||
|
|
}
|
||
|
|
.dialog-icon {
|
||
|
|
font-size: 44px;
|
||
|
|
margin-bottom: 12px;
|
||
|
|
}
|
||
|
|
.dialog-title {
|
||
|
|
font-size: 17px;
|
||
|
|
font-weight: 600;
|
||
|
|
color: #333;
|
||
|
|
margin-bottom: 8px;
|
||
|
|
}
|
||
|
|
.dialog-message {
|
||
|
|
font-size: 13px;
|
||
|
|
color: #999;
|
||
|
|
line-height: 1.5;
|
||
|
|
}
|
||
|
|
.dialog-footer {
|
||
|
|
display: flex;
|
||
|
|
border-top: 1px solid #eee;
|
||
|
|
}
|
||
|
|
.dialog-btn {
|
||
|
|
flex: 1;
|
||
|
|
padding: 14px;
|
||
|
|
text-align: center;
|
||
|
|
font-size: 15px;
|
||
|
|
cursor: pointer;
|
||
|
|
border: none;
|
||
|
|
background: none;
|
||
|
|
transition: background .15s;
|
||
|
|
}
|
||
|
|
.dialog-btn:hover {
|
||
|
|
background: #f5f5f5;
|
||
|
|
}
|
||
|
|
.dialog-btn-cancel {
|
||
|
|
color: #666;
|
||
|
|
border-right: 1px solid #eee;
|
||
|
|
}
|
||
|
|
.dialog-btn-confirm {
|
||
|
|
color: #ee0a24;
|
||
|
|
font-weight: 600;
|
||
|
|
}
|
||
|
|
|
||
|
|
/* Toast */
|
||
|
|
.toast {
|
||
|
|
position: fixed;
|
||
|
|
top: 50%;
|
||
|
|
left: 50%;
|
||
|
|
transform: translate(-50%, -50%);
|
||
|
|
background: rgba(0,0,0,.75);
|
||
|
|
color: #fff;
|
||
|
|
padding: 12px 24px;
|
||
|
|
border-radius: 8px;
|
||
|
|
font-size: 14px;
|
||
|
|
z-index: 300;
|
||
|
|
animation: fadeIn .2s ease;
|
||
|
|
}
|
||
|
|
|
||
|
|
/* 状态切换按钮 */
|
||
|
|
.state-toggle {
|
||
|
|
position: absolute;
|
||
|
|
bottom: 20px;
|
||
|
|
left: 50%;
|
||
|
|
transform: translateX(-50%);
|
||
|
|
z-index: 50;
|
||
|
|
display: flex;
|
||
|
|
gap: 8px;
|
||
|
|
}
|
||
|
|
.state-btn {
|
||
|
|
padding: 6px 14px;
|
||
|
|
border-radius: 16px;
|
||
|
|
border: 1px solid #ddd;
|
||
|
|
background: #fff;
|
||
|
|
font-size: 12px;
|
||
|
|
cursor: pointer;
|
||
|
|
color: #666;
|
||
|
|
transition: all .15s;
|
||
|
|
font-family: inherit;
|
||
|
|
}
|
||
|
|
.state-btn.active {
|
||
|
|
background: #07C160;
|
||
|
|
color: #fff;
|
||
|
|
border-color: #07C160;
|
||
|
|
}
|
||
|
|
.state-label {
|
||
|
|
position: absolute;
|
||
|
|
top: -24px;
|
||
|
|
left: 0;
|
||
|
|
right: 0;
|
||
|
|
text-align: center;
|
||
|
|
font-size: 11px;
|
||
|
|
color: #999;
|
||
|
|
}
|
||
|
|
|
||
|
|
.hidden { display: none !important; }
|
||
|
|
</style>
|
||
|
|
</head>
|
||
|
|
<body>
|
||
|
|
|
||
|
|
<div class="phone-frame" id="app">
|
||
|
|
<!-- 标题栏 -->
|
||
|
|
<div class="header">
|
||
|
|
<div class="header-left">
|
||
|
|
<span class="logo-block">IT</span>
|
||
|
|
<span class="header-title">智能IT服务</span>
|
||
|
|
</div>
|
||
|
|
<div class="header-actions">
|
||
|
|
<!-- 员工头像+姓名(纯展示) -->
|
||
|
|
<div class="user-info">
|
||
|
|
<div class="avatar"></div>
|
||
|
|
<span class="username">宋献</span>
|
||
|
|
</div>
|
||
|
|
<!-- "结束会话"固定按钮 -->
|
||
|
|
<button class="exit-btn" id="exitBtn" onclick="showConfirm()">结束会话</button>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- 聊天消息区 -->
|
||
|
|
<div class="chat-area" id="chatArea">
|
||
|
|
<div class="messages">
|
||
|
|
<div class="msg msg-ai">
|
||
|
|
<div class="msg-label">🤖 AI助手</div>
|
||
|
|
您好!我是IT智能服务助手,请问有什么可以帮您的?
|
||
|
|
</div>
|
||
|
|
<div class="msg msg-user">
|
||
|
|
我的打印机连不上了
|
||
|
|
</div>
|
||
|
|
<div class="msg msg-ai">
|
||
|
|
<div class="msg-label">🤖 AI助手</div>
|
||
|
|
了解,打印机连接问题通常有几种可能原因。我先帮您排查一下:<br><br>
|
||
|
|
1. 请确认打印机电源已开启<br>
|
||
|
|
2. 检查USB线或网络连接是否正常<br>
|
||
|
|
3. 在电脑上打开"设备和打印机"查看打印机状态
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- 确认对话框 -->
|
||
|
|
<div class="dialog-overlay hidden" id="dialogOverlay">
|
||
|
|
<div class="dialog">
|
||
|
|
<div class="dialog-body">
|
||
|
|
<div class="dialog-icon">⚠️</div>
|
||
|
|
<div class="dialog-title">结束会话</div>
|
||
|
|
<div class="dialog-message">退出后会话记录会清空,<br>当前咨询进度将丢失,<br>确定要结束会话吗?</div>
|
||
|
|
</div>
|
||
|
|
<div class="dialog-footer">
|
||
|
|
<button class="dialog-btn dialog-btn-cancel" onclick="cancelExit()">取消</button>
|
||
|
|
<button class="dialog-btn dialog-btn-confirm" onclick="confirmExit()">确定退出</button>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Toast -->
|
||
|
|
<div class="toast hidden" id="toast"></div>
|
||
|
|
|
||
|
|
<!-- 状态切换(演示用) -->
|
||
|
|
<div class="state-toggle">
|
||
|
|
<button class="state-btn active" onclick="setState('default', this)">默认</button>
|
||
|
|
<button class="state-btn" onclick="setState('hover', this)">Hover</button>
|
||
|
|
<button class="state-btn" onclick="setState('confirm', this)">确认退出</button>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
function showConfirm() {
|
||
|
|
document.getElementById('dialogOverlay').classList.remove('hidden')
|
||
|
|
}
|
||
|
|
|
||
|
|
function cancelExit() {
|
||
|
|
document.getElementById('dialogOverlay').classList.add('hidden')
|
||
|
|
}
|
||
|
|
|
||
|
|
function confirmExit() {
|
||
|
|
document.getElementById('dialogOverlay').classList.add('hidden')
|
||
|
|
showToast('已退出登录')
|
||
|
|
|
||
|
|
setTimeout(() => {
|
||
|
|
showToast('正在跳转登录页…')
|
||
|
|
// 实际场景:window.location.href = '/h5/login' 或 closeWindow
|
||
|
|
}, 1500)
|
||
|
|
}
|
||
|
|
|
||
|
|
function showToast(msg) {
|
||
|
|
const toast = document.getElementById('toast')
|
||
|
|
toast.textContent = msg
|
||
|
|
toast.classList.remove('hidden')
|
||
|
|
setTimeout(() => toast.classList.add('hidden'), 2000)
|
||
|
|
}
|
||
|
|
|
||
|
|
function setState(state, btn) {
|
||
|
|
// 重置按钮
|
||
|
|
document.querySelectorAll('.state-btn').forEach(b => b.classList.remove('active'))
|
||
|
|
btn.classList.add('active')
|
||
|
|
|
||
|
|
// 重置所有状态
|
||
|
|
cancelExit()
|
||
|
|
const exitBtn = document.getElementById('exitBtn')
|
||
|
|
exitBtn.classList.remove('hover')
|
||
|
|
|
||
|
|
switch(state) {
|
||
|
|
case 'default':
|
||
|
|
break
|
||
|
|
case 'hover':
|
||
|
|
exitBtn.classList.add('hover')
|
||
|
|
break
|
||
|
|
case 'confirm':
|
||
|
|
showConfirm()
|
||
|
|
break
|
||
|
|
}
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
|
||
|
|
</body>
|
||
|
|
</html>
|