master
lion 4 months ago
parent c383c97ef6
commit 2b9eeeb28b

@ -17,3 +17,12 @@ export function userListNoAuth(params) {
isLoading: false
})
}
export function downLoadFile(params) {
return request({
url: '/api/download-file',
method: 'get',
params:params,
noloading: true
})
}

@ -28,7 +28,8 @@
<script>
import { PopupManager } from "element-ui/lib/utils/popup";
import {defaultModalSize} from "@/settings";
import {downLoadFile} from "@/api/common.js"
import { getToken } from '@/utils/auth'
export default {
data() {
return {
@ -45,6 +46,13 @@ export default {
this.$nextTick(() => {
this.$refs.iframe.contentWindow.location.replace(`${window.location.origin}/admin/#/preview?url=${url}`)
})
},
async download(id){
// const res = await downLoadFile({
// id:id
// })
let url = `${window.location.origin}/api/download-file?id=${id}&token=${window.encodeURIComponent(getToken())}`
window.open(url,'_blank')
}
},
computed: {},
@ -59,9 +67,11 @@ export default {
},
created() {
this.$bus.$on('online-file',(url) => this.open(url))
this.$bus.$on('online-download',(id) => this.download(id))
},
beforeDestroy() {
this.$bus.$off('online-file')
this.$bus.$off('online-download')
}
}
</script>

@ -1024,10 +1024,11 @@ export default function formBuilder(
padding: "0 4px",
color:'blue'
},
attrs:{
href:file.url,
target:"_blank"
}
on: {
click: (_) => {
this.$bus.$emit("online-download", file.id);
},
},
},
'下载'
),
@ -1804,10 +1805,11 @@ export default function formBuilder(
padding: "0 4px",
color:'blue'
},
attrs:{
href:file.url,
target:"_blank"
}
on: {
click: (_) => {
this.$bus.$emit("online-download", file.id);
},
},
},
'下载'
),

Loading…
Cancel
Save