|
@@ -0,0 +1,857 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html lang="zh-CN">
|
|
|
+<head>
|
|
|
+ <meta charset="UTF-8">
|
|
|
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
+ <title>律助App - AI法律咨询</title>
|
|
|
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
|
|
+ <style>
|
|
|
+ * {
|
|
|
+ margin: 0;
|
|
|
+ padding: 0;
|
|
|
+ box-sizing: border-box;
|
|
|
+ font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
|
|
|
+ }
|
|
|
+
|
|
|
+ :root {
|
|
|
+ --primary-color: #1A237E;
|
|
|
+ --primary-light: #303F9F;
|
|
|
+ --accent-color: #FFD700;
|
|
|
+ --warning-color: #D32F2F;
|
|
|
+ --success-color: #388E3C;
|
|
|
+ --bg-color: #F5F5F5;
|
|
|
+ --card-color: #FFFFFF;
|
|
|
+ --text-primary: #212121;
|
|
|
+ --text-secondary: #616161;
|
|
|
+ --border-radius: 16px;
|
|
|
+ --shadow: 0 4px 16px rgba(0,0,0,0.08);
|
|
|
+ --transition: all 0.3s ease;
|
|
|
+ }
|
|
|
+
|
|
|
+ body {
|
|
|
+ background-color: var(--bg-color);
|
|
|
+ color: var(--text-primary);
|
|
|
+ max-width: 500px;
|
|
|
+ margin: 0 auto;
|
|
|
+ position: relative;
|
|
|
+ padding-bottom: 80px;
|
|
|
+ height: 100vh;
|
|
|
+ overflow: hidden;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 顶部导航 */
|
|
|
+ .top-nav {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ padding: 16px;
|
|
|
+ background: white;
|
|
|
+ box-shadow: 0 2px 10px rgba(0,0,0,0.05);
|
|
|
+ }
|
|
|
+
|
|
|
+ .nav-title {
|
|
|
+ font-size: 18px;
|
|
|
+ font-weight: bold;
|
|
|
+ color: var(--primary-color);
|
|
|
+ }
|
|
|
+
|
|
|
+ .nav-actions {
|
|
|
+ display: flex;
|
|
|
+ gap: 16px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .nav-action {
|
|
|
+ font-size: 18px;
|
|
|
+ color: var(--text-secondary);
|
|
|
+ cursor: pointer;
|
|
|
+ transition: var(--transition);
|
|
|
+ }
|
|
|
+
|
|
|
+ .nav-action:hover {
|
|
|
+ color: var(--primary-color);
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 咨询页面容器 */
|
|
|
+ .consult-container {
|
|
|
+ height: calc(100vh - 140px);
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ background: white;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 对话历史区 */
|
|
|
+ .chat-history {
|
|
|
+ flex: 1;
|
|
|
+ overflow-y: auto;
|
|
|
+ padding: 16px;
|
|
|
+ background: #f8f9ff;
|
|
|
+ }
|
|
|
+
|
|
|
+ .message {
|
|
|
+ display: flex;
|
|
|
+ margin-bottom: 20px;
|
|
|
+ animation: fadeIn 0.3s ease;
|
|
|
+ }
|
|
|
+
|
|
|
+ @keyframes fadeIn {
|
|
|
+ from { opacity: 0; transform: translateY(10px); }
|
|
|
+ to { opacity: 1; transform: translateY(0); }
|
|
|
+ }
|
|
|
+
|
|
|
+ .user-message {
|
|
|
+ justify-content: flex-end;
|
|
|
+ }
|
|
|
+
|
|
|
+ .message-avatar {
|
|
|
+ width: 36px;
|
|
|
+ height: 36px;
|
|
|
+ border-radius: 50%;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ margin: 0 8px;
|
|
|
+ flex-shrink: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .ai-message .message-avatar {
|
|
|
+ background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
|
|
|
+ color: white;
|
|
|
+ }
|
|
|
+
|
|
|
+ .user-message .message-avatar {
|
|
|
+ background: var(--accent-color);
|
|
|
+ color: var(--text-primary);
|
|
|
+ }
|
|
|
+
|
|
|
+ .message-content {
|
|
|
+ max-width: 80%;
|
|
|
+ padding: 12px 16px;
|
|
|
+ border-radius: 18px;
|
|
|
+ line-height: 1.4;
|
|
|
+ }
|
|
|
+
|
|
|
+ .ai-message .message-content {
|
|
|
+ background: white;
|
|
|
+ border: 1px solid #e0e0e0;
|
|
|
+ border-radius: 18px 18px 18px 4px;
|
|
|
+ box-shadow: var(--shadow);
|
|
|
+ }
|
|
|
+
|
|
|
+ .user-message .message-content {
|
|
|
+ background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
|
|
|
+ color: white;
|
|
|
+ border-radius: 18px 18px 4px 18px;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 智能回答区样式 */
|
|
|
+ .conclusion {
|
|
|
+ margin-bottom: 12px;
|
|
|
+ font-weight: 500;
|
|
|
+ }
|
|
|
+
|
|
|
+ .legal-reference {
|
|
|
+ background: #FFF9C4;
|
|
|
+ padding: 10px 12px;
|
|
|
+ border-radius: 8px;
|
|
|
+ margin-bottom: 12px;
|
|
|
+ border-left: 4px solid var(--accent-color);
|
|
|
+ position: relative;
|
|
|
+ }
|
|
|
+
|
|
|
+ .legal-reference:hover::after {
|
|
|
+ content: "点击查看详细法条";
|
|
|
+ position: absolute;
|
|
|
+ bottom: -25px;
|
|
|
+ left: 0;
|
|
|
+ background: rgba(0,0,0,0.7);
|
|
|
+ color: white;
|
|
|
+ padding: 4px 8px;
|
|
|
+ border-radius: 4px;
|
|
|
+ font-size: 12px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .action-steps {
|
|
|
+ margin-bottom: 12px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .action-steps ol {
|
|
|
+ margin-left: 20px;
|
|
|
+ margin-top: 8px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .action-steps li {
|
|
|
+ margin-bottom: 6px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .explanation {
|
|
|
+ background: #E3F2FD;
|
|
|
+ padding: 10px 12px;
|
|
|
+ border-radius: 8px;
|
|
|
+ font-size: 14px;
|
|
|
+ color: var(--text-secondary);
|
|
|
+ position: relative;
|
|
|
+ cursor: help;
|
|
|
+ }
|
|
|
+
|
|
|
+ .explanation:hover::after {
|
|
|
+ content: "通俗解释:用简单语言说明法律概念";
|
|
|
+ position: absolute;
|
|
|
+ bottom: -25px;
|
|
|
+ left: 0;
|
|
|
+ background: rgba(0,0,0,0.7);
|
|
|
+ color: white;
|
|
|
+ padding: 4px 8px;
|
|
|
+ border-radius: 4px;
|
|
|
+ font-size: 12px;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 快捷问题模板 */
|
|
|
+ .quick-templates {
|
|
|
+ display: flex;
|
|
|
+ gap: 8px;
|
|
|
+ overflow-x: auto;
|
|
|
+ padding: 16px;
|
|
|
+ background: white;
|
|
|
+ border-bottom: 1px solid #f0f0f0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .template-item {
|
|
|
+ background: white;
|
|
|
+ padding: 10px 16px;
|
|
|
+ border-radius: 20px;
|
|
|
+ border: 1px solid #e0e0e0;
|
|
|
+ font-size: 14px;
|
|
|
+ white-space: nowrap;
|
|
|
+ cursor: pointer;
|
|
|
+ transition: var(--transition);
|
|
|
+ flex-shrink: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .template-item:hover {
|
|
|
+ background: var(--primary-color);
|
|
|
+ color: white;
|
|
|
+ transform: translateY(-2px);
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 输入控制区 */
|
|
|
+ .input-area {
|
|
|
+ background: white;
|
|
|
+ padding: 16px;
|
|
|
+ border-top: 1px solid #f0f0f0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .input-container {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ background: var(--bg-color);
|
|
|
+ border-radius: 24px;
|
|
|
+ padding: 8px 16px;
|
|
|
+ gap: 8px;
|
|
|
+ transition: var(--transition);
|
|
|
+ }
|
|
|
+
|
|
|
+ .input-container:focus-within {
|
|
|
+ box-shadow: 0 0 0 2px rgba(26, 35, 126, 0.2);
|
|
|
+ }
|
|
|
+
|
|
|
+ .attach-btn {
|
|
|
+ cursor: pointer;
|
|
|
+ font-size: 18px;
|
|
|
+ color: var(--text-secondary);
|
|
|
+ transition: var(--transition);
|
|
|
+ }
|
|
|
+
|
|
|
+ .attach-btn:hover {
|
|
|
+ color: var(--primary-color);
|
|
|
+ }
|
|
|
+
|
|
|
+ .input-container input {
|
|
|
+ flex: 1;
|
|
|
+ border: none;
|
|
|
+ background: none;
|
|
|
+ outline: none;
|
|
|
+ font-size: 16px;
|
|
|
+ padding: 8px 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .voice-btn {
|
|
|
+ background: var(--primary-color);
|
|
|
+ color: white;
|
|
|
+ width: 36px;
|
|
|
+ height: 36px;
|
|
|
+ border-radius: 50%;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ cursor: pointer;
|
|
|
+ transition: var(--transition);
|
|
|
+ }
|
|
|
+
|
|
|
+ .voice-btn:hover {
|
|
|
+ background: var(--primary-light);
|
|
|
+ transform: scale(1.05);
|
|
|
+ }
|
|
|
+
|
|
|
+ .voice-btn.listening {
|
|
|
+ background: var(--warning-color);
|
|
|
+ animation: pulse 1.5s infinite;
|
|
|
+ }
|
|
|
+
|
|
|
+ @keyframes pulse {
|
|
|
+ 0% { transform: scale(1); }
|
|
|
+ 50% { transform: scale(1.1); }
|
|
|
+ 100% { transform: scale(1); }
|
|
|
+ }
|
|
|
+
|
|
|
+ .send-btn {
|
|
|
+ background: var(--primary-color);
|
|
|
+ color: white;
|
|
|
+ border: none;
|
|
|
+ padding: 8px 16px;
|
|
|
+ border-radius: 16px;
|
|
|
+ cursor: pointer;
|
|
|
+ font-weight: 500;
|
|
|
+ transition: var(--transition);
|
|
|
+ }
|
|
|
+
|
|
|
+ .send-btn:hover {
|
|
|
+ background: var(--primary-light);
|
|
|
+ transform: translateY(-2px);
|
|
|
+ }
|
|
|
+
|
|
|
+ .send-btn:disabled {
|
|
|
+ background: var(--text-secondary);
|
|
|
+ cursor: not-allowed;
|
|
|
+ transform: none;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 功能扩展区 */
|
|
|
+ .function-extension {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-around;
|
|
|
+ padding: 12px 16px;
|
|
|
+ background: white;
|
|
|
+ border-top: 1px solid #f0f0f0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .extension-item {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ gap: 6px;
|
|
|
+ cursor: pointer;
|
|
|
+ padding: 8px 12px;
|
|
|
+ border-radius: 8px;
|
|
|
+ transition: var(--transition);
|
|
|
+ }
|
|
|
+
|
|
|
+ .extension-item:hover {
|
|
|
+ background: var(--bg-color);
|
|
|
+ transform: translateY(-2px);
|
|
|
+ }
|
|
|
+
|
|
|
+ .extension-item i {
|
|
|
+ font-size: 20px;
|
|
|
+ color: var(--primary-color);
|
|
|
+ }
|
|
|
+
|
|
|
+ .extension-item span {
|
|
|
+ font-size: 12px;
|
|
|
+ color: var(--text-secondary);
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 底部导航栏 */
|
|
|
+ .bottom-nav {
|
|
|
+ position: fixed;
|
|
|
+ bottom: 0;
|
|
|
+ left: 0;
|
|
|
+ right: 0;
|
|
|
+ max-width: 500px;
|
|
|
+ margin: 0 auto;
|
|
|
+ background: white;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-around;
|
|
|
+ padding: 12px 0;
|
|
|
+ box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
|
|
|
+ z-index: 100;
|
|
|
+ }
|
|
|
+
|
|
|
+ .nav-item {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ padding: 8px 16px;
|
|
|
+ border-radius: 20px;
|
|
|
+ transition: var(--transition);
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+
|
|
|
+ .nav-item.active {
|
|
|
+ background: rgba(26, 35, 126, 0.1);
|
|
|
+ }
|
|
|
+
|
|
|
+ .nav-icon {
|
|
|
+ font-size: 20px;
|
|
|
+ margin-bottom: 4px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .nav-text {
|
|
|
+ font-size: 12px;
|
|
|
+ font-weight: 500;
|
|
|
+ }
|
|
|
+
|
|
|
+ .nav-item.active .nav-text {
|
|
|
+ color: var(--primary-color);
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 加载动画 */
|
|
|
+ .typing-indicator {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ padding: 12px 16px;
|
|
|
+ background: white;
|
|
|
+ border-radius: 18px;
|
|
|
+ border: 1px solid #e0e0e0;
|
|
|
+ width: fit-content;
|
|
|
+ box-shadow: var(--shadow);
|
|
|
+ }
|
|
|
+
|
|
|
+ .typing-dots {
|
|
|
+ display: flex;
|
|
|
+ gap: 4px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .typing-dot {
|
|
|
+ width: 8px;
|
|
|
+ height: 8px;
|
|
|
+ background: var(--text-secondary);
|
|
|
+ border-radius: 50%;
|
|
|
+ animation: typing 1.4s infinite ease-in-out;
|
|
|
+ }
|
|
|
+
|
|
|
+ .typing-dot:nth-child(1) { animation-delay: -0.32s; }
|
|
|
+ .typing-dot:nth-child(2) { animation-delay: -0.16s; }
|
|
|
+
|
|
|
+ @keyframes typing {
|
|
|
+ 0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
|
|
|
+ 40% { transform: scale(1); opacity: 1; }
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 响应式调整 */
|
|
|
+ @media (max-height: 700px) {
|
|
|
+ .consult-container {
|
|
|
+ height: calc(100vh - 120px);
|
|
|
+ }
|
|
|
+
|
|
|
+ .quick-templates {
|
|
|
+ padding: 12px 16px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .input-area {
|
|
|
+ padding: 12px 16px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+</head>
|
|
|
+<body>
|
|
|
+ <!-- 顶部导航 -->
|
|
|
+ <div class="top-nav">
|
|
|
+ <div class="nav-title">AI法律咨询</div>
|
|
|
+ <div class="nav-actions">
|
|
|
+ <div class="nav-action" onclick="showConsultHistory()">
|
|
|
+ <i class="fas fa-history"></i>
|
|
|
+ </div>
|
|
|
+ <div class="nav-action" onclick="showLawSearch()">
|
|
|
+ <i class="fas fa-search"></i>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 咨询页面容器 -->
|
|
|
+ <div class="consult-container">
|
|
|
+ <!-- 快捷问题模板 -->
|
|
|
+ <div class="quick-templates">
|
|
|
+ <div class="template-item" onclick="useTemplate('劳动纠纷咨询')">劳动纠纷咨询</div>
|
|
|
+ <div class="template-item" onclick="useTemplate('合同审查要点')">合同审查要点</div>
|
|
|
+ <div class="template-item" onclick="useTemplate('赔偿金额计算')">赔偿金额计算</div>
|
|
|
+ <div class="template-item" onclick="useTemplate('法律文书起草')">法律文书起草</div>
|
|
|
+ <div class="template-item" onclick="useTemplate('证据收集指导')">证据收集指导</div>
|
|
|
+ <div class="template-item" onclick="useTemplate('诉讼流程咨询')">诉讼流程咨询</div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 对话历史区 -->
|
|
|
+ <div class="chat-history" id="chatHistory">
|
|
|
+ <!-- 初始AI欢迎消息 -->
|
|
|
+ <div class="message ai-message">
|
|
|
+ <div class="message-avatar">
|
|
|
+ <i class="fas fa-robot"></i>
|
|
|
+ </div>
|
|
|
+ <div class="message-content">
|
|
|
+ <div class="conclusion">您好!我是您的AI法律助手,可以为您提供法律咨询、法条查询、案例分析和文书生成等服务。</div>
|
|
|
+ <div class="legal-reference">基于《中华人民共和国法律咨询服务规范》提供专业建议</div>
|
|
|
+ <div class="action-steps">
|
|
|
+ <strong>您可以:</strong>
|
|
|
+ <ol>
|
|
|
+ <li>描述您的法律问题</li>
|
|
|
+ <li>上传相关文件让我分析</li>
|
|
|
+ <li>使用快捷模板快速提问</li>
|
|
|
+ </ol>
|
|
|
+ </div>
|
|
|
+ <div class="explanation">我会用通俗易懂的方式解释法律概念,并提供具体的行动建议。</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 示例对话 -->
|
|
|
+ <div class="message user-message">
|
|
|
+ <div class="message-content">
|
|
|
+ 公司无故辞退我,应该怎么办?
|
|
|
+ </div>
|
|
|
+ <div class="message-avatar">
|
|
|
+ <i class="fas fa-user"></i>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="message ai-message">
|
|
|
+ <div class="message-avatar">
|
|
|
+ <i class="fas fa-robot"></i>
|
|
|
+ </div>
|
|
|
+ <div class="message-content">
|
|
|
+ <div class="conclusion">结论摘要:公司无故辞退属于违法解除劳动合同,您有权要求赔偿。</div>
|
|
|
+ <div class="legal-reference">
|
|
|
+ <strong>法律依据:</strong>
|
|
|
+ 《劳动合同法》第四十八条:用人单位违反本法规定解除或者终止劳动合同,劳动者要求继续履行劳动合同的,用人单位应当继续履行;劳动者不要求继续履行劳动合同或者劳动合同已经不能继续履行的,用人单位应当依照本法第八十七条规定支付赔偿金。
|
|
|
+ </div>
|
|
|
+ <div class="action-steps">
|
|
|
+ <strong>行动步骤:</strong>
|
|
|
+ <ol>
|
|
|
+ <li>收集证据:劳动合同、工资单、辞退通知等</li>
|
|
|
+ <li>与公司协商,要求支付赔偿金</li>
|
|
|
+ <li>协商不成可申请劳动仲裁</li>
|
|
|
+ <li>对仲裁结果不服可向人民法院提起诉讼</li>
|
|
|
+ </ol>
|
|
|
+ </div>
|
|
|
+ <div class="explanation">
|
|
|
+ 通俗解释:就像租房子房东不能随便赶走租客一样,公司也不能无故辞退员工,否则需要支付相当于2倍经济补偿的赔偿金。
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 输入控制区 -->
|
|
|
+ <div class="input-area">
|
|
|
+ <div class="input-container">
|
|
|
+ <div class="attach-btn" onclick="attachFile()">
|
|
|
+ <i class="fas fa-paperclip"></i>
|
|
|
+ </div>
|
|
|
+ <input type="text" placeholder="输入您的问题..." id="chatInput">
|
|
|
+ <div class="voice-btn" id="voiceBtn" onclick="toggleVoiceInput()">
|
|
|
+ <i class="fas fa-microphone"></i>
|
|
|
+ </div>
|
|
|
+ <button class="send-btn" id="sendBtn" onclick="sendMessage()">发送</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 功能扩展区 -->
|
|
|
+ <div class="function-extension">
|
|
|
+ <div class="extension-item" onclick="attachFile()">
|
|
|
+ <i class="fas fa-file-upload"></i>
|
|
|
+ <span>附件上传</span>
|
|
|
+ </div>
|
|
|
+ <div class="extension-item" onclick="showRelatedTools()">
|
|
|
+ <i class="fas fa-tools"></i>
|
|
|
+ <span>关联工具</span>
|
|
|
+ </div>
|
|
|
+ <div class="extension-item" onclick="saveConversation()">
|
|
|
+ <i class="fas fa-star"></i>
|
|
|
+ <span>收藏回答</span>
|
|
|
+ </div>
|
|
|
+ <div class="extension-item" onclick="shareConversation()">
|
|
|
+ <i class="fas fa-share-alt"></i>
|
|
|
+ <span>分享咨询</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 底部导航栏 -->
|
|
|
+ <div class="bottom-nav">
|
|
|
+ <div class="nav-item" onclick="switchPage('home')">
|
|
|
+ <div class="nav-icon">
|
|
|
+ <i class="fas fa-home"></i>
|
|
|
+ </div>
|
|
|
+ <div class="nav-text">首页</div>
|
|
|
+ </div>
|
|
|
+ <div class="nav-item active">
|
|
|
+ <div class="nav-icon">
|
|
|
+ <i class="fas fa-comments"></i>
|
|
|
+ </div>
|
|
|
+ <div class="nav-text">咨询</div>
|
|
|
+ </div>
|
|
|
+ <div class="nav-item" onclick="switchPage('tools')">
|
|
|
+ <div class="nav-icon">
|
|
|
+ <i class="fas fa-tools"></i>
|
|
|
+ </div>
|
|
|
+ <div class="nav-text">工具</div>
|
|
|
+ </div>
|
|
|
+ <div class="nav-item" onclick="switchPage('profile')">
|
|
|
+ <div class="nav-icon">
|
|
|
+ <i class="fas fa-user"></i>
|
|
|
+ </div>
|
|
|
+ <div class="nav-text">我的</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <script>
|
|
|
+ // DOM元素
|
|
|
+ const chatInput = document.getElementById('chatInput');
|
|
|
+ const sendBtn = document.getElementById('sendBtn');
|
|
|
+ const voiceBtn = document.getElementById('voiceBtn');
|
|
|
+ const chatHistory = document.getElementById('chatHistory');
|
|
|
+
|
|
|
+ // 发送消息功能
|
|
|
+ function sendMessage() {
|
|
|
+ const message = chatInput.value.trim();
|
|
|
+ if (message) {
|
|
|
+ // 添加用户消息
|
|
|
+ addUserMessage(message);
|
|
|
+ chatInput.value = '';
|
|
|
+ sendBtn.disabled = true;
|
|
|
+
|
|
|
+ // 显示AI正在输入
|
|
|
+ showTypingIndicator();
|
|
|
+
|
|
|
+ // 模拟AI回复(实际项目中会调用AI API)
|
|
|
+ setTimeout(() => {
|
|
|
+ removeTypingIndicator();
|
|
|
+ addAIResponse(message);
|
|
|
+ }, 2000);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 添用户消息到聊天界面
|
|
|
+ function addUserMessage(content) {
|
|
|
+ const messageDiv = document.createElement('div');
|
|
|
+ messageDiv.className = 'message user-message';
|
|
|
+ messageDiv.innerHTML = `
|
|
|
+ <div class="message-content">${content}</div>
|
|
|
+ <div class="message-avatar">
|
|
|
+ <i class="fas fa-user"></i>
|
|
|
+ </div>
|
|
|
+ `;
|
|
|
+ chatHistory.appendChild(messageDiv);
|
|
|
+ scrollToBottom();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 添加AI回复
|
|
|
+ function addAIResponse(userMessage) {
|
|
|
+ // 根据用户消息生成不同的回复(简化版)
|
|
|
+ let response = generateAIResponse(userMessage);
|
|
|
+
|
|
|
+ const messageDiv = document.createElement('div');
|
|
|
+ messageDiv.className = 'message ai-message';
|
|
|
+ messageDiv.innerHTML = `
|
|
|
+ <div class="message-avatar">
|
|
|
+ <i class="fas fa-robot"></i>
|
|
|
+ </div>
|
|
|
+ <div class="message-content">
|
|
|
+ ${response}
|
|
|
+ </div>
|
|
|
+ `;
|
|
|
+ chatHistory.appendChild(messageDiv);
|
|
|
+ scrollToBottom();
|
|
|
+ sendBtn.disabled = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 生成AI回复(简化版)
|
|
|
+ function generateAIResponse(userMessage) {
|
|
|
+ const responses = {
|
|
|
+ '劳动': `
|
|
|
+ <div class="conclusion">结论摘要:劳动纠纷通常涉及劳动合同、工资报酬、工作时间等问题。</div>
|
|
|
+ <div class="legal-reference">
|
|
|
+ <strong>法律依据:</strong>
|
|
|
+ 《劳动合同法》相关规定保障劳动者权益,包括签订书面合同、支付劳动报酬、提供劳动保护等。
|
|
|
+ </div>
|
|
|
+ <div class="action-steps">
|
|
|
+ <strong>行动步骤:</strong>
|
|
|
+ <ol>
|
|
|
+ <li>收集相关证据材料</li>
|
|
|
+ <li>与用人单位协商解决</li>
|
|
|
+ <li>向劳动监察部门投诉</li>
|
|
|
+ <li>申请劳动仲裁或提起诉讼</li>
|
|
|
+ </ol>
|
|
|
+ </div>
|
|
|
+ <div class="explanation">
|
|
|
+ 通俗解释:工作中遇到问题,首先要保留证据,然后按照法定程序维护自己的权益。
|
|
|
+ </div>
|
|
|
+ `,
|
|
|
+ '合同': `
|
|
|
+ <div class="conclusion">结论摘要:合同审查需要注意主体资格、条款内容、权利义务等方面。</div>
|
|
|
+ <div class="legal-reference">
|
|
|
+ <strong>法律依据:</strong>
|
|
|
+ 《民法典》合同编规定了合同的订立、效力、履行、变更和转让、权利义务终止等内容。
|
|
|
+ </div>
|
|
|
+ <div class="action-steps">
|
|
|
+ <strong>行动步骤:</strong>
|
|
|
+ <ol>
|
|
|
+ <li>审查合同主体是否适格</li>
|
|
|
+ <li>检查关键条款是否明确</li>
|
|
|
+ <li>注意违约责任条款</li>
|
|
|
+ <li>确认争议解决方式</li>
|
|
|
+ </ol>
|
|
|
+ </div>
|
|
|
+ <div class="explanation">
|
|
|
+ 通俗解释:签合同就像做交易,要看清条款,明确双方责任,避免日后纠纷。
|
|
|
+ </div>
|
|
|
+ `,
|
|
|
+ '默认': `
|
|
|
+ <div class="conclusion">结论摘要:我已理解您的问题,将为您提供专业的法律分析。</div>
|
|
|
+ <div class="legal-reference">
|
|
|
+ <strong>法律依据:</strong>
|
|
|
+ 根据相关法律法规和司法实践,针对您的情况提供以下建议。
|
|
|
+ </div>
|
|
|
+ <div class="action-steps">
|
|
|
+ <strong>行动步骤:</strong>
|
|
|
+ <ol>
|
|
|
+ <li>详细描述具体情况</li>
|
|
|
+ <li>提供相关证据材料</li>
|
|
|
+ <li>明确您的诉求</li>
|
|
|
+ <li>我可以为您生成详细解决方案</li>
|
|
|
+ </ol>
|
|
|
+ </div>
|
|
|
+ <div class="explanation">
|
|
|
+ 通俗解释:请详细说明您遇到的法律问题,我会用通俗易懂的方式为您解答。
|
|
|
+ </div>
|
|
|
+ `
|
|
|
+ };
|
|
|
+
|
|
|
+ // 根据关键词匹配回复
|
|
|
+ if (userMessage.includes('劳动') || userMessage.includes('工资') || userMessage.includes('辞退')) {
|
|
|
+ return responses['劳动'];
|
|
|
+ } else if (userMessage.includes('合同') || userMessage.includes('协议') || userMessage.includes('条款')) {
|
|
|
+ return responses['合同'];
|
|
|
+ } else {
|
|
|
+ return responses['默认'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 显示正在输入指示器
|
|
|
+ function showTypingIndicator() {
|
|
|
+ const typingDiv = document.createElement('div');
|
|
|
+ typingDiv.className = 'message ai-message';
|
|
|
+ typingDiv.id = 'typingIndicator';
|
|
|
+ typingDiv.innerHTML = `
|
|
|
+ <div class="message-avatar">
|
|
|
+ <i class="fas fa-robot"></i>
|
|
|
+ </div>
|
|
|
+ <div class="typing-indicator">
|
|
|
+ <div class="typing-dots">
|
|
|
+ <div class="typing-dot"></div>
|
|
|
+ <div class="typing-dot"></div>
|
|
|
+ <div class="typing-dot"></div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ `;
|
|
|
+ chatHistory.appendChild(typingDiv);
|
|
|
+ scrollToBottom();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 移除正在输入指示器
|
|
|
+ function removeTypingIndicator() {
|
|
|
+ const typingIndicator = document.getElementById('typingIndicator');
|
|
|
+ if (typingIndicator) {
|
|
|
+ typingIndicator.remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 滚动到底部
|
|
|
+ function scrollToBottom() {
|
|
|
+ chatHistory.scrollTop = chatHistory.scrollHeight;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 使用快捷模板
|
|
|
+ function useTemplate(template) {
|
|
|
+ chatInput.value = template;
|
|
|
+ chatInput.focus();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 语音输入功能
|
|
|
+ let isListening = false;
|
|
|
+ function toggleVoiceInput() {
|
|
|
+ if (!isListening) {
|
|
|
+ // 开始语音输入
|
|
|
+ voiceBtn.classList.add('listening');
|
|
|
+ voiceBtn.innerHTML = '<i class="fas fa-stop"></i>';
|
|
|
+ isListening = true;
|
|
|
+ alert('开始语音识别...请说话');
|
|
|
+
|
|
|
+ // 模拟语音识别结果
|
|
|
+ setTimeout(() => {
|
|
|
+ const voiceResults = [
|
|
|
+ "如何申请劳动仲裁?",
|
|
|
+ "租房合同纠纷怎么处理?",
|
|
|
+ "交通事故责任认定标准",
|
|
|
+ "离婚财产分割原则"
|
|
|
+ ];
|
|
|
+ const randomResult = voiceResults[Math.floor(Math.random() * voiceResults.length)];
|
|
|
+ chatInput.value = randomResult;
|
|
|
+ stopVoiceInput();
|
|
|
+ }, 3000);
|
|
|
+ } else {
|
|
|
+ stopVoiceInput();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function stopVoiceInput() {
|
|
|
+ voiceBtn.classList.remove('listening');
|
|
|
+ voiceBtn.innerHTML = '<i class="fas fa-microphone"></i>';
|
|
|
+ isListening = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 输入框事件
|
|
|
+ chatInput.addEventListener('input', function() {
|
|
|
+ sendBtn.disabled = !this.value.trim();
|
|
|
+ });
|
|
|
+
|
|
|
+ chatInput.addEventListener('keypress', function(e) {
|
|
|
+ if (e.key === 'Enter' && !sendBtn.disabled) {
|
|
|
+ sendMessage();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 其他功能函数
|
|
|
+ function attachFile() {
|
|
|
+ alert('打开文件选择器,支持图片、PDF、Word文档等格式');
|
|
|
+ }
|
|
|
+
|
|
|
+ function showRelatedTools() {
|
|
|
+ alert('显示相关工具:文书生成、赔偿计算器等');
|
|
|
+ }
|
|
|
+
|
|
|
+ function saveConversation() {
|
|
|
+ alert('当前咨询已收藏');
|
|
|
+ }
|
|
|
+
|
|
|
+ function shareConversation() {
|
|
|
+ alert('分享咨询记录');
|
|
|
+ }
|
|
|
+
|
|
|
+ function showConsultHistory() {
|
|
|
+ alert('打开咨询历史页面');
|
|
|
+ }
|
|
|
+
|
|
|
+ function showLawSearch() {
|
|
|
+ alert('打开法条案例检索页面');
|
|
|
+ }
|
|
|
+
|
|
|
+ function switchPage(page) {
|
|
|
+ alert(`切换到${page}页面`);
|
|
|
+ // 实际项目中这里会进行页面跳转
|
|
|
+ }
|
|
|
+
|
|
|
+ // 初始化
|
|
|
+ window.onload = function() {
|
|
|
+ sendBtn.disabled = true;
|
|
|
+ scrollToBottom();
|
|
|
+ };
|
|
|
+ </script>
|
|
|
+</body>
|
|
|
+</html>
|