From d7fe2047199227f465f090d579daecba52e9511d Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 8 Mar 2026 09:46:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96'=E5=BF=AB=E9=80=9F=E6=90=9C?= =?UTF-8?q?=E7=B4=A2'=E6=89=93=E5=BC=80=E6=AC=A1=E6=95=B0=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commons/utils/common.d.ts | 1 - commons/utils/common.ts | 3 -- electron/main/data/data.ts | 17 ++++---- electron/main/item/index.ts | 27 ++++++------ src/pages/item/components/Content.vue | 60 +++++++++++++-------------- src/pages/item/js/index.ts | 4 +- src/pages/search/QuickSearch.vue | 34 +++++++-------- types/item.d.ts | 2 - 8 files changed, 68 insertions(+), 80 deletions(-) diff --git a/commons/utils/common.d.ts b/commons/utils/common.d.ts index 47e6409..03ed8bd 100644 --- a/commons/utils/common.d.ts +++ b/commons/utils/common.d.ts @@ -64,7 +64,6 @@ export function newItemData(data: { fixedIcon?: boolean | null; openNumber?: number | null; lastOpen?: number | null; - quickSearchOpenNumber?: number | null; quickSearchLastOpen?: number | null; multiItemsTimeInterval?: number | null; }): ItemData; diff --git a/commons/utils/common.ts b/commons/utils/common.ts index 7a8f976..14a0757 100644 --- a/commons/utils/common.ts +++ b/commons/utils/common.ts @@ -243,7 +243,6 @@ function newItemData({ fixedIcon = false, openNumber = 0, lastOpen = 0, - quickSearchOpenNumber = 0, quickSearchLastOpen = 0, multiItemsTimeInterval = 0, }: { @@ -258,7 +257,6 @@ function newItemData({ fixedIcon?: boolean | null; openNumber?: number | null; lastOpen?: number | null; - quickSearchOpenNumber?: number | null; quickSearchLastOpen?: number | null; multiItemsTimeInterval?: number | null; }): ItemData { @@ -274,7 +272,6 @@ function newItemData({ fixedIcon: fixedIcon ?? false, openNumber: openNumber ?? 0, lastOpen: lastOpen ?? 0, - quickSearchOpenNumber: quickSearchOpenNumber ?? 0, quickSearchLastOpen: quickSearchLastOpen ?? 0, multiItemsTimeInterval: multiItemsTimeInterval ?? 0, }; diff --git a/electron/main/data/data.ts b/electron/main/data/data.ts index f5ced59..5adc4df 100644 --- a/electron/main/data/data.ts +++ b/electron/main/data/data.ts @@ -79,7 +79,7 @@ function databaseRestore(filePath: string) { function clearAndInsert( db: Database.Database, tableName: string, - list: Array + list: Array, ) { // 清空数据 db.prepare(`DELETE FROM ${tableName}`).run(); @@ -90,7 +90,7 @@ function clearAndInsert( const placeholders = keys.map(() => "?").join(","); const values = keys.map((key) => row[key]); db.prepare( - `INSERT INTO ${tableName} (${columns.join(",")}) VALUES (${placeholders})` + `INSERT INTO ${tableName} (${columns.join(",")}) VALUES (${placeholders})`, ).run(values); }); } @@ -136,7 +136,7 @@ function jsonRestore(filePath: string) { const child = parent.childList[j]; let childClassification = jsonAddClassification( child, - classification.id + classification.id, ); if ( childClassification && @@ -149,7 +149,7 @@ function jsonRestore(filePath: string) { child.itemList[k], child, childClassification.id, - iconData + iconData, ); } } @@ -162,7 +162,7 @@ function jsonRestore(filePath: string) { parent.itemList[k], parent, classification.id, - iconData + iconData, ); } } @@ -192,7 +192,7 @@ function jsonRestore(filePath: string) { */ function jsonAddClassification( oldClassification: any, - parentId: number | null + parentId: number | null, ) { // 排序 let itemSort: "default" | "initial" | "openNumber" | "lastOpen" = "default"; @@ -262,7 +262,7 @@ function jsonAddClassification( classification.shortcutKey, classification.globalShortcutKey, classification.data, - classification.type + classification.type, ); } @@ -277,7 +277,7 @@ function jsonAddItem( oldItem: any, oldClassification: any, classificationId: number, - iconData: Array + iconData: Array, ) { // 类型 let type = oldItem.type; @@ -341,7 +341,6 @@ function jsonAddItem( fixedIcon: oldItem.notRefreshIcon, openNumber: oldItem.openNumber, lastOpen: oldItem.lastOpen, - quickSearchOpenNumber: oldItem.quickSearchOpenNumber, quickSearchLastOpen: oldItem.quickSearchLastOpen, }); let item = newItem({ diff --git a/electron/main/item/index.ts b/electron/main/item/index.ts index 756e679..024849e 100644 --- a/electron/main/item/index.ts +++ b/electron/main/item/index.ts @@ -45,7 +45,7 @@ let itemSVGIconWindow: BrowserWindow | null = null; */ async function createAddEditWindow( id: number | null, - classificationId: number | null + classificationId: number | null, ) { // 如果窗口存在先关闭窗口 closeWindow(itemAddEditWindow); @@ -83,7 +83,7 @@ async function createAddEditWindow( } if (process.env.VITE_DEV_SERVER_URL) { itemAddEditWindow.loadURL( - process.env.VITE_DEV_SERVER_URL + "item/AddEdit" + getURLParams(params) + process.env.VITE_DEV_SERVER_URL + "item/AddEdit" + getURLParams(params), ); } else { itemAddEditWindow.loadFile(join(process.env.DIST, "index.html"), { @@ -139,7 +139,7 @@ async function createNetworkIconWindow() { }); if (process.env.VITE_DEV_SERVER_URL) { itemNetworkIconWindow.loadURL( - process.env.VITE_DEV_SERVER_URL + "item/NetworkIcon" + process.env.VITE_DEV_SERVER_URL + "item/NetworkIcon", ); } else { itemNetworkIconWindow.loadFile(join(process.env.DIST, "index.html"), { @@ -296,14 +296,15 @@ function updateOpenInfo(type: string, id: number) { // 记录打开信息 curItem.data.quickSearchLastOpen = new Date().getTime(); // 记录打开次数 - curItem.data.quickSearchOpenNumber += 1; + if (global.setting.item.openNumber) { + curItem.data.openNumber += 1; + } } if (updateData(curItem.id, curItem.data)) { sendToWebContent("mainWindow", "onUpdateOpenInfo", { id: curItem.id, openNumber: curItem.data.openNumber, lastOpen: curItem.data.lastOpen, - quickSearchOpenNumber: curItem.data.quickSearchOpenNumber, quickSearchLastOpen: curItem.data.quickSearchLastOpen, type, }); @@ -320,7 +321,7 @@ function updateOpenInfo(type: string, id: number) { function run( type: string, operation: "open" | "runas" | "openFileLocation" | "explore", - item: Item + item: Item, ) { if (item.data) { if (operation === "open" && item.data.runAsAdmin) { @@ -356,7 +357,7 @@ function run( operation, item.data.target, item.data.params ?? "", - item.data.startLocation + item.data.startLocation, ); } } catch (e) { @@ -495,7 +496,7 @@ function refreshIcon(idList: Array) { } // 发送消息到页面 sendToWebContent("mainWindow", "onRefreshItemIcon", itemList); - } + }, ); } @@ -533,7 +534,7 @@ function getDirectoryList( dir: string | null, hiddenItems: string | null, listen: boolean, - clear: boolean + clear: boolean, ) { // 校验目录 if (!dir || dir.trim() === "") { @@ -578,7 +579,7 @@ function getDirectoryList( classificationId, }); } - } + }, ); } @@ -671,7 +672,6 @@ function checkInvalid() { function clearOpenInfo(item: Item) { item.data.openNumber = 0; item.data.lastOpen = 0; - item.data.quickSearchOpenNumber = 0; item.data.quickSearchLastOpen = 0; } @@ -685,20 +685,17 @@ function deleteQuickSearchHistory(itemId: number) { if (item) { // 重置历史记录 item.data.quickSearchLastOpen = 0; - item.data.quickSearchOpenNumber = 0; // 更新 updateData(itemId, item.data); // 通知主页面 sendToWebContent("mainWindow", "onUpdateOpenInfo", { id: itemId, - quickSearchOpenNumber: item.data.quickSearchOpenNumber, quickSearchLastOpen: item.data.quickSearchLastOpen, type: "quickSearch", }); // 通知快速搜索页面 sendToWebContent("quickSearchWindow", "onUpdateOpenInfo", { id: itemId, - quickSearchOpenNumber: item.data.quickSearchOpenNumber, quickSearchLastOpen: item.data.quickSearchLastOpen, }); } @@ -711,7 +708,7 @@ function deleteQuickSearchHistory(itemId: number) { */ async function getDropItemInfo( classificationId: number, - pathList: Array + pathList: Array, ) { // 项目列表 let itemList: Array = []; diff --git a/src/pages/item/components/Content.vue b/src/pages/item/components/Content.vue index 3b6d8a3..e835ca8 100644 --- a/src/pages/item/components/Content.vue +++ b/src/pages/item/components/Content.vue @@ -20,7 +20,7 @@ >
{ // 设置项目宽度 setItemWidth(); }); - }) + }), ); // 监听更新项目 listens.push( @@ -729,7 +729,7 @@ onMounted(() => { // 设置项目宽度 setItemWidth(); }); - }) + }), ); // 监听删除项目 listens.push( @@ -749,7 +749,7 @@ onMounted(() => { // 设置项目宽度 setItemWidth(); }); - }) + }), ); // 监听锁定/解锁项目 listens.push( @@ -766,7 +766,7 @@ onMounted(() => { // 创建项目拖拽对象 createItemSortable(); }); - }) + }), ); // 监听批量操作 listens.push( @@ -778,7 +778,7 @@ onMounted(() => { // 创建项目拖拽对象 createItemSortable(); }); - }) + }), ); // 监听转换路径 listens.push( @@ -795,7 +795,7 @@ onMounted(() => { } // 清空批量操作 clearBatchOperation(); - }) + }), ); // 监听刷新图标 listens.push( @@ -813,7 +813,7 @@ onMounted(() => { } // 清空批量操作 clearBatchOperation(); - }) + }), ); // 监听移动项目 listens.push( @@ -828,7 +828,7 @@ onMounted(() => { // 创建项目拖拽对象 createItemSortable(); }); - }) + }), ); // 监听批量操作全选 listens.push( @@ -839,7 +839,7 @@ onMounted(() => { hasChildClassification(store.selectedClassificationParentId) ) { let classificationList = getClassificationChildList( - store.selectedClassificationParentId + store.selectedClassificationParentId, ); for (const classification of classificationList) { if (classification.type === 0) { @@ -857,7 +857,7 @@ onMounted(() => { let classification = getClassificationById(classificationId); if (classification && classification.type === 0) { let itemList = getItemListByClassificationId( - getSelectedClassificationId() + getSelectedClassificationId(), ); for (const item of itemList) { if (!store.itemBatchOperationDataArray.includes(item.id)) { @@ -867,14 +867,14 @@ onMounted(() => { } } } - }) + }), ); // 监听项目右键菜单关闭 listens.push( window.item.onRightMenuClose((data) => { store.itemRightMenuItemId = null; store.searchItemRightMenuItemId = null; - }) + }), ); // 监听项目资源管理器菜单 listens.push( @@ -884,14 +884,14 @@ onMounted(() => { } else if (data.type === "search") { store.searchItemRightMenuItemId = data.id; } - }) + }), ); // 监听取消项目拖拽 listens.push( window.item.onCancelDragOut((data) => { store.itemDragOutData = null; store.itemDragOut = false; - }) + }), ); // 监听更新打开次数 listens.push( @@ -902,17 +902,17 @@ onMounted(() => { item.data.openNumber = data.openNumber; item.data.lastOpen = data.lastOpen; } else if (data.type === "quickSearch") { - item.data.quickSearchOpenNumber = data.quickSearchOpenNumber; + item.data.openNumber = data.openNumber; item.data.quickSearchLastOpen = data.quickSearchLastOpen; } } - }) + }), ); // 监听无效项目 listens.push( window.item.onCheckInvalid((data) => { store.invalidItemIdList = data; - }) + }), ); }); // unmounted diff --git a/src/pages/item/js/index.ts b/src/pages/item/js/index.ts index 100d3f2..2b831fc 100644 --- a/src/pages/item/js/index.ts +++ b/src/pages/item/js/index.ts @@ -557,7 +557,6 @@ function sort( | "initial" | "openNumber" | "lastOpen" - | "quickSearchOpenNumber" | "quickSearchLastOpen", ) { if (type === "initial") { @@ -609,7 +608,6 @@ function sort( } else if ( type === "openNumber" || type === "lastOpen" || - type === "quickSearchOpenNumber" || type === "quickSearchLastOpen" ) { return list @@ -781,7 +779,7 @@ function getItemTitle(item: Item, quickSearch: boolean = false) { "\n" + store.language.openCount + store.language.colon + - (item.data.quickSearchOpenNumber ?? 0); + (item.data.openNumber ?? 0); } else if (store.setting.item.openNumber) { name += "\n" + diff --git a/src/pages/search/QuickSearch.vue b/src/pages/search/QuickSearch.vue index 2926c7a..73344b0 100644 --- a/src/pages/search/QuickSearch.vue +++ b/src/pages/search/QuickSearch.vue @@ -69,7 +69,7 @@ store.quickSearchItemRightMenuItemId === item.id ? hexToRGBA( store.setting.appearance.theme.secondBackgroundColor, - 0.3 + 0.3, ) : undefined, }" @@ -77,7 +77,7 @@ :index="index" :target="item.data.target" > - + {{ getName(item.name) }} value.value, () => { search(); - } + }, ); // 搜索 function search() { @@ -246,8 +246,8 @@ function refresh() { !resultList.value || resultList.value.length === 0 ? 0 : resultList.value.length > 9 - ? 10 * 48 + 1 - : resultList.value.length * 48 + 1; + ? 10 * 48 + 1 + : resultList.value.length * 48 + 1; window.quickSearch.setWindowHeight(height + 44); }); } @@ -271,7 +271,7 @@ function resetScroll() { function getData() { // 分类 store.classificationList = convertClassificationList( - window.classification.list() + window.classification.list(), ); // 项目 store.itemMap = convertItemList(window.item.list()); @@ -280,7 +280,7 @@ function getData() { // 搜索Map searchMap = getItemSearchMap( itemList, - store.setting.quickSearch.matchConditionsRemark + store.setting.quickSearch.matchConditionsRemark, ); // 历史记录 getHistory(); @@ -292,7 +292,7 @@ function getHistory() { let itemList: Array = filterExcludeSearchItemList().filter((item) => { if ( store.setting.quickSearch.showHistorySort === "openNumber" && - item.data.quickSearchOpenNumber > 0 + item.data.openNumber > 0 ) { return true; } else if ( @@ -307,8 +307,8 @@ function getHistory() { let sortList = sort( itemList, store.setting.quickSearch.showHistorySort === "openNumber" - ? "quickSearchOpenNumber" - : "quickSearchLastOpen" + ? "openNumber" + : "quickSearchLastOpen", ); if (sortList && sortList.length > 0) { // 截取数据 @@ -712,7 +712,7 @@ onMounted(() => { // 显示窗口 window.quickSearch.showWindow(); }, 10); - }) + }), ); // 清空数据 listens.push( @@ -723,14 +723,14 @@ onMounted(() => { selected.value = 0; mode.value = "search"; webSearchSource.value = null; - }) + }), ); // 监听项目右键菜单关闭 listens.push( window.item.onRightMenuClose((data) => { store.quickSearchItemRightMenuItemId = null; itemAllRemoveStyle("item", selected.value); - }) + }), ); // 监听项目资源管理器菜单 listens.push( @@ -738,18 +738,18 @@ onMounted(() => { if (data.type === "quickSearch") { store.quickSearchItemRightMenuItemId = data.id; } - }) + }), ); - // 删除历史记录 + // 监听更新打开信息 listens.push( window.item.onUpdateOpenInfo((data) => { let item = getItemById(data.id); if (item) { - item.data.quickSearchOpenNumber = data.quickSearchOpenNumber; + item.data.openNumber = data.openNumber; item.data.quickSearchLastOpen = data.quickSearchLastOpen; } getHistory(); - }) + }), ); }); // unmounted diff --git a/types/item.d.ts b/types/item.d.ts index ac92ab0..468aa8d 100644 --- a/types/item.d.ts +++ b/types/item.d.ts @@ -66,8 +66,6 @@ export interface ItemData { openNumber: number; // 最后打开时间 lastOpen: number; - // 快速搜索-打开次数 - quickSearchOpenNumber: number; // 快速搜索-最后打开时间 quickSearchLastOpen: number; // 多项目时间间隔(毫秒)