refactor: restructure pinia stores, fix calendar, add utilities

- Restructure Pinia store organization from src/stores/ to src/store/ with modular stores
- Update main.ts to use locally created Pinia instance instead of imported pre-configured one
- Fix template syntax errors in Calendar component: correct missing class spacing and incorrect closing tags
- Remove unused calendar demo/example files and documentation
- Add new constant files, token management utilities, and client configuration constants
- Add custom hooks useGoHome and useGoLogin for navigation and login logic
This commit is contained in:
duanshuwen
2026-05-26 23:02:05 +08:00
parent ac8f5b5f64
commit c977c485ef
20 changed files with 344 additions and 1494 deletions

1
src/store/index.ts Normal file
View File

@@ -0,0 +1 @@
export * from "./modules";

26
src/store/modules/app.ts Normal file
View File

@@ -0,0 +1,26 @@
import { defineStore } from "pinia";
import { devUrl, wssDevUrl } from "../../request/base/baseUrl";
export const useAppStore = defineStore("app", {
state() {
return {
sceneId: "", // 分身场景id
serverConfig: { // 服务器配置
baseUrl: devUrl, // 服务器基础地址
wssUrl: wssDevUrl, // 服务器ws地址
},
};
},
getters: {},
actions: {
setSceneId(data) {
this.sceneId = data;
},
setServerConfig(data) {
this.serverConfig = data;
},
},
unistorage: true,
});

View File

@@ -0,0 +1,6 @@
import { useAppStore } from "./app";
import { useSelectedDateStore } from "./selectedDate";
import { usePictureStore } from "./picture";
import { useLocationStore } from "./location";
export { useAppStore, useSelectedDateStore, usePictureStore, useLocationStore };

View File

@@ -0,0 +1,19 @@
import { defineStore } from "pinia";
export const useLocationStore = defineStore("location", {
state() {
return {
latitude: 0, // 纬度
longitude: 0, // 经度
};
},
actions: {
setLocationData(data) {
this.latitude = data.latitude;
this.longitude = data.longitude;
},
},
unistorage: true,
});

View File

@@ -0,0 +1,17 @@
import { defineStore } from "pinia";
export const usePictureStore = defineStore("picture", {
state() {
return {
previewImageData: [], // 预览图片数据
};
},
actions: {
setPreviewImageData(data) {
this.previewImageData = data;
},
},
unistorage: true,
});

View File

@@ -0,0 +1,21 @@
import { defineStore } from "pinia";
export const useSelectedDateStore = defineStore("selectedDate", {
state() {
return {
selectedDate: {
startDate: "",
endDate: "",
totalDays: 1,
},
};
},
actions: {
setData(data) {
this.selectedDate = data;
},
},
unistorage: true,
});