Index.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122
  1. <template>
  2. <div class="container">
  3. <!-- 顶部logo -->
  4. <div class="header">
  5. <div class="logo">
  6. <img src="@/assets/new_index/1.png" alt="logo" class="logo-img">
  7. </div>
  8. <!-- 用户信息区域 -->
  9. <div class="user-info" @mouseenter="showDropdown = true" @mouseleave="showDropdown = false">
  10. <div class="user-avatar">
  11. <div class="avatar-icon"></div>
  12. </div>
  13. <span class="username">{{ userInfo?.username || '用户' }}</span>
  14. <!-- 下拉菜单 -->
  15. <!-- <div v-if="showDropdown" class="dropdown-menu">
  16. <div class="dropdown-item logout-item" @click="handleLogout">
  17. <span>退出</span>
  18. </div>
  19. </div> -->
  20. </div>
  21. </div>
  22. <!-- 主内容区域 -->
  23. <div class="main-content">
  24. <!-- 主标题 -->
  25. <h1 class="main-title">蜀道安全管理AI智能助手</h1>
  26. <p class="sub-title">安全法规问答,智能识图提示,AI赋能筑造安心与高效</p>
  27. <!-- 搜索框 -->
  28. <div class="search-container">
  29. <div class="search-box">
  30. <input
  31. type="text"
  32. placeholder="请输入您想问的问题..."
  33. class="search-input"
  34. v-model="searchText"
  35. @keyup.enter="handleSearch"
  36. @input="handleInput"
  37. >
  38. <button class="voice-btn" @click="handleVoiceClick" :disabled="isSending" :class="{ 'recording': isListening }">
  39. <div class="icon-container">
  40. <img :src="voiceInputIcon" alt="语音" class="action-icon">
  41. <div v-if="isListening" class="recording-indicator"></div>
  42. </div>
  43. </button>
  44. <div class="divider"></div>
  45. <button class="send-btn" @click="handleSearch" :disabled="isSending || !searchText.trim()">
  46. <img :src="searchText.trim() && !isSending ? sendIconFilled : sendIconEmpty" alt="发送" class="send-icon">
  47. </button>
  48. </div>
  49. <!-- 提问联想 -->
  50. <div v-if="showSuggestions && userRecommendQuestions.length > 0" class="user-recommend-questions" @click.stop>
  51. <div class="recommend-list">
  52. <div
  53. v-for="(question, index) in userRecommendQuestions"
  54. :key="index"
  55. class="recommend-item"
  56. @click="handleUserRecommendQuestion(question)"
  57. >
  58. {{ question }}
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. <!-- 卡片区域 -->
  64. <div class="cards-container">
  65. <!-- 第一列:常见问题 -->
  66. <div class="card-column first-column">
  67. <div class="common-questions-card">
  68. <div class="card-header">
  69. <div class="refresh-button" @click="refreshQuestions">
  70. <span class="refresh-text">换一换</span>
  71. </div>
  72. </div>
  73. <div class="questions-content">
  74. <div class="questions-list">
  75. <div class="question-item" @click="goToAIQuestion(item.question)" v-for="(item, index) in recommendQuestions" :key="index" :title="item.question">
  76. {{ index + 1 }}. {{ item.question }}
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. </div>
  82. <!-- 第二列:隐患提示和安全培训 -->
  83. <div class="card-column">
  84. <div class="hazard-card" @click="goToHazardDetection">
  85. <div class="card-title">隐患提示</div>
  86. <div class="card-description">图片智能识别,风险隐患提示</div>
  87. </div>
  88. <div class="training-card" @click="goToSafetyTraining">
  89. <div class="card-title">安全培训</div>
  90. <div class="card-description">智能编排大纲,生成精美演示文稿</div>
  91. </div>
  92. </div>
  93. <!-- 第三列:考试工坊和政策文件 -->
  94. <div class="card-column">
  95. <div class="service-card exam-workshop-card" @click="goToExamWorkshop">
  96. <div class="service-header">
  97. <div class="service-icon">
  98. <img src="@/assets/new_index/6-1.png" alt="考试工坊" class="icon-img">
  99. </div>
  100. <div class="service-title">考试工坊</div>
  101. </div>
  102. <div class="service-description">让组卷更省心,让出题更精准</div>
  103. <div class="service-tag" style="color: #2563EB;">生成考题 ›</div>
  104. </div>
  105. <div class="service-card policy-document-card" @click="goToPolicyDocument">
  106. <div class="service-header">
  107. <div class="service-icon">
  108. <img src="@/assets/new_index/8-1.png" alt="政策文件" class="icon-img">
  109. </div>
  110. <div class="service-title">政策文件</div>
  111. </div>
  112. <div class="service-description">汇集国家、行业及集团政策文件</div>
  113. <div class="service-tag" style="color: #EA580C;">了解更多 ›</div>
  114. </div>
  115. </div>
  116. <!-- 第四列:AI写作和意见反馈 -->
  117. <div class="card-column">
  118. <div class="service-card ai-writing-card" @click="goToAIWriting">
  119. <div class="service-header">
  120. <div class="service-icon">
  121. <img src="@/assets/new_index/7-1.png" alt="AI写作" class="icon-img">
  122. </div>
  123. <div class="service-title">AI写作</div>
  124. </div>
  125. <div class="service-description">一键创作公文,让文案更专业</div>
  126. <div class="service-tag" style="color: #16A34A;">开始创作 ›</div>
  127. </div>
  128. <div class="service-card feedback-card" @click="openFeedbackModal">
  129. <div class="service-header">
  130. <div class="service-icon">
  131. <img src="@/assets/new_index/9-1.png" alt="意见反馈" class="icon-img">
  132. </div>
  133. <div class="service-title">意见反馈</div>
  134. </div>
  135. <div class="service-description">助力产品升级,期待您的反馈</div>
  136. <div class="service-tag" style="color: #9333EA;">参与反馈 ›</div>
  137. </div>
  138. </div>
  139. </div>
  140. </div>
  141. <!-- 底部版权信息 -->
  142. <div class="footer">
  143. <div class="footer-info">
  144. <span>工信部备案号: 蜀ICP备20251411234号-1</span>
  145. <span>川公网安备: 51010502011234号</span>
  146. <span>推荐电脑分辨率:1920*1080,1920*1200,3840*2160</span>
  147. <span>推荐浏览器:Google,Edge,火狐浏览器</span>
  148. </div>
  149. </div>
  150. <!-- 意见反馈弹窗 -->
  151. <FeedbackModal
  152. :visible="showFeedbackModal"
  153. @close="closeFeedbackModal"
  154. @submit="handleFeedbackSubmit"
  155. />
  156. </div>
  157. </template>
  158. <script setup>
  159. import { ref, computed, onMounted, onUnmounted, watch } from 'vue'
  160. import { useRouter } from 'vue-router'
  161. import FeedbackModal from '@/components/FeedbackModal.vue'
  162. import { apis } from '@/request/apis.js'
  163. // ===== 已删除:getUserId - 不再需要,改用token =====
  164. // import { getUserId } from '@/utils/userManager.js'
  165. import { useSpeechRecognition } from '@/composables/useSpeechRecognition.js'
  166. import { performLogout, getUsername } from '@/utils/auth.js'
  167. // 导入Element Plus组件
  168. import { ElMessage } from 'element-plus'
  169. // 导入图标
  170. import voiceInputIcon from '@/assets/Chat/18.png'
  171. import sendIconEmpty from '@/assets/Chat/15.png'
  172. import sendIconFilled from '@/assets/Chat/16.png'
  173. const router = useRouter()
  174. // 语音识别功能
  175. const {
  176. isSupported: speechSupported,
  177. isListening,
  178. isProcessing,
  179. transcript,
  180. error: speechError,
  181. startListening,
  182. stopListening
  183. } = useSpeechRecognition()
  184. // 响应式数据
  185. const searchText = ref('')
  186. const showFeedbackModal = ref(false)
  187. const isSending = ref(false)
  188. const recommendQuestions = ref([])
  189. // 用户信息相关
  190. const userInfo = ref(null)
  191. const showDropdown = ref(false)
  192. // 提问联想相关数据
  193. const userRecommendQuestions = ref([]) // 用户输入时获取的推荐问题
  194. const isGettingRecommendQuestions = ref(false) // 是否正在获取推荐问题
  195. const recommendQuestionsTimer = ref(null) // 防抖定时器
  196. const showSuggestions = ref(false) // 是否显示联想建议
  197. // 获取推荐问题
  198. const getRecommendQuestion = async () => {
  199. try {
  200. const res = await apis.getRecommendQuestion({ limit: 8 })
  201. recommendQuestions.value = res.data
  202. console.log('推荐问题数据结构:', recommendQuestions.value)
  203. } catch (error) {
  204. console.error('获取推荐问题失败:', error)
  205. }
  206. }
  207. // 换一换
  208. const refreshQuestions = () => {
  209. getRecommendQuestion()
  210. }
  211. // 清空推荐问题
  212. const clearRecommendQuestions = () => {
  213. userRecommendQuestions.value = []
  214. showSuggestions.value = false
  215. if (recommendQuestionsTimer.value) {
  216. clearTimeout(recommendQuestionsTimer.value)
  217. recommendQuestionsTimer.value = null
  218. }
  219. }
  220. // 处理输入框输入,获取联想问题
  221. const handleInput = () => {
  222. // 如果输入内容为空,清空推荐问题
  223. if (!searchText.value.trim()) {
  224. clearRecommendQuestions()
  225. return
  226. }
  227. // 防抖获取推荐问题
  228. if (recommendQuestionsTimer.value) {
  229. clearTimeout(recommendQuestionsTimer.value)
  230. }
  231. // 延迟100ms后获取推荐问题,避免频繁调用
  232. recommendQuestionsTimer.value = setTimeout(() => {
  233. getUserRecommendQuestions(searchText.value)
  234. }, 100)
  235. }
  236. // 获取用户推荐问题
  237. const getUserRecommendQuestions = async (userMessage) => {
  238. if (!userMessage || userMessage.trim().length === 0) {
  239. userRecommendQuestions.value = []
  240. showSuggestions.value = false
  241. return
  242. }
  243. // 如果正在发送消息,则不获取推荐问题
  244. if (isSending.value) {
  245. console.log('正在发送消息,跳过推荐问题获取')
  246. userRecommendQuestions.value = []
  247. showSuggestions.value = false
  248. return
  249. }
  250. try {
  251. console.log('开始获取用户推荐问题,用户输入:', userMessage)
  252. isGettingRecommendQuestions.value = true
  253. const response = await apis.getUserRecommendQuestion({
  254. user_message: userMessage.trim()
  255. // ===== 已删除:user_id - 后端从token解析 =====
  256. })
  257. console.log('用户推荐问题响应:', response)
  258. // 再次检查状态,防止在请求过程中状态发生变化
  259. if (isSending.value) {
  260. console.log('请求完成时状态已变化,不显示推荐问题')
  261. userRecommendQuestions.value = []
  262. showSuggestions.value = false
  263. return
  264. }
  265. if (response && response.data && response.data.questions && response.data.questions.length > 0) {
  266. userRecommendQuestions.value = response.data.questions
  267. showSuggestions.value = true
  268. console.log('用户推荐问题数据已设置:', userRecommendQuestions.value)
  269. } else {
  270. userRecommendQuestions.value = []
  271. showSuggestions.value = false
  272. }
  273. } catch (error) {
  274. console.error('获取用户推荐问题失败:', error)
  275. userRecommendQuestions.value = []
  276. showSuggestions.value = false
  277. } finally {
  278. isGettingRecommendQuestions.value = false
  279. }
  280. }
  281. // 处理联想问题点击
  282. const handleUserRecommendQuestion = (question) => {
  283. console.log('选择用户推荐问题:', question)
  284. // 设置消息内容到输入框
  285. searchText.value = question
  286. // 清空推荐问题列表
  287. clearRecommendQuestions()
  288. }
  289. // 语音输入相关方法
  290. const handleVoiceClick = () => {
  291. console.log('点击语音按钮')
  292. if (isProcessing.value) {
  293. ElMessage.info('语音正在转写,请稍候...')
  294. return
  295. }
  296. if (isListening.value) {
  297. stopVoiceInput()
  298. } else {
  299. startVoiceInput()
  300. }
  301. }
  302. const startVoiceInput = () => {
  303. console.log('开始语音输入')
  304. // 开始语音识别
  305. const success = startListening()
  306. if (!success) {
  307. ElMessage.error('语音识别启动失败,请检查麦克风权限')
  308. }
  309. }
  310. const stopVoiceInput = () => {
  311. console.log('停止语音输入')
  312. stopListening()
  313. ElMessage.info('语音转写中,请稍候...')
  314. }
  315. // 搜索功能
  316. const handleSearch = async () => {
  317. if (!searchText.value.trim()) {
  318. ElMessage.warning('请输入搜索内容')
  319. return
  320. }
  321. if (isSending.value) return
  322. isSending.value = true
  323. // 清空联想问题
  324. clearRecommendQuestions()
  325. try {
  326. console.log('搜索内容:', searchText.value)
  327. // 跳转到AI问答页面,并传递搜索内容
  328. router.push({
  329. path: '/chat',
  330. query: {
  331. autoMessage: searchText.value
  332. }
  333. })
  334. } finally {
  335. isSending.value = false
  336. }
  337. }
  338. // 意见反馈弹窗相关方法
  339. const openFeedbackModal = () => {
  340. showFeedbackModal.value = true
  341. }
  342. const closeFeedbackModal = () => {
  343. showFeedbackModal.value = false
  344. }
  345. // 提交意见反馈
  346. const handleFeedbackSubmit = async (feedbackData) => {
  347. try {
  348. console.log('收到反馈数据:', feedbackData)
  349. console.log('feedback_img字段值:', feedbackData.feedback_img)
  350. // 处理图片数据 - 直接使用feedback_img字段
  351. let feedbackImg = feedbackData.feedback_img || ''
  352. console.log('处理后的feedbackImg:', feedbackImg)
  353. // 将前端数据格式转换为后端字段格式
  354. const feedbackPayload = {
  355. feedback_type: getFeedbackType(feedbackData.type),
  356. feedback_content: feedbackData.content,
  357. feedback_user_phone: feedbackData.contact || '',
  358. feedback_img: feedbackImg
  359. // ===== 已删除:user_id - 后端从token解析 =====
  360. }
  361. console.log(feedbackPayload,'feedbackPayload')
  362. // 调用API接口
  363. const response = await apis.submitFeedback(feedbackPayload)
  364. console.log(response,'response')
  365. // 提交成功
  366. ElMessage.success('反馈提交成功!感谢您的宝贵意见')
  367. closeFeedbackModal()
  368. } catch (error) {
  369. console.error('提交反馈失败:', error)
  370. ElMessage.error('提交反馈失败,请重试')
  371. }
  372. }
  373. // 将前端反馈类型转换为后端数字类型
  374. const getFeedbackType = (type) => {
  375. const typeMap = {
  376. 'function': 1, // 功能建议 -> 问题反馈
  377. 'interface': 2, // 界面优化 -> 界面优化
  378. 'experience': 3, // 体验问题 -> 体验问题
  379. 'other': 4 // 其他 -> 其他
  380. }
  381. return typeMap[type] || 1
  382. }
  383. // 推荐问题点击跳转
  384. const goToAIQuestion = (question) => {
  385. console.log('点击问题:', question)
  386. // 跳转到AI问答页面,并传递问题内容
  387. router.push({
  388. path: '/chat',
  389. query: {
  390. autoMessage: question
  391. }
  392. })
  393. }
  394. // 服务导航跳转方法
  395. const goToHazardDetection = () => {
  396. router.push('/hazard-detection')
  397. }
  398. const goToSafetyTraining = () => {
  399. router.push('/safety-hazard')
  400. }
  401. const goToExamWorkshop = () => {
  402. router.push('/exam-workshop')
  403. }
  404. const goToAIWriting = () => {
  405. router.push('/ai-writing')
  406. }
  407. const goToPolicyDocument = () => {
  408. router.push('/policy-document')
  409. }
  410. // 退出登录
  411. const handleLogout = () => {
  412. console.log('退出登录')
  413. performLogout()
  414. }
  415. // 监听语音识别错误
  416. watch(transcript, (newVal) => {
  417. if (!newVal || isListening.value) return
  418. searchText.value = newVal
  419. })
  420. watch(speechError, (newVal) => {
  421. if (newVal) {
  422. console.error('语音识别错误:', newVal)
  423. ElMessage.error(newVal)
  424. }
  425. })
  426. // 点击外部区域关闭联想
  427. const handleClickOutside = (event) => {
  428. if (!event.target.closest('.user-recommend-questions') && !event.target.closest('.search-box')) {
  429. clearRecommendQuestions()
  430. }
  431. }
  432. onMounted(() => {
  433. getRecommendQuestion()
  434. // 从本地存储获取用户名
  435. const username = getUsername()
  436. userInfo.value = {
  437. username: username || '蜀道用户'
  438. }
  439. console.log('用户信息:', userInfo.value)
  440. // 添加点击外部区域关闭联想的事件监听
  441. document.addEventListener('click', handleClickOutside)
  442. })
  443. // 组件卸载时移除事件监听
  444. onUnmounted(() => {
  445. document.removeEventListener('click', handleClickOutside)
  446. if (recommendQuestionsTimer.value) {
  447. clearTimeout(recommendQuestionsTimer.value)
  448. }
  449. })
  450. </script>
  451. <style lang="less" scoped>
  452. .container {
  453. width: 100%;
  454. height: 100vh;
  455. background-image: url('@/assets/new_index/2.png');
  456. background-size: 100% 100%;
  457. background-repeat: no-repeat;
  458. background-position: center center;
  459. display: flex;
  460. flex-direction: column;
  461. overflow: hidden;
  462. box-sizing: border-box;
  463. // position: relative;
  464. }
  465. /* 顶部logo区域 */
  466. .header {
  467. padding: 19px 105px 0 105px;
  468. display: flex;
  469. justify-content: space-between;
  470. align-items: center;
  471. .logo {
  472. display: flex;
  473. align-items: center;
  474. .logo-img {
  475. width: 151px;
  476. height: 44px;
  477. }
  478. }
  479. /* 用户信息区域 */
  480. .user-info {
  481. position: relative;
  482. display: flex;
  483. align-items: center;
  484. // justify-content: center;
  485. gap: 8px;
  486. cursor: pointer;
  487. padding: 8px 12px;
  488. border-radius: 8px;
  489. transition: background-color 0.3s ease;
  490. height: 48px;
  491. .user-avatar {
  492. display: flex;
  493. align-items: center;
  494. justify-content: center;
  495. .avatar-icon {
  496. width: 32px;
  497. height: 32px;
  498. border-radius: 50%;
  499. background: #DBEAFE;
  500. display: flex;
  501. align-items: center;
  502. justify-content: center;
  503. position: relative;
  504. &::before {
  505. content: '👤';
  506. font-size: 16px;
  507. color: white;
  508. }
  509. }
  510. }
  511. .username {
  512. font-size: 16px;
  513. color: #000B63;
  514. font-weight: 500;
  515. white-space: nowrap;
  516. line-height: 1;
  517. display: flex;
  518. align-items: center;
  519. }
  520. /* 下拉菜单 */
  521. .dropdown-menu {
  522. position: absolute;
  523. top: 100%;
  524. left: 0;
  525. right: 0;
  526. background: white;
  527. border-radius: 8px;
  528. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  529. border: 1px solid #E5E7EB;
  530. z-index: 1000;
  531. overflow: hidden;
  532. .dropdown-item {
  533. padding: 12px 16px;
  534. font-size: 14px;
  535. color: #374151;
  536. cursor: pointer;
  537. transition: background-color 0.2s ease;
  538. &:hover {
  539. background-color: #F3F4F6;
  540. }
  541. &.logout-item {
  542. color: #DC2626;
  543. &:hover {
  544. background-color: #FEF2F2;
  545. }
  546. }
  547. }
  548. }
  549. }
  550. }
  551. /* 主内容区域 */
  552. .main-content {
  553. flex: 1;
  554. display: flex;
  555. flex-direction: column;
  556. align-items: center;
  557. padding: 50px 0 20px 0;
  558. max-width: 1434px;
  559. margin: 0 auto;
  560. width: 100%;
  561. box-sizing: border-box;
  562. }
  563. /* 主标题 */
  564. .main-title {
  565. font-size: 62px;
  566. font-weight: 900;
  567. color: #000B63;
  568. text-align: center;
  569. margin: 0;
  570. line-height: 1;
  571. }
  572. .sub-title {
  573. font-size: 24px;
  574. color: #000B63;
  575. text-align: center;
  576. margin: 15px 0 0 0;
  577. }
  578. /* 搜索框 */
  579. .search-container {
  580. width: 100%;
  581. max-width: 1323px;
  582. margin: 30px 0 0 0;
  583. position: relative; /* 为联想问题提供定位参考 */
  584. .search-box {
  585. position: relative;
  586. width: 100%;
  587. height: 64.4px;
  588. border: 2px solid rgba(0, 11, 99, 0.5);
  589. border-radius: 11.5px;
  590. background: #ffffff;
  591. display: flex;
  592. align-items: center;
  593. padding: 0 20px;
  594. .search-input {
  595. flex: 1;
  596. height: 100%;
  597. border: none;
  598. outline: none;
  599. font-size: 16px;
  600. background: transparent;
  601. padding: 0 20px 0 0;
  602. &::placeholder {
  603. color: #9CA3AF;
  604. }
  605. }
  606. .voice-btn {
  607. background: none;
  608. border: none;
  609. cursor: pointer;
  610. padding: 0;
  611. margin-right: 0;
  612. transition: all 0.3s ease;
  613. display: flex;
  614. align-items: center;
  615. justify-content: center;
  616. height: 100%;
  617. &:hover {
  618. opacity: 0.8;
  619. }
  620. .icon-container {
  621. width: 20px;
  622. height: 20px;
  623. display: flex;
  624. align-items: center;
  625. justify-content: center;
  626. flex-shrink: 0;
  627. position: relative;
  628. }
  629. .recording-indicator {
  630. position: absolute;
  631. top: -2px;
  632. right: -2px;
  633. width: 8px;
  634. height: 8px;
  635. background: #ef4444;
  636. border-radius: 50%;
  637. animation: blink 1s ease-in-out infinite;
  638. }
  639. .action-icon {
  640. width: 20px;
  641. height: 20px;
  642. max-width: 20px;
  643. max-height: 20px;
  644. object-fit: contain;
  645. }
  646. }
  647. .divider {
  648. width: 1px;
  649. height: 31px;
  650. background-color: #D6D5DE;
  651. margin: 0 12px;
  652. }
  653. .send-btn {
  654. background: none;
  655. border: none;
  656. cursor: pointer;
  657. padding: 0;
  658. transition: all 0.3s ease;
  659. display: flex;
  660. align-items: center;
  661. justify-content: center;
  662. height: 100%;
  663. &:hover:not(:disabled) {
  664. opacity: 0.8;
  665. }
  666. &:disabled {
  667. opacity: 0.5;
  668. cursor: not-allowed;
  669. }
  670. .send-icon {
  671. width: 90px;
  672. height: 40px;
  673. object-fit: contain;
  674. }
  675. }
  676. }
  677. }
  678. /* 提问联想样式 */
  679. .user-recommend-questions {
  680. position: absolute;
  681. top: 100%; /* 位于搜索框下方 */
  682. left: 0;
  683. right: 0;
  684. background: white;
  685. border-radius: 12px;
  686. padding: 16px 20px;
  687. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  688. border: 1px solid #E5E8EB;
  689. z-index: 10;
  690. margin-top: 8px;
  691. .recommend-list {
  692. display: flex;
  693. flex-direction: column;
  694. gap: 8px;
  695. max-height: 280px; /* 限制高度,大约5条内容的高度 */
  696. overflow-y: auto; /* 超过高度时显示滚动条 */
  697. /* 自定义滚动条样式 */
  698. &::-webkit-scrollbar {
  699. width: 6px;
  700. }
  701. &::-webkit-scrollbar-track {
  702. background: #f1f5f9;
  703. border-radius: 3px;
  704. }
  705. &::-webkit-scrollbar-thumb {
  706. background: #cbd5e1;
  707. border-radius: 3px;
  708. &:hover {
  709. background: #94a3b8;
  710. }
  711. }
  712. .recommend-item {
  713. padding: 8px 10px;
  714. font-size: 16px;
  715. color: #000;
  716. cursor: pointer;
  717. transition: all 0.2s ease;
  718. line-height: 1.4;
  719. border-radius: 6px;
  720. &:hover {
  721. background-color: #f8fafc;
  722. color: #2563EB;
  723. }
  724. &:last-child {
  725. margin-bottom: 0;
  726. }
  727. }
  728. }
  729. }
  730. @keyframes blink {
  731. 0%, 100% {
  732. opacity: 1;
  733. }
  734. 50% {
  735. opacity: 0.5;
  736. }
  737. }
  738. /* 卡片区域 */
  739. .cards-container {
  740. display: flex;
  741. gap: 28px;
  742. width: 100%;
  743. max-width: 1434px;
  744. margin: 35px 0 0 0;
  745. }
  746. .card-column {
  747. display: flex;
  748. flex-direction: column;
  749. gap: 28px;
  750. &.first-column {
  751. width: 338px;
  752. }
  753. &:nth-child(2) {
  754. width: 406px;
  755. }
  756. &:nth-child(3), &:nth-child(4) {
  757. width: 306px;
  758. }
  759. }
  760. /* 常见问题卡片 */
  761. .common-questions-card {
  762. background-image: url('@/assets/new_index/3.png');
  763. background-size: 100% 100%;
  764. background-repeat: no-repeat;
  765. width: 338px;
  766. height: 462px;
  767. position: relative;
  768. .card-header {
  769. position: absolute;
  770. top: 28.75px;
  771. right: 24.2px;
  772. text-align: center;
  773. .refresh-button {
  774. background: rgba(255, 255, 255, 0.25);
  775. border: none;
  776. border-radius: 151.8px;
  777. height: 27.46px;
  778. width: 66.7px;
  779. cursor: pointer;
  780. transition: all 0.3s ease;
  781. display: flex;
  782. align-items: center;
  783. justify-content: center;
  784. &:hover {
  785. background: rgba(255, 255, 255, 0.4);
  786. }
  787. .refresh-text {
  788. font-size: 14px;
  789. color: #FFFFFF;
  790. font-weight: 500;
  791. line-height: 1;
  792. }
  793. }
  794. }
  795. .questions-content {
  796. position: absolute;
  797. top: 81px;
  798. left: 25px;
  799. right: 25px;
  800. bottom: 25px;
  801. background: #ffffff;
  802. border-radius: 22.97px;
  803. padding: 18px;
  804. overflow-y: auto;
  805. .questions-list {
  806. .question-item {
  807. margin-bottom: 15px;
  808. font-size: 18px;
  809. color: #0F2340;
  810. cursor: pointer;
  811. transition: all 0.3s ease;
  812. line-height: 1.4;
  813. overflow: hidden;
  814. text-overflow: ellipsis;
  815. white-space: nowrap;
  816. &:hover {
  817. color: #2563EB;
  818. transform: translateX(5px);
  819. }
  820. &:last-child {
  821. margin-bottom: 0;
  822. }
  823. }
  824. }
  825. }
  826. }
  827. /* 隐患提示卡片 */
  828. .hazard-card {
  829. background-image: url('@/assets/new_index/4.png');
  830. background-size: 100% 100%;
  831. background-repeat: no-repeat;
  832. width: 406px;
  833. height: 217px;
  834. position: relative;
  835. cursor: pointer;
  836. transition: all 0.3s ease;
  837. &:hover {
  838. transform: translateY(-4px);
  839. }
  840. .card-title {
  841. position: absolute;
  842. left: 40px;
  843. top: 131.2px;
  844. font-size: 22px;
  845. color: #000000;
  846. font-weight: 600;
  847. }
  848. .card-description {
  849. position: absolute;
  850. left: 40px;
  851. top: 171.2px;
  852. font-size: 18px;
  853. color: #4B5563;
  854. line-height: 1.4;
  855. }
  856. }
  857. /* 安全培训卡片 */
  858. .training-card {
  859. background-image: url('@/assets/new_index/5.png');
  860. background-size: 100% 100%;
  861. background-repeat: no-repeat;
  862. width: 406px;
  863. height: 217px;
  864. position: relative;
  865. cursor: pointer;
  866. transition: all 0.3s ease;
  867. &:hover {
  868. transform: translateY(-4px);
  869. }
  870. .card-title {
  871. position: absolute;
  872. left: 40px;
  873. top: 119.6px;
  874. font-size: 22px;
  875. color: #FFFFFF;
  876. font-weight: 600;
  877. }
  878. .card-description {
  879. position: absolute;
  880. left: 40px;
  881. top: 159.8px;
  882. font-size: 18px;
  883. color: #DBEAFE;
  884. line-height: 1.4;
  885. }
  886. }
  887. /* 服务卡片 */
  888. .service-card {
  889. background-size: 100% 100%;
  890. background-repeat: no-repeat;
  891. width: 306px;
  892. height: 217px;
  893. position: relative;
  894. cursor: pointer;
  895. transition: all 0.3s ease;
  896. &:hover {
  897. transform: translateY(-4px);
  898. }
  899. &.exam-workshop-card {
  900. background-image: url('@/assets/new_index/6.png');
  901. }
  902. &.policy-document-card {
  903. background-image: url('@/assets/new_index/8.png');
  904. }
  905. &.ai-writing-card {
  906. background-image: url('@/assets/new_index/7.png');
  907. }
  908. &.feedback-card {
  909. background-image: url('@/assets/new_index/9.png');
  910. }
  911. .service-header {
  912. position: absolute;
  913. left: 50%;
  914. top: 40px;
  915. transform: translateX(-50%);
  916. display: flex;
  917. align-items: center;
  918. gap: 8px;
  919. }
  920. .service-icon {
  921. .icon-img {
  922. width: 40px;
  923. height: 40px;
  924. object-fit: contain;
  925. }
  926. }
  927. .service-title {
  928. font-size: 22px;
  929. color: #000000;
  930. font-weight: 600;
  931. line-height: 1;
  932. white-space: nowrap;
  933. }
  934. .service-description {
  935. position: absolute;
  936. left: 50%;
  937. top: 102px;
  938. transform: translateX(-50%);
  939. font-size: 18px;
  940. color: #4B5563;
  941. line-height: 1;
  942. text-align: center;
  943. width: 100%;
  944. }
  945. .service-tag {
  946. position: absolute;
  947. left: 38px;
  948. top: 173px;
  949. font-size: 16px;
  950. font-weight: 500;
  951. white-space: nowrap;
  952. }
  953. }
  954. /* 底部版权信息 */
  955. .footer {
  956. position: fixed;
  957. bottom: 0;
  958. width: 100%;
  959. height: 57px;
  960. background-image: url('@/assets/new_index/10.png');
  961. background-size: 100% 100%;
  962. background-repeat: no-repeat;
  963. display: flex;
  964. align-items: center;
  965. justify-content: center;
  966. z-index: 10;
  967. .footer-info {
  968. display: flex;
  969. justify-content: center;
  970. gap: 158px;
  971. font-size: 14px;
  972. color: #6B7280;
  973. line-height: 1;
  974. }
  975. }
  976. </style>