新增空闲锁屏、修复401等问题,新增文件版本管理、共享库等占位符

This commit is contained in:
Cheng Zhou
2026-01-13 13:59:07 +08:00
parent b3cd8e03f2
commit 0c7c03069a
21 changed files with 829 additions and 40 deletions
+3
View File
@@ -47,6 +47,9 @@ export const useAuthStore = defineStore("auth", () => {
login,
fetchMe: fetchMeAction,
logout,
setToken: (newToken: string) => {
token.value = newToken;
},
requestReLogin: () => {
forceLogin.value = true;
},
+55
View File
@@ -0,0 +1,55 @@
import { defineStore } from "pinia";
import { ref } from "vue";
export type LockReason = "idle" | "extend_failed" | "token_invalid";
export const useSessionStore = defineStore("session", () => {
const locked = ref(false);
const lockReason = ref<LockReason | null>(null);
const unlockAttempts = ref(0);
const lastUserActiveAt = ref(Date.now());
const lastNetworkActiveAt = ref(Date.now());
const lastExtendAt = ref(0);
const recordUserActivity = (ts: number = Date.now()) => {
lastUserActiveAt.value = ts;
};
const recordNetworkActivity = (ts: number = Date.now()) => {
lastNetworkActiveAt.value = ts;
};
const lock = (reason: LockReason) => {
locked.value = true;
lockReason.value = reason;
};
const unlock = () => {
locked.value = false;
lockReason.value = null;
unlockAttempts.value = 0;
};
const incrementUnlockAttempt = () => {
unlockAttempts.value += 1;
};
const setLastExtendAt = (ts: number) => {
lastExtendAt.value = ts;
};
return {
locked,
lockReason,
unlockAttempts,
lastUserActiveAt,
lastNetworkActiveAt,
lastExtendAt,
recordUserActivity,
recordNetworkActivity,
lock,
unlock,
incrementUnlockAttempt,
setLastExtendAt,
};
});