Compare commits

2 Commits
Author SHA1 Message Date
539943419 938dde4c1c feat: 屏蔽miaoDirectory底部工具栏,更新readme计划书 2024-09-01 04:18:41 +08:00
539943419 8e884eb178 feat: 优化代码表现 2024-09-01 03:39:50 +08:00
6 changed files with 63 additions and 68 deletions

No files matched your search

+4 -2
View File
@@ -1,13 +1,15 @@
## TODO list: ## TODO list:
| 任务 | 状态 | | 计划 | 状态 |
|---|---| |---|---|
| 拆分miaoDirectory | ✅ | | 拆分miaoDirectory | ✅ |
| 完善视频插件 | ✅ | | 完善视频插件 | ✅ |
| 完善PDF插件 | ✅ | | 完善PDF插件 | ✅ |
| 完善Code插件 | ✅ | | 完善Code插件 | ✅ |
| 实现miaoDirectory的搜索功能 | ❌ | | 实现miaoDirectory的搜索功能 | ✅ |
| 完善miaoDirectory的搜索功能 | ❌ | | 完善miaoDirectory的搜索功能 | ❌ |
| 实现miaoDirectory的排序功能 | ❌ |
| 完善图片浏览插件 | ❌ | | 完善图片浏览插件 | ❌ |
| VirtualDirectory更新时更新文件信息 | ❌ | | VirtualDirectory更新时更新文件信息 | ❌ |
| 创建音乐播放器组件(仿QQ音乐移动端吧) | ❌ |
| miaoDirectory的复制文件/文件夹功能 | ❌ | | miaoDirectory的复制文件/文件夹功能 | ❌ |
+20 -48
View File
@@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { h, onMounted, reactive, ref, shallowRef } from 'vue' import { h, onMounted, reactive, ref, shallowRef } from 'vue'
import { NIcon, NScrollbar, NDropdown, NQrCode } from 'naive-ui' import { NIcon, NScrollbar, NDropdown } from 'naive-ui'
import { import {
EyeOffOutline, EyeOffOutline,
EyeOutline, EyeOutline,
@@ -88,11 +88,11 @@ const openMenuOption = [
} }
] ]
const handleMenuSelect = (key: string) => { const handleMenuSelect = async (key: string) => {
if (key === 'share') { if (key === 'share') {
showModal.value = true showModal.value = true
modalData.value = { modalData.value = {
component: NQrCode, component: (await import('naive-ui/es/qr-code')).NQrCode,
props: { props: {
value: baseUrl, value: baseUrl,
size: 300, size: 300,
@@ -114,37 +114,21 @@ onMounted(() => {
<n-scrollbar x-scrollable> <n-scrollbar x-scrollable>
<div class="tabs-container"> <div class="tabs-container">
<transition-group name="tab"> <transition-group name="tab">
<div <div class="tab" v-for="(view, index) of views._views" :key="view.uid">
class="tab" <span class="tab-title" :title="view.title" @click="handleClickTitle(index)">
v-for="(view, index) of views._views"
:key="view.uid">
<span
class="tab-title"
:title="view.title"
@click="handleClickTitle(index)">
{{ {{
view.title.length > 5 && 0 view.title.length > 5 && 0
? `${view.title.substring(0, 5)}...` ? `${view.title.substring(0, 5)}...`
: view.title : view.title
}} }}
</span> </span>
<div <div class="tab-point" :style="{ backgroundColor: view.color }"></div>
class="tab-point"
:style="{ backgroundColor: view.color }"></div>
<div class="tab-control"> <div class="tab-control">
<n-icon <n-icon class="tag-control-icon icon" @click="view.switchShow()">
class="tag-control-icon icon" <EyeOutline v-show="view.visible" class="icon-inner" />
@click="view.switchShow()"> <EyeOffOutline v-show="!view.visible" class="icon-inner" />
<EyeOutline
v-show="view.visible"
class="icon-inner" />
<EyeOffOutline
v-show="!view.visible"
class="icon-inner" />
</n-icon> </n-icon>
<n-icon <n-icon class="tag-control-icon icon" @click="
class="tag-control-icon icon"
@click="
createView( createView(
view.component, view.component,
view.currentDirectories, view.currentDirectories,
@@ -154,9 +138,7 @@ onMounted(() => {
"> ">
<CopyOutline /> <CopyOutline />
</n-icon> </n-icon>
<n-icon <n-icon class="tag-control-icon icon" @click="deleteView(index)">
class="tag-control-icon icon"
@click="deleteView(index)">
<CloseOutline class="icon-inner" /> <CloseOutline class="icon-inner" />
</n-icon> </n-icon>
</div> </div>
@@ -166,10 +148,7 @@ onMounted(() => {
</n-scrollbar> </n-scrollbar>
<div class="view-controller-menu"> <div class="view-controller-menu">
<div class="view-controller-menu-item"> <div class="view-controller-menu-item">
<n-dropdown <n-dropdown trigger="click" :options="openMenuOption" @select="handleMenuSelect">
trigger="click"
:options="openMenuOption"
@select="handleMenuSelect">
<n-icon class="icon"> <n-icon class="icon">
<EllipsisVertical class="icon-inner" /> <EllipsisVertical class="icon-inner" />
</n-icon> </n-icon>
@@ -179,17 +158,10 @@ onMounted(() => {
</div> </div>
<div class="view-container"> <div class="view-container">
<transition-group name="page"> <transition-group name="page">
<div <div class="view-container-item" v-for="(view, index) of views._views" v-show="view.visible"
class="view-container-item"
v-for="(view, index) of views._views"
v-show="view.visible"
:key="view.uid"> :key="view.uid">
<component <component :is="view.component" v-model:current-directories="view.currentDirectories"
:is="view.component" v-model:current-files="view.currentFiles" :id="view.uid" :color="view.color"
v-model:current-directories="view.currentDirectories"
v-model:current-files="view.currentFiles"
:id="view.uid"
:color="view.color"
@exit="deleteView(index)"></component> @exit="deleteView(index)"></component>
</div> </div>
</transition-group> </transition-group>
@@ -197,10 +169,8 @@ onMounted(() => {
</div> </div>
<!-- 模态框展示,用来显示分享二维码,设置菜单之类的东西 --> <!-- 模态框展示,用来显示分享二维码,设置菜单之类的东西 -->
<MiaoMask v-model:show="showModal" @click="showModal = false"> <MiaoMask v-model:show="showModal" @click="showModal = false">
<component <component @click="(e: any) => e.stopPropagation()" :is="modalData?.component" v-bind="modalData?.props">
@click="(e:any) => e.stopPropagation()" </component>
:is="modalData?.component"
v-bind="modalData?.props"></component>
</MiaoMask> </MiaoMask>
</template> </template>
@@ -246,6 +216,7 @@ $tag-width: 170px;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
span { span {
user-select: none; user-select: none;
cursor: pointer; cursor: pointer;
@@ -333,7 +304,7 @@ $tag-width: 170px;
.view-container-item { .view-container-item {
flex: 1; flex: 1;
height: 100%; height: 100%;
min-width: 200px; min-width: 180px;
} }
&::-webkit-scrollbar { &::-webkit-scrollbar {
@@ -363,6 +334,7 @@ $tag-width: 170px;
.view { .view {
.view-controller { .view-controller {
.tabs-container { .tabs-container {
.tab-move, .tab-move,
.tab-enter-active { .tab-enter-active {
transition: all 0.2s ease; transition: all 0.2s ease;
@@ -7,7 +7,7 @@
<div class="item-main-info"> <div class="item-main-info">
<div class="item-main-info-name"> <div class="item-main-info-name">
<Icon class="item-main-info-name-icon" v-if="clientWidth <= 250"></Icon> <Icon class="item-main-info-name-icon" v-if="clientWidth <= 250"></Icon>
<n-ellipsis style="max-width: 80%;">{{ name }}</n-ellipsis> <n-ellipsis :style="{ maxWidth: clientWidth > 250 ? '80%' : '75%' }">{{ name }}</n-ellipsis>
</div> </div>
<div class="item-main-info-date" v-if="time"> <div class="item-main-info-date" v-if="time">
{{ time }} {{ time }}
@@ -238,7 +238,7 @@ onMounted(() => {
.miao-item { .miao-item {
cursor: pointer; cursor: pointer;
width: calc(100% - 20px); width: calc(100% - 20px);
min-width: 170px; // min-width: 170px;
// aspect-ratio: 66/9; // aspect-ratio: 66/9;
height: 50px; height: 50px;
position: relative; position: relative;
@@ -3,15 +3,13 @@
backgroundColor: backgroundColor:
index % 2 === 0 ? '#f8f8f8' : 'rgb(240 240 240)' index % 2 === 0 ? '#f8f8f8' : 'rgb(240 240 240)'
}"> }">
<n-scrollbar ref="scrollbarRef"> <n-scrollbar ref="scrollbarRef" style="max-height: 100%;">
<miao-lazy-div v-for="(dir, index) in showData_directory" :key="dir.uid" :disableLazy="index < 20" <miao-lazy-div v-for="(dir, index) in showData_directory" :key="dir.uid" min-height="50px">
min-height="50px">
<miaoDirectoryItem :item="dir" :color="props.color" :selectedItem="selectedItem" <miaoDirectoryItem :item="dir" :color="props.color" :selectedItem="selectedItem"
@delete="handleItemDelete(dir)" @click="handleItemClick(dir)" @drag-start="handleItemDragStart" @delete="handleItemDelete(dir)" @click="handleItemClick(dir)" @drag-start="handleItemDragStart"
@rename="handleItemRename(dir)" @on-selected="handleItemSelect(dir)" /> @rename="handleItemRename(dir)" @on-selected="handleItemSelect(dir)" />
</miao-lazy-div> </miao-lazy-div>
<miao-lazy-div v-for="(file, index) in showData_files" :key="file.uid" :disableLazy="index < 20" <miao-lazy-div v-for="(file) in showData_files" :key="file.uid" min-height="50px">
min-height="50px">
<miaoDirectoryItem :item="file" :color="props.color" :selectedItem="selectedItem" <miaoDirectoryItem :item="file" :color="props.color" :selectedItem="selectedItem"
@click="handleItemClick(file)" @download="handleItemDownload(file)" @delete="handleItemDelete(file)" @click="handleItemClick(file)" @download="handleItemDownload(file)" @delete="handleItemDelete(file)"
@drag-start="handleItemDragStart" @rename="handleItemRename(file)" @drag-start="handleItemDragStart" @rename="handleItemRename(file)"
@@ -77,6 +75,7 @@ const handleItemSelect = (item: VirtualDirectory | VirtualFile) => {
<style scoped lang="scss"> <style scoped lang="scss">
.miao-directory-container-items { .miao-directory-container-items {
width: 100%; width: 100%;
height: calc(100% - 30px - 60px); flex: 1;
min-height: 0;
} }
</style> </style>
+5 -6
View File
@@ -1,9 +1,5 @@
<template> <template>
<div <div class="container" @dragover="handleDragOver" @dragleave="handleDragLeave" @drop="handleDrop">
class="container"
@dragover="handleDragOver"
@dragleave="handleDragLeave"
@drop="handleDrop">
<slot></slot> <slot></slot>
<miao-mask v-model:show="showMask"></miao-mask> <miao-mask v-model:show="showMask"></miao-mask>
</div> </div>
@@ -63,8 +59,11 @@ const removeDirectory = async (files: File[]) => {
} }
const handleDragOver = async (event: DragEvent) => { const handleDragOver = async (event: DragEvent) => {
showMask.value += 1
event.preventDefault() event.preventDefault()
if (showMask.value === 1) {
return
}
showMask.value = 1
} }
const handleDragLeave = async () => { const handleDragLeave = async () => {
+27 -4
View File
@@ -14,7 +14,7 @@
@item-drag-start="handleItemDragStart" @item-rename="handleItemRename" @item-select="handleItemSelect" /> @item-drag-start="handleItemDragStart" @item-rename="handleItemRename" @item-select="handleItemSelect" />
<!-- 底部工具栏 --> <!-- 底部工具栏 -->
<miao-directory-bottom :index="index" @add-new-item="handleAddNewItem" <miao-directory-bottom :index="index" @add-new-item="handleAddNewItem" v-if="false"
@pick-files-upload="handlePickFilesUpload" /> @pick-files-upload="handlePickFilesUpload" />
<miao-mask v-model:show="showModel"></miao-mask> <miao-mask v-model:show="showModel"></miao-mask>
@@ -44,8 +44,10 @@ import MiaoDropHandler from '@/components/miaoDropHandler.vue'
import { NIcon } from 'naive-ui' import { NIcon } from 'naive-ui'
import { import {
CloseOutline, SearchOutline, FilterOutline, CheckmarkDoneOutline, CloseOutline, SearchOutline, FilterOutline, CheckmarkDoneOutline,
DocumentText, DocumentText, ExtensionPuzzleOutline,
FileTray FileTray,
AddOutline,
CloudUploadOutline
} from '@vicons/ionicons5' } from '@vicons/ionicons5'
import usePluginCenter from '@/hooks/usePluginCenter' import usePluginCenter from '@/hooks/usePluginCenter'
@@ -145,6 +147,16 @@ const showData_files = computed<VirtualFile[]>(() => {
const topBarMenuOption = computed(() => { const topBarMenuOption = computed(() => {
return [ return [
{
label: '新建',
key: 'create',
icon: renderIcon(AddOutline)
},
{
label: '上传',
key: 'upload',
icon: renderIcon(CloudUploadOutline)
},
{ {
label: '搜索', label: '搜索',
key: 'search', key: 'search',
@@ -177,10 +189,17 @@ const topBarMenuOption = computed(() => {
], ],
icon: renderIcon(FilterOutline) icon: renderIcon(FilterOutline)
}, },
{
label: '插件',
key: 'plugin',
children: [
...pluginCenter.getUsablePlugin([currentDirectories.value[0]], []).map(v => ({ ...pluginCenter.getUsablePlugin([currentDirectories.value[0]], []).map(v => ({
label: `插件:${v.name}`, label: `${v.name}`,
key: `plugin:${v.key}` key: `plugin:${v.key}`
})), })),
],
icon: renderIcon(ExtensionPuzzleOutline)
},
{ {
label: '关闭', label: '关闭',
key: 'close', key: 'close',
@@ -242,6 +261,10 @@ const handleTopBarMenuSelect = (key: string) => {
emit('exit') emit('exit')
} else if (key === 'search') { } else if (key === 'search') {
handleSearch() handleSearch()
} else if (key === 'upload') {
handlePickFilesUpload()
} else if (key === 'create') {
handleAddNewItem()
} else if (key === 'searchReset') { } else if (key === 'searchReset') {
handleSearchReset() handleSearchReset()
} else if (key === 'selectedItemReset') { } else if (key === 'selectedItemReset') {