diff --git a/.env.production b/.env.production index 974a084..e0f5bec 100644 --- a/.env.production +++ b/.env.production @@ -2,6 +2,6 @@ VITE_API_URL= VITE_STORE_PREFIX=senmeshzc VITE_BASEPATH= VITE_APP_TITLE=森睿智传 -VITE_IS_INSIDE=true +VITE_IS_INSIDE=false VITE_DOMAIN= VITE_INIT_PASSWORD="Qaz123567!@#" \ No newline at end of file diff --git a/.gitignore b/.gitignore index a547bf3..4fff125 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ dist-ssr *.njsproj *.sln *.sw? +*.zip diff --git a/package.json b/package.json index c678853..1efb991 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "type": "module", "scripts": { "dev": "vite", - "build": "tsc -b && vite build", + "prod": "tsc -b && vite build", "lint": "eslint .", "preview": "vite preview" }, diff --git a/src/apis/file.ts b/src/apis/file.ts index df4ee91..9a98025 100644 --- a/src/apis/file.ts +++ b/src/apis/file.ts @@ -2,29 +2,35 @@ import { http, HTTP_CONTENT_TYPE } from "@/lib/http"; const baseUrl = import.meta.env.VITE_API_URL; -export enum RootType { +export const RootType = { // 1普通/2内穿外/3外传内/4我的分享 - MY = "1", - INSIDE = "2", - OUTSIDE = "3", - SHARE = "4", -} + MY: "1", + INSIDE: "2", + OUTSIDE: "3", + SHARE: "4", +} as const; -export enum FileStatus { +export type RootType = (typeof RootType)[keyof typeof RootType]; + +export const FileStatus = { // 1正常2失效11解析中12待审核13传输中14失败 - VALID = "1", - INVALID = "2", - PARSING = "11", - AUDITING = "12", - TRANSFERING = "13", - FAILED = "14", -} + VALID: "1", + INVALID: "2", + PARSING: "11", + AUDITING: "12", + TRANSFERING: "13", + FAILED: "14", +} as const; -export enum FileType { +export type FileStatus = (typeof FileStatus)[keyof typeof FileStatus]; + +export const FileType = { // 1文件/2目录 - FILE = "1", - DIRECTORY = "2", -} + FILE: "1", + DIRECTORY: "2", +} as const; + +export type FileType = (typeof FileType)[keyof typeof FileType]; // 获取文件下载地址 export const getFileUrl = (code?: string, appendBaseUrl = true) => { diff --git a/src/components/data-table.tsx b/src/components/data-table.tsx index 8454ef6..fc48752 100644 --- a/src/components/data-table.tsx +++ b/src/components/data-table.tsx @@ -36,7 +36,7 @@ export function DataTable({ ? null : flexRender( header.column.columnDef.header, - header.getContext() + header.getContext(), )} ); diff --git a/src/components/move-file-dialog.tsx b/src/components/move-file-dialog.tsx index cfbd4e0..468005c 100644 --- a/src/components/move-file-dialog.tsx +++ b/src/components/move-file-dialog.tsx @@ -9,7 +9,7 @@ import { } from "@/components/ui/dialog"; import { Spinner } from "@/components/ui/spinner"; import { FileType, getFilePage } from "@/apis/file"; -import { Folder, FolderInput, CircleAlert, MoveRight } from "lucide-react"; +import { Folder, FolderInput, MoveRight } from "lucide-react"; import clsx from "clsx"; import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"; import { DirectoryBreadcrumb } from "@/components/directory-breadcrumb"; @@ -66,7 +66,7 @@ export function MoveFileDialog({ // 选中行 const [rowSelection, setRowSelection] = useState({}); // 当前打开的目录层级 - const [openDirectorys, setOpenDirectorys] = useState([]); + const [openDirectorys, setOpenDirectorys] = useState([]); // 文件目录ID const [parentId, setParentId] = useState(0); // 分页 @@ -213,7 +213,6 @@ export function MoveFileDialog({ - 您确定要将{data?.fileType === FileType.DIRECTORY ? "目录" : "文件"} 移动到该目录下吗? diff --git a/src/routes/(user)/my/index.tsx b/src/routes/(user)/my/index.tsx index c5048e7..75e4666 100644 --- a/src/routes/(user)/my/index.tsx +++ b/src/routes/(user)/my/index.tsx @@ -5,7 +5,6 @@ import { Folder, FolderPlus, FolderInput, - Eye, } from "lucide-react"; import { Button } from "@/components/ui/button"; import { EditFileDialog } from "./-components/EditFileDialog"; diff --git a/src/routes/(user)/recycle/-components/BatchRemoveConfirmDialog.tsx b/src/routes/(user)/recycle/-components/BatchRemoveConfirmDialog.tsx index 2bd62f6..0344b3c 100644 --- a/src/routes/(user)/recycle/-components/BatchRemoveConfirmDialog.tsx +++ b/src/routes/(user)/recycle/-components/BatchRemoveConfirmDialog.tsx @@ -10,6 +10,7 @@ import { } from "@/components/ui/dialog"; import { Spinner } from "@/components/ui/spinner"; import { useBatchRemoveFile } from "../-hooks/useBatchRemoveFile"; +import { toast } from "sonner"; type BatchRemoveConfirmDialogProps = { open: boolean; @@ -32,6 +33,10 @@ export function BatchRemoveConfirmDialog({ }); const onSubmit = () => { + if (!ids?.length) { + toast("请至少选择一个文件/目录"); + return; + } batchRemove(ids); }; diff --git a/src/routes/(user)/recycle/-hooks/useBatchRemoveFile.ts b/src/routes/(user)/recycle/-hooks/useBatchRemoveFile.ts index 625f640..0c5f9bd 100644 --- a/src/routes/(user)/recycle/-hooks/useBatchRemoveFile.ts +++ b/src/routes/(user)/recycle/-hooks/useBatchRemoveFile.ts @@ -6,7 +6,7 @@ export const useBatchRemoveFile = (mutationOptions?: any) => { const { mutateAsync: batchRemoveMutateAsync, isPending: batchRemoveIsPending, - } = useMutation({ + } = useMutation({ mutationFn: removeFileByIds, ...(mutationOptions || {}), }); diff --git a/src/routes/(user)/recycle/-hooks/useRecoverFile.ts b/src/routes/(user)/recycle/-hooks/useRecoverFile.ts index 906bda2..b9b51bf 100644 --- a/src/routes/(user)/recycle/-hooks/useRecoverFile.ts +++ b/src/routes/(user)/recycle/-hooks/useRecoverFile.ts @@ -4,7 +4,7 @@ import { toast } from "sonner"; export const useRecoverFile = (mutationOptions?: any) => { const { mutateAsync: recoverMutateAsync, isPending: recoverIsPending } = - useMutation({ + useMutation({ mutationFn: recoverFile, ...(mutationOptions || {}), }); diff --git a/src/routes/(user)/recycle/-hooks/useRemoveFile.ts b/src/routes/(user)/recycle/-hooks/useRemoveFile.ts index 3554ed5..1d51986 100644 --- a/src/routes/(user)/recycle/-hooks/useRemoveFile.ts +++ b/src/routes/(user)/recycle/-hooks/useRemoveFile.ts @@ -4,7 +4,7 @@ import { toast } from "sonner"; export const useRemoveFile = (mutationOptions?: any) => { const { mutateAsync: removeMutateAsync, isPending: removeIsPending } = - useMutation({ + useMutation({ mutationFn: removeFile, ...(mutationOptions || {}), }); diff --git a/src/routes/(user)/recycle/index.tsx b/src/routes/(user)/recycle/index.tsx index e1466b7..347805d 100644 --- a/src/routes/(user)/recycle/index.tsx +++ b/src/routes/(user)/recycle/index.tsx @@ -30,7 +30,7 @@ export function useColumns({ return [ { id: "select", - header: ({ table }) => ( + header: ({ table }: any) => ( table.toggleAllPageRowsSelected(!!value)} /> ), - cell: ({ row }) => ( + cell: ({ row }: any) => ( row.toggleSelected(!!value)} @@ -206,7 +206,7 @@ function RouteComponent() { setOpen={setOpenBatchRemoveConfirmDialog} ids={table .getFilteredSelectedRowModel() - .rows.map((row) => row.original.id)} + .rows.map((row: any) => row.original.id)} refetch={query.refetch} /> - + 风险预警设置 diff --git a/src/routes/admin/console/-components/ManualCreateRiskRule.tsx b/src/routes/admin/console/-components/ManualCreateRiskRule.tsx index 13e076f..b23470c 100644 --- a/src/routes/admin/console/-components/ManualCreateRiskRule.tsx +++ b/src/routes/admin/console/-components/ManualCreateRiskRule.tsx @@ -119,7 +119,7 @@ export function ManualCreateRiskRule({ onSubmit, loading, onClose }: any) { 内容示例 -