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.

41 lines
958 B

  1. import { defineStore } from "pinia";
  2. import { getUserCountAPI } from "@/api/AIxiaocaishen";
  3. export const useChatStore = defineStore("chat", {
  4. state: () => ({
  5. messages: [],
  6. isLoading: false, // 新增加载状态
  7. UserCount: 0,
  8. chartData: [],
  9. kLineData: [],
  10. dbqbClickRecord: {},
  11. searchRecord: false,
  12. currentUserIndex: null,
  13. announcementMsg: null,
  14. }),
  15. actions: {
  16. async getUserCount() {
  17. const result = await getUserCountAPI({
  18. token: localStorage.getItem("localToken"),
  19. source: "1",
  20. });
  21. this.UserCount = result.data;
  22. },
  23. setLoading(status) {
  24. this.isLoading = status;
  25. },
  26. isLoadingT() {
  27. this.isLoading = true;
  28. },
  29. isLoadingF() {
  30. this.isLoading = false;
  31. },
  32. addKLineData(data) {
  33. this.kLineData.push(data);
  34. },
  35. },
  36. persist: {
  37. key: "chat_messages",
  38. storage: sessionStorage,
  39. paths: ["messages", "kLineData"],
  40. },
  41. });