From 6b4405d127139cd4513f89a777045e14ce2c8724 Mon Sep 17 00:00:00 2001 From: prr <3099672575@qq.com> Date: Mon, 28 Oct 2024 18:59:23 +0800 Subject: [PATCH] =?UTF-8?q?test:=E5=85=B1=E4=BA=AB=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/components.d.ts | 2 + frontend/src/components/builtin/FileIcon.vue | 9 +- frontend/src/components/builtin/FileList.vue | 2 +- frontend/src/components/builtin/FileTree.vue | 4 +- .../src/components/builtin/ShareFileTree.vue | 239 ++++++++++++++++++ frontend/src/components/computer/Computer.vue | 84 +++--- frontend/src/components/oa/ShareFiles.vue | 2 + frontend/src/hook/useComputer.ts | 24 +- frontend/src/hook/useContextMenu.ts | 4 + frontend/src/i18n/index.ts | 4 +- frontend/src/i18n/lang/zh.json | 2 + frontend/src/system/core/FileOs.ts | 82 ++++-- frontend/src/system/index.ts | 42 +-- 13 files changed, 416 insertions(+), 84 deletions(-) create mode 100644 frontend/src/components/builtin/ShareFileTree.vue diff --git a/frontend/components.d.ts b/frontend/components.d.ts index f9b873b..35ff343 100644 --- a/frontend/components.d.ts +++ b/frontend/components.d.ts @@ -55,6 +55,7 @@ declare module 'vue' { ElCarousel: typeof import('element-plus/es')['ElCarousel'] ElCarouselItem: typeof import('element-plus/es')['ElCarouselItem'] ElCheckbox: typeof import('element-plus/es')['ElCheckbox'] + ElCion: typeof import('element-plus/es')['ElCion'] ElCol: typeof import('element-plus/es')['ElCol'] ElColorPicker: typeof import('element-plus/es')['ElColorPicker'] ElContainer: typeof import('element-plus/es')['ElContainer'] @@ -134,6 +135,7 @@ declare module 'vue' { Setting: typeof import('./src/components/setting/Setting.vue')['default'] SetUpdate: typeof import('./src/components/setting/SetUpdate.vue')['default'] ShareFiles: typeof import('./src/components/oa/ShareFiles.vue')['default'] + ShareFileTree: typeof import('./src/components/builtin/ShareFileTree.vue')['default'] ShowNews: typeof import('./src/components/taskbar/ShowNews.vue')['default'] StartMenu: typeof import('./src/components/taskbar/StartMenu.vue')['default'] StartOption: typeof import('./src/components/taskbar/StartOption.vue')['default'] diff --git a/frontend/src/components/builtin/FileIcon.vue b/frontend/src/components/builtin/FileIcon.vue index 91f7ac0..6ad4dd7 100644 --- a/frontend/src/components/builtin/FileIcon.vue +++ b/frontend/src/components/builtin/FileIcon.vue @@ -4,7 +4,7 @@ -
+
ln
@@ -24,7 +24,6 @@ if(props.icon && props.icon.indexOf('.') !== -1){ isSvg.value = false; } if(props.file && props.file.content) { - //console.log(props.file) if(typeof props.file.content === 'string') { const end = props.file.content.split("::").pop() if(end && end.indexOf('.') !== -1){ @@ -51,10 +50,10 @@ if(props.file && props.file.content) { } .ln-img { position: absolute; - top: 0; + bottom: 0; left: 0; - width: 100%; - height: 100%; + width: 80%; + height: 80%; } } diff --git a/frontend/src/components/builtin/FileList.vue b/frontend/src/components/builtin/FileList.vue index 8220aff..ca6f374 100644 --- a/frontend/src/components/builtin/FileList.vue +++ b/frontend/src/components/builtin/FileList.vue @@ -34,7 +34,7 @@ @dragleave="handleDragLeave()" @dragstart.stop="startDragApp($event, item)" @click="handleClick(index)" @mousedown.stop :ref="(ref: any) => { if (ref) { - appPositions[index] = markRaw(ref as Element); + appPositions[indeíx] = markRaw(ref as Element); } } "> diff --git a/frontend/src/components/builtin/FileTree.vue b/frontend/src/components/builtin/FileTree.vue index 3b89ddf..21c2994 100644 --- a/frontend/src/components/builtin/FileTree.vue +++ b/frontend/src/components/builtin/FileTree.vue @@ -52,8 +52,8 @@ import { useSystem,OsFileWithoutContent,basename } from '@/system/index.ts'; import { onMounted, ref } from 'vue'; import { dealSystemName } from '@/i18n'; // 分享 -import { getSystemConfig } from "@/system/config"; -const config = ref(getSystemConfig()) +// import { getSystemConfig } from "@/system/config"; +// const config = ref(getSystemConfig()) const sys = useSystem(); type FileWithOpen = OsFileWithoutContent & { diff --git a/frontend/src/components/builtin/ShareFileTree.vue b/frontend/src/components/builtin/ShareFileTree.vue new file mode 100644 index 0000000..d44c96a --- /dev/null +++ b/frontend/src/components/builtin/ShareFileTree.vue @@ -0,0 +1,239 @@ + + + diff --git a/frontend/src/components/computer/Computer.vue b/frontend/src/components/computer/Computer.vue index be5b83b..d39c5b8 100644 --- a/frontend/src/components/computer/Computer.vue +++ b/frontend/src/components/computer/Computer.vue @@ -42,8 +42,9 @@ :key="random" > -
{{ t("share") }}
- {{ t("share") }} + - +
@@ -162,6 +163,10 @@ const { refersh, createFolder, backFolder, openFolder, onComputerMount } = useCo readdir(path) { return system.fs.readdir(path); }, + sharedir(path) { + const val:number = system.getConfig('userInfo')?.id + return system.fs.sharedir(val,path) + }, exists(path) { return system.fs.exists(path); }, @@ -206,8 +211,44 @@ function leftHandleDown(e: MouseEvent) { } const rootFileList = ref>([]); -const shareFileList = ref>([]); +const shareFileList = ref>([ + { + ext: "", + isDirectory: true, + isFile: false, + isSymlink: false, + mode: 2147484141, + name: "myshare", + oldPath: "/F/myshare", + parentPath: "/F", + path: "/F/myshare", + title: "myshare", + size: 64, + mtime: "", + rdev: 0, + atime: "", + birthtime: "" + }, + { + ext: "", + isDirectory: true, + isFile: false, + isSymlink: false, + mode: 2147484141, + name: "othershare", + oldPath: "/F/othershare", + parentPath: "/F", + path: "/F/othershare", + title: "othershare", + size: 64, + mtime: "", + rdev: 0, + atime: "", + birthtime: "" + } +]); const random = ref(0); +const shareShow = ref(false) onMounted(() => { if (config) { router_url.value = config.path; @@ -227,24 +268,7 @@ onMounted(() => { random.value = random.value + 1; } }); - shareFileList.value = [{ - atime: "2024-10-21T18:25:12.936228381+08:00", - birthtime: "2024-10-21T18:25:12.936228381+08:00", - content: "", - ext: "", - isDirectory: true, - isFile: false, - isOpen: false, - isSymlink: false, - modTime: "2024-10-21T18:25:12.936228381+08:00", - mode: 2147484141, - name: "F", - oldPath: "/F", - parentPath: "/", - path: "/F", - size: 64, - title: "F" - }] + shareShow.value = system.getConfig('userType') === 'member' ? true : false }); function handleOuterClick() { @@ -271,17 +295,17 @@ const chosenView = ref("icon"); /**------树状列表打开------ */ const chosenTreePath = ref(""); async function onTreeOpen(path: string) { - chosenTreePath.value = path; - const file = await system.fs.stat(path); - + let file:any + // const file = await system.fs.stat(path); + if (path.substring(0,2) == '/F') { + file = path.indexOf('/F/myshare') !== -1 ? shareFileList.value[0] : shareFileList.value[1] + } else { + file = await system.fs.stat(path) + } if (file) { - console.log('此电脑:',file,path); - const temp = path.substr(0,2) == '/F' ? shareFileList.value[0] : file - openFolder(temp) - // openFolder(file); + openFolder(file); } - //console.log(path) router_url.value = path; } diff --git a/frontend/src/components/oa/ShareFiles.vue b/frontend/src/components/oa/ShareFiles.vue index 059fd9e..a201488 100644 --- a/frontend/src/components/oa/ShareFiles.vue +++ b/frontend/src/components/oa/ShareFiles.vue @@ -62,6 +62,8 @@ const onSubmit = async () => { temp.senderid = temp.senderid.toString() temp.receverid = temp.receverid.map((item:any) => item.toString()) const res = await fetchPost(apiUrl, new URLSearchParams(temp)) + console.log('分享文件:',res) + }