提交 bb40d5b1 authored 作者: 王鹏飞's avatar 王鹏飞

chore(课程资料): 修改下载资料的文件名称

上级 d7e57293
......@@ -19,6 +19,7 @@
"cross-env": "^7.0.3",
"echarts": "^5.0.2",
"element-ui": "^2.15.1",
"file-saver": "^2.0.5",
"js-cookie": "^2.2.1",
"lodash": "^4.17.21",
"qrcode.vue": "^1.7.0",
......@@ -5575,6 +5576,11 @@
"node": ">= 10.13.0"
}
},
"node_modules/file-saver": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/file-saver/-/file-saver-2.0.5.tgz",
"integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA=="
},
"node_modules/file-uri-to-path": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
......@@ -18335,6 +18341,11 @@
}
}
},
"file-saver": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/file-saver/-/file-saver-2.0.5.tgz",
"integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA=="
},
"file-uri-to-path": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
......
......@@ -83,6 +83,7 @@
"cross-env": "^7.0.3",
"echarts": "^5.0.2",
"element-ui": "^2.15.1",
"file-saver": "^2.0.5",
"js-cookie": "^2.2.1",
"lodash": "^4.17.21",
"qrcode.vue": "^1.7.0",
......
......@@ -2,12 +2,12 @@
<div>
<ul class="file-list" v-if="currentFiles.length">
<li class="file-list-item" v-for="file in currentFiles" :key="file.id">
<a :href="file.file_url" target="_blank">
<a href="javascript:;" :download="file.file_name" @click="downloadFile(file)">
<i class="el-icon-document"></i>
<div class="file-list-item__inner" v-html="file.file_name"></div>
</a>
<!-- <span v-if="file.file_size">{{ file.file_size }}</span> -->
<a :href="file.file_url" :download="file.file_name" target="_blank">
<a href="javascript:;" :download="file.file_name" @click="downloadFile(file)">
<el-tooltip effect="dark" :content="$t('viewerRead.download')">
<i class="el-icon-download"></i>
</el-tooltip>
......@@ -21,6 +21,7 @@
</template>
<script>
import { saveAs } from 'file-saver'
export default {
name: 'FilePanel',
props: {
......@@ -41,6 +42,12 @@ export default {
return file
})
}
},
methods: {
// 下载文件
downloadFile(file) {
saveAs(file.file_url, file.file_name)
}
}
}
</script>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论