| | |
| | | }) |
| | | .then(() => { |
| | | router.push(`/login?redirect=${route.fullPath}`); |
| | | }) |
| | | .catch(() => { |
| | | tagsViewStore.delAllViews(); |
| | | router.push(`/login?redirect=${route.fullPath}`); |
| | | }); |
| | | }); |
| | | } |
| | |
| | | resolve(); |
| | | }) |
| | | .catch((error) => { |
| | | clearSessionAndCache(); |
| | | reject(error); |
| | | }); |
| | | }); |
| | |
| | | function downloadFile(url: string) { |
| | | function downloadFile(url: string, fileName: string) { |
| | | return new Promise<void>((resolve, reject) => { |
| | | let baseUrl = ""; |
| | | if (process.env.NODE_ENV === "development") { |
| | |
| | | // 1. 预检文件是否存在 |
| | | fetch(link.href, { method: "HEAD" }) |
| | | .then(() => { |
| | | link.download = "文件"; |
| | | link.download = fileName; |
| | | document.body.appendChild(link); // 添加到 DOM |
| | | link.click(); |
| | | window.URL.revokeObjectURL(url); |
| | |
| | | if (!formEl) return; |
| | | formEl.validate((valid, fields) => { |
| | | if (valid) { |
| | | downloadFile(props.data.fileUrl) |
| | | downloadFile(props.data.fileUrl, props.data.fileName) |
| | | .then(() => { |
| | | ElMessage({ |
| | | message: "下载成功!!!", |