You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2574 lines
64 KiB

6 months ago
4 weeks ago
4 weeks ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
1 month ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
6 months ago
6 months ago
3 months ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
  1. <script setup>
  2. // 导入
  3. import { ref, computed, onMounted, watch, nextTick, onUnmounted, h } from "vue";
  4. import { setHeight } from "../utils/setHeight";
  5. import {
  6. getUserCountAPI,
  7. showExchangeAPI,
  8. godExchangeAPI,
  9. exchangeAPI,
  10. getGoldCoinAPI,
  11. } from "../api/AIxiaocaishen";
  12. import { ElMessage } from "element-plus";
  13. import AIchat from "./AIchat.vue";
  14. import AIfind from "./AIfind.vue";
  15. import Feedback from "./Feedback.vue";
  16. import Announcement from "./Announcement.vue";
  17. import { useAppBridge } from "../assets/js/useAppBridge.js";
  18. import { useDataStore } from "@/store/dataList.js";
  19. import { useChatStore } from "../store/chat";
  20. import { useEmotionAudioStore } from "../store/emotionAudio";
  21. import { useAudioStore } from "../store/audio";
  22. import _ from "lodash";
  23. import logo from "../assets/img/homePage/logo.png";
  24. import madeInHL from "../assets/img/homePage/madeInHL.png";
  25. import getCountAll from "../assets/img/homePage/get-count-all.png";
  26. import announcementBtn from "../assets/img/homePage/announcement.png";
  27. import thinkActive from "../assets/img/homePage/tail/think-active.png";
  28. import thinkNoActive from "../assets/img/homePage/tail/think-no-active.png";
  29. import languageBtn from "../assets/img/homePage/tail/language.png";
  30. import dbqbButton01 from "../assets/img/AiEmotion/dbqb-button01.png";
  31. import dbqbButton02 from "../assets/img/AiEmotion/dbqb-button02.png";
  32. import emotionButton01 from "../assets/img/AiEmotion/emotion-button01.png";
  33. import emotionButton02 from "../assets/img/AiEmotion/emotion-button02.png";
  34. import voice from "../assets/img/homePage/tail/voice.png";
  35. import voiceNoActive from "../assets/img/homePage/tail/voice-no-active.png";
  36. import sendBtn from "../assets/img/homePage/tail/send.png";
  37. import msgBtn from "../assets/img/homePage/tail/msg.png";
  38. import feedbackBtn from "../assets/img/Feedback/feedbackBtn.png";
  39. import AiEmotion from "./AiEmotion.vue";
  40. import HistoryRecord from "./components/HistoryRecord.vue";
  41. // import VConsole from "vconsole";
  42. // const vConsole = new VConsole();
  43. const isMobile = ref(null);
  44. // 获取 AiEmotion 组件的 ref
  45. const aiEmotionRef = ref(null);
  46. // 获取历史记录组件的 ref
  47. const historyRecordRef = ref(null);
  48. // import { useUserStore } from "../store/userPessionCode.js";
  49. const { getQueryVariable, setActiveTabIndex, getUserInfo } = useDataStore();
  50. const dataStore = useDataStore();
  51. const chatStore = useChatStore();
  52. // 变量
  53. // 音频管理
  54. const emotionAudioStore = useEmotionAudioStore();
  55. const audioStore = useAudioStore();
  56. // 根据当前页面类型获取对应的音频store
  57. const getCurrentAudioStore = () => {
  58. return activeTab.value === "AiEmotion" ? emotionAudioStore : audioStore;
  59. };
  60. const isVoice = computed(() => {
  61. const currentStore = getCurrentAudioStore();
  62. return currentStore.isVoiceEnabled;
  63. });
  64. const toggleVoice = () => {
  65. const currentStore = getCurrentAudioStore();
  66. if (!currentStore.isVoiceEnabled) {
  67. // 如果语音功能关闭,先开启语音功能
  68. currentStore.toggleVoice();
  69. } else {
  70. // 如果语音功能开启,则切换播放/暂停状态
  71. if (currentStore.currentAudioUrl || currentStore.ttsUrl) {
  72. // 有音频时切换播放/暂停
  73. currentStore.togglePlayPause();
  74. } else {
  75. // 没有音频时关闭语音功能
  76. currentStore.toggleVoice();
  77. }
  78. }
  79. };
  80. // 将默认值改为从 sessionStorage 中获取,如果没有则使用默认值 'aifindCow'为第一个默认tab
  81. const activeTab = ref(sessionStorage.getItem("activeTabAI") || "AIchat");
  82. const activeIndex = ref(
  83. parseInt(sessionStorage.getItem("activeIndexAI") || "0")
  84. );
  85. const tabs = computed(() => [
  86. {
  87. name: "AIchat",
  88. label: "夺宝奇兵大模型",
  89. },
  90. // {
  91. // name: "AIfind",
  92. // label: "发现",
  93. // },
  94. {
  95. name: "AiEmotion",
  96. label: "AI情绪大模型",
  97. },
  98. ]);
  99. // 修改 setActiveTab 方法,添加一个可选参数 forceAIchat
  100. const setActiveTab = (tab, index, forceAIchat = false) => {
  101. isScrolling.value = false; //回复滚动到底部方法
  102. isAnnouncementVisible.value = false;
  103. // 重置输入框禁用状态,防止页面切换时状态残留
  104. console.log("tab", tab, "index", index);
  105. if (tab == "AIchat") {
  106. isInputDisabled.value = chatStore.chatInput;
  107. console.log("切换到AIchat页面,输入框状态为", isInputDisabled.value);
  108. } else if (tab == "AiEmotion") {
  109. isInputDisabled.value = chatStore.emotionInput;
  110. console.log("切换到AiEmotion页面,输入框状态为", isInputDisabled.value);
  111. } else {
  112. isInputDisabled.value = false;
  113. }
  114. if (forceAIchat && activeTab.value !== "AIchat") {
  115. activeTab.value = "AIchat";
  116. activeIndex.value = 0;
  117. sessionStorage.setItem("activeTabAI", "AIchat");
  118. sessionStorage.setItem("activeIndexAI", "0");
  119. } else {
  120. activeTab.value = tab;
  121. activeIndex.value = index;
  122. sessionStorage.setItem("activeTabAI", tab);
  123. sessionStorage.setItem("activeIndexAI", index.toString());
  124. }
  125. setActiveTabIndex(index);
  126. console.log(tab, index, "tab, index");
  127. setHeight(document.getElementById("testId")); // 给父组件发送窗口高度
  128. };
  129. // 修改 activeComponent 的计算逻辑
  130. const activeComponent = computed(() => {
  131. if (activeTab.value === "AIchat") {
  132. return AIchat;
  133. } else if (activeTab.value === "AIfind") {
  134. return AIfind;
  135. } else if (activeTab.value === "AiEmotion") {
  136. return AiEmotion; // 新增逻辑
  137. }
  138. });
  139. const activeTwoTab = computed(() => {
  140. if (isAnnouncementVisible.value) {
  141. return Announcement;
  142. } else {
  143. return Feedback;
  144. }
  145. });
  146. // 新增一个方法,调用时先判断是否处于 AIchat,若不在则跳转到 AIchat
  147. const ensureAIchat = () => {
  148. setActiveTab("AIchat", 0, true);
  149. };
  150. // 获取次数
  151. const UserCount = computed(() => chatStore.UserCount);
  152. const getCount = () => {
  153. console.log("点击了获取次数的按钮");
  154. };
  155. // 深度思考
  156. const isThinking = ref(true);
  157. const toggleThink = () => {
  158. isThinking.value = !isThinking.value;
  159. };
  160. // 发送消息
  161. const message = ref("");
  162. // 传输对象
  163. const messages = ref([]);
  164. // 信息加载状态
  165. const isLoading = computed(() => {
  166. chatStore.isLoading;
  167. });
  168. // 输入框禁用状态
  169. const isInputDisabled = ref(false);
  170. // 添加用户消息
  171. const updateMessage = (title) => {
  172. message.value = title;
  173. console.log("updateMessage 的值:", title);
  174. };
  175. watch(
  176. () => chatStore.announcementMsg,
  177. (newVal) => {
  178. console.log("监听到公告改变", chatStore.announcementMsg);
  179. if (chatStore.announcementMsg && !isInputDisabled.value) {
  180. message.value = chatStore.announcementMsg;
  181. chatStore.announcementMsg = null;
  182. }
  183. }
  184. );
  185. watch(
  186. () => dataStore.isFeedback,
  187. async (newVal) => {
  188. if (!dataStore.isFeedback) {
  189. // 重置公告页面显示状态
  190. isAnnouncementVisible.value = false;
  191. await nextTick();
  192. // 监听页面高度
  193. throttledHeightListener();
  194. }
  195. }
  196. );
  197. watch(
  198. () => chatStore.chatInput,
  199. async (newVal) => {
  200. if (activeTab.value == "AIchat") {
  201. isInputDisabled.value = chatStore.chatInput;
  202. }
  203. }
  204. );
  205. watch(
  206. () => chatStore.emotionInput,
  207. async (newVal) => {
  208. if (activeTab.value == "AiEmotion") {
  209. isInputDisabled.value = chatStore.emotionInput;
  210. }
  211. }
  212. );
  213. const sendMessage = async () => {
  214. if (
  215. localStorage.getItem("localToken") == null ||
  216. localStorage.getItem("localToken") == ""
  217. ) {
  218. ElMessage.error("请先登录");
  219. return;
  220. }
  221. // 检查输入内容是否为空
  222. if (!message.value || !message.value.trim()) {
  223. ElMessage.warning("输入内容不能为空");
  224. return;
  225. }
  226. isScrolling.value = false;
  227. // 注意:历史记录会在消息发送后自动更新,无需手动添加
  228. // 取消历史记录选中状态
  229. if (historyRecordRef) {
  230. historyRecordRef.value.selectedRecordId = null;
  231. }
  232. // 判断当前是否为 AiEmotion 组件
  233. if (activeTab.value === "AiEmotion") {
  234. // 禁用输入框
  235. isInputDisabled.value = true;
  236. chatStore.emotionInput = true;
  237. // 调用 AiEmotion 组件的 handleSendMessage 方法
  238. aiEmotionRef.value?.handleSendMessage(message.value, () => {
  239. // 打字机效果完成后的回调,重新启用输入框
  240. isInputDisabled.value = false;
  241. chatStore.emotionInput = false;
  242. });
  243. message.value = ""; // 清空输入框
  244. return;
  245. }
  246. // 调用 ensureAIchat 确保跳转到 AIchat 页面
  247. ensureAIchat();
  248. if (isInputDisabled.value) return;
  249. isInputDisabled.value = true;
  250. chatStore.chatInput = true;
  251. const messageContent = message.value;
  252. // 重置消息输入框
  253. message.value = "";
  254. setTimeout(() => {
  255. console.log("延时后添加消息", messageContent);
  256. // 发送消息时,设置 isLoading 为 true
  257. messages.value = [
  258. ...messages.value,
  259. {
  260. sender: "user",
  261. content: messageContent,
  262. audioArray: [],
  263. audioStatus: false,
  264. },
  265. ];
  266. console.log(messages.value, "messages.value");
  267. }, 200);
  268. };
  269. // 重新启用输入框的方法
  270. const enableInput = () => {
  271. console.log("解除禁用");
  272. isInputDisabled.value = false;
  273. };
  274. // 处理历史记录选择
  275. const handleHistorySelect = (stockData) => {
  276. console.log("接收到历史记录数据:", stockData);
  277. // 如果当前不在AiEmotion页面,切换到AiEmotion页面
  278. // if (activeTab.value !== 'AiEmotion') {
  279. // setActiveTab('AiEmotion', 1);
  280. // }
  281. // 等待组件渲染完成后调用addStock方法
  282. nextTick(() => {
  283. if (aiEmotionRef.value && aiEmotionRef.value.addStock) {
  284. aiEmotionRef.value.addStock(stockData);
  285. } else {
  286. console.error("AiEmotion组件或addStock方法不可用");
  287. }
  288. });
  289. };
  290. // 公告
  291. // 新增一个变量来控制是否显示公告页面
  292. const isAnnouncementVisible = ref(false);
  293. const showAnnouncement = async () => {
  294. console.log("打开公告");
  295. dataStore.isFeedback = true; // 显示用户反馈页面
  296. isScrolling.value = false; //回复滚动到底部方法
  297. isAnnouncementVisible.value = true; // 显示公告页面
  298. if (isMobile.value) {
  299. if (historyRecordRef) {
  300. historyRecordRef.value.isCollapsed = true;
  301. }
  302. }
  303. };
  304. // 跳转用户反馈
  305. const showFeedback = () => {
  306. console.log("打开用户反馈");
  307. dataStore.isFeedback = true; // 显示用户反馈页面
  308. isAnnouncementVisible.value = false; // 显示反馈页面
  309. if (isMobile.value) {
  310. if (historyRecordRef) {
  311. historyRecordRef.value.isCollapsed = true;
  312. }
  313. }
  314. };
  315. // 保证发送消息时,滚动屏在底部
  316. const tabContentAIchat = ref(null);
  317. const tabContentAiEmotion = ref(null);
  318. const isScrolling = ref(false); //判断用户是否在滚动
  319. // AiEmotion页面高度监听器相关变量
  320. const aiEmotionHeightObserver = ref(null);
  321. const isAiEmotionAutoScrollEnabled = ref(false);
  322. const isAiEmotionUserScrolling = ref(false); // 用户是否正在手动滚动
  323. const aiEmotionScrollTimer = ref(null); // 滚动检测定时器
  324. const isChartInteracting = ref(false); // 图表是否正在交互
  325. const chartInteractionTimer = ref(null); // 图表交互检测定时器
  326. // 获取当前活动页面的滚动容器
  327. const getCurrentScrollContainer = () => {
  328. if (activeTab.value === "AIchat") {
  329. return tabContentAIchat.value;
  330. } else if (activeTab.value === "AiEmotion") {
  331. return tabContentAiEmotion.value;
  332. }
  333. return null;
  334. };
  335. const smoothScrollToBottom = async () => {
  336. // console.log("调用滚动到底部的方法");
  337. // await nextTick();
  338. const container = getCurrentScrollContainer();
  339. // console.log(container, 'container')
  340. // console.log(isScrolling.value, 'isScrolling.value')
  341. if (!container) return;
  342. await nextTick(); // 确保在DOM更新后执行
  343. if (!isScrolling.value) {
  344. container.scrollTop = container.scrollHeight - container.offsetHeight;
  345. // container.scrollTop = container.scrollHeight;
  346. // container.scrollTop = container.offsetHeight;
  347. // container.scrollTop = container.scrollHeight + container.offsetHeight;
  348. // console.log(container.scrollHeight, container.offsetHeight, container.scrollHeight - container.offsetHeight, container.scrollTop, "总长度", "可视长度", "位置")
  349. }
  350. };
  351. const throttledSmoothScrollToBottom = _.throttle(smoothScrollToBottom, 300, {
  352. trailing: false,
  353. });
  354. // AiEmotion页面自动滚动到底部的防抖函数
  355. const debouncedAiEmotionScrollToBottom = _.debounce(() => {
  356. if (
  357. activeTab.value === "AiEmotion" &&
  358. isAiEmotionAutoScrollEnabled.value &&
  359. !isAiEmotionUserScrolling.value &&
  360. !isChartInteracting.value
  361. ) {
  362. const container = tabContentAiEmotion.value;
  363. if (container) {
  364. container.scrollTop = container.scrollHeight - container.offsetHeight;
  365. }
  366. }
  367. }, 150);
  368. // 启动AiEmotion页面高度监听器
  369. const startAiEmotionHeightObserver = () => {
  370. // 先停止之前的监听器
  371. stopAiEmotionHeightObserver();
  372. isAiEmotionAutoScrollEnabled.value = true;
  373. // 创建ResizeObserver监听页面内容变化
  374. aiEmotionHeightObserver.value = new ResizeObserver((entries) => {
  375. if (
  376. isAiEmotionAutoScrollEnabled.value &&
  377. activeTab.value === "AiEmotion" &&
  378. !isChartInteracting.value
  379. ) {
  380. debouncedAiEmotionScrollToBottom();
  381. }
  382. });
  383. // 监听document.body的尺寸变化
  384. if (document.body) {
  385. aiEmotionHeightObserver.value.observe(document.body);
  386. }
  387. // 创建MutationObserver监听DOM结构变化
  388. const mutationObserver = new MutationObserver((mutations) => {
  389. let shouldScroll = false;
  390. mutations.forEach((mutation) => {
  391. if (mutation.type === "childList" && mutation.addedNodes.length > 0) {
  392. // 检查新增的节点是否包含实际内容
  393. const hasContent = Array.from(mutation.addedNodes).some((node) => {
  394. if (node.nodeType === Node.ELEMENT_NODE) {
  395. return node.offsetHeight > 0 || node.scrollHeight > 0;
  396. }
  397. return (
  398. node.nodeType === Node.TEXT_NODE &&
  399. node.textContent.trim().length > 0
  400. );
  401. });
  402. if (hasContent) {
  403. shouldScroll = true;
  404. }
  405. }
  406. });
  407. if (
  408. shouldScroll &&
  409. isAiEmotionAutoScrollEnabled.value &&
  410. activeTab.value === "AiEmotion" &&
  411. !isChartInteracting.value
  412. ) {
  413. debouncedAiEmotionScrollToBottom();
  414. }
  415. });
  416. // 监听AiEmotion页面的主要内容区域的DOM变化
  417. const aiEmotionContainer = tabContentAiEmotion.value;
  418. if (aiEmotionContainer) {
  419. mutationObserver.observe(aiEmotionContainer, {
  420. childList: true,
  421. subtree: true,
  422. attributes: false,
  423. characterData: true,
  424. });
  425. }
  426. // 保存mutationObserver引用以便清理
  427. aiEmotionHeightObserver.value.mutationObserver = mutationObserver;
  428. // 为AiEmotion页面的滚动容器添加滚动事件监听器
  429. if (aiEmotionContainer) {
  430. aiEmotionContainer.addEventListener("scroll", handleAiEmotionUserScroll, {
  431. passive: true,
  432. });
  433. // 保存滚动事件监听器引用以便清理
  434. aiEmotionHeightObserver.value.scrollListener = handleAiEmotionUserScroll;
  435. }
  436. console.log("AiEmotion页面高度监听器已启动");
  437. };
  438. // AiEmotion页面用户滚动检测
  439. const handleAiEmotionUserScroll = () => {
  440. // 标记用户正在滚动
  441. isAiEmotionUserScrolling.value = true;
  442. // 清除之前的定时器
  443. if (aiEmotionScrollTimer.value) {
  444. clearTimeout(aiEmotionScrollTimer.value);
  445. }
  446. // 设置定时器,2秒后恢复自动滚动
  447. // aiEmotionScrollTimer.value = setTimeout(() => {
  448. // isAiEmotionUserScrolling.value = false;
  449. // console.log("AiEmotion页面用户滚动检测:恢复自动滚动");
  450. // }, 2000);
  451. };
  452. // 图表交互状态管理
  453. const handleChartInteractionStart = () => {
  454. console.log("图表交互开始,临时禁用自动滚动");
  455. isChartInteracting.value = true;
  456. // 清除之前的定时器
  457. if (chartInteractionTimer.value) {
  458. clearTimeout(chartInteractionTimer.value);
  459. }
  460. };
  461. const handleChartInteractionEnd = () => {
  462. // 清除之前的定时器
  463. if (chartInteractionTimer.value) {
  464. clearTimeout(chartInteractionTimer.value);
  465. }
  466. // 设置定时器,1秒后恢复自动滚动
  467. chartInteractionTimer.value = setTimeout(() => {
  468. isChartInteracting.value = false;
  469. console.log("图表交互结束,恢复自动滚动");
  470. }, 1000);
  471. };
  472. // 暴露图表交互管理函数给全局使用
  473. window.handleChartInteractionStart = handleChartInteractionStart;
  474. window.handleChartInteractionEnd = handleChartInteractionEnd;
  475. // 处理AiEmotion页面的滚动请求
  476. const handleAiEmotionScrollToBottom = () => {
  477. if (activeTab.value === "AiEmotion") {
  478. const container = tabContentAiEmotion.value;
  479. if (container) {
  480. // 使用nextTick确保DOM已更新
  481. nextTick(() => {
  482. container.scrollTop = container.scrollHeight - container.offsetHeight;
  483. console.log("AiEmotion页面:执行容器滚动到底部");
  484. });
  485. }
  486. }
  487. };
  488. // 停止AiEmotion页面高度监听器
  489. const stopAiEmotionHeightObserver = () => {
  490. isAiEmotionAutoScrollEnabled.value = false;
  491. isAiEmotionUserScrolling.value = false;
  492. // 清理滚动检测定时器
  493. if (aiEmotionScrollTimer.value) {
  494. clearTimeout(aiEmotionScrollTimer.value);
  495. aiEmotionScrollTimer.value = null;
  496. }
  497. if (aiEmotionHeightObserver.value) {
  498. // 清理ResizeObserver
  499. aiEmotionHeightObserver.value.disconnect();
  500. // 清理MutationObserver
  501. if (aiEmotionHeightObserver.value.mutationObserver) {
  502. aiEmotionHeightObserver.value.mutationObserver.disconnect();
  503. aiEmotionHeightObserver.value.mutationObserver = null;
  504. }
  505. // 清理滚动事件监听器
  506. if (
  507. aiEmotionHeightObserver.value.scrollListener &&
  508. tabContentAiEmotion.value
  509. ) {
  510. tabContentAiEmotion.value.removeEventListener(
  511. "scroll",
  512. aiEmotionHeightObserver.value.scrollListener
  513. );
  514. aiEmotionHeightObserver.value.scrollListener = null;
  515. }
  516. aiEmotionHeightObserver.value = null;
  517. }
  518. console.log("AiEmotion页面高度监听器已停止");
  519. };
  520. watch(
  521. () => chatStore.messages.length,
  522. () => {
  523. // console.log('messages变化了')
  524. // 只有在AIchat页面时才执行自动滚动
  525. if (activeTab.value === "AIchat") {
  526. throttledSmoothScrollToBottom();
  527. }
  528. // setTimeout(throttledSmoothScrollToBottom, 100);
  529. },
  530. { deep: false, immediate: true }
  531. );
  532. watch(
  533. () => chatStore.dbqbClickRecord,
  534. async (newValue, oldValue) => {
  535. const container = getCurrentScrollContainer();
  536. if (!container) return;
  537. await nextTick(); // 确保在DOM更新后执行
  538. container.scrollTop = 0;
  539. }
  540. );
  541. watch(
  542. activeTab,
  543. async () => {
  544. console.log("activeTab变化了", activeTab.value);
  545. if (activeTab.value == "AIchat" || activeTab.value == "AiEmotion") {
  546. if (historyRecordRef.value && historyRecordRef.value.getHistoryList) {
  547. const result = historyRecordRef.value.getHistoryList({
  548. model: activeTab.value == "AIchat" ? 1 : 2,
  549. token: localStorage.getItem("localToken"),
  550. });
  551. }
  552. }
  553. if (activeTab.value === "AIchat") {
  554. isScrolling.value = false; //回复滚动到底部方法
  555. // 停止AiEmotion页面的高度监听器
  556. stopAiEmotionHeightObserver();
  557. setTimeout(() => {
  558. // throttledSmoothScrollToBottom();
  559. }, 100);
  560. } else if (activeTab.value === "AiEmotion") {
  561. // 启动AiEmotion页面的高度监听器
  562. await nextTick(); // 确保DOM更新后启动监听器
  563. startAiEmotionHeightObserver();
  564. } else {
  565. // 其他页面时停止AiEmotion页面的高度监听器
  566. stopAiEmotionHeightObserver();
  567. }
  568. // AiEmotion页面不执行自动滚动,避免刷新后滚动到底部
  569. // setTimeout(throttledSmoothScrollToBottom, 100);
  570. },
  571. { deep: true, immediate: true }
  572. );
  573. // 获取token的核心函数
  574. const fnGetToken = () => {
  575. // console.log('进入fnGetToken')
  576. window.JWready = (ress) => {
  577. // console.log('进入JWready')
  578. try {
  579. ress = JSON.parse(ress);
  580. // console.log(ress, 'ress')
  581. } catch (error) {
  582. console.log(error, "fnGetToken error");
  583. } //platform为5是app端
  584. // platform.value = ress.data.platform
  585. // 处理平台判断
  586. console.log(ress.data.platform, "ress.data.platform");
  587. if (!ress.data.platform) {
  588. // 非App环境通过URL参数获取
  589. localStorage.setItem(
  590. "localToken",
  591. decodeURIComponent(String(getQueryVariable("token")))
  592. );
  593. // localStorage.setItem('localToken', "+SsksARQgUHIbIG3rRnnbZi0+fEeMx8pywnIlrmTxo5EOPR/wjWDV7w7+ZUseiBtf9kFa/atmNx6QfSpv5w")
  594. } else {
  595. // App环境通过桥接获取
  596. useAppBridge().packageFun(
  597. "JWgetStorage",
  598. (response) => {
  599. const res = JSON.parse(response); // 解析返回的结果
  600. localStorage.setItem("localToken", res.data);
  601. // localStorage.setItem('localToken', "+SsksARQgUHIbIG3rRnnbZi0+fEeMx8pywnIlrmTxo5EOPR/wjWDV7w7+ZUseiBtf9kFa/atmNx6QfSpv5w")
  602. },
  603. 5,
  604. {
  605. key: "token",
  606. }
  607. );
  608. }
  609. };
  610. // console.log('出来了')
  611. // 触发App桥接
  612. useAppBridge().packageFun("JWwebReady", () => {}, 5, {});
  613. };
  614. // 在setTimeout中延迟执行
  615. setTimeout(() => {
  616. fnGetToken();
  617. }, 800);
  618. const heightListener = () => {
  619. const tabContainer = getCurrentScrollContainer();
  620. if (!tabContainer) return;
  621. let befortop = 0;
  622. const scrollHandler = () => {
  623. const aftertop = tabContainer.scrollTop;
  624. // 新增底部判断逻辑
  625. const isBottom =
  626. aftertop + tabContainer.offsetHeight + 70 >= tabContainer.scrollHeight;
  627. if (activeTab.value === "AIchat") {
  628. if (aftertop - befortop > 0) {
  629. // console.log("向下滚动");
  630. isScrolling.value = true;
  631. } else {
  632. // console.log("向上滚动");
  633. isScrolling.value = true;
  634. }
  635. // 添加底部状态检测
  636. if (isBottom) {
  637. // console.log("滚动到底部");
  638. isScrolling.value = false;
  639. }
  640. }
  641. befortop = aftertop;
  642. };
  643. // console.log(isScrolling.value, 'isScrolling.value')
  644. tabContainer.addEventListener("scroll", scrollHandler);
  645. };
  646. const throttledHeightListener = _.throttle(heightListener, 500, {
  647. trailing: false,
  648. });
  649. // const goToRecharge = () => {
  650. // console.log("点击充值");
  651. // // http://39.101.133.168:8919/payment/recharge/index?
  652. // // url=http%3A%2F%2Flocalhost%3A8080%2FLiveActivity%2Fpck
  653. // // &platform=1
  654. // // &token=+S4h5QEE1hTIb4CxphrnbZi0+fEeMx8pywnIlrmTmo4QO6IolWnVWu5r+J4rKXMwK41UPfKqyIp+RvWmtM8
  655. // const userAgent = navigator.userAgent.toLowerCase();
  656. // const mobileKeywords = ["mobile", "android", "iphone", "ipad", "ipod"];
  657. // const isMobile = mobileKeywords.some((keyword) =>
  658. // userAgent.includes(keyword)
  659. // );
  660. // console.log(isMobile ? "手机" : "电脑");
  661. // const url = encodeURI("http://39.101.133.168:8857/aixiaocaishen/homePage");
  662. // console.log(url, "url");
  663. // const platform = isMobile ? 2 : 1;
  664. // const token = encodeURIComponent(localStorage.getItem("localToken"));
  665. // console.log(token, "token");
  666. // const rechargeUrl =
  667. // "http://39.101.133.168:8919/payment/recharge/index?" +
  668. // "url=" +
  669. // url +
  670. // "&platform=" +
  671. // platform +
  672. // "&token=" +
  673. // token;
  674. // console.log(rechargeUrl, "rechargeUrl");
  675. // window.location.href = rechargeUrl;
  676. // // window.open(rechargeUrl)
  677. // };
  678. const adjustFooterPosition = (height) => {
  679. const html = document.querySelector("html");
  680. const body = document.querySelector("body");
  681. const isAndroid = /Android/i.test(navigator.userAgent);
  682. if (isAndroid) {
  683. console.log("是安卓设备");
  684. console.log("window.visualViewport", window.visualViewport.height);
  685. const homePage = document.querySelector(".homepage");
  686. homePage.style.height = `${height}px`;
  687. // homePage.style.height = `460px`;
  688. html.scrollTop = 0;
  689. } else {
  690. console.log("非安卓设备");
  691. console.log("调整底部位置", height);
  692. const homePage = document.querySelector(".homepage");
  693. homePage.style.height = `${height}px`;
  694. html.scrollTop = 0;
  695. }
  696. setTimeout(() => {
  697. // 隐藏滚动条
  698. html.style.overflow = "hidden";
  699. body.style.overflow = "hidden";
  700. }, 200);
  701. };
  702. // 是否正在输入法组合
  703. const inputing = ref(false);
  704. const onFocus = function () {
  705. const visualViewport = window.visualViewport;
  706. // 获取可视区域高度
  707. setTimeout(() => {
  708. console.log("输入框聚焦");
  709. console.log(visualViewport.height, "visualViewport.height");
  710. const keyboardHeight = window.innerHeight - visualViewport.height;
  711. console.log(window.innerHeight, "window.innerHeight");
  712. console.log(keyboardHeight, "keyboardHeight");
  713. adjustFooterPosition(visualViewport.height);
  714. }, 200);
  715. };
  716. const onBlur = function () {
  717. inputing.value = false;
  718. const visualViewport = window.visualViewport;
  719. setTimeout(() => {
  720. console.log("输入框失焦");
  721. const keyboardHeight = window.innerHeight - visualViewport.height;
  722. console.log(window.innerHeight, "window.innerHeight");
  723. console.log(visualViewport.height, "visualViewport.height");
  724. console.log(keyboardHeight, "keyboardHeight");
  725. adjustFooterPosition(visualViewport.height);
  726. }, 200);
  727. };
  728. // window.addEventListener("resize", () => {
  729. // // 检测是否为iOS设备
  730. // const isIOS = /iPhone|iPad|iPod|ios/i.test(navigator.userAgent);
  731. // console.log("是否为iOS设备:", isIOS);
  732. // if (!isIOS) {
  733. // console.log("窗口大小变化");
  734. // const homePage = document.querySelector(".homepage");
  735. // homePage.style.height = `${window.innerHeight}px`;
  736. // }
  737. // });
  738. let touchmoveHandlerRef = null;
  739. const touchmoveHandler = (e) => {
  740. if (!dataStore.isFeedback) {
  741. if (historyRecordRef) {
  742. if (!historyRecordRef.value.isCollapsed) {
  743. return;
  744. }
  745. }
  746. // 判断触摸目标是否在当前活动页面的可滚动区域内
  747. const currentContainer = getCurrentScrollContainer();
  748. const isScrollableArea =
  749. currentContainer && currentContainer.contains(e.target);
  750. // 如果不在可滚动区域,则阻止滚动
  751. if (!isScrollableArea) {
  752. e.preventDefault();
  753. }
  754. }
  755. };
  756. const judgeDevice = async () => {
  757. // 延时300ms
  758. await new Promise((resolve) => setTimeout(resolve, 200));
  759. const userAgent = navigator.userAgent;
  760. isMobile.value =
  761. /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
  762. userAgent
  763. );
  764. console.log("当前设备为:", isMobile.value ? "移动端" : "PC端");
  765. };
  766. const throttledJudgeDevice = _.throttle(judgeDevice, 300, {
  767. trailing: false,
  768. });
  769. const expandHistory = () => {
  770. // if (activeTab.value == "AIchat" || activeTab.value == "AiEmotion") {
  771. // historyRecordRef.value.getHistoryList({
  772. // token: localStorage.getItem("localToken"),
  773. // model: activeTab.value == "AIchat" ? 1 : 2,
  774. // });
  775. // }
  776. if (
  777. historyRecordRef.value &&
  778. historyRecordRef.value.isCollapsed !== undefined
  779. ) {
  780. console.log("存在");
  781. historyRecordRef.value.isCollapsed = !historyRecordRef.value.isCollapsed;
  782. if (activeTab.value == "AIchat") {
  783. chatStore.aiChatCall = true;
  784. } else if (activeTab.value == "AiEmotion") {
  785. chatStore.aiEmotionCall = true;
  786. }
  787. }
  788. };
  789. const backToHome = () => {
  790. if (isMobile.value) {
  791. console.log("用户是移动端");
  792. // 调用原生方法跳转到首页
  793. uni.postMessage({
  794. data: {
  795. val: {
  796. name: "JWopenView",
  797. extra: {
  798. data: {
  799. type: 3,
  800. },
  801. },
  802. },
  803. },
  804. });
  805. } else {
  806. console.log("用户是pc端");
  807. const env = import.meta.env.VITE_ENV;
  808. console.log("当前的环境为:", env);
  809. if (env == "development" || env == "test") {
  810. window.parent.location.href =
  811. "http://121.89.234.155:8807/hljw/homepage?menu=999999991";
  812. } else {
  813. window.parent.postMessage(
  814. {
  815. type: "NAVIGATE_TO_HOMEPAGE",
  816. menu: "999999991",
  817. },
  818. "*"
  819. );
  820. }
  821. // window.parent.location.href = window.parent.document.referrer
  822. }
  823. };
  824. // 8.18金币兑换Token start
  825. const userInfo = ref({
  826. nickname: "",
  827. img: "",
  828. jwcode: "",
  829. });
  830. const changeRule = ref({
  831. gold: 1,
  832. token: 1,
  833. });
  834. const changeLevelList = ref([
  835. { position: 10, calculatedPosition: 10 },
  836. { position: 20, calculatedPosition: 20 },
  837. { position: 50, calculatedPosition: 50 },
  838. { position: 100, calculatedPosition: 100 },
  839. { position: 200, calculatedPosition: 200 },
  840. { position: 500, calculatedPosition: 500 },
  841. { position: 1000, calculatedPosition: 1000 },
  842. ]);
  843. const activeLevel = ref(
  844. changeLevelList.value[0] || { position: 10, calculatedPosition: 10 }
  845. );
  846. const gold = ref(90);
  847. // 点击剩余次数会弹出的弹窗
  848. // 新增一个 ref 来控制弹窗的显示与隐藏
  849. const dialogVisible = ref(false);
  850. const rechargeDialogVisible = ref(false);
  851. const confirmDialogVisible = ref(false);
  852. const changeSuccessDialogVisible = ref(false);
  853. // 图片加载错误处理
  854. const handleImageError = (event) => {
  855. console.error("图片加载失败:", event.target.src);
  856. // 可以设置默认图片或重试逻辑
  857. event.target.src =
  858. "https://cdn.legu168.com/jtzy/Product/pcjingwang/images/userimg.png";
  859. };
  860. // 获取次数
  861. const showCount = async () => {
  862. try {
  863. if (
  864. !dataStore.userInfo.img ||
  865. !dataStore.userInfo.nickname ||
  866. !dataStore.userInfo.jwcode
  867. ) {
  868. console.log("缺少用户信息,调用方法");
  869. await getUserInfo();
  870. }
  871. userInfo.value.nickname = dataStore.userInfo.nickname;
  872. userInfo.value.img = dataStore.userInfo.img;
  873. userInfo.value.jwcode = dataStore.userInfo.jwcode;
  874. console.log("userInfo", userInfo.value);
  875. const [res, res2] = await Promise.all([
  876. showExchangeAPI(),
  877. getGoldCoinAPI({
  878. token: String(localStorage.getItem("localToken")),
  879. }),
  880. ]);
  881. changeLevelList.value = res.data;
  882. activeLevel.value = changeLevelList.value[0];
  883. changeRule.value.token = res.data[0].ratio;
  884. gold.value = res2.data.total;
  885. // 显示弹窗
  886. dialogVisible.value = true;
  887. console.log("dialogVisible 的值:", dialogVisible.value); // 添加日志确认
  888. } catch (e) {
  889. console.error("获取兑换列表出错", e);
  890. }
  891. };
  892. const chooseLevel = (item) => {
  893. activeLevel.value = item;
  894. };
  895. const changeToken = () => {
  896. if (gold.value < activeLevel.value.position) {
  897. rechargeDialogVisible.value = true;
  898. return;
  899. } else {
  900. confirmDialogVisible.value = true;
  901. }
  902. };
  903. const goRecharge = () => {
  904. console.log("执行前往充值方法");
  905. sessionStorage.setItem("rechargeFlag", "1");
  906. sessionStorage.setItem("activeLevel", JSON.stringify(activeLevel.value));
  907. if (isMobile.value) {
  908. console.log("用户是移动端");
  909. uni.postMessage({
  910. data: {
  911. val: {
  912. name: "JWopenView",
  913. extra: {
  914. data: {
  915. type: 4,
  916. },
  917. },
  918. },
  919. },
  920. });
  921. } else {
  922. console.log("用户是pc端");
  923. const env = import.meta.env.VITE_ENV;
  924. console.log("当前的环境为:", env);
  925. if (env == "development" || env == "test") {
  926. window.parent.location.href =
  927. "http://121.89.234.155:8807/user/myGold?token=" +
  928. encodeURIComponent(localStorage.getItem("localToken")) +
  929. "&where=xiaocaishen&successUrl=https://hwjb.homilychart.com/aixiaocaishen/homePage";
  930. // "&where=xiaocaishen&successUrl=http://192.168.1.5:3000/aixiaocaishen/homePage";
  931. } else {
  932. window.parent.location.href =
  933. "https://web.homilychart.com/user/myGold?token=" +
  934. encodeURIComponent(localStorage.getItem("localToken")) +
  935. "&where=xiaocaishen&successUrl=https://mp.homilychart.com/aixiaocaishen/homePage";
  936. }
  937. // window.parent.location.href = window.parent.document.referrer
  938. }
  939. };
  940. const goChange = async () => {
  941. try {
  942. await exchangeAPI({
  943. token: String(localStorage.getItem("localToken")),
  944. num: activeLevel.value.position,
  945. });
  946. confirmDialogVisible.value = false;
  947. dialogVisible.value = false;
  948. changeSuccessDialogVisible.value = true;
  949. setTimeout(() => {
  950. changeSuccessDialogVisible.value = false;
  951. }, 2000);
  952. // 刷新次数
  953. await chatStore.getUserCount();
  954. } catch (e) {
  955. console.error("兑换失败", e);
  956. }
  957. };
  958. // 8.18金币兑换Token end
  959. onMounted(async () => {
  960. throttledJudgeDevice();
  961. // 禁用全局触摸滚动
  962. touchmoveHandlerRef = touchmoveHandler;
  963. document.addEventListener("touchmove", touchmoveHandlerRef, {
  964. passive: false,
  965. });
  966. setHeight(document.getElementById("testId")); // 给父组件发送窗口高度
  967. // 获取次数
  968. await chatStore.getUserCount();
  969. // 滚动到底部
  970. throttledSmoothScrollToBottom();
  971. // 监听页面高度
  972. throttledHeightListener();
  973. // 添加输入框焦点处理
  974. // handleInputFocus();
  975. // 初始化视口高度变量
  976. // updateAppHeight();
  977. // 添加原生事件监听器
  978. window.addEventListener("resize", throttledJudgeDevice);
  979. window.receiveUniAppMessage = async function (messageData) {
  980. console.log("收到 uni-app 消息:", messageData);
  981. // 根据消息类型进行不同处理
  982. switch (messageData.type) {
  983. case "paymentSuccess":
  984. // 处理支付成功消息
  985. const [res1, res2] = await Promise.all([
  986. godExchangeAPI({ state: 1 }),
  987. getGoldCoinAPI({ token: String(localStorage.getItem("localToken")) }),
  988. ]);
  989. gold.value = res2.data.total;
  990. rechargeDialogVisible.value = false;
  991. break;
  992. default:
  993. console.log("未知消息类型:", messageData.type);
  994. }
  995. };
  996. if (
  997. sessionStorage.getItem("rechargeFlag") == "1" &&
  998. getQueryVariable("successType") == "success"
  999. ) {
  1000. await godExchangeAPI({ state: 1 });
  1001. await showCount();
  1002. activeLevel.value =
  1003. JSON.parse(sessionStorage.getItem("activeLevel")) ||
  1004. changeLevelList.value[0];
  1005. console.log("activeLevel", activeLevel.value);
  1006. sessionStorage.removeItem("activeLevel");
  1007. sessionStorage.setItem("rechargeFlag", "0");
  1008. }
  1009. });
  1010. onUnmounted(() => {
  1011. window.removeEventListener("resize", throttledJudgeDevice);
  1012. if (touchmoveHandlerRef) {
  1013. console.log("卸载touchmoveHandlerRef组件");
  1014. document.removeEventListener("touchmove", touchmoveHandlerRef);
  1015. }
  1016. // 清理AiEmotion页面的高度监听器
  1017. stopAiEmotionHeightObserver();
  1018. delete window.receiveUniAppMessage;
  1019. // 清理图表交互相关的定时器和全局函数
  1020. if (chartInteractionTimer.value) {
  1021. clearTimeout(chartInteractionTimer.value);
  1022. }
  1023. if (window.handleChartInteractionStart) {
  1024. delete window.handleChartInteractionStart;
  1025. }
  1026. if (window.handleChartInteractionEnd) {
  1027. delete window.handleChartInteractionEnd;
  1028. }
  1029. });
  1030. </script>
  1031. <template>
  1032. <div class="homepage" id="testId">
  1033. <!-- 历史记录组件 -->
  1034. <HistoryRecord
  1035. ref="historyRecordRef"
  1036. :current-type="activeTab"
  1037. @selectRecord="handleHistorySelect"
  1038. :isMobile="isMobile"
  1039. @showAnnouncement="showAnnouncement"
  1040. @showFeedback="showFeedback"
  1041. />
  1042. <div
  1043. v-if="isMobile && !historyRecordRef?.isCollapsed"
  1044. class="zhezhao"
  1045. @click="expandHistory"
  1046. ></div>
  1047. <el-container
  1048. v-if="!dataStore.isFeedback"
  1049. class="main-container"
  1050. :class="{
  1051. collapsed: historyRecordRef?.isCollapsed && !isMobile,
  1052. unCollapsed: !historyRecordRef?.isCollapsed && !isMobile,
  1053. }"
  1054. >
  1055. <!-- AI小财神头部 logo 次数 公告 -->
  1056. <el-header class="homepage-head">
  1057. <!-- logo -->
  1058. <div class="homepage-logo" v-if="isMobile">
  1059. <img
  1060. class="expand"
  1061. @click="expandHistory"
  1062. src="https://d31zlh4on95l9h.cloudfront.net/images/37fe3d79a8a700f6c674c9f0e7af066b.png"
  1063. alt="icon"
  1064. />
  1065. <img :src="logo" alt="图片加载失败" class="logo1" />
  1066. <!-- <img :src="madeInHL" alt="图片加载失败" class="logo2" /> -->
  1067. </div>
  1068. <div class="homepage-right-group" v-if="isMobile">
  1069. <div class="count-badge" @click="showCount">
  1070. <img
  1071. src="https://d31zlh4on95l9h.cloudfront.net/images/74e20c65c9ef2526477c63ad68698a50.png"
  1072. class="action-btn"
  1073. />
  1074. <div class="count-number">{{ UserCount }}</div>
  1075. <div class="clickGetCount">点击获取Token</div>
  1076. </div>
  1077. <div class="backToHomeBtn" @click="backToHome()">
  1078. <img
  1079. src="https://d31zlh4on95l9h.cloudfront.net/images/9cbc5b2eb2327bd04d015c19d8c3f1f9.png"
  1080. alt="返回首页"
  1081. class="backImg"
  1082. />
  1083. <div class="backContent">返回首页</div>
  1084. </div>
  1085. <!-- <img
  1086. :src="announcementBtn"
  1087. class="announcement-btn action-btn"
  1088. @click="showAnnouncement"
  1089. />
  1090. <img
  1091. :src="feedbackBtn"
  1092. class="announcement-btn action-btn"
  1093. @click="showFeedback"
  1094. /> -->
  1095. </div>
  1096. </el-header>
  1097. <!-- 主体部分小人 问题轮询图 对话内容 -->
  1098. <el-main class="homepage-body">
  1099. <div class="main-wrapper">
  1100. <section class="tab-section">
  1101. <div
  1102. class="tab-container"
  1103. :class="{
  1104. pcTabContainer: !isMobile,
  1105. }"
  1106. >
  1107. <div
  1108. v-for="(tab, index) in tabs"
  1109. :key="tab.name"
  1110. @click="setActiveTab(tab.name, index)"
  1111. :class="[
  1112. 'tab-item',
  1113. { active: activeIndex === index && !isAnnouncementVisible },
  1114. ]"
  1115. >
  1116. <span>{{ tab.label }}</span>
  1117. </div>
  1118. <div v-if="!isMobile" class="pc-count-badge">
  1119. <div class="pc-countBtn" @click="showCount">
  1120. <div class="pc-action-btn">
  1121. <div class="pc-count-number">{{ UserCount }}</div>
  1122. </div>
  1123. <div class="pc-clickGetCount">点击获取Token</div>
  1124. </div>
  1125. <div class="pc-backToHomeBtn" @click="backToHome()">
  1126. <img
  1127. src="https://d31zlh4on95l9h.cloudfront.net/images/9cbc5b2eb2327bd04d015c19d8c3f1f9.png"
  1128. alt="返回首页"
  1129. class="pc-backImg"
  1130. />
  1131. <div class="pc-backContent">返回首页</div>
  1132. </div>
  1133. </div>
  1134. </div>
  1135. </section>
  1136. <!-- AIchat页面的独立滚动容器 -->
  1137. <div
  1138. v-show="activeTab === 'AIchat'"
  1139. class="tab-content"
  1140. :class="{
  1141. pcTabContent: !isMobile,
  1142. }"
  1143. ref="tabContentAIchat"
  1144. >
  1145. <component
  1146. v-if="activeTab === 'AIchat'"
  1147. :is="activeComponent"
  1148. :messages="messages"
  1149. @updateMessage="updateMessage"
  1150. @sendMessage="sendMessage"
  1151. @ensureAIchat="ensureAIchat"
  1152. @enableInput="enableInput"
  1153. />
  1154. </div>
  1155. <!-- AiEmotion页面的独立滚动容器 -->
  1156. <div
  1157. v-show="activeTab === 'AiEmotion'"
  1158. class="tab-content"
  1159. :class="{
  1160. pcTabContent: !isMobile,
  1161. }"
  1162. ref="tabContentAiEmotion"
  1163. >
  1164. <component
  1165. v-if="activeTab === 'AiEmotion'"
  1166. :is="activeComponent"
  1167. :messages="messages"
  1168. @updateMessage="updateMessage"
  1169. @sendMessage="sendMessage"
  1170. @ensureAIchat="ensureAIchat"
  1171. @enableInput="enableInput"
  1172. @scrollToBottom="handleAiEmotionScrollToBottom"
  1173. ref="aiEmotionRef"
  1174. />
  1175. </div>
  1176. </div>
  1177. </el-main>
  1178. <!-- 尾部 问题输入框 深度思考 多语言 语音播报 -->
  1179. <el-footer
  1180. class="homepage-footer"
  1181. :class="{
  1182. pcFooter: !isMobile,
  1183. }"
  1184. id="input"
  1185. >
  1186. <!-- 第一行按钮 -->
  1187. <div class="footer-first-line">
  1188. <div class="left-group">
  1189. <!-- <img v-if="isThinking" :src="thinkActive" @click="toggleThink" class="action-btn" />
  1190. <img v-else :src="thinkNoActive" @click="toggleThink" class="action-btn" />
  1191. <img :src="languageBtn" @click="changeLanguage" class="action-btn" /> -->
  1192. <!-- 夺宝奇兵大模型按钮 -->
  1193. <img
  1194. :src="activeTab === 'AIchat' ? dbqbButton01 : dbqbButton02"
  1195. @click="setActiveTab('AIchat', 0)"
  1196. class="action-btn model-btn"
  1197. alt="夺宝奇兵大模型"
  1198. />
  1199. <!-- AI情绪大模型按钮 -->
  1200. <img
  1201. :src="
  1202. activeTab === 'AiEmotion' ? emotionButton01 : emotionButton02
  1203. "
  1204. @click="setActiveTab('AiEmotion', 1)"
  1205. class="action-btn model-btn"
  1206. alt="AI情绪大模型"
  1207. />
  1208. <!-- <img v-if="
  1209. getCurrentAudioStore().isVoiceEnabled &&
  1210. getCurrentAudioStore().isPlaying
  1211. " :src="voice" @click="toggleVoice" class="action-btn" style="animation: pulse 1.5s infinite" />
  1212. <img v-else-if="
  1213. getCurrentAudioStore().isVoiceEnabled &&
  1214. !getCurrentAudioStore().isPlaying
  1215. " :src="voiceNoActive" @click="toggleVoice" class="action-btn" />
  1216. <img v-else :src="voiceNoActive" @click="toggleVoice" class="action-btn" /> -->
  1217. </div>
  1218. </div>
  1219. <!-- 第二行输入框 -->
  1220. <div class="footer-second-line">
  1221. <!-- <img :src="msgBtn" class="msg-icon" /> -->
  1222. <div class="input-container">
  1223. <el-input
  1224. type="textarea"
  1225. v-model="message"
  1226. @focus="onFocus"
  1227. @blur="onBlur"
  1228. :autosize="{ minRows: 1, maxRows: 4 }"
  1229. class="msg-input"
  1230. @keydown.enter.exact.prevent="
  1231. isLoading || isInputDisabled ? null : sendMessage()
  1232. "
  1233. :disabled="isInputDisabled"
  1234. resize="none"
  1235. :class="{ input: !message && !inputing }"
  1236. @compositionstart="inputing = true"
  1237. @compositionend="inputing = false"
  1238. >
  1239. </el-input>
  1240. <img
  1241. :src="
  1242. isInputDisabled
  1243. ? 'https://d31zlh4on95l9h.cloudfront.net/images/aa192bcbc1682c97e1bc6fb422f2afff.png'
  1244. : 'https://d31zlh4on95l9h.cloudfront.net/images/e6ec2ae238ced85b74e0912e988f243e.png'
  1245. "
  1246. @click="sendMessage"
  1247. class="action-btn send-btn-inner"
  1248. :style="{
  1249. opacity: isInputDisabled ? 0.5 : 1,
  1250. cursor: isInputDisabled ? 'not-allowed' : 'pointer',
  1251. }"
  1252. />
  1253. </div>
  1254. </div>
  1255. </el-footer>
  1256. </el-container>
  1257. <el-container
  1258. v-else
  1259. class="main-container"
  1260. :class="{
  1261. collapsed: historyRecordRef?.isCollapsed && !isMobile,
  1262. unCollapsed: !historyRecordRef?.isCollapsed && !isMobile,
  1263. }"
  1264. >
  1265. <el-header class="homepage-head">
  1266. <!-- logo -->
  1267. <!-- <div class="homepage-logo">
  1268. <img :src="logo" alt="图片加载失败" class="logo1" />
  1269. <img :src="madeInHL" alt="图片加载失败" class="logo2" />
  1270. </div> -->
  1271. <div class="homepage-right-group">
  1272. <div class="count-badge" @click="showCount">
  1273. <img
  1274. src="https://d31zlh4on95l9h.cloudfront.net/images/74e20c65c9ef2526477c63ad68698a50.png"
  1275. class="action-btn"
  1276. />
  1277. <div class="count-number">{{ UserCount }}</div>
  1278. <div class="clickGetCount">点击获取Token</div>
  1279. </div>
  1280. <div class="backToHomeBtn" @click="backToHome()">
  1281. <img
  1282. src="https://d31zlh4on95l9h.cloudfront.net/images/9cbc5b2eb2327bd04d015c19d8c3f1f9.png"
  1283. alt="返回首页"
  1284. class="backImg"
  1285. />
  1286. <div class="backContent">返回首页</div>
  1287. </div>
  1288. <!-- <img
  1289. :src="announcementBtn"
  1290. class="announcement-btn action-btn"
  1291. @click="showAnnouncement"
  1292. />
  1293. <img
  1294. :src="feedbackBtn"
  1295. class="announcement-btn action-btn"
  1296. @click="showFeedback"
  1297. /> -->
  1298. </div>
  1299. </el-header>
  1300. <!-- 主体部分小人 问题轮询图 对话内容 -->
  1301. <el-main class="homepage-body">
  1302. <component :is="activeTwoTab" />
  1303. </el-main>
  1304. </el-container>
  1305. <!-- 弹窗 -->
  1306. <!-- 新增弹窗组件 -->
  1307. <el-dialog v-if="!isMobile" v-model="dialogVisible" width="48%">
  1308. <!-- 中间内容部分 -->
  1309. <div class="changeMsg">
  1310. <div class="changeInfo">
  1311. <div class="changeImg">
  1312. <img
  1313. :src="userInfo.img"
  1314. alt="头像"
  1315. class="changeImgClass"
  1316. @error="handleImageError"
  1317. />
  1318. </div>
  1319. <div class="changeContent">
  1320. <div class="changeUsername">{{ userInfo.nickname }}</div>
  1321. <div class="changeJwcode">精网号{{ userInfo.jwcode }}</div>
  1322. </div>
  1323. </div>
  1324. <div class="changeRule">
  1325. 兑换规则{{ changeRule.gold }}金币={{ changeRule.token }}Token
  1326. </div>
  1327. </div>
  1328. <div class="changeLevel">
  1329. <div class="changeLevelTitle">兑换Token</div>
  1330. <div class="changeLevelContent">
  1331. <div
  1332. class="changeLevelItems"
  1333. v-for="item in changeLevelList"
  1334. :key="item"
  1335. :class="{
  1336. changeLevelItemsActive: item.position == activeLevel.position,
  1337. }"
  1338. @click="chooseLevel(item)"
  1339. >
  1340. <div class="changeLevelItem">
  1341. <div class="changeLevelItemToken">
  1342. <img
  1343. src="https://d31zlh4on95l9h.cloudfront.net/images/403ef762dd2f335df3b0c9e3fe488375.png"
  1344. alt="token"
  1345. class="changeLevelItemTokenImg"
  1346. />
  1347. {{ item.calculatedPosition }}
  1348. </div>
  1349. <div class="changeLevelItemToken">{{ item.position }} 金币</div>
  1350. </div>
  1351. </div>
  1352. </div>
  1353. </div>
  1354. <div class="changeNow">
  1355. 应付金额
  1356. <div class="changePay">{{ activeLevel.position }}</div>
  1357. (金币余额{{ gold }})
  1358. </div>
  1359. <div class="changeBtn" @click="changeToken">立即兑换</div>
  1360. </el-dialog>
  1361. <el-dialog v-else v-model="dialogVisible" width="80%">
  1362. <!-- 中间内容部分 -->
  1363. <div class="changeMsg">
  1364. <div class="changeInfo">
  1365. <div class="changeImg">
  1366. <img
  1367. :src="userInfo.img"
  1368. alt="头像"
  1369. class="changeImgClass"
  1370. @error="handleImageError"
  1371. />
  1372. </div>
  1373. <div class="changeContent">
  1374. <div class="changeJwcode">精网号{{ userInfo.jwcode }}</div>
  1375. </div>
  1376. </div>
  1377. </div>
  1378. <div class="changeLevel">
  1379. <div class="changeLevelTitle">
  1380. 兑换Token
  1381. <div class="changeRule">
  1382. (兑换规则{{ changeRule.gold }}金币={{ changeRule.token }}Token)
  1383. </div>
  1384. </div>
  1385. <div class="changeLevelContent">
  1386. <div
  1387. class="changeLevelItems"
  1388. v-for="item in changeLevelList"
  1389. :key="item"
  1390. :class="{
  1391. changeLevelItemsActive: item.position == activeLevel.position,
  1392. }"
  1393. @click="chooseLevel(item)"
  1394. >
  1395. <div class="changeLevelItem">
  1396. <div class="changeLevelItemToken">
  1397. <img
  1398. src="https://d31zlh4on95l9h.cloudfront.net/images/403ef762dd2f335df3b0c9e3fe488375.png"
  1399. alt="token"
  1400. class="changeLevelItemTokenImg"
  1401. />
  1402. {{ item.calculatedPosition }}
  1403. </div>
  1404. <div class="changeLevelItemToken">{{ item.position }} 金币</div>
  1405. </div>
  1406. </div>
  1407. </div>
  1408. </div>
  1409. <div class="changeNow">
  1410. 应付金额
  1411. <div class="changePay">{{ activeLevel.position }}</div>
  1412. (金币余额{{ gold }})
  1413. </div>
  1414. <div class="changeBtn" @click="changeToken">立即兑换</div>
  1415. </el-dialog>
  1416. <el-dialog
  1417. v-model="rechargeDialogVisible"
  1418. :width="isMobile ? '60%' : '30%'"
  1419. :show-close="false"
  1420. >
  1421. <div class="rechargeDialogTitle">温馨提示</div>
  1422. <div class="rechargeDialogContent">
  1423. 尊敬的用户您好您当前的金币余额不足无法进行兑换可充值金币后进行兑换点击下方的前往充值可进行充值
  1424. </div>
  1425. <div class="rechargeDialogBtnGroup">
  1426. <div class="recharge" @click="goRecharge">前往充值</div>
  1427. <div
  1428. class="rechargeDialogCancel"
  1429. @click="rechargeDialogVisible = false"
  1430. >
  1431. 取消
  1432. </div>
  1433. </div>
  1434. </el-dialog>
  1435. <el-dialog
  1436. v-model="confirmDialogVisible"
  1437. :width="isMobile ? '60%' : '30%'"
  1438. :show-close="false"
  1439. >
  1440. <div class="confirmDialogTitle">兑换</div>
  1441. <div class="confirmDialogContent">
  1442. 尊敬的用户您好您确认要花费{{ activeLevel.position }}金币兑换{{
  1443. activeLevel.calculatedPosition
  1444. }}Token吗
  1445. </div>
  1446. <div class="confirmDialogBtnGroup">
  1447. <div class="confirmDialogConfirm" @click="goChange()">确认</div>
  1448. <div class="confirmDialogCancel" @click="confirmDialogVisible = false">
  1449. 取消
  1450. </div>
  1451. </div>
  1452. </el-dialog>
  1453. <el-dialog
  1454. v-model="changeSuccessDialogVisible"
  1455. :width="isMobile ? '60%' : '30%'"
  1456. :show-close="false"
  1457. class="changeSuccessDialog"
  1458. >
  1459. <div class="changeSuccessDialogTitle">兑换成功</div>
  1460. <div class="changeSuccessDialogContent">
  1461. 尊敬的用户恭喜您成功兑换{{ activeLevel.calculatedPosition }} Token
  1462. </div>
  1463. </el-dialog>
  1464. </div>
  1465. </template>
  1466. <style scoped>
  1467. /* 标签栏 */
  1468. .tab-container {
  1469. display: flex;
  1470. margin-bottom: 10px;
  1471. height: 100%;
  1472. position: relative;
  1473. justify-content: center;
  1474. align-items: center;
  1475. gap: 25vw;
  1476. /* 新增右对齐 */
  1477. }
  1478. .pcTabContainer {
  1479. }
  1480. .tab-item {
  1481. cursor: pointer;
  1482. padding: 8px 12px;
  1483. font-size: clamp(18px, 3vw, 20px);
  1484. /* color: #999; */
  1485. color: #fff;
  1486. transition: all 0.3s;
  1487. border-bottom: 2px solid transparent;
  1488. font-weight: bold;
  1489. }
  1490. .tab-item.active {
  1491. /* color: #000;
  1492. border-color: #000; */
  1493. background: linear-gradient(0deg, #ffffff, #fec13e);
  1494. -webkit-background-clip: text;
  1495. background-clip: text;
  1496. -webkit-text-fill-color: transparent;
  1497. color: transparent;
  1498. border-color: #fec13e;
  1499. }
  1500. .tab-item:not(.active):hover {
  1501. color: #999999;
  1502. }
  1503. .tab-content {
  1504. overflow-y: auto;
  1505. overflow-x: hidden;
  1506. scroll-behavior: smooth;
  1507. height: 100%;
  1508. /* 添加平滑滚动效果 */
  1509. }
  1510. .pcTabContent {
  1511. padding: 0 6%;
  1512. }
  1513. @media (max-width: 768px) {
  1514. .tab-container {
  1515. gap: 15px;
  1516. padding: 0 10px;
  1517. }
  1518. .tab-item {
  1519. font-size: clamp(14px, 3vw, 16px);
  1520. padding: 6px 10px;
  1521. }
  1522. }
  1523. </style>
  1524. <style scoped>
  1525. html {
  1526. height: 100dvh;
  1527. overflow: hidden !important;
  1528. position: fixed;
  1529. margin: 0;
  1530. padding: 0;
  1531. -webkit-overflow-scrolling: auto;
  1532. /* 禁用 iOS 弹性滚动 */
  1533. }
  1534. body {
  1535. height: 100dvh;
  1536. overflow: clip;
  1537. margin: 0;
  1538. padding: 0;
  1539. -webkit-overflow-scrolling: auto;
  1540. /* 禁用 iOS 弹性滚动 */
  1541. position: fixed;
  1542. }
  1543. #app {
  1544. overflow: hidden;
  1545. height: 100%;
  1546. margin: 0;
  1547. padding: 0;
  1548. }
  1549. .homepage {
  1550. /* height: var(--app-height, 100vh); */
  1551. height: var(--app-height, 100vh);
  1552. margin: 0 auto;
  1553. background-image: url("https://d31zlh4on95l9h.cloudfront.net/images/2dc3c13a74100b906e809d26b66db211.png");
  1554. background-size: 100% 100%;
  1555. background-repeat: no-repeat;
  1556. background-position: center;
  1557. display: flex;
  1558. flex-direction: row;
  1559. /* 改为水平布局 */
  1560. overflow: hidden;
  1561. position: fixed;
  1562. top: 0;
  1563. left: 0;
  1564. right: 0;
  1565. bottom: 0;
  1566. width: 100%;
  1567. /* -webkit-overflow-scrolling: touch; */
  1568. }
  1569. .main-container {
  1570. flex: 1;
  1571. transition: margin-left 0.3s ease;
  1572. display: flex;
  1573. flex-direction: column;
  1574. overflow: hidden;
  1575. }
  1576. .main-container.unCollapsed {
  1577. margin-left: 300px; /* 为历史记录组件留出空间 */
  1578. }
  1579. /* 当历史记录组件折叠时调整主容器边距 */
  1580. .main-container.collapsed {
  1581. margin-left: 3%;
  1582. }
  1583. .zhezhao {
  1584. width: 100%;
  1585. height: 100%;
  1586. background-color: rgba(0, 0, 0, 0.5);
  1587. z-index: 100;
  1588. position: fixed;
  1589. }
  1590. /* 移动端适配 */
  1591. @media (max-width: 768px) {
  1592. .homepage {
  1593. background-image: url("https://d31zlh4on95l9h.cloudfront.net/images/90d31d7052e729c63acb9e2cb94d1307.png");
  1594. }
  1595. .main-container {
  1596. /* margin-left: 280px; */
  1597. }
  1598. .main-container.unCollapsed {
  1599. margin-left: 280px;
  1600. }
  1601. .main-container.collapsed {
  1602. margin-left: 40px;
  1603. }
  1604. }
  1605. .homepage .el-container {
  1606. height: 100%;
  1607. flex-direction: column;
  1608. display: flex;
  1609. width: 100%;
  1610. overflow: hidden;
  1611. /* 防止容器滚动 */
  1612. }
  1613. .el-container .el-header {
  1614. flex-shrink: 0;
  1615. /* 防止头部压缩 */
  1616. height: auto;
  1617. min-height: 60px;
  1618. padding: 5px 0;
  1619. position: sticky;
  1620. top: 0;
  1621. z-index: 10;
  1622. /* background-color: rgba(255, 255, 255, 0.9); */
  1623. }
  1624. .el-container .el-main {
  1625. flex: 1;
  1626. /* 自动占据剩余空间 */
  1627. overflow: hidden;
  1628. /* 主容器不滚动 */
  1629. display: flex;
  1630. flex-direction: column;
  1631. min-height: 0;
  1632. /* 允许内容区域缩小 */
  1633. position: relative;
  1634. height: auto;
  1635. }
  1636. .el-container .el-footer {
  1637. flex-shrink: 0;
  1638. height: auto;
  1639. min-height: 70px;
  1640. position: sticky;
  1641. bottom: 0;
  1642. z-index: 20;
  1643. background-color: rgba(211, 24, 24, 0);
  1644. box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
  1645. -webkit-transform: translateZ(0);
  1646. transform: translateZ(0);
  1647. padding-bottom: env(safe-area-inset-bottom, 0);
  1648. /* 适配iPhone X及以上的底部安全区域 */
  1649. }
  1650. .homepage-head {
  1651. padding: 0px;
  1652. display: flex;
  1653. position: relative;
  1654. justify-content: space-between;
  1655. width: 100%;
  1656. }
  1657. .homepage-right-group {
  1658. display: flex;
  1659. gap: 8px;
  1660. align-items: center;
  1661. margin-left: auto;
  1662. margin-right: 20px;
  1663. }
  1664. .homepage-right-group .action-btn {
  1665. height: 40px;
  1666. }
  1667. .count-badge {
  1668. position: relative;
  1669. cursor: pointer;
  1670. }
  1671. .count-badge:hover {
  1672. transform: scale(1.05);
  1673. }
  1674. .count-number {
  1675. position: absolute;
  1676. top: 16px;
  1677. right: 0px;
  1678. width: 68%;
  1679. text-align: center;
  1680. color: #6a00ff;
  1681. font-size: 14px;
  1682. font-weight: bold;
  1683. }
  1684. .clickGetCount {
  1685. width: 100%;
  1686. text-align: center;
  1687. color: white;
  1688. font-size: 12px;
  1689. }
  1690. .backToHomeBtn {
  1691. display: flex;
  1692. flex-direction: column;
  1693. justify-content: center;
  1694. align-items: center;
  1695. cursor: pointer;
  1696. }
  1697. .backToHomeBtn:hover {
  1698. transform: scale(1.05);
  1699. }
  1700. .backImg {
  1701. width: 60%;
  1702. height: auto;
  1703. }
  1704. .backContent {
  1705. width: 100%;
  1706. text-align: center;
  1707. color: white;
  1708. font-size: 12px;
  1709. white-space: nowrap;
  1710. }
  1711. .pc-count-badge {
  1712. width: 200px;
  1713. height: 100%;
  1714. position: absolute;
  1715. right: 20px;
  1716. display: flex;
  1717. }
  1718. .pc-countBtn {
  1719. width: 65%;
  1720. height: 100%;
  1721. position: relative;
  1722. cursor: pointer;
  1723. }
  1724. .pc-countBtn:hover {
  1725. transform: scale(1.05);
  1726. }
  1727. .pc-action-btn {
  1728. width: 100%;
  1729. height: 70%;
  1730. background-image: url("https://d31zlh4on95l9h.cloudfront.net/images/74e20c65c9ef2526477c63ad68698a50.png");
  1731. background-repeat: no-repeat;
  1732. background-size: 100% 100%;
  1733. }
  1734. .pc-count-number {
  1735. position: absolute;
  1736. top: 15px;
  1737. right: 4px;
  1738. width: 68%;
  1739. text-align: center;
  1740. color: #6a00ff;
  1741. font-size: 15px;
  1742. font-weight: bold;
  1743. }
  1744. .pc-clickGetCount {
  1745. width: 100%;
  1746. text-align: center;
  1747. color: white;
  1748. font-size: 12px;
  1749. }
  1750. .pc-backToHomeBtn {
  1751. width: 35%;
  1752. height: 100%;
  1753. display: flex;
  1754. flex-direction: column;
  1755. align-items: center;
  1756. cursor: pointer;
  1757. }
  1758. .pc-backImg {
  1759. width: auto;
  1760. height: 70%;
  1761. }
  1762. .pc-backContent {
  1763. width: 100%;
  1764. text-align: center;
  1765. color: white;
  1766. font-size: 12px;
  1767. }
  1768. .pc-backToHomeBtn:hover {
  1769. transform: scale(1.05);
  1770. }
  1771. .homepage-right-group .announcement-btn {
  1772. cursor: pointer;
  1773. transition: transform 0.3s;
  1774. }
  1775. .homepage-right-group .announcement-btn:hover {
  1776. transform: scale(1.3);
  1777. }
  1778. .homepage-body {
  1779. padding: 0px;
  1780. display: flex;
  1781. flex-direction: column;
  1782. flex: 1;
  1783. min-height: 0;
  1784. /* 允许内容区域缩小 */
  1785. overflow: hidden;
  1786. }
  1787. .main-wrapper {
  1788. height: 100%;
  1789. display: flex;
  1790. flex-direction: column;
  1791. flex: 1;
  1792. min-height: 0;
  1793. /* 允许内容区域缩小 */
  1794. }
  1795. .tab-section {
  1796. flex-shrink: 0;
  1797. /* 禁止伸缩 */
  1798. }
  1799. .tab-content {
  1800. flex: 1;
  1801. overflow-y: auto;
  1802. min-height: 0;
  1803. /* 关键:允许内容收缩 */
  1804. }
  1805. .homepage-logo {
  1806. height: 100%;
  1807. width: fit-content;
  1808. display: flex;
  1809. /* flex-direction: column; */
  1810. align-items: center;
  1811. justify-content: center;
  1812. margin-left: 20px;
  1813. margin-right: auto;
  1814. position: relative;
  1815. gap: 10px;
  1816. }
  1817. .expand {
  1818. font-size: 2.5rem;
  1819. cursor: pointer;
  1820. color: white;
  1821. }
  1822. .logo1 {
  1823. width: 110px;
  1824. height: auto;
  1825. margin-bottom: 8px;
  1826. }
  1827. .logo2 {
  1828. width: 80px;
  1829. height: auto;
  1830. }
  1831. /* 尾部 */
  1832. .homepage-footer {
  1833. display: flex;
  1834. flex-direction: column;
  1835. gap: 5px;
  1836. flex-shrink: 0;
  1837. /* width: 100%; */
  1838. background-color: #fff;
  1839. }
  1840. .pcFooter {
  1841. margin: 0 6% 4%;
  1842. }
  1843. .footer-first-line {
  1844. display: flex;
  1845. justify-content: space-between;
  1846. align-items: center;
  1847. padding: 5px 15px;
  1848. flex-shrink: 0;
  1849. }
  1850. .left-group {
  1851. display: flex;
  1852. gap: 15px;
  1853. }
  1854. .action-btn {
  1855. cursor: pointer;
  1856. transition: transform 0.2s;
  1857. height: 28px;
  1858. }
  1859. .model-btn {
  1860. height: 32px;
  1861. transition: all 0.3s ease;
  1862. }
  1863. .model-btn:hover {
  1864. transform: scale(1.1);
  1865. }
  1866. .send-btn {
  1867. margin-left: 10px;
  1868. height: 33px !important;
  1869. width: auto;
  1870. /* margin-right: 5px; */
  1871. }
  1872. .input-container {
  1873. position: relative;
  1874. width: 100%;
  1875. }
  1876. .send-btn-inner {
  1877. position: absolute;
  1878. right: 10px;
  1879. top: 50%;
  1880. transform: translateY(-50%);
  1881. height: 28px !important;
  1882. width: auto;
  1883. z-index: 10;
  1884. transition: all 0.3s ease;
  1885. }
  1886. .send-btn-inner:hover {
  1887. transform: translateY(-50%) scale(1.1);
  1888. }
  1889. /* 音频播放动画 */
  1890. @keyframes pulse {
  1891. 0% {
  1892. transform: scale(1);
  1893. }
  1894. 50% {
  1895. transform: scale(1.1);
  1896. }
  1897. 100% {
  1898. transform: scale(1);
  1899. }
  1900. }
  1901. .footer-second-line {
  1902. position: relative;
  1903. display: flex;
  1904. align-items: center;
  1905. padding: 5px 15px 10px;
  1906. flex-shrink: 0;
  1907. }
  1908. .msg-icon {
  1909. position: absolute;
  1910. left: 25px;
  1911. top: 50%;
  1912. transform: translateY(-50%);
  1913. width: 24px;
  1914. z-index: 999;
  1915. }
  1916. .msg-input:deep(.el-textarea__inner) {
  1917. border: none !important;
  1918. box-shadow: none !important;
  1919. overflow-y: auto !important;
  1920. transition: all 0.2s ease-out;
  1921. resize: none !important;
  1922. line-height: 1.5 !important;
  1923. max-height: 100px !important;
  1924. padding-right: 45px !important;
  1925. }
  1926. .msg-input {
  1927. min-height: 34px;
  1928. width: 100%;
  1929. border-radius: 5px;
  1930. font-size: 16px;
  1931. transition: all 0.3s ease-out;
  1932. overflow-y: hidden;
  1933. box-shadow: 0 4px 12px rgba(89, 24, 241, 0.3);
  1934. background: #fff;
  1935. z-index: 5;
  1936. /* 添加iOS设备特殊处理 */
  1937. -webkit-appearance: none;
  1938. appearance: none;
  1939. }
  1940. .msg-input:focus {
  1941. outline: none;
  1942. }
  1943. .input::before {
  1944. content: "请输入股票名称或股票代码...";
  1945. position: absolute;
  1946. left: 11px;
  1947. top: 5px;
  1948. color: var(--el-text-color-secondary);
  1949. pointer-events: none;
  1950. white-space: nowrap;
  1951. overflow-x: hidden;
  1952. text-overflow: ellipsis;
  1953. width: 80%;
  1954. z-index: 6;
  1955. }
  1956. .changeMsg {
  1957. display: flex;
  1958. width: 100%;
  1959. margin-bottom: 30px;
  1960. flex-wrap: wrap;
  1961. gap: 20px;
  1962. }
  1963. .changeInfo {
  1964. display: flex;
  1965. background-color: #f8f8f8;
  1966. border-radius: 5px;
  1967. padding: 10px 20px;
  1968. /* width: 40%; */
  1969. white-space: nowrap;
  1970. }
  1971. .changeImg {
  1972. height: 100%;
  1973. display: flex;
  1974. justify-content: center;
  1975. align-items: center;
  1976. margin-right: 10px;
  1977. }
  1978. .changeImgClass {
  1979. width: 50px;
  1980. height: auto;
  1981. }
  1982. .changeContent {
  1983. display: flex;
  1984. flex-direction: column;
  1985. justify-content: center;
  1986. font-weight: bold;
  1987. }
  1988. .changeRule {
  1989. display: flex;
  1990. background-color: #f8f8f8;
  1991. border-radius: 5px;
  1992. text-align: center;
  1993. align-items: center;
  1994. justify-content: center;
  1995. color: #4e86fe;
  1996. white-space: nowrap;
  1997. padding: 5px 20px;
  1998. min-width: 40%;
  1999. }
  2000. .changeLevel {
  2001. display: flex;
  2002. flex-direction: column;
  2003. }
  2004. .changeLevelTitle {
  2005. font-weight: bold;
  2006. margin-bottom: 10px;
  2007. }
  2008. .changeLevelContent {
  2009. display: flex;
  2010. flex-wrap: wrap;
  2011. gap: 15px;
  2012. margin-bottom: 10px;
  2013. }
  2014. .changeLevelItems {
  2015. display: flex;
  2016. background-color: #f8f8f8;
  2017. width: 20%;
  2018. min-width: 70px;
  2019. max-width: 150px;
  2020. justify-content: center;
  2021. align-items: center;
  2022. flex-direction: column;
  2023. border-radius: 10px;
  2024. padding: 5px;
  2025. cursor: pointer;
  2026. }
  2027. .changeLevelItems:hover {
  2028. background-color: #ecf2ff;
  2029. }
  2030. .changeLevelItemsActive {
  2031. border: 1px solid #4e86fe;
  2032. background-color: #ecf2ff;
  2033. }
  2034. .changeLevelItem {
  2035. display: flex;
  2036. flex-direction: column;
  2037. justify-content: center;
  2038. align-items: center;
  2039. }
  2040. .changeLevelItemToken {
  2041. display: flex;
  2042. justify-content: center;
  2043. align-items: center;
  2044. }
  2045. .changeLevelItemTokenImg {
  2046. width: 40px;
  2047. height: 40px;
  2048. }
  2049. .changeNow {
  2050. display: flex;
  2051. white-space: nowrap;
  2052. /* font-weight: bold; */
  2053. margin-bottom: 15px;
  2054. align-items: center;
  2055. }
  2056. .changePay {
  2057. color: #4e86fe;
  2058. margin: 0px 5px;
  2059. font-size: 1.1rem;
  2060. }
  2061. .changeBtn {
  2062. width: 40%;
  2063. max-width: 350px;
  2064. background-color: #4e86fe;
  2065. color: white;
  2066. display: flex;
  2067. justify-content: center;
  2068. align-content: center;
  2069. padding: 10px;
  2070. border-radius: 5px;
  2071. cursor: pointer;
  2072. }
  2073. .changeBtn:hover {
  2074. background-color: #3a73e6;
  2075. }
  2076. .rechargeDialogTitle {
  2077. font-size: 1.7rem;
  2078. /* font-weight: bold; */
  2079. color: #4e86fe;
  2080. display: flex;
  2081. justify-content: center;
  2082. align-items: center;
  2083. letter-spacing: 10px;
  2084. }
  2085. .rechargeDialogContent {
  2086. padding: 20px;
  2087. font-size: 1.2rem;
  2088. }
  2089. .rechargeDialogBtnGroup {
  2090. display: flex;
  2091. font-size: 1.2rem;
  2092. padding: 0px 20px;
  2093. justify-content: space-between;
  2094. }
  2095. .recharge {
  2096. color: white;
  2097. background-color: #4e86fe;
  2098. padding: 10px 20px;
  2099. border-radius: 13px;
  2100. cursor: pointer;
  2101. min-width: 20%;
  2102. text-align: center;
  2103. white-space: nowrap;
  2104. }
  2105. .recharge:hover {
  2106. background-color: #3a73e6;
  2107. }
  2108. .rechargeDialogCancel {
  2109. border: 1px solid rgb(202, 202, 202);
  2110. padding: 10px 20px;
  2111. border-radius: 13px;
  2112. cursor: pointer;
  2113. min-width: 20%;
  2114. text-align: center;
  2115. }
  2116. .rechargeDialogCancel:hover {
  2117. background-color: #ecf2ff;
  2118. }
  2119. .confirmDialogTitle {
  2120. font-size: 1.7rem;
  2121. /* font-weight: bold; */
  2122. color: #4e86fe;
  2123. display: flex;
  2124. justify-content: center;
  2125. align-items: center;
  2126. letter-spacing: 10px;
  2127. }
  2128. .confirmDialogContent {
  2129. padding: 20px;
  2130. font-size: 1.2rem;
  2131. }
  2132. .confirmDialogBtnGroup {
  2133. display: flex;
  2134. font-size: 1.2rem;
  2135. padding: 0px 20px;
  2136. justify-content: space-between;
  2137. }
  2138. .confirmDialogConfirm {
  2139. color: white;
  2140. background-color: #4e86fe;
  2141. padding: 10px 20px;
  2142. border-radius: 13px;
  2143. cursor: pointer;
  2144. min-width: 20%;
  2145. text-align: center;
  2146. }
  2147. .confirmDialogConfirm:hover {
  2148. background-color: #3a73e6;
  2149. }
  2150. .confirmDialogCancel {
  2151. border: 1px solid rgb(202, 202, 202);
  2152. padding: 10px 20px;
  2153. border-radius: 13px;
  2154. cursor: pointer;
  2155. min-width: 20%;
  2156. text-align: center;
  2157. }
  2158. .confirmDialogCancel:hover {
  2159. background-color: #ecf2ff;
  2160. }
  2161. .changeSuccessDialogTitle {
  2162. font-size: 1.7rem;
  2163. font-weight: bold;
  2164. color: #de93a3;
  2165. display: flex;
  2166. justify-content: center;
  2167. align-items: center;
  2168. letter-spacing: 10px;
  2169. }
  2170. .changeSuccessDialogContent {
  2171. padding: 20px;
  2172. font-size: 1.2rem;
  2173. font-weight: bold;
  2174. text-align: center;
  2175. }
  2176. @media (max-width: 768px) {
  2177. .action-btn {
  2178. height: 21px;
  2179. }
  2180. .footer-second-line {
  2181. padding: 5px 10px 10px;
  2182. }
  2183. .msg-input {
  2184. /* min-height: 44px; */
  2185. /* height: 44px; */
  2186. font-size: 16px;
  2187. }
  2188. /* .changeImg {
  2189. width: 30px;
  2190. height: 30px;
  2191. } */
  2192. .changeLevel {
  2193. flex-direction: horizontal;
  2194. }
  2195. .changeLevelContent {
  2196. display: flex;
  2197. /* justify-content: center; */
  2198. }
  2199. .changeLevelItems {
  2200. flex: 0 0 calc(33% - 20px);
  2201. /* margin-right: auto; */
  2202. }
  2203. .changeLevelTitle {
  2204. align-items: center;
  2205. display: flex;
  2206. }
  2207. .changeRule {
  2208. margin-left: 10px;
  2209. width: 0%;
  2210. background-color: white;
  2211. }
  2212. .changeMsg {
  2213. gap: 10px 20px;
  2214. margin-bottom: 10px;
  2215. }
  2216. .changeImgClass {
  2217. width: 30px;
  2218. height: 30px;
  2219. }
  2220. /* .changeContent {
  2221. font-size: 0.5rem;
  2222. } */
  2223. .changeLevelItems {
  2224. font-size: 0.7rem;
  2225. min-width: 0px;
  2226. }
  2227. .changeLevelItemToken {
  2228. white-space: nowrap;
  2229. }
  2230. .changeLevelItemTokenImg {
  2231. width: 20px;
  2232. height: 20px;
  2233. }
  2234. .changeInfo {
  2235. margin: 0px auto;
  2236. }
  2237. .changeBtn {
  2238. margin: 0px auto;
  2239. }
  2240. .rechargeDialogTitle {
  2241. font-size: 1.3rem;
  2242. }
  2243. .rechargeDialogContent {
  2244. padding: 10px 0px;
  2245. font-size: 0.8rem;
  2246. }
  2247. .rechargeDialogBtnGroup {
  2248. font-size: 1rem;
  2249. }
  2250. .recharge {
  2251. padding: 5px 10px;
  2252. }
  2253. .rechargeDialogCancel {
  2254. padding: 5px 10px;
  2255. }
  2256. .confirmDialogTitle {
  2257. font-size: 1.3rem;
  2258. }
  2259. .confirmDialogContent {
  2260. padding: 10px 0px;
  2261. font-size: 0.8rem;
  2262. }
  2263. .confirmDialogBtnGroup {
  2264. font-size: 1rem;
  2265. }
  2266. .confirmDialogConfirm {
  2267. padding: 5px 10px;
  2268. }
  2269. .confirmDialogCancel {
  2270. padding: 5px 10px;
  2271. }
  2272. .changeSuccessDialogTitle {
  2273. font-size: 1.3rem;
  2274. }
  2275. .changeSuccessDialogContent {
  2276. font-size: 1rem;
  2277. }
  2278. }
  2279. </style>
  2280. <style>
  2281. .changeSuccessDialog {
  2282. background: linear-gradient(180deg, #a2dffe, #b59be1);
  2283. }
  2284. </style>