feat: 实现初始应用结构,包含主导航、仪表盘、文件管理页面和WebSocket服务。
This commit is contained in:
parent
3f42c0c675
commit
ec7c5a1e23
@ -56,6 +56,13 @@
|
||||
>
|
||||
<i class="fas fa-exchange-alt"></i>格式转换
|
||||
</button>
|
||||
<button
|
||||
class="nav-item"
|
||||
:class="{ active: currentPage === PAGE_TYPES.FILE_MANAGEMENT }"
|
||||
@click="handleNavClick(PAGE_TYPES.FILE_MANAGEMENT)"
|
||||
>
|
||||
<i class="fas fa-folder"></i>文件管理
|
||||
</button>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
||||
1009
src/components/pages/FileManagementPage.vue
Normal file
1009
src/components/pages/FileManagementPage.vue
Normal file
File diff suppressed because it is too large
Load Diff
@ -11,7 +11,8 @@ export const PAGE_TYPES = {
|
||||
HIERARCHY_DELETION_PARAMS: 'hierarchy-deletion-params',
|
||||
GEOMETRY_COMPLEXITY_RESULT: 'geometry-complexity-result',
|
||||
GEOMETRY_OPTIMIZATION_PARAMS: 'geometry-optimization-params',
|
||||
GEOMETRY_OPTIMIZATION_RESULT: 'geometry-optimization-result'
|
||||
GEOMETRY_OPTIMIZATION_RESULT: 'geometry-optimization-result',
|
||||
FILE_MANAGEMENT: 'file-management'
|
||||
}
|
||||
|
||||
// 需要CAD连接的页面
|
||||
|
||||
@ -29,7 +29,12 @@ class WebSocketService {
|
||||
onSoftwareUpdate: [],
|
||||
onLogUpdate: [],
|
||||
onStatsUpdate: [],
|
||||
onOperationTypesUpdate: []
|
||||
onOperationTypesUpdate: [],
|
||||
onFileListUpdate: [],
|
||||
onDownloadUrl: [],
|
||||
onRenameStrategies: [],
|
||||
onRenamePreview: [],
|
||||
onRenameResult: []
|
||||
}
|
||||
|
||||
}
|
||||
@ -185,6 +190,30 @@ class WebSocketService {
|
||||
if (message.data.connected_users) {
|
||||
this.connectedUsers = message.data.connected_users
|
||||
}
|
||||
if (message.data.connected_users) {
|
||||
this.connectedUsers = message.data.connected_users
|
||||
}
|
||||
|
||||
// 文件管理相关消息处理
|
||||
if (message.data.files) {
|
||||
this.emit('onFileListUpdate', message.data)
|
||||
}
|
||||
|
||||
if (message.data.download_url) {
|
||||
this.emit('onDownloadUrl', message.data)
|
||||
}
|
||||
|
||||
if (message.data.strategies) {
|
||||
this.emit('onRenameStrategies', message.data.strategies)
|
||||
}
|
||||
|
||||
if (message.data.preview) {
|
||||
this.emit('onRenamePreview', message.data)
|
||||
}
|
||||
|
||||
if (message.data.results) {
|
||||
this.emit('onRenameResult', message.data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -324,6 +353,54 @@ class WebSocketService {
|
||||
return this.send({ type: 'get_operation_types' })
|
||||
}
|
||||
|
||||
// --- 文件管理 API ---
|
||||
|
||||
// 获取文件列表
|
||||
getFileList() {
|
||||
return this.send({ type: 'get_file_list' })
|
||||
}
|
||||
|
||||
// 请求单个文件下载链接
|
||||
downloadFile(filePath) {
|
||||
return this.send({
|
||||
type: 'download_file',
|
||||
file_path: filePath
|
||||
})
|
||||
}
|
||||
|
||||
// 请求批量文件下载链接
|
||||
downloadBatch(filePaths) {
|
||||
return this.send({
|
||||
type: 'download_batch',
|
||||
file_paths: filePaths
|
||||
})
|
||||
}
|
||||
|
||||
// 获取重命名策略
|
||||
getRenameStrategies() {
|
||||
return this.send({ type: 'get_rename_strategies' })
|
||||
}
|
||||
|
||||
// 预览重命名
|
||||
previewRename(filePaths, strategy, params) {
|
||||
return this.send({
|
||||
type: 'preview_rename',
|
||||
file_paths: filePaths,
|
||||
strategy: strategy,
|
||||
params: params
|
||||
})
|
||||
}
|
||||
|
||||
// 执行文件重命名
|
||||
renameFiles(filePaths, strategy, params) {
|
||||
return this.send({
|
||||
type: 'rename_files',
|
||||
file_paths: filePaths,
|
||||
strategy: strategy,
|
||||
params: params
|
||||
})
|
||||
}
|
||||
|
||||
// 心跳检测
|
||||
startHeartbeat() {
|
||||
this.heartbeatTimer = setInterval(() => {
|
||||
|
||||
@ -65,6 +65,7 @@ import HierarchyDeletionParamsPage from '@/components/pages/HierarchyDeletionPar
|
||||
import GeometryComplexityResult from '@/components/pages/GeometryComplexityResult.vue'
|
||||
import GeometryOptimizationParams from '@/components/pages/GeometryOptimizationParams.vue'
|
||||
import GeometryOptimizationResult from '@/components/pages/GeometryOptimizationResult.vue'
|
||||
import FileManagementPage from '@/components/pages/FileManagementPage.vue'
|
||||
import InfoManagementPanel from '@/components/layout/InfoManagementPanel.vue'
|
||||
import { PAGE_TYPES } from '@/config/pages'
|
||||
|
||||
@ -108,7 +109,8 @@ const pageComponentMap = {
|
||||
[PAGE_TYPES.HIERARCHY_DELETION_PARAMS]: HierarchyDeletionParamsPage,
|
||||
[PAGE_TYPES.GEOMETRY_COMPLEXITY_RESULT]: GeometryComplexityResult,
|
||||
[PAGE_TYPES.GEOMETRY_OPTIMIZATION_PARAMS]: GeometryOptimizationParams,
|
||||
[PAGE_TYPES.GEOMETRY_OPTIMIZATION_RESULT]: GeometryOptimizationResult
|
||||
[PAGE_TYPES.GEOMETRY_OPTIMIZATION_RESULT]: GeometryOptimizationResult,
|
||||
[PAGE_TYPES.FILE_MANAGEMENT]: FileManagementPage
|
||||
}
|
||||
|
||||
// 当前组件computed
|
||||
|
||||
1007
websocket-file-api-docs.md
Normal file
1007
websocket-file-api-docs.md
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user