update
This commit is contained in:
@@ -101,13 +101,6 @@ export const useAppearanceStore = defineStore('appearance', () => {
|
||||
]);
|
||||
appearanceSettings.value = settingsResponse.data;
|
||||
allTerminalThemes.value = themesResponse.data; // 更新 allTerminalThemes
|
||||
console.log('[AppearanceStore LOG] 外观设置已加载 (原始数据):', JSON.stringify(settingsResponse.data)); // 添加原始数据日志
|
||||
console.log(`[AppearanceStore LOG] 从后端加载的 terminalBackgroundEnabled 原始值: ${settingsResponse.data.terminalBackgroundEnabled}`); // 专门记录该值
|
||||
console.log('[AppearanceStore] 所有终端主题列表已加载:', allTerminalThemes.value);
|
||||
|
||||
// --- 后端返回的 activeTerminalThemeId 已经是 number | null ---
|
||||
// 前端不再需要设置默认主题 ID 的逻辑,后端初始化时会保证它不为 NULL
|
||||
// 如果后端返回 null (理论上不应发生,除非初始化失败),则 currentTerminalTheme 计算属性会回退到 defaultXtermTheme
|
||||
|
||||
// 应用加载的 UI 主题
|
||||
applyUiTheme(currentUiTheme.value);
|
||||
@@ -486,7 +479,6 @@ export const useAppearanceStore = defineStore('appearance', () => {
|
||||
for (const [key, value] of Object.entries(theme)) {
|
||||
root.style.setProperty(key, value);
|
||||
}
|
||||
console.log('[AppearanceStore] UI 主题已应用:', theme);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -67,7 +67,6 @@ export const useCommandHistoryStore = defineStore('commandHistory', () => {
|
||||
try {
|
||||
const cachedData = localStorage.getItem(cacheKey);
|
||||
if (cachedData) {
|
||||
console.log('[CmdHistoryStore] Loading history from cache.');
|
||||
historyList.value = JSON.parse(cachedData); // 缓存中已是降序
|
||||
isLoading.value = false; // 先显示缓存
|
||||
} else {
|
||||
|
||||
@@ -26,7 +26,6 @@ export const useQuickCommandTagsStore = defineStore('quickCommandTags', () => {
|
||||
try {
|
||||
const cachedData = localStorage.getItem(cacheKey);
|
||||
if (cachedData) {
|
||||
console.log('[QuickCmdTagStore] Loading quick command tags from cache.');
|
||||
tags.value = JSON.parse(cachedData);
|
||||
isLoading.value = false;
|
||||
} else {
|
||||
@@ -41,7 +40,6 @@ export const useQuickCommandTagsStore = defineStore('quickCommandTags', () => {
|
||||
// 2. 后台获取最新数据
|
||||
isLoading.value = true;
|
||||
try {
|
||||
console.log('[QuickCmdTagStore] Fetching latest quick command tags from server...');
|
||||
// 使用新的 API 端点
|
||||
const response = await apiClient.get<QuickCommandTag[]>('/quick-command-tags');
|
||||
const freshData = response.data;
|
||||
@@ -50,11 +48,9 @@ export const useQuickCommandTagsStore = defineStore('quickCommandTags', () => {
|
||||
// 3. 对比并更新
|
||||
const currentDataString = JSON.stringify(tags.value);
|
||||
if (currentDataString !== freshDataString) {
|
||||
console.log('[QuickCmdTagStore] Tags data changed, updating state and cache.');
|
||||
tags.value = freshData;
|
||||
localStorage.setItem(cacheKey, freshDataString);
|
||||
} else {
|
||||
console.log('[QuickCmdTagStore] Tags data is up-to-date.');
|
||||
}
|
||||
error.value = null;
|
||||
return true;
|
||||
|
||||
@@ -250,7 +250,6 @@ export const useQuickCommandsStore = defineStore('quickCommands', () => {
|
||||
try {
|
||||
const cachedData = localStorage.getItem(cacheKey);
|
||||
if (cachedData) {
|
||||
console.log(`[QuickCmdStore] Loading commands from cache.`);
|
||||
// 确保解析后的数据符合 QuickCommandFE 结构 (特别是 tagIds)
|
||||
const parsedData = JSON.parse(cachedData) as QuickCommandFE[];
|
||||
// 基本验证,确保 tagIds 是数组
|
||||
@@ -291,7 +290,6 @@ export const useQuickCommandsStore = defineStore('quickCommands', () => {
|
||||
quickCommandsList.value = freshData;
|
||||
localStorage.setItem(cacheKey, freshDataString); // 更新缓存
|
||||
} else {
|
||||
console.log('[QuickCmdStore] Commands data is up-to-date.');
|
||||
}
|
||||
error.value = null;
|
||||
} catch (err: any) {
|
||||
|
||||
@@ -208,7 +208,6 @@ export const useSettingsStore = defineStore('settings', () => {
|
||||
try {
|
||||
if (settings.value.fileManagerColWidths) {
|
||||
loadedFmWidths = JSON.parse(settings.value.fileManagerColWidths);
|
||||
console.log(`[SettingsStore] Successfully parsed fileManagerColWidths JSON: ${JSON.stringify(loadedFmWidths)}`);
|
||||
if (typeof loadedFmWidths !== 'object' || loadedFmWidths === null) {
|
||||
console.warn('[SettingsStore] Invalid fileManagerColWidths format loaded, resetting.');
|
||||
loadedFmWidths = {};
|
||||
|
||||
@@ -24,7 +24,6 @@ export const useTagsStore = defineStore('tags', () => {
|
||||
try {
|
||||
const cachedData = localStorage.getItem(cacheKey);
|
||||
if (cachedData) {
|
||||
console.log('[TagsStore] Loading tags from cache.');
|
||||
tags.value = JSON.parse(cachedData);
|
||||
isLoading.value = false; // 先显示缓存
|
||||
} else {
|
||||
@@ -39,7 +38,6 @@ export const useTagsStore = defineStore('tags', () => {
|
||||
// 2. 后台获取最新数据
|
||||
isLoading.value = true; // 标记正在后台获取
|
||||
try {
|
||||
console.log('[TagsStore] Fetching latest tags from server...');
|
||||
const response = await apiClient.get<TagInfo[]>('/tags');
|
||||
const freshData = response.data;
|
||||
const freshDataString = JSON.stringify(freshData);
|
||||
@@ -47,7 +45,6 @@ export const useTagsStore = defineStore('tags', () => {
|
||||
// 3. 对比并更新
|
||||
const currentDataString = JSON.stringify(tags.value);
|
||||
if (currentDataString !== freshDataString) {
|
||||
console.log('[TagsStore] Tags data changed, updating state and cache.');
|
||||
tags.value = freshData;
|
||||
localStorage.setItem(cacheKey, freshDataString); // 更新缓存
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user