工具下载

This commit is contained in:
nisen
2023-09-05 15:07:37 +08:00
parent 5f4fc5d2e8
commit fa6a926ffd

View File

@@ -75,20 +75,21 @@ export default {
}, },
downLoad(toolInfo) { downLoad(toolInfo) {
console.log(toolInfo); console.log(toolInfo);
toolDown({ window.open(`/activityApi/xboe/m/boe/tools/url/download?urlStr=${process.env.VUE_APP_BOE_WEB_URL}/upload${toolInfo.filePath}&fileName=${toolInfo.name}`)
urlStr: `${process.env.VUE_APP_BOE_WEB_URL}/upload${toolInfo.filePath}`, // toolDown({
fileName: toolInfo.name // urlStr: `${process.env.VUE_APP_BOE_WEB_URL}/upload${toolInfo.filePath}`,
}).then((result) => { // fileName: toolInfo.name
const link = document.createElement('a');// 创建a标签 // }).then((result) => {
let blob = new Blob([result.data], { type: '' }); // 设置文件类型 // const link = document.createElement('a');// 创建a标签
link.style.display = "none"; // let blob = new Blob([result.data], { type: '' }); // 设置文件类型
link.href = URL.createObjectURL(blob); // 创建URL // link.style.display = "none";
link.setAttribute("download", `${toolInfo.name}`); // link.href = URL.createObjectURL(blob); // 创建URL
document.body.appendChild(link); // link.setAttribute("download", `${toolInfo.name}`);
link.click(); // document.body.appendChild(link);
URL.revokeObjectURL(link.href); // link.click();
document.body.removeChild(link); // URL.revokeObjectURL(link.href);
}) // document.body.removeChild(link);
// })
}, },
getPic(index) { getPic(index) {
return this.webBaseUrl + "/images/listblue0" + (index + 1) + ".png"; return this.webBaseUrl + "/images/listblue0" + (index + 1) + ".png";
@@ -105,9 +106,10 @@ export default {
}; };
</script> </script>
<style scoped lang='scss'> <style scoped lang='scss'>
.nav:hover{ .nav:hover {
color: #387DF7; color: #387DF7;
} }
.toolBanner { .toolBanner {
width: 100%; width: 100%;
height: 240px; height: 240px;