fix: some
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 2m59s

This commit is contained in:
luo
2026-10-13 14:53:19 +08:00
parent 77b0e25011
commit da95a914e3
31 changed files with 1702 additions and 116 deletions

View File

@@ -1,12 +1,30 @@
import { reactive, ref } from 'vue';
import { reactive } from 'vue';
import { isCurrentSession } from '@/utils/session-context.js';
import { getShanghaiDay, normalizeExpiryReminder } from '@/utils/expiry-reminder.js';
const receivedReminders = new Set();
const state = reactive({
assetInfo: null,
deviceRealtime: null,
currentPackage: null
currentPackage: null,
expiryReminder: null
});
export const useAssetStore = () => {
const receiveExpiryReminder = (context, value) => {
const reminder = normalizeExpiryReminder(value);
if (!reminder || !isCurrentSession(context)) return;
const day = getShanghaiDay();
const key = JSON.stringify([context.token, context.identifier, day]);
if (receivedReminders.has(key)) return;
receivedReminders.add(key);
state.expiryReminder = { ...context, day, reminder, shown: false };
};
const markExpiryReminderShown = () => {
if (state.expiryReminder) state.expiryReminder.shown = true;
};
const dismissExpiryReminder = () => { state.expiryReminder = null; };
const setAssetInfo = (info) => {
state.assetInfo = info;
};
@@ -23,6 +41,8 @@ export const useAssetStore = () => {
state.assetInfo = null;
state.deviceRealtime = null;
state.currentPackage = null;
state.expiryReminder = null;
receivedReminders.clear();
};
return {
@@ -30,6 +50,9 @@ export const useAssetStore = () => {
setAssetInfo,
setDeviceRealtime,
setCurrentPackage,
receiveExpiryReminder,
markExpiryReminderShown,
dismissExpiryReminder,
clearAsset
};
};
};