diff --git a/src/component/Admin/Entity/EntityRow.tsx b/src/component/Admin/Entity/EntityRow.tsx index b07be39..296bc37 100644 --- a/src/component/Admin/Entity/EntityRow.tsx +++ b/src/component/Admin/Entity/EntityRow.tsx @@ -50,8 +50,8 @@ const EntityRow = ({ dispatch(getEntityUrl(entity?.id ?? 0)) .then((url) => { - // window.location.assign(url); - window.open(url, "_blank"); + // 直接下载文件 + window.location.assign(url); }) .finally(() => { setOpenLoading(false); diff --git a/src/component/Admin/File/FileRow.tsx b/src/component/Admin/File/FileRow.tsx index dd56c6d..e623581 100644 --- a/src/component/Admin/File/FileRow.tsx +++ b/src/component/Admin/File/FileRow.tsx @@ -89,17 +89,8 @@ const FileRow = ({ // 可预览文件:新窗口打开预览,窗口保持显示预览内容 window.open(url, "_blank"); } else { - - // PlanA: - // 当前窗口下载(不跳转页面,直接下载链接) - // window.location.assign(url); - - // PlanB: - // 在新窗口打开下载链接 - // - 下载成功:浏览器自动关闭下载窗口 - // - 下载失败:窗口保持打开显示错误信息 - window.open(url, "_blank"); - + // 下载文件:当前窗口下载(不跳转页面,直接下载链接) + window.location.assign(url); } }) .finally(() => {