Compare commits

...
2 Commits
Author SHA1 Message Date
jimmy 014e7c01fa U:调整部分报错以及页面展示 2025-12-12 10:20:48 +08:00
jimmy 6fe0569d44 A:增加路径先选择功能 2025-12-12 10:17:23 +08:00
9 changed files with 234 additions and 28 deletions

No files matched your search

+1
View File
@@ -11,6 +11,7 @@
},
"dependencies": {
"@tauri-apps/api": "^2",
"@tauri-apps/plugin-dialog": "^2.4.2",
"@tauri-apps/plugin-opener": "^2",
"@vicons/ionicons5": "^0.13.0",
"axios": "^1.13.2",
+10
View File
@@ -11,6 +11,9 @@ importers:
'@tauri-apps/api':
specifier: ^2
version: 2.9.1
'@tauri-apps/plugin-dialog':
specifier: ^2.4.2
version: 2.4.2
'@tauri-apps/plugin-opener':
specifier: ^2
version: 2.5.2
@@ -452,6 +455,9 @@ packages:
engines: {node: '>= 10'}
hasBin: true
'@tauri-apps/plugin-dialog@2.4.2':
resolution: {integrity: sha512-lNIn5CZuw8WZOn8zHzmFmDSzg5zfohWoa3mdULP0YFh/VogVdMVWZPcWSHlydsiJhRQYaTNSYKN7RmZKE2lCYQ==}
'@tauri-apps/plugin-opener@2.5.2':
resolution: {integrity: sha512-ei/yRRoCklWHImwpCcDK3VhNXx+QXM9793aQ64YxpqVF0BDuuIlXhZgiAkc15wnPVav+IbkYhmDJIv5R326Mew==}
@@ -1130,6 +1136,10 @@ snapshots:
'@tauri-apps/cli-win32-ia32-msvc': 2.9.5
'@tauri-apps/cli-win32-x64-msvc': 2.9.5
'@tauri-apps/plugin-dialog@2.4.2':
dependencies:
'@tauri-apps/api': 2.9.1
'@tauri-apps/plugin-opener@2.5.2':
dependencies:
'@tauri-apps/api': 2.9.1
+183 -1
View File
@@ -171,6 +171,7 @@ dependencies = [
"sysinfo",
"tauri",
"tauri-build",
"tauri-plugin-dialog",
"tauri-plugin-opener",
"tokio",
"uuid",
@@ -193,6 +194,27 @@ dependencies = [
"stable_deref_trait",
]
[[package]]
name = "ashpd"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6cbdf310d77fd3aaee6ea2093db7011dc2d35d2eb3481e5607f1f8d942ed99df"
dependencies = [
"enumflags2",
"futures-channel",
"futures-util",
"rand 0.9.2",
"raw-window-handle",
"serde",
"serde_repr",
"tokio",
"url",
"wayland-backend",
"wayland-client",
"wayland-protocols",
"zbus",
]
[[package]]
name = "async-broadcast"
version = "0.7.2"
@@ -1089,6 +1111,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89a09f22a6c6069a18470eb92d2298acf25463f14256d24778e1230d789a2aec"
dependencies = [
"bitflags 2.10.0",
"block2 0.6.2",
"libc",
"objc2 0.6.3",
]
@@ -1103,6 +1127,15 @@ dependencies = [
"syn 2.0.111",
]
[[package]]
name = "dlib"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412"
dependencies = [
"libloading",
]
[[package]]
name = "dlopen2"
version = "0.8.2"
@@ -1132,6 +1165,12 @@ version = "0.15.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b"
[[package]]
name = "downcast-rs"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2"
[[package]]
name = "dpi"
version = "0.1.2"
@@ -3639,7 +3678,7 @@ checksum = "740ebea15c5d1428f910cd1a5f52cebf8d25006245ed8ade92702f4943d91e07"
dependencies = [
"base64 0.22.1",
"indexmap 2.12.1",
"quick-xml",
"quick-xml 0.38.4",
"serde",
"time",
]
@@ -3840,6 +3879,15 @@ version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"
[[package]]
name = "quick-xml"
version = "0.37.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "331e97a1af0bf59823e6eadffe373d7b27f485be8748f71471c662c1f269b7fb"
dependencies = [
"memchr",
]
[[package]]
name = "quick-xml"
version = "0.38.4"
@@ -4154,6 +4202,31 @@ dependencies = [
"web-sys",
]
[[package]]
name = "rfd"
version = "0.15.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef2bee61e6cffa4635c72d7d81a84294e28f0930db0ddcb0f66d10244674ebed"
dependencies = [
"ashpd",
"block2 0.6.2",
"dispatch2",
"glib-sys",
"gobject-sys",
"gtk-sys",
"js-sys",
"log",
"objc2 0.6.3",
"objc2-app-kit",
"objc2-core-foundation",
"objc2-foundation 0.3.2",
"raw-window-handle",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
"windows-sys 0.59.0",
]
[[package]]
name = "rgb"
version = "0.8.52"
@@ -4274,6 +4347,12 @@ dependencies = [
"syn 2.0.111",
]
[[package]]
name = "scoped-tls"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"
[[package]]
name = "scopeguard"
version = "1.2.0"
@@ -5168,6 +5247,46 @@ dependencies = [
"walkdir",
]
[[package]]
name = "tauri-plugin-dialog"
version = "2.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "313f8138692ddc4a2127c4c9607d616a46f5c042e77b3722450866da0aad2f19"
dependencies = [
"log",
"raw-window-handle",
"rfd",
"serde",
"serde_json",
"tauri",
"tauri-plugin",
"tauri-plugin-fs",
"thiserror 2.0.17",
"url",
]
[[package]]
name = "tauri-plugin-fs"
version = "2.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47df422695255ecbe7bac7012440eddaeefd026656171eac9559f5243d3230d9"
dependencies = [
"anyhow",
"dunce",
"glob",
"percent-encoding",
"schemars 0.8.22",
"serde",
"serde_json",
"serde_repr",
"tauri",
"tauri-plugin",
"tauri-utils",
"thiserror 2.0.17",
"toml 0.9.8",
"url",
]
[[package]]
name = "tauri-plugin-opener"
version = "2.5.2"
@@ -5439,6 +5558,7 @@ dependencies = [
"signal-hook-registry",
"socket2",
"tokio-macros",
"tracing",
"windows-sys 0.61.2",
]
@@ -5995,6 +6115,66 @@ dependencies = [
"web-sys",
]
[[package]]
name = "wayland-backend"
version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "673a33c33048a5ade91a6b139580fa174e19fb0d23f396dca9fa15f2e1e49b35"
dependencies = [
"cc",
"downcast-rs",
"rustix",
"scoped-tls",
"smallvec",
"wayland-sys",
]
[[package]]
name = "wayland-client"
version = "0.31.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c66a47e840dc20793f2264eb4b3e4ecb4b75d91c0dd4af04b456128e0bdd449d"
dependencies = [
"bitflags 2.10.0",
"rustix",
"wayland-backend",
"wayland-scanner",
]
[[package]]
name = "wayland-protocols"
version = "0.32.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efa790ed75fbfd71283bd2521a1cfdc022aabcc28bdcff00851f9e4ae88d9901"
dependencies = [
"bitflags 2.10.0",
"wayland-backend",
"wayland-client",
"wayland-scanner",
]
[[package]]
name = "wayland-scanner"
version = "0.31.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54cb1e9dc49da91950bdfd8b848c49330536d9d1fb03d4bfec8cae50caa50ae3"
dependencies = [
"proc-macro2",
"quick-xml 0.37.5",
"quote",
]
[[package]]
name = "wayland-sys"
version = "0.31.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34949b42822155826b41db8e5d0c1be3a2bd296c747577a43a3e6daefc296142"
dependencies = [
"dlib",
"log",
"pkg-config",
]
[[package]]
name = "web-sys"
version = "0.3.83"
@@ -6760,6 +6940,7 @@ dependencies = [
"ordered-stream",
"serde",
"serde_repr",
"tokio",
"tracing",
"uds_windows",
"uuid",
@@ -7009,6 +7190,7 @@ dependencies = [
"endi",
"enumflags2",
"serde",
"url",
"winnow 0.7.14",
"zvariant_derive",
"zvariant_utils",
+1
View File
@@ -34,3 +34,4 @@ sysinfo = "0.37.2"
notify = { version = "8.2.0", features = ["serde"] }
image = "0.25.9"
base64 = "0.22.1"
tauri-plugin-dialog = "2.4.2"
@@ -5,6 +5,7 @@
"windows": ["main"],
"permissions": [
"core:default",
"opener:default"
"opener:default",
"dialog:default"
]
}
+1
View File
@@ -370,6 +370,7 @@ async fn debug_process_file(
pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_opener::init())
.plugin(tauri_plugin_dialog::init())
.manage(WatcherState {
watcher: Mutex::new(None),
})
+1 -1
View File
@@ -2,7 +2,7 @@
:root {
/* 布局尺寸变量 */
--header-height: 64px;
--sidebar-width: 290px;
--sidebar-width: 220px;
--sidebar-collapsed-width: 64px;
/* 间距变量 */
+19 -15
View File
@@ -8,7 +8,6 @@
<n-icon size="32" class="logo-icon">
<img src="@/assets/logo.svg" alt="logo" />
</n-icon>
<!-- 使用 v-show 避免折叠时文字换行导致的跳动 -->
<span class="site-title" v-show="!collapsed">Argus</span>
</router-link>
@@ -36,14 +35,14 @@
</header>
<!-- 主体布局 (Flex Container) -->
<div class="app-body">
<!-- 改回 n-layout 以满足 n-layout-sider 的依赖,但强制使用 flex 布局 -->
<n-layout has-sider class="app-body">
<!-- 左侧导航栏 -->
<!-- 注意:这里保留 n-layout-sider 是为了利用它的折叠动画和样式 -->
<n-layout-sider
bordered
collapse-mode="width"
:collapsed-width="64"
:width="290"
:width="220"
:native-scrollbar="false"
class="app-sider"
v-model:collapsed="collapsed"
@@ -67,14 +66,14 @@
<router-view />
</div>
</main>
</div>
</n-layout>
</div>
</template>
<script lang="ts" setup>
import { ref, watch, computed, h, onMounted } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import { NMenu, NIcon, NLayoutSider, NInput } from 'naive-ui'
import { NMenu, NIcon, NLayout, NLayoutSider, NInput } from 'naive-ui'
import ThemeToggle from '@/components/ThemeToggle.vue'
import { useThemeStore } from '@/stores/theme'
import {
@@ -227,8 +226,9 @@ const handleMenuSelect = (key: string) => {
.header-left {
display: flex;
align-items: center;
width: 200px; /* 固定宽度避免折叠时右侧内容跳动 */
width: 200px;
cursor: pointer;
overflow: hidden;
}
.logo-icon {
@@ -265,28 +265,32 @@ const handleMenuSelect = (key: string) => {
gap: 12px;
}
/* 关键布局区域 */
.app-body {
/* 强制覆盖 n-layout 的默认样式,确保 Flex 生效 */
:deep(.n-layout.app-body) {
flex: 1;
display: flex;
flex-direction: row;
display: flex !important;
flex-direction: row !important;
overflow: hidden; /* 防止body本身滚动 */
background-color: transparent; /* 透视背景 */
}
/* 侧边栏 */
.app-sider {
height: 100%; /* 撑满 body 高度 */
height: 100%;
background-color: var(--sidebar-bg);
/* n-layout-sider 内部会自动处理 overflow */
/* 确保 sider 自身不收缩 */
flex-shrink: 0;
}
/* 内容区 */
.app-content {
flex: 1;
height: 100%;
overflow: hidden; /* 内部滚动 */
overflow: hidden;
background-color: var(--content-bg);
position: relative;
/* 确保内容区可以收缩 */
min-width: 0;
}
.content-wrapper {
@@ -307,4 +311,4 @@ const handleMenuSelect = (key: string) => {
:deep(.n-layout-sider--collapsed .n-menu-item) {
margin-right: 0;
}
</style>
</style>
+16 -10
View File
@@ -5,7 +5,7 @@ import { CloseOutline, FolderOutline, CheckmarkCircle, EllipseOutline } from '@v
import { onMounted, ref } from 'vue'
import { NSpace, NInput, NButton, NIcon, NTag, NCard, NEmpty, useMessage } from 'naive-ui'
import type { LibraryTable } from '@/model/libraryTable.ts'
// import { open } from '@tauri-apps/plugin-dialog'; // Need to install this plugin for directory selection
import { open } from '@tauri-apps/plugin-dialog';
// 消息提示
const message = useMessage()
@@ -24,15 +24,21 @@ const libraryPaths = ref<LibraryPath[]>([])
// 选择文件夹
const selectFolder = async () => {
// TODO: Install @tauri-apps/plugin-dialog and use open({ directory: true })
// const selected = await open({
// directory: true,
// multiple: false,
// });
// if (selected) {
// inputPath.value = selected as string;
// }
message.info('Feature requires @tauri-apps/plugin-dialog. Please type path for now.');
try {
const selected = await open({
directory: true,
multiple: false,
});
if (selected) {
// open returns string | string[] | null
// Since multiple is false, it returns string | null
inputPath.value = selected as string;
}
} catch (error) {
console.error('Failed to select folder:', error);
message.error('选择文件夹失败');
}
}
// 添加路径