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

import { defineStore } from "pinia";
import { getUserCountAPI } from "@/api/AIxiaocaishen";
export const useChatStore = defineStore("chat", {
state: () => ({
messages: [],
isLoading: false, // 新增加载状态
UserCount: 0,
chartData: [],
kLineData: [],
dbqbClickRecord: {},
searchRecord: false,
currentUserIndex: null,
announcementMsg: null,
}),
actions: {
async getUserCount() {
const result = await getUserCountAPI({
token: localStorage.getItem("localToken"),
source: "1",
});
this.UserCount = result.data;
},
setLoading(status) {
this.isLoading = status;
},
isLoadingT() {
this.isLoading = true;
},
isLoadingF() {
this.isLoading = false;
},
addKLineData(data) {
this.kLineData.push(data);
},
},
persist: {
key: "chat_messages",
storage: sessionStorage,
paths: ["messages", "kLineData"],
},
});