|
|
@@ -0,0 +1,591 @@
|
|
|
+<!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>AI客服</title>
|
|
|
+ <!-- 使用国内CDN的Bootstrap Icons -->
|
|
|
+ <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/bootstrap-icons/1.10.0/font/bootstrap-icons.min.css">
|
|
|
+ <style>
|
|
|
+ * {
|
|
|
+ margin: 0;
|
|
|
+ padding: 0;
|
|
|
+ box-sizing: border-box;
|
|
|
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
|
+ }
|
|
|
+
|
|
|
+ body {
|
|
|
+ background-color: #f5f5f5;
|
|
|
+ color: #333;
|
|
|
+ font-size: 14px;
|
|
|
+ line-height: 1.5;
|
|
|
+ max-width: 100vw;
|
|
|
+ overflow-x: hidden;
|
|
|
+ }
|
|
|
+
|
|
|
+ .container {
|
|
|
+ width: 100%;
|
|
|
+ max-width: 375px;
|
|
|
+ margin: 0 auto;
|
|
|
+ background-color: #fff;
|
|
|
+ min-height: 100vh;
|
|
|
+ position: relative;
|
|
|
+ padding-bottom: 60px;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 状态栏 */
|
|
|
+ .status-bar {
|
|
|
+ height: 44px;
|
|
|
+ background-color: #fff;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ position: relative;
|
|
|
+ border-bottom: 1px solid #eee;
|
|
|
+ flex-shrink: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .status-bar .title {
|
|
|
+ font-size: 17px;
|
|
|
+ font-weight: 600;
|
|
|
+ color: #000;
|
|
|
+ }
|
|
|
+
|
|
|
+ .status-bar .action {
|
|
|
+ position: absolute;
|
|
|
+ right: 15px;
|
|
|
+ color: #3478f6;
|
|
|
+ font-size: 15px;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* AI客服主内容区 */
|
|
|
+ .ai-chat-container {
|
|
|
+ flex: 1;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ overflow: hidden;
|
|
|
+ position: relative;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 聊天记录区域 */
|
|
|
+ .chat-messages {
|
|
|
+ flex: 1;
|
|
|
+ overflow-y: auto;
|
|
|
+ padding: 15px;
|
|
|
+ background-color: #f9f9f9;
|
|
|
+ -webkit-overflow-scrolling: touch;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 消息气泡 */
|
|
|
+ .message {
|
|
|
+ max-width: 80%;
|
|
|
+ margin-bottom: 15px;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ }
|
|
|
+
|
|
|
+ .message-ai {
|
|
|
+ align-self: flex-start;
|
|
|
+ }
|
|
|
+
|
|
|
+ .message-user {
|
|
|
+ align-self: flex-end;
|
|
|
+ }
|
|
|
+
|
|
|
+ .message-bubble {
|
|
|
+ padding: 12px 15px;
|
|
|
+ border-radius: 18px;
|
|
|
+ position: relative;
|
|
|
+ word-break: break-word;
|
|
|
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
|
|
+ }
|
|
|
+
|
|
|
+ .message-ai .message-bubble {
|
|
|
+ background-color: #fff;
|
|
|
+ border-bottom-left-radius: 4px;
|
|
|
+ color: #333;
|
|
|
+ margin-left: 10px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .message-user .message-bubble {
|
|
|
+ background-color: #3478f6;
|
|
|
+ border-bottom-right-radius: 4px;
|
|
|
+ color: #fff;
|
|
|
+ margin-right: 10px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .message-time {
|
|
|
+ font-size: 11px;
|
|
|
+ color: #999;
|
|
|
+ margin-top: 5px;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+
|
|
|
+ .message-avatar {
|
|
|
+ width: 32px;
|
|
|
+ height: 32px;
|
|
|
+ border-radius: 50%;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ background-color: #f0f0f0;
|
|
|
+ color: #999;
|
|
|
+ font-size: 16px;
|
|
|
+ flex-shrink: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .message-ai .message-content {
|
|
|
+ display: flex;
|
|
|
+ align-items: flex-start;
|
|
|
+ }
|
|
|
+
|
|
|
+ .message-user .message-content {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: flex-end;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 输入区域 */
|
|
|
+ .input-area {
|
|
|
+ padding: 10px 15px;
|
|
|
+ background-color: #fff;
|
|
|
+ border-top: 1px solid #eee;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ flex-shrink: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .input-box {
|
|
|
+ flex: 1;
|
|
|
+ border: 1px solid #ddd;
|
|
|
+ border-radius: 20px;
|
|
|
+ padding: 8px 15px;
|
|
|
+ font-size: 14px;
|
|
|
+ outline: none;
|
|
|
+ resize: none;
|
|
|
+ max-height: 100px;
|
|
|
+ line-height: 1.4;
|
|
|
+ }
|
|
|
+
|
|
|
+ .send-btn {
|
|
|
+ width: 40px;
|
|
|
+ height: 40px;
|
|
|
+ border-radius: 50%;
|
|
|
+ background-color: #3478f6;
|
|
|
+ color: #fff;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ margin-left: 10px;
|
|
|
+ border: none;
|
|
|
+ outline: none;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 快捷问题 */
|
|
|
+ .quick-questions {
|
|
|
+ padding: 10px 15px;
|
|
|
+ background-color: #fff;
|
|
|
+ border-top: 1px solid #eee;
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ flex-shrink: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .quick-question {
|
|
|
+ padding: 8px 12px;
|
|
|
+ background-color: #f5f5f5;
|
|
|
+ border-radius: 15px;
|
|
|
+ margin: 5px;
|
|
|
+ font-size: 13px;
|
|
|
+ color: #333;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* AI客服欢迎卡片 */
|
|
|
+ .ai-welcome-card {
|
|
|
+ background-color: #fff;
|
|
|
+ border-radius: 12px;
|
|
|
+ padding: 15px;
|
|
|
+ margin-bottom: 15px;
|
|
|
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
|
|
|
+ }
|
|
|
+
|
|
|
+ .ai-welcome-header {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .ai-avatar {
|
|
|
+ width: 44px;
|
|
|
+ height: 44px;
|
|
|
+ border-radius: 50%;
|
|
|
+ background-color: #e3f2fd;
|
|
|
+ color: #1976d2;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ font-size: 20px;
|
|
|
+ margin-right: 10px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .ai-name {
|
|
|
+ font-weight: 600;
|
|
|
+ font-size: 16px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .ai-status {
|
|
|
+ font-size: 12px;
|
|
|
+ color: #4caf50;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ }
|
|
|
+
|
|
|
+ .ai-status-dot {
|
|
|
+ width: 8px;
|
|
|
+ height: 8px;
|
|
|
+ border-radius: 50%;
|
|
|
+ background-color: #4caf50;
|
|
|
+ margin-right: 5px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .ai-welcome-text {
|
|
|
+ color: #666;
|
|
|
+ line-height: 1.5;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 底部导航栏 */
|
|
|
+ .bottom-nav {
|
|
|
+ position: fixed;
|
|
|
+ bottom: 0;
|
|
|
+ left: 0;
|
|
|
+ right: 0;
|
|
|
+ background-color: white;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-around;
|
|
|
+ padding: 8px 0;
|
|
|
+ box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
|
|
|
+ max-width: 375px;
|
|
|
+ margin: 0 auto;
|
|
|
+ z-index: 100;
|
|
|
+ }
|
|
|
+
|
|
|
+ .nav-item {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ color: #666;
|
|
|
+ text-decoration: none;
|
|
|
+ font-size: 12px;
|
|
|
+ position: relative;
|
|
|
+ }
|
|
|
+
|
|
|
+ .nav-icon {
|
|
|
+ font-size: 22px;
|
|
|
+ margin-bottom: 3px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .nav-item.active {
|
|
|
+ color: #1971c2;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 加载动画 */
|
|
|
+ .typing-indicator {
|
|
|
+ display: flex;
|
|
|
+ padding: 10px 15px;
|
|
|
+ background-color: #fff;
|
|
|
+ border-radius: 18px;
|
|
|
+ margin-left: 10px;
|
|
|
+ align-self: flex-start;
|
|
|
+ }
|
|
|
+
|
|
|
+ .typing-dot {
|
|
|
+ width: 8px;
|
|
|
+ height: 8px;
|
|
|
+ background-color: #ccc;
|
|
|
+ border-radius: 50%;
|
|
|
+ margin: 0 2px;
|
|
|
+ animation: typingAnimation 1.4s infinite ease-in-out;
|
|
|
+ }
|
|
|
+
|
|
|
+ .typing-dot:nth-child(1) {
|
|
|
+ animation-delay: 0s;
|
|
|
+ }
|
|
|
+
|
|
|
+ .typing-dot:nth-child(2) {
|
|
|
+ animation-delay: 0.2s;
|
|
|
+ }
|
|
|
+
|
|
|
+ .typing-dot:nth-child(3) {
|
|
|
+ animation-delay: 0.4s;
|
|
|
+ }
|
|
|
+
|
|
|
+ @keyframes typingAnimation {
|
|
|
+ 0%, 60%, 100% {
|
|
|
+ transform: translateY(0);
|
|
|
+ }
|
|
|
+ 30% {
|
|
|
+ transform: translateY(-5px);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 时间分隔线 */
|
|
|
+ .time-divider {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ margin: 15px 0;
|
|
|
+ color: #999;
|
|
|
+ font-size: 12px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .time-divider::before,
|
|
|
+ .time-divider::after {
|
|
|
+ content: "";
|
|
|
+ flex: 1;
|
|
|
+ height: 1px;
|
|
|
+ background-color: #eee;
|
|
|
+ margin: 0 10px;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+</head>
|
|
|
+<body>
|
|
|
+ <div class="container">
|
|
|
+ <!-- 状态栏 -->
|
|
|
+ <div class="status-bar">
|
|
|
+ <div class="title">AI客服</div>
|
|
|
+ <div class="action"><i class="bi bi-headset"></i></div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- AI客服主内容区 -->
|
|
|
+ <div class="ai-chat-container">
|
|
|
+ <div class="chat-messages">
|
|
|
+ <!-- AI欢迎卡片 -->
|
|
|
+ <div class="ai-welcome-card">
|
|
|
+ <div class="ai-welcome-header">
|
|
|
+ <div class="ai-avatar">
|
|
|
+ <i class="bi bi-robot"></i>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <div class="ai-name">旅行AI助手</div>
|
|
|
+ <div class="ai-status">
|
|
|
+ <span class="ai-status-dot"></span>
|
|
|
+ 在线
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="ai-welcome-text">
|
|
|
+ 您好!我是您的旅行AI助手,可以为您解答旅行相关问题,包括景点推荐、行程规划、酒店预订等。请问有什么可以帮您的吗?
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 时间分隔线 -->
|
|
|
+ <div class="time-divider">
|
|
|
+ 今天
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- AI消息 -->
|
|
|
+ <div class="message message-ai">
|
|
|
+ <div class="message-content">
|
|
|
+ <div class="message-avatar">
|
|
|
+ <i class="bi bi-robot"></i>
|
|
|
+ </div>
|
|
|
+ <div class="message-bubble">
|
|
|
+ 您好!为了更好的帮助您,请告诉我您计划去哪里旅行?
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="message-time">10:30</div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 用户消息 -->
|
|
|
+ <div class="message message-user">
|
|
|
+ <div class="message-content">
|
|
|
+ <div class="message-bubble">
|
|
|
+ 我想去北京玩3天,有什么推荐吗?
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="message-time">10:32</div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- AI回复 -->
|
|
|
+ <div class="message message-ai">
|
|
|
+ <div class="message-content">
|
|
|
+ <div class="message-avatar">
|
|
|
+ <i class="bi bi-robot"></i>
|
|
|
+ </div>
|
|
|
+ <div class="message-bubble">
|
|
|
+ 北京3日游推荐行程:<br><br>
|
|
|
+ <strong>第一天</strong>:天安门广场 → 故宫 → 景山公园<br>
|
|
|
+ <strong>第二天</strong>:颐和园 → 圆明园<br>
|
|
|
+ <strong>第三天</strong>:八达岭长城 → 798艺术区<br><br>
|
|
|
+ 需要我为您详细介绍某个景点或预订门票吗?
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="message-time">10:33</div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- AI正在输入指示器 -->
|
|
|
+ <div class="message message-ai">
|
|
|
+ <div class="message-content">
|
|
|
+ <div class="message-avatar">
|
|
|
+ <i class="bi bi-robot"></i>
|
|
|
+ </div>
|
|
|
+ <div class="typing-indicator">
|
|
|
+ <div class="typing-dot"></div>
|
|
|
+ <div class="typing-dot"></div>
|
|
|
+ <div class="typing-dot"></div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 快捷问题 -->
|
|
|
+ <div class="quick-questions">
|
|
|
+ <div class="quick-question">北京必去景点</div>
|
|
|
+ <div class="quick-question">3天行程推荐</div>
|
|
|
+ <div class="quick-question">特色美食推荐</div>
|
|
|
+ <div class="quick-question">交通指南</div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 输入区域 -->
|
|
|
+ <div class="input-area">
|
|
|
+ <textarea class="input-box" placeholder="输入您的问题..." rows="1"></textarea>
|
|
|
+ <button class="send-btn">
|
|
|
+ <i class="bi bi-send-fill"></i>
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 底部导航栏 -->
|
|
|
+ <div class="bottom-nav">
|
|
|
+ <a href="#" class="nav-item">
|
|
|
+ <i class="bi bi-house-door nav-icon"></i>
|
|
|
+ <span>首页</span>
|
|
|
+ </a>
|
|
|
+ <a href="#" class="nav-item active">
|
|
|
+ <i class="bi bi-robot nav-icon"></i>
|
|
|
+ <span>客服</span>
|
|
|
+ </a>
|
|
|
+ <a href="#" class="nav-item">
|
|
|
+ <i class="bi bi-chat-dots nav-icon"></i>
|
|
|
+ <span>消息</span>
|
|
|
+ </a>
|
|
|
+ <a href="#" class="nav-item">
|
|
|
+ <i class="bi bi-person nav-icon"></i>
|
|
|
+ <span>我的</span>
|
|
|
+ </a>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <script>
|
|
|
+ document.addEventListener('DOMContentLoaded', function() {
|
|
|
+ const inputBox = document.querySelector('.input-box');
|
|
|
+ const sendBtn = document.querySelector('.send-btn');
|
|
|
+ const chatMessages = document.querySelector('.chat-messages');
|
|
|
+ const quickQuestions = document.querySelectorAll('.quick-question');
|
|
|
+
|
|
|
+ // 自动调整输入框高度
|
|
|
+ inputBox.addEventListener('input', function() {
|
|
|
+ this.style.height = 'auto';
|
|
|
+ this.style.height = (this.scrollHeight) + 'px';
|
|
|
+ });
|
|
|
+
|
|
|
+ // 发送消息
|
|
|
+ function sendMessage() {
|
|
|
+ const messageText = inputBox.value.trim();
|
|
|
+ if (messageText === '') return;
|
|
|
+
|
|
|
+ // 添加用户消息
|
|
|
+ const now = new Date();
|
|
|
+ const timeString = now.getHours() + ':' + (now.getMinutes() < 10 ? '0' : '') + now.getMinutes();
|
|
|
+
|
|
|
+ const userMessage = document.createElement('div');
|
|
|
+ userMessage.className = 'message message-user';
|
|
|
+ userMessage.innerHTML = `
|
|
|
+ <div class="message-content">
|
|
|
+ <div class="message-bubble">${messageText}</div>
|
|
|
+ </div>
|
|
|
+ <div class="message-time">${timeString}</div>
|
|
|
+ `;
|
|
|
+
|
|
|
+ chatMessages.appendChild(userMessage);
|
|
|
+ inputBox.value = '';
|
|
|
+ inputBox.style.height = 'auto';
|
|
|
+
|
|
|
+ // 滚动到底部
|
|
|
+ chatMessages.scrollTop = chatMessages.scrollHeight;
|
|
|
+
|
|
|
+ // 模拟AI回复
|
|
|
+ setTimeout(() => {
|
|
|
+ const typingIndicator = document.querySelector('.typing-indicator');
|
|
|
+ if (typingIndicator) typingIndicator.remove();
|
|
|
+
|
|
|
+ const aiResponses = [
|
|
|
+ "我明白了,您对北京3日游感兴趣。需要我为您预订酒店吗?",
|
|
|
+ "北京的美食推荐:全聚德烤鸭、东来顺涮肉、炸酱面、豆汁儿等。",
|
|
|
+ "您可以选择地铁出行,北京地铁覆盖主要景点,非常方便。",
|
|
|
+ "需要我为您规划更详细的行程安排吗?"
|
|
|
+ ];
|
|
|
+
|
|
|
+ const randomResponse = aiResponses[Math.floor(Math.random() * aiResponses.length)];
|
|
|
+
|
|
|
+ const aiMessage = document.createElement('div');
|
|
|
+ aiMessage.className = 'message message-ai';
|
|
|
+ aiMessage.innerHTML = `
|
|
|
+ <div class="message-content">
|
|
|
+ <div class="message-avatar">
|
|
|
+ <i class="bi bi-robot"></i>
|
|
|
+ </div>
|
|
|
+ <div class="message-bubble">${randomResponse}</div>
|
|
|
+ </div>
|
|
|
+ <div class="message-time">${timeString}</div>
|
|
|
+ `;
|
|
|
+
|
|
|
+ chatMessages.appendChild(aiMessage);
|
|
|
+ chatMessages.scrollTop = chatMessages.scrollHeight;
|
|
|
+
|
|
|
+ // 添加正在输入指示器
|
|
|
+ setTimeout(() => {
|
|
|
+ const typingIndicator = document.createElement('div');
|
|
|
+ typingIndicator.className = 'message message-ai';
|
|
|
+ typingIndicator.innerHTML = `
|
|
|
+ <div class="message-content">
|
|
|
+ <div class="message-avatar">
|
|
|
+ <i class="bi bi-robot"></i>
|
|
|
+ </div>
|
|
|
+ <div class="typing-indicator">
|
|
|
+ <div class="typing-dot"></div>
|
|
|
+ <div class="typing-dot"></div>
|
|
|
+ <div class="typing-dot"></div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ `;
|
|
|
+ chatMessages.appendChild(typingIndicator);
|
|
|
+ chatMessages.scrollTop = chatMessages.scrollHeight;
|
|
|
+ }, 1000);
|
|
|
+ }, 1000);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 点击发送按钮
|
|
|
+ sendBtn.addEventListener('click', sendMessage);
|
|
|
+
|
|
|
+ // 按Enter键发送
|
|
|
+ inputBox.addEventListener('keypress', function(e) {
|
|
|
+ if (e.key === 'Enter' && !e.shiftKey) {
|
|
|
+ e.preventDefault();
|
|
|
+ sendMessage();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 快捷问题点击
|
|
|
+ quickQuestions.forEach(question => {
|
|
|
+ question.addEventListener('click', function() {
|
|
|
+ inputBox.value = this.textContent;
|
|
|
+ inputBox.focus();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
+ </script>
|
|
|
+</body>
|
|
|
+</html>
|