feat:修改下载

This commit is contained in:
lixg
2023-03-03 16:09:55 +08:00
parent b14f26053e
commit 3ac0659c55
5 changed files with 82 additions and 10 deletions

View File

@@ -418,7 +418,23 @@ const handleClick = (tab, event) => {
console.log("附件", tab, event); console.log("附件", tab, event);
}; };
const download = (url) => { const download = (url) => {
window.open(url); console.log("url", url);
let urlNew = url.slice(1);
console.log(
"url2",
window.location.protocol +
import.meta.env.VITE_BOE_API_URL +
import.meta.env.VITE_FILE_PATH +
urlNew
);
if (urlNew) {
window.open(
window.location.protocol +
import.meta.env.VITE_BOE_API_URL +
import.meta.env.VITE_FILE_PATH +
urlNew
);
}
}; };
const downloads = (url) => { const downloads = (url) => {
ElMessage.warning("未到开始时间,请耐心等待!"); ElMessage.warning("未到开始时间,请耐心等待!");

View File

@@ -180,13 +180,22 @@ const handleClick = (tab, event) => {
console.log("附件", tab, event); console.log("附件", tab, event);
}; };
const download = (url) => { const download = (url) => {
let urlNew = url.slice(1);
console.log( console.log(
"下载url", "url2",
import.meta.env.VITE_FILE_PATH, window.location.protocol +
process.env.VITE_FILE_PATH, import.meta.env.VITE_BOE_API_URL +
url import.meta.env.VITE_FILE_PATH +
urlNew
); );
window.open(import.meta.env.VITE_FILE_PATH + url); if (urlNew) {
window.open(
window.location.protocol +
import.meta.env.VITE_BOE_API_URL +
import.meta.env.VITE_FILE_PATH +
urlNew
);
}
}; };
const downloads = (url) => { const downloads = (url) => {
ElMessage.warning("未在有效时间范围内,请耐心等待!"); ElMessage.warning("未在有效时间范围内,请耐心等待!");

View File

@@ -184,7 +184,22 @@ const handleClick = (tab, event) => {
console.log("附件", tab, event); console.log("附件", tab, event);
}; };
const download = (url) => { const download = (url) => {
window.open(import.meta.env.VITE_FILE_PATH + url); let urlNew = url.slice(1);
console.log(
"url2",
window.location.protocol +
import.meta.env.VITE_BOE_API_URL +
import.meta.env.VITE_FILE_PATH +
urlNew
);
if (urlNew) {
window.open(
window.location.protocol +
import.meta.env.VITE_BOE_API_URL +
import.meta.env.VITE_FILE_PATH +
urlNew
);
}
}; };
const downloads = (url) => { const downloads = (url) => {
ElMessage.warning("未在有效时间范围内,请耐心等待!"); ElMessage.warning("未在有效时间范围内,请耐心等待!");

View File

@@ -193,7 +193,23 @@ const handleClick = (tab, event) => {
console.log("附件", tab, event); console.log("附件", tab, event);
}; };
const download = (url) => { const download = (url) => {
window.open(import.meta.env.VITE_FILE_PATH + url); // window.open(import.meta.env.VITE_FILE_PATH + url);
let urlNew = url.slice(1);
console.log(
"url2",
window.location.protocol +
import.meta.env.VITE_BOE_API_URL +
import.meta.env.VITE_FILE_PATH +
urlNew
);
if (urlNew) {
window.open(
window.location.protocol +
import.meta.env.VITE_BOE_API_URL +
import.meta.env.VITE_FILE_PATH +
urlNew
);
}
}; };
let timer = null; let timer = null;

View File

@@ -2,7 +2,7 @@
* @Author: lixg lixg@dongwu-inc.com * @Author: lixg lixg@dongwu-inc.com
* @Date: 2023-01-13 11:42:48 * @Date: 2023-01-13 11:42:48
* @LastEditors: lixg lixg@dongwu-inc.com * @LastEditors: lixg lixg@dongwu-inc.com
* @LastEditTime: 2023-03-02 13:55:02 * @LastEditTime: 2023-03-03 15:06:24
* @FilePath: /stu_h5/src/views/filestorag/fileStorag.vue * @FilePath: /stu_h5/src/views/filestorag/fileStorag.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
--> -->
@@ -108,7 +108,23 @@ const fileList = computed(() =>
); );
//下载 //下载
function downloadFile(url) { function downloadFile(url) {
window.open(import.meta.env.VITE_FILE_PATH + url); // window.open(import.meta.env.VITE_FILE_PATH + url);
let urlNew = url.slice(1);
console.log(
"url2",
window.location.protocol +
import.meta.env.VITE_BOE_API_URL +
import.meta.env.VITE_FILE_PATH +
urlNew
);
if (urlNew) {
window.open(
window.location.protocol +
import.meta.env.VITE_BOE_API_URL +
import.meta.env.VITE_FILE_PATH +
urlNew
);
}
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>