From 731054d3717790f68f776563a2e9ce6f3cbe4596 Mon Sep 17 00:00:00 2001 From: tiantian <1012874180@qq.com> Date: Sat, 28 Dec 2024 17:13:04 +0800 Subject: [PATCH] =?UTF-8?q?add:=E7=A7=BB=E5=8A=A8=E7=AB=AF=E9=80=82?= =?UTF-8?q?=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/App.vue | 12 ++--- frontend/src/components/builtin/FileList.vue | 42 ++++++++++++++- frontend/src/components/desktop/DeskItem.vue | 54 +++++++++++++++---- frontend/src/components/desktop/Desktop.vue | 17 +++--- .../src/components/window/MobileTemplate.vue | 19 +++++++ frontend/src/components/window/WindowNode.vue | 7 ++- 6 files changed, 120 insertions(+), 31 deletions(-) create mode 100644 frontend/src/components/window/MobileTemplate.vue diff --git a/frontend/src/App.vue b/frontend/src/App.vue index d97316e..80c8d84 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -1,18 +1,18 @@ diff --git a/frontend/src/components/builtin/FileList.vue b/frontend/src/components/builtin/FileList.vue index 4856712..d6fd186 100644 --- a/frontend/src/components/builtin/FileList.vue +++ b/frontend/src/components/builtin/FileList.vue @@ -32,7 +32,7 @@ @touchstart.passive="doubleTouch($event, item)" @contextmenu.stop.prevent="handleRightClick($event, item, index)" @drop="hadnleDrop($event, item.path)" @dragenter.prevent="handleDragEnter(index)" @dragover.prevent @dragleave="handleDragLeave()" - @dragstart.stop="startDragApp($event, item)" @click="handleClick(index)" @mousedown.stop :ref="(ref: any) => { + @dragstart.stop="startDragApp($event, item)" @click="handleClick(index, item)" @mousedown.stop :ref="(ref: any) => { if (ref) { appPositions[index] = markRaw(ref as Element); } @@ -130,6 +130,7 @@ function getName(item: any) { return name; } } + function handleOnOpen(item: OsFileWithoutContent) { // props.onOpen(item); // emitEvent('desktop.app.open'); @@ -199,10 +200,16 @@ const hoverIndex = ref(-1); const appPositions = ref>([]); const chosenIndexs = ref>([]); -function handleClick(index: number) { +import { isMobileDevice } from "@/util/device"; +const isMobile = ref(false); +function handleClick(index: number, item: OsFileWithoutContent) { chosenIndexs.value = [index]; + if (isMobile.value) { + handleOnOpen(item) + } } onMounted(() => { + isMobile.value = isMobileDevice(); chosenIndexs.value = []; props.onChosen( throttle((rect: Rect) => { @@ -651,4 +658,35 @@ function handleDragLeave() { background-color: unset; user-select: none; } + +@media screen and (max-width: 768px) { + .file-item { + height: vh(70); + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + overflow: hidden; + + &:hover { + background-color: transparent; + } + + .icon { + width: vw(40); + height: vh(40); + } + + .title { + font-size: vw(12); + text-align: center; + } + } + + .chosen { + background-color: transparent; + border: 1px solid transparent; + } + +} diff --git a/frontend/src/components/desktop/DeskItem.vue b/frontend/src/components/desktop/DeskItem.vue index cc09e00..098574a 100644 --- a/frontend/src/components/desktop/DeskItem.vue +++ b/frontend/src/components/desktop/DeskItem.vue @@ -1,10 +1,15 @@ + + \ No newline at end of file diff --git a/frontend/src/components/window/WindowNode.vue b/frontend/src/components/window/WindowNode.vue index feda054..086b7dd 100644 --- a/frontend/src/components/window/WindowNode.vue +++ b/frontend/src/components/window/WindowNode.vue @@ -1,14 +1,13 @@