🔨 Refactor: refactored the import section of the code

This commit is contained in:
萌萌哒赫萝
2023-08-07 01:36:27 -07:00
parent 33b36d63c6
commit cb131d5250
64 changed files with 778 additions and 195 deletions
+48 -4
View File
@@ -1408,16 +1408,37 @@ https://www.baidu.com/img/bd_logo1.png"
</template>
<script lang="tsx" setup>
// Vue 相关
import { ref, reactive, watch, onBeforeMount, computed, onBeforeUnmount } from 'vue'
// Vue Router 相关
import { useRoute } from 'vue-router'
// Element Plus 图标
import { InfoFilled, Grid, Fold, Close, Folder, FolderAdd, Upload, CircleClose, Loading, CopyDocument, Edit, DocumentAdd, Link, Refresh, ArrowRight, HomeFilled, Document, Coin, Download, DeleteFilled, Sort, FolderOpened } from '@element-plus/icons-vue'
// 状态管理相关
import { useManageStore } from '../store/manageStore'
// 工具函数
import { customRenameFormatTable, customStrMatch, customStrReplace, renameFile, formatLink, formatFileName, getFileIconPath, formatFileSize, getExtension, isValidUrl, svg } from '../utils/common'
// 静态工具函数
import { cancelDownloadLoadingFileList, refreshDownloadFileTransferList } from '../utils/static'
// Electron 相关
import { ipcRenderer, clipboard, IpcRendererEvent } from 'electron'
// 数据库操作
import { fileCacheDbInstance } from '../store/bucketFileDb'
// 工具函数
import { trimPath } from '~/main/manage/utils/common'
// Axios
import axios from 'axios'
// Element Plus 组件
import {
ElMessage, ElMessageBox, ElNotification,
ElButton,
@@ -1434,19 +1455,42 @@ import {
ElTag,
ElCard
} from 'element-plus'
// 类型声明
import type { Column, RowClassNameGetter } from 'element-plus'
// 状态管理相关
import { useFileTransferStore, useDownloadFileTransferStore } from '@/manage/store/manageStore'
// UUID
import { v4 as uuidv4 } from 'uuid'
// 路径处理库
import path from 'path'
import { IUploadTask, IDownloadTask } from '~/main/manage/datastore/upDownTaskQueue'
// 文件系统库
import fs from 'fs-extra'
// 数据发送工具函数
import { getConfig, saveConfig } from '../utils/dataSender'
// Markdown 解析库
import { marked } from 'marked'
// 文本文件扩展名列表
import { textFileExt } from '../utils/textfile'
// 视频文件扩展名列表
import { videoExt } from '../utils/videofile'
// 组件
import ImageWebdav from '@/components/ImageWebdav.vue'
// 国际化函数
import { T as $T } from '@/i18n'
import { IUploadTask, IDownloadTask } from '~/main/manage/datastore/upDownTaskQueue'
/*
configMap:{
prefix: string, -> baseDir
@@ -2408,7 +2452,7 @@ async function handleFolderBatchDownload (item: any) {
Location: configMap.bucketConfig.Location
},
paging: paging.value,
prefix: `/${item.key.replace(/\/+$/, '').replace(/^\/+/, '')}/`,
prefix: `/${item.key.replace(/^\/+|\/+$/, '')}/`,
marker: pagingMarker.value,
itemsPerPage: itemsPerPage.value,
customUrl: currentCustomUrl.value,
@@ -2443,7 +2487,7 @@ async function handleFolderBatchDownload (item: any) {
bucketName: configMap.bucketName,
region: configMap.bucketConfig.Location,
key: item.key,
fileName: [undefined, true].includes(manageStore.config.settings.isDownloadFolderKeepDirStructure) ? `/${item.key.replace(/\/+$/, '').replace(/^\/+/, '')}` : item.fileName,
fileName: [undefined, true].includes(manageStore.config.settings.isDownloadFolderKeepDirStructure) ? `/${item.key.replace(/^\/+|\/+$/, '')}` : item.fileName,
customUrl: currentCustomUrl.value,
downloadUrl: item.downloadUrl,
githubUrl: item.url,
@@ -2486,7 +2530,7 @@ async function handleBatchDownload () {
bucketName: configMap.bucketName,
region: configMap.bucketConfig.Location,
key: item.key,
fileName: manageStore.config.settings.isDownloadFileKeepDirStructure ? `/${item.key.replace(/\/+$/, '').replace(/^\/+/, '')}` : item.fileName,
fileName: manageStore.config.settings.isDownloadFileKeepDirStructure ? `/${item.key.replace(/^\/+|\/+$/, '')}` : item.fileName,
customUrl: currentCustomUrl.value,
downloadUrl: item.downloadUrl,
githubUrl: item.url,
+23
View File
@@ -258,17 +258,40 @@
</template>
<script lang="ts" setup>
// Vue 相关
import { reactive, ref, onMounted, computed } from 'vue'
// 支持的图床列表
import { supportedPicBedList } from '../utils/constants'
// Element Plus 图标
import { Delete, Edit, Pointer, InfoFilled } from '@element-plus/icons-vue'
// Element Plus 消息组件
import { ElMessage, ElNotification } from 'element-plus'
// 数据发送工具函数
import { getConfig, saveConfig, removeConfig } from '../utils/dataSender'
// Electron 相关
import { shell } from 'electron'
// Vue Router 相关
import { useRouter } from 'vue-router'
// 状态管理相关
import { useManageStore } from '../store/manageStore'
// 工具函数
import { formObjToTableData, svg } from '../utils/common'
// 数据发送工具函数
import { getConfig as getPicBedsConfig } from '@/utils/dataSender'
// 端点地址格式化
import { formatEndpoint } from '~/main/manage/utils/common'
// 国际化函数
import { T as $T } from '@/i18n'
const activeName = ref('login')
+19
View File
@@ -273,15 +273,34 @@
</template>
<script lang="ts" setup>
// Vue 相关
import { ref, reactive, computed, onBeforeMount, watch } from 'vue'
// Electron 相关
import { shell } from 'electron'
// 支持的图床列表
import { supportedPicBedList } from '../utils/constants'
// Element Plus 图标
import { CirclePlus, SuccessFilled, Folder, Switch, Tools, ChromeFilled, HomeFilled, FolderOpened } from '@element-plus/icons-vue'
// Vue Router 相关
import { useRouter, useRoute } from 'vue-router'
// Element Plus 通知组件
import { ElNotification } from 'element-plus'
// 数据发送工具函数
import { invokeToMain } from '../utils/dataSender'
// 新建图床配置
import { newBucketConfig } from '../utils/newBucketConfig'
// 状态管理相关
import { useManageStore } from '../store/manageStore'
// 国际化函数
import { T as $T } from '@/i18n'
const manageStore = useManageStore() as any
@@ -513,14 +513,29 @@
</template>
<script lang="ts" setup>
// Element Plus 图标
import { InfoFilled, Folder } from '@element-plus/icons-vue'
// Vue 相关
import { ref, reactive, onBeforeMount, watch, onBeforeUnmount } from 'vue'
// 数据发送工具函数
import { getConfig, saveConfig, invokeToMain } from '../utils/dataSender'
// Element Plus 消息组件
import { ElMessage } from 'element-plus'
// 状态管理相关
import { useManageStore } from '../store/manageStore'
import { fileCacheDbInstance } from '../store/bucketFileDb'
// 工具函数
import { formatFileSize, customRenameFormatTable } from '../utils/common'
// 国际化函数
import { T as $T } from '@/i18n'
// 静态路径选择
import { selectDownloadFolder } from '../utils/static'
const manageStore = useManageStore()
+11
View File
@@ -1,8 +1,19 @@
// UUID
import { v4 as uuidv4 } from 'uuid'
// 路径处理库
import path from 'path'
// 加密库
import crypto from 'crypto'
// 可用图标列表
import { availableIconList } from './icon'
// 数据发送工具函数
import { getConfig } from './dataSender'
// 工具函数
import { handleUrlEncode } from '~/universal/utils/common'
export function randomStringGenerator (length: number): string {